mirror of
https://github.com/lichess-org/mobile.git
synced 2026-05-26 13:50:52 +00:00
only show the team scores when they are enabled
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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: [
|
||||
|
||||
@@ -249,6 +249,7 @@ class _BroadcastRoundScreenState extends ConsumerState<BroadcastRoundScreen>
|
||||
roundId: _selectedRoundId ?? value.defaultRoundId,
|
||||
tournamentId: _selectedTournamentId,
|
||||
tournamentSlug: value.data.slug,
|
||||
showTeamScores: value.data.showTeamScores == true,
|
||||
),
|
||||
_ => const SizedBox.shrink(),
|
||||
},
|
||||
|
||||
@@ -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<BroadcastTeamMatch> 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,
|
||||
|
||||
Reference in New Issue
Block a user