Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-21 18:59:48 +08:00
parent 604d78ad6a
commit 2d66b1d8ca
4 changed files with 1113 additions and 1116 deletions

View File

@@ -59,10 +59,8 @@ class SSearchController extends GetxController {
controller.text = Get.parameters['text']!; controller.text = Get.parameters['text']!;
} }
if (recordSearchHistory.value) {
historyList = historyList =
List<String>.from(GStorage.historyWord.get('cacheList') ?? []).obs; List<String>.from(GStorage.historyWord.get('cacheList') ?? []).obs;
}
if (searchSuggestion) { if (searchSuggestion) {
_ctr = StreamController<String>(); _ctr = StreamController<String>();

View File

@@ -80,7 +80,7 @@ class _SearchPageState extends State<SearchPage> {
if (_searchController.searchSuggestion) _searchSuggest(), if (_searchController.searchSuggestion) _searchSuggest(),
if (context.orientation == Orientation.portrait) ...[ if (context.orientation == Orientation.portrait) ...[
if (_searchController.enableHotKey) hotSearch(theme), if (_searchController.enableHotKey) hotSearch(theme),
if (_searchController.recordSearchHistory.value) _history(theme), _history(theme),
if (_searchController.enableSearchRcmd) hotSearch(theme, false) if (_searchController.enableSearchRcmd) hotSearch(theme, false)
] else ] else
Row( Row(
@@ -97,7 +97,6 @@ class _SearchPageState extends State<SearchPage> {
], ],
), ),
), ),
if (_searchController.recordSearchHistory.value)
Expanded(child: _history(theme)), Expanded(child: _history(theme)),
], ],
), ),
@@ -207,28 +206,6 @@ class _SearchPageState extends State<SearchPage> {
), ),
), ),
), ),
// deprecated
// SizedBox(
// height: 34,
// child: TextButton(
// onPressed: () => Get.toNamed('/dynTopicRcmd'),
// child: Row(
// children: [
// Text(
// '话题',
// strutStyle:
// const StrutStyle(leading: 0, height: 1),
// style: style,
// ),
// Icon(
// size: 18,
// Icons.keyboard_arrow_right,
// color: outline,
// ),
// ],
// ),
// ),
// ),
], ],
) )
: text, : text,
@@ -272,9 +249,13 @@ class _SearchPageState extends State<SearchPage> {
} }
Widget _history(ThemeData theme) { Widget _history(ThemeData theme) {
final secondary = theme.colorScheme.secondary;
return Obx( return Obx(
() => Padding( () {
if (_searchController.historyList.isEmpty) {
return const SizedBox.shrink();
}
final secondary = theme.colorScheme.secondary;
return Padding(
padding: EdgeInsets.fromLTRB( padding: EdgeInsets.fromLTRB(
10, 10,
context.orientation == Orientation.landscape context.orientation == Orientation.landscape
@@ -288,7 +269,6 @@ class _SearchPageState extends State<SearchPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (_searchController.historyList.isNotEmpty)
Padding( Padding(
padding: const EdgeInsets.fromLTRB(6, 0, 6, 6), padding: const EdgeInsets.fromLTRB(6, 0, 6, 6),
child: Row( child: Row(
@@ -301,28 +281,30 @@ class _SearchPageState extends State<SearchPage> {
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Obx( Obx(
() => SizedBox( () {
bool enable =
_searchController.recordSearchHistory.value;
return SizedBox(
width: 34, width: 34,
height: 34, height: 34,
child: IconButton( child: IconButton(
iconSize: 22, iconSize: 22,
tooltip: _searchController.recordSearchHistory.value tooltip: enable ? '记录搜索' : '无痕搜索',
? '记录搜索' icon: enable
: '无痕搜索',
icon: _searchController.recordSearchHistory.value
? historyIcon(theme) ? historyIcon(theme)
: historyIcon(theme).disable(), : historyIcon(theme).disable(),
style: IconButton.styleFrom(padding: EdgeInsets.zero), style:
IconButton.styleFrom(padding: EdgeInsets.zero),
onPressed: () { onPressed: () {
enable = !enable;
_searchController.recordSearchHistory.value = _searchController.recordSearchHistory.value =
!_searchController.recordSearchHistory.value; enable;
GStorage.setting.put( GStorage.setting.put(
SettingBoxKey.recordSearchHistory, SettingBoxKey.recordSearchHistory, enable);
_searchController.recordSearchHistory.value,
);
}, },
), ),
), );
},
), ),
const Spacer(), const Spacer(),
SizedBox( SizedBox(
@@ -351,8 +333,7 @@ class _SearchPageState extends State<SearchPage> {
], ],
), ),
), ),
Obx( Wrap(
() => Wrap(
spacing: 8, spacing: 8,
runSpacing: 8, runSpacing: 8,
direction: Axis.horizontal, direction: Axis.horizontal,
@@ -367,10 +348,10 @@ class _SearchPageState extends State<SearchPage> {
) )
.toList(), .toList(),
), ),
),
], ],
), ),
), );
},
); );
} }

View File

@@ -13,6 +13,4 @@ enum PlaySpeed {
final double value; final double value;
const PlaySpeed(this.value); const PlaySpeed(this.value);
String get desc => value == 1.0 ? '正常' : value.toString();
} }

View File

@@ -693,6 +693,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
color: Colors.white, color: Colors.white,
fontSize: 12, fontSize: 12,
); );
return LayoutBuilder(
builder: (context, constraints) {
final maxWidth = constraints.maxWidth;
final maxHeight = constraints.maxHeight;
return Stack( return Stack(
fit: StackFit.passthrough, fit: StackFit.passthrough,
key: _playerKey, key: _playerKey,
@@ -720,8 +724,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
// 如果起点太靠上则屏蔽 // 如果起点太靠上则屏蔽
if (details.localFocalPoint.dy < 40) return; if (details.localFocalPoint.dy < 40) return;
if (details.localFocalPoint.dx < 40) return; if (details.localFocalPoint.dx < 40) return;
if (details.localFocalPoint.dx > context.width - 40) return; if (details.localFocalPoint.dx > maxWidth - 40) return;
if (details.localFocalPoint.dy > context.height - 40) return; if (details.localFocalPoint.dy > maxHeight - 40) return;
if (details.pointerCount == 2) { if (details.pointerCount == 2) {
interacting = true; interacting = true;
} }
@@ -737,7 +741,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
if (interacting || _initialFocalPoint == Offset.zero) return; if (interacting || _initialFocalPoint == Offset.zero) return;
Offset cumulativeDelta = Offset cumulativeDelta =
details.localFocalPoint - _initialFocalPoint; details.localFocalPoint - _initialFocalPoint;
if (details.pointerCount == 2 && cumulativeDelta.distance < 1.5) { if (details.pointerCount == 2 &&
cumulativeDelta.distance < 1.5) {
interacting = true; interacting = true;
_gestureType = null; _gestureType = null;
return; return;
@@ -746,12 +751,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
/// 锁定时禁用 /// 锁定时禁用
if (plPlayerController.controlsLock.value) return; if (plPlayerController.controlsLock.value) return;
RenderBox renderBox =
_playerKey.currentContext!.findRenderObject() as RenderBox;
if (_gestureType == null) { if (_gestureType == null) {
if (cumulativeDelta.distance < 1) return; if (cumulativeDelta.distance < 1) return;
if (cumulativeDelta.dx.abs() > 3 * cumulativeDelta.dy.abs()) { if (cumulativeDelta.dx.abs() >
3 * cumulativeDelta.dy.abs()) {
_gestureType = 'horizontal'; _gestureType = 'horizontal';
} else if (cumulativeDelta.dy.abs() > } else if (cumulativeDelta.dy.abs() >
3 * cumulativeDelta.dx.abs()) { 3 * cumulativeDelta.dx.abs()) {
@@ -762,9 +765,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
// _gestureType = 'vertical'; // _gestureType = 'vertical';
final double totalWidth = renderBox.size.width;
final double tapPosition = details.localFocalPoint.dx; final double tapPosition = details.localFocalPoint.dx;
final double sectionWidth = totalWidth / 3; final double sectionWidth = maxWidth / 3;
if (tapPosition < sectionWidth) { if (tapPosition < sectionWidth) {
if (!plPlayerController.enableSlideVolumeBrightness) { if (!plPlayerController.enableSlideVolumeBrightness) {
return; return;
@@ -797,17 +799,18 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
final int curSliderPosition = final int curSliderPosition =
plPlayerController.sliderPosition.value.inMilliseconds; plPlayerController.sliderPosition.value.inMilliseconds;
final double width = renderBox.size.width;
final Duration pos = Duration( final Duration pos = Duration(
milliseconds: curSliderPosition + milliseconds: curSliderPosition +
(plPlayerController.sliderScale * delta.dx / width) (plPlayerController.sliderScale *
delta.dx /
maxWidth)
.round()); // TODO .round()); // TODO
final Duration result = final Duration result = pos.clamp(
pos.clamp(Duration.zero, plPlayerController.duration.value); Duration.zero, plPlayerController.duration.value);
final height = renderBox.size.height * 0.125; final height = maxHeight * 0.125;
if (details.localFocalPoint.dy <= height && if (details.localFocalPoint.dy <= height &&
(details.localFocalPoint.dx >= width * 0.875 || (details.localFocalPoint.dx >= maxWidth * 0.875 ||
details.localFocalPoint.dx <= width * 0.125)) { details.localFocalPoint.dx <= maxWidth * 0.125)) {
plPlayerController.cancelSeek = true; plPlayerController.cancelSeek = true;
plPlayerController.showPreview.value = false; plPlayerController.showPreview.value = false;
if (plPlayerController.hasToast != true) { if (plPlayerController.hasToast != true) {
@@ -849,10 +852,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
if (plPlayerController.showSeekPreview && if (plPlayerController.showSeekPreview &&
plPlayerController.cancelSeek != true) { plPlayerController.cancelSeek != true) {
try { try {
plPlayerController.previewDx.value = result.inMilliseconds / plPlayerController.previewDx.value =
result.inMilliseconds /
plPlayerController plPlayerController
.durationSeconds.value.inMilliseconds * .durationSeconds.value.inMilliseconds *
renderBox.size.width; maxWidth;
if (!plPlayerController.showPreview.value) { if (!plPlayerController.showPreview.value) {
plPlayerController.showPreview.value = true; plPlayerController.showPreview.value = true;
} }
@@ -860,7 +864,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
} }
} else if (_gestureType == 'left') { } else if (_gestureType == 'left') {
// 左边区域 👈 // 左边区域 👈
final double level = renderBox.size.height * 3; final double level = maxHeight * 3;
final double brightness = final double brightness =
_brightnessValue.value - delta.dy / level; _brightnessValue.value - delta.dy / level;
final double result = brightness.clamp(0.0, 1.0); final double result = brightness.clamp(0.0, 1.0);
@@ -895,10 +899,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
} }
} else if (_gestureType == 'right') { } else if (_gestureType == 'right') {
// 右边区域 // 右边区域
final double level = renderBox.size.height * 0.5; final double level = maxHeight * 0.5;
EasyThrottle.throttle( EasyThrottle.throttle(
'setVolume', const Duration(milliseconds: 20), () { 'setVolume', const Duration(milliseconds: 20), () {
final double volume = _volumeValue.value - delta.dy / level; final double volume =
_volumeValue.value - delta.dy / level;
final double result = volume.clamp(0.0, 1.0); final double result = volume.clamp(0.0, 1.0);
setVolume(result); setVolume(result);
}); });
@@ -942,11 +947,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
!plPlayerController.enableSlideFS) { !plPlayerController.enableSlideFS) {
return; return;
} }
RenderBox renderBox =
_playerKey.currentContext!.findRenderObject() as RenderBox;
final double totalWidth = renderBox.size.width;
final double tapPosition = details.localPosition.dx; final double tapPosition = details.localPosition.dx;
final double sectionWidth = totalWidth / 3; final double sectionWidth = maxWidth / 3;
late String gestureType; late String gestureType;
if (tapPosition < sectionWidth) { if (tapPosition < sectionWidth) {
if (!plPlayerController.enableSlideVolumeBrightness) { if (!plPlayerController.enableSlideVolumeBrightness) {
@@ -975,7 +977,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
if (_gestureType == 'left') { if (_gestureType == 'left') {
// 左边区域 👈 // 左边区域 👈
final double level = renderBox.size.height * 3; final double level = maxHeight * 3;
final double brightness = final double brightness =
_brightnessValue.value - details.delta.dy / level; _brightnessValue.value - details.delta.dy / level;
final double result = brightness.clamp(0.0, 1.0); final double result = brightness.clamp(0.0, 1.0);
@@ -1009,7 +1011,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
} }
} else if (_gestureType == 'right') { } else if (_gestureType == 'right') {
// 右边区域 // 右边区域
final double level = renderBox.size.height * 0.5; final double level = maxHeight * 0.5;
EasyThrottle.throttle( EasyThrottle.throttle(
'setVolume', const Duration(milliseconds: 20), () { 'setVolume', const Duration(milliseconds: 20), () {
final double volume = final double volume =
@@ -1036,11 +1038,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
doubleTapFuc('center'); doubleTapFuc('center');
return; return;
} }
RenderBox renderBox =
_playerKey.currentContext!.findRenderObject() as RenderBox;
final double totalWidth = renderBox.size.width;
final double tapPosition = details.localPosition.dx; final double tapPosition = details.localPosition.dx;
final double sectionWidth = totalWidth / 4; final double sectionWidth = maxWidth / 4;
String type = 'left'; String type = 'left';
if (tapPosition < sectionWidth) { if (tapPosition < sectionWidth) {
type = 'left'; type = 'left';
@@ -1074,7 +1073,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
translation: const Offset(0.0, 0.3), // 上下偏移量(负数向上偏移) translation: const Offset(0.0, 0.3), // 上下偏移量(负数向上偏移)
child: AnimatedOpacity( child: AnimatedOpacity(
curve: Curves.easeInOut, curve: Curves.easeInOut,
opacity: plPlayerController.longPressStatus.value ? 1.0 : 0.0, opacity:
plPlayerController.longPressStatus.value ? 1.0 : 0.0,
duration: const Duration(milliseconds: 150), duration: const Duration(milliseconds: 150),
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
@@ -1088,8 +1088,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: Obx( child: Obx(
() => Text( () => Text(
'${plPlayerController.enableAutoLongPressSpeed ? (plPlayerController.longPressStatus.value ? plPlayerController.lastPlaybackSpeed : plPlayerController.playbackSpeed) * 2 : plPlayerController.longPressSpeed}倍速中', '${plPlayerController.enableAutoLongPressSpeed ? (plPlayerController.longPressStatus.value ? plPlayerController.lastPlaybackSpeed : plPlayerController.playbackSpeed) * 2 : plPlayerController.longPressSpeed}倍速中',
style: style: const TextStyle(
const TextStyle(color: Colors.white, fontSize: 13), color: Colors.white, fontSize: 13),
), ),
), ),
), ),
@@ -1109,7 +1109,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: Obx( child: Obx(
() => AnimatedOpacity( () => AnimatedOpacity(
curve: Curves.easeInOut, curve: Curves.easeInOut,
opacity: plPlayerController.isSliderMoving.value ? 1.0 : 0.0, opacity:
plPlayerController.isSliderMoving.value ? 1.0 : 0.0,
duration: const Duration(milliseconds: 150), duration: const Duration(milliseconds: 150),
child: IntrinsicWidth( child: IntrinsicWidth(
child: Container( child: Container(
@@ -1135,13 +1136,14 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
const SizedBox(width: 2), const SizedBox(width: 2),
Obx( Obx(
() => Text( () => Text(
plPlayerController plPlayerController.durationSeconds.value
.durationSeconds.value.inMinutes >= .inMinutes >=
60 60
? printDurationWithHours( ? printDurationWithHours(
plPlayerController.durationSeconds.value) plPlayerController
: printDuration( .durationSeconds.value)
plPlayerController.durationSeconds.value), : printDuration(plPlayerController
.durationSeconds.value),
style: textStyle, style: textStyle,
), ),
), ),
@@ -1166,8 +1168,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
opacity: _volumeIndicator.value ? 1.0 : 0.0, opacity: _volumeIndicator.value ? 1.0 : 0.0,
duration: const Duration(milliseconds: 150), duration: const Duration(milliseconds: 150),
child: Container( child: Container(
padding: padding: const EdgeInsets.symmetric(
const EdgeInsets.symmetric(horizontal: 8, vertical: 5), horizontal: 8, vertical: 5),
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Color(0x88000000), color: Color(0x88000000),
borderRadius: BorderRadius.all(Radius.circular(64)), borderRadius: BorderRadius.all(Radius.circular(64)),
@@ -1212,8 +1214,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
opacity: _brightnessIndicator.value ? 1.0 : 0.0, opacity: _brightnessIndicator.value ? 1.0 : 0.0,
duration: const Duration(milliseconds: 150), duration: const Duration(milliseconds: 150),
child: Container( child: Container(
padding: padding: const EdgeInsets.symmetric(
const EdgeInsets.symmetric(horizontal: 8, vertical: 5), horizontal: 8, vertical: 5),
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Color(0x88000000), color: Color(0x88000000),
borderRadius: BorderRadius.all(Radius.circular(64)), borderRadius: BorderRadius.all(Radius.circular(64)),
@@ -1305,12 +1307,14 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: FilledButton.tonal( child: FilledButton.tonal(
style: FilledButton.styleFrom( style: FilledButton.styleFrom(
tapTargetSize: MaterialTapTargetSize.shrinkWrap, tapTargetSize: MaterialTapTargetSize.shrinkWrap,
backgroundColor: theme.colorScheme.secondaryContainer backgroundColor: theme
.colorScheme.secondaryContainer
.withValues(alpha: 0.8), .withValues(alpha: 0.8),
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
padding: const EdgeInsets.all(15), padding: const EdgeInsets.all(15),
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(6)), borderRadius:
BorderRadius.all(Radius.circular(6)),
), ),
), ),
onPressed: () async { onPressed: () async {
@@ -1346,8 +1350,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
/// 进度条 live模式下禁用 /// 进度条 live模式下禁用
Obx( Obx(
() { () {
final int value = plPlayerController.sliderPositionSeconds.value; final int value =
final int max = plPlayerController.durationSeconds.value.inSeconds; plPlayerController.sliderPositionSeconds.value;
final int max =
plPlayerController.durationSeconds.value.inSeconds;
final int buffer = plPlayerController.bufferedSeconds.value; final int buffer = plPlayerController.bufferedSeconds.value;
if (plPlayerController.showControls.value) { if (plPlayerController.showControls.value) {
return const SizedBox.shrink(); return const SizedBox.shrink();
@@ -1405,7 +1411,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
timeLabelLocation: TimeLabelLocation.none, timeLabelLocation: TimeLabelLocation.none,
thumbColor: primary, thumbColor: primary,
barHeight: 3.5, barHeight: 3.5,
thumbRadius: draggingFixedProgressBar.value ? 7 : 2.5, thumbRadius:
draggingFixedProgressBar.value ? 7 : 2.5,
// onDragStart: (duration) { // onDragStart: (duration) {
// feedBack(); // feedBack();
// plPlayerController.onChangedSliderStart(); // plPlayerController.onChangedSliderStart();
@@ -1443,7 +1450,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: CustomPaint( child: CustomPaint(
size: const Size(double.infinity, 3.5), size: const Size(double.infinity, 3.5),
painter: SegmentProgressBar( painter: SegmentProgressBar(
segmentColors: plPlayerController.segmentList, segmentColors:
plPlayerController.segmentList,
), ),
), ),
), ),
@@ -1458,7 +1466,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: CustomPaint( child: CustomPaint(
size: const Size(double.infinity, 3.5), size: const Size(double.infinity, 3.5),
painter: SegmentProgressBar( painter: SegmentProgressBar(
segmentColors: plPlayerController.viewPointList, segmentColors:
plPlayerController.viewPointList,
), ),
), ),
), ),
@@ -1489,15 +1498,16 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
SafeArea( SafeArea(
child: Obx( child: Obx(
() => Visibility( () => Visibility(
visible: visible: plPlayerController.videoType.value != 'live' &&
plPlayerController.videoType.value != 'live' && isFullScreen, isFullScreen,
child: Align( child: Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: FractionalTranslation( child: FractionalTranslation(
translation: const Offset(1, -0.4), translation: const Offset(1, -0.4),
child: Visibility( child: Visibility(
visible: plPlayerController.showControls.value && visible: plPlayerController.showControls.value &&
(isFullScreen || plPlayerController.controlsLock.value), (isFullScreen ||
plPlayerController.controlsLock.value),
child: DecoratedBox( child: DecoratedBox(
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Color(0x45000000), color: Color(0x45000000),
@@ -1508,7 +1518,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
plPlayerController.controlsLock.value plPlayerController.controlsLock.value
? FontAwesomeIcons.lock ? FontAwesomeIcons.lock
: FontAwesomeIcons.lockOpen, : FontAwesomeIcons.lockOpen,
semanticLabel: plPlayerController.controlsLock.value semanticLabel:
plPlayerController.controlsLock.value
? '解锁' ? '解锁'
: '锁定', : '锁定',
size: 15, size: 15,
@@ -1561,13 +1572,14 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
// title: const Text('点击保存'), // title: const Text('点击保存'),
titlePadding: EdgeInsets.zero, titlePadding: EdgeInsets.zero,
contentPadding: const EdgeInsets.all(8), contentPadding: const EdgeInsets.all(8),
insetPadding: insetPadding: EdgeInsets.only(
EdgeInsets.only(left: context.width / 2), left: context.width / 2),
//移除圆角 //移除圆角
shape: const RoundedRectangleBorder(), shape: const RoundedRectangleBorder(),
content: GestureDetector( content: GestureDetector(
onTap: () async { onTap: () async {
String name = DateTime.now().toString(); String name =
DateTime.now().toString();
final SaveResult result = final SaveResult result =
await SaverGallery.saveImage( await SaverGallery.saveImage(
value, value,
@@ -1588,8 +1600,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
}, },
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints( constraints: BoxConstraints(
maxWidth: context.width / 3, maxWidth: maxWidth / 3,
maxHeight: context.height / 3, maxHeight: maxHeight / 3,
), ),
child: Image.memory(value), child: Image.memory(value),
), ),
@@ -1624,7 +1636,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
colors: [Colors.black26, Colors.transparent], colors: [Colors.black26, Colors.transparent],
), ),
), ),
child: Column(mainAxisSize: MainAxisSize.min, children: [ child:
Column(mainAxisSize: MainAxisSize.min, children: [
Image.asset( Image.asset(
'assets/images/loading.gif', 'assets/images/loading.gif',
height: 25, height: 25,
@@ -1655,7 +1668,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
/// 点击 快进/快退 /// 点击 快进/快退
Obx( Obx(
() => _mountSeekBackwardButton.value || _mountSeekForwardButton.value () => _mountSeekBackwardButton.value ||
_mountSeekForwardButton.value
? Positioned.fill( ? Positioned.fill(
child: Row( child: Row(
children: [ children: [
@@ -1669,13 +1683,15 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: child, child: child,
), ),
child: BackwardSeekIndicator( child: BackwardSeekIndicator(
duration: duration: plPlayerController
plPlayerController.fastForBackwardDuration, .fastForBackwardDuration,
onSubmitted: (Duration value) { onSubmitted: (Duration value) {
_mountSeekBackwardButton.value = false; _mountSeekBackwardButton.value = false;
final Player player = widget final Player player = widget
.plPlayerController.videoPlayerController!; .plPlayerController
Duration result = player.state.position - value; .videoPlayerController!;
Duration result =
player.state.position - value;
result = result.clamp( result = result.clamp(
Duration.zero, Duration.zero,
player.state.duration, player.state.duration,
@@ -1701,13 +1717,15 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: child, child: child,
), ),
child: ForwardSeekIndicator( child: ForwardSeekIndicator(
duration: duration: plPlayerController
plPlayerController.fastForBackwardDuration, .fastForBackwardDuration,
onSubmitted: (Duration value) { onSubmitted: (Duration value) {
_mountSeekForwardButton.value = false; _mountSeekForwardButton.value = false;
final Player player = widget final Player player = widget
.plPlayerController.videoPlayerController!; .plPlayerController
Duration result = player.state.position + value; .videoPlayerController!;
Duration result =
player.state.position + value;
result = result.clamp( result = result.clamp(
Duration.zero, Duration.zero,
player.state.duration, player.state.duration,
@@ -1729,6 +1747,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
), ),
], ],
); );
},
);
} }
} }
@@ -1785,7 +1805,8 @@ Widget buildDmChart(
} }
Widget buildSeekPreviewWidget(PlPlayerController plPlayerController) { Widget buildSeekPreviewWidget(PlPlayerController plPlayerController) {
return Obx(() { return Obx(
() {
if (!plPlayerController.showPreview.value || if (!plPlayerController.showPreview.value ||
plPlayerController.videoShot?['status'] != true) { plPlayerController.videoShot?['status'] != true) {
if (plPlayerController.videoShot == null) { if (plPlayerController.videoShot == null) {
@@ -1857,13 +1878,12 @@ Widget buildSeekPreviewWidget(PlPlayerController plPlayerController) {
); );
} catch (e) { } catch (e) {
if (kDebugMode) debugPrint('seek preview: $e'); if (kDebugMode) debugPrint('seek preview: $e');
return SizedBox.shrink( return const SizedBox.shrink();
key: ValueKey(plPlayerController.previewDx.value),
);
} }
}, },
); );
}); },
);
} }
Widget buildViewPointWidget( Widget buildViewPointWidget(