WidgetExtension extension
Extension methods on Widget for convenient flexbox layout configuration.
This extension provides a fluent, chainable API for configuring widget properties in flexbox layouts. Instead of wrapping widgets in multiple layout widgets, you can use these extension methods to declaratively define sizing, positioning, alignment, and flex behavior.
The extension methods wrap widgets in FlexItem or AbsoluteItem internally, managing the configuration efficiently through a wrapper mechanism that avoids unnecessary nesting when methods are chained.
Example:
Container(color: Colors.blue)
.width(100.size)
.height(50.size)
.flexGrow(1)
.selfAligned(BoxAlignment.center)
- on
Properties
- asAbsoluteItem → Widget
-
Available on Widget, provided by the WidgetExtension extension
Explicitly wraps this widget as an AbsoluteItem.no setter - asFlexItem → Widget
-
Available on Widget, provided by the WidgetExtension extension
Explicitly wraps this widget as a FlexItem.no setter
Methods
-
aspectRatio(
double aspectRatio, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the aspect ratio constraint for this widget. -
bottom(
PositionUnit bottom, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the distance from the bottom edge of the parent container. -
constrained(
{SizeUnit? minWidth, SizeUnit? maxWidth, SizeUnit? minHeight, SizeUnit? maxHeight, Key? key}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets comprehensive size constraints including both minimum and maximum bounds. -
flexGrow(
double flexGrow, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the flex grow factor for this widget within a flex container. -
flexShrink(
double flexShrink, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the flex shrink factor for this widget within a flex container. -
height(
SizeUnit height, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the height of this widget using a SizeUnit. -
id(
Object valueKey) → Widget -
Available on Widget, provided by the WidgetExtension extension
Assigns a ValueKey to this widget using the provided value. -
key(
Key key) → Widget -
Available on Widget, provided by the WidgetExtension extension
Assigns a Key to this widget. -
left(
PositionUnit left, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the distance from the left edge of the parent container. -
maxHeight(
SizeUnit maxHeight, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the maximum height constraint for this widget using a SizeUnit. -
maxSized(
{SizeUnit? maxWidth, SizeUnit? maxHeight, Key? key}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets maximum width and height constraints simultaneously. -
maxWidth(
SizeUnit maxWidth, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the maximum width constraint for this widget using a SizeUnit. -
minHeight(
SizeUnit minHeight, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the minimum height constraint for this widget using a SizeUnit. -
minSized(
{SizeUnit? minWidth, SizeUnit? minHeight, Key? key}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets minimum width and height constraints simultaneously. -
minWidth(
SizeUnit minWidth, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the minimum width constraint for this widget using a SizeUnit. -
paintOrder(
int paintOrder, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the paint order for this widget within its parent container. -
position(
PositionType position, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the position type for this widget to control positioning context. -
positioned(
{PositionUnit? top, PositionUnit? left, PositionUnit? bottom, PositionUnit? right, Key? key}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Positions the widget using multiple edge offsets simultaneously. -
right(
PositionUnit right, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the distance from the right edge of the parent container. -
selfAligned(
BoxAlignmentGeometry alignSelf, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the alignment of this widget within its parent flex container. -
sized(
{SizeUnit? width, SizeUnit? height, Key? key}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets both width and height dimensions simultaneously. -
top(
PositionUnit top, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the distance from the top edge of the parent container. -
width(
SizeUnit width, [Key? key]) → Widget -
Available on Widget, provided by the WidgetExtension extension
Sets the width of this widget using a SizeUnit.