showNativeDialog static method
Future
showNativeDialog({
- BuildContext? context,
- String title = 'Info',
- Material? body,
- String message = 'Action cannot be undo.',
- String okBtn = 'OK',
- String? cancelBtn,
- Color? okButtonTextColor,
- Color? cancelButtonTextColor,
- TextStyle? okButtonTextStyle,
- TextStyle? cancelButtonTextStyle,
- Widget? okButton,
- Widget? cancelButton,
- List<
Widget> ? buttonList, - bool isDismissible = true,
Implementation
static Future showNativeDialog({
BuildContext? context,
String title = 'Info',
Material? body,
String message = 'Action cannot be undo.',
String okBtn = 'OK',
String? cancelBtn,
Color? okButtonTextColor,
Color? cancelButtonTextColor,
TextStyle? okButtonTextStyle,
TextStyle? cancelButtonTextStyle,
Widget? okButton,
Widget? cancelButton,
List<Widget>? buttonList,
bool isDismissible = true,
}) async {
return showPlatformDialog(
context: context ?? Get.context!,
androidBarrierDismissible: isDismissible,
useRootNavigator: true,
builder: (context) => PopScope(
canPop: isDismissible,
child: BasicDialogAlert(
title: Text(title),
content: body ?? Text(message),
actions: buttonList ??
<Widget>[
okButton ??
BasicDialogAction(
title: Text(
okBtn,
style: okButtonTextStyle ??
TextStyle(color: okButtonTextColor),
),
onPressed: () =>
Get.back(result: cancelBtn == null ? false : true),
),
if (cancelBtn != null || cancelButton != null)
cancelButton ??
BasicDialogAction(
title: Text(
cancelBtn ?? '',
style: cancelButtonTextStyle ??
TextStyle(color: cancelButtonTextColor),
),
onPressed: () => Get.back(result: false),
),
],
),
),
);
}