From 707d5080921b3b466e7b8b35d9d0e6776b781990 Mon Sep 17 00:00:00 2001 From: Julien <120588494+julien4215@users.noreply.github.com> Date: Wed, 12 Feb 2025 08:34:40 +0100 Subject: [PATCH 1/2] Add a key to the broadcast player widget so that when the board is flipped the state of the clocks is preserved --- lib/src/view/broadcast/broadcast_game_screen.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/src/view/broadcast/broadcast_game_screen.dart b/lib/src/view/broadcast/broadcast_game_screen.dart index 71a1411a1d..dbaf8fe0d3 100644 --- a/lib/src/view/broadcast/broadcast_game_screen.dart +++ b/lib/src/view/broadcast/broadcast_game_screen.dart @@ -173,12 +173,14 @@ class _Body extends ConsumerWidget { (context, boardSize, borderRadius) => _BroadcastBoard(roundId, gameId, boardSize, borderRadius), boardHeader: _PlayerWidget( + key: const ValueKey('top'), tournamentId: tournamentId, roundId: roundId, gameId: gameId, widgetPosition: _PlayerWidgetPosition.top, ), boardFooter: _PlayerWidget( + key: const ValueKey('bottom'), tournamentId: tournamentId, roundId: roundId, gameId: gameId, @@ -381,6 +383,7 @@ enum _PlayerWidgetPosition { bottom, top } class _PlayerWidget extends ConsumerWidget { const _PlayerWidget({ + required super.key, required this.tournamentId, required this.roundId, required this.gameId, From bf31792d9cd6d67d180f943c0f20c542f0e7eeef Mon Sep 17 00:00:00 2001 From: Julien <120588494+julien4215@users.noreply.github.com> Date: Wed, 12 Feb 2025 10:34:56 +0100 Subject: [PATCH 2/2] Add a comment to explain why a key is needed in broadcast player widget --- lib/src/view/broadcast/broadcast_game_screen.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/src/view/broadcast/broadcast_game_screen.dart b/lib/src/view/broadcast/broadcast_game_screen.dart index dbaf8fe0d3..a8793b356a 100644 --- a/lib/src/view/broadcast/broadcast_game_screen.dart +++ b/lib/src/view/broadcast/broadcast_game_screen.dart @@ -173,6 +173,7 @@ class _Body extends ConsumerWidget { (context, boardSize, borderRadius) => _BroadcastBoard(roundId, gameId, boardSize, borderRadius), boardHeader: _PlayerWidget( + // We need to use a key to preserve the state of the clock when board is flipped key: const ValueKey('top'), tournamentId: tournamentId, roundId: roundId, @@ -180,6 +181,7 @@ class _Body extends ConsumerWidget { widgetPosition: _PlayerWidgetPosition.top, ), boardFooter: _PlayerWidget( + // We need to use a key to preserve the state of the clock when board is flipped key: const ValueKey('bottom'), tournamentId: tournamentId, roundId: roundId,