import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
@Composable
fun SimpleCardScreen() {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Card(
modifier = Modifier.padding(16.dp),
shape = MaterialTheme.shapes.medium,
elevation = CardDefaults.cardElevation(defaultElevation = 8.dp)
) {
Column(modifier = Modifier.padding(16.dp)) {
Text(
text = "Card Title",
style = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.Bold
)
Spacer(modifier = Modifier.height(8.dp))
Text(
text = "This is a simple description inside the card.",
style = MaterialTheme.typography.bodyMedium
)
}
}
}
}We use a Box to center the card on the screen. Inside the Box, we add a Card composable with padding and elevation to create a shadow effect. The card uses a medium shape for rounded corners. Inside the card, a Column arranges the title and description vertically with padding. The title text is bold and uses the titleLarge typography style, while the description uses bodyMedium. A spacer adds vertical space between the texts.