fix: danmaku block

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-26 18:10:30 +08:00
parent d3c7b3830f
commit 79da08b285
59 changed files with 207 additions and 303 deletions

View File

@@ -34,6 +34,7 @@ import 'package:PiliPalaX/plugin/pl_player/index.dart';
import 'package:PiliPalaX/utils/storage.dart';
import 'package:PiliPalaX/utils/utils.dart';
import 'package:PiliPalaX/utils/video_utils.dart';
import 'package:hive/hive.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import '../../../utils/id_utils.dart';
@@ -206,6 +207,8 @@ class VideoDetailController extends GetxController
Floating? floating;
late PreferredSizeWidget headerControl;
Box get setting => GStorage.setting;
// late bool enableCDN;
int? cacheVideoQa;
late String cacheDecode;
@@ -285,7 +288,7 @@ class VideoDetailController extends GetxController
hwdec.value = setting.get(SettingBoxKey.hardwareDecoding,
defaultValue: Platform.isAndroid ? 'auto-safe' : 'auto');
if (userInfo == null ||
localCache.get(LocalCacheKey.historyPause) == true) {
GStorage.localCache.get(LocalCacheKey.historyPause) == true) {
enableHeart = false;
}
danmakuCid.value = cid.value;

View File

@@ -9,7 +9,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:get/get_navigation/src/dialog/dialog_route.dart';
import 'package:hive/hive.dart';
import 'package:PiliPalaX/http/constants.dart';
import 'package:PiliPalaX/http/user.dart';
import 'package:PiliPalaX/http/video.dart';
@@ -60,7 +59,6 @@ class VideoIntroController extends GetxController
RxBool hasCoin = false.obs;
// 是否收藏
RxBool hasFav = false.obs;
Box userInfoCache = GStorage.userInfo;
bool userLogin = false;
Rx<FavFolderData> favFolderData = FavFolderData().obs;
List addMediaIdsNew = [];
@@ -85,7 +83,7 @@ class VideoIntroController extends GetxController
@override
void onInit() {
super.onInit();
userInfo = userInfoCache.get('userInfoCache');
userInfo = GStorage.userInfo.get('userInfoCache');
try {
if (heroTag.isEmpty) {
heroTag = Get.arguments['heroTag'];
@@ -114,8 +112,8 @@ class VideoIntroController extends GetxController
}
userLogin = userInfo != null;
lastPlayCid.value = int.parse(Get.parameters['cid']!);
isShowOnlineTotal =
setting.get(SettingBoxKey.enableOnlineTotal, defaultValue: true);
isShowOnlineTotal = GStorage.setting
.get(SettingBoxKey.enableOnlineTotal, defaultValue: true);
startTimer();
queryVideoIntro();
}

View File

@@ -8,7 +8,6 @@ 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:hive/hive.dart';
import 'package:PiliPalaX/common/widgets/badge.dart';
import 'package:PiliPalaX/common/widgets/network_img_layer.dart';
import 'package:PiliPalaX/models/common/reply_type.dart';
@@ -21,8 +20,6 @@ import 'package:PiliPalaX/utils/utils.dart';
import '../../../../../utils/app_scheme.dart';
import 'zan.dart';
Box setting = GStorage.setting;
class ReplyItem extends StatelessWidget {
const ReplyItem({
super.key,
@@ -746,8 +743,8 @@ class ReplyItem extends StatelessWidget {
);
} else {
String appUrlSchema = '';
final bool enableWordRe = setting.get(SettingBoxKey.enableWordRe,
defaultValue: false) as bool;
final bool enableWordRe = GStorage.setting
.get(SettingBoxKey.enableWordRe, defaultValue: false) as bool;
if (content.jumpUrl[matchStr] != null &&
!matchedStrs.contains(matchStr)) {
appUrlSchema = content.jumpUrl[matchStr]['app_url_schema'];

View File

@@ -73,8 +73,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
PlayerStatus playerStatus = PlayerStatus.playing;
double doubleOffset = 0;
final Box<dynamic> localCache = GStorage.localCache;
final Box<dynamic> setting = GStorage.setting;
late Future _futureBuilderFuture;
// 自动退出全屏
late bool autoExitFullscreen;
@@ -103,6 +101,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
StreamSubscription? _listenerLoadingState;
StreamSubscription? _listenerCid;
Box get setting => GStorage.setting;
@override
void initState() {
super.initState();

View File

@@ -55,8 +55,6 @@ class _HeaderControlState extends State<HeaderControl> {
static const TextStyle subTitleStyle = TextStyle(fontSize: 12);
static const TextStyle titleStyle = TextStyle(fontSize: 14);
Size get preferredSize => const Size(double.infinity, kToolbarHeight);
final Box<dynamic> localCache = GStorage.localCache;
final Box<dynamic> videoStorage = GStorage.video;
double buttonSpace = 8;
// bool isFullScreen = false;
late String heroTag;
@@ -68,6 +66,7 @@ class _HeaderControlState extends State<HeaderControl> {
Timer? clock;
late String defaultCDNService;
bool get isFullScreen => widget.controller!.isFullScreen.value;
Box get setting => GStorage.setting;
@override
void initState() {
@@ -1046,7 +1045,7 @@ class _HeaderControlState extends State<HeaderControl> {
{'value': 1.0, 'label': '满屏'},
];
// 智能云屏蔽
int danmakuWeight = widget.controller!.danmakuWeight.value;
int danmakuWeight = widget.controller!.danmakuWeight;
// 显示区域
double showArea = widget.controller!.showArea;
// 不透明度
@@ -1116,7 +1115,7 @@ class _HeaderControlState extends State<HeaderControl> {
arguments: widget.controller)
},
child: Text(
"屏蔽管理(${widget.controller!.danmakuFilterRule.value.length})")),
"屏蔽管理(${widget.controller!.danmakuFilterRule.length})")),
],
),
Padding(
@@ -1143,8 +1142,7 @@ class _HeaderControlState extends State<HeaderControl> {
label: '$danmakuWeight',
onChanged: (double val) {
danmakuWeight = val.toInt();
widget.controller!.danmakuWeight.value =
danmakuWeight;
widget.controller!.danmakuWeight = danmakuWeight;
widget.controller!.putDanmakuSettings();
setState(() {});
},