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_manager.dart';
|
||||||
import 'package:cabo_counter/data/game_session.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/custom_theme.dart';
|
||||||
import 'package:cabo_counter/utility/globals.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';
|
||||||
@@ -291,7 +290,6 @@ class _CreateGameState extends State<CreateGame> {
|
|||||||
isPointsLimitEnabled: selectedMode!,
|
isPointsLimitEnabled: selectedMode!,
|
||||||
);
|
);
|
||||||
gameManager.addGameSession(gameSession);
|
gameManager.addGameSession(gameSession);
|
||||||
LocalStorageService.saveGameSessions();
|
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
Navigator.pushReplacement(
|
Navigator.pushReplacement(
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class _MainMenuViewState extends State<MainMenuView> {
|
|||||||
return await _showDeleteGamePopup(gameTitle);
|
return await _showDeleteGamePopup(gameTitle);
|
||||||
},
|
},
|
||||||
onDismissed: (direction) {
|
onDismissed: (direction) {
|
||||||
_deleteSpecificGame(index);
|
gameManager.removeGameSession(index);
|
||||||
},
|
},
|
||||||
dismissThresholds: const {
|
dismissThresholds: const {
|
||||||
DismissDirection.startToEnd: 0.6
|
DismissDirection.startToEnd: 0.6
|
||||||
@@ -215,12 +215,4 @@ class _MainMenuViewState extends State<MainMenuView> {
|
|||||||
false;
|
false;
|
||||||
return shouldDelete;
|
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"
|
description: "Mobile app for the card game Cabo"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.1.6+149
|
version: 0.1.6+150
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
Reference in New Issue
Block a user