updateExpansionState method
Implementation
void updateExpansionState(LinkedHashSet<K> expandedKeys) {
if (expandedKeys.isNotEmpty) {
final activeKey = expandedKeys.first;
final idx = value.displayItems.indexWhere((item) => item.key == activeKey);
final activeItem = idx != -1 ? value.displayItems[idx] : null;
updateState(
who: 'updateExpansionState',
expandedKeys: expandedKeys,
activeKey: activeKey,
activeItem: activeItem,
activeIndex: idx,
isCreatingItem: false,
isEditingItem: false,
);
} else {
updateState(
who: 'updateExpansionState',
expandedKeys: expandedKeys,
clearActive: true,
isCreatingItem: false,
isEditingItem: false,
);
}
}