dialogAlertTransion function

dynamic dialogAlertTransion({
  1. required BuildContext context,
  2. bool designer = false,
  3. Widget alertWd = const Text(''),
  4. Widget title = const Text(''),
  5. Widget content = const Text(''),
  6. transitionType transitionType = transitionType.Bounce,
  7. bool blur = true,
  8. bool close = true,
  9. bool animate = true,
  10. bool autoClose = false,
  11. bool buttonConfirm = true,
  12. Size size = Size.zero,
  13. int countDown = 0,
  14. int duration = 1000,
  15. int token = 0,
  16. bool outClose = true,
  17. String acceptString = 'Accept',
  18. String rejectString = 'Cancel',
  19. Alignment alignment = Alignment.center,
  20. Color backgroundColor = Colors.white,
  21. Function? acceptFunc,
  22. Function? rejectFunc,
  23. Function? closeFunc,
})

Implementation

dialogAlertTransion({
  required BuildContext context,
  bool designer = false,
  Widget alertWd = const Text(''),
  Widget title = const Text(''),
  Widget content = const Text(''),
  transitionType transitionType = transitionType.Bounce,
  bool blur = true,
  bool close = true,
  bool animate = true,
  bool autoClose = false,
  bool buttonConfirm = true,
  Size size = Size.zero,
  int countDown = 0,
  int duration = 1000,
  int token = 0,
  bool outClose = true,
  String acceptString = 'Accept',
  String rejectString = 'Cancel',
  Alignment alignment = Alignment.center,
  Color backgroundColor = Colors.white,
  Function? acceptFunc,
  Function? rejectFunc,
  Function? closeFunc,
}) {
  try {
    showGeneralDialog(
      context: context,
      barrierDismissible: false,
      transitionDuration: Duration.zero,
      barrierColor: Colors.transparent,
      pageBuilder: (BuildContext buildContext, animation, secondaryAnimation) {
        return SafeArea(
          child: MainAlertGo(
            acceptString: acceptString,
            rejectString: rejectString,
            title: title,
            contextMain: context,
            content: content,
            autoClose: autoClose,
            blur: blur,
            close: close,
            countDown: countDown,
            duration: duration,
            animate: animate,
            outClose: autoClose,
            alertWd: alertWd,
            designer: designer,
            animationType: transitionType,
            backgroundColor: Colors.black,
            alignment: alignment,
            acceptFunc: acceptFunc,
            closeFunc: closeFunc,
            rejectFunc: rejectFunc,
            buttonConfirm: buttonConfirm,
            token: token,
            size: Size.zero == size
                ? MediaQuery.of(context).size.width < 480
                    ? Size(MediaQuery.of(context).size.width - 20, 0)
                    : Size(MediaQuery.of(context).size.width / 3, 0)
                : size,
          ),
        );
      },
      transitionBuilder: (context, animation, secondaryAnimation, child) {
        return FadeTransition(
          opacity: Tween<double>(begin: 0.0, end: 1.0).animate(animation),
          child: child,
        );
      },
    );
  } catch (e) {
    print(e);
  }
}