'Flutter Show Full Screen Dialog in iOS 13 and Above

I want to show full screen dialog, it works as expected on Android but I noticed this is not fullscreen in iOS (I'm using iOS 15.2). I have been searching for some solutions and I found it due to a new behavior from iOS 13. In iOS 13 fullscreen dialog has changed. How can I force the fullscreen in iOS 13 and above using flutter?

This is the way I show my fullscreen dialog:

 _displayDialogEventsNews(BuildContext context, Widget dialogClass) {
    showGeneralDialog(
      context: context,
      barrierDismissible: false,
      transitionDuration: const Duration(milliseconds: 500),
      transitionBuilder: (context, animation, secondaryAnimation, child) {
        return FadeTransition(
          opacity: animation,
          child: ScaleTransition(
            scale: animation,
            child: child,
          ),
        );
      },
      pageBuilder: (context, animation, secondaryAnimation) {
        return SafeArea(
          child: Container(
            width: MediaQuery.of(context).size.width,
            height: MediaQuery.of(context).size.height,
            child: Center(
              child: dialogClass,
            ),
          ),
        );
      },
    );
  }

I also tried to show fullscreen dialog using this way, it did work to show the fullscreen dialog but scroll behavior and button click in my dialog screen didn't work when I was using this way.

openDialog(Widget dialogClass) {
    Navigator.of(context).push(MaterialPageRoute<Null>(
        builder: (BuildContext context) {
          return dialogClass;
        },
        fullscreenDialog: true));
  }

enter image description here

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source