diff --git a/lib/src/model/over_the_board/over_the_board_clock.dart b/lib/src/model/over_the_board/over_the_board_clock.dart index 248f7dc38a..475b247c88 100644 --- a/lib/src/model/over_the_board/over_the_board_clock.dart +++ b/lib/src/model/over_the_board/over_the_board_clock.dart @@ -93,6 +93,16 @@ class OverTheBoardClock extends _$OverTheBoardClock { state = state.copyWith(activeClock: newSideToMove); } + + void giveTime(Duration amount) { + final newTime = state.timeLeft(state.activeClock!)! + amount; + + if (state.activeClock == Side.white) { + state = state.copyWith(whiteTimeLeft: newTime); + } else { + state = state.copyWith(blackTimeLeft: newTime); + } + } } @freezed diff --git a/lib/src/view/over_the_board/over_the_board_screen.dart b/lib/src/view/over_the_board/over_the_board_screen.dart index 685d76690a..62945fb507 100644 --- a/lib/src/view/over_the_board/over_the_board_screen.dart +++ b/lib/src/view/over_the_board/over_the_board_screen.dart @@ -329,6 +329,12 @@ class _BottomBar extends ConsumerWidget { ); }, ), + BottomSheetAction( + makeLabel: (context) => const Text('Give 15 seconds.'), + onPressed: () { + ref.read(overTheBoardClockProvider.notifier).giveTime(const Duration(seconds: 15)); + }, + ), ], ); }