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

ios android 旋转体验同步

上级 179c06fa
...@@ -26,6 +26,6 @@ subprojects { ...@@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }
...@@ -231,7 +231,11 @@ class GZVideoPlayerState extends State<GZVideoPlayer> ...@@ -231,7 +231,11 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
///恢复设备竖屏 ///恢复设备竖屏
if (widget.restoreVertical) { if (widget.restoreVertical) {
GzOrientation.setPreferredOrientations([DeviceOrientation.portraitUp]); if (Platform.isIOS) {
GzOrientation.forceOrientation(DeviceOrientation.portraitUp);
} else {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
}
} }
Wakelock.toggle(enable: false); Wakelock.toggle(enable: false);
...@@ -413,10 +417,31 @@ class GZVideoPlayerState extends State<GZVideoPlayer> ...@@ -413,10 +417,31 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
/// 点击全屏或取消 /// 点击全屏或取消
void toggleFullScreen() { void toggleFullScreen() {
if (_fullScreened) { if (_fullScreened) {
if (Platform.isIOS) {
GzOrientation.forceOrientation(DeviceOrientation.portraitUp); GzOrientation.forceOrientation(DeviceOrientation.portraitUp);
} else { } else {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]).then((_) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]);
});
}
} else {
if (Platform.isIOS) {
GzOrientation.forceOrientation(DeviceOrientation.landscapeRight); GzOrientation.forceOrientation(DeviceOrientation.landscapeRight);
} }
else {
SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]).then((_){
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]);
});
}
}
} }
/// 显示或隐藏菜单栏 /// 显示或隐藏菜单栏
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论