Skip to content

perf: optimize navigation bar and blur animations via caching and dra…#2158

Merged
theovilardo merged 1 commit into
masterfrom
optim/general-animations-main
May 29, 2026
Merged

perf: optimize navigation bar and blur animations via caching and dra…#2158
theovilardo merged 1 commit into
masterfrom
optim/general-animations-main

Conversation

@theovilardo

Copy link
Copy Markdown
Collaborator

…w-phase clipping

Implements performance optimizations for the navigation bar and background blur during player expansion. These changes reduce recompositions and object allocations by moving clipping to the graphics layer and caching expensive UI objects.

  • Moved navigation bar shape and clipping logic to graphicsLayer to avoid triggering layout passes during corner radius animations.
  • Introduced BlurEffectCache to quantize blur radii (4px steps) and reuse RenderEffect instances, reducing allocations during expansion.
  • Added NavBarShapeCache to provide stable Shape instances for quantized corner radii.
  • Refactored DynamicSmoothCornerShape to cache generated Outline paths and support toggling between smooth and standard rounded corners.
  • Updated navigation bar visibility logic to use vertical translation instead of height changes, preventing child elements from resizing or squishing during transitions.
  • Integrated useSmoothCorners state to dynamically switch between AbsoluteSmoothCornerShape and RoundedCornerShape.

…w-phase clipping

Implements performance optimizations for the navigation bar and background blur during player expansion. These changes reduce recompositions and object allocations by moving clipping to the graphics layer and caching expensive UI objects.

- Moved navigation bar shape and clipping logic to `graphicsLayer` to avoid triggering layout passes during corner radius animations.
- Introduced `BlurEffectCache` to quantize blur radii (4px steps) and reuse `RenderEffect` instances, reducing allocations during expansion.
- Added `NavBarShapeCache` to provide stable `Shape` instances for quantized corner radii.
- Refactored `DynamicSmoothCornerShape` to cache generated `Outline` paths and support toggling between smooth and standard rounded corners.
- Updated navigation bar visibility logic to use vertical translation instead of height changes, preventing child elements from resizing or squishing during transitions.
- Integrated `useSmoothCorners` state to dynamically switch between `AbsoluteSmoothCornerShape` and `RoundedCornerShape`.
@theovilardo theovilardo merged commit 1fc349c into master May 29, 2026
3 of 4 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2fa0d2c76c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

modifier = Modifier
.fillMaxWidth()
.height(visibleNavBarOccupiedHeight)
.height(navBarOccupiedHeight)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep hidden nav bar from reserving full inset

When shouldHideNavigationBar becomes true for hidden routes or an active search bar, shouldRenderNavigationBar remains true during the 220 ms hide animation, so this bottomBar is still measured at the full navBarOccupiedHeight. Since Scaffold passes that measured height as innerPadding to AppNavigation, the content keeps a full blank bottom inset until the bar is finally removed, then jumps; before this change the Box height used visibleNavBarOccupiedHeight, so the reserved space collapsed together with the animation.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant