Search packages, repositories and app categories

Package detailsv8.0.3

flutter_map_dragmarker

Dragmarker class for flutter_map

AndroidiOSWebmacOSWindowsLinux
30-day downloads
27.1K
Likes
33
Pub points
130

Install package

flutter pub add flutter_map_dragmarker

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A drag marker widget for flutter_map that enables interactive placement and movement of markers on a map. It extends the functionality of flutter_map by allowing users to drag markers to desired locations, making it ideal for applications requiring precise geolocation input. The package integrates seamlessly with flutter_map's existing API and supports all major platforms including mobile, web, and desktop. It is lightweight and designed for simplicity without sacrificing core functionality.

Use cases

  • Interactive map marker placement
  • Geolocation data entry
  • Map-based form inputs
  • Real-time location adjustment
  • Customizable marker drag behavior

Key features

  • Draggable marker support
  • Seamless integration with flutter_map
  • Cross-platform compatibility
  • Customizable drag behavior
  • Lightweight and easy to implement

Suitable for

  • Developers building interactive maps
  • Applications needing user-defined coordinates
  • Location-aware forms
  • Map editing tools
  • Prototyping geospatial features

Considerations

  • Requires flutter_map to be installed
  • Limited to marker-specific interactions
  • No built-in validation for positions
  • May require additional styling for custom visuals
  • Not suitable for complex multi-marker manipulation

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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.

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package