Migrate Help Settings Fragment to Compose

This commit is contained in:
Ciphreon
2025-03-15 12:40:43 +01:00
committed by Cody Henthorne
parent 3e1edfbc67
commit c8c0146fd0
2 changed files with 155 additions and 56 deletions

View File

@@ -48,6 +48,45 @@ import org.signal.core.ui.compose.Rows.TextAndLabel
object Rows {
/**
* Link row that positions [text] and optional [label] in a [TextAndLabel] to the side of an [icon] on the right.
*/
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun LinkRow(
text: String,
onClick: (() -> Unit)? = null,
modifier: Modifier = Modifier,
label: String? = null,
textColor: Color = MaterialTheme.colorScheme.onSurface,
enabled: Boolean = true,
icon: ImageVector
) {
Row(
modifier = modifier
.fillMaxWidth()
.clickable(
enabled = enabled,
onClick = onClick ?: {}
)
.padding(defaultPadding()),
verticalAlignment = CenterVertically
) {
TextAndLabel(
text = text,
label = label,
textColor = textColor,
enabled = enabled,
modifier = Modifier.padding(end = 16.dp)
)
Icon(
imageVector = icon,
contentDescription = null
)
}
}
/**
* A row consisting of a radio button and [text] and optional [label] in a [TextAndLabel].
*/
@@ -293,7 +332,7 @@ object Rows {
*/
@Composable
fun RowScope.TextAndLabel(
text: String,
text: String? = null,
modifier: Modifier = Modifier,
label: String? = null,
enabled: Boolean = true,
@@ -305,11 +344,13 @@ object Rows {
.alpha(if (enabled) 1f else 0.4f)
.weight(1f)
) {
Text(
text = text,
style = textStyle,
color = textColor
)
if (text != null) {
Text(
text = text,
style = textStyle,
color = textColor
)
}
if (label != null) {
Text(