Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.
/ geodraw Public archive

Draw markers, lines and polygons on a map

License

Notifications You must be signed in to change notification settings

synw/geodraw

Repository files navigation

Geodraw

pub package

Draw markers, lines and polygons on a map.

Marker picker

Marker screenshot

import 'package:flutter/material.dart';
import 'package:geodraw/geodraw.dart';
import 'package:latlong/latlong.dart';

class MarkerPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MarkerPicker(
      callback: (BuildContext context, LatLng point) {
        print("Point: $point");
      },
    );
  }
}

Line picker

Line screenshot

import 'package:flutter/material.dart';
import 'package:geodraw/geodraw.dart';
import 'package:latlong/latlong.dart';

class LinePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return LinePicker(
      callback: (BuildContext context, List<LatLng> points) {
        print("Line;");
        for (final point in points) {
          print("$point");
        }
      },
    );
  }
}

Polygon picker

Polygon screenshot

import 'package:flutter/material.dart';
import 'package:geodraw/geodraw.dart';
import 'package:latlong/latlong.dart';

class PolygonPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return PolygonPicker(
      callback: (BuildContext context, List<LatLng> points) {
        print("Polygon;");
        for (final point in points) {
          print("$point");
        }
      },
    );
  }
}

Note: the map will autocenter on current position unless a center is provided. Example:

MarkerPicker(
    center: LatLng(0, 51.0);
    zoom: 16.0,
    callback: (BuildContext context, LatLng point) {
       print("Point: $point");
    },
);