showAlertDialog method
void
showAlertDialog({
- BackButtonBehavior backButtonBehavior = BackButtonBehavior.ignore,
- VoidCallback? cancel,
- VoidCallback? confirm,
- VoidCallback? backgroundReturn,
- VoidCallback? onClose,
- Duration afterHidden = const Duration(seconds: 2),
- Widget buildContent(
- dynamic cancel()
Implementation
void showAlertDialog(
{BackButtonBehavior backButtonBehavior = BackButtonBehavior.ignore,
VoidCallback? cancel,
VoidCallback? confirm,
VoidCallback? backgroundReturn,
VoidCallback? onClose,
Duration afterHidden = const Duration(seconds: 2),
Widget Function(Function() cancel)? buildContent}) {
BotToast.showAnimationWidget(
clickClose: false,
allowClick: false,
onlyOne: true,
crossPage: true,
onClose: onClose,
backButtonBehavior: backButtonBehavior,
wrapToastAnimation: (controller, cancel, child) => Stack(
children: <Widget>[
AnimatedBuilder(
builder: (_, child) => Opacity(
opacity: controller.value,
child: child,
),
animation: controller,
child: const DecoratedBox(
decoration: BoxDecoration(color: Colors.black26),
child: SizedBox.expand(),
),
),
CustomScaleAnimation(
controller: controller,
onCancel: cancel,
afterHidden: afterHidden,
child: child,
)
],
),
toastBuilder: (cancelFunc) => Center(
child: buildContent?.call(cancelFunc) ?? SizedBox(),
),
animationDuration: const Duration(milliseconds: 300));
}