YurCustomDialog function

Future YurCustomDialog({
  1. String? title,
  2. required Widget content,
  3. required List<Widget> actions,
  4. Widget? icon,
  5. bool isDismisable = true,
  6. dynamic onPopInvoked(
    1. bool
    )?,
})

Implementation

Future<dynamic> YurCustomDialog({
  String? title,
  required Widget content,
  required List<Widget> actions,
  Widget? icon,
  bool isDismisable = true,
  Function(bool)? onPopInvoked,
}) {
  return showDialog(
    context: Get.context,
    barrierDismissible: isDismisable,
    builder: (BuildContext context) {
      return PopScope(
        canPop: isDismisable,
        onPopInvoked: onPopInvoked,
        child: AlertDialog(
          title: title == null
              ? null
              : YurText(
                  text: title,
                  textAlign: TextAlign.center,
                  fontWeight: FontWeight.bold,
                  fontSize: 20,
                ),
          content: IntrinsicHeight(child: content),
          actions: actions,
          icon: icon,
          backgroundColor: Colors.white.withOpacity(0.9),
          elevation: 24,
          shadowColor: Colors.black,
          surfaceTintColor: Colors.white,
          shape: const RoundedRectangleBorder(borderRadius: br16),
        ),
      );
    },
  );
}