yShowDialog function

void yShowDialog({
  1. required dynamic alertBuilder(
    1. BuildContext pageContext,
    2. BuildContext? dialogContext
    ),
  2. bool dismissible = true,
  3. BuildContext? context,
})

Implementation

void yShowDialog({required Function(BuildContext pageContext, BuildContext? dialogContext) alertBuilder, bool dismissible = true, BuildContext? context}) {
  showDialog(
    context: context ?? yPages.last.context,
    barrierDismissible: dismissible,
    builder: (dialogContext) {
      if (!dismissible) _dialogContext = dialogContext;
      return WillPopScope(
        onWillPop: () => Future.value(dismissible),
        child: alertBuilder(context ?? yPages.last.context, dismissible ? dialogContext : null),
      );
    },
  );
}