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