Skip to content

Commit 2836461

Browse files
committed
fix: isFinished is true only if initialized else false
1 parent a4b0233 commit 2836461

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/src/material/material_controls.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ class _MaterialControlsState extends State<MaterialControls>
364364
}
365365

366366
Widget _buildHitArea() {
367-
final bool isFinished = _latestValue.position >= _latestValue.duration;
367+
final bool isFinished = (_latestValue.position >= _latestValue.duration) &&
368+
_latestValue.duration.inSeconds > 0;
368369
final bool showPlayButton =
369370
widget.showPlayButton && !_dragging && !notifier.hideStuff;
370371

@@ -519,7 +520,8 @@ class _MaterialControlsState extends State<MaterialControls>
519520
}
520521

521522
void _playPause() {
522-
final isFinished = _latestValue.position >= _latestValue.duration;
523+
final bool isFinished = (_latestValue.position >= _latestValue.duration) &&
524+
_latestValue.duration.inSeconds > 0;
523525

524526
setState(() {
525527
if (controller.value.isPlaying) {

0 commit comments

Comments
 (0)