WEBVTT

00:00.080 --> 00:06.800
Welcome back for the first features like the model year, acceleration, weight, horsepower, displacement,

00:06.800 --> 00:07.720
cylinders.

00:07.800 --> 00:14.160
We specified a text fields and allow the user to enter data inside the text fields.

00:14.200 --> 00:19.440
Now we're going to make for the origin parameter.

00:19.440 --> 00:26.160
For the origin feature, we're going to allow the user to select one of the buttons.

00:26.160 --> 00:31.560
One of the origins European American Japanese.

00:31.880 --> 00:38.000
So we're going to allow the user to select only one button from the group.

00:38.280 --> 00:44.520
So for that create a new Kotlin file inside the screens package.

00:44.560 --> 00:47.240
Name it as origin chip.

00:47.400 --> 00:56.480
So we're going to create a chip composable function text a string selected boolean and on click lambda

00:56.480 --> 00:57.880
expression okay.

00:58.040 --> 01:01.440
Start with filter chip.

01:01.720 --> 01:10.400
Set the selected to selected on click to unclick and the label a new text with with the parameter text

01:10.400 --> 01:18.300
that it's best filter chip is a Material Design component in Jetpack Compose that allows users to select

01:18.300 --> 01:20.940
multiple options from a set.

01:21.100 --> 01:24.340
It's commonly used for filtering and categorizing.

01:24.500 --> 01:33.420
Okay, so we're going to use it for selecting the origin of the car back to our car features form.

01:33.420 --> 01:37.380
Under this text create a new row.

01:37.620 --> 01:48.580
Set the modifier to modifier dot fill maximum width horizontal arrangement space evenly alt plus enter

01:48.580 --> 02:00.140
to add this arrangement dot space evenly and here inside this row, start creating the first origin

02:00.300 --> 02:00.980
chip.

02:01.140 --> 02:03.940
Set the text for American selected.

02:04.140 --> 02:11.820
Set the car origin to one F and on click on features changed car features dot copy.

02:12.100 --> 02:17.420
We need to convert to this form, so please pay attention to me.

02:17.580 --> 02:25.570
The first chip, the origin chip named as American set the selected The car features one equals to one

02:25.610 --> 02:25.930
f.

02:25.970 --> 02:27.450
Back to car features.

02:27.450 --> 02:31.570
Here we need to set the origin 1 to 1 f.

02:31.690 --> 02:38.370
But the problem here that our model needs only one origin.

02:38.570 --> 02:41.330
We need to pass only one origin.

02:41.330 --> 02:49.170
And the value for the origin one is one, American one, European two, and Japanese three.

02:49.210 --> 02:57.170
To solve this problem, we need to set the other ones the other origins to zeros.

02:57.170 --> 03:04.610
So here this is what we've did since it's American and it's uh it's number is one.

03:04.610 --> 03:08.410
So here we set the origin one equals to one which is true.

03:08.450 --> 03:13.610
The origin two is false and origin three is false or zero okay.

03:13.850 --> 03:18.170
So this is how we specify the American origin.

03:18.410 --> 03:21.210
The similar to what we've done here.

03:21.450 --> 03:30.570
Let me copy this origin and paste it to here and change the American to European set.

03:30.570 --> 03:41.590
The car features origin to to 1 F and the origin here set it to zero, the origin 2 to 1 and origin

03:41.590 --> 03:43.510
three equals to zero.

03:43.590 --> 03:50.590
Similar to this, we're going to copy the European and paste it here for the Japanese.

03:50.590 --> 03:52.630
So we have American.

03:52.630 --> 03:54.030
We have European.

03:54.030 --> 03:59.950
And now Japanese set the origin to three equals to one.

04:00.430 --> 04:07.710
And set the origin to to zero and make the origin three equals to one f okay.

04:07.830 --> 04:11.030
So this is our origin chips.

04:11.030 --> 04:16.870
Now let's call this function and run our application to see the results.

04:16.870 --> 04:18.550
So car features four.

04:18.710 --> 04:25.670
Copy this and let's go to Car Mileage Predictor inside the input form.

04:25.670 --> 04:28.550
Let me call this composable.

04:28.550 --> 04:37.590
And we need we need to pass the parameters the car features or features chains and validation errors.

04:37.590 --> 04:41.830
In the next video we're going to create those variables and run our application.
