Use alpha instead of colors in *SettingsEntry
This commit is contained in:
@@ -11,6 +11,7 @@ import androidx.compose.material.ripple.rememberRipple
|
|||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.alpha
|
||||||
import androidx.compose.ui.graphics.*
|
import androidx.compose.ui.graphics.*
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
@@ -293,6 +294,7 @@ fun SwitchSettingEntry(
|
|||||||
onClick = { onCheckedChange(!isChecked) },
|
onClick = { onCheckedChange(!isChecked) },
|
||||||
enabled = isEnabled
|
enabled = isEnabled
|
||||||
)
|
)
|
||||||
|
.alpha(if (isEnabled) 1f else 0.5f)
|
||||||
.padding(start = 24.dp)
|
.padding(start = 24.dp)
|
||||||
.padding(horizontal = 32.dp, vertical = 16.dp)
|
.padding(horizontal = 32.dp, vertical = 16.dp)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -304,12 +306,12 @@ fun SwitchSettingEntry(
|
|||||||
) {
|
) {
|
||||||
BasicText(
|
BasicText(
|
||||||
text = title,
|
text = title,
|
||||||
style = typography.xs.semiBold.copy(color = if (isEnabled) colorPalette.text else colorPalette.darkGray),
|
style = typography.xs.semiBold.copy(color = colorPalette.text),
|
||||||
)
|
)
|
||||||
|
|
||||||
BasicText(
|
BasicText(
|
||||||
text = text,
|
text = text,
|
||||||
style = typography.xs.semiBold.copy(color = if (isEnabled) colorPalette.textSecondary else colorPalette.darkGray),
|
style = typography.xs.semiBold.copy(color = colorPalette.textSecondary),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,18 +338,19 @@ fun SettingsEntry(
|
|||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
enabled = isEnabled
|
enabled = isEnabled
|
||||||
)
|
)
|
||||||
|
.alpha(if (isEnabled) 1f else 0.5f)
|
||||||
.padding(start = 24.dp)
|
.padding(start = 24.dp)
|
||||||
.padding(horizontal = 32.dp, vertical = 16.dp)
|
.padding(horizontal = 32.dp, vertical = 16.dp)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
BasicText(
|
BasicText(
|
||||||
text = title,
|
text = title,
|
||||||
style = typography.xs.semiBold.copy(color = if (isEnabled) colorPalette.text else colorPalette.darkGray),
|
style = typography.xs.semiBold.copy(color = colorPalette.text),
|
||||||
)
|
)
|
||||||
|
|
||||||
BasicText(
|
BasicText(
|
||||||
text = text,
|
text = text,
|
||||||
style = typography.xs.semiBold.copy(color = if (isEnabled) colorPalette.textSecondary else colorPalette.darkGray),
|
style = typography.xs.semiBold.copy(color = colorPalette.text),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user