mod: use inappwebview

This commit is contained in:
bggRGjQaUbCoE
2024-09-06 17:58:08 +08:00
parent c5e7943c54
commit 365d2bc643
24 changed files with 310 additions and 43 deletions

View File

@@ -103,7 +103,7 @@ class PiliScheme {
if (path.startsWith('/detail')) {
var opusId = path.split('/').last;
Get.toNamed(
'/webview',
'/webviewnew',
parameters: {
'url': 'https://www.bilibili.com/opus/$opusId',
'type': 'url',
@@ -170,7 +170,7 @@ class PiliScheme {
void getToOpusWeb() {
var opusId = path.split('/').last;
Get.toNamed(
'/webview',
'/webviewnew',
parameters: {
'url': 'https://m.bilibili.com/dynamic/$opusId',
'type': 'url',
@@ -214,7 +214,7 @@ class PiliScheme {
print(value);
SmartDialog.showToast('未知路径:$value,请截图反馈给开发者');
// Get.toNamed(
// '/webview',
// '/webviewnew',
// parameters: {
// 'url': value.dataString ?? "",
// 'type': 'url',
@@ -332,7 +332,7 @@ class PiliScheme {
);
} else {
Get.toNamed(
'/webview',
'/webviewnew',
parameters: {'url': redirectUrl, 'type': 'url', 'pageTitle': ''},
);
}
@@ -396,7 +396,7 @@ class PiliScheme {
} else {
SmartDialog.showToast('未知路径或匹配错误:$value,先采用浏览器打开');
Get.toNamed(
'/webview',
'/webviewnew',
parameters: {
'url': value.toString(),
'type': 'url',

View File

@@ -65,7 +65,7 @@ class CacheManage {
}
// 缓存大小格式转换
String formatSize(double value) {
static String formatSize(double value) {
List<String> unitArr = ['B', 'K', 'M', 'G'];
int index = 0;
while (value > 1024) {

View File

@@ -53,7 +53,7 @@ class UrlUtils {
);
} else {
await Get.toNamed(
'/webview',
'/webviewnew',
parameters: {
'url': redirectUrl,
'type': 'url',

View File

@@ -9,6 +9,7 @@ import 'package:PiliPalaX/utils/storage.dart';
import 'package:crypto/crypto.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:package_info_plus/package_info_plus.dart';
@@ -21,6 +22,22 @@ import '../models/github/latest.dart';
class Utils {
static final Random random = Random();
static void copyText(String text) {
Clipboard.setData(ClipboardData(text: text));
SmartDialog.showToast('已复制');
}
static launchURL(String url) async {
try {
final Uri uri = Uri.parse(url);
if (!await launchUrl(uri)) {
SmartDialog.showToast('Could not launch $url');
}
} catch (e) {
SmartDialog.showToast(e.toString());
}
}
static Color get vipColor {
return GStorage.brightness == Brightness.light
? const Color(0xFFFF6699)