GithubHelp home page GithubHelp logo

sirkalmi / flutter_map_dragmarker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibrierley/flutter_map_dragmarker

0.0 0.0 0.0 344 KB

A drag marker for flutter_map

License: BSD 3-Clause "New" or "Revised" License

C++ 35.89% C 2.26% Objective-C 0.06% Kotlin 0.20% Dart 27.21% Swift 1.83% HTML 2.91% CMake 29.65%

flutter_map_dragmarker's Introduction

flutter_map_dragmarker

A drag marker for flutter_map.

See the example/lib/main.dart for usage, but the included example below in this file should show pretty much everything.

ko-fi

Usage

  • This layer should probably be the last layer so IF it needs to be dragged (otherwise why would you use this :)). If not, other layers may intercept the gestures.
  • offset and dragOffset are there for tweaking icon/images if they should not get displayed centered.
  • height is mainly for Images, use Icon(..., size: ...), but be aware internal calculations are based on size.
  • rotateMarker toggles the markers' rotation on and off. True keeping markers upright.
  • Use scrollMapNearEdge if the map should scroll when a marker is dragged near the edge.
  • Enable useLongPress if you want to enable dragging after a long press
  FlutterMap(
    options: MapOptions(center: LatLng(45.5231, -122.6765), zoom: 9),
    children: [
      TileLayer(
        urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
      ),
      DragMarkers(
        markers: [
          DragMarker(
            point: LatLng(45.535, -122.675),
            offset: const Offset(0.0, -8.0),
            builder: (ctx) => const Icon(Icons.location_on, size: 50),
            onDragUpdate: (details, latLng) => print(latLng),
          ),
        ],
      ),
    ],
  ),

Further notes

It may be interesting to move the map alternately to marker, too. So the marker stays in place, but then technically you aren't dragging anymore, so thoughts welcome.

flutter_map_dragmarker's People

Contributors

eidolonfire avatar ibrierley avatar josxha avatar pablojimpas 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.