Added mounted check to popups
This commit is contained in:
@@ -85,10 +85,10 @@ class InformationView extends StatelessWidget {
|
||||
CupertinoButton(
|
||||
sizeStyle: CupertinoButtonSize.medium,
|
||||
child: const Text('Spieldaten exportieren'),
|
||||
onPressed: () async =>
|
||||
await LocalStorageService.exportJsonFile()
|
||||
? null
|
||||
: showCupertinoDialog(
|
||||
onPressed: () async {
|
||||
final success = await LocalStorageService.exportJsonFile();
|
||||
if (!success && context.mounted) {
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: const Text('Fehler'),
|
||||
@@ -97,18 +97,22 @@ class InformationView extends StatelessWidget {
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: const Text('OK'),
|
||||
onPressed: () =>
|
||||
Navigator.pop(context),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
],
|
||||
))),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
CupertinoButton(
|
||||
sizeStyle: CupertinoButtonSize.medium,
|
||||
child: const Text('Spieldaten importieren'),
|
||||
onPressed: () async => {
|
||||
await LocalStorageService.importJsonFile()
|
||||
? null
|
||||
: showCupertinoDialog(
|
||||
onPressed: () async {
|
||||
final success =
|
||||
await LocalStorageService.importJsonFile();
|
||||
if (!success && context.mounted) {
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: const Text('Fehler'),
|
||||
@@ -117,11 +121,11 @@ class InformationView extends StatelessWidget {
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: const Text('OK'),
|
||||
onPressed: () =>
|
||||
Navigator.pop(context),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
],
|
||||
))
|
||||
));
|
||||
}
|
||||
}),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user