Skip to content

Commit 63a4448

Browse files
committed
fix(timeline): Only allows seek between bounds
1 parent 3441175 commit 63a4448

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/screens/events_timeline/desktop/timeline.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,13 @@ class Timeline extends ChangeNotifier {
359359
DateTime get currentDate => date.add(currentPosition);
360360

361361
void seekTo(Duration position) {
362-
currentPosition = position;
362+
if (position < Duration.zero) {
363+
currentPosition = Duration.zero;
364+
} else if (position > endPosition) {
365+
currentPosition = endPosition;
366+
} else {
367+
currentPosition = position;
368+
}
363369
notifyListeners();
364370

365371
forEachEvent((tile, event) async {
@@ -375,8 +381,6 @@ class Timeline extends ChangeNotifier {
375381
});
376382
}
377383

378-
// TODO(bdlukaa): Only make it possible to seek between bounds.
379-
// Currently, is is possible to seek before and after the day.
380384
/// Seeks forward by [duration]
381385
void seekForward([Duration duration = const Duration(seconds: 15)]) =>
382386
seekTo(currentPosition + duration);

0 commit comments

Comments
 (0)