mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
app: keep FAB clear of side system bars
In navigation bar mode, NavigationSuiteScaffold places the primary action at the end edge of the window with a fixed 16dp margin and ignores window insets. In landscape with 3-button navigation, the FAB on the Modules and Superuser tabs overlapped the side navigation bar. Pad the primary action slot with the end side of the safe drawing insets in bar mode, so the FAB stays clear of side system bars and display cutouts. Portrait and navigation rail layouts are unchanged. Assisted-by: Claude Opus 5.5
This commit is contained in:
@@ -10,11 +10,15 @@ import androidx.compose.animation.scaleOut
|
|||||||
import androidx.compose.foundation.focusGroup
|
import androidx.compose.foundation.focusGroup
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
|
import androidx.compose.foundation.layout.WindowInsetsSides
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
|
import androidx.compose.foundation.layout.only
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.safeDrawing
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.systemBars
|
import androidx.compose.foundation.layout.systemBars
|
||||||
|
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
import androidx.compose.foundation.pager.rememberPagerState
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
@@ -178,8 +182,11 @@ fun MainScreen(
|
|||||||
// In the rail header, keep the FAB slot even when the FAB is hidden so the rail
|
// In the rail header, keep the FAB slot even when the FAB is hidden so the rail
|
||||||
// items don't jump on tab switches, and center the FAB in the collapsed rail.
|
// items don't jump on tab switches, and center the FAB in the collapsed rail.
|
||||||
// Skip the slot if no tab has a FAB (no root).
|
// Skip the slot if no tab has a FAB (no root).
|
||||||
|
// In bar mode, the scaffold places this slot at the end edge of the window without
|
||||||
|
// considering insets, so pad it to keep the FAB clear of side system bars and cutouts.
|
||||||
Box(
|
Box(
|
||||||
if (isBar || !hasFabTab) Modifier
|
if (isBar) Modifier.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.End))
|
||||||
|
else if (!hasFabTab) Modifier
|
||||||
else Modifier.padding(start = 20.dp).heightIn(min = 56.dp)
|
else Modifier.padding(start = 20.dp).heightIn(min = 56.dp)
|
||||||
) {
|
) {
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
|
|||||||
Reference in New Issue
Block a user