dialog backDismiss

This commit is contained in:
csf 2022-04-21 10:02:47 +08:00
parent 8386e0f20e
commit 9f6254cc82
4 changed files with 13 additions and 22 deletions

View File

@ -96,6 +96,7 @@ class DialogManager {
static Future<T?> show<T>(DialogBuilder builder,
{bool clickMaskDismiss = false,
bool backDismiss = false,
String? tag,
bool useAnimation = true}) async {
final t;
@ -113,6 +114,7 @@ class DialogManager {
final res = await SmartDialog.show<T>(
tag: t,
clickMaskDismiss: clickMaskDismiss,
backDismiss: backDismiss,
useAnimation: useAnimation,
builder: (_) => StatefulBuilder(
builder: (_, setState) => builder(setState, close)));
@ -125,27 +127,23 @@ class CustomAlertDialog extends StatelessWidget {
{required this.title,
required this.content,
required this.actions,
this.onWillPop,
this.contentPadding});
final Widget title;
final Widget content;
final List<Widget> actions;
final WillPopCallback? onWillPop;
final double? contentPadding;
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: onWillPop ?? () async => false,
child: AlertDialog(
scrollable: true,
title: title,
contentPadding: EdgeInsets.symmetric(
horizontal: contentPadding ?? 25, vertical: 10),
content: content,
actions: actions,
));
return AlertDialog(
scrollable: true,
title: title,
contentPadding:
EdgeInsets.symmetric(horizontal: contentPadding ?? 25, vertical: 10),
content: content,
actions: actions,
);
}
}

View File

@ -877,10 +877,9 @@ void showOptions() {
] +
more),
actions: [],
onWillPop: () async => true,
contentPadding: 0,
);
}, clickMaskDismiss: true);
}, clickMaskDismiss: true, backDismiss: true);
}
void showSetOSPassword(bool login) {

View File

@ -244,11 +244,8 @@ void showServerSettingsWithValue(
child: Text(translate('OK')),
),
],
onWillPop: () async {
return true;
},
);
}, clickMaskDismiss: true);
});
}
String? validate(value) {

View File

@ -118,11 +118,8 @@ void showAbout() {
)),
]),
actions: [],
onWillPop: () async {
return true;
},
);
}, clickMaskDismiss: true);
}, clickMaskDismiss: true, backDismiss: true);
}
Future<String> login(String name, String pass) async {