BentoGrid class

A scrollable bento grid that positions tiles of varying sizes using the skyline bin-packing algorithm.

Tile widths are expressed as fractions of the available width — no column count or fixed pixel widths needed. The grid always fills its parent.

BentoGrid(
  unitHeight: 180,
  items: [
    BentoItem(size: BentoItemSize.fullTower, child: HeroTile()),
    BentoItem(size: BentoItemSize.halfCard,  child: LinkTile()),
    BentoItem(size: BentoItemSize.halfCard,  child: LinkTile()),
    BentoItem(size: BentoItemSize.fullBar,   child: SectionTitle()),
  ],
)
Inheritance

Constructors

BentoGrid({Key? key, required List<BentoItem> items, double unitHeight = 180.0, BentoSizingStrategy? strategy, EdgeInsetsGeometry? padding, ScrollPhysics? physics, bool? primary, bool shrinkWrap = false})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
items List<BentoItem>
The tiles to display in the grid.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
padding EdgeInsetsGeometry?
Padding around the grid.
final
physics ScrollPhysics?
Scroll physics. Defaults to the platform default.
final
primary bool?
Whether this is the primary scroll view.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shrinkWrap bool
Whether the grid should shrink-wrap its content.
final
strategy BentoSizingStrategy?
Custom sizing strategy. Defaults to DefaultBentoSizingStrategy.
final
unitHeight double
Height of one row unit in pixels.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
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