diff --git a/wallpaper/lib/pages/mypage/mypage_controller.dart b/wallpaper/lib/pages/mypage/mypage_controller.dart index 09416ab..df0acc5 100644 --- a/wallpaper/lib/pages/mypage/mypage_controller.dart +++ b/wallpaper/lib/pages/mypage/mypage_controller.dart @@ -1,5 +1,8 @@ import 'package:get/get.dart'; +import 'package:wallpaper/routes/app_routes.dart'; class MyPageController extends GetxController { - + goWebview(String urlStr,String title) { + Get.toNamed(AppRoutes.webviewpage, arguments: {"urlStr":urlStr,"title":title}); + } } \ No newline at end of file diff --git a/wallpaper/lib/pages/mypage/mypage_view.dart b/wallpaper/lib/pages/mypage/mypage_view.dart index 865249d..b6ddc6e 100644 --- a/wallpaper/lib/pages/mypage/mypage_view.dart +++ b/wallpaper/lib/pages/mypage/mypage_view.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:wallpaper/pages/mypage/mypage_controller.dart'; -class MyPageView extends GetView { +class MyPageView extends GetView { const MyPageView({super.key}); @override @@ -19,7 +20,7 @@ class MyPageView extends GetView { title: const Text('隐私协议'), trailing: const Icon(Icons.arrow_forward_ios), onTap: () { - + controller.goWebview("http://www.baidu.com",'隐私协议'); }, ), ListTile( @@ -27,16 +28,13 @@ class MyPageView extends GetView { title: const Text('用户协议'), trailing: const Icon(Icons.arrow_forward_ios), onTap: () { - + controller.goWebview("http://www.bing.com",'用户协议'); }, ), - ListTile( - leading: const Icon(Icons.info), - title: const Text('系统版本'), - trailing: const Text("v1.0",style: TextStyle(fontSize: 14),), - onTap: () { - print(".....ssss"); - }, + const ListTile( + leading: Icon(Icons.info), + title: Text('系统版本'), + trailing: Text("v1.0",style: TextStyle(fontSize: 14),), ), ], ), diff --git a/wallpaper/lib/pages/webviewpage/webviewpage_binding.dart b/wallpaper/lib/pages/webviewpage/webviewpage_binding.dart new file mode 100644 index 0000000..7ccafd0 --- /dev/null +++ b/wallpaper/lib/pages/webviewpage/webviewpage_binding.dart @@ -0,0 +1,12 @@ +import 'package:get/get.dart'; +import 'package:wallpaper/pages/webviewpage/webviewpage_controller.dart'; + + + +class WebviewPageBinding extends Bindings { + @override + void dependencies() { + Get.put(WebviewPageController()); + } + +} \ No newline at end of file diff --git a/wallpaper/lib/pages/webviewpage/webviewpage_controller.dart b/wallpaper/lib/pages/webviewpage/webviewpage_controller.dart new file mode 100644 index 0000000..5e8600b --- /dev/null +++ b/wallpaper/lib/pages/webviewpage/webviewpage_controller.dart @@ -0,0 +1,13 @@ +import 'package:get/get.dart'; + +class WebviewPageController extends GetxController { + var urlStr = RxString(""); + var titleStr = RxString(""); + @override + void onInit() { + super.onInit(); + urlStr.value = Get.arguments["urlStr"]; + titleStr.value = Get.arguments["title"]; + + } +} \ No newline at end of file diff --git a/wallpaper/lib/pages/webviewpage/webviewpage_view.dart b/wallpaper/lib/pages/webviewpage/webviewpage_view.dart new file mode 100644 index 0000000..1ca280c --- /dev/null +++ b/wallpaper/lib/pages/webviewpage/webviewpage_view.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:get/get.dart'; +import 'package:wallpaper/pages/webviewpage/webviewpage_controller.dart'; + +class WebviewPageView extends GetView { + const WebviewPageView({super.key}); + + @override + Widget build(BuildContext context) { + return Obx(() => Scaffold( + appBar: AppBar( + title: Text(controller.titleStr.value), + ), + body: InAppWebView( + initialUrlRequest: URLRequest(url: WebUri.uri(Uri.parse(controller.urlStr.value))), + ), + )); + } +} \ No newline at end of file diff --git a/wallpaper/lib/routes/app_routes.dart b/wallpaper/lib/routes/app_routes.dart index 0cac2f4..ecf4ba7 100644 --- a/wallpaper/lib/routes/app_routes.dart +++ b/wallpaper/lib/routes/app_routes.dart @@ -15,12 +15,15 @@ import 'package:wallpaper/pages/downloadpage/downloadpage_binding.dart'; import 'package:wallpaper/pages/mypage/mypage_binding.dart'; import 'package:get/get.dart'; +import 'package:wallpaper/pages/webviewpage/webviewpage_binding.dart'; +import 'package:wallpaper/pages/webviewpage/webviewpage_view.dart'; class AppRoutes { AppRoutes._(); static const initialPage = '/tabvc'; static const imgcategorypage = "/ImgCategoryPage"; static const imgscanpage = "/imgscanpage"; + static const webviewpage = "/webviewpage"; static final routes= [ GetPage( @@ -38,6 +41,11 @@ class AppRoutes { page: ()=> ImgScanPageView(), bindings: [ImgScanPageBinding()], ), + GetPage( + name: webviewpage, + page: ()=> const WebviewPageView(), + bindings: [WebviewPageBinding()], + ), ]; diff --git a/wallpaper/macos/Flutter/GeneratedPluginRegistrant.swift b/wallpaper/macos/Flutter/GeneratedPluginRegistrant.swift index e777c67..f4894ad 100644 --- a/wallpaper/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/wallpaper/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,8 +5,10 @@ import FlutterMacOS import Foundation +import flutter_inappwebview_macos import path_provider_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) } diff --git a/wallpaper/pubspec.lock b/wallpaper/pubspec.lock index 0d32cc7..b6cd093 100644 --- a/wallpaper/pubspec.lock +++ b/wallpaper/pubspec.lock @@ -230,6 +230,62 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.0.5" + flutter_inappwebview: + dependency: "direct main" + description: + name: flutter_inappwebview + sha256: "3e9a443a18ecef966fb930c3a76ca5ab6a7aafc0c7b5e14a4a850cf107b09959" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.0.0" + flutter_inappwebview_android: + dependency: transitive + description: + name: flutter_inappwebview_android + sha256: d247f6ed417f1f8c364612fa05a2ecba7f775c8d0c044c1d3b9ee33a6515c421 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.13" + flutter_inappwebview_internal_annotations: + dependency: transitive + description: + name: flutter_inappwebview_internal_annotations + sha256: "5f80fd30e208ddded7dbbcd0d569e7995f9f63d45ea3f548d8dd4c0b473fb4c8" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.1" + flutter_inappwebview_ios: + dependency: transitive + description: + name: flutter_inappwebview_ios + sha256: f363577208b97b10b319cd0c428555cd8493e88b468019a8c5635a0e4312bd0f + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.13" + flutter_inappwebview_macos: + dependency: transitive + description: + name: flutter_inappwebview_macos + sha256: b55b9e506c549ce88e26580351d2c71d54f4825901666bd6cfa4be9415bb2636 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.11" + flutter_inappwebview_platform_interface: + dependency: transitive + description: + name: flutter_inappwebview_platform_interface + sha256: "545fd4c25a07d2775f7d5af05a979b2cac4fbf79393b0a7f5d33ba39ba4f6187" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.10" + flutter_inappwebview_web: + dependency: transitive + description: + name: flutter_inappwebview_web + sha256: d8c680abfb6fec71609a700199635d38a744df0febd5544c5a020bd73de8ee07 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.8" flutter_keyboard_visibility: dependency: "direct main" description: @@ -412,10 +468,10 @@ packages: dependency: transitive description: name: js - sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.flutter-io.cn" source: hosted - version: "0.7.1" + version: "0.6.7" json_annotation: dependency: transitive description: diff --git a/wallpaper/pubspec.yaml b/wallpaper/pubspec.yaml index a61deb3..9a19338 100644 --- a/wallpaper/pubspec.yaml +++ b/wallpaper/pubspec.yaml @@ -54,10 +54,12 @@ dependencies: #随机生成文件名 crypto: ^3.0.3 - + #android设置壁纸 async_wallpaper: ^2.0.3 + #webview网页 + flutter_inappwebview: ^6.0.0 #将图片导出到相册 image_gallery_saver: ^2.0.3 permission_handler: ^10.0.0