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).