Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

add customize font weight support

Prediditf0ad46f51869
diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dart
index c8877c1c..3a0bff79 100644
--- a/lib/pages/player/player_item.dart
+++ b/lib/pages/player/player_item.dart
@@ -86,6 +86,7 @@ class _PlayerItemState extends State<PlayerItem>
late bool _danmakuBiliBiliSource;
late bool _danmakuGamerSource;
late bool _danmakuDanDanSource;
+ late int _danmakuFontWeight;
// 过渡动画
late AnimationController _animationController;
@@ -725,6 +726,7 @@ class _PlayerItemState extends State<PlayerItem>
setting.get(SettingBoxKey.danmakuGamerSource, defaultValue: true);
_danmakuDanDanSource =
setting.get(SettingBoxKey.danmakuDanDanSource, defaultValue: true);
+ _danmakuFontWeight = setting.get(SettingBoxKey.danmakuFontWeight, defaultValue: 4);
haEnable = setting.get(SettingBoxKey.hAenable, defaultValue: true);
playerTimer = getPlayerTimer();
windowManager.addListener(this);
@@ -1219,6 +1221,7 @@ class _PlayerItemState extends State<PlayerItem>
fontSize: _fontSize,
duration: _duration.toInt(),
showStroke: _border,
+ fontWeight: _danmakuFontWeight,
massiveMode: _massiveMode,
),
),
diff --git a/lib/pages/settings/danmaku/danmaku_settings.dart b/lib/pages/settings/danmaku/danmaku_settings.dart
index bb796b30..48762aab 100644
--- a/lib/pages/settings/danmaku/danmaku_settings.dart
+++ b/lib/pages/settings/danmaku/danmaku_settings.dart
@@ -25,6 +25,7 @@ class _DanmakuSettingsPageState extends State<DanmakuSettingsPage> {
late dynamic defaultDanmakuArea;
late dynamic defaultDanmakuOpacity;
late dynamic defaultDanmakuFontSize;
+ late int defaultDanmakuFontWeight;
final PopularController popularController = Modular.get<PopularController>();
@override
@@ -43,6 +44,8 @@ class _DanmakuSettingsPageState extends State<DanmakuSettingsPage> {
setting.get(SettingBoxKey.danmakuOpacity, defaultValue: 1.0);
defaultDanmakuFontSize = setting.get(SettingBoxKey.danmakuFontSize,
defaultValue: (Utils.isCompact()) ? 16.0 : 25.0);
+ defaultDanmakuFontWeight =
+ setting.get(SettingBoxKey.danmakuFontWeight, defaultValue: 4);
}
void onBackPressed(BuildContext context) {
@@ -71,6 +74,13 @@ class _DanmakuSettingsPageState extends State<DanmakuSettingsPage> {
});
}
+ void updateDanmakuFontWeight(int i) async {
+ await setting.put(SettingBoxKey.danmakuFontWeight, i);
+ setState(() {
+ defaultDanmakuFontWeight = i;
+ });
+ }
+
@override
Widget build(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((_) {
@@ -190,9 +200,7 @@ class _DanmakuSettingsPageState extends State<DanmakuSettingsPage> {
TextButton(
onPressed: () async {
updateDanmakuFontSize(
- (Utils.isCompact())
- ? 16.0
- : 25.0);
+ (Utils.isCompact()) ? 16.0 : 25.0);
SmartDialog.dismiss();
},
child: const Text('默认设置'),
@@ -209,6 +217,69 @@ class _DanmakuSettingsPageState extends State<DanmakuSettingsPage> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline)),
),
+ ListTile(
+ onTap: () async {
+ SmartDialog.show(
+ useAnimation: false,
+ builder: (context) {
+ return AlertDialog(
+ title: const Text('字体字重'),
+ content: StatefulBuilder(builder:
+ (BuildContext context, StateSetter setState) {
+ return Wrap(
+ spacing: 8,
+ runSpacing: 2,
+ children: [
+ for (final int i in danFontWeightList) ...<Widget>[
+ if (i == defaultDanmakuFontWeight) ...<Widget>[
+ FilledButton(
+ onPressed: () async {
+ updateDanmakuFontWeight(i);
+ SmartDialog.dismiss();
+ },
+ child: Text(i.toString()),
+ ),
+ ] else ...[
+ FilledButton.tonal(
+ onPressed: () async {
+ updateDanmakuFontWeight(i);
+ SmartDialog.dismiss();
+ },
+ child: Text(i.toString()),
+ ),
+ ]
+ ]
+ ],
+ );
+ }),
+ actions: <Widget>[
+ TextButton(
+ onPressed: () => SmartDialog.dismiss(),
+ child: Text(
+ '取消',
+ style: TextStyle(
+ color: Theme.of(context).colorScheme.outline),
+ ),
+ ),
+ TextButton(
+ onPressed: () async {
+ updateDanmakuFontWeight(4);
+ SmartDialog.dismiss();
+ },
+ child: const Text('默认设置'),
+ ),
+ ],
+ );
+ });
+ },
+ dense: false,
+ title: const Text('字体字重'),
+ subtitle: Text('$defaultDanmakuFontWeight',
+ style: Theme.of(context)
+ .textTheme
+ .labelMedium!
+ .copyWith(color: Theme.of(context).colorScheme.outline)),
+ ),
ListTile(
onTap: () async {
SmartDialog.show(
diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart
index f05e4967..d0ab580e 100644
--- a/lib/utils/constants.dart
+++ b/lib/utils/constants.dart
@@ -91,6 +91,19 @@ final List<double> danFontList = [
32.0,
];
+// 可选弹幕字体字重
+final List<int> danFontWeightList = [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+];
+
// 可选弹幕区域
const List<double> danAreaList = [
0.25,
diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart
index 2d4ea9ab..43e7ec7c 100644
--- a/lib/utils/storage.dart
+++ b/lib/utils/storage.dart
@@ -109,6 +109,7 @@ class SettingBoxKey {
danmakuBiliBiliSource = 'danmakuBiliBiliSource',
danmakuGamerSource = 'danmakuGamerSource',
danmakuDanDanSource = 'danmakuDanDanSource',
+ danmakuFontWeight = 'danmakuFontWeight',
themeMode = 'themeMode',
themeColor = 'themeColor',
privateMode = 'privateMode',
diff --git a/pubspec.lock b/pubspec.lock
index 271b2011..4d2de62e 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -170,10 +170,10 @@ packages:
dependency: "direct main"
description:
name: canvas_danmaku
- sha256: e5eebd19588cae528123fa14c0ad080fdc96881c3018f944f910024988ddb67e
+ sha256: "539beee7dab73b0d01980194885730de11527ec0f96d9c4fa26ae4eac6699b7f"
url: "https://pub.dev"
source: hosted
- version: "0.2.2"
+ version: "0.2.3"
characters:
dependency: transitive
description:
@@ -461,10 +461,10 @@ packages:
dependency: "direct main"
description:
name: flutter_smart_dialog
- sha256: "7932ab58440379094c6a568efc329d322c6dd740e5a553080f2d56a71ed53752"
+ sha256: d7b915461fdc9bb8111d23a709b4ce910dbc4b9bef0fbd941655f74bf7de09a6
url: "https://pub.dev"
source: hosted
- version: "4.9.8+3"
+ version: "4.9.8+5"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -495,10 +495,10 @@ packages:
dependency: "direct main"
description:
name: fvp
- sha256: "439ff92c52349cb6c345f680dcbe7f7a40fcd524073030a1e93aec64f959d864"
+ sha256: "3dd245cac5dfba36311cbf5834d8f275ba1f3e49a5cdcb4a98e01cb41e9a21d8"
url: "https://pub.dev"
source: hosted
- version: "0.27.0"
+ version: "0.28.0"
glob:
dependency: transitive
description:
@@ -1023,10 +1023,10 @@ packages:
dependency: transitive
description:
name: shared_preferences
- sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051"
+ sha256: "95f9997ca1fb9799d494d0cb2a780fd7be075818d59f00c43832ed112b158a82"
url: "https://pub.dev"
source: hosted
- version: "2.3.2"
+ version: "2.3.3"
shared_preferences_android:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index f2b9b0e6..1abbb80c 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -52,7 +52,7 @@ dependencies:
flutter_smart_dialog: ^4.9.8
cached_network_image: ^3.4.1
- fvp: ^0.27.0
+ fvp: ^0.28.0
video_player: ^2.9.1
flutter_volume_controller: ^1.3.2
@@ -68,7 +68,7 @@ dependencies:
xpath_selector: ^3.0.2
xpath_selector_html_parser: ^3.0.1
webview_flutter: ^4.9.0
- canvas_danmaku: ^0.2.0
+ canvas_danmaku: ^0.2.3
webdav_client: ^1.2.2
tray_manager: ^0.2.3
dlna_dart: ^0.0.8