Welcome back.
If the user enters letters instead of numbers or he missed to enter some of the variables, the model
will give us errors.
In order to prevent this, I'm going to create a new Kotlin file.
Name it as validation errors and this file contains a new composable.
This composable is responsible for displaying the errors for the user and validate them.
So validation or validate error takes a list of errors.
It's of type string and this is a card.
Set the modifier dot fill maximum width colors equals to card defaults, dot card colors and inside
it set the container color to error container.
We need to display the error and the error container with the same color.
Okay, so we need to display errors for the user.
If he missed any of the text fields or he entered the wrong format of input.
Let me create a column and design this card.
Set the padding 816 dpi and inside this column start creating the text.
Composable.
Please fix the following.
We need title small color on error container.
Set a spacer modifier.
Modifier height ATP.
Then create a for loop displaying all the errors inside the errors list passed as a parameter.
So we're going to display a text for all errors inside the errors list.
So here errors for each for each error.
So let me name it like this.
For each error.
Go and create a text composable.
Having the text parameter like this and display the name of the error.
Set the style to body small.
Let's make it like this and an error container and set the modifier to vertical to ADP.
Okay so this is our validation errors composable function.
And in this function we have the card.
Inside this card we have column displaying a text for each error passed as a parameter.
And this function.