pub struct OrientationBuilder;Expand description
Builds from the orientation of the box it is given — the reference’s
OrientationBuilder: landscape when the box is wider than tall, portrait otherwise.
The box, not the window: a panel beside a list on a wide window is portrait if it is
taller than wide, whatever the window is. It takes all the room on offer, as an
Aligned does, so that the box it decides on is that room and not the
size of what it built; along a row’s or a column’s own direction, shared with other
children, the room is only its content’s. It is a LayoutBuilder, with what that says
about state: the content is built on the fly from the box, and keeps none.
use frus_core::Orientation;
use frus_widgets::{column, row, text, OrientationBuilder};
let _gallery: frus_widgets::LayoutBuilder<()> = OrientationBuilder::new(|orientation| {
match orientation {
Orientation::Landscape => row![text("a"), text("b")],
Orientation::Portrait => column![text("a"), text("b")],
}
});Implementations§
Source§impl OrientationBuilder
impl OrientationBuilder
Sourcepub fn new<Msg: 'static, W: Widget<Msg> + 'static>(
build: impl Fn(Orientation) -> W + 'static,
) -> LayoutBuilder<Msg>
pub fn new<Msg: 'static, W: Widget<Msg> + 'static>( build: impl Fn(Orientation) -> W + 'static, ) -> LayoutBuilder<Msg>
A builder from build, given the orientation of the box.
Auto Trait Implementations§
impl Freeze for OrientationBuilder
impl RefUnwindSafe for OrientationBuilder
impl Send for OrientationBuilder
impl Sync for OrientationBuilder
impl Unpin for OrientationBuilder
impl UnsafeUnpin for OrientationBuilder
impl UnwindSafe for OrientationBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more