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,
  24. double top = 0,
  25. double left = 0,
  26. double rigth = 0,
  27. double bottom = 0,
})

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,
  double top = 0,
  double left = 0,
  double rigth = 0,
  double bottom = 0,
}) async {
  try {
    if (controlDialogGO.controll.containsKey(token)) {
      await controlDialogGO.close(token: token);
    }
    controlDialogGO.controll.addAll({
      token: dialogState(
        state: OverlayEntry(
          builder: (context) {
            return Positioned(
              top: top,
              bottom: bottom,
              left: left,
              right: rigth,
              child: MainAlertGoDialog(
                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: backgroundColor,
                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,
              ),
            );
          },
        ),
      )
    });
    Overlay.of(context).insert(controlDialogGO.controll[token]!.state);
  } catch (e) {
    print(e);
  }
}