mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: custom for/backward duration
Closes #366 Closes #601 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -257,6 +257,7 @@ class PlPlayerController {
|
||||
late final enableSlideVolumeBrightness = GStorage.enableSlideVolumeBrightness;
|
||||
late final enableSlideFS = GStorage.enableSlideFS;
|
||||
late final enableDragSubtitle = GStorage.enableDragSubtitle;
|
||||
late final fastForBackwardDuration = GStorage.fastForBackwardDuration;
|
||||
|
||||
/// 弹幕权重
|
||||
int danmakuWeight = 0;
|
||||
|
||||
@@ -1704,6 +1704,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
child: child,
|
||||
),
|
||||
child: BackwardSeekIndicator(
|
||||
duration:
|
||||
plPlayerController.fastForBackwardDuration,
|
||||
onSubmitted: (Duration value) {
|
||||
_mountSeekBackwardButton.value = false;
|
||||
final Player player = widget
|
||||
@@ -1733,6 +1735,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
child: child,
|
||||
),
|
||||
child: ForwardSeekIndicator(
|
||||
duration:
|
||||
plPlayerController.fastForBackwardDuration,
|
||||
onSubmitted: (Duration value) {
|
||||
_mountSeekForwardButton.value = false;
|
||||
final Player player = widget
|
||||
|
||||
@@ -4,11 +4,14 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class BackwardSeekIndicator extends StatefulWidget {
|
||||
// final void Function(Duration) onChanged;
|
||||
final void Function(Duration) onSubmitted;
|
||||
final ValueChanged<Duration> onSubmitted;
|
||||
final int duration;
|
||||
|
||||
const BackwardSeekIndicator({
|
||||
super.key,
|
||||
// required this.onChanged,
|
||||
required this.onSubmitted,
|
||||
required this.duration,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -16,15 +19,16 @@ class BackwardSeekIndicator extends StatefulWidget {
|
||||
}
|
||||
|
||||
class BackwardSeekIndicatorState extends State<BackwardSeekIndicator> {
|
||||
Duration value = const Duration(seconds: 10);
|
||||
late Duration duration;
|
||||
|
||||
Timer? timer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
duration = Duration(seconds: widget.duration);
|
||||
timer = Timer(const Duration(milliseconds: 400), () {
|
||||
widget.onSubmitted.call(value);
|
||||
widget.onSubmitted.call(duration);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,12 +41,12 @@ class BackwardSeekIndicatorState extends State<BackwardSeekIndicator> {
|
||||
void increment() {
|
||||
timer?.cancel();
|
||||
timer = Timer(const Duration(milliseconds: 400), () {
|
||||
widget.onSubmitted.call(value);
|
||||
widget.onSubmitted.call(duration);
|
||||
});
|
||||
// widget.onChanged.call(value);
|
||||
// 重复点击 快退秒数累加10
|
||||
setState(() {
|
||||
value += const Duration(seconds: 10);
|
||||
duration += Duration(seconds: widget.duration);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -75,7 +79,7 @@ class BackwardSeekIndicatorState extends State<BackwardSeekIndicator> {
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'快退${value.inSeconds}秒',
|
||||
'快退${duration.inSeconds}秒',
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.white,
|
||||
|
||||
@@ -4,11 +4,14 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class ForwardSeekIndicator extends StatefulWidget {
|
||||
// final void Function(Duration) onChanged;
|
||||
final void Function(Duration) onSubmitted;
|
||||
final ValueChanged<Duration> onSubmitted;
|
||||
final int duration;
|
||||
|
||||
const ForwardSeekIndicator({
|
||||
super.key,
|
||||
// required this.onChanged,
|
||||
required this.onSubmitted,
|
||||
required this.duration,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -16,15 +19,16 @@ class ForwardSeekIndicator extends StatefulWidget {
|
||||
}
|
||||
|
||||
class ForwardSeekIndicatorState extends State<ForwardSeekIndicator> {
|
||||
Duration value = const Duration(seconds: 10);
|
||||
late Duration duration;
|
||||
|
||||
Timer? timer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
duration = Duration(seconds: widget.duration);
|
||||
timer = Timer(const Duration(milliseconds: 400), () {
|
||||
widget.onSubmitted.call(value);
|
||||
widget.onSubmitted.call(duration);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,12 +41,12 @@ class ForwardSeekIndicatorState extends State<ForwardSeekIndicator> {
|
||||
void increment() {
|
||||
timer?.cancel();
|
||||
timer = Timer(const Duration(milliseconds: 400), () {
|
||||
widget.onSubmitted.call(value);
|
||||
widget.onSubmitted.call(duration);
|
||||
});
|
||||
// widget.onChanged.call(value);
|
||||
// 重复点击 快进秒数累加10
|
||||
setState(() {
|
||||
value += const Duration(seconds: 10);
|
||||
duration += Duration(seconds: widget.duration);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -74,7 +78,7 @@ class ForwardSeekIndicatorState extends State<ForwardSeekIndicator> {
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'快进${value.inSeconds}秒',
|
||||
'快进${duration.inSeconds}秒',
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.white,
|
||||
|
||||
Reference in New Issue
Block a user