Add Icons to theme to wrap material icons

This commit is contained in:
Wolf-Martell Montwé 2023-05-10 15:22:58 +02:00
parent 1971549516
commit 5354a82b99
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
4 changed files with 16 additions and 6 deletions

View file

@ -10,7 +10,6 @@ android {
dependencies {
api(projects.core.ui.compose.theme)
implementation(libs.androidx.compose.material)
implementation(libs.androidx.compose.material.icons.extended)
testImplementation(projects.core.ui.compose.testing)
}

View file

@ -3,9 +3,6 @@ package app.k9mail.core.ui.compose.designsystem.atom.textfield
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Visibility
import androidx.compose.material.icons.filled.VisibilityOff
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@ -18,6 +15,7 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.R
import app.k9mail.core.ui.compose.theme.Icons
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import androidx.compose.material.OutlinedTextField as MaterialOutlinedTextField
@ -62,9 +60,9 @@ private fun selectTrailingIcon(
return if (hasTrailingIcon) {
{
val image = if (isShowPasswordAllowed(isEnabled, isPasswordVisible)) {
Icons.Filled.Visibility
Icons.passwordVisibility
} else {
Icons.Filled.VisibilityOff
Icons.passwordVisibilityOff
}
val description = if (isShowPasswordAllowed(isEnabled, isPasswordVisible)) {

View file

@ -11,4 +11,5 @@ dependencies {
api(projects.core.ui.compose.common)
implementation(libs.accompanist.systemuicontroller)
implementation(libs.androidx.compose.material)
implementation(libs.androidx.compose.material.icons.extended)
}

View file

@ -0,0 +1,12 @@
package app.k9mail.core.ui.compose.theme
import androidx.compose.material.icons.filled.Error
import androidx.compose.material.icons.filled.Visibility
import androidx.compose.material.icons.filled.VisibilityOff
import androidx.compose.material.icons.Icons as MaterialIcons
object Icons {
val error = MaterialIcons.Filled.Error
val passwordVisibility = MaterialIcons.Filled.Visibility
val passwordVisibilityOff = MaterialIcons.Filled.VisibilityOff
}