Giter Club home page Giter Club logo

flutter_map's Introduction

pub package likes points popularity license stars forks sdk version

Lightweight and powerful Map widget for flutter, supporting different projections including EPSG4326/Mercator/WGS1984.

  • Written entirely in Dart. No plugins, No platform code, No native code.

  • Map is vendor-free. Meaning that you can choose any tile provider of your choice. Google Maps, Mapbox, OSM Maps and Yandex Maps are a few to name. You can also use this package with your own custom tiles, your own server, your own [sub]domain.

  • Support for vector tiles is under development in vt and cartography packages. Please checkout these packages to know more about the progress and open issues/tasks.

  • This package supports caching out of the box through cached_network_image and flutter_cache_manager packages.

Demo

Web Demo

The web demo contains several examples demonstrating different aspects and usages of the project. From interactivity to polyline rendering.

The source code of the demo app is available in the ./example project.

Contributing

I welcome contributions in all forms. One lightweight way you can contribute is to tell me that you're using Map, which will give me warm fuzzy feelings ๐Ÿคฉ.

Supported platforms

  • [โœ“] Android
  • [โœ“] iOS
  • [โœ“] Web
  • [โœ“] Windows
  • [โœ“] Linux
  • [โœ“] macOS
  • [โœ“] Flutter 3 is supported.

Getting Started

In your pubspec.yaml file add:

dependencies:
  map: any

Then, in your code import:

import 'package:map/map.dart';
final controller = MapController(
  location: const LatLng(0, 0),
  zoom: 2,
);
MapLayout(
  controller: controller,
  builder: (context, transformer) {
    return TileLayer(
      builder: (context, x, y, z) {
        final tilesInZoom = pow(2.0, z).floor();

        while (x < 0) {
          x += tilesInZoom;
        }
        while (y < 0) {
          y += tilesInZoom;
        }

        x %= tilesInZoom;
        y %= tilesInZoom;

        //Google Maps
        final url =
            'https://www.google.com/maps/vt/pb=!1m4!1m3!1i$z!2i$x!3i$y!2m3!1e0!2sm!3i420120488!3m7!2sen!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e0!5m1!1e0!23i4111425';

        return CachedNetworkImage(
          imageUrl: url,
          fit: BoxFit.cover,
        );
      },
    );
  },
);

Please check out the example project/tab for a working sample.

flutter_map's People

Contributors

xclud 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.