show static method

void show(
  1. BuildContext context,
  2. DialogType dialogType, {
  3. AnimationType animationType = AnimationType.scale,
  4. bool? barrierDismissible = true,
  5. String? barrierLabel = '',
  6. Duration? transitionDuration,
  7. Color? color,
  8. String? bigHeader,
  9. String? headerText,
  10. String? bodyText,
  11. String? buttonText,
  12. Widget? customDialog,
  13. double? height,
  14. double? width,
  15. String? okButtonText,
  16. Widget? cancelButtonWidget,
  17. Widget? centerBodyWidget,
  18. Widget? centerTitleWidget,
  19. Widget? okButtonWidget,
  20. Function? onCloseButtonPressed,
  21. Function? onOkButtonPressed,
})

Implementation

static void show(
  BuildContext context,
  DialogType dialogType, {
  AnimationType animationType = AnimationType.scale,
  bool? barrierDismissible = true,
  String? barrierLabel = '',
  Duration? transitionDuration,
  Color? color,
  String? bigHeader,
  String? headerText,
  String? bodyText,
  String? buttonText,
  Widget? customDialog,
  double? height,
  double? width,
  String? okButtonText,
  Widget? cancelButtonWidget,
  Widget? centerBodyWidget,
  Widget? centerTitleWidget,
  Widget? okButtonWidget,
  Function? onCloseButtonPressed,
  Function? onOkButtonPressed,
}) {
  showGeneralDialog(
    barrierColor: Colors.black.withOpacity(0.4),
    transitionBuilder: (context, a1, a2, widget) {
      switch (animationType) {
        case AnimationType.scale:
          return DialogAnimations.scaleDialog(child: widget, animation: a1);
        case AnimationType.rotate:
          return DialogAnimations.rotateDialog(child: widget, animation: a1);
        case AnimationType.upToDown:
          return DialogAnimations.upToDown(child: widget, animation: a1);
        case AnimationType.downToUp:
          return DialogAnimations.downToUp(child: widget, animation: a1);
        case AnimationType.leftToRight:
          return DialogAnimations.leftToRight(child: widget, animation: a1);
        case AnimationType.rightToLeft:
          return DialogAnimations.rightToLeft(child: widget, animation: a1);
      }
    },
    transitionDuration:
        transitionDuration ?? const Duration(milliseconds: 250),
    barrierLabel: barrierLabel,
    barrierDismissible: barrierDismissible!,
    context: context,
    pageBuilder: (context, animation1, animation2) {
      return ADialogWidget(
        type: dialogType,
        color: color,
        bigHeader: bigHeader,
        headerText: headerText,
        bodyText: bodyText,
        buttonText: buttonText,
        customDialog: customDialog,
        height: height,
        width: width,
        okButtonText: okButtonText,
        cancelButtonWidget: cancelButtonWidget,
        centerBodyWidget: centerBodyWidget,
        centerTitleWidget: centerTitleWidget,
        okButtonWidget: okButtonWidget,
        onCloseButtonPressed: onCloseButtonPressed,
        onOkButtonPressed: onOkButtonPressed,
      );
    },
  );
}