mod: format code
This commit is contained in:
@ -222,7 +222,7 @@ class PlPlayerController {
|
||||
late double opacityVal;
|
||||
late double fontSizeVal;
|
||||
late double danmakuDurationVal;
|
||||
late List speedsList;
|
||||
late List<double> speedsList;
|
||||
// 缓存
|
||||
double? defaultDuration;
|
||||
late bool enableAutoLongPressSpeed = false;
|
||||
@ -236,24 +236,28 @@ class PlPlayerController {
|
||||
sliderPositionSeconds.value = newSecond;
|
||||
}
|
||||
}
|
||||
|
||||
void updatePositionSecond() {
|
||||
int newSecond = _position.value.inSeconds;
|
||||
if (positionSeconds.value != newSecond) {
|
||||
positionSeconds.value = newSecond;
|
||||
}
|
||||
}
|
||||
|
||||
void updateDurationSecond() {
|
||||
int newSecond = _duration.value.inSeconds;
|
||||
if (durationSeconds.value != newSecond) {
|
||||
durationSeconds.value = newSecond;
|
||||
}
|
||||
}
|
||||
|
||||
void updateBufferedSecond() {
|
||||
int newSecond = _buffered.value.inSeconds;
|
||||
if (bufferedSeconds.value != newSecond) {
|
||||
bufferedSeconds.value = newSecond;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加一个私有构造函数
|
||||
PlPlayerController._() {
|
||||
_videoType = videoType;
|
||||
@ -285,10 +289,10 @@ class PlPlayerController {
|
||||
_longPressSpeed.value = videoStorage
|
||||
.get(VideoBoxKey.longPressSpeedDefault, defaultValue: 2.0);
|
||||
}
|
||||
List speedsListTemp =
|
||||
videoStorage.get(VideoBoxKey.customSpeedsList, defaultValue: []);
|
||||
speedsList = List.from(speedsListTemp);
|
||||
for (var i in PlaySpeed.values) {
|
||||
final List<double> speedsListTemp = videoStorage
|
||||
.get(VideoBoxKey.customSpeedsList, defaultValue: <double>[]);
|
||||
speedsList = List<double>.from(speedsListTemp);
|
||||
for (final PlaySpeed i in PlaySpeed.values) {
|
||||
speedsList.add(i.value);
|
||||
}
|
||||
|
||||
@ -937,9 +941,10 @@ class PlPlayerController {
|
||||
if (!isFullScreen.value && status) {
|
||||
/// 按照视频宽高比决定全屏方向
|
||||
toggleFullScreen(true);
|
||||
|
||||
/// 进入全屏
|
||||
await enterFullScreen();
|
||||
if(mode == FullScreenMode.vertical ||
|
||||
if (mode == FullScreenMode.vertical ||
|
||||
(mode == FullScreenMode.auto && direction.value == 'vertical')) {
|
||||
await verticalScreen();
|
||||
} else {
|
||||
|
||||
@ -6,13 +6,13 @@ enum PlayRepeat {
|
||||
}
|
||||
|
||||
extension PlayRepeatExtension on PlayRepeat {
|
||||
static final List<String> _descList = [
|
||||
static final List<String> _descList = <String>[
|
||||
'播完暂停',
|
||||
'顺序播放',
|
||||
'单个循环',
|
||||
'列表循环',
|
||||
];
|
||||
get description => _descList[index];
|
||||
String get description => _descList[index];
|
||||
|
||||
static final List<double> _valueList = [
|
||||
1,
|
||||
@ -20,6 +20,6 @@ extension PlayRepeatExtension on PlayRepeat {
|
||||
3,
|
||||
4,
|
||||
];
|
||||
get value => _valueList[index];
|
||||
get defaultValue => _valueList[1];
|
||||
double get value => _valueList[index];
|
||||
double get defaultValue => _valueList[1];
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ extension PlaySpeedExtension on PlaySpeed {
|
||||
'1.75',
|
||||
'2.0',
|
||||
];
|
||||
get description => _descList[index];
|
||||
String get description => _descList[index];
|
||||
|
||||
static final List<double> _valueList = [
|
||||
0.25,
|
||||
@ -34,6 +34,6 @@ extension PlaySpeedExtension on PlaySpeed {
|
||||
1.75,
|
||||
2.0,
|
||||
];
|
||||
get value => _valueList[index];
|
||||
get defaultValue => _valueList[3];
|
||||
double get value => _valueList[index];
|
||||
double get defaultValue => _valueList[3];
|
||||
}
|
||||
|
||||
@ -9,30 +9,23 @@ import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:media_kit_video/media_kit_video.dart';
|
||||
import 'package:nil/nil.dart';
|
||||
import 'package:pilipala/plugin/pl_player/controller.dart';
|
||||
import 'package:pilipala/plugin/pl_player/models/duration.dart';
|
||||
import 'package:pilipala/plugin/pl_player/models/fullscreen_mode.dart';
|
||||
import 'package:pilipala/plugin/pl_player/models/play_status.dart';
|
||||
import 'package:pilipala/plugin/pl_player/utils.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:screen_brightness/screen_brightness.dart';
|
||||
|
||||
import 'models/bottom_progress_behavior.dart';
|
||||
import 'utils/fullscreen.dart';
|
||||
import 'widgets/app_bar_ani.dart';
|
||||
import 'widgets/backward_seek.dart';
|
||||
import 'widgets/bottom_control.dart';
|
||||
import 'widgets/common_btn.dart';
|
||||
import 'widgets/forward_seek.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
class PLVideoPlayer extends StatefulWidget {
|
||||
final PlPlayerController controller;
|
||||
final PreferredSizeWidget? headerControl;
|
||||
final PreferredSizeWidget? bottomControl;
|
||||
final Widget? danmuWidget;
|
||||
|
||||
const PLVideoPlayer({
|
||||
required this.controller,
|
||||
this.headerControl,
|
||||
@ -41,6 +34,11 @@ class PLVideoPlayer extends StatefulWidget {
|
||||
super.key,
|
||||
});
|
||||
|
||||
final PlPlayerController controller;
|
||||
final PreferredSizeWidget? headerControl;
|
||||
final PreferredSizeWidget? bottomControl;
|
||||
final Widget? danmuWidget;
|
||||
|
||||
@override
|
||||
State<PLVideoPlayer> createState() => _PLVideoPlayerState();
|
||||
}
|
||||
@ -66,7 +64,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
|
||||
double _distance = 0.0;
|
||||
// 初始手指落下位置
|
||||
double _initTapPositoin = 0.0;
|
||||
// double _initTapPositoin = 0.0;
|
||||
|
||||
// bool _volumeInterceptEventStream = false;
|
||||
|
||||
@ -90,7 +88,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
|
||||
// 双击播放、暂停
|
||||
void onDoubleTapCenter() {
|
||||
final _ = widget.controller;
|
||||
final PlPlayerController _ = widget.controller;
|
||||
if (_.videoPlayerController!.state.playing) {
|
||||
_.pause();
|
||||
} else {
|
||||
@ -98,7 +96,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
}
|
||||
}
|
||||
|
||||
doubleTapFuc(String type) {
|
||||
void doubleTapFuc(String type) {
|
||||
if (!enableQuickDouble) {
|
||||
onDoubleTapCenter();
|
||||
return;
|
||||
@ -138,7 +136,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
try {
|
||||
FlutterVolumeController.showSystemUI = true;
|
||||
_ctr.volumeValue.value = (await FlutterVolumeController.getVolume())!;
|
||||
FlutterVolumeController.addListener((value) {
|
||||
FlutterVolumeController.addListener((double value) {
|
||||
if (mounted && !_ctr.volumeInterceptEventStream.value) {
|
||||
_ctr.volumeValue.value = value;
|
||||
}
|
||||
@ -149,7 +147,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
Future.microtask(() async {
|
||||
try {
|
||||
_ctr.brightnessValue.value = await ScreenBrightness().current;
|
||||
ScreenBrightness().onCurrentBrightnessChanged.listen((value) {
|
||||
ScreenBrightness().onCurrentBrightnessChanged.listen((double value) {
|
||||
if (mounted) {
|
||||
_ctr.brightnessValue.value = value;
|
||||
}
|
||||
@ -198,9 +196,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _ = widget.controller;
|
||||
Color colorTheme = Theme.of(context).colorScheme.primary;
|
||||
TextStyle subTitleStyle = const TextStyle(
|
||||
final PlPlayerController _ = widget.controller;
|
||||
final Color colorTheme = Theme.of(context).colorScheme.primary;
|
||||
const TextStyle subTitleStyle = TextStyle(
|
||||
height: 1.5,
|
||||
fontSize: 40.0,
|
||||
letterSpacing: 0.0,
|
||||
@ -209,24 +207,22 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
fontWeight: FontWeight.normal,
|
||||
backgroundColor: Color(0xaa000000),
|
||||
);
|
||||
const textStyle = TextStyle(
|
||||
const TextStyle textStyle = TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
);
|
||||
return Stack(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
fit: StackFit.passthrough,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(
|
||||
() => Video(
|
||||
controller: videoController,
|
||||
controls: NoVideoControls,
|
||||
pauseUponEnteringBackgroundMode: !enableBackgroundPlay,
|
||||
resumeUponEnteringForegroundMode: true,
|
||||
subtitleViewConfiguration: SubtitleViewConfiguration(
|
||||
subtitleViewConfiguration: const SubtitleViewConfiguration(
|
||||
style: subTitleStyle,
|
||||
textAlign: TextAlign.center,
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
padding: EdgeInsets.all(24.0),
|
||||
),
|
||||
fit: _.videoFit.value,
|
||||
),
|
||||
@ -315,7 +311,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
/// 音量🔊 控制条展示
|
||||
Obx(
|
||||
() => Align(
|
||||
alignment: Alignment.center,
|
||||
child: AnimatedOpacity(
|
||||
curve: Curves.easeInOut,
|
||||
opacity: _ctr.volumeIndicator.value ? 1.0 : 0.0,
|
||||
@ -331,8 +326,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 34.0,
|
||||
width: 28.0,
|
||||
@ -368,7 +362,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
/// 亮度🌞 控制条展示
|
||||
Obx(
|
||||
() => Align(
|
||||
alignment: Alignment.center,
|
||||
child: AnimatedOpacity(
|
||||
curve: Curves.easeInOut,
|
||||
opacity: _ctr.brightnessIndicator.value ? 1.0 : 0.0,
|
||||
@ -384,8 +377,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 30.0,
|
||||
width: 28.0,
|
||||
@ -451,14 +443,14 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
onTap: () {
|
||||
_.controls = !_.showControls.value;
|
||||
},
|
||||
onDoubleTapDown: (details) {
|
||||
onDoubleTapDown: (TapDownDetails details) {
|
||||
// live模式下禁用 锁定时🔒禁用
|
||||
if (_.videoType.value == 'live' || _.controlsLock.value) {
|
||||
return;
|
||||
}
|
||||
final totalWidth = MediaQuery.of(context).size.width;
|
||||
final tapPosition = details.localPosition.dx;
|
||||
final sectionWidth = totalWidth / 3;
|
||||
final double totalWidth = MediaQuery.sizeOf(context).width;
|
||||
final double tapPosition = details.localPosition.dx;
|
||||
final double sectionWidth = totalWidth / 3;
|
||||
String type = 'left';
|
||||
if (tapPosition < sectionWidth) {
|
||||
type = 'left';
|
||||
@ -469,11 +461,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
}
|
||||
doubleTapFuc(type);
|
||||
},
|
||||
onLongPressStart: (detail) {
|
||||
onLongPressStart: (LongPressStartDetails detail) {
|
||||
feedBack();
|
||||
_.setDoubleSpeedStatus(true);
|
||||
},
|
||||
onLongPressEnd: (details) {
|
||||
onLongPressEnd: (LongPressEndDetails details) {
|
||||
_.setDoubleSpeedStatus(false);
|
||||
},
|
||||
|
||||
@ -483,16 +475,18 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
if (_.videoType.value == 'live' || _.controlsLock.value) {
|
||||
return;
|
||||
}
|
||||
final tapPosition = details.localPosition.dx;
|
||||
int curSliderPosition = _.sliderPosition.value.inMilliseconds;
|
||||
double scale = 90000 / MediaQuery.of(context).size.width;
|
||||
Duration pos = Duration(
|
||||
// final double tapPosition = details.localPosition.dx;
|
||||
final int curSliderPosition =
|
||||
_.sliderPosition.value.inMilliseconds;
|
||||
final double scale = 90000 / MediaQuery.sizeOf(context).width;
|
||||
final Duration pos = Duration(
|
||||
milliseconds:
|
||||
curSliderPosition + (details.delta.dx * scale).round());
|
||||
Duration result = pos.clamp(Duration.zero, _.duration.value);
|
||||
final Duration result =
|
||||
pos.clamp(Duration.zero, _.duration.value);
|
||||
_.onUpdatedSliderProgress(result);
|
||||
_.onChangedSliderStart();
|
||||
_initTapPositoin = tapPosition;
|
||||
// _initTapPositoin = tapPosition;
|
||||
},
|
||||
onHorizontalDragEnd: (DragEndDetails details) {
|
||||
if (_.videoType.value == 'live' || _.controlsLock.value) {
|
||||
@ -503,10 +497,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
},
|
||||
// 垂直方向 音量/亮度调节
|
||||
onVerticalDragUpdate: (DragUpdateDetails details) async {
|
||||
final totalWidth = MediaQuery.of(context).size.width;
|
||||
final tapPosition = details.localPosition.dx;
|
||||
final sectionWidth = totalWidth / 3;
|
||||
final delta = details.delta.dy;
|
||||
final double totalWidth = MediaQuery.sizeOf(context).width;
|
||||
final double tapPosition = details.localPosition.dx;
|
||||
final double sectionWidth = totalWidth / 3;
|
||||
final double delta = details.delta.dy;
|
||||
|
||||
/// 锁定时禁用
|
||||
if (_.controlsLock.value) {
|
||||
return;
|
||||
@ -518,12 +513,13 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
}
|
||||
if (tapPosition < sectionWidth) {
|
||||
// 左边区域 👈
|
||||
double level = (_.isFullScreen.value
|
||||
final double level = (_.isFullScreen.value
|
||||
? Get.size.height
|
||||
: screenWidth * 9 / 16) *
|
||||
3;
|
||||
final brightness = _ctr.brightnessValue.value - delta / level;
|
||||
final result = brightness.clamp(0.0, 1.0);
|
||||
final double brightness =
|
||||
_ctr.brightnessValue.value - delta / level;
|
||||
final double result = brightness.clamp(0.0, 1.0);
|
||||
setBrightness(result);
|
||||
} else if (tapPosition < sectionWidth * 2) {
|
||||
// 全屏
|
||||
@ -547,12 +543,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
_distance = dy;
|
||||
} else {
|
||||
// 右边区域 👈
|
||||
double level = (_.isFullScreen.value
|
||||
final double level = (_.isFullScreen.value
|
||||
? Get.size.height
|
||||
: screenWidth * 9 / 16) *
|
||||
3;
|
||||
final volume = _ctr.volumeValue.value - delta / level;
|
||||
final result = volume.clamp(0.0, 1.0);
|
||||
final double volume = _ctr.volumeValue.value - delta / level;
|
||||
final double result = volume.clamp(0.0, 1.0);
|
||||
setVolume(result);
|
||||
}
|
||||
},
|
||||
@ -569,7 +565,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
children: [
|
||||
if (widget.headerControl != null || _.headerControl != null)
|
||||
ClipRect(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: AppBarAni(
|
||||
controller: animationController,
|
||||
visible: !_.controlsLock.value && _.showControls.value,
|
||||
@ -579,7 +574,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
),
|
||||
const Spacer(),
|
||||
ClipRect(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: AppBarAni(
|
||||
controller: animationController,
|
||||
visible: !_.controlsLock.value && _.showControls.value,
|
||||
@ -604,23 +598,23 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
final int buffer = _.bufferedSeconds.value;
|
||||
if (defaultBtmProgressBehavior ==
|
||||
BtmProgresBehavior.alwaysHide.code) {
|
||||
return Container();
|
||||
return nil;
|
||||
}
|
||||
if (defaultBtmProgressBehavior ==
|
||||
BtmProgresBehavior.onlyShowFullScreen.code &&
|
||||
!_.isFullScreen.value) {
|
||||
return Container();
|
||||
return nil;
|
||||
} else if (defaultBtmProgressBehavior ==
|
||||
BtmProgresBehavior.onlyHideFullScreen.code &&
|
||||
_.isFullScreen.value) {
|
||||
return Container();
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (_.videoType.value == 'live') {
|
||||
return Container();
|
||||
return nil;
|
||||
}
|
||||
if (value > max || max <= 0) {
|
||||
return Container();
|
||||
return nil;
|
||||
}
|
||||
return Positioned(
|
||||
bottom: -1.5,
|
||||
@ -633,7 +627,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
progressBarColor: colorTheme,
|
||||
baseBarColor: Colors.white.withOpacity(0.2),
|
||||
bufferedBarColor:
|
||||
Theme.of(context).colorScheme.primary.withOpacity(0.4),
|
||||
Theme.of(context).colorScheme.primary.withOpacity(0.4),
|
||||
timeLabelLocation: TimeLabelLocation.none,
|
||||
thumbColor: colorTheme,
|
||||
barHeight: 3,
|
||||
@ -700,7 +694,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: RadialGradient(
|
||||
center: Alignment.center,
|
||||
colors: [Colors.black26, Colors.transparent],
|
||||
),
|
||||
),
|
||||
@ -711,7 +704,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
return nil;
|
||||
}
|
||||
}),
|
||||
|
||||
@ -732,7 +725,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
_ctr.hideSeekBackwardButton.value ? 0.0 : 1.0,
|
||||
),
|
||||
duration: const Duration(milliseconds: 500),
|
||||
builder: (context, value, child) => Opacity(
|
||||
builder: (BuildContext context, double value,
|
||||
Widget? child) =>
|
||||
Opacity(
|
||||
opacity: value,
|
||||
child: child,
|
||||
),
|
||||
@ -743,14 +738,14 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
}
|
||||
},
|
||||
child: BackwardSeekIndicator(
|
||||
onChanged: (value) {
|
||||
onChanged: (Duration value) {
|
||||
// _seekBarDeltaValueNotifier.value = -value;
|
||||
},
|
||||
onSubmitted: (value) {
|
||||
onSubmitted: (Duration value) {
|
||||
_ctr.hideSeekBackwardButton.value = true;
|
||||
Player player =
|
||||
final Player player =
|
||||
widget.controller.videoPlayerController!;
|
||||
var result = player.state.position - value;
|
||||
Duration result = player.state.position - value;
|
||||
result = result.clamp(
|
||||
Duration.zero,
|
||||
player.state.duration,
|
||||
@ -760,11 +755,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
},
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
: nil,
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width / 4,
|
||||
width: MediaQuery.sizeOf(context).width / 4,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -775,7 +770,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
end: _ctr.hideSeekForwardButton.value ? 0.0 : 1.0,
|
||||
),
|
||||
duration: const Duration(milliseconds: 500),
|
||||
builder: (context, value, child) => Opacity(
|
||||
builder: (BuildContext context, double value,
|
||||
Widget? child) =>
|
||||
Opacity(
|
||||
opacity: value,
|
||||
child: child,
|
||||
),
|
||||
@ -786,14 +783,14 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
}
|
||||
},
|
||||
child: ForwardSeekIndicator(
|
||||
onChanged: (value) {
|
||||
onChanged: (Duration value) {
|
||||
// _seekBarDeltaValueNotifier.value = value;
|
||||
},
|
||||
onSubmitted: (value) {
|
||||
onSubmitted: (Duration value) {
|
||||
_ctr.hideSeekForwardButton.value = true;
|
||||
Player player =
|
||||
final Player player =
|
||||
widget.controller.videoPlayerController!;
|
||||
var result = player.state.position + value;
|
||||
Duration result = player.state.position + value;
|
||||
result = result.clamp(
|
||||
Duration.zero,
|
||||
player.state.duration,
|
||||
@ -803,7 +800,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
},
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
: nil,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:nil/nil.dart';
|
||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||
import 'package:pilipala/plugin/pl_player/widgets/play_pause_btn.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
@ -37,7 +38,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
||||
final int max = _.durationSeconds.value;
|
||||
final int buffer = _.bufferedSeconds.value;
|
||||
if (value > max || max <= 0) {
|
||||
return Container();
|
||||
return nil;
|
||||
}
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 7, right: 7, bottom: 6),
|
||||
@ -79,8 +80,10 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
||||
Obx(() {
|
||||
return Text(
|
||||
_.durationSeconds.value >= 3600
|
||||
? printDurationWithHours(Duration(seconds: _.positionSeconds.value))
|
||||
: printDuration(Duration(seconds: _.positionSeconds.value)),
|
||||
? printDurationWithHours(
|
||||
Duration(seconds: _.positionSeconds.value))
|
||||
: printDuration(
|
||||
Duration(seconds: _.positionSeconds.value)),
|
||||
style: textStyle,
|
||||
);
|
||||
}),
|
||||
@ -90,8 +93,10 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
||||
Obx(
|
||||
() => Text(
|
||||
_.durationSeconds.value >= 3600
|
||||
? printDurationWithHours(Duration(seconds: _.durationSeconds.value))
|
||||
: printDuration(Duration(seconds: _.durationSeconds.value)),
|
||||
? printDurationWithHours(
|
||||
Duration(seconds: _.durationSeconds.value))
|
||||
: printDuration(
|
||||
Duration(seconds: _.durationSeconds.value)),
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user