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
|
content: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
topBar = {
|
||||||
|
TopBar(name, innerPadding)
|
||||||
|
},
|
||||||
floatingActionButton = floatingActionButton
|
floatingActionButton = floatingActionButton
|
||||||
) { padding ->
|
) { padding ->
|
||||||
Box(
|
Box(
|
||||||
@@ -105,6 +108,12 @@ fun ExpandableFab(
|
|||||||
|
|
||||||
val rotation by animateFloatAsState(if (isExpanded) 45f else 0f)
|
val rotation by animateFloatAsState(if (isExpanded) 45f else 0f)
|
||||||
|
|
||||||
|
BackHandler(
|
||||||
|
enabled = isExpanded
|
||||||
|
) {
|
||||||
|
isExpanded = false
|
||||||
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.End,
|
horizontalAlignment = Alignment.End,
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
@@ -145,7 +154,7 @@ fun ExpandableFab(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TopBar(text: String, innerPadding: PaddingValues, openMenuButton: (@Composable () -> Unit)? = null) {
|
fun TopBar(text: String, innerPadding: PaddingValues) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -155,10 +164,6 @@ fun TopBar(text: String, innerPadding: PaddingValues, openMenuButton: (@Composab
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
if (openMenuButton != null) {
|
|
||||||
openMenuButton()
|
|
||||||
}
|
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text,
|
text,
|
||||||
modifier = Modifier,
|
modifier = Modifier,
|
||||||
|
|||||||
Reference in New Issue
Block a user