Skip to content

Commit a4bb195

Browse files
committed
feat(add-new-user): add error icon
1 parent f9b6363 commit a4bb195

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

feature-add/src/main/java/com/hoc/flowmvi/ui/add/AddNewUserScreen.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import androidx.compose.foundation.verticalScroll
2020
import androidx.compose.material.icons.Icons
2121
import androidx.compose.material.icons.filled.ArrowBack
2222
import androidx.compose.material.icons.filled.Email
23+
import androidx.compose.material.icons.filled.Error
2324
import androidx.compose.material.icons.filled.Person
2425
import androidx.compose.material3.ButtonDefaults
2526
import androidx.compose.material3.ElevatedButton
@@ -312,6 +313,11 @@ private fun LastNameTextField(
312313
lastNameError?.let {
313314
Text(text = it)
314315
}
316+
},
317+
trailingIcon = {
318+
if (lastNameError !== null) {
319+
ErrorIcon()
320+
}
315321
}
316322
)
317323
}
@@ -346,6 +352,11 @@ private fun FirstNameTextField(
346352
firstNameError?.let {
347353
Text(text = it)
348354
}
355+
},
356+
trailingIcon = {
357+
if (firstNameError !== null) {
358+
ErrorIcon()
359+
}
349360
}
350361
)
351362
}
@@ -380,10 +391,24 @@ private fun EmailTextField(
380391
emailError?.let {
381392
Text(text = it)
382393
}
394+
},
395+
trailingIcon = {
396+
if (emailError !== null) {
397+
ErrorIcon()
398+
}
383399
}
384400
)
385401
}
386402

403+
@Composable
404+
private fun ErrorIcon() {
405+
Icon(
406+
imageVector = Icons.Filled.Error,
407+
contentDescription = "Error",
408+
tint = MaterialTheme.colorScheme.error,
409+
)
410+
}
411+
387412
@Preview(
388413
showBackground = true,
389414
showSystemUi = true,

0 commit comments

Comments
 (0)