mod: danmaku

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-27 10:39:53 +08:00
parent 91fc383723
commit 8e8dc273aa
11 changed files with 22 additions and 29 deletions

View File

@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:PiliPalaX/utils/extension.dart';
import 'package:canvas_danmaku/canvas_danmaku.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -100,18 +101,20 @@ class _PlDanmakuState extends State<PlDanmaku> {
_plDanmakuController.getCurrentDanmaku(currentPosition);
if (playerController.showDanmaku &&
_controller != null &&
playerController.playerStatus.status.value == PlayerStatus.playing &&
currentDanmakuList != null &&
_controller != null) {
Color? defaultColor =
playerController.blockTypes.contains(6) ? Colors.white : null;
playerController.isBuffering.value.not &&
currentDanmakuList != null) {
for (DanmakuElem e in currentDanmakuList) {
_controller!.addDanmaku(DanmakuContentItem(
e.content,
color: defaultColor ?? DmUtils.decimalToColor(e.color),
type: DmUtils.getPosition(e.mode),
));
_controller!.addDanmaku(
DanmakuContentItem(
e.content,
color: playerController.blockTypes.contains(6)
? Colors.white
: DmUtils.decimalToColor(e.color),
type: DmUtils.getPosition(e.mode),
),
);
}
}
}

View File

@@ -4,11 +4,10 @@ import 'package:flutter/material.dart';
import 'rich_node_panel.dart';
// ignore: must_be_immutable
class Content extends StatelessWidget {
dynamic item;
String? source;
Content({
final dynamic item;
final String? source;
const Content({
super.key,
this.item,
this.source,

View File

@@ -1,4 +1,3 @@
// ignore: file_names
import 'package:PiliPalaX/utils/extension.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';

View File

@@ -87,7 +87,7 @@ class _FontSizeSelectPageState extends State<FontSizeSelectPage> {
divisions: list.length - 1,
secondaryTrackValue: 1,
onChanged: (double val) {
currentSize = double.parse(val.toStringAsFixed(2));
currentSize = val.toPrecision(2);
setState(() {});
},
),

View File

@@ -389,7 +389,6 @@ class VideoIntroController extends GetxController
}
}
} catch (e) {
// ignore: avoid_print
debugPrint(e.toString());
}
SmartDialog.showLoading(msg: '请求中');

View File

@@ -1,5 +1,3 @@
// ignore_for_file: library_private_types_in_public_api
import 'package:flutter/material.dart';
class ExpandedSection extends StatefulWidget {
@@ -17,7 +15,7 @@ class ExpandedSection extends StatefulWidget {
});
@override
_ExpandedSectionState createState() => _ExpandedSectionState();
State<ExpandedSection> createState() => _ExpandedSectionState();
}
class _ExpandedSectionState extends State<ExpandedSection>

View File

@@ -1491,8 +1491,7 @@ class _HeaderControlState extends State<HeaderControl> {
value: danmakuLineHeight,
label: '$danmakuLineHeight',
onChanged: (double val) {
danmakuLineHeight =
double.parse(val.toStringAsFixed(1));
danmakuLineHeight = val.toPrecision(1);
widget.controller!.danmakuLineHeight =
danmakuLineHeight;
widget.controller?.putDanmakuSettings();

View File

@@ -1,5 +1,3 @@
// ignore_for_file: avoid_print
import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
@@ -85,8 +83,7 @@ class PlPlayerController {
final Rx<bool> _continuePlayInBackground = false.obs;
///
// ignore: prefer_final_fields
Rx<bool> _isSliderMoving = false.obs;
final Rx<bool> _isSliderMoving = false.obs;
PlaylistMode _looping = PlaylistMode.none;
bool _autoPlay = false;
final bool _listenersInitialized = false;

View File

@@ -1,4 +1,3 @@
// ignore: camel_case_types
enum BtmProgressBehavior {
alwaysShow,
alwaysHide,

View File

@@ -583,6 +583,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
@override
Widget build(BuildContext context) {
_listenerFS?.cancel();
_listenerFS = isFullScreen
? plPlayerController.subtitleFontScaleFS.listen((value) {
_updateSubtitle(value);

View File

@@ -191,8 +191,7 @@ class LiveMessageStream {
for (final server in servers) {
try {
return await WebSocket.connect(server);
// ignore: empty_catches
} catch (e) {}
} catch (_) {}
}
throw Exception("all servers connect failed");
}