Skip to content

Perf: Optimize AnimatedBuilder usage in update badge #540

Description

@ZhuchkaTriplesix

Problem

In lib/features/updater/update_available_badge.dart, an AnimatedBuilder is used to create a pulsing animation for the update badge. However, it completely ignores the child parameter.

Because the builder function recreates the inner Row, Icon, and Text widgets instead of accepting them via child, the framework is forced to rebuild those static elements on every single frame (60 or 120 times per second) while the animation is running.

Proposed Solution

Refactor the AnimatedBuilder to pass the static Row and its contents into the child property, and only update the container's decoration (color/border) in the builder closure.

Trade-offs

  • Pros: Reduces CPU usage and garbage collection pressure during the continuous pulse animation.
  • Cons: Slightly more verbose code structure.

Impact

  • Risk: Zero. Behavior remains visually identical.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions