diff --git a/lib/pages/hot/view.dart b/lib/pages/hot/view.dart index 38d0311c6..820f115f0 100644 --- a/lib/pages/hot/view.dart +++ b/lib/pages/hot/view.dart @@ -5,7 +5,6 @@ import 'package:PiliPlus/common/widgets/video_card_h.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/models/common/tab_type.dart'; import 'package:PiliPlus/pages/rank/view.dart'; -import 'package:PiliPlus/utils/utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:get/get.dart'; @@ -129,9 +128,13 @@ class _HotPageState extends State with AutomaticKeepAliveClientMixin { 'http://i0.hdslb.com/bfs/archive/552ebe8c4794aeef30ebd1568b59ad35f15e21ad.png', title: '每周必看', onTap: () { - Utils.handleWebview( - 'https://www.bilibili.com/h5/weekly-recommend', - inApp: true, + Get.toNamed( + '/webview', + parameters: { + 'url': + 'https://www.bilibili.com/h5/weekly-recommend' + }, + arguments: {'off': false}, ); }, ), @@ -140,9 +143,13 @@ class _HotPageState extends State with AutomaticKeepAliveClientMixin { 'http://i0.hdslb.com/bfs/archive/3693ec9335b78ca57353ac0734f36a46f3d179a9.png', title: '入站必刷', onTap: () { - Utils.handleWebview( - 'https://www.bilibili.com/h5/good-history', - inApp: true, + Get.toNamed( + '/webview', + parameters: { + 'url': + 'https://www.bilibili.com/h5/good-history' + }, + arguments: {'off': false}, ); }, ), diff --git a/lib/pages/webview/webview_page.dart b/lib/pages/webview/webview_page.dart index 78c4a1b47..ab76103ac 100644 --- a/lib/pages/webview/webview_page.dart +++ b/lib/pages/webview/webview_page.dart @@ -45,6 +45,7 @@ class _WebviewPageNewState extends State { final _titleStream = StreamController(); final _progressStream = StreamController(); bool? _inApp; + bool? _off; InAppWebViewController? _webViewController; @@ -53,6 +54,7 @@ class _WebviewPageNewState extends State { super.initState(); if (Get.arguments is Map) { _inApp = Get.arguments['inApp']; + _off = Get.arguments['off']; } } @@ -251,7 +253,7 @@ class _WebviewPageNewState extends State { bool hasMatch = await PiliScheme.routePush( navigationAction.request.url?.uriValue ?? Uri(), selfHandle: true, - off: true, + off: _off ?? true, ); // debugPrint('webview: [$url], [$hasMatch]'); if (hasMatch) { diff --git a/lib/utils/app_scheme.dart b/lib/utils/app_scheme.dart index bfe7ec51c..b71d823a5 100644 --- a/lib/utils/app_scheme.dart +++ b/lib/utils/app_scheme.dart @@ -413,7 +413,7 @@ class PiliScheme { .firstMatch(path) ?.group(1); if (bvid != null) { - videoPush(null, bvid, off: false); + videoPush(null, bvid, off: off); return true; } launchURL();