ajilo297/flutter_tree_view

Retain collapsed / expanded state.

Opened this issue · 2 comments

I'm using the latest master branch. Is there anyway to store the state of which children are expanded?

When I navigate away and back the treeview always rebuilds and resets this.

Hi, I am using the library too and it would be really great if the expanded state would be remembered.

I found a solution:

Copy the tree_view.dart and add it locally. In class class TreeViewChildState in build method change AnimatedSize to:

AnimatedSize( curve: Curves.easeIn, duration: const Duration(milliseconds: 400), child:Offstage ( offstage: !isExpanded!, child: Column( mainAxisSize: MainAxisSize.min, children: widget.children, ), ), ),