Slide 20
Slide 20 text
改善後 (別のアイ
デ
ィア)
@Composable
fun IconWithBackground(imageVector: ImageVector, modifier: Modifier = Modifier) {
Icon(
modifier = modifier.roundedBlueBackground(),
imageVector = imageVector,
contentDescription = null,
)
}
@Composable
private fun TextWithBackground(text: String, modifier: Modifier) {
Text(
modifier = modifier.roundedBlueBackground(),
text = text,
fontSize = 16.sp,
)
}
private fun Modifier.roundedBlueBackground(): Modifier = this
.background(Color(0xFFBBDEFB), RoundedCornerShape(8.dp))
.padding(16.dp)
共通背景を定義