pub struct FlexItem<'a> { /* private fields */ }Expand description
Configuration for a flex item.
Implementations§
Source§impl<'a> FlexItem<'a>
impl<'a> FlexItem<'a>
Sourcepub fn grow(self, grow: f32) -> Self
pub fn grow(self, grow: f32) -> Self
How much should this item grow compared to the other items.
By default items don’t grow.
Sourcepub fn basis(self, basis: f32) -> Self
pub fn basis(self, basis: f32) -> Self
Set the default size of the item, before it grows. If this is not set, the items “intrinsic size” will be used.
Sourcepub fn align_self(self, align_self: FlexAlign) -> Self
pub fn align_self(self, align_self: FlexAlign) -> Self
How do we align the item in the cross axis?
Default is stretch.
Sourcepub fn align_self_content(self, align_self_content: Align2) -> Self
pub fn align_self_content(self, align_self_content: Align2) -> Self
If align_self is stretch, how do we align the content?
Default is center.
Sourcepub fn shrink(self) -> Self
pub fn shrink(self) -> Self
Shrink this item if there isn’t enough space.
Note: You may only ever set this on a single item in a flex container.
Sourcepub fn transform(self, transform: TSTransform) -> Self
pub fn transform(self, transform: TSTransform) -> Self
Set the visual transform of the item.
Sourcepub fn frame_builder(
self,
frame_builder: impl FnOnce(&Ui, &Response) -> (Frame, TSTransform) + 'a,
) -> Self
pub fn frame_builder( self, frame_builder: impl FnOnce(&Ui, &Response) -> (Frame, TSTransform) + 'a, ) -> Self
Set the frame of the item using a builder function.
Sourcepub fn content_id(self, content_id: Id) -> Self
pub fn content_id(self, content_id: Id) -> Self
Egui flex can’t always know when the content size of a widget changes (e.g. when a Label or Button is truncated). If the content id changes, this will force a remeasure of the widget.
Sourcepub fn sense(self, sense: Sense) -> Self
pub fn sense(self, sense: Sense) -> Self
Set a sense for the FlexItem. The response will be passed to the FrameBuilder closure.
Sourcepub fn min_size(self, min_size: impl Into<Vec2>) -> Self
pub fn min_size(self, min_size: impl Into<Vec2>) -> Self
Set the minimum outer (including Frame margin) size of the item in points (pixels).
Sourcepub fn min_width(self, min_width: impl Into<Option<f32>>) -> Self
pub fn min_width(self, min_width: impl Into<Option<f32>>) -> Self
Set the minimum outer (including Frame margin) width of the item in points (pixels).
Sourcepub fn min_height(self, min_height: impl Into<Option<f32>>) -> Self
pub fn min_height(self, min_height: impl Into<Option<f32>>) -> Self
Set the minimum outer (including Frame margin) height of the item in points (pixels).
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for FlexItem<'a>
impl<'a> !Send for FlexItem<'a>
impl<'a> !Sync for FlexItem<'a>
impl<'a> !UnwindSafe for FlexItem<'a>
impl<'a> Freeze for FlexItem<'a>
impl<'a> Unpin for FlexItem<'a>
impl<'a> UnsafeUnpin for FlexItem<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more