The expander didn't work

Issue #2 resolved
pennchester created an issue

Hello,

I found that the expander didn't work,It didn’t changed,Please look this:

My code is this:

Comments (3)

  1. Kevin Armstrong

    This is, unfortunately, part of the design. The expand/collapse display of the node is driven by the expanded property on the node itself. In order for the expander to be updated, you have to update the node in the treeViewController as such:

    onExpandNode(String key, bool expanded) {
      Node node = _treeViewController.getNode(key);
      if (node != null) {
        updated = _treeViewController.updateNode(key, 
          node.copyWith(expanded: expanded)
        );
        setState(() {
          _treeViewController = _treeViewController.copyWith(children: updated);
        });
      }
    }
    

  2. Log in to comment