ITADN

Draw content under navigation bar for edge-to-edge UI

#135Opend4rken 创建于 2026-01-17
enhancement :)
D
d4rkencommented
## Summary Extend the edge-to-edge UI implementation to draw content under the system navigation bar. Currently, the app uses `enableEdgeToEdge()` but content stops at the navigation bar boundary. ## Current State - ✅ `enableEdgeToEdge()` is called in `MainActivity.kt` - ✅ Status bar: Content draws under it (TopAppBar handles insets) - ✅ Display cutouts: Handled via `displayCutoutPadding()` on screens - ❌ Navigation bar: Content does not draw underneath ## Goal Allow list content (like the device dashboard) to scroll underneath the translucent navigation bar, providing a more immersive modern Android experience. ## Implementation Approach ### Screens with LazyColumn/LazyVerticalGrid Add bottom content padding equal to navigation bar insets: ```kotlin LazyColumn( contentPadding = PaddingValues( bottom = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding() ) ) ``` Or use `Modifier.navigationBarsPadding()` on the last item. ### Screens to Update - `DashboardScreen.kt` - Main device list - `DiscoverScreen.kt` - Bluetooth device discovery list - `SettingsScreen.kt` - Settings list - `DebugLogScreen.kt` - Debug log list - `RecorderScreen.kt` - Recorder file list ### Considerations - FABs need `navigationBarsPadding()` to stay above the nav bar - Bottom sheets already handle this via Material3 - Test on both gesture navigation and 3-button navigation - Test with different navigation bar heights ## References - Android edge-to-edge guide: https://developer.android.com/develop/ui/views/layout/edge-to-edge - WindowInsets documentation: https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/WindowInsets
0 条评论