Add slider
This commit is contained in:
parent
30aa018bed
commit
aa3f743eee
@ -26,7 +26,11 @@ class _MusicPlayerState extends State<MusicPlayer> {
|
|||||||
VideoPlayerController? _videoPlayerController;
|
VideoPlayerController? _videoPlayerController;
|
||||||
ChewieAudioController? _chewieAudioController;
|
ChewieAudioController? _chewieAudioController;
|
||||||
|
|
||||||
bool get _isPlaying => _chewieAudioController?.isPlaying ?? false;
|
bool get _isPlaying => _videoPlayerController?.value.isPlaying ?? false;
|
||||||
|
|
||||||
|
Duration? get _duration => _videoPlayerController?.value.duration;
|
||||||
|
|
||||||
|
Duration? get _position => _videoPlayerController?.value.position;
|
||||||
|
|
||||||
final List<MusicEntry> stack = [];
|
final List<MusicEntry> stack = [];
|
||||||
int currMusicPos = 0;
|
int currMusicPos = 0;
|
||||||
@ -54,9 +58,9 @@ class _MusicPlayerState extends State<MusicPlayer> {
|
|||||||
videoPlayerController: _videoPlayerController!,
|
videoPlayerController: _videoPlayerController!,
|
||||||
autoPlay: true,
|
autoPlay: true,
|
||||||
showControls: false);
|
showControls: false);
|
||||||
}
|
|
||||||
|
|
||||||
setState(() {});
|
_videoPlayerController!.addListener(() => setState(() {}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _stop() async {
|
Future<void> _stop() async {
|
||||||
@ -69,7 +73,6 @@ class _MusicPlayerState extends State<MusicPlayer> {
|
|||||||
|
|
||||||
void _pause() async {
|
void _pause() async {
|
||||||
await _chewieAudioController?.pause();
|
await _chewieAudioController?.pause();
|
||||||
setState(() {});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _playPrevious() async {
|
void _playPrevious() async {
|
||||||
@ -154,6 +157,12 @@ class _MusicPlayerState extends State<MusicPlayer> {
|
|||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Text(currMusic.artist, textAlign: TextAlign.center),
|
Text(currMusic.artist, textAlign: TextAlign.center),
|
||||||
const fluent.SizedBox(height: 40),
|
const fluent.SizedBox(height: 40),
|
||||||
|
fluent.Slider(
|
||||||
|
max: _duration?.inSeconds as double? ?? 0,
|
||||||
|
value: _position?.inSeconds as double? ?? 0,
|
||||||
|
onChanged: (d) => {},
|
||||||
|
),
|
||||||
|
const fluent.SizedBox(height: 40),
|
||||||
fluent.Row(
|
fluent.Row(
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
IconButton(
|
||||||
|
Loading…
Reference in New Issue
Block a user