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

退出播放器恢复设备竖屏

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