Skip to content

Provides beautiful animated marker clustering functionality for flutter_map. Inspired by Leaflet.markercluster

License

Notifications You must be signed in to change notification settings

cromoteca/flutter_map_marker_cluster

This branch is 2 commits ahead of, 233 commits behind lpongetti/flutter_map_marker_cluster:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e309ac0 · Jan 30, 2021

History

61 Commits
Aug 31, 2020
Jan 30, 2021
Nov 18, 2019
Aug 31, 2020
Jun 6, 2019
Jun 7, 2019
Jan 25, 2021
Jun 6, 2019
Sep 6, 2019
Nov 18, 2019
Jun 6, 2019
Jan 25, 2021

Repository files navigation

Flutter Map Marker Cluster

pub package travis

A Dart implementation of Leaflet.markercluster for Flutter apps. This is a plugin for flutter_map package

Usage

Add flutter_map and flutter_map_marker_cluster to your pubspec:

dependencies:
  flutter_map: any
  flutter_map_marker_cluster: any # or the latest version on Pub

Add it in you FlutterMap and configure it using MarkerClusterGroupLayerOptions.

  Widget build(BuildContext context) {
    return FlutterMap(
      options: new MapOptions(
        plugins: [
          MarkerClusterPlugin(),
        ],
      ),
      layers: [
        TileLayerOptions(
          urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
          subdomains: ['a', 'b', 'c'],
        ),
        MarkerClusterLayerOptions(
          maxClusterRadius: 120,
          size: Size(40, 40),
          fitBoundsOptions: FitBoundsOptions(
            padding: EdgeInsets.all(50),
          ),
          markers: markers,
          polygonOptions: PolygonOptions(
              borderColor: Colors.blueAccent,
              color: Colors.black12,
              borderStrokeWidth: 3),
          builder: (context, markers) {
            return FloatingActionButton(
              child: Text(markers.length.toString()),
              onPressed: null,
            );
          },
        ),
      ],
    );
  }

Run the example

See the example/ folder for a working example app.

About

Provides beautiful animated marker clustering functionality for flutter_map. Inspired by Leaflet.markercluster

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 96.6%
  • Objective-C 1.6%
  • Other 1.8%