Skip to content

Commit 3cc18a3

Browse files
author
stevebower
committed
Update Confirmation - maxLines is always 3 and set text to fillMaxWidth.
1 parent ce8db23 commit 3cc18a3

14 files changed

+51
-9
lines changed

compose-material/src/main/java/com/google/android/horologist/compose/material/Confirmation.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package com.google.android.horologist.compose.material
1919
import androidx.compose.foundation.layout.Arrangement
2020
import androidx.compose.foundation.layout.ColumnScope
2121
import androidx.compose.foundation.layout.PaddingValues
22+
import androidx.compose.foundation.layout.fillMaxWidth
2223
import androidx.compose.runtime.Composable
2324
import androidx.compose.runtime.LaunchedEffect
2425
import androidx.compose.runtime.getValue
@@ -115,10 +116,11 @@ public fun ConfirmationContent(
115116
title = title?.let {
116117
{
117118
Text(
119+
modifier = Modifier.fillMaxWidth(),
118120
text = it,
119121
color = MaterialTheme.colors.onBackground,
120122
textAlign = TextAlign.Center,
121-
maxLines = if (icon == null) 3 else 2,
123+
maxLines = 3,
122124
overflow = TextOverflow.Ellipsis,
123125
)
124126
}

sample/src/test/kotlin/com/google/android/horologist/screensizes/DialogTest.kt

+16
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,20 @@ class DialogTest(device: Device) : ScreenSizeTest(
237237
)
238238
}
239239
}
240+
241+
@Test
242+
fun multiLineConfirmationScreen() {
243+
runTest {
244+
ConfirmationContent(
245+
icon = {
246+
Icon(
247+
imageVector = Icons.Filled.Check,
248+
contentDescription = "Completed",
249+
tint = Color.Green,
250+
)
251+
},
252+
title = "This example uses three lines of text to show max limit",
253+
)
254+
}
255+
}
240256
}

0 commit comments

Comments
 (0)