feat(ui): hide elements when searcher is expanded

This commit is contained in:
Cilly Leang 2026-02-27 22:56:44 +11:00
parent fb53422aac
commit a3dacda912
Signed by: cilly
GPG key ID: 6500251E087653C9

View file

@ -1,5 +1,8 @@
package moe.lava.banksia.ui.screens.map package moe.lava.banksia.ui.screens.map
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
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.add import androidx.compose.foundation.layout.add
@ -93,33 +96,40 @@ fun MapScreen(
}, },
) )
Box( AnimatedVisibility(
modifier = Modifier visible = !searchExpandedState,
.fillMaxSize() label = "search-hider",
.windowInsetsPadding( enter = fadeIn(),
WindowInsets.safeContent.add( exit = fadeOut(),
WindowInsets(bottom = sheetState.bottomInset)
)
),
contentAlignment = Alignment.BottomEnd
) { ) {
FloatingActionButton( Box(
containerColor = MaterialTheme.colorScheme.surfaceContainer, modifier = Modifier
onClick = { viewModel.centreCameraToLocation() }, .fillMaxSize()
.windowInsetsPadding(
WindowInsets.safeContent.add(
WindowInsets(bottom = sheetState.bottomInset)
)
),
contentAlignment = Alignment.BottomEnd
) { ) {
Icon(painterResource(Res.drawable.my_location_24), "Move to current location") FloatingActionButton(
containerColor = MaterialTheme.colorScheme.surfaceContainer,
onClick = { viewModel.centreCameraToLocation() },
) {
Icon(painterResource(Res.drawable.my_location_24), "Move to current location")
}
} }
}
AppBottomSheet( AppBottomSheet(
sheetState = sheetState, sheetState = sheetState,
onDismiss = { viewModel.handleEvent(MapScreenEvent.DismissState) } onDismiss = { viewModel.handleEvent(MapScreenEvent.DismissState) }
) { ) {
InfoPanel( InfoPanel(
state = infoState, state = infoState,
onEvent = viewModel::handleEvent, onEvent = viewModel::handleEvent,
onPeekHeightChange = { ph -> sheetState.peekTo(ph) }, onPeekHeightChange = { ph -> sheetState.peekTo(ph) },
) )
}
} }
} }
} }