Fixed wrong pointLimit shown

This commit is contained in:
2025-06-12 10:21:52 +02:00
parent 5fc3162213
commit 62750cbbf0
3 changed files with 7 additions and 7 deletions

View File

@@ -70,7 +70,9 @@ class _CreateGameState extends State<CreateGame> {
Text( Text(
selectedMode == null selectedMode == null
? 'Wähle einen Modus' ? 'Wähle einen Modus'
: (selectedMode! ? '101 Punkte' : 'Unbegrenzt'), : (selectedMode!
? '${Globals.pointLimit} Punkte'
: 'Unbegrenzt'),
), ),
const SizedBox(width: 3), const SizedBox(width: 3),
const CupertinoListTileChevron(), const CupertinoListTileChevron(),
@@ -290,16 +292,13 @@ class _CreateGameState extends State<CreateGame> {
isPointsLimitEnabled: selectedMode!, isPointsLimitEnabled: selectedMode!,
); );
final index = await gameManager.addGameSession(gameSession); final index = await gameManager.addGameSession(gameSession);
print('index des spiels: $index');
if (context.mounted) { if (context.mounted) {
Navigator.pushReplacement( Navigator.pushReplacement(
context, context,
CupertinoPageRoute( CupertinoPageRoute(
builder: (context) => ActiveGameView( builder: (context) => ActiveGameView(
gameSession: gameManager.gameList[index]))); gameSession: gameManager.gameList[index])));
} else { } else {}
print('Context is not mounted');
}
}, },
), ),
), ),

View File

@@ -1,6 +1,7 @@
import 'package:cabo_counter/data/game_manager.dart'; import 'package:cabo_counter/data/game_manager.dart';
import 'package:cabo_counter/services/local_storage_service.dart'; import 'package:cabo_counter/services/local_storage_service.dart';
import 'package:cabo_counter/utility/custom_theme.dart'; import 'package:cabo_counter/utility/custom_theme.dart';
import 'package:cabo_counter/utility/globals.dart';
import 'package:cabo_counter/views/active_game_view.dart'; import 'package:cabo_counter/views/active_game_view.dart';
import 'package:cabo_counter/views/create_game_view.dart'; import 'package:cabo_counter/views/create_game_view.dart';
import 'package:cabo_counter/views/settings_view.dart'; import 'package:cabo_counter/views/settings_view.dart';
@@ -185,7 +186,7 @@ class _MainMenuViewState extends State<MainMenuView> {
/// Translates the game mode boolean into the corresponding String. /// Translates the game mode boolean into the corresponding String.
/// If [pointLimit] is true, it returns '101 Punkte', otherwise it returns 'Unbegrenzt'. /// If [pointLimit] is true, it returns '101 Punkte', otherwise it returns 'Unbegrenzt'.
String _translateGameMode(bool pointLimit) { String _translateGameMode(bool pointLimit) {
if (pointLimit) return '101 Punkte'; if (pointLimit) return '${Globals.pointLimit} Punkte';
return 'Unbegrenzt'; return 'Unbegrenzt';
} }

View File

@@ -2,7 +2,7 @@ name: cabo_counter
description: "Mobile app for the card game Cabo" description: "Mobile app for the card game Cabo"
publish_to: 'none' publish_to: 'none'
version: 0.2.5+195 version: 0.2.5+196
environment: environment:
sdk: ^3.5.4 sdk: ^3.5.4