Added ruleset depending icons and adjusted mvp text
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 45s
Pull Request Pipeline / lint (pull_request) Successful in 47s

This commit is contained in:
2026-04-22 00:19:48 +02:00
parent 6f0147420a
commit 23b903e28a

View File

@@ -187,15 +187,11 @@ class _MatchTileState extends State<MatchTile> {
), ),
child: Row( child: Row(
children: [ children: [
const Icon( getMvpIcon(),
Icons.emoji_events,
size: 20,
color: Colors.amber,
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded( Expanded(
child: Text( child: Text(
getWinner(loc), getMvpText(loc),
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@@ -290,13 +286,15 @@ class _MatchTileState extends State<MatchTile> {
} }
} }
String getWinner(AppLocalizations loc) { String getMvpText(AppLocalizations loc) {
if (widget.match.mvp.isEmpty) return ''; if (widget.match.mvp.isEmpty) return '';
final ruleset = widget.match.game.ruleset; final ruleset = widget.match.game.ruleset;
if (ruleset == Ruleset.singleWinner || ruleset == Ruleset.singleLoser) { if (ruleset == Ruleset.singleWinner) {
return '${loc.winner}: ${widget.match.mvp.first.name}'; return '${loc.winner}: ${widget.match.mvp.first.name}';
} else if (ruleset == Ruleset.lowestScore || } else if (ruleset == Ruleset.singleLoser) {
return '${loc.loser}: ${widget.match.mvp.first.name}';
} else if (ruleset == Ruleset.highestScore ||
ruleset == Ruleset.lowestScore) { ruleset == Ruleset.lowestScore) {
final mvp = widget.match.mvp; final mvp = widget.match.mvp;
final mvpScore = widget.match.scores[mvp.first.id]?.score ?? 0; final mvpScore = widget.match.scores[mvp.first.id]?.score ?? 0;
@@ -306,4 +304,25 @@ class _MatchTileState extends State<MatchTile> {
} }
return '${loc.winner}: n.A.'; return '${loc.winner}: n.A.';
} }
Icon getMvpIcon() {
const Icon(Icons.emoji_events, size: 20, color: Colors.amber);
switch (widget.match.game.ruleset) {
case Ruleset.singleWinner:
return const Icon(Icons.emoji_events, size: 20, color: Colors.amber);
case Ruleset.singleLoser:
return const Icon(
Icons.sentiment_dissatisfied_outlined,
size: 20,
color: Colors.blue,
);
case Ruleset.lowestScore:
return const Icon(Icons.arrow_downward, size: 20, color: Colors.orange);
case Ruleset.highestScore:
return const Icon(Icons.arrow_upward, size: 20, color: Colors.green);
default:
return const Icon(Icons.emoji_events, size: 20, color: Colors.amber);
}
}
} }