SectionedListController<K extends Object, Section, Item> constructor
SectionedListController<K extends Object, Section, Item> ({
- required TickerProvider vsync,
- required K sectionKeyOf(
- Section section
- required K itemKeyOf(
- Item item
- TreeAnimationStyle animationStyle = const TreeAnimationStyle(),
- double itemIndent = 0.0,
- bool preserveExpansion = true,
Implementation
SectionedListController({
required TickerProvider vsync,
required this.sectionKeyOf,
required this.itemKeyOf,
TreeAnimationStyle animationStyle = const TreeAnimationStyle(),
double itemIndent = 0.0,
bool preserveExpansion = true,
}) : _tree = TreeController<SecKey<K>, SecPayload<Section, Item>>(
vsync: vsync,
animationStyle: animationStyle,
indentWidth: itemIndent,
),
_preserveExpansion = preserveExpansion {
// The tree layer merged its two expansion-memory knobs into one int;
// this module keeps the friendlier bool (it never exposed the
// capacity) and maps it onto the shared default.
_sync = TreeSyncController<SecKey<K>, SecPayload<Section, Item>>(
treeController: _tree,
expansionMemory: preserveExpansion
? TreeSyncController.defaultExpansionMemory
: 0,
);
// Single underlying TreeController node-data listener that fans out
// into the two domain-specific listener lists. Attached unconditionally;
// dispatch is cheap (one type test, one list iteration that is empty
// when nothing subscribes).
_tree.addNodeDataListener(_dispatchPayloadNotification);
}