mod: 优化快进手势阈值
This commit is contained in:
@ -478,20 +478,13 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final tapPosition = details.localPosition.dx;
|
final tapPosition = details.localPosition.dx;
|
||||||
double scale = 60 / MediaQuery.of(context).size.width;
|
|
||||||
int curSliderPosition = _.sliderPosition.value.inMilliseconds;
|
int curSliderPosition = _.sliderPosition.value.inMilliseconds;
|
||||||
late int result;
|
double scale = 60000 / MediaQuery.of(context).size.width;
|
||||||
if (tapPosition - _initTapPositoin > 0) {
|
Duration pos = Duration(
|
||||||
// 快进
|
milliseconds:
|
||||||
/// TODO 优化屏幕越小效果越明显
|
curSliderPosition + (details.delta.dx * scale).round());
|
||||||
result = (curSliderPosition + (500 * scale).toInt())
|
Duration result = pos.clamp(Duration.zero, _.duration.value);
|
||||||
.clamp(0, _.duration.value.inMilliseconds);
|
_.onUodatedSliderProgress(result);
|
||||||
} else {
|
|
||||||
// 快退
|
|
||||||
result = (curSliderPosition - (500 * scale).toInt())
|
|
||||||
.clamp(0, _.duration.value.inMilliseconds);
|
|
||||||
}
|
|
||||||
_.onUodatedSliderProgress(Duration(milliseconds: result));
|
|
||||||
_.onChangedSliderStart();
|
_.onChangedSliderStart();
|
||||||
_initTapPositoin = tapPosition;
|
_initTapPositoin = tapPosition;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user