Skip to content

Commit

Permalink
hide bottom bar menus on interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
X1nto committed Aug 13, 2023
1 parent b103c34 commit 283b488
Showing 1 changed file with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.xinto.mauth.ui.screen.home.component

import androidx.compose.animation.*
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.res.stringResource
import com.xinto.mauth.R
import com.xinto.mauth.core.settings.model.SortSetting
Expand All @@ -25,7 +27,7 @@ fun HomeBottomBar(
AnimatedContent(
targetState = isSelectionActive,
transitionSpec = {
slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.Up) + fadeIn() with
slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.Up) + fadeIn() togetherWith
slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Up) + fadeOut()
},
label = "Actions"
Expand All @@ -38,7 +40,10 @@ fun HomeBottomBar(
)
}
} else {
Row {
Row(
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.CenterVertically,
) {
var isMoreActionsVisible by remember { mutableStateOf(false) }
IconButton(onClick = {
isMoreActionsVisible = true
Expand All @@ -63,7 +68,10 @@ fun HomeBottomBar(
contentDescription = null
)
},
onClick = onSettingsClick
onClick = {
isMoreActionsVisible = false
onSettingsClick()
}
)
}
}
Expand All @@ -84,7 +92,10 @@ fun HomeBottomBar(
) {
SortSetting.values().forEach {
DropdownMenuItem(
onClick = { onActiveSortChange(it) },
onClick = {
isSortVisible = false
onActiveSortChange(it)
},
text = {
val resource = remember(it) {
when (it) {
Expand Down Expand Up @@ -127,7 +138,8 @@ fun HomeBottomBar(
AnimatedContent(
targetState = isSelectionActive,
transitionSpec = {
scaleIn() + fadeIn() with scaleOut() + fadeOut()
scaleIn() + fadeIn() togetherWith
scaleOut() + fadeOut()
},
label = "FAB"
) { isSelectionActive ->
Expand Down

0 comments on commit 283b488

Please sign in to comment.