Refactoring & comments
This commit is contained in:
@@ -1,25 +1,5 @@
|
||||
import 'package:cabo_counter/data/game_session.dart';
|
||||
import 'package:cabo_counter/services/local_storage_service.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class Globals extends ChangeNotifier {
|
||||
List<GameSession> gameList = [];
|
||||
int pointLimit = 100;
|
||||
int caboPenalty = 5;
|
||||
String appDevPhase = 'Alpha';
|
||||
|
||||
void addGameSession(GameSession session) {
|
||||
gameList.add(session);
|
||||
gameList.sort((a, b) => b.createdAt.compareTo(a.createdAt));
|
||||
notifyListeners(); // Wichtig!
|
||||
LocalStorageService.saveGameSessions();
|
||||
}
|
||||
|
||||
void removeGameSession(int index) {
|
||||
gameList.removeAt(index);
|
||||
notifyListeners(); // Wichtig!
|
||||
LocalStorageService.saveGameSessions();
|
||||
}
|
||||
class Globals {
|
||||
static int pointLimit = 100;
|
||||
static int caboPenalty = 5;
|
||||
static String appDevPhase = 'Alpha';
|
||||
}
|
||||
|
||||
final globals = Globals(); // Globale Instanz
|
||||
|
||||
Reference in New Issue
Block a user