AbsoluteItem constructor
- Key? key,
- int? paintOrder,
- SizeUnit? width,
- SizeUnit? height,
- SizeUnit? minWidth,
- SizeUnit? maxWidth,
- SizeUnit? minHeight,
- SizeUnit? maxHeight,
- PositionUnit? top,
- PositionUnit? left,
- PositionUnit? bottom,
- PositionUnit? right,
- double? aspectRatio,
- required Widget child,
Creates an absolutely positioned item with a direct child widget.
The child parameter is required and specifies the widget to be positioned
absolutely within its parent container.
The top, left, bottom, right parameters specify the position offsets
from the parent's edges. You can use any combination of these to position
the item. If both top and bottom are specified, the height is determined
by the difference. The same applies to left and right for width.
The width and height parameters specify the explicit size of the item.
If null, the size is determined by content or positioning constraints.
The minWidth, maxWidth, minHeight, maxHeight parameters set size
constraints for the item.
The aspectRatio parameter maintains the width/height ratio if specified.
The paintOrder parameter controls the painting order when items overlap.
Lower values are painted first (behind), higher values are painted last (on top).
Example
AbsoluteItem(
top: PositionUnit.fixed(20),
left: PositionUnit.fixed(30),
width: SizeUnit.fixed(100),
height: SizeUnit.fixed(50),
child: Container(color: Colors.red),
)
Implementation
const factory AbsoluteItem({
Key? key,
int? paintOrder,
SizeUnit? width,
SizeUnit? height,
SizeUnit? minWidth,
SizeUnit? maxWidth,
SizeUnit? minHeight,
SizeUnit? maxHeight,
PositionUnit? top,
PositionUnit? left,
PositionUnit? bottom,
PositionUnit? right,
double? aspectRatio,
required Widget child,
}) = _DirectAbsoluteItem;