Replace private helper methods with private widgets #120
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Connection with issue(s)
This PR will resolve a performance problem that has no open issue.
There are private methods that return Widgets instead of Widgets themselves, which makes it impossible for Flutter to identify their address in the build context, thus rebuilding all the widgets inside those methods instead of pointing to the already built widget in the memory and Widget tree.
This PR will FIX this by moving this code to private widgets, while also creating a parent-building structure that will rebuild children widgets only when necessary.
Testing and Review Notes
No tests other than normal smoke tests are required, as this PR changes only issues related to performance.
Sources:
Writing Better Flutter Widgets: How to Choose Between Classes and Functions
Widgets versus helper methods | Decoding Flutter
Screenshots or Videos
Simulator.Screen.Recording.-.iPhone.1.-.2023-09-19.at.17.33.24.mp4
To Do