mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-16 15:16:15 +08:00
mod: lint
mod: tweaks opt: publish page Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -3,9 +3,12 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/pair.dart';
|
||||
import 'package:PiliPlus/common/widgets/progress_bar/segment_progress_bar.dart';
|
||||
import 'package:PiliPlus/http/init.dart';
|
||||
import 'package:PiliPlus/models/common/audio_normalization.dart';
|
||||
import 'package:PiliPlus/models/common/sponsor_block/segment_type.dart';
|
||||
import 'package:PiliPlus/models/common/sponsor_block/skip_type.dart';
|
||||
import 'package:PiliPlus/models/user/danmaku_rule.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/data_source.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/data_status.dart';
|
||||
@@ -111,7 +114,6 @@ class PlPlayerController {
|
||||
dynamic _seasonId;
|
||||
dynamic _subType;
|
||||
int _heartDuration = 0;
|
||||
bool _enableHeart = true;
|
||||
|
||||
late DataSource dataSource;
|
||||
|
||||
@@ -239,14 +241,6 @@ class PlPlayerController {
|
||||
/// 弹幕开关
|
||||
RxBool isOpenDanmu = false.obs;
|
||||
|
||||
late final showFSActionItem = GStorage.showFSActionItem;
|
||||
late final enableShrinkVideoSize = GStorage.enableShrinkVideoSize;
|
||||
late final darkVideoPage = GStorage.darkVideoPage;
|
||||
late final enableSlideVolumeBrightness = GStorage.enableSlideVolumeBrightness;
|
||||
late final enableSlideFS = GStorage.enableSlideFS;
|
||||
late final enableDragSubtitle = GStorage.enableDragSubtitle;
|
||||
late final fastForBackwardDuration = GStorage.fastForBackwardDuration;
|
||||
|
||||
/// 弹幕权重
|
||||
int danmakuWeight = 0;
|
||||
late RuleFilter filters;
|
||||
@@ -279,6 +273,47 @@ class PlPlayerController {
|
||||
late double subtitleStrokeWidth = GStorage.subtitleStrokeWidth;
|
||||
late int subtitleFontWeight = GStorage.subtitleFontWeight;
|
||||
|
||||
// sponsor block
|
||||
late final bool enableSponsorBlock =
|
||||
setting.get(SettingBoxKey.enableSponsorBlock, defaultValue: false);
|
||||
late final double blockLimit = GStorage.blockLimit;
|
||||
late final List<Pair<SegmentType, SkipType>> blockSettings =
|
||||
GStorage.blockSettings;
|
||||
late final List<Color> blockColor = GStorage.blockColor;
|
||||
late final List<String> segmentTypes =
|
||||
SegmentType.values.map((item) => item.name).toList();
|
||||
late final List<String> enableList = blockSettings
|
||||
.where((item) => item.second != SkipType.disable)
|
||||
.map((item) => item.first.name)
|
||||
.toList();
|
||||
late final blockServer = GStorage.blockServer;
|
||||
|
||||
// settings
|
||||
late final showFSActionItem = GStorage.showFSActionItem;
|
||||
late final enableShrinkVideoSize = GStorage.enableShrinkVideoSize;
|
||||
late final darkVideoPage = GStorage.darkVideoPage;
|
||||
late final enableSlideVolumeBrightness = GStorage.enableSlideVolumeBrightness;
|
||||
late final enableSlideFS = GStorage.enableSlideFS;
|
||||
late final enableDragSubtitle = GStorage.enableDragSubtitle;
|
||||
late final fastForBackwardDuration = GStorage.fastForBackwardDuration;
|
||||
|
||||
late final horizontalSeasonPanel = GStorage.horizontalSeasonPanel;
|
||||
late final preInitPlayer = GStorage.preInitPlayer;
|
||||
late final showRelatedVideo = GStorage.showRelatedVideo;
|
||||
late final showVideoReply = GStorage.showVideoReply;
|
||||
late final showBangumiReply = GStorage.showBangumiReply;
|
||||
late final reverseFromFirst = GStorage.reverseFromFirst;
|
||||
late final horizontalPreview = GStorage.horizontalPreview;
|
||||
late final showDmChart = GStorage.showDmChart;
|
||||
|
||||
int? cacheVideoQa;
|
||||
late int cacheAudioQa;
|
||||
bool enableHeart = true;
|
||||
|
||||
bool enableHA =
|
||||
GStorage.setting.get(SettingBoxKey.enableHA, defaultValue: true);
|
||||
String hwdec = GStorage.hardwareDecoding;
|
||||
|
||||
// 播放顺序相关
|
||||
PlayRepeat playRepeat = PlayRepeat.pause;
|
||||
|
||||
@@ -440,6 +475,11 @@ class PlPlayerController {
|
||||
setting.get(SettingBoxKey.enableLongShowControl, defaultValue: false);
|
||||
speedList = GStorage.speedList;
|
||||
|
||||
if (!Accounts.get(AccountType.heartbeat).isLogin ||
|
||||
GStorage.localCache.get(LocalCacheKey.historyPause) == true) {
|
||||
enableHeart = false;
|
||||
}
|
||||
|
||||
// _playerEventSubs = onPlayerStatusChanged.listen((PlayerStatus status) {
|
||||
// if (status == PlayerStatus.playing) {
|
||||
// WakelockPlus.enable();
|
||||
@@ -474,9 +514,6 @@ class PlPlayerController {
|
||||
Duration? seekTo,
|
||||
// 初始化播放速度
|
||||
double speed = 1.0,
|
||||
// 硬件加速
|
||||
bool enableHA = true,
|
||||
String? hwdec,
|
||||
double? width,
|
||||
double? height,
|
||||
Duration? duration,
|
||||
@@ -485,8 +522,6 @@ class PlPlayerController {
|
||||
// 记录历史记录
|
||||
String bvid = '',
|
||||
int cid = 0,
|
||||
// 历史记录开关
|
||||
bool enableHeart = true,
|
||||
dynamic epid,
|
||||
dynamic seasonId,
|
||||
dynamic subType,
|
||||
@@ -511,7 +546,6 @@ class PlPlayerController {
|
||||
_epid = epid;
|
||||
_seasonId = seasonId;
|
||||
_subType = subType;
|
||||
_enableHeart = enableHeart;
|
||||
|
||||
if (showSeekPreview) {
|
||||
videoShot = null;
|
||||
@@ -529,7 +563,7 @@ class PlPlayerController {
|
||||
}
|
||||
// 配置Player 音轨、字幕等等
|
||||
_videoPlayerController = await _createVideoController(
|
||||
dataSource, _looping, enableHA, hwdec, width, height, seekTo);
|
||||
dataSource, _looping, width, height, seekTo);
|
||||
callback?.call();
|
||||
// 获取视频时长 00:00
|
||||
_duration.value = duration ?? _videoPlayerController!.state.duration;
|
||||
@@ -564,7 +598,7 @@ class PlPlayerController {
|
||||
final directory = await getApplicationSupportDirectory();
|
||||
shadersDirectory = Directory(path.join(directory.path, 'anime_shaders'));
|
||||
|
||||
if (!await shadersDirectory!.exists()) {
|
||||
if (!shadersDirectory!.existsSync()) {
|
||||
await shadersDirectory!.create(recursive: true);
|
||||
}
|
||||
|
||||
@@ -576,7 +610,7 @@ class PlPlayerController {
|
||||
for (var filePath in shaderFiles) {
|
||||
final fileName = filePath.split('/').last;
|
||||
final targetFile = File(path.join(shadersDirectory!.path, fileName));
|
||||
if (await targetFile.exists()) {
|
||||
if (targetFile.existsSync()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -636,8 +670,6 @@ class PlPlayerController {
|
||||
Future<Player> _createVideoController(
|
||||
DataSource dataSource,
|
||||
PlaylistMode looping,
|
||||
bool enableHA,
|
||||
String? hwdec,
|
||||
double? width,
|
||||
double? height,
|
||||
Duration? seekTo,
|
||||
@@ -1123,7 +1155,7 @@ class PlPlayerController {
|
||||
}
|
||||
|
||||
/// 调整播放时间
|
||||
onChangedSlider(double v) {
|
||||
void onChangedSlider(double v) {
|
||||
_sliderPosition.value = Duration(seconds: v.floor());
|
||||
updateSliderPositionSecond();
|
||||
}
|
||||
@@ -1278,7 +1310,7 @@ class PlPlayerController {
|
||||
}
|
||||
|
||||
/// 设置长按倍速状态 live模式下禁用
|
||||
void setLongPressStatus(bool val) async {
|
||||
Future<void> setLongPressStatus(bool val) async {
|
||||
if (videoType.value == 'live') {
|
||||
return;
|
||||
}
|
||||
@@ -1314,13 +1346,17 @@ class PlPlayerController {
|
||||
updateSubtitleStyle();
|
||||
}
|
||||
|
||||
late final FullScreenMode mode = FullScreenModeCode.fromCode(
|
||||
setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0));
|
||||
late final horizontalScreen =
|
||||
setting.get(SettingBoxKey.horizontalScreen, defaultValue: false);
|
||||
|
||||
// 全屏
|
||||
void triggerFullScreen({bool status = true, int duration = 500}) {
|
||||
EasyThrottle.throttle('fullScreen', Duration(milliseconds: duration),
|
||||
() async {
|
||||
stopScreenTimer();
|
||||
FullScreenMode mode = FullScreenModeCode.fromCode(
|
||||
setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!;
|
||||
|
||||
if (!isFullScreen.value && status) {
|
||||
hideStatusBar();
|
||||
|
||||
@@ -1354,7 +1390,7 @@ class PlPlayerController {
|
||||
if (mode == FullScreenMode.none) {
|
||||
return;
|
||||
}
|
||||
if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
||||
if (!horizontalScreen) {
|
||||
await verticalScreenForTwoSeconds();
|
||||
} else {
|
||||
await autoScreen();
|
||||
@@ -1398,7 +1434,7 @@ class PlPlayerController {
|
||||
dynamic seasonId,
|
||||
dynamic subType,
|
||||
}) async {
|
||||
if (!_enableHeart || MineController.anonymity.value || progress == 0) {
|
||||
if (!enableHeart || MineController.anonymity.value || progress == 0) {
|
||||
return;
|
||||
} else if (playerStatus.status.value == PlayerStatus.paused) {
|
||||
if (isManual.not) {
|
||||
@@ -1440,33 +1476,35 @@ class PlPlayerController {
|
||||
}
|
||||
}
|
||||
|
||||
setPlayRepeat(PlayRepeat type) {
|
||||
void setPlayRepeat(PlayRepeat type) {
|
||||
playRepeat = type;
|
||||
video.put(VideoBoxKey.playRepeat, type.value);
|
||||
}
|
||||
|
||||
void putDanmakuSettings() {
|
||||
setting.put(SettingBoxKey.danmakuWeight, danmakuWeight);
|
||||
setting.put(SettingBoxKey.danmakuBlockType, blockTypes);
|
||||
setting.put(SettingBoxKey.danmakuShowArea, showArea);
|
||||
setting.put(SettingBoxKey.danmakuOpacity, opacity);
|
||||
setting.put(SettingBoxKey.danmakuFontScale, fontSize);
|
||||
setting.put(SettingBoxKey.danmakuFontScaleFS, fontSizeFS);
|
||||
setting.put(SettingBoxKey.danmakuDuration, danmakuDuration);
|
||||
setting.put(SettingBoxKey.danmakuStaticDuration, danmakuStaticDuration);
|
||||
setting.put(SettingBoxKey.strokeWidth, strokeWidth);
|
||||
setting.put(SettingBoxKey.fontWeight, fontWeight);
|
||||
setting.put(SettingBoxKey.danmakuLineHeight, danmakuLineHeight);
|
||||
setting
|
||||
..put(SettingBoxKey.danmakuWeight, danmakuWeight)
|
||||
..put(SettingBoxKey.danmakuBlockType, blockTypes)
|
||||
..put(SettingBoxKey.danmakuShowArea, showArea)
|
||||
..put(SettingBoxKey.danmakuOpacity, opacity)
|
||||
..put(SettingBoxKey.danmakuFontScale, fontSize)
|
||||
..put(SettingBoxKey.danmakuFontScaleFS, fontSizeFS)
|
||||
..put(SettingBoxKey.danmakuDuration, danmakuDuration)
|
||||
..put(SettingBoxKey.danmakuStaticDuration, danmakuStaticDuration)
|
||||
..put(SettingBoxKey.strokeWidth, strokeWidth)
|
||||
..put(SettingBoxKey.fontWeight, fontWeight)
|
||||
..put(SettingBoxKey.danmakuLineHeight, danmakuLineHeight);
|
||||
}
|
||||
|
||||
void putSubtitleSettings() {
|
||||
setting.put(SettingBoxKey.subtitleFontScale, subtitleFontScale);
|
||||
setting.put(SettingBoxKey.subtitleFontScaleFS, subtitleFontScaleFS);
|
||||
setting.put(SettingBoxKey.subtitlePaddingH, subtitlePaddingH);
|
||||
setting.put(SettingBoxKey.subtitlePaddingB, subtitlePaddingB);
|
||||
setting.put(SettingBoxKey.subtitleBgOpaticy, subtitleBgOpaticy);
|
||||
setting.put(SettingBoxKey.subtitleStrokeWidth, subtitleStrokeWidth);
|
||||
setting.put(SettingBoxKey.subtitleFontWeight, subtitleFontWeight);
|
||||
setting
|
||||
..put(SettingBoxKey.subtitleFontScale, subtitleFontScale)
|
||||
..put(SettingBoxKey.subtitleFontScaleFS, subtitleFontScaleFS)
|
||||
..put(SettingBoxKey.subtitlePaddingH, subtitlePaddingH)
|
||||
..put(SettingBoxKey.subtitlePaddingB, subtitlePaddingB)
|
||||
..put(SettingBoxKey.subtitleBgOpaticy, subtitleBgOpaticy)
|
||||
..put(SettingBoxKey.subtitleStrokeWidth, subtitleStrokeWidth)
|
||||
..put(SettingBoxKey.subtitleFontWeight, subtitleFontWeight);
|
||||
}
|
||||
|
||||
Future<void> dispose({String type = 'single'}) async {
|
||||
@@ -1541,7 +1579,7 @@ class PlPlayerController {
|
||||
late final RxBool showPreview = false.obs;
|
||||
late final RxDouble previewDx = 0.0.obs;
|
||||
|
||||
void getVideoShot() async {
|
||||
Future<void> getVideoShot() async {
|
||||
if (_isQueryingVideoShot) {
|
||||
return;
|
||||
}
|
||||
@@ -1571,7 +1609,7 @@ class PlPlayerController {
|
||||
}
|
||||
|
||||
late final RxList dmTrend = [].obs;
|
||||
late final RxBool showDmChart = true.obs;
|
||||
late final RxBool showDmTreandChart = true.obs;
|
||||
}
|
||||
|
||||
extension BoxFitExt on BoxFit {
|
||||
|
||||
@@ -6,18 +6,13 @@ enum BtmProgressBehavior {
|
||||
}
|
||||
|
||||
extension BtmProgresBehaviorDesc on BtmProgressBehavior {
|
||||
String get description => ['始终展示', '始终隐藏', '仅全屏时展示', '仅全屏时隐藏'][index];
|
||||
String get description => const ['始终展示', '始终隐藏', '仅全屏时展示', '仅全屏时隐藏'][index];
|
||||
}
|
||||
|
||||
extension BtmProgresBehaviorCode on BtmProgressBehavior {
|
||||
static final List<int> _codeList = [0, 1, 2, 3];
|
||||
int get code => _codeList[index];
|
||||
int get code => index;
|
||||
|
||||
static BtmProgressBehavior? fromCode(int code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return BtmProgressBehavior.values[index];
|
||||
}
|
||||
return null;
|
||||
static BtmProgressBehavior fromCode(int code) {
|
||||
return BtmProgressBehavior.values[code];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ enum FullScreenMode {
|
||||
}
|
||||
|
||||
extension FullScreenModeDesc on FullScreenMode {
|
||||
String get description => [
|
||||
String get description => const [
|
||||
'按视频方向(默认)',
|
||||
'不改变当前方向',
|
||||
'强制竖屏',
|
||||
@@ -26,14 +26,9 @@ extension FullScreenModeDesc on FullScreenMode {
|
||||
}
|
||||
|
||||
extension FullScreenModeCode on FullScreenMode {
|
||||
static final List<int> _codeList = [0, 1, 2, 3, 4, 5];
|
||||
int get code => _codeList[index];
|
||||
int get code => index;
|
||||
|
||||
static FullScreenMode? fromCode(int code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return FullScreenMode.values[index];
|
||||
}
|
||||
return null;
|
||||
static FullScreenMode fromCode(int code) {
|
||||
return FullScreenMode.values[code];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ enum PlayRepeat {
|
||||
}
|
||||
|
||||
extension PlayRepeatExtension on PlayRepeat {
|
||||
static final List<String> _descList = <String>[
|
||||
static const List<String> _descList = <String>[
|
||||
'播完暂停',
|
||||
'顺序播放',
|
||||
'单个循环',
|
||||
@@ -16,7 +16,7 @@ extension PlayRepeatExtension on PlayRepeat {
|
||||
];
|
||||
String get description => _descList[index];
|
||||
|
||||
static final List<double> _valueList = [
|
||||
static const List<double> _valueList = [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
|
||||
@@ -12,7 +12,7 @@ enum PlaySpeed {
|
||||
}
|
||||
|
||||
extension PlaySpeedExtension on PlaySpeed {
|
||||
static final List<String> _descList = [
|
||||
static const List<String> _descList = [
|
||||
'0.5',
|
||||
'0.75',
|
||||
'正常',
|
||||
@@ -24,7 +24,7 @@ extension PlaySpeedExtension on PlaySpeed {
|
||||
];
|
||||
String get description => _descList[index];
|
||||
|
||||
static final List<double> _valueList = [
|
||||
static const List<double> _valueList = [
|
||||
0.5,
|
||||
0.75,
|
||||
1.0,
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/progress_bar/audio_video_progress_bar.dart';
|
||||
import 'package:PiliPlus/common/widgets/progress_bar/segment_progress_bar.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
@@ -138,7 +139,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
}
|
||||
|
||||
// 双击播放、暂停
|
||||
void onDoubleTapCenter() async {
|
||||
Future<void> onDoubleTapCenter() async {
|
||||
if (plPlayerController.videoPlayerController!.state.completed) {
|
||||
await plPlayerController.videoPlayerController!.seek(Duration.zero);
|
||||
plPlayerController.videoPlayerController!.play();
|
||||
@@ -372,13 +373,13 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
height: 30,
|
||||
alignment: Alignment.center,
|
||||
child: ComBtn(
|
||||
icon: plPlayerController.showDmChart.value
|
||||
? Icon(
|
||||
icon: plPlayerController.showDmTreandChart.value
|
||||
? const Icon(
|
||||
Icons.show_chart,
|
||||
size: 22,
|
||||
color: Colors.white,
|
||||
)
|
||||
: Stack(
|
||||
: const Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
@@ -395,8 +396,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
plPlayerController.showDmChart.value =
|
||||
!plPlayerController.showDmChart.value;
|
||||
plPlayerController.showDmTreandChart.value =
|
||||
!plPlayerController.showDmTreandChart.value;
|
||||
},
|
||||
),
|
||||
)),
|
||||
@@ -577,9 +578,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
onTap: () {
|
||||
widget.videoDetailController!.setSubtitle(0);
|
||||
},
|
||||
child: Text(
|
||||
child: const Text(
|
||||
"关闭字幕",
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
...widget.videoDetailController!.subtitles
|
||||
@@ -855,7 +856,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(6)),
|
||||
color: theme.colorScheme.secondaryContainer,
|
||||
),
|
||||
child: Text(
|
||||
@@ -869,12 +871,14 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
}
|
||||
} else {
|
||||
if (plPlayerController.cancelSeek == true) {
|
||||
plPlayerController.cancelSeek = null;
|
||||
plPlayerController.hasToast = null;
|
||||
plPlayerController
|
||||
..cancelSeek = null
|
||||
..hasToast = null;
|
||||
}
|
||||
}
|
||||
plPlayerController.onUpdatedSliderProgress(result);
|
||||
plPlayerController.onChangedSliderStart();
|
||||
plPlayerController
|
||||
..onUpdatedSliderProgress(result)
|
||||
..onChangedSliderStart();
|
||||
if (plPlayerController.showSeekPreview &&
|
||||
plPlayerController.cancelSeek != true) {
|
||||
try {
|
||||
@@ -1099,9 +1103,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
duration: const Duration(milliseconds: 150),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0x88000000),
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0x88000000),
|
||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||
),
|
||||
height: 32.0,
|
||||
width: 70.0,
|
||||
@@ -1135,9 +1139,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
child: IntrinsicWidth(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0x88000000),
|
||||
borderRadius: BorderRadius.circular(64.0),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0x88000000),
|
||||
borderRadius: BorderRadius.all(Radius.circular(64)),
|
||||
),
|
||||
height: 34.0,
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
@@ -1189,9 +1193,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0x88000000),
|
||||
borderRadius: BorderRadius.circular(64.0),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0x88000000),
|
||||
borderRadius: BorderRadius.all(Radius.circular(64)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -1235,9 +1239,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0x88000000),
|
||||
borderRadius: BorderRadius.circular(64.0),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0x88000000),
|
||||
borderRadius: BorderRadius.all(Radius.circular(64)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -1317,52 +1321,51 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
// ),
|
||||
|
||||
Obx(
|
||||
() =>
|
||||
showRestoreScaleBtn.value && plPlayerController.showControls.value
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 95),
|
||||
child: FilledButton.tonal(
|
||||
style: FilledButton.styleFrom(
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
backgroundColor: theme
|
||||
.colorScheme.secondaryContainer
|
||||
.withOpacity(0.8),
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
padding: const EdgeInsets.all(15),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
showRestoreScaleBtn.value = false;
|
||||
final animController = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 255),
|
||||
);
|
||||
final anim = Matrix4Tween(
|
||||
begin: transformationController.value,
|
||||
end: Matrix4.identity(),
|
||||
).animate(
|
||||
CurveTween(curve: Curves.easeOut)
|
||||
.animate(animController),
|
||||
);
|
||||
void listener() {
|
||||
transformationController.value = anim.value;
|
||||
}
|
||||
|
||||
animController.addListener(listener);
|
||||
await animController.forward(from: 0);
|
||||
animController.removeListener(listener);
|
||||
animController.dispose();
|
||||
},
|
||||
child: Text('还原屏幕'),
|
||||
() => showRestoreScaleBtn.value &&
|
||||
plPlayerController.showControls.value
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 95),
|
||||
child: FilledButton.tonal(
|
||||
style: FilledButton.styleFrom(
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
backgroundColor: theme.colorScheme.secondaryContainer
|
||||
.withOpacity(0.8),
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: const EdgeInsets.all(15),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
onPressed: () async {
|
||||
showRestoreScaleBtn.value = false;
|
||||
final animController = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 255),
|
||||
);
|
||||
final anim = Matrix4Tween(
|
||||
begin: transformationController.value,
|
||||
end: Matrix4.identity(),
|
||||
).animate(
|
||||
CurveTween(curve: Curves.easeOut)
|
||||
.animate(animController),
|
||||
);
|
||||
void listener() {
|
||||
transformationController.value = anim.value;
|
||||
}
|
||||
|
||||
animController.addListener(listener);
|
||||
await animController.forward(from: 0);
|
||||
animController
|
||||
..removeListener(listener)
|
||||
..dispose();
|
||||
},
|
||||
child: const Text('还原屏幕'),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
|
||||
/// 进度条 live模式下禁用
|
||||
@@ -1407,7 +1410,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
if (plPlayerController.dmTrend.isNotEmpty &&
|
||||
plPlayerController.showDmChart.value)
|
||||
plPlayerController.showDmTreandChart.value)
|
||||
buildDmChart(theme, plPlayerController),
|
||||
if (plPlayerController.viewPointList.isNotEmpty &&
|
||||
plPlayerController.showVP.value)
|
||||
@@ -1459,7 +1462,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
bottom: 0.75,
|
||||
child: IgnorePointer(
|
||||
child: CustomPaint(
|
||||
size: Size(double.infinity, 3.5),
|
||||
size: const Size(double.infinity, 3.5),
|
||||
painter: SegmentProgressBar(
|
||||
segmentColors: plPlayerController.segmentList,
|
||||
),
|
||||
@@ -1474,7 +1477,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
bottom: 0.75,
|
||||
child: IgnorePointer(
|
||||
child: CustomPaint(
|
||||
size: Size(double.infinity, 3.5),
|
||||
size: const Size(double.infinity, 3.5),
|
||||
painter: SegmentProgressBar(
|
||||
segmentColors: plPlayerController.viewPointList,
|
||||
),
|
||||
@@ -1517,9 +1520,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
visible: plPlayerController.showControls.value &&
|
||||
(isFullScreen || plPlayerController.controlsLock.value),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0x45000000),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0x45000000),
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
),
|
||||
child: ComBtn(
|
||||
icon: Icon(
|
||||
@@ -1554,9 +1557,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
visible:
|
||||
plPlayerController.showControls.value && isFullScreen,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0x45000000),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0x45000000),
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
),
|
||||
child: ComBtn(
|
||||
icon: const Icon(
|
||||
@@ -1700,11 +1703,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
Duration.zero,
|
||||
player.state.duration,
|
||||
);
|
||||
plPlayerController.seekTo(
|
||||
result,
|
||||
type: 'slider',
|
||||
);
|
||||
plPlayerController.play();
|
||||
plPlayerController
|
||||
..seekTo(
|
||||
result,
|
||||
type: 'slider',
|
||||
)
|
||||
..play();
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -1731,11 +1735,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
Duration.zero,
|
||||
player.state.duration,
|
||||
);
|
||||
plPlayerController.seekTo(
|
||||
result,
|
||||
type: 'slider',
|
||||
);
|
||||
plPlayerController.play();
|
||||
plPlayerController
|
||||
..seekTo(
|
||||
result,
|
||||
type: 'slider',
|
||||
)
|
||||
..play();
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -1871,7 +1876,9 @@ Widget buildSeekPreviewWidget(PlPlayerController plPlayerController) {
|
||||
padding: EdgeInsets.only(left: left),
|
||||
child: UnconstrainedBox(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(scale == 2.5 ? 6 : 10),
|
||||
borderRadius: scale == 2.5
|
||||
? const BorderRadius.all(Radius.circular(6))
|
||||
: StyleString.mdRadius,
|
||||
child: Align(
|
||||
widthFactor: 0.1,
|
||||
heightFactor: 0.1,
|
||||
|
||||
@@ -52,7 +52,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
if (controller.dmTrend.isNotEmpty &&
|
||||
controller.showDmChart.value)
|
||||
controller.showDmTreandChart.value)
|
||||
buildDmChart(theme, controller, 4.5),
|
||||
if (controller.viewPointList.isNotEmpty &&
|
||||
controller.showVP.value)
|
||||
@@ -99,12 +99,11 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
||||
if (controller.showSeekPreview) {
|
||||
controller.showPreview.value = false;
|
||||
}
|
||||
controller.onChangedSliderEnd();
|
||||
controller
|
||||
.onChangedSlider(duration.inSeconds.toDouble());
|
||||
controller.seekTo(
|
||||
Duration(seconds: duration.inSeconds),
|
||||
type: 'slider');
|
||||
..onChangedSliderEnd()
|
||||
..onChangedSlider(duration.inSeconds.toDouble())
|
||||
..seekTo(Duration(seconds: duration.inSeconds),
|
||||
type: 'slider');
|
||||
SemanticsService.announce(
|
||||
"${(duration.inSeconds / max * 100).round()}%",
|
||||
TextDirection.ltr);
|
||||
@@ -117,7 +116,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
||||
bottom: 5.25,
|
||||
child: IgnorePointer(
|
||||
child: CustomPaint(
|
||||
size: Size(double.infinity, 3.5),
|
||||
size: const Size(double.infinity, 3.5),
|
||||
painter: SegmentProgressBar(
|
||||
segmentColors: controller.segmentList,
|
||||
),
|
||||
@@ -132,7 +131,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
||||
bottom: 5.25,
|
||||
child: IgnorePointer(
|
||||
child: CustomPaint(
|
||||
size: Size(double.infinity, 3.5),
|
||||
size: const Size(double.infinity, 3.5),
|
||||
painter: SegmentProgressBar(
|
||||
segmentColors: controller.viewPointList,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user