forked from omni/OmniCards
fix: fixed top bar and added back handler for floating action button
This commit is contained in:
@@ -77,6 +77,9 @@ fun Page(
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopBar(name, innerPadding)
|
||||
},
|
||||
floatingActionButton = floatingActionButton
|
||||
) { padding ->
|
||||
Box(
|
||||
@@ -105,6 +108,12 @@ fun ExpandableFab(
|
||||
|
||||
val rotation by animateFloatAsState(if (isExpanded) 45f else 0f)
|
||||
|
||||
BackHandler(
|
||||
enabled = isExpanded
|
||||
) {
|
||||
isExpanded = false
|
||||
}
|
||||
|
||||
Column(
|
||||
horizontalAlignment = Alignment.End,
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
@@ -145,7 +154,7 @@ fun ExpandableFab(
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun TopBar(text: String, innerPadding: PaddingValues, openMenuButton: (@Composable () -> Unit)? = null) {
|
||||
fun TopBar(text: String, innerPadding: PaddingValues) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -155,10 +164,6 @@ fun TopBar(text: String, innerPadding: PaddingValues, openMenuButton: (@Composab
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
if (openMenuButton != null) {
|
||||
openMenuButton()
|
||||
}
|
||||
|
||||
Text(
|
||||
text,
|
||||
modifier = Modifier,
|
||||
|
||||
Reference in New Issue
Block a user