Simplyfing methods
This commit is contained in:
@@ -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<CreateGame> {
|
||||
isPointsLimitEnabled: selectedMode!,
|
||||
);
|
||||
gameManager.addGameSession(gameSession);
|
||||
LocalStorageService.saveGameSessions();
|
||||
if (context.mounted) {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
|
||||
@@ -118,7 +118,7 @@ class _MainMenuViewState extends State<MainMenuView> {
|
||||
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<MainMenuView> {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user