提交 e5b70717 authored 作者: jungleiOS's avatar jungleiOS

退出播放器恢复设备竖屏

上级 c24d98cd
......@@ -145,6 +145,7 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
/// 倍数按钮标题
String _speedTitle = '';
/// 倍数item
VideoSpeedItem _speedItem = VideoSpeedItem();
......@@ -219,10 +220,13 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]);
/// 常亮
Wakelock.toggle(enable: true);
/// 初始化亮度为系统亮度
initBrightness();
/// 倍数按钮标题
_speedTitle = widget.videoStyle.videoSpeedButtonStyle.title;
_initPlayer();
......@@ -248,10 +252,9 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
_controller.dispose();
_controlBarAnimationController.dispose();
///竖屏
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
///恢复设备竖屏
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
OrientationPlugin.setPreferredOrientations([DeviceOrientation.portraitUp]);
Wakelock.toggle(enable: false);
_subscription.cancel();
_brightness.dispose();
......@@ -816,7 +819,8 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
// 左侧垂直滑动 - 亮度调节
if (details.primaryDelta! > 0) {
//往下滑动
_brightness.value = _brightness.value - widget.playOptions.brightnessGestureUnit;
_brightness.value =
_brightness.value - widget.playOptions.brightnessGestureUnit;
widget.onBrightness?.call(_brightness.value);
if (_brightness.value <= 0) {
_brightness.value = 0.0;
......@@ -825,7 +829,8 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
await ScreenBrightness().setScreenBrightness(_brightness.value);
} else {
//往上滑动
_brightness.value = _brightness.value + widget.playOptions.brightnessGestureUnit;
_brightness.value =
_brightness.value + widget.playOptions.brightnessGestureUnit;
widget.onBrightness?.call(_brightness.value);
if (_brightness.value >= 1) {
_brightness.value = 1.0;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论