runWebViewTitleBarWidget function
bool
runWebViewTitleBarWidget(
- List<
String> args, { - WidgetBuilder? builder,
- Color? backgroundColor,
- void onError(
- Object error,
- 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;
}