GridSelectorExtensions extension
Generic 2D grid selector with arrow-key navigation.
Controls:
- Arrow keys move across cells (wraps around edges)
- Space toggles selection when
multiSelectis true - Enter confirms the current selection
- Esc cancels (returns
[])
Parameters:
options: Labels rendered inside each cell.prompt: Frame title text.columns: Fixed column count (auto when zero).multiSelect: Enables toggling multiple cells at once.cellWidth: Overrides computed width per cell.maxColumns: Caps automatically computed column count.initialSelection: Indices that start out selected.
Example:
final selected = terminice.gridSelector(
options: const ['Red', 'Blue', 'Green', 'Yellow'],
prompt: 'Select colors',
multiSelect: true,
initialSelection: {1, 2},
);
- on
Methods
-
gridSelector(
{required List< String> options, String prompt = 'Select', int columns = 0, bool multiSelect = false, int? cellWidth, int? maxColumns, Set<int> ? initialSelection}) → List<String> -
Available on Terminice, provided by the GridSelectorExtensions extension
Renders a flexible grid selector and returns the chosen labels.