Fix OutlinedDecimalTextField colors

This commit is contained in:
Sad Ellie 2024-01-23 17:55:05 +03:00
parent 13bb808455
commit b90aa99004
3 changed files with 20 additions and 2 deletions

View File

@ -27,6 +27,8 @@ import androidx.compose.material.icons.outlined.Clear
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.TextFieldColors
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.ImeAction
@ -40,8 +42,9 @@ fun OutlinedDecimalTextField(
value: TextFieldValue,
onValueChange: (TextFieldValue) -> Unit,
label: @Composable () -> Unit,
colors: TextFieldColors = OutlinedTextFieldDefaults.colors(),
expressionFormatter: VisualTransformation,
imeAction: ImeAction = ImeAction.Next
imeAction: ImeAction = ImeAction.Next,
) {
OutlinedTextField(
modifier = modifier,
@ -61,5 +64,6 @@ fun OutlinedDecimalTextField(
keyboardType = KeyboardType.Decimal,
imeAction = imeAction
),
colors = colors
)
}

View File

@ -19,6 +19,8 @@
package com.sadellie.unitto.feature.bodymass.components
import androidx.compose.animation.AnimatedContent
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@ -49,6 +51,11 @@ internal fun BodyMassTextField(
onValueChange(it.copy(cleanText))
},
label = { AnimatedContent(label) { Text(it) } },
colors = OutlinedTextFieldDefaults
.colors(
focusedTextColor = MaterialTheme.colorScheme.onSecondaryContainer,
unfocusedTextColor = MaterialTheme.colorScheme.onSecondaryContainer,
),
expressionFormatter = expressionFormatter,
imeAction = imeAction
)

View File

@ -1,6 +1,6 @@
/*
* Unitto is a unit converter for Android
* Copyright (c) 2023 Elshan Agaev
* Copyright (c) 2023-2024 Elshan Agaev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,6 +19,8 @@
package com.sadellie.unitto.feature.datecalculator.components
import androidx.compose.animation.AnimatedContent
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@ -43,6 +45,11 @@ internal fun TimeUnitTextField(
onValueChange(newValue.copy(newValue.text.filter { it.isDigit() }))
},
label = { AnimatedContent(label) { Text(it) } },
colors = OutlinedTextFieldDefaults
.colors(
focusedTextColor = MaterialTheme.colorScheme.onSecondaryContainer,
unfocusedTextColor = MaterialTheme.colorScheme.onSecondaryContainer,
),
expressionFormatter = expressionFormatter,
imeAction = imeAction
)