Welcome back.
Now let's call those functions from our fabs open Uber clone map.
And here expandable fab.
Let me create two expandable fabs.
Additional fabs.
And here scroll down.
This is the second floating action button for drawing map drawing route.
And before the clear markers fab I need to create another two floating action buttons.
So copy this paste it here first time.
And the second time we have request right draw route.
The third one is adding markers to multi points list.
So this floating action button will add the markers to the multi points list.
The expanded equals to false and set on a place multi place multi markers.
Then scroll down instead of draw a route I need to make it add marker, add multi markers, then scroll
down to the fourth floating action button.
Instead of drawing route.
Here we need to set the route between multiple markers.
Remove and draw route.
Set it to on multiple markers route.
Now let's pass those to Lambda expressions.
Here in the constructor pass on place multiple markers and on multiple markers route.
Those are two lambda expressions having nothing in the parameters and returning nothing.
Go back to Uber clone map.
Here we need to specify the logic behind the newly created Parameters.
Let's start with on a place multiple markers.
Here it's simply specified as a toggle to enable or disable adding markers to a list.
So here we need to create like a flag, a boolean in order to allow the user to add markers to the list
or not.
Since when the user clicks on the map, there are markers created on the map on the touched position.
We need to enable or disable adding those markers to the multiple list.
So for this purpose I created this floating action button and on place multiple markers parameter.
In order to allow this enable or disable adding markers to the list, I'm going to create a new variable
up here.
Outside the box that contains the Google map.
We need to create the variables to control the multiple marker selection status.
VAR is adding markers enabled by.
Remember mutable state flow and set it to false.
Then val mutable multiple markers list equals to remember mutable state list of lat long.
Also, we need to create a variable for holding list of multiple points.
So route multi points by ViewModel dot multi points dot collect as state with life cycle.
If you notice I'm not lecturing anything because those are simple and in the previous videos I lectured
about them exactly like this.
Exactly like this and others.
Okay, so there's no need to mention them in the current videos.
Okay.
So let's use those variables.
Scroll down.
And here on place multiple markers we need to specify those points.
So enable or disable adding markers to the list.
If it is enabled go and disabled.
If it is disabled go and enabled.
So this is the switch and this is a toggle.
Now let's specify the multi markers route.
If is adding enabled go and fetch the ViewModel.
Fetch multiple route marker okay.
Go and execute this function.
Now let's make use of this add marker to Multi Points route.
Scroll up and control the click on map click so here if is adding markers enabled.
So here I am checking if multiple marker enabled.
Go and add the multiple markers list and add the mile at long mile marker.
Also store markers to waypoints api url.
Okay, so the idea here, if we are clicking on the map, there is a new marker being displayed.
But if adding markers are enabled then go and add it to the marker.
And here go and store the marker to waypoints api URL.
Okay.
So in this case we are storing the marker to the list if it is enabled.
If not, just go and display it and set the selected location to my marker.