runWebViewTitleBarWidget function

bool runWebViewTitleBarWidget(
  1. List<String> args, {
  2. WidgetBuilder? builder,
  3. Color? backgroundColor,
  4. void onError(
    1. Object error,
    2. StackTrace stack
    )?,
})

runs the title bar title bar is a widget that displays the title of the webview window return true if the args is matchs the title bar

builder custom TitleBar widget builder. can use TitleBarWebViewController to controller the WebView use TitleBarWebViewState to triger the title bar status.

Implementation

bool runWebViewTitleBarWidget(
  List<String> args, {
  WidgetBuilder? builder,
  Color? backgroundColor,
  void Function(Object error, StackTrace stack)? onError,
}) {
  if (args.isEmpty || args[0] != 'web_view_title_bar') {
    return false;
  }
  final webViewId = int.tryParse(args[1]);
  if (webViewId == null) {
    return false;
  }
  final titleBarTopPadding = int.tryParse(args.length > 2 ? args[2] : '0') ?? 0;
  runZonedGuarded(
    () {
      runApp(_TitleBarApp(
        webViewId: webViewId,
        titleBarTopPadding: titleBarTopPadding,
        backgroundColor: backgroundColor,
        builder: builder ?? _defaultTitleBar,
      ));
    },
    onError ??
        (e, s) {
          debugPrint('WebViewTitleBar: unhandled expections: $e, $s');
        },
  );

  return true;
}