flutter_tree_view icon indicating copy to clipboard operation
flutter_tree_view copied to clipboard

Retain collapsed / expanded state.

Open phimath opened this issue 6 years ago • 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.

phimath avatar Aug 12 '19 16:08 phimath

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

sasam0502 avatar Mar 25 '22 15:03 sasam0502

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, ), ), ),

sasam0502 avatar Apr 01 '22 10:04 sasam0502