Prepared for dialog implementation

This commit is contained in:
Felix Kirchner
2025-04-30 17:59:21 +02:00
parent 6402fff7d4
commit c8113430f1
4 changed files with 20 additions and 7 deletions

View File

@@ -52,8 +52,8 @@
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Release" buildConfiguration = "Release"
selectedDebuggerIdentifier = "" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"

View File

@@ -11,10 +11,9 @@ class LocalStorageService {
/// Speichert GameSessions im App-Dokumentenverzeichnis /// Speichert GameSessions im App-Dokumentenverzeichnis
static Future<void> saveGameSessions() async { static Future<void> saveGameSessions() async {
try { try {
List<GameSession> sessions = Globals.gameList;
final file = await _getLocalFile(); final file = await _getLocalFile();
final jsonList = sessions.map((session) => session.toJson()).toList(); final jsonFile = getJsonFile();
await file.writeAsString(json.encode(jsonList)); await file.writeAsString(jsonFile);
print('Daten gespeichert'); print('Daten gespeichert');
} catch (e) { } catch (e) {
print('Fehler beim Speichern: $e'); print('Fehler beim Speichern: $e');
@@ -49,6 +48,12 @@ class LocalStorageService {
} }
} }
static String getJsonFile() {
final jsonFile =
Globals.gameList.map((session) => session.toJson()).toList();
return json.encode(jsonFile);
}
static Future<File> _getLocalFile() async { static Future<File> _getLocalFile() async {
final directory = await getApplicationDocumentsDirectory(); final directory = await getApplicationDocumentsDirectory();
final path = '${directory.path}/$_fileName'; final path = '${directory.path}/$_fileName';

View File

@@ -80,7 +80,10 @@ class InformationView extends StatelessWidget {
Uri.parse('https://www.github.com/flixcoo')), Uri.parse('https://www.github.com/flixcoo')),
icon: const Icon(FontAwesomeIcons.github)), icon: const Icon(FontAwesomeIcons.github)),
], ],
) ),
CupertinoButton(
child: const Text('Spieldaten exportieren'),
onPressed: () => {saveJsonToDevice()})
], ],
), ),
Positioned( Positioned(
@@ -112,4 +115,8 @@ class InformationView extends StatelessWidget {
], ],
))); )));
} }
void saveJsonToDevice() async {
//todo: implement
}
} }

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.1.3+101 version: 0.1.3+103
environment: environment:
sdk: ^3.5.4 sdk: ^3.5.4
@@ -16,6 +16,7 @@ dependencies:
package_info_plus: any package_info_plus: any
flutter_keyboard_visibility: ^6.0.0 flutter_keyboard_visibility: ^6.0.0
path_provider: ^2.1.1 path_provider: ^2.1.1
file_picker: any
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: