fix: single result row
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 49s
Pull Request Pipeline / lint (pull_request) Successful in 50s

This commit is contained in:
2026-05-10 18:47:48 +02:00
parent 341b293151
commit 50bf111f03

View File

@@ -283,71 +283,55 @@ class _MatchDetailViewState extends State<MatchDetailView> {
/// Returns the result row for single winner/loser rulesets or a placeholder /// Returns the result row for single winner/loser rulesets or a placeholder
/// if no result is entered yet /// if no result is entered yet
List<Widget> getSingleResultRow(AppLocalizations loc) { List<Widget> getSingleResultRow(AppLocalizations loc) {
// Single Winner if (match.mvp.isNotEmpty) {
if (match.mvp.isNotEmpty && match.game.ruleset == Ruleset.singleWinner) { final ruleset = match.game.ruleset;
return [
Text( if (ruleset == Ruleset.singleWinner || ruleset == Ruleset.singleLoser) {
loc.winner, return [
style: const TextStyle(fontSize: 16, color: CustomTheme.textColor), Text(
), ruleset == Ruleset.singleWinner ? loc.winner : loc.loser,
Text( style: const TextStyle(fontSize: 16, color: CustomTheme.textColor),
match.mvp.first.name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: CustomTheme.primaryColor,
), ),
), Text(
]; match.mvp.first.name,
// Single Loser style: const TextStyle(
} else if (match.mvp.isNotEmpty && fontSize: 16,
match.game.ruleset == Ruleset.singleLoser) { fontWeight: FontWeight.bold,
return [ color: CustomTheme.primaryColor,
Text( ),
loc.loser,
style: const TextStyle(fontSize: 16, color: CustomTheme.textColor),
),
Text(
match.mvp.first.name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: CustomTheme.primaryColor,
), ),
), ];
]; } else if (match.game.ruleset == Ruleset.multipleWinners) {
// Multiple Winners return [
} else if (match.mvp.isNotEmpty && Text(
match.game.ruleset == Ruleset.multipleWinners) { loc.winners,
return [ style: const TextStyle(fontSize: 16, color: CustomTheme.textColor),
Text( ),
loc.winners, Flexible(
style: const TextStyle(fontSize: 16, color: CustomTheme.textColor), child: Container(
), padding: const EdgeInsets.only(left: 10),
Flexible( child: Text(
child: Container( match.mvp.map((player) => player.name).join(', '),
padding: const EdgeInsets.only(left: 10), textAlign: TextAlign.end,
child: Text( style: const TextStyle(
match.mvp.map((player) => player.name).join(', '), fontSize: 16,
textAlign: TextAlign.end, fontWeight: FontWeight.bold,
style: const TextStyle( color: CustomTheme.primaryColor,
fontSize: 16, ),
fontWeight: FontWeight.bold,
color: CustomTheme.primaryColor,
), ),
), ),
), ),
), ];
]; }
// No result entered yet
} else {
return [
Text(
loc.no_results_entered_yet,
style: const TextStyle(fontSize: 14, color: CustomTheme.textColor),
),
];
} }
// No results yet
return [
Text(
loc.no_results_entered_yet,
style: const TextStyle(fontSize: 14, color: CustomTheme.textColor),
),
];
} }
/// Returns the result widget for scores or placement /// Returns the result widget for scores or placement