showDialog static method
void
showDialog({
- required Widget content,
- Widget? title,
- List<
Widget> ? actions, - String? cancelText,
- String? confirmText,
- VoidCallback? onConfirm,
- MainAxisAlignment? actionsAlignment,
- bool close = false,
Implementation
static void showDialog({
required Widget content,
Widget? title,
List<Widget>? actions,
String? cancelText,
String? confirmText,
VoidCallback? onConfirm,
MainAxisAlignment? actionsAlignment,
bool close = false,
}) {
Get.dialog(Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AlertDialog(
title: Center(child: title),
content: content,
actions: actions ??
<Widget>[
SizedBox(
height: 42,
width: 120.w,
child: ComButton(
plain: true,
child: Text(cancelText ?? 'Cancel'),
onPressed: () {
Get.back();
},
),
),
SizedBox(
height: 42,
width: 120.w,
child: ComButton(
gradient: CommonColors.primaryGradient,
child: Text(cancelText ?? 'Confirm'),
onPressed: () {
onConfirm?.call();
},
),
),
],
actionsAlignment: actionsAlignment ?? MainAxisAlignment.spaceAround,
),
Visibility(
visible: close,
child: IconButton(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
icon: const Icon(
Icons.cancel_outlined,
size: 36,
color: Colors.white60,
),
onPressed: () {
Navigator.pop(Get.context!);
},
),
)
],
));
}