Compare commits
4 Commits
f7c1d6e975
...
f40a9ad09b
| Author | SHA1 | Date | |
|---|---|---|---|
| f40a9ad09b | |||
| 822bc03c83 | |||
| a8d4e640cf | |||
| cf71b40718 |
@@ -20,10 +20,10 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"players": {
|
"players": {
|
||||||
"type": "null"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
"type": "null"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"winner": {
|
"winner": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@@ -33,8 +33,6 @@
|
|||||||
"id",
|
"id",
|
||||||
"createdAt",
|
"createdAt",
|
||||||
"name",
|
"name",
|
||||||
"players",
|
|
||||||
"group",
|
|
||||||
"winner"
|
"winner"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,7 @@ class CustomNavigationBar extends StatefulWidget {
|
|||||||
class _CustomNavigationBarState extends State<CustomNavigationBar>
|
class _CustomNavigationBarState extends State<CustomNavigationBar>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
final List<Widget> tabs = [
|
int tabKeyCount = 0;
|
||||||
const HomeView(),
|
|
||||||
const GameHistoryView(),
|
|
||||||
const GroupsView(),
|
|
||||||
const StatisticsView(),
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -31,6 +26,22 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
// Pretty ugly but works
|
||||||
|
final List<Widget> tabs = [
|
||||||
|
KeyedSubtree(key: ValueKey('home_$tabKeyCount'), child: const HomeView()),
|
||||||
|
KeyedSubtree(
|
||||||
|
key: ValueKey('games_$tabKeyCount'),
|
||||||
|
child: const GameHistoryView(),
|
||||||
|
),
|
||||||
|
KeyedSubtree(
|
||||||
|
key: ValueKey('groups_$tabKeyCount'),
|
||||||
|
child: const GroupsView(),
|
||||||
|
),
|
||||||
|
KeyedSubtree(
|
||||||
|
key: ValueKey('stats_$tabKeyCount'),
|
||||||
|
child: const StatisticsView(),
|
||||||
|
),
|
||||||
|
];
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
@@ -42,10 +53,15 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => Navigator.push(
|
onPressed: () async {
|
||||||
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (_) => const SettingsView()),
|
MaterialPageRoute(builder: (_) => const SettingsView()),
|
||||||
),
|
);
|
||||||
|
setState(() {
|
||||||
|
tabKeyCount++;
|
||||||
|
});
|
||||||
|
},
|
||||||
icon: const Icon(Icons.settings),
|
icon: const Icon(Icons.settings),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
await DataTransferService.getAppDataAsJson(context);
|
await DataTransferService.getAppDataAsJson(context);
|
||||||
final result = await DataTransferService.exportData(
|
final result = await DataTransferService.exportData(
|
||||||
json,
|
json,
|
||||||
'exported_data',
|
'game_tracker-data',
|
||||||
);
|
);
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
showExportSnackBar(context: context, result: result);
|
showExportSnackBar(context: context, result: result);
|
||||||
@@ -103,11 +103,31 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
icon: Icons.download_outlined,
|
icon: Icons.download_outlined,
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
showDialog<bool>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: const Text('Delete all data?'),
|
||||||
|
content: const Text('This can\'t be undone'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(false),
|
||||||
|
child: const Text('Abbrechen'),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(true),
|
||||||
|
child: const Text('Löschen'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
).then((confirmed) {
|
||||||
|
if (confirmed == true && context.mounted) {
|
||||||
DataTransferService.deleteAllData(context);
|
DataTransferService.deleteAllData(context);
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context: context,
|
context: context,
|
||||||
message: 'Data successfully deleted',
|
message: 'Daten erfolgreich gelöscht',
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user