import 'package:flutter/material.dart'; import 'package:plugin_basic/router/basic_page_router.dart'; import 'package:shared/utils/log_utils.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import '../widget/webview_page.dart'; import 'package:auto_route/auto_route.dart'; /* * 全局的公共Web页面 */ @RoutePage() class GlobalWebPage extends HookConsumerWidget { final bool isShowAppBar; final String initialUrl; final String title; const GlobalWebPage({ Key? key, @PathParam('isShowAppBar') required this.isShowAppBar, @PathParam('initialUrl') required this.initialUrl, @PathParam('title') required this.title, }) : super(key: key); //启动当前页面 static void startInstance({ required BuildContext context, required String title, required String url, bool isShowAppBar = true, }) { context.router.push(GlobalWebPageRoute(isShowAppBar: isShowAppBar, initialUrl: url, title: title)); } @override Widget build(BuildContext context, WidgetRef ref) { Log.d("GlobalWebPage 的参数 isShowAppBar:$isShowAppBar title:$title initialUrl:$initialUrl "); return WebViewPage( showAppbar: isShowAppBar, initialUrl: initialUrl, arguments: {'title': title}, ); } }