feat: showing game color in choose tile

This commit is contained in:
2026-05-03 10:59:46 +02:00
parent 5d832c98a7
commit 6272794cc5
4 changed files with 38 additions and 23 deletions

View File

@@ -56,7 +56,7 @@ class _CreateGameViewState extends State<CreateGameView> {
late List<(Ruleset, String)> _rulesets;
/// The currently selected color for the game.
GameColor? selectedColor;
GameColor? selectedColor = GameColor.orange;
/// Controller for the game name input field.
final _gameNameController = TextEditingController();
@@ -212,9 +212,11 @@ class _CreateGameViewState extends State<CreateGameView> {
if (!isEditMode())
ChooseTile(
title: loc.ruleset,
trailingText: selectedRuleset == null
? loc.none
: translateRulesetToString(selectedRuleset!, context),
trailing: selectedRuleset == null
? Text(loc.none)
: Text(
translateRulesetToString(selectedRuleset!, context),
),
onPressed: () async {
final result = await Navigator.of(context).push<Ruleset?>(
adaptivePageRoute(
@@ -238,9 +240,24 @@ class _CreateGameViewState extends State<CreateGameView> {
// Choose color tile
ChooseTile(
title: loc.color,
trailingText: selectedColor == null
? loc.none
: translateGameColorToString(selectedColor!, context),
trailing: selectedColor == null
? Text(loc.none)
: Row(
children: [
Text(
translateGameColorToString(selectedColor!, context),
),
Container(
width: 16,
height: 16,
margin: const EdgeInsets.only(left: 12),
decoration: BoxDecoration(
color: getColorFromGameColor(selectedColor!),
shape: BoxShape.circle,
),
),
],
),
onPressed: () async {
final result = await Navigator.of(context).push<GameColor?>(
adaptivePageRoute(

View File

@@ -132,9 +132,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
if (!isEditMode())
ChooseTile(
title: loc.game,
trailingText: selectedGame == null
? loc.none_group
: selectedGame!.name,
trailing: selectedGame == null
? Text(loc.none_group)
: Text(selectedGame!.name),
onPressed: () async {
selectedGame = await Navigator.of(context).push(
adaptivePageRoute(
@@ -158,9 +158,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
// Group selection tile.
ChooseTile(
title: loc.group,
trailingText: selectedGroup == null
? loc.none_group
: selectedGroup!.name,
trailing: selectedGroup == null
? Text(loc.none_group)
: Text(selectedGroup!.name),
onPressed: () async {
// Remove all players from the previously selected group from
// the selected players list, in case the user deselects the