@@ -12,9 +12,11 @@ import androidx.compose.foundation.clickable
1212import androidx.compose.foundation.interaction.MutableInteractionSource
1313import androidx.compose.foundation.layout.Arrangement
1414import androidx.compose.foundation.layout.Box
15+ import androidx.compose.foundation.layout.BoxWithConstraints
1516import androidx.compose.foundation.layout.Column
1617import androidx.compose.foundation.layout.ExperimentalLayoutApi
1718import androidx.compose.foundation.layout.FlowRow
19+ import androidx.compose.foundation.layout.FlowRowOverflow
1820import androidx.compose.foundation.layout.Spacer
1921import androidx.compose.foundation.layout.fillMaxHeight
2022import androidx.compose.foundation.layout.fillMaxSize
@@ -399,6 +401,7 @@ private fun NoCallActiveScreen() {
399401
400402@OptIn(ExperimentalLayoutApi ::class )
401403@WearPreviewDevices
404+ @WearPreviewFontScales
402405@Composable
403406private fun KeypadScreen (
404407 onKeyPressed : (Char ) -> Unit = {}
@@ -442,36 +445,38 @@ private fun KeypadScreen(
442445 overflow = TextOverflow .Visible
443446 )
444447 }
445- FlowRow (
446- modifier = Modifier
447- .fillMaxWidth()
448- .weight(1f , fill = true )
449- .padding(
450- start = if (isRound) 32 .dp else 8 .dp,
451- end = if (isRound) 32 .dp else 8 .dp,
452- bottom = if (isRound) 32 .dp else 8 .dp
453- ),
454- maxItemsInEachRow = 3 ,
455- horizontalArrangement = Arrangement .Center ,
456- verticalArrangement = Arrangement .Center
457- ) {
458- digits.forEach {
459- Box (
460- modifier = Modifier
461- .weight(1f , fill = true )
462- .fillMaxHeight(1f / 4f )
463- .clickable {
464- keypadText + = it
465- onKeyPressed.invoke(it)
466- },
467- contentAlignment = Alignment .Center
468- ) {
469- Text (
470- text = it + " " ,
471- maxLines = 1 ,
472- textAlign = TextAlign .Center ,
473- fontSize = 16 .sp
474- )
448+ BoxWithConstraints {
449+ FlowRow (
450+ modifier = Modifier
451+ .fillMaxSize()
452+ .padding(
453+ start = if (isRound) 32 .dp else 8 .dp,
454+ end = if (isRound) 32 .dp else 8 .dp,
455+ bottom = if (isRound) 32 .dp else 8 .dp
456+ ),
457+ maxItemsInEachRow = 3 ,
458+ horizontalArrangement = Arrangement .Center ,
459+ verticalArrangement = Arrangement .Center ,
460+ overflow = FlowRowOverflow .Visible
461+ ) {
462+ digits.forEach {
463+ Box (
464+ modifier = Modifier
465+ .weight(1f , fill = true )
466+ .height((this @BoxWithConstraints.maxHeight - if (isRound) 32 .dp else 8 .dp) / 4 )
467+ .clickable {
468+ keypadText + = it
469+ onKeyPressed.invoke(it)
470+ },
471+ contentAlignment = Alignment .Center
472+ ) {
473+ Text (
474+ text = it + " " ,
475+ maxLines = 1 ,
476+ textAlign = TextAlign .Center ,
477+ fontSize = 16 .sp
478+ )
479+ }
475480 }
476481 }
477482 }
0 commit comments