Can change music position from cursor

This commit is contained in:
Pierre HUBERT 2022-03-24 11:56:21 +01:00
parent b11eb6063c
commit 545d9a951f

View File

@ -95,6 +95,8 @@ class _MusicPlayerState extends State<MusicPlayer> {
await _play(); await _play();
} }
void _updatePosition(Duration d) => _videoPlayerController?.seekTo(d);
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
@ -168,7 +170,9 @@ class _MusicPlayerState extends State<MusicPlayer> {
fluent.Slider( fluent.Slider(
max: _duration?.inSeconds as double? ?? 0, max: _duration?.inSeconds as double? ?? 0,
value: _position?.inSeconds as double? ?? 0, value: _position?.inSeconds as double? ?? 0,
onChanged: (d) => {}, onChanged: (d) => _updatePosition(Duration(seconds: d.toInt())),
label:
"${_position?.inMinutes.toString().padLeft(2, '0')} : ${((_position?.inSeconds ?? 0) % 60).toString().padLeft(2, '0')}",
), ),
const fluent.SizedBox(height: 40), const fluent.SizedBox(height: 40),
fluent.Row( fluent.Row(