Welcome back.
Let's continue customizing clustering.
We defined our basic and default clustering system.
Now let's define our custom clustering.
You can use the cluster manager to define the zoom levels before or after marker rendering and cluster
rendering.
But in this example and in this course, I'm not gonna deep dive into cluster managers.
I showed you how to create cluster manager, but I'm not gonna use it because the default cluster manager
is is good and working fine with the maps and our needs.
There are a lot of things you can define and other like parameters in the clustering composable.
In this video we're gonna define the cluster content.
So the cluster content takes cluster for every cluster.
Go and create a new, for example, uh text.
Let me choose a text in order to change this and set cluster size and set the color.
For example.
In red.
Let me run.
And you notice that we have number 14 in red.
Here we if we click on the cluster go to the logcat and you click the cluster static size 14.
Let me increase the cluster.
And you notice that the markers are seven here and seven in another cluster.
Increase it in order to define and expand the markers okay.
So this is how we create a custom cluster.
Also we can create a pretty and more professional cluster like creating a new composable.
So let me define another composable here new Kotlin file.
Name it as circle cluster.
And this composable function contains other composables.
We can define some parameters for this function.
For example color if we need to make colors, and to define different colors for different clusters.
Also a text title, for example, or the text in in the middle of the cluster we can set a new modifier.
Okay.
And inside this circle cluster we can define surface.
And let me define some parameters for this surface I think I imported the wrong color not from graphics.
I need to import it from UI compose UI.
And here we go.
White border.
You can define the thickness of the border three dpi.
For example color dot green.
It's good.
Alt plus enter to import DPI and this is the surface.
Inside the surface.
Define a new box composable and inside it set text font weight is black.
Text align center color white alt plus.
Enter to import the text align.
And this is our composable that defines the custom shape for the cluster.
Let's use it in our clustering and cluster content.
Specify for every item.
Cluster.
Circle.
Cluster pass.
For example.
Cluster color.
Color dot blue.
The first parameter.
The second parameter is the size to string and pass the modifier.
For example, make it 50 dpi.
Let's run and see if the clustering.
The custom clustering takes place.
Here we go.
This is our map.
Go to here.
And you notice guys this is our custom cluster.
Okay.
The gestures are working fine.
If you click again you will notice that the gestures are working fine.
Also, you can notice that the cluster zoom level is good.
You can notice the green color, the stroke and the blue and the text inside it displaying the size
of the cluster.
Also, you can display the name of the cluster.
Then how many point of interest you have and so on.
Okay, so instead of displaying ten plus or the the default shape, you can customize cluster appearance.