global_web_page.dart 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import 'package:plugin_basic/utils/ext_get_nav.dart';
  4. import 'package:router/path/router_path.dart';
  5. import 'package:shared/utils/log_utils.dart';
  6. import '../base/base_stateless_page.dart';
  7. import '../widget/webview_page.dart';
  8. /*
  9. * 全局的公共Web页面
  10. */
  11. class GlobalWebPage extends BaseStatelessPage {
  12. GlobalWebPage({super.key});
  13. //启动当前页面
  14. static void startInstance(
  15. String title,
  16. String url, {
  17. bool isShowAppBar = true,
  18. }) {
  19. return Get.start(RouterPath.globalWeb, arguments: {'title': title, 'initialUrl': Uri.encodeFull(url), 'isShowAppBar': isShowAppBar});
  20. }
  21. @override
  22. GetxController createRawController() {
  23. throw UnimplementedError();
  24. }
  25. @override
  26. void initState() {}
  27. @override
  28. Widget buildWidget(BuildContext context) {
  29. bool isShowAppBar = Get.arguments['isShowAppBar'];
  30. String initialUrl = Get.arguments['initialUrl'];
  31. String title = Get.arguments['title'];
  32. Log.d("GlobalWebPage 的参数 isShowAppBar:$isShowAppBar title:$title initialUrl:$initialUrl ");
  33. return WebViewPage(
  34. showAppbar: isShowAppBar,
  35. initialUrl: initialUrl,
  36. arguments: {'title': title},
  37. );
  38. }
  39. }