trailingContent and supportingContent should be null if there is nothing to display.
This commit is contained in:
parent
8339a6f1f3
commit
ea93579b23
1 changed files with 36 additions and 28 deletions
|
|
@ -82,48 +82,56 @@ fun PreferenceText(
|
||||||
color = tintColor ?: enabled.toEnabledColor(),
|
color = tintColor ?: enabled.toEnabledColor(),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
supportingContent = {
|
supportingContent = if (subtitle != null) {
|
||||||
if (subtitle != null) {
|
{
|
||||||
Text(
|
Text(
|
||||||
style = ElementTheme.typography.fontBodyMdRegular,
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
text = subtitle,
|
text = subtitle,
|
||||||
color = tintColor ?: enabled.toSecondaryEnabledColor(),
|
color = tintColor ?: enabled.toSecondaryEnabledColor(),
|
||||||
)
|
)
|
||||||
} else if (subtitleAnnotated != null) {
|
}
|
||||||
|
} else if (subtitleAnnotated != null) {
|
||||||
|
{
|
||||||
Text(
|
Text(
|
||||||
style = ElementTheme.typography.fontBodyMdRegular,
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
text = subtitleAnnotated,
|
text = subtitleAnnotated,
|
||||||
color = tintColor ?: enabled.toSecondaryEnabledColor(),
|
color = tintColor ?: enabled.toSecondaryEnabledColor(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
null
|
||||||
},
|
},
|
||||||
trailingContent = ListItemContent.Custom {
|
trailingContent = if (currentValue != null || loadingCurrentValue || showEndBadge) {
|
||||||
Row(
|
ListItemContent.Custom {
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
Row(
|
||||||
) {
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
if (currentValue != null) {
|
) {
|
||||||
Text(
|
if (currentValue != null) {
|
||||||
text = currentValue,
|
Text(
|
||||||
style = ElementTheme.typography.fontBodyXsMedium,
|
text = currentValue,
|
||||||
color = enabled.toSecondaryEnabledColor(),
|
style = ElementTheme.typography.fontBodyXsMedium,
|
||||||
)
|
color = enabled.toSecondaryEnabledColor(),
|
||||||
} else if (loadingCurrentValue) {
|
)
|
||||||
CircularProgressIndicator(
|
} else if (loadingCurrentValue) {
|
||||||
modifier = Modifier
|
CircularProgressIndicator(
|
||||||
.progressSemantics()
|
modifier = Modifier
|
||||||
.size(20.dp),
|
.progressSemantics()
|
||||||
strokeWidth = 2.dp
|
.size(20.dp),
|
||||||
)
|
strokeWidth = 2.dp
|
||||||
}
|
)
|
||||||
if (showEndBadge) {
|
}
|
||||||
val endBadgeStartPadding = if (currentValue != null || loadingCurrentValue) 16.dp else 0.dp
|
if (showEndBadge) {
|
||||||
RedIndicatorAtom(
|
val endBadgeStartPadding = if (currentValue != null || loadingCurrentValue) 16.dp else 0.dp
|
||||||
modifier = Modifier
|
RedIndicatorAtom(
|
||||||
.padding(start = endBadgeStartPadding)
|
modifier = Modifier
|
||||||
)
|
.padding(start = endBadgeStartPadding)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue