美文网首页
[Flutter 实战] 固定屏幕方向 Landscape or

[Flutter 实战] 固定屏幕方向 Landscape or

作者: 寅丁 | 来源:发表于2019-11-07 16:22 被阅读0次

在此记录项目中所遇到问题及解决方案

把屏幕固定为竖屏

Future main() async {
    await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
    runApp(new MyApp());
  }

如果想固定插件所产生的页面,需要在原生项目里配置
比如Android,在 [project_root]\android\app\src\main\AndroidManifest.xml 文件里配置

这个我使用第三方裁剪图片库的Activity
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait" //在这里配置
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>

更多说明屏幕方向的资料见

相关文章

网友评论

      本文标题:[Flutter 实战] 固定屏幕方向 Landscape or

      本文链接:https://www.haomeiwen.com/subject/qwpoectx.html