open link

This commit is contained in:
wgh19
2024-06-01 16:44:25 +08:00
parent 39eb5c836e
commit 1fad3694cf
3 changed files with 18 additions and 7 deletions

View File

@@ -160,7 +160,8 @@
"Manga": "漫画", "Manga": "漫画",
"Actions": "操作", "Actions": "操作",
"Current quantity": "当前数量", "Current quantity": "当前数量",
"Display the original image on the details page": "在详情页显示原图" "Display the original image on the details page": "在详情页显示原图",
"Open link": "打开链接"
}, },
"zh_TW": { "zh_TW": {
"Search": "搜索", "Search": "搜索",
@@ -323,6 +324,7 @@
"Manga": "漫畫", "Manga": "漫畫",
"Actions": "操作", "Actions": "操作",
"Current quantity": "當前數量", "Current quantity": "當前數量",
"Display the original image on the details page": "在詳情頁顯示原圖" "Display the original image on the details page": "在詳情頁顯示原圖",
"Open link": "打開鏈接"
} }
} }

View File

@@ -10,7 +10,9 @@ import 'package:pixes/network/network.dart';
import 'package:pixes/pages/illust_page.dart'; import 'package:pixes/pages/illust_page.dart';
import 'package:pixes/pages/novel_page.dart'; import 'package:pixes/pages/novel_page.dart';
import 'package:pixes/pages/user_info_page.dart'; import 'package:pixes/pages/user_info_page.dart';
import 'package:pixes/utils/app_links.dart';
import 'package:pixes/utils/block.dart'; import 'package:pixes/utils/block.dart';
import 'package:pixes/utils/ext.dart';
import 'package:pixes/utils/translation.dart'; import 'package:pixes/utils/translation.dart';
import '../components/animated_image.dart'; import '../components/animated_image.dart';
@@ -41,6 +43,12 @@ class _SearchPageState extends State<SearchPage> {
]; ];
void search() { void search() {
if (text.isURL && handleLink(Uri.parse(text))) {
return;
} else if ("https://$text".isURL &&
handleLink(Uri.parse("https://$text"))) {
return;
}
switch (searchType) { switch (searchType) {
case 0: case 0:
context.to(() => SearchResultPage(text)); context.to(() => SearchResultPage(text));
@@ -92,7 +100,8 @@ class _SearchPageState extends State<SearchPage> {
children: [ children: [
Expanded( Expanded(
child: TextBox( child: TextBox(
placeholder: searchTypes[searchType].tl, placeholder:
searchTypes[searchType].tl + ' / ' "Open link".tl,
onChanged: (s) => text = s, onChanged: (s) => text = s,
onSubmitted: (s) => search(), onSubmitted: (s) => search(),
foregroundDecoration: BoxDecoration( foregroundDecoration: BoxDecoration(
@@ -129,7 +138,7 @@ class _SearchPageState extends State<SearchPage> {
optionController.showFlyout( optionController.showFlyout(
placementMode: FlyoutPlacementMode.bottomCenter, placementMode: FlyoutPlacementMode.bottomCenter,
builder: buildSearchOption, builder: buildSearchOption,
); barrierColor: Colors.transparent);
}, },
), ),
), ),

View File

@@ -56,7 +56,7 @@ dependencies:
flutter_file_dialog: 3.0.1 flutter_file_dialog: 3.0.1
archive: ^3.5.1 archive: ^3.5.1
webview_flutter: ^4.7.0 webview_flutter: ^4.7.0
flutter_acrylic: ^1.0.0+2 flutter_acrylic: 1.0.0+2
device_info_plus: ^10.1.0 device_info_plus: ^10.1.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: