Skip to content

refactor: Optimize navigation bar padding calculation#136

Merged
theovilardo merged 1 commit intomasterfrom
feature/nav-padding-improvement
Sep 9, 2025
Merged

refactor: Optimize navigation bar padding calculation#136
theovilardo merged 1 commit intomasterfrom
feature/nav-padding-improvement

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

This commit refactors the calculation of horizontal padding for the navigation bar in MainActivity.kt.

The systemNavBarInset and horizontalPadding variables are now calculated once at a higher scope within the MainActivity composable, rather than being recalculated inside the Scaffold's bottomBar lambda. This improves efficiency by avoiding redundant computations during recomposition.

The navBarStyle is also collected as state at this higher scope to be used in the padding calculation.

This commit refactors the calculation of horizontal padding for the navigation bar in `MainActivity.kt`.

The `systemNavBarInset` and `horizontalPadding` variables are now calculated once at a higher scope within the `MainActivity` composable, rather than being recalculated inside the `Scaffold`'s `bottomBar` lambda. This improves efficiency by avoiding redundant computations during recomposition.

The `navBarStyle` is also collected as state at this higher scope to be used in the padding calculation.
@theovilardo theovilardo merged commit 7076dbb into master Sep 9, 2025
@theovilardo theovilardo deleted the feature/nav-padding-improvement branch October 16, 2025 18:07
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