mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08:00
refa: segment progressbar
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -22,9 +22,31 @@ class BottomControl extends StatelessWidget {
|
||||
final double maxWidth;
|
||||
final bool isFullScreen;
|
||||
final PlPlayerController controller;
|
||||
final Widget Function() buildBottomControl;
|
||||
final ValueGetter<Widget> buildBottomControl;
|
||||
final VideoDetailController videoDetailController;
|
||||
|
||||
void onDragStart(ThumbDragDetails duration) {
|
||||
feedBack();
|
||||
controller.onChangedSliderStart(duration.timeStamp);
|
||||
}
|
||||
|
||||
void onDragUpdate(ThumbDragDetails duration, int max) {
|
||||
if (!controller.isFileSource && controller.showSeekPreview) {
|
||||
controller.updatePreviewIndex(duration.timeStamp.inSeconds);
|
||||
}
|
||||
controller.onUpdatedSliderProgress(duration.timeStamp);
|
||||
}
|
||||
|
||||
void onSeek(Duration duration, int max) {
|
||||
if (controller.showSeekPreview) {
|
||||
controller.showPreview.value = false;
|
||||
}
|
||||
controller
|
||||
..onChangedSliderEnd()
|
||||
..onChangedSlider(duration.inSeconds.toDouble())
|
||||
..seekTo(Duration(seconds: duration.inSeconds), isSeek: false);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = ColorScheme.of(context);
|
||||
@@ -33,27 +55,6 @@ class BottomControl extends StatelessWidget {
|
||||
: colorScheme.primary;
|
||||
final thumbGlowColor = primary.withAlpha(80);
|
||||
final bufferedBarColor = primary.withValues(alpha: 0.4);
|
||||
void onDragStart(ThumbDragDetails duration) {
|
||||
feedBack();
|
||||
controller.onChangedSliderStart(duration.timeStamp);
|
||||
}
|
||||
|
||||
void onDragUpdate(ThumbDragDetails duration, int max) {
|
||||
if (!controller.isFileSource && controller.showSeekPreview) {
|
||||
controller.updatePreviewIndex(duration.timeStamp.inSeconds);
|
||||
}
|
||||
controller.onUpdatedSliderProgress(duration.timeStamp);
|
||||
}
|
||||
|
||||
void onSeek(Duration duration, int max) {
|
||||
if (controller.showSeekPreview) {
|
||||
controller.showPreview.value = false;
|
||||
}
|
||||
controller
|
||||
..onChangedSliderEnd()
|
||||
..onChangedSlider(duration.inSeconds.toDouble())
|
||||
..seekTo(Duration(seconds: duration.inSeconds), isSeek: false);
|
||||
}
|
||||
|
||||
Widget progressBar() {
|
||||
final child = Obx(() {
|
||||
@@ -93,63 +94,42 @@ class BottomControl extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(10, 0, 10, 7),
|
||||
child: Obx(
|
||||
() => Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
progressBar(),
|
||||
if (controller.enableBlock &&
|
||||
videoDetailController.segmentProgressList.isNotEmpty)
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 5.25,
|
||||
child: IgnorePointer(
|
||||
child: RepaintBoundary(
|
||||
child: CustomPaint(
|
||||
key: const Key('segmentList'),
|
||||
size: const Size(double.infinity, 3.5),
|
||||
painter: SegmentProgressBar(
|
||||
segmentColors:
|
||||
videoDetailController.segmentProgressList,
|
||||
),
|
||||
),
|
||||
() => Offstage(
|
||||
offstage: !controller.showControls.value,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
progressBar(),
|
||||
if (controller.enableBlock &&
|
||||
videoDetailController.segmentProgressList.isNotEmpty)
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 5.25,
|
||||
child: SegmentProgressBar(
|
||||
segments: videoDetailController.segmentProgressList,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (controller.showViewPoints &&
|
||||
videoDetailController.viewPointList.isNotEmpty &&
|
||||
videoDetailController.showVP.value) ...[
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 5.25,
|
||||
child: IgnorePointer(
|
||||
child: RepaintBoundary(
|
||||
child: CustomPaint(
|
||||
key: const Key('viewPointList'),
|
||||
size: const Size(double.infinity, 3.5),
|
||||
painter: SegmentProgressBar(
|
||||
segmentColors:
|
||||
videoDetailController.viewPointList,
|
||||
),
|
||||
),
|
||||
if (controller.showViewPoints &&
|
||||
videoDetailController.viewPointList.isNotEmpty &&
|
||||
videoDetailController.showVP.value)
|
||||
Padding(
|
||||
padding: const .only(bottom: 8.75),
|
||||
child: ViewPointSegmentProgressBar(
|
||||
segments: videoDetailController.viewPointList,
|
||||
onSeek: PlatformUtils.isDesktop
|
||||
? (position) =>
|
||||
controller.seekTo(position, isSeek: false)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!PlatformUtils.isMobile)
|
||||
buildViewPointWidget(
|
||||
videoDetailController,
|
||||
controller,
|
||||
8.75,
|
||||
maxWidth - 40,
|
||||
),
|
||||
if (videoDetailController.showDmTrendChart.value)
|
||||
if (videoDetailController.dmTrend.value?.dataOrNull
|
||||
case final list?)
|
||||
buildDmChart(primary, list, videoDetailController, 4.5),
|
||||
],
|
||||
if (videoDetailController.showDmTrendChart.value)
|
||||
if (videoDetailController.dmTrend.value?.dataOrNull
|
||||
case final list?)
|
||||
buildDmChart(primary, list, videoDetailController, 4.5),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user