API ReferenceEnvironment
Orientation
Portrait and landscape viewport orientation.
Orientation is derived from constraints (max_width > max_height means
landscape). Defined in incular-widgets, not incular-config.
use incular::prelude::*;
fn main() {
println!("portrait: {:?}", Orientation::Portrait);
println!("landscape: {:?}", Orientation::Landscape);
}use incular::prelude::*;
fn main() {
let app = Application::new(|_cx| {
OrientationBuilder::new(
|_cx, orientation: Orientation| -> Widget {
match orientation {
Orientation::Portrait => Text::new("List").into(),
Orientation::Landscape => Text::new("Grid").into(),
}
},
).into()
})
.expect("valid application");
incular::run(app).expect("run application");
}Related: LayoutBuilder,
MediaQuery.