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

ios android 旋转体验同步

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