アプリケーションの向きが変更されないようにして、レイアウトを強制的に「縦長」にしたいと思います。
main.dartには、次のように記述します。
void main(){
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown
]);
runApp(new MyApp());
}
しかし、Androidシミュレータの回転ボタンを使用すると、レイアウトは新しいデバイスの向きに「従います」...
どうすればこれを解決できますか?
ありがとう
SystemChrome.setPreferredOrientationsは非同期で戻るため、runAppで囲む必要があるようthenです。


'package:flutter/services.dart'、それはおそらくバグです:github.com/flutter/flutter/issues/13238