Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to refresh UI state for node after check-box is clicked on such node? #22

Closed
UlyssesAlves opened this issue Aug 21, 2023 · 1 comment

Comments

@UlyssesAlves
Copy link

I need a tree with a checkbox on each of its nodes. My current problem is that the checkbox ui state does not change right after I click the checkbox for that node, but it is then updated correctly when I expand or shrink the tree.

How can I make this work so that when a checkbox os pressed it's UI wii change too on the node?

@jawwad-hassan89
Copy link
Collaborator

jawwad-hassan89 commented Oct 17, 2023

Wrap the node widget in a ValueListenableBuilder, and use the node.listenableData as the value to listen. Use node.data to assign or get the data.
The node extends the ValueListenable, so it can be used as a ChangeNotifier or ValueListenable.

Apologize for the late reply.

//sample code
 ValueListenableBuilder(
      valueListenable: node.listenableData,
      builder: (context, page, child) {
        return SomeWidgetHere();
      },
    );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants