mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: sys msg
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:PiliPalaX/common/widgets/refresh_indicator.dart';
|
import 'package:PiliPalaX/common/widgets/refresh_indicator.dart';
|
||||||
import 'package:PiliPalaX/utils/app_scheme.dart';
|
import 'package:PiliPalaX/utils/app_scheme.dart';
|
||||||
|
import 'package:PiliPalaX/utils/id_utils.dart';
|
||||||
import 'package:PiliPalaX/utils/utils.dart';
|
import 'package:PiliPalaX/utils/utils.dart';
|
||||||
import 'package:easy_debounce/easy_throttle.dart';
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
@@ -170,11 +171,12 @@ class _SysMsgPageState extends State<SysMsgPage> {
|
|||||||
InlineSpan _buildContent(String content) {
|
InlineSpan _buildContent(String content) {
|
||||||
final List<InlineSpan> spanChildren = <InlineSpan>[];
|
final List<InlineSpan> spanChildren = <InlineSpan>[];
|
||||||
RegExp urlRegExp = RegExp(
|
RegExp urlRegExp = RegExp(
|
||||||
r'#\{([^}]*)\}\{([^}]*)\}|https?:\/\/[^\s/\$.?#].[^\s]*|www\.[^\s/\$.?#].[^\s]*');
|
r'#\{([^}]*)\}\{([^}]*)\}|https?:\/\/[^\s/\$.?#].[^\s]*|www\.[^\s/\$.?#].[^\s]*|\【(.*?)\】');
|
||||||
content.splitMapJoin(
|
content.splitMapJoin(
|
||||||
urlRegExp,
|
urlRegExp,
|
||||||
onMatch: (Match match) {
|
onMatch: (Match match) {
|
||||||
if (match[0]!.startsWith('#')) {
|
String matchStr = match[0]!;
|
||||||
|
if (matchStr.startsWith('#')) {
|
||||||
spanChildren.add(
|
spanChildren.add(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: match[1],
|
text: match[1],
|
||||||
@@ -190,6 +192,37 @@ class _SysMsgPageState extends State<SysMsgPage> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
} else if (matchStr.startsWith('【')) {
|
||||||
|
try {
|
||||||
|
bool isBV = match[3]?.startsWith('BV') == true;
|
||||||
|
// validate
|
||||||
|
if (isBV) {
|
||||||
|
IdUtils.bv2av(match[3]!);
|
||||||
|
} else {
|
||||||
|
IdUtils.av2bv(int.parse(match[3]!));
|
||||||
|
}
|
||||||
|
spanChildren.add(TextSpan(text: '【'));
|
||||||
|
spanChildren.add(
|
||||||
|
TextSpan(
|
||||||
|
text: match[3],
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.primary),
|
||||||
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
try {
|
||||||
|
Uri uri = Uri.parse(match[3]!);
|
||||||
|
PiliScheme.routePush(uri);
|
||||||
|
} catch (err) {
|
||||||
|
SmartDialog.showToast(err.toString());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
spanChildren.add(TextSpan(text: '】'));
|
||||||
|
} catch (e) {
|
||||||
|
spanChildren.add(
|
||||||
|
TextSpan(text: match[0]),
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
spanChildren.add(
|
spanChildren.add(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
|
|||||||
@@ -98,13 +98,13 @@ class _StyleSettingState extends State<StyleSetting> {
|
|||||||
defaultVal: true,
|
defaultVal: true,
|
||||||
needReboot: true,
|
needReboot: true,
|
||||||
),
|
),
|
||||||
const SetSwitchItem(
|
// const SetSwitchItem(
|
||||||
title: '首页背景渐变',
|
// title: '首页背景渐变',
|
||||||
setKey: SettingBoxKey.enableGradientBg,
|
// setKey: SettingBoxKey.enableGradientBg,
|
||||||
leading: Icon(Icons.gradient_outlined),
|
// leading: Icon(Icons.gradient_outlined),
|
||||||
defaultVal: false,
|
// defaultVal: false,
|
||||||
needReboot: true,
|
// needReboot: true,
|
||||||
),
|
// ),
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
double? result = await showDialog(
|
double? result = await showDialog(
|
||||||
|
|||||||
@@ -71,13 +71,13 @@ class _VideoSettingState extends State<VideoSetting> {
|
|||||||
setKey: SettingBoxKey.enableHA,
|
setKey: SettingBoxKey.enableHA,
|
||||||
defaultVal: true,
|
defaultVal: true,
|
||||||
),
|
),
|
||||||
const SetSwitchItem(
|
// const SetSwitchItem(
|
||||||
title: '亮度记忆',
|
// title: '亮度记忆',
|
||||||
subTitle: '返回时自动调整视频亮度',
|
// subTitle: '返回时自动调整视频亮度',
|
||||||
leading: Icon(Icons.brightness_6_outlined),
|
// leading: Icon(Icons.brightness_6_outlined),
|
||||||
setKey: SettingBoxKey.enableAutoBrightness,
|
// setKey: SettingBoxKey.enableAutoBrightness,
|
||||||
defaultVal: true,
|
// defaultVal: true,
|
||||||
),
|
// ),
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '免登录1080P',
|
title: '免登录1080P',
|
||||||
subTitle: '免登录查看1080P视频',
|
subTitle: '免登录查看1080P视频',
|
||||||
|
|||||||
Reference in New Issue
Block a user