Skip to content

Commit

Permalink
perf: Optimize colors of ChildListItem()
Browse files Browse the repository at this point in the history
  • Loading branch information
XayahSuSuSu committed Mar 30, 2024
1 parent 64eb4cd commit 14ed95c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ internal fun ChildListItem(
)
}
Column(modifier = Modifier.weight(1f)) {
BodyLargeText(title)
BodyLargeText(text = title, color = MaterialTheme.colorScheme.onSurface)
if (subtitle != null)
BodyMediumText(text = subtitle)
BodyMediumText(text = subtitle, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
if (isChecked != null && onCheckBoxClick != null) {
IconToggleButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
Expand All @@ -30,20 +31,22 @@ internal fun TopBarSubTitle(modifier: Modifier, text: String) {
}

@Composable
internal fun BodyLargeText(text: String) {
internal fun BodyLargeText(text: String, color: Color = Color.Unspecified) {
Text(
text = text,
style = MaterialTheme.typography.bodyLarge
style = MaterialTheme.typography.bodyLarge,
color = color
)
}

@Composable
internal fun BodyMediumText(modifier: Modifier = Modifier, text: String, fontWeight: FontWeight? = null) {
internal fun BodyMediumText(modifier: Modifier = Modifier, text: String, fontWeight: FontWeight? = null, color: Color = Color.Unspecified) {
Text(
modifier = modifier,
text = text,
style = MaterialTheme.typography.bodyMedium,
fontWeight = fontWeight,
color = color,
)
}

Expand Down

0 comments on commit 14ed95c

Please sign in to comment.