Flutter 颤振:如何禁用设备方向更改?
有没有什么方法可以使方向只指向颤振中的肖像或风景?谢谢。最好的方法是在主方法中使用Flutter 颤振:如何禁用设备方向更改?,flutter,Flutter,有没有什么方法可以使方向只指向颤振中的肖像或风景?谢谢。最好的方法是在主方法中使用SystemChrome。例如: 要将方向锁定为横向,请使用: await SystemChrome.setPreferredOrientations( [DeviceOrientation.landscapeRight, DeviceOrientation.landscapeLeft] ); 要将方向锁定为纵向,请使用: await SystemChrome.setPreferredOrien
SystemChrome
。例如:
要将方向锁定为横向,请使用:
await SystemChrome.setPreferredOrientations(
[DeviceOrientation.landscapeRight, DeviceOrientation.landscapeLeft]
);
要将方向锁定为纵向,请使用:
await SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitRight, DeviceOrientation.portraitLeft]
);
我问如何禁用方向更改。这是否回答了您的问题?