android – Flutter Windows – How to open webpage inside the app


I have an enterprise Flutter app which was developed primarily for Android & iOS. We added support for Windows. Currently, the app does the authentication using webview. Below is the current code.

openBrowserOverlay(String url) {
  if(Platform.isWindows) {
    launchUrl(Uri.parse(url), mode: LaunchMode.inAppWebView);
  } else {
    FlutterWebBrowser.openWebPage(
      url: url,
      customTabsOptions: CustomTabsOptions(
        instantAppsEnabled: true,
        showTitle: true,
        urlBarHidingEnabled: true,
      ),
      safariVCOptions: SafariViewControllerOptions(
        barCollapsingEnabled: true,
        entersReaderIfAvailable: true,
        modalPresentationCapturesStatusBarAppearance: true,
        dismissButtonStyle: SafariViewControllerDismissButtonStyle.done,
      ),
    );
  }
}

The flutter_inappwebview package currently support Android & iOS. For Windows, we used the url_launcher package, but it opens the webpage in a new window.

How can:

  1. One open webpage inside the windows app?
  2. Hide the URL Bar when the web page is opened?

Ideally, a package that works across platform would be best but if its not possible, happy to do condition platform specific coding.

Thanks!

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img