diff --git a/BasicLayoutsCodelab/app/src/main/java/com/codelab/basiclayouts/MainActivity.kt b/BasicLayoutsCodelab/app/src/main/java/com/codelab/basiclayouts/MainActivity.kt index c8b08e7..ad26189 100644 --- a/BasicLayoutsCodelab/app/src/main/java/com/codelab/basiclayouts/MainActivity.kt +++ b/BasicLayoutsCodelab/app/src/main/java/com/codelab/basiclayouts/MainActivity.kt @@ -101,9 +101,31 @@ fun AlignYourBodyElement( // Step: Favorite collection card - Material Surface @Composable fun FavoriteCollectionCard( + @DrawableRes drawable: Int, + @StringRes text: Int, modifier: Modifier = Modifier ) { - // Implement composable here + Surface( + shape = MaterialTheme.shapes.small, + modifier = modifier + ) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier.width(192.dp) + ) { + Image( + painter = painterResource(id = drawable), + contentDescription = null, + contentScale = ContentScale.Crop, + modifier = Modifier.size(56.dp) + ) + Text( + text = stringResource(id = text), + style = MaterialTheme.typography.h3, + modifier = Modifier.padding(horizontal = 16.dp) + ) + } + } } // Step: Align your body row - Arrangements @@ -194,6 +216,8 @@ fun AlignYourBodyElementPreview() { fun FavoriteCollectionCardPreview() { MySootheTheme { FavoriteCollectionCard( + drawable = R.drawable.fc2_nature_meditations, + text = R.string.fc2_nature_meditations, modifier = Modifier.padding(8.dp) ) }