diff --git a/lib/pages/msg_feed_top/sys_msg/view.dart b/lib/pages/msg_feed_top/sys_msg/view.dart index b095cd70..67458dde 100644 --- a/lib/pages/msg_feed_top/sys_msg/view.dart +++ b/lib/pages/msg_feed_top/sys_msg/view.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:PiliPalaX/common/widgets/refresh_indicator.dart'; import 'package:PiliPalaX/utils/app_scheme.dart'; +import 'package:PiliPalaX/utils/id_utils.dart'; import 'package:PiliPalaX/utils/utils.dart'; import 'package:easy_debounce/easy_throttle.dart'; import 'package:flutter/gestures.dart'; @@ -170,11 +171,12 @@ class _SysMsgPageState extends State { InlineSpan _buildContent(String content) { final List spanChildren = []; RegExp urlRegExp = RegExp( - r'#\{([^}]*)\}\{([^}]*)\}|https?:\/\/[^\s/\$.?#].[^\s]*|www\.[^\s/\$.?#].[^\s]*'); + r'#\{([^}]*)\}\{([^}]*)\}|https?:\/\/[^\s/\$.?#].[^\s]*|www\.[^\s/\$.?#].[^\s]*|\【(.*?)\】'); content.splitMapJoin( urlRegExp, onMatch: (Match match) { - if (match[0]!.startsWith('#')) { + String matchStr = match[0]!; + if (matchStr.startsWith('#')) { spanChildren.add( TextSpan( text: match[1], @@ -190,6 +192,37 @@ class _SysMsgPageState extends State { }, ), ); + } 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 { spanChildren.add( TextSpan( diff --git a/lib/pages/setting/style_setting.dart b/lib/pages/setting/style_setting.dart index 4671d39e..fba6ae86 100644 --- a/lib/pages/setting/style_setting.dart +++ b/lib/pages/setting/style_setting.dart @@ -98,13 +98,13 @@ class _StyleSettingState extends State { defaultVal: true, needReboot: true, ), - const SetSwitchItem( - title: '首页背景渐变', - setKey: SettingBoxKey.enableGradientBg, - leading: Icon(Icons.gradient_outlined), - defaultVal: false, - needReboot: true, - ), + // const SetSwitchItem( + // title: '首页背景渐变', + // setKey: SettingBoxKey.enableGradientBg, + // leading: Icon(Icons.gradient_outlined), + // defaultVal: false, + // needReboot: true, + // ), ListTile( onTap: () async { double? result = await showDialog( diff --git a/lib/pages/setting/video_setting.dart b/lib/pages/setting/video_setting.dart index 2fa3bca4..6425a974 100644 --- a/lib/pages/setting/video_setting.dart +++ b/lib/pages/setting/video_setting.dart @@ -71,13 +71,13 @@ class _VideoSettingState extends State { setKey: SettingBoxKey.enableHA, defaultVal: true, ), - const SetSwitchItem( - title: '亮度记忆', - subTitle: '返回时自动调整视频亮度', - leading: Icon(Icons.brightness_6_outlined), - setKey: SettingBoxKey.enableAutoBrightness, - defaultVal: true, - ), + // const SetSwitchItem( + // title: '亮度记忆', + // subTitle: '返回时自动调整视频亮度', + // leading: Icon(Icons.brightness_6_outlined), + // setKey: SettingBoxKey.enableAutoBrightness, + // defaultVal: true, + // ), const SetSwitchItem( title: '免登录1080P', subTitle: '免登录查看1080P视频',