From c61309368353beec0ff95cc4064d3daa7ded02c6 Mon Sep 17 00:00:00 2001 From: Noah Date: Mon, 18 May 2026 20:40:52 +0200 Subject: [PATCH] only show the team scores when they are enabled --- lib/src/model/broadcast/broadcast.dart | 1 + .../model/broadcast/broadcast_repository.dart | 1 + .../broadcast_player_results_screen.dart | 8 +++-- .../broadcast/broadcast_round_screen.dart | 1 + .../view/broadcast/broadcast_teams_tab.dart | 31 ++++++++++++++----- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/lib/src/model/broadcast/broadcast.dart b/lib/src/model/broadcast/broadcast.dart index f917a62c3..a8896c3dc 100644 --- a/lib/src/model/broadcast/broadcast.dart +++ b/lib/src/model/broadcast/broadcast.dart @@ -107,6 +107,7 @@ sealed class BroadcastTournamentData with _$BroadcastTournamentData { // PRIVATE=-1, NORMAL=3, HIGH=4, BEST=5 int? tier, bool? teamTable, + bool? showTeamScores, required BroadcastTournamentInformation information, }) = _BroadcastTournamentData; } diff --git a/lib/src/model/broadcast/broadcast_repository.dart b/lib/src/model/broadcast/broadcast_repository.dart index cd79359a3..48fbd2086 100644 --- a/lib/src/model/broadcast/broadcast_repository.dart +++ b/lib/src/model/broadcast/broadcast_repository.dart @@ -137,6 +137,7 @@ BroadcastTournamentData _tournamentDataFromPick(RequiredPick pick) => BroadcastT imageUrl: pick('image').asStringOrNull(), description: pick('description').asStringOrNull(), teamTable: pick('teamTable').asBoolOrFalse(), + showTeamScores: pick('showTeamScores').asBoolOrFalse(), information: ( format: pick('info', 'format').asStringOrNull(), timeControl: pick('info', 'tc').asStringOrNull(), diff --git a/lib/src/view/broadcast/broadcast_player_results_screen.dart b/lib/src/view/broadcast/broadcast_player_results_screen.dart index d1a963c50..233be7973 100644 --- a/lib/src/view/broadcast/broadcast_player_results_screen.dart +++ b/lib/src/view/broadcast/broadcast_player_results_screen.dart @@ -311,9 +311,11 @@ class _OverallStatPlayer extends StatelessWidget { if (team != null) ...[ GestureDetector( onTap: () { - Navigator.of( - context, - ).push(BroadcastTeamScreen.buildRoute(context, tournament.data.id, team)); + if (tournament.data.showTeamScores == true) { + Navigator.of(context).push( + BroadcastTeamScreen.buildRoute(context, tournament.data.id, team), + ); + } }, child: Row( children: [ diff --git a/lib/src/view/broadcast/broadcast_round_screen.dart b/lib/src/view/broadcast/broadcast_round_screen.dart index 9c7a7abfb..08cb5ce87 100644 --- a/lib/src/view/broadcast/broadcast_round_screen.dart +++ b/lib/src/view/broadcast/broadcast_round_screen.dart @@ -249,6 +249,7 @@ class _BroadcastRoundScreenState extends ConsumerState roundId: _selectedRoundId ?? value.defaultRoundId, tournamentId: _selectedTournamentId, tournamentSlug: value.data.slug, + showTeamScores: value.data.showTeamScores == true, ), _ => const SizedBox.shrink(), }, diff --git a/lib/src/view/broadcast/broadcast_teams_tab.dart b/lib/src/view/broadcast/broadcast_teams_tab.dart index dab82d4da..b5f9438d5 100644 --- a/lib/src/view/broadcast/broadcast_teams_tab.dart +++ b/lib/src/view/broadcast/broadcast_teams_tab.dart @@ -34,11 +34,13 @@ class BroadcastTeamsTab extends ConsumerWidget { required this.roundId, required this.tournamentId, required this.tournamentSlug, + this.showTeamScores = false, }); final BroadcastRoundId roundId; final BroadcastTournamentId tournamentId; final String tournamentSlug; + final bool showTeamScores; @override Widget build(BuildContext context, WidgetRef ref) { @@ -50,6 +52,7 @@ class BroadcastTeamsTab extends ConsumerWidget { roundId, tournamentId, tournamentSlug, + showTeamScores, ), AsyncError(:final error) => Center(child: Text('Cannot load teams data: $error')), _ => const Center(child: CircularProgressIndicator.adaptive()), @@ -58,12 +61,19 @@ class BroadcastTeamsTab extends ConsumerWidget { } class BroadcastTeamsList extends ConsumerWidget { - const BroadcastTeamsList(this.teamMatches, this.roundId, this.tournamentId, this.tournamentSlug); + const BroadcastTeamsList( + this.teamMatches, + this.roundId, + this.tournamentId, + this.tournamentSlug, + this.showTeamScores, + ); final IList teamMatches; final BroadcastRoundId roundId; final BroadcastTournamentId tournamentId; final String tournamentSlug; + final bool showTeamScores; @override Widget build(BuildContext context, WidgetRef ref) { @@ -87,6 +97,7 @@ class BroadcastTeamsList extends ConsumerWidget { title: value.round.name, showEvaluationGauge: showEvaluationGauges, customScoring: value.round.customScoring, + showTeamScores: showTeamScores, ); }, ), @@ -107,6 +118,7 @@ class _TeamMatchCard extends StatelessWidget { required this.title, required this.showEvaluationGauge, required this.customScoring, + required this.showTeamScores, }); final BroadcastTeamMatch match; @@ -118,6 +130,7 @@ class _TeamMatchCard extends StatelessWidget { final String title; final bool showEvaluationGauge; final BroadcastCustomScoring? customScoring; + final bool showTeamScores; bool get matchFinished => games.everyEntry((e) => e.value.isOver); BroadcastResult? get matchStatus => matchFinished @@ -145,9 +158,11 @@ class _TeamMatchCard extends StatelessWidget { Expanded( child: GestureDetector( onTap: () { - Navigator.of(context).push( - BroadcastTeamScreen.buildRoute(context, tournamentId, match.team1.name), - ); + if (showTeamScores) { + Navigator.of(context).push( + BroadcastTeamScreen.buildRoute(context, tournamentId, match.team1.name), + ); + } }, child: Text( match.team1.name, @@ -184,9 +199,11 @@ class _TeamMatchCard extends StatelessWidget { Expanded( child: GestureDetector( onTap: () { - Navigator.of(context).push( - BroadcastTeamScreen.buildRoute(context, tournamentId, match.team2.name), - ); + if (showTeamScores) { + Navigator.of(context).push( + BroadcastTeamScreen.buildRoute(context, tournamentId, match.team2.name), + ); + } }, child: Text( match.team2.name,