Open zhaoyul opened 9 months ago
Thanks for the timely reply^_^ @dupuchba
I want the following page to be in landscape mode. and when it goes back, flip back to original (portrait) mode.
(def static-route
(m/Scaffold
.appBar (m/AppBar .title (m/Text "static monitor"))
.body
(f/widget
:get [m/Navigator]
:watch [ _ (s/SystemChrome.setPreferredOrientations [s/DeviceOrientation.landscapeLeft]) ;; <=== I don't think it's a good idea
]
m/Center
(m/ElevatedButton .onPressed #(.pop navigator))
(m/Text "Go back!"))))
SystemChrome.setPreferredOrientations returns a promise, is there a way to write something like
void main() {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]
).then((_) {
runApp(MyApp());
});
}
Should I use await
?
https://api.flutter.dev/flutter/services/SystemChrome/setPreferredOrientations.html according to documentation it only works on iPad. These kind of features are OS dependent and are not forced by flutter. What are the OSes you target?
hello @zhaoyul , can you be more specific in your question?