SSpreadsheetSelectionController class
Manages row/column selection + dimming state for SSpreadsheet.
Selection is tracked by an opaque identity key — resolved per row via SSpreadsheet.rowKeyBuilder and per column via SSpreadsheet.columnKeyBuilder (both default to the raw index when omitted) — rather than by raw index. This means a selection survives row filtering/reordering that shifts indices: as long as the same key still exists somewhere in the grid, it stays highlighted at its new position.
Pass an instance to SSpreadsheet.selectionController to enable
selection. When SSpreadsheet.dimUnselectedOpacity is less than 1.0,
the spreadsheet automatically dims every header/cell that doesn't belong
to the selected row/column. When
SSpreadsheet.enableTapToSelectRowHeader /
SSpreadsheet.enableTapToSelectColumnHeader are true, tapping a header
toggles that row's/column's selection, and tapping anywhere else in the
grid outside the selected row/column (another header, another cell)
automatically clears the selection.
- Inheritance
-
- Object
- ChangeNotifier
- SSpreadsheetSelectionController
Constructors
- SSpreadsheetSelectionController({bool exclusive = true})
Properties
- exclusive → bool
-
When
true(default), selecting a row clears any active column selection and vice versa, so at most one axis is ever selected at once. Set tofalseto allow a row and a column to be selected simultaneously (e.g. to highlight their intersection cell yourself).final - hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- hasSelection → bool
-
Whether either axis currently has a selection.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedColumnKey → Object?
-
The identity key of the currently selected column, or
null.no setter - selectedRowKey → Object?
-
The identity key of the currently selected row, or
null.no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clear(
) → void - Clears both the row and column selection.
-
clearColumn(
) → void - Clears the column selection only.
-
clearRow(
) → void - Clears the row selection only.
-
dispose(
) → void -
Discards any resources used by the object.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
selectColumn(
Object? key) → void -
Selects the column identified by
key. Mirrors selectRow. -
selectRow(
Object? key) → void -
Selects the row identified by
key. Selecting the already-selected row toggles it off (matching how the built-in header tap handling behaves). Passnullto explicitly clear the row selection. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited