expand method
展开 node
Implementation
void expand(EasyTreeNode<E> node) {
assert(_isInitialized);
if (!node.expanded && !node.isLeaf && _nodes != null) {
node.expanded = true;
List<EasyTreeNode<E>> modified = node.getModifiedChildren;
modified.retainWhere((element) => element.isShow);
int index = _nodes!.indexOf(node);
if (index != -1 && modified.length > 0) {
index += 1;
_nodes!.insertAll(index, modified);
int total = modified.length;
for (int offset = 0; offset < total; offset++) {
State<StatefulWidget>? _state = _listKey.currentState;
if (_state is SliverAnimatedListState) {
_state.insertItem(index + offset);
} else if (_state is AnimatedListState) {
_state.insertItem(index + offset);
}
}
}
}
}