limiting_direction_csx 0.0.3 copy "limiting_direction_csx: ^0.0.3" to clipboard
limiting_direction_csx: ^0.0.3 copied to clipboard

outdated

Limit the rotatable orientation of the screen, also known as the orientation Settings that the interface can support. It should be noted that the orientation set here needs to be included in the suppo [...]

limiting_direction_csx #

flutter强制某些界面横屏,特殊界面--特殊的可支持设备旋转方位。解决目前所有的flutter不能操作iOS的问题!

iOS项目配置 #

1.调整主项目的info.plist文件添加 #

<key>UIRequiresFullScreen</key>
<true/>

(即xcode打开iOS项目,勾选中Targets->General->Deployment Info->Requires full screen(前面选中打勾☑️)) (这个配置主要针对pad的适配,需要添加,单纯的手机应用开发,这个配置可以不用勾选就可以实现其效果)

2.主项目的Main.storyboard的控制器类型class从FlutterViewController调整为MainViewController #

ios配置Main.storyboard,图片在根目录下的iosConfiguration.png

使用代码介绍 #

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  if (Platform.isIOS) {
    // 设置启动即强制横屏
    await LimitingDirectionCsx.setUpScreenDirection(
        DeviceDirectionMask.Landscape);
  } else {
    await SystemChrome.setPreferredOrientations(
      [DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
  }
  runApp(MyApp());
}
//或者在需要的地方调用
if (Platform.isIOS) {
  await LimitingDirectionCsx.setUpScreenDirection(
      DeviceDirectionMask.Landscape);
}
//来设置枚举类型,选择自己想要的可支持方位
6
likes
0
points
4
downloads

Publisher

unverified uploader

Weekly Downloads

Limit the rotatable orientation of the screen, also known as the orientation Settings that the interface can support. It should be noted that the orientation set here needs to be included in the supported orientation of the project.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on limiting_direction_csx

Packages that implement limiting_direction_csx