feat: wait for exit dialog response
This commit is contained in:
@@ -33,7 +33,7 @@ class _ApplicationExitControlState extends State<ApplicationExitControl> {
|
|||||||
|
|
||||||
Future<AppExitResponse> _handleExitRequest() async {
|
Future<AppExitResponse> _handleExitRequest() async {
|
||||||
if (SharedPrefSingleton().minimizeOnQuit == null) {
|
if (SharedPrefSingleton().minimizeOnQuit == null) {
|
||||||
showDialog(
|
final exitApp = await showDialog<bool?>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
bool minimize = false;
|
bool minimize = false;
|
||||||
@@ -71,14 +71,14 @@ class _ApplicationExitControlState extends State<ApplicationExitControl> {
|
|||||||
children: [
|
children: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context, false);
|
||||||
windowManager.hide();
|
windowManager.hide();
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!.minimize),
|
child: Text(AppLocalizations.of(context)!.minimize),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context, true);
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!.exit),
|
child: Text(AppLocalizations.of(context)!.exit),
|
||||||
),
|
),
|
||||||
@@ -91,6 +91,13 @@ class _ApplicationExitControlState extends State<ApplicationExitControl> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (exitApp == null || exitApp == false) {
|
||||||
|
return AppExitResponse.cancel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SharedPrefSingleton().minimizeOnQuit == false) {
|
||||||
|
windowManager.hide();
|
||||||
return AppExitResponse.cancel;
|
return AppExitResponse.cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user