mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: viewpoint
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -48,8 +48,10 @@ class SegmentProgressBar extends CustomPainter {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
|
height: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
strutStyle: StrutStyle(height: 1, leading: 0),
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
)..layout();
|
)..layout();
|
||||||
|
|
||||||
|
|||||||
@@ -1992,15 +1992,6 @@ class VideoDetailController extends GetxController
|
|||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res["data"] is List && res["data"].isNotEmpty) {
|
|
||||||
var result = await VideoHttp.vttSubtitles(res["data"]);
|
|
||||||
if (result != null) {
|
|
||||||
_vttSubtitles = result;
|
|
||||||
}
|
|
||||||
// if (_vttSubtitles.isEmpty) {
|
|
||||||
// SmartDialog.showToast('字幕均加载失败');
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
if (GStorage.showViewPoints &&
|
if (GStorage.showViewPoints &&
|
||||||
res["view_points"] is List &&
|
res["view_points"] is List &&
|
||||||
res["view_points"].isNotEmpty) {
|
res["view_points"].isNotEmpty) {
|
||||||
@@ -2022,6 +2013,16 @@ class VideoDetailController extends GetxController
|
|||||||
plPlayerController.showVP.value = showVP = true;
|
plPlayerController.showVP.value = showVP = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res["data"] is List && res["data"].isNotEmpty) {
|
||||||
|
var result = await VideoHttp.vttSubtitles(res["data"]);
|
||||||
|
if (result != null) {
|
||||||
|
_vttSubtitles = result;
|
||||||
|
}
|
||||||
|
// if (_vttSubtitles.isEmpty) {
|
||||||
|
// SmartDialog.showToast('字幕均加载失败');
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1050,7 +1050,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
value: '${(value / max * 100).round()}%',
|
value: '${(value / max * 100).round()}%',
|
||||||
// enabled: false,
|
// enabled: false,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.bottomCenter,
|
||||||
children: [
|
children: [
|
||||||
ProgressBar(
|
ProgressBar(
|
||||||
progress: Duration(seconds: value),
|
progress: Duration(seconds: value),
|
||||||
@@ -1097,18 +1097,32 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
// },
|
// },
|
||||||
),
|
),
|
||||||
if (plPlayerController.segmentList.isNotEmpty)
|
if (plPlayerController.segmentList.isNotEmpty)
|
||||||
CustomPaint(
|
Positioned(
|
||||||
size: Size(double.infinity, 3.5),
|
left: 0,
|
||||||
painter: SegmentProgressBar(
|
right: 0,
|
||||||
segmentColors: plPlayerController.segmentList,
|
bottom: 0.75,
|
||||||
|
child: IgnorePointer(
|
||||||
|
child: CustomPaint(
|
||||||
|
size: Size(double.infinity, 3.5),
|
||||||
|
painter: SegmentProgressBar(
|
||||||
|
segmentColors: plPlayerController.segmentList,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (plPlayerController.viewPointList.isNotEmpty &&
|
if (plPlayerController.viewPointList.isNotEmpty &&
|
||||||
plPlayerController.showVP.value)
|
plPlayerController.showVP.value)
|
||||||
CustomPaint(
|
Positioned(
|
||||||
size: Size(double.infinity, 3.5),
|
left: 0,
|
||||||
painter: SegmentProgressBar(
|
right: 0,
|
||||||
segmentColors: plPlayerController.viewPointList,
|
bottom: 0.75,
|
||||||
|
child: IgnorePointer(
|
||||||
|
child: CustomPaint(
|
||||||
|
size: Size(double.infinity, 3.5),
|
||||||
|
painter: SegmentProgressBar(
|
||||||
|
segmentColors: plPlayerController.viewPointList,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -46,73 +46,87 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10, bottom: 7),
|
padding: const EdgeInsets.only(left: 10, right: 10, bottom: 7),
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
// label: '${(value / max * 100).round()}%',
|
// label: '${(value / max * 100).round()}%',
|
||||||
value: '${(value / max * 100).round()}%',
|
value: '${(value / max * 100).round()}%',
|
||||||
// enabled: false,
|
// enabled: false,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.bottomCenter,
|
||||||
children: [
|
children: [
|
||||||
ProgressBar(
|
ProgressBar(
|
||||||
progress: Duration(seconds: value),
|
progress: Duration(seconds: value),
|
||||||
buffered: Duration(seconds: buffer),
|
buffered: Duration(seconds: buffer),
|
||||||
total: Duration(seconds: max),
|
total: Duration(seconds: max),
|
||||||
progressBarColor: colorTheme,
|
progressBarColor: colorTheme,
|
||||||
baseBarColor: Colors.white.withOpacity(0.2),
|
baseBarColor: Colors.white.withOpacity(0.2),
|
||||||
bufferedBarColor: colorTheme.withOpacity(0.4),
|
bufferedBarColor: colorTheme.withOpacity(0.4),
|
||||||
timeLabelLocation: TimeLabelLocation.none,
|
timeLabelLocation: TimeLabelLocation.none,
|
||||||
thumbColor: colorTheme,
|
thumbColor: colorTheme,
|
||||||
barHeight: 3.5,
|
barHeight: 3.5,
|
||||||
thumbRadius: 7,
|
thumbRadius: 7,
|
||||||
onDragStart: (duration) {
|
onDragStart: (duration) {
|
||||||
feedBack();
|
feedBack();
|
||||||
controller!.onChangedSliderStart();
|
controller!.onChangedSliderStart();
|
||||||
},
|
},
|
||||||
onDragUpdate: (duration) {
|
onDragUpdate: (duration) {
|
||||||
double newProgress =
|
double newProgress =
|
||||||
duration.timeStamp.inSeconds / max;
|
duration.timeStamp.inSeconds / max;
|
||||||
if ((newProgress - lastAnnouncedValue).abs() >
|
if ((newProgress - lastAnnouncedValue).abs() > 0.02) {
|
||||||
0.02) {
|
accessibilityDebounce?.cancel();
|
||||||
accessibilityDebounce?.cancel();
|
accessibilityDebounce =
|
||||||
accessibilityDebounce =
|
Timer(const Duration(milliseconds: 200), () {
|
||||||
Timer(const Duration(milliseconds: 200), () {
|
SemanticsService.announce(
|
||||||
SemanticsService.announce(
|
"${(newProgress * 100).round()}%",
|
||||||
"${(newProgress * 100).round()}%",
|
TextDirection.ltr);
|
||||||
TextDirection.ltr);
|
lastAnnouncedValue = newProgress;
|
||||||
lastAnnouncedValue = newProgress;
|
});
|
||||||
});
|
}
|
||||||
}
|
controller!
|
||||||
controller!
|
.onUpdatedSliderProgress(duration.timeStamp);
|
||||||
.onUpdatedSliderProgress(duration.timeStamp);
|
},
|
||||||
},
|
onSeek: (duration) {
|
||||||
onSeek: (duration) {
|
controller!.onChangedSliderEnd();
|
||||||
controller!.onChangedSliderEnd();
|
controller!
|
||||||
controller!
|
.onChangedSlider(duration.inSeconds.toDouble());
|
||||||
.onChangedSlider(duration.inSeconds.toDouble());
|
controller!.seekTo(
|
||||||
controller!.seekTo(
|
Duration(seconds: duration.inSeconds),
|
||||||
Duration(seconds: duration.inSeconds),
|
type: 'slider');
|
||||||
type: 'slider');
|
SemanticsService.announce(
|
||||||
SemanticsService.announce(
|
"${(duration.inSeconds / max * 100).round()}%",
|
||||||
"${(duration.inSeconds / max * 100).round()}%",
|
TextDirection.ltr);
|
||||||
TextDirection.ltr);
|
},
|
||||||
},
|
),
|
||||||
|
if (controller?.segmentList.isNotEmpty == true)
|
||||||
|
Positioned(
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 5.25,
|
||||||
|
child: IgnorePointer(
|
||||||
|
child: CustomPaint(
|
||||||
|
size: Size(double.infinity, 3.5),
|
||||||
|
painter: SegmentProgressBar(
|
||||||
|
segmentColors: controller!.segmentList,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (controller?.segmentList.isNotEmpty == true)
|
if (controller?.viewPointList.isNotEmpty == true &&
|
||||||
CustomPaint(
|
controller?.showVP.value == true)
|
||||||
size: Size(double.infinity, 3.5),
|
Positioned(
|
||||||
painter: SegmentProgressBar(
|
left: 0,
|
||||||
segmentColors: controller!.segmentList,
|
right: 0,
|
||||||
|
bottom: 5.25,
|
||||||
|
child: IgnorePointer(
|
||||||
|
child: CustomPaint(
|
||||||
|
size: Size(double.infinity, 3.5),
|
||||||
|
painter: SegmentProgressBar(
|
||||||
|
segmentColors: controller!.viewPointList,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (controller?.viewPointList.isNotEmpty == true &&
|
),
|
||||||
controller?.showVP.value == true)
|
],
|
||||||
CustomPaint(
|
),
|
||||||
size: Size(double.infinity, 3.5),
|
),
|
||||||
painter: SegmentProgressBar(
|
|
||||||
segmentColors: controller!.viewPointList,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user