BuilderFlexItem class

A builder variant of FlexItem that allows dynamic child construction.

BuilderFlexItem provides the same flex layout capabilities as DirectFlexItem, but instead of taking a pre-built child widget, it accepts a builder function that receives layout information at build time.

This is useful when the flex content needs access to layout bounds, scroll positions, or other dynamic layout state that may change during the widget's lifetime.

Usage

BuilderFlexItem(
  flexGrow: 1.0,
  builder: (context, layoutBox) {
    return Container(
      color: Colors.blue,
      child: Text('Size: ${layoutBox.size}'),
    );
  },
)
Inheritance
Implemented types

Constructors

BuilderFlexItem.new({Key? key, required Widget builder(BuildContext context, LayoutBox box), int? paintOrder, SizeUnit? width, SizeUnit? height, SizeUnit? minWidth, SizeUnit? maxWidth, SizeUnit? minHeight, SizeUnit? maxHeight, double flexGrow = 0.0, double flexShrink = 0.0, double? aspectRatio, PositionUnit? top, PositionUnit? left, PositionUnit? bottom, PositionUnit? right, BoxAlignmentGeometry? alignSelf})
Creates a flex item with a builder function.
const

Properties

alignSelf BoxAlignmentGeometry?
final
aspectRatio double?
The aspect ratio constraint (width/height) for this item.
final
bottom PositionUnit?
The offset from the bottom edge of the parent container.
final
builder Widget Function(BuildContext context, LayoutBox box)
final
flexGrow double
The flex grow factor for this item.
final
flexShrink double
The flex shrink factor for this item.
final
hashCode int
The hash code for this object.
no setterinherited
height SizeUnit?
The preferred height of this item.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
left PositionUnit?
The offset from the left edge of the parent container.
final
maxHeight SizeUnit?
The maximum height constraint for this item.
final
maxWidth SizeUnit?
The maximum width constraint for this item.
final
minHeight SizeUnit?
The minimum height constraint for this item.
final
minWidth SizeUnit?
The minimum width constraint for this item.
final
paintOrder int?
The paint order for this item, controlling drawing order when overlapping. Lower values are painted first (behind), higher values are painted last (on top).
final
The offset from the right edge of the parent container.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
top PositionUnit?
The offset from the top edge of the parent container.
final
width SizeUnit?
The preferred width of this item.
final

Methods

build(BuildContext context) Widget
Builds the widget tree for this builder flex item.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited