iosfluttermodal-dialogsfsafariviewcontroller

flutter: SFSafariViewController doesn't open like a native iOS modal


In order to use SFSafariViewController in my Flutter app, I am using this package: flutter_inappwebview: ^3.3.0+3

While this works, there is a bug in the animation through which the SFSafariViewController appears.

Notice this:

Actual Behaviour

enter image description here

Expected Behaviour

enter image description here

Notice how in the second GIF, the app itself is pushed back, whereas in the first GIF, we can see a semi-transparent view created instead of the native push back animation for the app.

Here's the code that I am using:

final ChromeSafariBrowser browser = MyChromeSafariBrowser(MyInAppBrowser());
await browser.open(
        url: 'https://google.com',
        options: ChromeSafariBrowserClassOptions(
                  ios: IOSSafariOptions(
                      barCollapsingEnabled: true,
                      presentationStyle: IOSUIModalPresentationStyle.POPOVER
                ),
        ),
);

Here's the Gist for the MyChromeSafariBrowser and MyInAppBrowser class.

Can you please help me with this?


Solution

  • This was fixed in the release v4.0.0 and it is now possible to get the expected behaviour by setting

    presentationStyle: IOSUIModalPresentationStyle.POPOVER
    

    More information here: https://pub.dev/packages/flutter_inappwebview#-changelog-tab-