Skip to content

Commit

Permalink
Update the skip and back forward feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
nusjose committed Jun 19, 2024
1 parent 20c1573 commit 43add1f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/src/cupertino/cupertino_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -886,8 +886,13 @@ class _CupertinoControlsState extends State<CupertinoControls>
Future<void> _skipBack() async {
_cancelAndRestartTimer();
final beginning = Duration.zero.inMilliseconds;
final timeSkip =
(_latestValue.position - const Duration(seconds: 15)).inMilliseconds;

final start = widget.showCustomProgressBar
? _latestValue.position -
(widget.startDuration ?? const Duration(seconds: 0))
: _latestValue.position;

final timeSkip = (start - const Duration(seconds: 15)).inMilliseconds;

final skip = (timeSkip <=
(widget.startDuration ?? const Duration(seconds: 0)).inMilliseconds
Expand All @@ -908,8 +913,12 @@ class _CupertinoControlsState extends State<CupertinoControls>
? (widget.endDuration ?? _latestValue.duration).inMilliseconds
: _latestValue.duration.inMilliseconds;

final timeSkip =
(_latestValue.position + const Duration(seconds: 15)).inMilliseconds;
final start = widget.showCustomProgressBar
? _latestValue.position -
(widget.startDuration ?? const Duration(seconds: 0))
: _latestValue.position;

final timeSkip = (start + const Duration(seconds: 15)).inMilliseconds;

final skip = (timeSkip >= end ? end : timeSkip);
await controller.seekTo(Duration(milliseconds: math.min(skip, end)));
Expand Down

0 comments on commit 43add1f

Please sign in to comment.