chore: Follow up audioplayer
This commit is contained in:
parent
6a220ffb4b
commit
d4fb0ce1a7
1 changed files with 19 additions and 15 deletions
|
|
@ -245,8 +245,9 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
if (waveform != null)
|
if (waveform != null)
|
||||||
Padding(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
height: 40,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
for (var i = 0; i < waveform.length; i++)
|
for (var i = 0; i < waveform.length; i++)
|
||||||
|
|
@ -257,28 +258,31 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
color: widget.color.withAlpha(64),
|
color: widget.color.withAlpha(64),
|
||||||
borderRadius: BorderRadius.circular(2),
|
borderRadius: BorderRadius.circular(2),
|
||||||
),
|
),
|
||||||
height: 32 * (waveform[i] / 1024),
|
height: 56 * (waveform[i] / 1024),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
if (audioPlayer != null)
|
||||||
height: 28,
|
SizedBox(
|
||||||
child: Slider.adaptive(
|
height: 40,
|
||||||
value: currentPosition,
|
child: Slider(
|
||||||
min: 0,
|
activeColor: widget.color,
|
||||||
max: maxPosition,
|
thumbColor: widget.color,
|
||||||
onChangeStart: (_) => audioPlayer?.pause(),
|
value: currentPosition,
|
||||||
onChangeEnd: (_) => audioPlayer?.play(),
|
min: 0,
|
||||||
onChanged: (pos) => audioPlayer?.seek(
|
max: maxPosition,
|
||||||
Duration(
|
onChangeStart: (_) => audioPlayer.pause(),
|
||||||
milliseconds: pos.round(),
|
onChangeEnd: (_) => audioPlayer.play(),
|
||||||
|
onChanged: (pos) => audioPlayer.seek(
|
||||||
|
Duration(
|
||||||
|
milliseconds: pos.round(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue