MultiSelectModel<T> class

A multi-select component following the Model architecture.

Displays a list of items and allows the user to select multiple.

Example

final multiSelect = MultiSelectModel<String>(
  title: 'Choose colors:',
  items: ['Red', 'Green', 'Blue'],
);

// In your update function:
switch (msg) {
  case MultiSelectionMadeMsg<String>(:final items):
    print('Selected: $items');
    return (this, Cmd.quit());
}
Inheritance

Constructors

MultiSelectModel({required List<T> items, String title = 'Select options:', String hint = '(Space to toggle, Enter to confirm)', bool showTitle = true, bool showHint = true, bool showHelp = true, bool showPagination = true, int height = 10, int initialIndex = 0, Set<int>? initialSelected, String display(T)?, MultiSelectKeyMap? keyMap, MultiSelectStyles? styles})
Creates a new multi-select model.

Properties

cursor → int
Gets the current cursor position.
no setter
display → String Function(T)?
Custom display function for items.
final
hashCode → int
The hash code for this object.
no setterinherited
hint → String
Hint text displayed below title.
final
items → List<T>
Gets the items.
no setter
keyMap → MultiSelectKeyMap
Key bindings.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedIndices → Set<int>
Gets the selected indices.
no setter
selectedItems → List<T>
Gets the selected items.
no setter
showHelp → bool
Whether to show help text.
final
showHint → bool
Whether to show the hint.
final
showPagination → bool
Whether to show pagination.
final
showTitle → bool
Whether to show the title.
final
styles → MultiSelectStyles
Styles.
final
title → String
The title/prompt displayed above the list.
final

Methods

init() → Cmd?
Returns an optional command to execute on program startup.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
update(Msg msg) → (MultiSelectModel<T>, Cmd?)
Updates the component state in response to a message.
override
view() → String
Renders the current model state for display.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited