[Suggestion] Improvements on QuillController and Nodes
Have you checked for an existing issue?
- [x] I have searched the existing issues
Issue
As the title says, I propose that we can make several changes both in the QuillController and in the Nodes that we currently have.
I have been doing some tests, and I have noticed that if we make a minimal change, such as changing the selection, the entire document is re-rendered. This, as can be assumed, is a fairly heavy cost in performance. In small documents it is not noticeable, but in documents with at least 1k lines, it begins to look unstable.
Proposal
I have found it better to change two fundamental aspects that make this problem constant in all versions:
Use a ValueNotifier for the selection
As the title mentions, what I mean is that we change the selection to be a value that we can subscribe to, in specific parts, where this value is used, instead of just being a static value.
By doing this, we would be able to avoid the entire widget tree being constantly rebuilt just by placing the cursor in one place or another.
Make Nodes extend ChangeNotifier
By changing Nodes to be a value that can notify its listeners, we can create widgets that focus on just listening if any value of the Node has changed. This would avoid having to render all the nodes, when only a small part of them has changed.
For now it is not so easy to do, since when using proxies, I have not managed to find an exact way to implement the listeners for the selection. The same goes for the Nodes.