flutter: non-Android: Prompt exit App manually when restoring default settings
This commit is contained in:
parent
b7098cd2b9
commit
6c1e6a33a9
|
@ -608,6 +608,10 @@
|
|||
"@exitApp": {
|
||||
"description": "The App will exit."
|
||||
},
|
||||
"exitAppManually": "You have to close immediately and reopen App to take effect.",
|
||||
"@exitAppManually": {
|
||||
"description": "You have to close immediately and reopen App to take effect."
|
||||
},
|
||||
"pick": "Pick",
|
||||
"@pick": {
|
||||
"description": "Pick "
|
||||
|
|
|
@ -152,6 +152,7 @@
|
|||
"restore": "重置",
|
||||
"restoreDefaultSettings": "恢复默认设置",
|
||||
"exitApp": "App 将退出。",
|
||||
"exitAppManually": "您需要立即退出并重新打开本程序才能使默认配置生效。",
|
||||
"pick": "选择",
|
||||
"hint": "提示",
|
||||
"player": "玩家",
|
||||
|
|
|
@ -171,12 +171,24 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
|
|||
restoreFactoryDefaultSettings() async {
|
||||
confirm() async {
|
||||
Navigator.of(context).pop();
|
||||
_startTimer();
|
||||
showCountdownDialog(context);
|
||||
if (Platform.isAndroid) {
|
||||
_startTimer();
|
||||
showCountdownDialog(context);
|
||||
} else {
|
||||
_restore();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(S.of(context).exitAppManually)));
|
||||
}
|
||||
}
|
||||
|
||||
cancel() => Navigator.of(context).pop();
|
||||
|
||||
var prompt = "";
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
prompt = S.of(context).exitApp;
|
||||
}
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
|
@ -184,9 +196,7 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
|
|||
title: Text(S.of(context).restore,
|
||||
style: TextStyle(color: AppTheme.dialogTitleColor)),
|
||||
content: SingleChildScrollView(
|
||||
child: Text(S.of(context).restoreDefaultSettings +
|
||||
"?\n" +
|
||||
S.of(context).exitApp),
|
||||
child: Text(S.of(context).restoreDefaultSettings + "?\n" + prompt),
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(child: Text(S.of(context).ok), onPressed: confirm),
|
||||
|
|
Loading…
Reference in New Issue