Git Product home page Git Product logo

flutter_map_supercluster's Introduction

Flutter Map Supercluster (previously flutter_map_fast_cluster)

Two different Marker clustering layers for flutter_map:

  • SuperclusterImmutableLayer: An extremely fast Marker clustering layer, Markers may not be added/removed.
  • SuperclusterMutableLayer: An slightly slower (but still very fast) Marker clustering layer. Markers can be added/removed.

If you want beautiful clustering animations check out flutter_map_marker_cluster. It will perform well for quite a lot of Markers on most devices. If you are running in to performance issues and are happy to sacrifice animations then this package may be for you.

Usage

Add flutter_map and flutter_map_supercluster to your pubspec:

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

Add it to FlutterMap:

  Widget build(BuildContext context) {
  return FlutterMap(
    options: MapOptions(
      zoom: 5,
      maxZoom: 15,
    ),
    children: <Widget>[
      TileLayer(
        options: TileLayerOptions(
          urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
          subdomains: ['a', 'b', 'c'],
        ),
      ),
      SuperclusterLayer.immutable(
        initialMarkers: markers, // Provide your own
        clusterWidgetSize: const Size(40, 40),
        builder: (context, markerCount, extraClusterData) {
          return Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(20.0),
              color: Colors.blue,
            ),
            child: Center(
              child: Text(
                markerCount.toString(),
                style: const TextStyle(color: Colors.white),
              ),
            ),
          );
        },
      ),
    ],
  );
}

Run the example

See the example/ folder for a working example app which demonstrates both immutable and mutable cluster layers.

flutter_map_supercluster's People

Contributors

rorystephenson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.