feat(ui): hide elements when searcher is expanded
This commit is contained in:
parent
fb53422aac
commit
a3dacda912
1 changed files with 33 additions and 23 deletions
|
|
@ -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) },
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue