flutter_desktop: handle privacy mode back notifications

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2022-08-08 22:00:01 +08:00
parent e553756ad8
commit b2ffe9dee4
8 changed files with 210 additions and 38 deletions

View file

@ -194,14 +194,20 @@ void msgBox(String type, String title, String text, {bool? hasCancel}) {
style: TextStyle(color: MyTheme.accent))));
SmartDialog.dismiss();
final buttons = [
wrap(Translator.call('OK'), () {
SmartDialog.dismiss();
backToHome();
})
];
List<Widget> buttons = [];
if (type != "connecting" && type != "success" && type.indexOf("nook") < 0) {
buttons.insert(
0,
wrap(Translator.call('OK'), () {
SmartDialog.dismiss();
backToHome();
}));
}
if (hasCancel == null) {
hasCancel = type != 'error';
// hasCancel = type != 'error';
hasCancel = type.indexOf("error") < 0 &&
type.indexOf("nocancel") < 0 &&
type != "restarting";
}
if (hasCancel) {
buttons.insert(
@ -210,6 +216,14 @@ void msgBox(String type, String title, String text, {bool? hasCancel}) {
SmartDialog.dismiss();
}));
}
// TODO: test this button
if (type.indexOf("hasclose") >= 0) {
buttons.insert(
0,
wrap(Translator.call('Close'), () {
SmartDialog.dismiss();
}));
}
DialogManager.show((setState, close) => CustomAlertDialog(
title: Text(translate(title), style: TextStyle(fontSize: 21)),
content: Text(Translator.call(text), style: TextStyle(fontSize: 15)),