showAlertDialog method

void showAlertDialog({
  1. BackButtonBehavior backButtonBehavior = BackButtonBehavior.ignore,
  2. VoidCallback? cancel,
  3. VoidCallback? confirm,
  4. VoidCallback? backgroundReturn,
  5. VoidCallback? onClose,
  6. Duration afterHidden = const Duration(seconds: 2),
  7. Widget buildContent(
    1. 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));
}