|
@@ -1,12 +1,17 @@
|
|
|
+import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
+import 'package:plugin_basic/dialog/country_code_selecter.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 'package:widgets/ext/ex_widget.dart';
|
|
|
+import 'package:widgets/my_appbar.dart';
|
|
|
+import 'package:widgets/widget_export.dart';
|
|
|
import '../widget/webview_page.dart';
|
|
|
import 'package:auto_route/auto_route.dart';
|
|
|
|
|
|
/*
|
|
|
- * 全局的公共Web页面
|
|
|
+ * 全局的公共Web页面,兼容网页与富文本展示
|
|
|
*/
|
|
|
@RoutePage()
|
|
|
class GlobalWebPage extends HookConsumerWidget {
|
|
@@ -34,10 +39,34 @@ class GlobalWebPage extends HookConsumerWidget {
|
|
|
@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},
|
|
|
- );
|
|
|
+
|
|
|
+ if (initialUrl.startsWith('http')) {
|
|
|
+ //网页加载
|
|
|
+ return WebViewPage(
|
|
|
+ showAppbar: isShowAppBar,
|
|
|
+ initialUrl: initialUrl,
|
|
|
+ arguments: {'title': title},
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ //富文本加载
|
|
|
+ return Scaffold(
|
|
|
+ backgroundColor: context.appColors.whiteBG,
|
|
|
+ appBar: isShowAppBar
|
|
|
+ ? MyAppBar.appBar(
|
|
|
+ context,
|
|
|
+ title ?? "",
|
|
|
+ backgroundColor: context.appColors.backgroundWhite,
|
|
|
+ )
|
|
|
+ : null,
|
|
|
+ body: SafeArea(
|
|
|
+ bottom: true,
|
|
|
+ top: false,
|
|
|
+ child: SingleChildScrollView(
|
|
|
+ scrollDirection: Axis.vertical,
|
|
|
+ physics: const BouncingScrollPhysics(),
|
|
|
+ child: Html(data: initialUrl).paddingOnly(left: 10, right: 10),
|
|
|
+ ),
|
|
|
+ ));
|
|
|
+ }
|
|
|
}
|
|
|
}
|