flutter_badges icon indicating copy to clipboard operation
flutter_badges copied to clipboard

Replace private helper methods with private widgets

Open edgarfroes opened this issue 1 year ago • 1 comments

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

https://github.com/yako-dev/flutter_badges/assets/4291391/dbd8293b-33d2-44af-b926-10af2d15bd01

To Do

  • [X] double check the original issue to confirm it is fully satisfied
  • [X] add testing notes and screenshots in PR description to help guide reviewers
  • [X] request the "UX" team perform a design review (if/when applicable)

edgarfroes avatar Sep 19 '23 20:09 edgarfroes

@yako-dev any feedback?

edgarfroes avatar Sep 26 '23 18:09 edgarfroes