From c9abd24426c8cf4b149e729a8794c73eca43fadd Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Sat, 12 Mar 2022 11:16:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/login/login_page.dart | 4 +-- lib/main.dart | 5 ++- lib/setting/about_page.dart | 5 ++- lib/setting/treaty_page.dart | 12 +++---- lib/setting/user_service_page.dart | 49 +++++++++++++++++++++++++++++ lib/web/web_turntable_activity.dart | 2 ++ 6 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 lib/setting/user_service_page.dart diff --git a/lib/login/login_page.dart b/lib/login/login_page.dart index b718939e..ae81fb31 100644 --- a/lib/login/login_page.dart +++ b/lib/login/login_page.dart @@ -111,7 +111,7 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { initController() { tapGestureRecognizer.onTap = () { - Navigator.of(context).pushNamed('/router/treaty_page',arguments: {"userType" : "0"}); + Navigator.of(context).pushNamed('/router/treaty_page'); }; scrollController = ScrollController(keepScrollOffset: false); @@ -1112,7 +1112,7 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { recognizer: TapGestureRecognizer() ..onTap = () { Navigator.of(context) - .popAndPushNamed('/router/treaty_page',arguments: {"userType" : "0"}); + .popAndPushNamed('/router/treaty_page'); }, ), ]), diff --git a/lib/main.dart b/lib/main.dart index 9f4b60f7..7ebc1f22 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -53,6 +53,7 @@ import 'package:huixiang/setting/logout_page.dart'; import 'package:huixiang/setting/permission_setting_page.dart'; import 'package:huixiang/setting/setting_page.dart'; import 'package:huixiang/setting/treaty_page.dart'; +import 'package:huixiang/setting/user_service_page.dart'; import 'package:huixiang/store/store_order.dart'; import 'package:huixiang/settlement/settlement.dart'; import 'package:huixiang/test_page.dart'; @@ -333,7 +334,7 @@ Map routers = { '/router/coupons_page': (context, {arguments}) => CouponsPage(), '/router/setting_page': (context, {arguments}) => SettingPage(), '/router/qr_scan': (context, {arguments}) => QrCodeScanPage(), - '/router/treaty_page': (context, {arguments}) => TreatyPage(arguments:arguments), + '/router/treaty_page': (context, {arguments}) => TreatyPage(), '/router/mine_card': (context, {arguments}) => MineCardPage(), '/router/guide_Page': (context, {arguments}) => GuidePage(), '/router/about_page': (context, {arguments}) => AboutPage(), @@ -367,4 +368,6 @@ Map routers = { LogoutPage(), '/router/logout_ing': (context, {arguments}) => LogoutIng(), + '/router/user_service_page': (context, {arguments}) => + UserServicePage(), }; diff --git a/lib/setting/about_page.dart b/lib/setting/about_page.dart index 232cb61f..c19e435e 100644 --- a/lib/setting/about_page.dart +++ b/lib/setting/about_page.dart @@ -106,14 +106,13 @@ class _AboutPage extends State { GestureDetector( child: settingSingleItem(S.of(context).yinsishengming), onTap: () { - Navigator.of(context).pushNamed('/router/treaty_page',arguments: {"userType" : "0"}); + Navigator.of(context).pushNamed('/router/treaty_page'); }, ), GestureDetector( child: settingSingleItem("用户协议"), onTap: () { - Navigator.of(context).pushNamed('/router/treaty_page', - arguments: {"userType" : "1"}); + Navigator.of(context).pushNamed('/router/user_service_page'); }, ), Padding( diff --git a/lib/setting/treaty_page.dart b/lib/setting/treaty_page.dart index 78973710..20868e08 100644 --- a/lib/setting/treaty_page.dart +++ b/lib/setting/treaty_page.dart @@ -1,14 +1,15 @@ +import 'dart:io'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:webview_flutter/webview_flutter.dart'; +import 'package:webview_flutter/src/webview_cupertino.dart'; class TreatyPage extends StatefulWidget { - final Map arguments; - - TreatyPage({this.arguments}); @override State createState() { return _TreatyPage(); @@ -22,7 +23,6 @@ class _TreatyPage extends State { @override void initState() { super.initState(); - userType = widget.arguments["userType"]; // if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); // if (Platform.isIOS) WebView.platform = CupertinoWebView(); } @@ -31,7 +31,7 @@ class _TreatyPage extends State { Widget build(BuildContext context) { return Scaffold( appBar: MyAppBar( - title: (userType == "0") ? S.of(context).yinsishengming : "用户协议", + title:S.of(context).yinsishengming, titleColor: Colors.black, background: Colors.transparent, leadingColor: Colors.black, @@ -58,7 +58,7 @@ class _TreatyPage extends State { child: Align( alignment: Alignment.center, child: Text( - (userType == "0") ? "用户注册及使用App隐私协议" : "用户协议", + "用户注册及使用App隐私协议", style: TextStyle( fontSize: 18.sp, fontWeight: MyFontWeight.semi_bold, diff --git a/lib/setting/user_service_page.dart b/lib/setting/user_service_page.dart new file mode 100644 index 00000000..1dc6fc05 --- /dev/null +++ b/lib/setting/user_service_page.dart @@ -0,0 +1,49 @@ +import 'dart:io'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:webview_flutter/webview_flutter.dart'; +import 'package:webview_flutter/src/webview_cupertino.dart'; + +class UserServicePage extends StatefulWidget { + @override + State createState() { + return _UserServicePage(); + } +} + +class _UserServicePage extends State with WidgetsBindingObserver { + var controller = new ScrollController(); + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addObserver(this); + if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); + if (Platform.isIOS) WebView.platform = CupertinoWebView(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + title:"用户协议", + titleColor: Colors.black, + background: Color(0xFFFFFFFF), + leadingColor: Colors.black, + ), + body: Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + alignment: Alignment.center, + child: + WebView( + initialUrl: "http://huixiang.lotus-wallet.com/user.html", + javascriptMode: JavascriptMode.unrestricted, + )), + ); + } +} diff --git a/lib/web/web_turntable_activity.dart b/lib/web/web_turntable_activity.dart index edc642d8..6fe1cf8c 100644 --- a/lib/web/web_turntable_activity.dart +++ b/lib/web/web_turntable_activity.dart @@ -8,6 +8,7 @@ import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:webview_flutter/webview_flutter.dart'; +import 'package:webview_flutter/src/webview_cupertino.dart'; import 'package:flutter/cupertino.dart'; class WebTurntableActivity extends StatefulWidget { @@ -35,6 +36,7 @@ class _WebTurntableActivity extends State with WidgetsBind token = value.getString('token'), }); if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); + if (Platform.isIOS) WebView.platform = CupertinoWebView(); }