Skip to content
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

Don't cluster specific items #47

Open
deargosep opened this issue Jul 3, 2022 · 1 comment
Open

Don't cluster specific items #47

deargosep opened this issue Jul 3, 2022 · 1 comment

Comments

@deargosep
Copy link

For example if I have user avatar on map, I don't need it to cluster, how do I do that?

@oguibueno
Copy link

For example if I have user avatar on map, I don't need it to cluster, how do I do that?

What you can do is to have 2 different sets. One for clustering items and another one for non clustering items, like this:

final Set<Marker> _nonClusteringMarkers = {};
final Set<Marker> _clusteringMarkers = {};

GoogleMap(
  markers: {..._nonClusteringMarkers, ..._clusteringMarkers},
);

Create two classes like:

class Place { ... }

class ClusterPlace extends Place with ClusterItem { ... }

The Place one you use for the non clustering markers and the ClusterPlace you use for the clustering markers.

At the ClusterManager you can do something like this:

ClusterManager _initClusterManager() {
    return ClusterManager<ClusterPlace>(
      _items,
      _updateClusteringMarkers,
      markerBuilder: _markerClusterBuilder,
    );
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants