FlexibleGridOptions class
Configuration payload for FlexibleGrid.
The options surface mirrors the override hooks exposed by MediasfuUICustomOverrides
and is intended for advanced UI composition. In addition to basic row/column
sizing it supports:
- Responsive sizing:
customWidth
/customHeight
act as upper bounds. When they arenull
, non-finite, or non-positive the grid derives sizes from its layout constraints so cells always remain visible. - Rich spacing controls: per-row and per-column spacing, padding, margin, and decoration at the container, row, and cell levels.
- Builder hooks: inject custom renderers or wrappers via
containerBuilder
,gridBuilder
,rowBuilder
,cellBuilder
, andemptyCellBuilder
without re-implementing grid logic. - Custom empty-state handling: provide
emptyCell
content or a builder to handle cells whose index exceedscomponentsToRender.length
.
Example – render a three-by-three grid that adapts to the available width and decorates empty cells:
FlexibleGridOptions(
customWidth: null, // allow the grid to derive width from constraints
customHeight: null,
rows: 3,
columns: 3,
componentsToRender: const [Icon(Icons.person)],
emptyCellBuilder: (context, suggested) => DecoratedBox(
decoration: BoxDecoration(
color: Colors.blueGrey.shade900,
borderRadius: BorderRadius.circular(12),
),
child: suggested,
),
);
Constructors
-
FlexibleGridOptions({required double? customWidth, required double? customHeight, required int rows, required int columns, required List<
Widget> componentsToRender, Color backgroundColor = Colors.transparent, bool showAspect = true, EdgeInsetsGeometry? containerPadding, EdgeInsetsGeometry? containerMargin, Decoration? containerDecoration, AlignmentGeometry? containerAlignment, Clip containerClipBehavior = Clip.none, BoxConstraints? containerConstraints, MainAxisAlignment? gridMainAxisAlignment, CrossAxisAlignment? gridCrossAxisAlignment, MainAxisSize gridMainAxisSize = MainAxisSize.min, double? rowSpacing = 2, double? columnSpacing = 2, EdgeInsetsGeometry? rowPadding, EdgeInsetsGeometry? rowMargin, Decoration? rowDecoration, Clip rowClipBehavior = Clip.none, MainAxisAlignment? rowMainAxisAlignment, CrossAxisAlignment? rowCrossAxisAlignment, MainAxisSize rowMainAxisSize = MainAxisSize.min, EdgeInsetsGeometry? cellPadding, EdgeInsetsGeometry? cellMargin, Decoration? cellDecoration, Decoration? emptyCellDecoration, Clip cellClipBehavior = Clip.none, AlignmentGeometry? cellAlignment, Widget? emptyCell, FlexibleGridEmptyCellBuilder? emptyCellBuilder, FlexibleGridCellBuilder? cellBuilder, FlexibleGridRowBuilder? rowBuilder, FlexibleGridGridBuilder? gridBuilder, FlexibleGridContainerBuilder? containerBuilder}) -
const
Properties
- backgroundColor → Color
-
final
- cellAlignment → AlignmentGeometry?
-
final
- cellBuilder → FlexibleGridCellBuilder?
-
final
- cellClipBehavior → Clip
-
final
- cellDecoration → Decoration?
-
final
- cellMargin → EdgeInsetsGeometry?
-
final
- cellPadding → EdgeInsetsGeometry?
-
final
- columns → int
-
final
- columnSpacing → double?
-
final
-
componentsToRender
→ List<
Widget> -
final
- containerAlignment → AlignmentGeometry?
-
final
- containerBuilder → FlexibleGridContainerBuilder?
-
final
- containerClipBehavior → Clip
-
final
- containerConstraints → BoxConstraints?
-
final
- containerDecoration → Decoration?
-
final
- containerMargin → EdgeInsetsGeometry?
-
final
- containerPadding → EdgeInsetsGeometry?
-
final
- customHeight → double?
-
final
- customWidth → double?
-
final
- emptyCell → Widget?
-
final
- emptyCellBuilder → FlexibleGridEmptyCellBuilder?
-
final
- emptyCellDecoration → Decoration?
-
final
- gridBuilder → FlexibleGridGridBuilder?
-
final
- gridCrossAxisAlignment → CrossAxisAlignment?
-
final
- gridMainAxisAlignment → MainAxisAlignment?
-
final
- gridMainAxisSize → MainAxisSize
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- rowBuilder → FlexibleGridRowBuilder?
-
final
- rowClipBehavior → Clip
-
final
- rowCrossAxisAlignment → CrossAxisAlignment?
-
final
- rowDecoration → Decoration?
-
final
- rowMainAxisAlignment → MainAxisAlignment?
-
final
- rowMainAxisSize → MainAxisSize
-
final
- rowMargin → EdgeInsetsGeometry?
-
final
- rowPadding → EdgeInsetsGeometry?
-
final
- rows → int
-
final
- rowSpacing → double?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showAspect → bool
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited