Skip to content

Commit

Permalink
feat: add credit text
Browse files Browse the repository at this point in the history
  • Loading branch information
aslansari committed May 15, 2024
1 parent 361ac20 commit cc80399
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package com.aslansari.spiritvisor.cocktail

import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.Button
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.Text
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -13,6 +11,7 @@ import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import coil3.compose.AsyncImage
import com.aslansari.spiritvisor.cocktail.component.CreditText

@Composable
internal fun CocktailRoute(
Expand Down Expand Up @@ -68,5 +67,6 @@ internal fun CocktailScreen(
Text("Go Back")
}
}
CreditText(modifier = Modifier.align(Alignment.BottomCenter))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.aslansari.spiritvisor.cocktail.component

import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.Icon
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import com.aslansari.spiritvisor.theme.icon.HeartSharp

@Composable
fun CreditText(modifier: Modifier = Modifier) {
Row(
modifier = modifier.padding(12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
val creditText = buildAnnotatedString {
append("created by ")
withStyle(style = SpanStyle(color = Color(0xFF21272A))) {
append("Aslan")
}
append(" with")
}
Text(creditText, style = MaterialTheme.typography.caption.copy(color = Color(0xFF697077)))
Spacer(Modifier.size(2.dp))
Icon(
imageVector = Icons.HeartSharp,
contentDescription = null,
tint = Color(0xFFDA1E28)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.aslansari.spiritvisor.cocktail.component.CreditText

@Composable
internal fun HomeRoute(
Expand All @@ -34,29 +35,32 @@ internal fun HomeScreen(
uiState: HomeUiState,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
Text("Pick a flavor for your cocktail ...", style = MaterialTheme.typography.h4)
Spacer(Modifier.size(32.dp))
FlowRow(
modifier = Modifier.fillMaxWidth(.5f),
horizontalArrangement = Arrangement.spacedBy(32.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
maxItemsInEachRow = 3,
Box(modifier = modifier.fillMaxSize()) {
Column(
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
FlavorCategoryButton("Sour", onClick = { onClick("Sour") })
FlavorCategoryButton("Sweet", onClick = { onClick("Sweet") })
FlavorCategoryButton("Salty", onClick = { onClick("Salty") })
FlavorCategoryButton("Spicy", onClick = { onClick("Spicy") })
FlavorCategoryButton("Bitter", onClick = { onClick("Bitter") })
FlavorCategoryButton("Herbal", onClick = { onClick("Herbal") })
FlavorCategoryButton("Fruity", onClick = { onClick("Fruity") })
FlavorCategoryButton("Smoky", onClick = { onClick("Smoky") })
FlavorCategoryButton("Umami", onClick = { onClick("Umami") })
Text("Pick a flavor for your cocktail ...", style = MaterialTheme.typography.h4)
Spacer(Modifier.size(32.dp))
FlowRow(
modifier = Modifier.fillMaxWidth(.5f),
horizontalArrangement = Arrangement.spacedBy(32.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
maxItemsInEachRow = 3,
) {
FlavorCategoryButton("Sour", onClick = { onClick("Sour") })
FlavorCategoryButton("Sweet", onClick = { onClick("Sweet") })
FlavorCategoryButton("Salty", onClick = { onClick("Salty") })
FlavorCategoryButton("Spicy", onClick = { onClick("Spicy") })
FlavorCategoryButton("Bitter", onClick = { onClick("Bitter") })
FlavorCategoryButton("Herbal", onClick = { onClick("Herbal") })
FlavorCategoryButton("Fruity", onClick = { onClick("Fruity") })
FlavorCategoryButton("Smoky", onClick = { onClick("Smoky") })
FlavorCategoryButton("Umami", onClick = { onClick("Umami") })
}
}
CreditText(modifier = Modifier.align(Alignment.BottomCenter))
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.aslansari.spiritvisor.theme.icon

import androidx.compose.runtime.Composable
import androidx.compose.foundation.Image
import androidx.compose.material.icons.Icons
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import org.jetbrains.compose.ui.tooling.preview.Preview

@Preview
@Composable
private fun VectorPreview() {
Image(Icons.HeartSharp, null)
}

private var _HeartSharp: ImageVector? = null

public val Icons.HeartSharp: ImageVector
get() {
if (_HeartSharp != null) {
return _HeartSharp!!
}
_HeartSharp = ImageVector.Builder(
name = "HeartSharp",
defaultWidth = 16.dp,
defaultHeight = 17.dp,
viewportWidth = 16f,
viewportHeight = 17f
).apply {
path(
fill = SolidColor(Color(0xFFDA1E28)),
fillAlpha = 1.0f,
stroke = null,
strokeAlpha = 1.0f,
strokeLineWidth = 1.0f,
strokeLineCap = StrokeCap.Butt,
strokeLineJoin = StrokeJoin.Miter,
strokeLineMiter = 1.0f,
pathFillType = PathFillType.NonZero
) {
moveTo(8.00006f, 14.5f)
lineTo(7.71881f, 14.3125f)
curveTo(6.3819f, 13.4197f, 4.6904f, 12.4106f, 3.4376f, 10.9275f)
curveTo(2.1172f, 9.365f, 1.4838f, 7.7603f, 1.5001f, 6.0213f)
curveTo(1.5197f, 4.0794f, 3.0769f, 2.5f, 4.9713f, 2.5f)
curveTo(6.4748f, 2.5f, 7.4744f, 3.375f, 8.0001f, 4.0066f)
curveTo(8.5257f, 3.375f, 9.5254f, 2.5f, 11.0288f, 2.5f)
curveTo(12.9232f, 2.5f, 14.4804f, 4.0794f, 14.5001f, 6.0203f)
curveTo(14.5176f, 7.7603f, 13.8841f, 9.3641f, 12.5626f, 10.9266f)
curveTo(11.3097f, 12.4106f, 9.6182f, 13.4197f, 8.2813f, 14.3125f)
lineTo(8.00006f, 14.5f)
close()
}
}.build()
return _HeartSharp!!
}

0 comments on commit cc80399

Please sign in to comment.