limiting_direction_csx 0.0.1
limiting_direction_csx: ^0.0.1 copied to clipboard
限制屏幕旋转方位.
LimitingDirection #
flutter强制某些界面横屏,特殊界面--特殊的可支持设备旋转方位。解决目前所有的flutter不能操作iOS的问题!
iOS项目配置 #
1.调整主项目的info.plist文件添加 #
<key>UIRequiresFullScreen</key>
<true/>
(即xcode打开iOS项目,勾选中Targets->General->Deployment Info->Requires full screen(前面选中打勾☑️))
2.主项目的Main.storyboard的控制器类型class从FlutterViewController调整为MainViewController #

使用代码介绍 #
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// 设置启动即强制横屏
await LimitingDirectionCsx.changeScreenOrientation(
DeviceOrientationMask.Landscape);
runApp(MyApp());
}
//或者在需要的地方调用
await LimitingDirectionCsx.changeScreenOrientation(
DeviceOrientationMask.Landscape);
//来设置枚举类型,选择自己想要的可支持方位