Browser constructor

const Browser({
  1. Key? key,
  2. required String? initialUriString,
  3. BrowserController? controller,
  4. BrowserPolicy? policy,
  5. Widget? topBar = const AutoBrowserTopBar(),
  6. Widget contentBuilder(
    1. BuildContext context,
    2. BrowserController controller,
    3. Widget webView
    )?,
  7. Widget? bottomBar = const AutoBrowserBottomBar(),
  8. void onShare(
    1. BuildContext context,
    2. BrowserController controller
    )? = defaultOnShare,
  9. Widget onError(
    1. BuildContext context,
    2. BrowserController controller,
    3. WebResourceError error
    ) = defaultOnError,
})

Constructs a browser widget.

Optional parameter policy specifies the allowed websites.

Optional parameter topBar is the bar above the web content. If null, no bar will be displayed.

If you want to replace some web pages with Flutter widgets, you can use contentBuilder.

Optional parameter bottomBar is the bar below the web content. If null, no bar will be displayed.

By default, a platform-specific URL sharing dialog is shown when the "share" button is pressed. You can override the behavior with onShare. If onShare is null, no "share" button will be displayed.

By default, the browser displays loading errors with its own widget. You can override the behavior with onError.

Implementation

const Browser({
  Key? key,
  required this.initialUriString,
  this.controller,
  this.policy,
  this.topBar = const AutoBrowserTopBar(),
  this.contentBuilder,
  this.bottomBar = const AutoBrowserBottomBar(),
  this.onShare = defaultOnShare,
  this.onError = defaultOnError,
}) : super(key: key);