add static2Scroll option

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2026-01-01 12:44:08 +08:00
parent 87c7699324
commit 80e007bac6
6 changed files with 93 additions and 74 deletions

View File

@@ -62,15 +62,14 @@ abstract final class ReplyGrpc {
), ),
MainListReply.fromBuffer, MainListReply.fromBuffer,
); );
if (res.isSuccess) { if (res case Success(:final response)) {
final mainListReply = res.data;
// keyword filter // keyword filter
if (mainListReply.hasUpTop() && needRemoveGrpc(mainListReply.upTop)) { if (response.hasUpTop() && needRemoveGrpc(response.upTop)) {
mainListReply.clearUpTop(); response.clearUpTop();
} }
if (mainListReply.replies.isNotEmpty) { if (response.replies.isNotEmpty) {
mainListReply.replies.removeWhere((item) { response.replies.removeWhere((item) {
final hasMatch = needRemoveGrpc(item); final hasMatch = needRemoveGrpc(item);
if (!hasMatch && item.replies.isNotEmpty) { if (!hasMatch && item.replies.isNotEmpty) {
item.replies.removeWhere(needRemoveGrpc); item.replies.removeWhere(needRemoveGrpc);

View File

@@ -1,5 +1,4 @@
import 'package:PiliPlus/common/widgets/button/icon_button.dart'; import 'package:PiliPlus/common/widgets/button/icon_button.dart';
import 'package:PiliPlus/pages/setting/widgets/switch_item.dart';
import 'package:PiliPlus/pages/video/introduction/ugc/widgets/menu_row.dart'; import 'package:PiliPlus/pages/video/introduction/ugc/widgets/menu_row.dart';
import 'package:PiliPlus/plugin/pl_player/controller.dart'; import 'package:PiliPlus/plugin/pl_player/controller.dart';
import 'package:PiliPlus/plugin/pl_player/utils/danmaku_options.dart'; import 'package:PiliPlus/plugin/pl_player/utils/danmaku_options.dart';
@@ -147,6 +146,11 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
setOptions(); setOptions();
} }
void updateDanmakuWeight(double val) {
plPlayerController.danmakuWeight = val.toInt();
setState(() {});
}
void onUpdateBlockType(int blockType, bool blocked) { void onUpdateBlockType(int blockType, bool blocked) {
if (blocked) { if (blocked) {
DanmakuOptions.blockTypes.remove(blockType); DanmakuOptions.blockTypes.remove(blockType);
@@ -178,9 +182,9 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
const SizedBox(height: 10), const SizedBox(height: 10),
if (!isLive) ...[ if (!isLive) ...[
Row( Row(
mainAxisAlignment: .spaceBetween,
children: [ children: [
Text('智能云屏蔽 ${plPlayerController.danmakuWeight}'), Text('智能云屏蔽 ${plPlayerController.danmakuWeight}'),
const Spacer(),
TextButton( TextButton(
style: TextButton.styleFrom( style: TextButton.styleFrom(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@@ -214,8 +218,7 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
value: plPlayerController.danmakuWeight.toDouble(), value: plPlayerController.danmakuWeight.toDouble(),
divisions: 10, divisions: 10,
label: '${plPlayerController.danmakuWeight}', label: '${plPlayerController.danmakuWeight}',
onChanged: (val) => onChanged: updateDanmakuWeight,
plPlayerController.danmakuWeight = val.toInt(),
onChangeEnd: (val) => GStorage.setting.put( onChangeEnd: (val) => GStorage.setting.put(
SettingBoxKey.danmakuWeight, SettingBoxKey.danmakuWeight,
val.toInt(), val.toInt(),
@@ -225,10 +228,9 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
), ),
], ],
const Text('按类型屏蔽'), const Text('按类型屏蔽'),
Padding( SingleChildScrollView(
padding: const EdgeInsets.only(top: 12), scrollDirection: .horizontal,
child: SingleChildScrollView( padding: const .symmetric(vertical: 10),
scrollDirection: Axis.horizontal,
child: Row( child: Row(
spacing: 10, spacing: 10,
children: blockTypesList.map( children: blockTypesList.map(
@@ -245,30 +247,45 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
).toList(), ).toList(),
), ),
), ),
), const Text('其他'),
SetSwitchItem( SingleChildScrollView(
title: '海量弹幕', scrollDirection: .horizontal,
contentPadding: EdgeInsets.zero, padding: const .symmetric(vertical: 10),
titleStyle: const TextStyle(fontSize: 14), child: Row(
defaultVal: DanmakuOptions.massiveMode, spacing: 10,
setKey: SettingBoxKey.danmakuMassiveMode, children: [
onChanged: (value) { ActionRowLineItem(
DanmakuOptions.massiveMode = value; selectStatus: DanmakuOptions.massiveMode,
onTap: () {
DanmakuOptions.massiveMode =
!DanmakuOptions.massiveMode;
setState(() {}); setState(() {});
setOptions(); setOptions();
}, },
text: '海量弹幕',
), ),
SetSwitchItem( ActionRowLineItem(
title: '滚动弹幕固定速度', selectStatus: DanmakuOptions.static2Scroll,
contentPadding: EdgeInsets.zero, onTap: () {
titleStyle: const TextStyle(fontSize: 14), DanmakuOptions.static2Scroll =
defaultVal: DanmakuOptions.scrollFixedVelocity, !DanmakuOptions.static2Scroll;
setKey: SettingBoxKey.danmakuFixedV,
onChanged: (value) {
DanmakuOptions.scrollFixedVelocity = value;
setState(() {}); setState(() {});
setOptions(); setOptions();
}, },
text: '固定转滚动',
),
ActionRowLineItem(
selectStatus: DanmakuOptions.scrollFixedVelocity,
onTap: () {
DanmakuOptions.scrollFixedVelocity =
!DanmakuOptions.scrollFixedVelocity;
setState(() {});
setOptions();
},
text: '滚动弹幕固定速度',
),
],
),
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,

View File

@@ -69,9 +69,8 @@ class _WhisperBlockPageState extends State<WhisperBlockPage> {
), ),
), ),
Expanded( Expanded(
child: Padding(
padding: const EdgeInsets.all(12),
child: SingleChildScrollView( child: SingleChildScrollView(
padding: const EdgeInsets.all(12),
child: Wrap( child: Wrap(
spacing: 12, spacing: 12,
runSpacing: 12, runSpacing: 12,
@@ -93,7 +92,6 @@ class _WhisperBlockPageState extends State<WhisperBlockPage> {
), ),
), ),
), ),
),
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 25, left: 25,

View File

@@ -16,6 +16,7 @@ abstract final class DanmakuOptions {
static double danmakuStaticDuration = Pref.danmakuStaticDuration; static double danmakuStaticDuration = Pref.danmakuStaticDuration;
static double danmakuStrokeWidth = Pref.strokeWidth; static double danmakuStrokeWidth = Pref.strokeWidth;
static bool scrollFixedVelocity = Pref.danmakuFixedV; static bool scrollFixedVelocity = Pref.danmakuFixedV;
static bool static2Scroll = Pref.static2Scroll;
static bool massiveMode = Pref.danmakuMassiveMode; static bool massiveMode = Pref.danmakuMassiveMode;
static double danmakuLineHeight = Pref.danmakuLineHeight; static double danmakuLineHeight = Pref.danmakuLineHeight;
@@ -38,7 +39,7 @@ abstract final class DanmakuOptions {
strokeWidth: danmakuStrokeWidth, strokeWidth: danmakuStrokeWidth,
scrollFixedVelocity: scrollFixedVelocity, scrollFixedVelocity: scrollFixedVelocity,
massiveMode: massiveMode, massiveMode: massiveMode,
static2Scroll: true, static2Scroll: static2Scroll,
safeArea: true, safeArea: true,
lineHeight: danmakuLineHeight, lineHeight: danmakuLineHeight,
); );

View File

@@ -192,6 +192,7 @@ abstract final class SettingBoxKey {
danmakuStaticDuration = 'danmakuStaticDuration', danmakuStaticDuration = 'danmakuStaticDuration',
danmakuMassiveMode = 'danmakuMassiveMode', danmakuMassiveMode = 'danmakuMassiveMode',
danmakuFixedV = 'danmakuFixedV', danmakuFixedV = 'danmakuFixedV',
static2Scroll = 'static2Scroll',
danmakuLineHeight = 'danmakuLineHeight', danmakuLineHeight = 'danmakuLineHeight',
strokeWidth = 'strokeWidth', strokeWidth = 'strokeWidth',
fontWeight = 'fontWeight'; fontWeight = 'fontWeight';

View File

@@ -322,6 +322,9 @@ abstract final class Pref {
static bool get danmakuFixedV => static bool get danmakuFixedV =>
_setting.get(SettingBoxKey.danmakuFixedV, defaultValue: false); _setting.get(SettingBoxKey.danmakuFixedV, defaultValue: false);
static bool get static2Scroll =>
_setting.get(SettingBoxKey.static2Scroll, defaultValue: false);
static double get subtitleFontScale => static double get subtitleFontScale =>
_setting.get(SettingBoxKey.subtitleFontScale, defaultValue: 1.0); _setting.get(SettingBoxKey.subtitleFontScale, defaultValue: 1.0);