SpannableGrid class
A grid widget that allows its items to span columns and rows and supports editing.
Widget layouts its children (defined in cells) in a grid of fixed columns
and rows.
The gaps between grid cells is defined by optional spacing
parameter.
The SpannableGrid is sized to fit its parent widget width.
The widget supports editing mode in which user can move selected cell to available places withing the grid. User enter the editing mode by long press on the cell. In the editing mode the editing cell is highlighted while other cells are faded. All grid structure becomes visible. User exit the editing mode by click on editing cell. Updated SpannableGridCellData object is returned in the onCellChanged callback.
SpannableGrid(
columns: 4,
rows: 4,
cells: cells,
spacing: 2.0,
onCellChanged: (cell) { print('Cell ${cell.id} changed'); },
),
See also:
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SpannableGrid
Constructors
-
SpannableGrid({Key? key, required List<
SpannableGridCellData> cells, required int columns, required int rows, SpannableGridEditingStrategy editingStrategy = const SpannableGridEditingStrategy(), SpannableGridStyle style = const SpannableGridStyle(), Widget? emptyCellView, SpannableGridSize gridSize = SpannableGridSize.parentWidth, dynamic onCellChanged(SpannableGridCellData?)?, bool showGrid = false})
Properties
-
cells
→ List<
SpannableGridCellData> -
Items data
final
- columns → int
-
Number of columns
final
- editingStrategy → SpannableGridEditingStrategy
-
How an editing mode should work.
final
- emptyCellView → Widget?
-
A widget to display in empty cells.
final
- gridSize → SpannableGridSize
-
How a grid size is determined.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onCellChanged → (dynamic Function(SpannableGridCellData?)?)
-
A callback, that called when a cell position is changed by the user
final
- rows → int
-
Number of rows
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showGrid → bool
-
When set to 'true', the grid structure is always visible.
final
- style → SpannableGridStyle
-
Appearance of the grid.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _SpannableGridState -
Creates the mutable state for this widget at a given location in the tree.
override
-
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}) → 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