diff --git a/star_lock/ios/Podfile.lock b/star_lock/ios/Podfile.lock index fe983598..284c6333 100644 --- a/star_lock/ios/Podfile.lock +++ b/star_lock/ios/Podfile.lock @@ -59,6 +59,8 @@ PODS: - Toast (4.0.0) - url_launcher_ios (0.0.1): - Flutter + - webview_flutter_wkwebview (0.0.1): + - Flutter DEPENDENCIES: - aj_captcha_flutter (from `.symlinks/plugins/aj_captcha_flutter/ios`) @@ -79,6 +81,7 @@ DEPENDENCIES: - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) + - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) SPEC REPOS: trunk: @@ -128,6 +131,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/sqflite/ios" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" + webview_flutter_wkwebview: + :path: ".symlinks/plugins/webview_flutter_wkwebview/ios" SPEC CHECKSUMS: aj_captcha_flutter: dd7af1aa064bdd621ae335b819bab07309c3c023 @@ -156,6 +161,7 @@ SPEC CHECKSUMS: SwiftProtobuf: 40bd808372cb8706108f22d28f8ab4a6b9bc6989 Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 + webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a PODFILE CHECKSUM: 99f32fc524867f7069762a97e548b5edf4ebf43f diff --git a/star_lock/ios/Runner/Info.plist b/star_lock/ios/Runner/Info.plist index af4195e3..a2ec65c5 100644 --- a/star_lock/ios/Runner/Info.plist +++ b/star_lock/ios/Runner/Info.plist @@ -72,6 +72,8 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + io.flutter.embedded_views_preview + UIViewControllerBasedStatusBarAppearance diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart index 02a8a7ba..6b63dfe0 100644 --- a/star_lock/lib/appRouters.dart +++ b/star_lock/lib/appRouters.dart @@ -8,6 +8,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_page.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart'; +import 'package:star_lock/mine/about/webviewShow_page.dart'; import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_page.dart'; @@ -329,6 +330,7 @@ abstract class Routers { static const expireLockChangeDatePage = '/expireLockChangeDatePage'; //即将到期列表有效期修改 static const safeVerifyPage = '/safeVerifyPage'; //删除账号安全验证 + static const webviewShowPage = '/webviewShowPage'; //网页 } abstract class AppRouters { @@ -820,6 +822,7 @@ abstract class AppRouters { GetPage(name: Routers.safeVerifyPage, page: () => const SafeVerifyPage()), GetPage( name: Routers.minePersonInfoViewSafetyProblemPage, - page: () => const MinePersonInfoViewSafetyProblemPage()) + page: () => const MinePersonInfoViewSafetyProblemPage()), + GetPage(name: Routers.webviewShowPage, page: () => const WebviewShowPage()), ]; } diff --git a/star_lock/lib/mine/about/about_page.dart b/star_lock/lib/mine/about/about_page.dart index f485d664..71999782 100644 --- a/star_lock/lib/mine/about/about_page.dart +++ b/star_lock/lib/mine/about/about_page.dart @@ -1,12 +1,22 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; import '../../app_settings/app_colors.dart'; import '../../tools/commonItem.dart'; import '../../tools/titleAppBar.dart'; import '../../translations/trans_lib.dart'; +// 网页的宏定义网址 +class XSWebviewURLMacro { + static const baseWebURL = 'http://192.168.56.101:8099'; //baseURL + static const userAgreementURL = + '$baseWebURL/page/detail?pageId=1&lang=cn'; //1用户协议 + static const privacyPolicyURL = + '$baseWebURL/page/detail?pageId=2&lang=cn'; //2隐私政策 +} + class AbountPage extends StatefulWidget { const AbountPage({Key? key}) : super(key: key); @@ -66,7 +76,13 @@ class _AbountPageState extends State { rightTitle: "", isHaveLine: false, isHaveDirection: true, - action: () {}), + action: () { + Navigator.pushNamed(context, Routers.webviewShowPage, + arguments: { + "url": XSWebviewURLMacro.userAgreementURL, + "title": '用户协议' + }); + }), Divider( height: 1, color: AppColors.greyLineColor, @@ -78,7 +94,13 @@ class _AbountPageState extends State { rightTitle: "", isHaveLine: false, isHaveDirection: true, - action: () {}), + action: () { + Navigator.pushNamed(context, Routers.webviewShowPage, + arguments: { + "url": XSWebviewURLMacro.privacyPolicyURL, + "title": '隐私政策' + }); + }), Divider( height: 1, color: AppColors.greyLineColor, diff --git a/star_lock/lib/mine/about/webviewShow_page.dart b/star_lock/lib/mine/about/webviewShow_page.dart new file mode 100644 index 00000000..5e32cf5a --- /dev/null +++ b/star_lock/lib/mine/about/webviewShow_page.dart @@ -0,0 +1,56 @@ +import 'package:flutter/material.dart'; +import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/tools/titleAppBar.dart'; +import 'package:webview_flutter/webview_flutter.dart'; + +class WebviewShowPage extends StatefulWidget { + const WebviewShowPage({Key? key}) : super(key: key); + + @override + State createState() => _WebviewShowPageState(); +} + +class _WebviewShowPageState extends State { + late WebViewController _webViewController; + String _webURL = ''; + String _webTitle = ''; + + @override + void initState() { + super.initState(); + + _webViewController = WebViewController() + ..setJavaScriptMode(JavaScriptMode.unrestricted); + } + + @override + Widget build(BuildContext context) { + dynamic obj = ModalRoute.of(context)?.settings.arguments; + if (obj != null && (obj["url"] != null)) { + _webURL = obj["url"]; + } + + if (obj != null && (obj["title"] != null)) { + _webTitle = obj["title"]; + } + + _webViewController.loadRequest(Uri.parse(_webURL)); + return Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: const Color(0xFFFFFFFF), + appBar: TitleAppBar( + barTitle: getWebTitle(), + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + body: WebViewWidget(controller: _webViewController)); + } + + String getWebTitle() { + String webTitleStr = _webTitle; + _webViewController.getTitle().then((result) { + webTitleStr = result!; + }); + return webTitleStr; + } +} diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_logic.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_logic.dart index 69bfaa75..72c5bf72 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_logic.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_logic.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; -import 'package:get/get_utils/get_utils.dart'; import 'package:star_lock/appRouters.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart'; import 'package:star_lock/tools/toast.dart'; diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index 22ae9020..f4901cd7 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -4,6 +4,7 @@ abstract class Api { // final String baseUrl = "http://wenlin.lock.star-lock.cn/api"; //曾工 final String baseUrl = "http://192.168.56.101:8099/api"; //曾工本地 // final String baseUrl = "http://192.168.1.14:8099/api"; //葛工开发环境地址 + final String baseWebURL = 'http://192.168.56.101:8099'; //关于网页网址前缀 // 登录注册 final String getVerificationCodeUrl = '/user/sendValidationCode'; diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 197db058..dfea4c56 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -110,6 +110,8 @@ dependencies: #网络图片缓存 cached_network_image: ^3.2.0 + webview_flutter: ^4.2.3 + dev_dependencies: flutter_test: sdk: flutter