diff --git a/lib/pages/danmaku/view.dart b/lib/pages/danmaku/view.dart index e21252171..82723b018 100644 --- a/lib/pages/danmaku/view.dart +++ b/lib/pages/danmaku/view.dart @@ -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 { _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), + ), + ); } } } diff --git a/lib/pages/dynamics/widgets/content_panel.dart b/lib/pages/dynamics/widgets/content_panel.dart index e14720dce..5dda0b65e 100644 --- a/lib/pages/dynamics/widgets/content_panel.dart +++ b/lib/pages/dynamics/widgets/content_panel.dart @@ -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, diff --git a/lib/pages/search/widgets/hot_keyword.dart b/lib/pages/search/widgets/hot_keyword.dart index 449b3b3e8..876bef01c 100644 --- a/lib/pages/search/widgets/hot_keyword.dart +++ b/lib/pages/search/widgets/hot_keyword.dart @@ -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'; diff --git a/lib/pages/setting/pages/font_size_select.dart b/lib/pages/setting/pages/font_size_select.dart index 7af3126a4..4520ff225 100644 --- a/lib/pages/setting/pages/font_size_select.dart +++ b/lib/pages/setting/pages/font_size_select.dart @@ -87,7 +87,7 @@ class _FontSizeSelectPageState extends State { divisions: list.length - 1, secondaryTrackValue: 1, onChanged: (double val) { - currentSize = double.parse(val.toStringAsFixed(2)); + currentSize = val.toPrecision(2); setState(() {}); }, ), diff --git a/lib/pages/video/detail/introduction/controller.dart b/lib/pages/video/detail/introduction/controller.dart index e28737376..eabcadad5 100644 --- a/lib/pages/video/detail/introduction/controller.dart +++ b/lib/pages/video/detail/introduction/controller.dart @@ -389,7 +389,6 @@ class VideoIntroController extends GetxController } } } catch (e) { - // ignore: avoid_print debugPrint(e.toString()); } SmartDialog.showLoading(msg: '请求中'); diff --git a/lib/pages/video/detail/widgets/expandable_section.dart b/lib/pages/video/detail/widgets/expandable_section.dart index afa68cc9f..967b0fe55 100644 --- a/lib/pages/video/detail/widgets/expandable_section.dart +++ b/lib/pages/video/detail/widgets/expandable_section.dart @@ -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 createState() => _ExpandedSectionState(); } class _ExpandedSectionState extends State diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index ccd43ad1d..1b1036972 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -1491,8 +1491,7 @@ class _HeaderControlState extends State { value: danmakuLineHeight, label: '$danmakuLineHeight', onChanged: (double val) { - danmakuLineHeight = - double.parse(val.toStringAsFixed(1)); + danmakuLineHeight = val.toPrecision(1); widget.controller!.danmakuLineHeight = danmakuLineHeight; widget.controller?.putDanmakuSettings(); diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 75352f495..71fdb1e68 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -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 _continuePlayInBackground = false.obs; /// - // ignore: prefer_final_fields - Rx _isSliderMoving = false.obs; + final Rx _isSliderMoving = false.obs; PlaylistMode _looping = PlaylistMode.none; bool _autoPlay = false; final bool _listenersInitialized = false; diff --git a/lib/plugin/pl_player/models/bottom_progress_behavior.dart b/lib/plugin/pl_player/models/bottom_progress_behavior.dart index 9914258f8..030821078 100644 --- a/lib/plugin/pl_player/models/bottom_progress_behavior.dart +++ b/lib/plugin/pl_player/models/bottom_progress_behavior.dart @@ -1,4 +1,3 @@ -// ignore: camel_case_types enum BtmProgressBehavior { alwaysShow, alwaysHide, diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 958ac9b4b..e0a6c9266 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -583,6 +583,7 @@ class _PLVideoPlayerState extends State @override Widget build(BuildContext context) { + _listenerFS?.cancel(); _listenerFS = isFullScreen ? plPlayerController.subtitleFontScaleFS.listen((value) { _updateSubtitle(value); diff --git a/lib/tcp/live.dart b/lib/tcp/live.dart index 721756b44..e0f702d0c 100644 --- a/lib/tcp/live.dart +++ b/lib/tcp/live.dart @@ -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"); }