use normal_text_size

This commit is contained in:
FunkyMuse 2023-07-10 16:40:47 +02:00
parent 10eff3707a
commit d90a86c319
2 changed files with 17 additions and 6 deletions

View File

@ -4,10 +4,7 @@ import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.LocalIndication import androidx.compose.foundation.LocalIndication
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.ripple.LocalRippleTheme import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.material3.* import androidx.compose.material3.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -16,12 +13,15 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.simplemobiletools.calculator.compose.extensions.MyDevices import com.simplemobiletools.calculator.compose.extensions.MyDevices
import com.simplemobiletools.calculator.compose.extensions.NoRippleTheme import com.simplemobiletools.calculator.compose.extensions.NoRippleTheme
import com.simplemobiletools.calculator.compose.theme.AppThemeSurface import com.simplemobiletools.calculator.compose.theme.AppThemeSurface
import com.simplemobiletools.calculator.compose.theme.preferenceSummaryColor import com.simplemobiletools.calculator.compose.theme.preferenceSummaryColor
import com.simplemobiletools.calculator.compose.theme.preferenceTitleColor import com.simplemobiletools.calculator.compose.theme.preferenceTitleColor
import com.simplemobiletools.commons.R
@Composable @Composable
fun SettingsCheckBoxComponent( fun SettingsCheckBoxComponent(
@ -41,10 +41,10 @@ fun SettingsCheckBoxComponent(
modifier = modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
.clickable(onClick = { onChange?.invoke(!initialValue) }, interactionSource = interactionSource, indication = indication) .clickable(onClick = { onChange?.invoke(!initialValue) }, interactionSource = interactionSource, indication = indication)
.padding(16.dp), .padding(horizontal = 16.dp, vertical = 8.dp),
) { ) {
Column( Column(
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f)
) { ) {
Text( Text(
modifier = Modifier modifier = Modifier
@ -52,6 +52,9 @@ fun SettingsCheckBoxComponent(
.padding(end = 16.dp), .padding(end = 16.dp),
text = title, text = title,
color = preferenceTitleColor(isEnabled = isPreferenceEnabled), color = preferenceTitleColor(isEnabled = isPreferenceEnabled),
fontSize = with(LocalDensity.current) {
dimensionResource(id = R.dimen.normal_text_size).toSp()
}
) )
AnimatedVisibility(visible = !summary.isNullOrBlank()) { AnimatedVisibility(visible = !summary.isNullOrBlank()) {
Text( Text(

View File

@ -9,6 +9,8 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
@ -42,6 +44,9 @@ fun SettingsPreferenceComponent(
text = preferenceTitle, text = preferenceTitle,
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
color = preferenceTitleColor(isEnabled = isPreferenceEnabled), color = preferenceTitleColor(isEnabled = isPreferenceEnabled),
fontSize = with(LocalDensity.current) {
dimensionResource(id = R.dimen.normal_text_size).toSp()
}
) )
AnimatedVisibility(visible = !preferenceSummary.isNullOrBlank()) { AnimatedVisibility(visible = !preferenceSummary.isNullOrBlank()) {
Text( Text(
@ -49,6 +54,9 @@ fun SettingsPreferenceComponent(
modifier = Modifier modifier = Modifier
.fillMaxWidth(), .fillMaxWidth(),
color = preferenceSummaryColor.copy(alpha = 0.6f), color = preferenceSummaryColor.copy(alpha = 0.6f),
fontSize = with(LocalDensity.current) {
dimensionResource(id = R.dimen.normal_text_size).toSp()
}
) )
} }
} }