opt: viewpoint

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-13 10:56:14 +08:00
parent c63a32bd47
commit 042b69cc05
4 changed files with 113 additions and 82 deletions

View File

@@ -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();

View File

@@ -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('字幕均加载失败');
// }
}
} }
} }

View File

@@ -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,20 +1097,34 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
// }, // },
), ),
if (plPlayerController.segmentList.isNotEmpty) if (plPlayerController.segmentList.isNotEmpty)
CustomPaint( Positioned(
left: 0,
right: 0,
bottom: 0.75,
child: IgnorePointer(
child: CustomPaint(
size: Size(double.infinity, 3.5), size: Size(double.infinity, 3.5),
painter: SegmentProgressBar( painter: SegmentProgressBar(
segmentColors: plPlayerController.segmentList, segmentColors: plPlayerController.segmentList,
), ),
), ),
),
),
if (plPlayerController.viewPointList.isNotEmpty && if (plPlayerController.viewPointList.isNotEmpty &&
plPlayerController.showVP.value) plPlayerController.showVP.value)
CustomPaint( Positioned(
left: 0,
right: 0,
bottom: 0.75,
child: IgnorePointer(
child: CustomPaint(
size: Size(double.infinity, 3.5), size: Size(double.infinity, 3.5),
painter: SegmentProgressBar( painter: SegmentProgressBar(
segmentColors: plPlayerController.viewPointList, segmentColors: plPlayerController.viewPointList,
), ),
), ),
),
),
], ],
), ),
// SlideTransition( // SlideTransition(

View File

@@ -50,7 +50,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
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),
@@ -70,8 +70,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
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), () {
@@ -97,22 +96,37 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
}, },
), ),
if (controller?.segmentList.isNotEmpty == true) if (controller?.segmentList.isNotEmpty == true)
CustomPaint( Positioned(
left: 0,
right: 0,
bottom: 5.25,
child: IgnorePointer(
child: CustomPaint(
size: Size(double.infinity, 3.5), size: Size(double.infinity, 3.5),
painter: SegmentProgressBar( painter: SegmentProgressBar(
segmentColors: controller!.segmentList, segmentColors: controller!.segmentList,
), ),
), ),
),
),
if (controller?.viewPointList.isNotEmpty == true && if (controller?.viewPointList.isNotEmpty == true &&
controller?.showVP.value == true) controller?.showVP.value == true)
CustomPaint( Positioned(
left: 0,
right: 0,
bottom: 5.25,
child: IgnorePointer(
child: CustomPaint(
size: Size(double.infinity, 3.5), size: Size(double.infinity, 3.5),
painter: SegmentProgressBar( painter: SegmentProgressBar(
segmentColors: controller!.viewPointList, segmentColors: controller!.viewPointList,
), ),
), ),
),
),
], ],
)), ),
),
); );
}, },
), ),