Replace private helper methods with private widgets#120
Closed
edgarfroes wants to merge 1 commit intoyako-dev:masterfrom
Closed
Replace private helper methods with private widgets#120edgarfroes wants to merge 1 commit intoyako-dev:masterfrom
edgarfroes wants to merge 1 commit intoyako-dev:masterfrom
Conversation
Author
|
@yako-dev any feedback? |
yadaniyil
added a commit
that referenced
this pull request
Apr 10, 2026
Bug fixes: - #114: showBadge ignored when loop animation active (didUpdateWidget restructured) - #130: showBadge slow to hide with animation (stop() before reverse()) - #98: border anti-aliasing artifact (border moved into BoxDecoration strokeAlignInside) - #115: animation not re-triggered for custom content (key-based detection) New API: - BadgeStyle.copyWith() covering all 8 fields - BadgePosition.centerStart() and .centerEnd() named constructors - BadgeState.animationController and .appearanceController public getters Code quality: - _BadgeVisual extracted as StatelessWidget (PR #120, reduces rebuilds) - ConstrainedBox + IntrinsicWidth for proportional small badges (PR #111) - BadgeGradient.gradient() asserts document constructor invariants - Example app: 16 lint warnings resolved, pedantic replaced with flutter_lints - README: corrected GIF height, added hide Badge import option Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
yadaniyil
added a commit
that referenced
this pull request
Apr 10, 2026
* test: rewrite and expand test suite - Rewrite content_change tests: replace illegal state.didUpdateWidget() calls with proper TestWidgetScreen+setState so the framework drives the lifecycle naturally - Fix duplicate test name in show_hide tests (shadowed the second case) - Remove unnecessary async from all synchronous unit tests - Add 15 new test cases: standalone badge rendering/onTap/ignorePointer, showBadge:false initial state, BadgePosition factory defaults, Icon content change animation, non-Text/Icon limitation documentation, and issue #114 regression (skip:true — confirms early-return bug in didUpdateWidget loop branch) - Note in PLAN.md: always use GestureDetector (not ElevatedButton) when triggering setState in animation tests to avoid ripple pollution Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: upgrade flutter_lints to ^6.0.0, fix resulting lint warnings - Bump flutter_lints ^2.0.1 → ^6.0.0 in main package - Update flutter SDK lower bound from ">=0.2.5" → ">=3.10.0" to match the Dart >=3.0.0 constraint (Dart 3.0 shipped with Flutter 3.10) - Example app: replace discontinued pedantic ^1.11.1 with flutter_lints ^6.0.0, remove unused integration_test dep, bump cupertino_icons to ^1.0.8, add flutter SDK lower bound - Fix 3 use_super_parameters lint warnings in Badge, BadgePositioned, and TestWidgetScreen constructors Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: mark Phase 1 complete in PLAN.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: v3.2.0 — bug fixes, new API, and code quality improvements Bug fixes: - #114: showBadge ignored when loop animation active (didUpdateWidget restructured) - #130: showBadge slow to hide with animation (stop() before reverse()) - #98: border anti-aliasing artifact (border moved into BoxDecoration strokeAlignInside) - #115: animation not re-triggered for custom content (key-based detection) New API: - BadgeStyle.copyWith() covering all 8 fields - BadgePosition.centerStart() and .centerEnd() named constructors - BadgeState.animationController and .appearanceController public getters Code quality: - _BadgeVisual extracted as StatelessWidget (PR #120, reduces rebuilds) - ConstrainedBox + IntrinsicWidth for proportional small badges (PR #111) - BadgeGradient.gradient() asserts document constructor invariants - Example app: 16 lint warnings resolved, pedantic replaced with flutter_lints - README: corrected GIF height, added hide Badge import option Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: add GitHub Actions for CI and pub.dev publishing - ci.yml: runs on every PR and push to master (analyze, format check, tests) - publish.yml: publishes to pub.dev on v* tag push using OIDC (no stored secrets) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
|
Great idea — implemented in v3.2.0. The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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