item_selector library
A generic item selector that works in conjunction with ListView, GridView, Row, Column, or basically any parent widget that can have indexed child widgets.
Example
Widget build(BuildContext context) {
return ItemSelectionController(
child: ListView.builder(
itemCount: 100,
itemBuilder: (BuildContext context, int index) {
return ItemSelectionBuilder(
index: index,
builder: (BuildContext context, int index, bool selected) {
return Text('$index: $selected');
},
);
},
),
);
}
Classes
- ItemSelection
- Manages a selection of items.
- ItemSelectionBuilder
- Builds itself based on selection state changes.
- ItemSelectionController
- Controls a selection within indexed child widgets.
Enums
- ItemSelectionMode
- Specifies how an item selection controller responds to user interaction.
Typedefs
- ItemSelectionActionCallback = bool Function(int start, int end)
- Signature for a callback function that is called by ItemSelectionController when items are interactively selected by the user.
- ItemSelectionChangeCallback = void Function(int index, bool selected)
-
Signature for a callback function that is called by ItemSelection when an
item selection state changes to
selected
at the specifiedindex
. - ItemSelectionWidgetBuilder = Widget Function(BuildContext context, int index, bool selected)
-
Signature for a builder function that is called by ItemSelectionBuilder to
create a widget for a given
index
andselected
state.