ajilo297 / flutter_tree_view

A Flutter package to create an easily customisable Tree View
MIT License
66 stars 19 forks source link

Retain collapsed / expanded state. #6

Open phimath opened 5 years ago

phimath commented 5 years ago

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.

sasam0502 commented 2 years ago

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

sasam0502 commented 2 years ago

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