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'); },
),
Inheritance

Constructors

SpannableGrid({Key key, @required List<SpannableGridCellData> cells, @required int columns, @required int rows, double spacing: 0.0, dynamic onCellChanged(SpannableGridCellData), Color editingGridColor: Colors.black12, bool editingOnLongPress: true, Decoration editingCellDecoration})

Properties

cells → List<SpannableGridCellData>
Items data [...]
final
columns → int
Number of columns
final
editingCellDecoration Decoration
Decoration to highlight the editing cell in the editing mode.
final
editingGridColor Color
This color is used to display available grid cells in the editing mode.
final
editingOnLongPress → bool
Allows editing by long press on grid item [...]
final
onCellChanged → dynamic Function(SpannableGridCellData)
A callback, that called when a cell position is changed by the user
final
rows → int
Number of rows
final
spacing → double
Space between cells
final
hashCode → int
The hash code for this object.
read-only, inherited
key Key
Controls how one widget replaces another widget in the tree.
final, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

createState() → _SpannableGridState
Creates the mutable state for this widget at a given location in the tree. [...]
override
createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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.debug}) → String
Returns 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 ==(dynamic other) → bool
The equality operator.
inherited