Comments (8)
hi @christianrowlands, thanks for the appreciation and your feedback.
I will look into this issue, and fix it.
from animated_tree_view.
@christianrowlands you can already use the TreeNode..expansionNotifier.value
to set the initial expansion state, but right now it won't have any effect as the initial state is always collapsed for the TreeNode
.
I will have to do some refactoring so that the initial expansion state is respected by the TreeNode
.
onTreeReady
callback will be easy to implement, this might take a little longer.
from animated_tree_view.
the fix for TreeViewController
.expand
and .expandAllChildren
has been pushed to the fix/treeview-controller branch.
The onTreeReady
callback has also been added.
You can use the updated code from this branch, it is working but not properly tested yet. The branch will be merged into main
after testing and documentation changes.
from animated_tree_view.
hi @christianrowlands, thanks for the appreciation and your feedback. I will look into this issue, and fix it.
Same issue with expand as well, And please add example for best practice to get tree controller.
from animated_tree_view.
Yeah, that is another issue I am running into. I can get the controller, but it is not initialized until after the initState()
and build()
methods are called. As a result, I am not sure when to expand all the children. I am using your library to display comments on a post, and I want the comments to always be expanded. I have tried a variety of options but am unable to figure out how to expand all without adding some sort of delayed timer that is called so that the lazy initialized controller is ready.
from animated_tree_view.
@christianrowlands I didn't such a use case in mind when I designed the controller, and with the current implementation I don't see any way of getting to know when the controller will get initialized, so the a delayed seems like the best option.
Just an FYI, thee controller is initialized in the initState
method of the TreeView
, so it takes some time to initialize.
What I can do, is to add a onTreeReady
callback to the TreeView
which will provide the controller. This way the controller will also be more straight-forward to access rather than using the GlobalKey
to get the controller.
Will this work for you @christianrowlands ?
from animated_tree_view.
@berslen I will look into the Expand
method as well, will hopefully have a fix ready by tomorrow.
from animated_tree_view.
Yeah, an onTreeReady
callback would be great.
Or maybe there is an even more straightforward approach for my specific use case. I am looking to mimic Reddit's behavior for comments on a post where all of the comments and child comments are expanded by default. Given the new expandAllChildren
method that was added, I thought that was the best option. But if there were a way to set the default expansion state of a node, then I could override the TreeNode
class and set the expansion state to true. Something like this?
/// Represents a Comment that is submitted to/received from the server backend.
class Comment extends TreeNode {
final String commentId;
final String? parentId; // Null indicates a top level comment
final String postId;
final String userId;
final String comment;
DateTime? createdAt;
Comment({
required this.commentId,
this.parentId,
required this.postId,
required this.userId,
required this.comment,
this.createdAt,
}) : super(key: commentId, initialExpansionState: true);
}
from animated_tree_view.
Related Issues (19)
- layout error
- Unhandled Exception: Exception: Animated list state not found from GlobalKey<AnimatedListState> HOT 1
- Lookup TreeNode by Key? HOT 1
- breaking showRootNode in 2.1.0 HOT 1
- Feature Request: allow items reordering HOT 6
- question for real world usecase HOT 1
- Question: Is there a way to deactivate "toggleExpansion" ? HOT 2
- combinePaths not implemented in HTML renderer
- How to refresh UI state for node after check-box is clicked on such node? HOT 1
- Dynamic change of root HOT 2
- After updating the data, the connected line was disconnected HOT 3
- scroll to index 3.0 HOT 1
- Custom name for node HOT 1
- Expand all nodes default or special node HOT 3
- Unhandled Exception: Bad state: No element HOT 1
- Exception has occurred. HOT 1
- Error: Bad state: No element HOT 1
- onItemTap exception HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from animated_tree_view.