Add delay clock modes and unify local clock setup UI#3122
Conversation
|
Hey I like that there is less going on the clock toolbar and I'm in favor of some of your unifying Few questions and feedbacks if you don't mind: Having a little trouble envisioning what you mean without a submit button. Can you share a screenshot for these bullets or better yet perhaps add a video for the otb changes as well? I like the unified order for the clock settings for all the tools. One other slight reorder I considered is rated before side since rated influences if the side option even exists. Such as on 'challenge a friend' and 'correspondence' screens from the play menu. But my personal rebuttal to myself is that for the correspondence play screen, the side option animates in above when the toggle is toggled. If they were in reverse order, I assume it wouldn't be as pretty because then the rated toggle would be included in the bump-up. Not sure if anything made any sense or if you had any personal opinions on this one. One other idea, as you heard I was in favor of decluttering the clock toolbar. What are your thoughts to bringing sound and/or the rotation button into the gear settings? I can go either way but figured it was worth a shout of consideration. Lastly, I can create a separate pr later but is it somewhat easy to eventually bring in the other clock options that I mentioned in the previous ticket? |
I like the unified design changes and text. I am not so sure I love losing the submit button. Just because I adjust the toggle doesn't mean I want that new time control applied . |
|
Also, I'm presuming this will fix #1905 |
There was a problem hiding this comment.
Pull request overview
This pull request extends the standalone (offline/local) Clock tool to support additional time-control modes (simple delay and Bronstein delay) and updates the local setup UIs/preferences to use a unified “Clock” time-control option.
Changes:
- Add clock mode support (increment, simple delay, Bronstein delay) to the Clock tool controller, including new delay/bonus handling and new unit tests.
- Introduce a dedicated Clock tool settings modal and align custom per-side clock settings UI with the selected clock mode.
- Rename local OTB time control from
realTimetoclock(with preference migration) and adjust offline/OTB setup UI ordering accordingly.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| test/view/offline_computer/offline_computer_game_screen_test.dart | Stabilizes the “new game” sheet test by ensuring the “Side” option is scrolled into view before interacting/asserting. |
| test/model/clock/clock_tool_controller_test.dart | Adds unit coverage for simple delay and Bronstein delay behaviors in the Clock tool controller. |
| lib/src/view/over_the_board/configure_over_the_board_game.dart | Updates OTB local setup to use Clock vs Unlimited and refactors the clock settings UI expansion behavior. |
| lib/src/view/offline_computer/offline_computer_game_screen.dart | Reorders “Side” in the offline computer new-game setup sheet to better match the setup flow. |
| lib/src/view/clock/custom_clock_settings.dart | Updates per-side custom clock bottom sheet to reflect the selected clock mode and new submit callback style. |
| lib/src/view/clock/clock_tool_settings_modal.dart | Adds a new dedicated Clock tool settings panel for clock type + time + increment/delay selection. |
| lib/src/view/clock/clock_tool_screen.dart | Updates the Clock tool UI to pass clock mode into custom settings and display increment/delay indicator. |
| lib/src/view/clock/clock_settings.dart | Switches the Clock tool settings button to use the new Clock tool settings modal. |
| lib/src/model/over_the_board/over_the_board_preferences.dart | Renames local OTB time control enum value to clock and migrates existing stored preferences. |
| lib/src/model/clock/clock_tool_controller.dart | Implements clock mode logic (increment/simple delay/Bronstein) and new delay/bonus bookkeeping in the controller/options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (active != null && (initialOfActive.inMilliseconds != 0 || hasActiveMoved)) { | ||
| _clock.start(); | ||
| final delay = _pausedDelayRemaining ?? _delayFor(active); | ||
| _markDelay(delay); | ||
| _clock.start(delay: delay); |
| title: Text.rich( | ||
| TextSpan( | ||
| text: 'Minutes: ', | ||
| children: [ |
| String _clockValueInSecondsLabel(BuildContext context) { | ||
| return switch (widget.clockType) { | ||
| ClockTimeControlType.increment => context.l10n.incrementInSeconds, | ||
| ClockTimeControlType.simpleDelay || ClockTimeControlType.bronsteinDelay => 'Delay in seconds', | ||
| }; |
| SettingsListTile( | ||
| settingsLabel: const Text('Clock type'), | ||
| settingsValue: _clockType.label, |
| showChoicePicker<ClockTimeControlType>( | ||
| context, | ||
| title: const Text('Clock type'), | ||
| choices: ClockTimeControlType.values, |
| String _clockValueInSecondsLabel(BuildContext context) { | ||
| return switch (_clockType) { | ||
| ClockTimeControlType.increment => context.l10n.incrementInSeconds, | ||
| ClockTimeControlType.simpleDelay || ClockTimeControlType.bronsteinDelay => 'Delay in seconds', | ||
| }; |
| String get label => switch (this) { | ||
| increment => 'Increment', | ||
| simpleDelay => 'Simple delay', | ||
| bronsteinDelay => 'Bronstein delay', | ||
| }; | ||
|
|
||
| String get clockValueLabel => switch (this) { | ||
| increment => 'Increment', | ||
| simpleDelay || bronsteinDelay => 'Delay', | ||
| }; |
|
@Matrix9494 sorry for the delay on this. Can you first check the copilot comments before I review this myself? Thanks! |


Summary
Adds simple delay and Bronstein delay support to the standalone Clock tool, while keeping increment as the default mode.
The changes are scoped to local/offline clock setup and do not affect server-backed online time controls.
Main areas changed:
lib/src/model/clock/clock_tool_controller.dartlib/src/view/clock/clock_tool_settings_modal.dartlib/src/view/clock/clock_settings.dartlib/src/view/clock/clock_tool_screen.dartlib/src/view/clock/custom_clock_settings.dartlib/src/model/over_the_board/over_the_board_preferences.dartrealTimetoclock, with migration for existing preferences.lib/src/view/over_the_board/configure_over_the_board_game.dartClockandUnlimited.lib/src/view/offline_computer/offline_computer_game_screen.dartAI assistance
This PR was developed with assistance from ChatGPT/Codex. I reviewed and tested the changes manually, and I understand the submitted code.
Demo
Screen_recording_20260506_134420.webm