mmaillot
08/12/2021, 11:44 AMmmaillot
08/12/2021, 11:45 AM@Composable
fun Phoneme(
modifier: Modifier = Modifier,
@DrawableRes lowerImage: Int,
@DrawableRes upperImage: Int,
@DrawableRes cursiveImage: Int,
) {
BoxWithConstraints(
modifier = modifier
.padding(20.dp)
.scale(0.8f)
.border(
width = 20.dp,
color = Color.White,
shape = RoundedCornerShape(30.dp),
)
) {
val width = maxWidth
Row(
modifier = modifier
) {
Image(
painter = painterResource(id = lowerImage),
contentScale = ContentScale.Fit,
modifier = Modifier.width(width / 3),
contentDescription = null
)
Image(
painter = painterResource(id = upperImage),
contentScale = ContentScale.Fit,
modifier = Modifier.width(width / 3),
contentDescription = null
)
Image(
painter = painterResource(id = cursiveImage),
contentScale = ContentScale.Fit,
modifier = Modifier.width(width / 3),
contentDescription = null
)
}
}
}
mmaillot
08/12/2021, 11:45 AM@Composable
fun Word(
modifier: Modifier = Modifier,
@DrawableRes wordImage: Int,
) {
Row(
modifier = modifier
.scale(0.8f)
.border(
width = 20.dp,
color = Color.White,
shape = RoundedCornerShape(30.dp),
)
) {
Image(
painter = painterResource(id = wordImage),
contentScale = ContentScale.Fit,
contentDescription = null
)
}
}
mmaillot
08/12/2021, 11:45 AM@Composable
fun MainScreen(model: PhonemeModel) {
BoxWithConstraints {
val width = maxWidth
Row(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
.background(Color.Blue, RoundedCornerShape(30.dp))
) {
Phoneme(
modifier = Modifier.width((width / 3) * 2),
lowerImage = model.lowerImage,
upperImage = model.upperImage,
cursiveImage = model.cursiveImage
)
Word(
modifier = Modifier.width(width / 3),
wordImage = model.wordImage
)
}
}
}
mmaillot
08/12/2021, 11:47 AMBoxWithConstraints
then compute the size manuallymmaillot
08/12/2021, 11:48 AMmmaillot
08/12/2021, 11:49 AMTin Tran
08/12/2021, 11:49 AMmmaillot
08/12/2021, 11:51 AMTin Tran
08/12/2021, 11:53 AMRow(Modifier.height(IntrinsicSize.Max)) {
//Phoneme
Word(Modifier.fillMaxHeight())
}
Colton Idle
08/12/2021, 4:18 PMmmaillot
08/19/2021, 4:05 PM