Removed selectedRulesetIndex

This commit is contained in:
2026-05-04 11:03:34 +02:00
parent 94bb477cd9
commit 8194fb2f28

View File

@@ -44,19 +44,10 @@ class _CreateGameViewState extends State<CreateGameView> {
late final AppDatabase db; late final AppDatabase db;
/// The currently selected ruleset for the game. late List<(Ruleset, String)> _rulesets;
Ruleset? selectedRuleset; Ruleset? selectedRuleset;
/// The index of the currently selected ruleset.
int selectedRulesetIndex = -1;
/// A list of available rulesets and their localized names.
late List<(Ruleset, String)> _rulesets;
/// A list of available game colors and their localized names.
late List<(GameColor, String)> _colors; late List<(GameColor, String)> _colors;
/// The currently selected color for the game.
GameColor? selectedColor = GameColor.orange; GameColor? selectedColor = GameColor.orange;
/// Controller for the game name input field. /// Controller for the game name input field.
@@ -122,10 +113,7 @@ class _CreateGameViewState extends State<CreateGameView> {
_descriptionController.text = widget.gameToEdit!.description; _descriptionController.text = widget.gameToEdit!.description;
selectedRuleset = widget.gameToEdit!.ruleset; selectedRuleset = widget.gameToEdit!.ruleset;
selectedColor = widget.gameToEdit!.color; selectedColor = widget.gameToEdit!.color;
selectedRuleset = widget.gameToEdit!.ruleset;
selectedRulesetIndex = _rulesets.indexWhere(
(r) => r.$1 == selectedRuleset,
);
} }
} }
@@ -435,7 +423,7 @@ class _CreateGameViewState extends State<CreateGameView> {
buttonType: ButtonType.primary, buttonType: ButtonType.primary,
onPressed: onPressed:
_gameNameController.text.trim().isNotEmpty && _gameNameController.text.trim().isNotEmpty &&
selectedRulesetIndex != -1 && selectedRuleset != null &&
selectedColor != null selectedColor != null
? () async { ? () async {
Game newGame = Game( Game newGame = Game(