-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Add support for custom cluster icon in Google Map Flutter #153092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks like this is not going to be implementable without https://issuetracker.google.com/issues/140415468 (or, alternately, #150525), since the cluster renderer protocol requires a synchronous response. Usually when we have something that requires a synchronous response we pre-generated the necessary information, send it asynchronously, and store it on the platform thread for immediate response, but there's no way to pre-generate all possible images. Even if clients didn't want the ability to change the icon dynamically (which they well might), they will almost certainly want to add a number, and that can be arbitrary as well. |
Please use a thumbs-up reaction on this comment specifically (in addition to the original feature request) if the following limited version of this feature would address your use case: We could potentially implement an API that allowed pre-providing a map of |
@stuartmorgan Needed one suggestion for this as I am not a native developer, what if I fork this package and add custom cluster logic for my usecase on native side code will this reflect on the flutter side map view? |
I'm really happy that there is now official support for clustering, but the inability to alter the clusterOptions leaves it unusable in my opinion. Specially with custom map styles, the variety of colors makes it look really out of place. But let's be honest, green, red, blue, brown... Even without a custom map style, these colors look awful when put together, I can't believe any dev that cares about design would use these clusters as it is. The clusterIcons also look too big in my personal opinion, so it would be nice to be able to adjust their scaling. I am really not familiar with the limitations to implement this, but ideally there would be an example of the default renderer which would allow us to tweak all the details. As I can in js or with Fluster, but until then I really don't think I can use the official clustering. |
This comment was marked as off-topic.
This comment was marked as off-topic.
I agree that clustering without the possibility of customizing the appearance is not very useful. However, I spent a bit of time looking into a possible solution, and it's definitely something I might be able to fix. I understand that the ClusterManager constructor here should probably extend setAlgorithm and setRenderer, and then trickle that down all the way back to the interface? Not really my department, but I might give it a go. Or has @stuartmorgan been working on this? |
When I read that flutter google maps offers its own clustering option, I immediately tried to implement it in my project, but when I realized that the cluster icons are not changeable and the numbers are fixed, it makes the whole thing completely unusable. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Is it even possible to change the cluster default colors? Just implemented this on my app but the lack of customization options means I might have to look for another solutions. |
For now no customization can be made. |
It would be beneficial to at least have things like:
I'll keep following this issue. Thanks for consideration. |
This comment has been minimized.
This comment has been minimized.
Still no updates? It's been over half a year and no new features for the ClusterManager? Besides marker customisation it would also be nice to be able to set a max zoom level at which clustering is disabled (e.g. if there are some pins that are just too close to each other). |
Use case
So Clustering in Google map is just landed but we don't have any support for custom cluster icon. There are some package on pub.dev but they are not proper solution to the problem.
Proposal
Need some properties that can override default cluster marker.
Like this
https://developers.google.com/maps/documentation/android-sdk/utility/marker-clustering
The ClusterManager constructor creates a DefaultClusterRenderer and a NonHierarchicalDistanceBasedAlgorithm. You can change the ClusterRenderer and the Algorithm using the setAlgorithm(Algorithm algorithm) and setRenderer(ClusterRenderer view) methods of ClusterManager.
You can implement ClusterRenderer to customize the rendering of the clusters. DefaultClusterRenderer provides a good base to start from. By subclassing DefaultClusterRenderer, you can override the defaults.
The text was updated successfully, but these errors were encountered: