From 11aa7494f3d0fdf0b178b2838ef3cba10684c1a5 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sun, 8 Jun 2025 20:47:10 +0200 Subject: [PATCH] Simplyfing methods --- lib/views/create_game_view.dart | 2 -- lib/views/main_menu_view.dart | 10 +--------- pubspec.yaml | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/views/create_game_view.dart b/lib/views/create_game_view.dart index 9927c45..8b1cf37 100644 --- a/lib/views/create_game_view.dart +++ b/lib/views/create_game_view.dart @@ -1,6 +1,5 @@ import 'package:cabo_counter/data/game_manager.dart'; import 'package:cabo_counter/data/game_session.dart'; -import 'package:cabo_counter/services/local_storage_service.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'; @@ -291,7 +290,6 @@ class _CreateGameState extends State { isPointsLimitEnabled: selectedMode!, ); gameManager.addGameSession(gameSession); - LocalStorageService.saveGameSessions(); if (context.mounted) { Navigator.pushReplacement( context, diff --git a/lib/views/main_menu_view.dart b/lib/views/main_menu_view.dart index a7047ae..d999984 100644 --- a/lib/views/main_menu_view.dart +++ b/lib/views/main_menu_view.dart @@ -118,7 +118,7 @@ class _MainMenuViewState extends State { return await _showDeleteGamePopup(gameTitle); }, onDismissed: (direction) { - _deleteSpecificGame(index); + gameManager.removeGameSession(index); }, dismissThresholds: const { DismissDirection.startToEnd: 0.6 @@ -215,12 +215,4 @@ class _MainMenuViewState extends State { false; return shouldDelete; } - - /// Deletes a specific game session by its index. - /// This function takes an [index] as parameter and removes the game session at - /// that index from the global game list, - void _deleteSpecificGame(int index) { - gameManager.gameList.removeAt(index); - LocalStorageService.saveGameSessions(); - } } diff --git a/pubspec.yaml b/pubspec.yaml index 1b9467e..1826611 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: cabo_counter description: "Mobile app for the card game Cabo" publish_to: 'none' -version: 0.1.6+149 +version: 0.1.6+150 environment: sdk: ^3.5.4