Last active
July 27, 2024 13:54
-
-
Save hassanabidpk/92cf3acf5b98d1fdb83e699db115663d to your computer and use it in GitHub Desktop.
Iteration 1 of CoffeeDetailScreen generated by Google AI Studio. Iteration 2 done to rectify changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dev.hassanabid.ioextendedsg.studioui | |
import android.annotation.SuppressLint | |
import androidx.compose.foundation.Image | |
import androidx.compose.foundation.layout.* | |
import androidx.compose.foundation.shape.RoundedCornerShape | |
import androidx.compose.material.icons.Icons | |
import androidx.compose.material.icons.filled.ArrowBack | |
import androidx.compose.material.icons.filled.Coffee | |
import androidx.compose.material.icons.filled.DeliveryDining | |
import androidx.compose.material.icons.filled.Favorite | |
import androidx.compose.material.icons.filled.LocalOffer | |
import androidx.compose.material.icons.filled.Star | |
import androidx.compose.material3.* | |
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.graphics.vector.ImageVector | |
import androidx.compose.ui.res.painterResource | |
import androidx.compose.ui.res.vectorResource | |
import androidx.compose.ui.text.font.FontWeight | |
import androidx.compose.ui.text.style.TextAlign | |
import androidx.compose.ui.tooling.preview.Preview | |
import androidx.compose.ui.unit.dp | |
import androidx.compose.ui.unit.sp | |
import dev.hassanabid.ioextendedsg.R | |
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") | |
@OptIn(ExperimentalMaterial3Api::class) | |
@Preview(showBackground = true) | |
@Composable | |
fun CoffeeDetailScreen() { | |
Scaffold( | |
topBar = { | |
CenterAlignedTopAppBar( | |
title = { Text("Detail") }, | |
navigationIcon = { | |
IconButton(onClick = { /*TODO*/ }) { | |
Icon( | |
imageVector = Icons.Default.ArrowBack, | |
contentDescription = "Back", | |
) | |
} | |
}, | |
actions = { | |
IconButton(onClick = { /*TODO*/ }) { | |
Icon( | |
imageVector = Icons.Default.Favorite, | |
contentDescription = "Favorite", | |
) | |
} | |
} | |
) | |
} | |
) { | |
Column( | |
modifier = Modifier | |
.fillMaxSize() | |
.padding(16.dp) | |
) { | |
Image( | |
painter = painterResource(id = R.drawable.coffee), | |
contentDescription = "Coffee", | |
modifier = Modifier | |
.fillMaxWidth() | |
.height(350.dp) | |
.padding(bottom = 16.dp) | |
) | |
Text( | |
text = "Caffe Mocha", | |
fontSize = 24.sp, | |
fontWeight = FontWeight.Bold, | |
modifier = Modifier.padding(bottom = 8.dp) | |
) | |
Row( | |
verticalAlignment = Alignment.CenterVertically, | |
modifier = Modifier.padding(bottom = 8.dp) | |
) { | |
Text( | |
text = "Ice/Hot", | |
fontSize = 14.sp | |
) | |
Spacer(modifier = Modifier.weight(1f)) | |
Icon( | |
imageVector = Icons.Default.DeliveryDining, | |
contentDescription = "Delivery", | |
tint = Color(0xFFD49A6A) | |
) | |
Spacer(modifier = Modifier.width(8.dp)) | |
Icon( | |
imageVector = Icons.Default.Coffee, | |
contentDescription = "Coffee", | |
tint = Color(0xFFD49A6A) | |
) | |
Spacer(modifier = Modifier.width(8.dp)) | |
Icon( | |
imageVector = Icons.Default.LocalOffer, | |
contentDescription = "Offer", | |
tint = Color(0xFFD49A6A) | |
) | |
} | |
Row( | |
verticalAlignment = Alignment.CenterVertically, | |
modifier = Modifier.padding(bottom = 16.dp) | |
) { | |
Icon( | |
imageVector = Icons.Default.Star, | |
contentDescription = "Rating", | |
tint = Color(0xFFFFE0B2) | |
) | |
Spacer(modifier = Modifier.width(4.dp)) | |
Text( | |
text = "4.8", | |
fontSize = 16.sp, | |
fontWeight = FontWeight.Bold | |
) | |
Spacer(modifier = Modifier.width(4.dp)) | |
Text( | |
text = "(230)", | |
fontSize = 12.sp, | |
color = Color.Gray | |
) | |
} | |
Text( | |
text = "Description", | |
fontSize = 18.sp, | |
fontWeight = FontWeight.Bold, | |
modifier = Modifier.padding(bottom = 8.dp) | |
) | |
Text( | |
text = "A cappuccino is an approximately 150 ml (5 oz) beverage, with 25 ml of espresso coffee and 85ml of fresh milk the fo...", | |
fontSize = 14.sp, | |
modifier = Modifier.padding(bottom = 16.dp) | |
) | |
Text( | |
text = "Read More", | |
color = Color(0xFFD49A6A), | |
textAlign = TextAlign.Center, | |
modifier = Modifier | |
.fillMaxWidth() | |
.padding(bottom = 16.dp) | |
) | |
Text( | |
text = "Size", | |
fontSize = 18.sp, | |
fontWeight = FontWeight.Bold, | |
modifier = Modifier.padding(bottom = 8.dp) | |
) | |
Row( | |
horizontalArrangement = Arrangement.SpaceBetween, | |
modifier = Modifier.fillMaxWidth() | |
) { | |
OutlinedButton( | |
onClick = { /*TODO*/ }, | |
shape = RoundedCornerShape(16.dp), | |
modifier = Modifier.weight(1f) | |
) { | |
Text(text = "S") | |
} | |
Spacer(modifier = Modifier.width(8.dp)) | |
Button( | |
onClick = { /*TODO*/ }, | |
shape = RoundedCornerShape(16.dp), | |
modifier = Modifier.weight(1f), | |
colors = ButtonDefaults.buttonColors( | |
containerColor = Color(0xFFF5F5F5), | |
contentColor = Color.Black | |
) | |
) { | |
Text(text = "M") | |
} | |
Spacer(modifier = Modifier.width(8.dp)) | |
OutlinedButton( | |
onClick = { /*TODO*/ }, | |
shape = RoundedCornerShape(16.dp), | |
modifier = Modifier.weight(1f) | |
) { | |
Text(text = "L") | |
} | |
} | |
Spacer(modifier = Modifier.height(16.dp)) | |
Row( | |
verticalAlignment = Alignment.CenterVertically, | |
horizontalArrangement = Arrangement.SpaceBetween, | |
modifier = Modifier.fillMaxWidth() | |
) { | |
Text( | |
text = "Price", | |
fontSize = 16.sp, | |
fontWeight = FontWeight.Bold | |
) | |
Spacer(modifier = Modifier.weight(1f)) | |
Button( | |
onClick = { /*TODO*/ }, | |
shape = RoundedCornerShape(16.dp), | |
modifier = Modifier.fillMaxWidth(), | |
colors = ButtonDefaults.buttonColors( | |
containerColor = Color(0xFFD49A6A) | |
) | |
) { | |
Text(text = "Buy Now") | |
} | |
} | |
Text( | |
text = "$ 4.53", | |
fontSize = 20.sp, | |
fontWeight = FontWeight.Bold, | |
color = Color(0xFFD49A6A), | |
modifier = Modifier.padding(top = 8.dp) | |
) | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dev.hassanabid.ioextendedsg.studioui | |
import android.annotation.SuppressLint | |
import androidx.compose.foundation.Image | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.* | |
import androidx.compose.foundation.shape.RoundedCornerShape | |
import androidx.compose.material.icons.Icons | |
import androidx.compose.material.icons.filled.ArrowBack | |
import androidx.compose.material.icons.filled.Coffee | |
import androidx.compose.material.icons.filled.DeliveryDining | |
import androidx.compose.material.icons.filled.Favorite | |
import androidx.compose.material.icons.filled.LocalOffer | |
import androidx.compose.material.icons.filled.Star | |
import androidx.compose.material3.* | |
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.graphics.vector.ImageVector | |
import androidx.compose.ui.res.painterResource | |
import androidx.compose.ui.res.vectorResource | |
import androidx.compose.ui.text.font.FontWeight | |
import androidx.compose.ui.text.style.TextAlign | |
import androidx.compose.ui.tooling.preview.Preview | |
import androidx.compose.ui.unit.dp | |
import androidx.compose.ui.unit.sp | |
import dev.hassanabid.ioextendedsg.R | |
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") | |
@OptIn(ExperimentalMaterial3Api::class) | |
@Preview(showBackground = true) | |
@Composable | |
fun CoffeeDetailScreen2() { | |
Scaffold( | |
topBar = { | |
CenterAlignedTopAppBar( | |
title = { Text("Detail") }, | |
navigationIcon = { | |
IconButton(onClick = { /*TODO*/ }) { | |
Icon( | |
imageVector = Icons.Default.ArrowBack, | |
contentDescription = "Back", | |
) | |
} | |
}, | |
actions = { | |
IconButton(onClick = { /*TODO*/ }) { | |
Icon( | |
imageVector = Icons.Default.Favorite, | |
contentDescription = "Favorite", | |
) | |
} | |
} | |
) | |
}, | |
bottomBar = { | |
// Red outline starts here | |
Column( | |
modifier = Modifier | |
.fillMaxWidth() | |
.background(MaterialTheme.colorScheme.surface) | |
.padding(16.dp), | |
verticalArrangement = Arrangement.Bottom, | |
horizontalAlignment = Alignment.CenterHorizontally | |
) { | |
Row( | |
verticalAlignment = Alignment.CenterVertically, | |
horizontalArrangement = Arrangement.SpaceBetween, | |
modifier = Modifier.fillMaxWidth() | |
) { | |
Column() { | |
Text( | |
text = "Price", | |
fontSize = 16.sp, | |
fontWeight = FontWeight.Bold | |
) | |
Text( | |
text = "$ 4.53", | |
fontSize = 20.sp, | |
fontWeight = FontWeight.Bold, | |
color = Color(0xFFD49A6A), | |
modifier = Modifier.padding(top = 8.dp) | |
) | |
} | |
Spacer(modifier = Modifier.weight(1f)) | |
Button( | |
onClick = { /*TODO*/ }, | |
shape = RoundedCornerShape(16.dp), | |
modifier = Modifier.padding(all = 8.dp) | |
.width(200.dp) | |
.height(56.dp), | |
colors = ButtonDefaults.buttonColors( | |
containerColor = Color(0xFFD49A6A) | |
) | |
) { | |
Text(text = "Buy Now") | |
} | |
} | |
} | |
// Red outline ends here | |
} | |
) { | |
Column( | |
modifier = Modifier | |
.fillMaxSize() | |
.padding(16.dp) | |
) { | |
Image( | |
painter = painterResource(id = R.drawable.coffee), | |
contentDescription = "Coffee", | |
modifier = Modifier | |
.fillMaxWidth() | |
.height(350.dp) | |
.padding(bottom = 8.dp) | |
) | |
Text( | |
text = "Caffe Mocha", | |
fontSize = 26.sp, | |
fontWeight = FontWeight.Bold, | |
modifier = Modifier.padding(bottom = 8.dp) | |
) | |
Row( | |
verticalAlignment = Alignment.CenterVertically, | |
modifier = Modifier.padding(bottom = 8.dp) | |
) { | |
Text( | |
text = "Ice/Hot", | |
fontSize = 14.sp | |
) | |
Spacer(modifier = Modifier.weight(1f)) | |
Icon( | |
imageVector = Icons.Default.DeliveryDining, | |
contentDescription = "Delivery", | |
tint = Color(0xFFD49A6A) | |
) | |
Spacer(modifier = Modifier.width(16.dp)) | |
Icon( | |
imageVector = Icons.Default.Coffee, | |
contentDescription = "Coffee", | |
tint = Color(0xFFD49A6A) | |
) | |
Spacer(modifier = Modifier.width(16.dp)) | |
Icon( | |
imageVector = Icons.Default.LocalOffer, | |
contentDescription = "Offer", | |
tint = Color(0xFFD49A6A) | |
) | |
} | |
Row( | |
verticalAlignment = Alignment.CenterVertically, | |
modifier = Modifier.padding(bottom = 16.dp) | |
) { | |
Icon( | |
imageVector = Icons.Default.Star, | |
contentDescription = "Rating", | |
tint = Color(0xFFFFE0B2) | |
) | |
Spacer(modifier = Modifier.width(4.dp)) | |
Text( | |
text = "4.8", | |
fontSize = 16.sp, | |
fontWeight = FontWeight.Bold | |
) | |
Spacer(modifier = Modifier.width(4.dp)) | |
Text( | |
text = "(230)", | |
fontSize = 12.sp, | |
color = Color.Gray | |
) | |
} | |
Text( | |
text = "Description", | |
fontSize = 20.sp, | |
fontWeight = FontWeight.Bold, | |
modifier = Modifier.padding(bottom = 8.dp) | |
) | |
Text( | |
text = "A cappuccino is an approximately 150 ml (5 oz) beverage, with 25 ml of espresso coffee and 85ml of fresh milk the fo...", | |
fontSize = 16.sp, | |
modifier = Modifier.padding(bottom = 16.dp) | |
) | |
Text( | |
text = "Read More", | |
color = Color(0xFFD49A6A), | |
textAlign = TextAlign.Center, | |
modifier = Modifier | |
.fillMaxWidth() | |
.padding(bottom = 16.dp) | |
) | |
Text( | |
text = "Size", | |
fontSize = 20.sp, | |
fontWeight = FontWeight.Bold, | |
modifier = Modifier.padding(bottom = 8.dp) | |
) | |
Row( | |
horizontalArrangement = Arrangement.SpaceBetween, | |
modifier = Modifier.fillMaxWidth() | |
) { | |
OutlinedButton( | |
onClick = { /*TODO*/ }, | |
shape = RoundedCornerShape(16.dp), | |
modifier = Modifier.weight(1f) | |
) { | |
Text(text = "S") | |
} | |
Spacer(modifier = Modifier.width(8.dp)) | |
Button( | |
onClick = { /*TODO*/ }, | |
shape = RoundedCornerShape(16.dp), | |
modifier = Modifier.weight(1f), | |
colors = ButtonDefaults.buttonColors( | |
containerColor = Color(0xFFF5F5F5), | |
contentColor = Color.Black | |
) | |
) { | |
Text(text = "M") | |
} | |
Spacer(modifier = Modifier.width(8.dp)) | |
OutlinedButton( | |
onClick = { /*TODO*/ }, | |
shape = RoundedCornerShape(16.dp), | |
modifier = Modifier.weight(1f) | |
) { | |
Text(text = "L") | |
} | |
} | |
Spacer(modifier = Modifier.height(16.dp)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generated UI (need to be corrected)