Skip to content

Commit

Permalink
feat: add love anim in cocktail screen, fix button padding
Browse files Browse the repository at this point in the history
  • Loading branch information
aslansari committed May 19, 2024
1 parent 5305ef7 commit d46c7a7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel
import coil3.compose.SubcomposeAsyncImage
import coil3.compose.SubcomposeAsyncImageContent
import com.aslansari.spiritvisor.cocktail.component.CreditText
import com.aslansari.spiritvisor.home.HeartAnimation
import com.aslansari.spiritvisor.theme.icon.LocalBar

@Composable
Expand Down Expand Up @@ -53,6 +54,8 @@ internal fun CocktailScreen(
modifier: Modifier = Modifier,
) {
Box(modifier = modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
var showLove by remember { mutableStateOf(false) }
HeartAnimation(showLove = showLove) { showLove = false }
Column(
horizontalAlignment = Alignment.CenterHorizontally,
) {
Expand Down Expand Up @@ -166,6 +169,9 @@ internal fun CocktailScreen(
}
}
}
CreditText(modifier = Modifier.align(Alignment.BottomCenter))
CreditText(
modifier = Modifier.align(Alignment.BottomCenter),
onLoveSurge = { showLove = true },
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ internal fun HomeScreen(
textAlign = TextAlign.Center,
)
Spacer(Modifier.size(32.dp))
val buttonPadding = if (windowSizeClass.widthSizeClass == WindowWidthSizeClass.Expanded) {
32.dp
} else {
12.dp
}
FlowRow(
modifier = Modifier.padding(16.dp).then(
if (windowSizeClass.widthSizeClass == WindowWidthSizeClass.Expanded) {
Expand All @@ -77,7 +82,7 @@ internal fun HomeScreen(
Modifier.fillMaxWidth()
}
),
horizontalArrangement = Arrangement.spacedBy(32.dp),
horizontalArrangement = Arrangement.spacedBy(buttonPadding),
verticalArrangement = Arrangement.spacedBy(16.dp),
maxItemsInEachRow = 3,
) {
Expand All @@ -100,7 +105,7 @@ private fun RowScope.FlavorCategoryButton(
modifier: Modifier = Modifier,
) {
Button(
modifier = modifier.height(60.dp).weight(1f),
modifier = modifier.height(60.dp).requiredWidthIn(max = 250.dp).weight(1f),
shape = MaterialTheme.shapes.medium,
onClick = onClick,
) {
Expand Down

0 comments on commit d46c7a7

Please sign in to comment.