mapbox_draw_polygon_area 0.0.1 copy "mapbox_draw_polygon_area: ^0.0.1" to clipboard
mapbox_draw_polygon_area: ^0.0.1 copied to clipboard

A Flutter package that allows you to calculate the area of a polygon drawn on a Mapbox map.

drat pub publish --d# Flutter Mapbox Polygon Area Calculator

A Flutter package that allows you to calculate the area of a polygon drawn on a Mapbox map.

Features #

image

Getting started #

This package is highly dependent on Get state management package. Install latest getX pacakge from pub dev.

''' import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:mapbox_draw_polygon_area/src/mapbox_draw_polygon.dart' as myPacakge; import 'package:mapbox_gl/mapbox_gl.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return GetMaterialApp( home: MapboxMapExample(), ); } }

class MapboxMapExample extends StatefulWidget { @override _MapboxMapExampleState createState() => _MapboxMapExampleState(); }

class _MapboxMapExampleState extends State

void _onMapCreated(MapboxMapController controller) { //Assigning mapbox controller to your getx controller instance myController.mapBoxcontrollerInstance = controller; //<----Here //Add this function to use on symbol tap and feature taps myController.onMapCreateFun(); //<----Here }

@override void initState() { super.initState(); }

@override Widget build(BuildContext context) { return Scaffold( floatingActionButtonLocation: FloatingActionButtonLocation.miniCenterDocked, floatingActionButton: Stack( fit: StackFit.expand, children: [

      myController.drawPad(), // <-------------Snapping sheet to draw points
      myController.centerTargetiIcon(), // <------Target icon that is placed in the center of the screen
     
    ],
  ),
  body: MapboxMap(
    styleString: MapboxStyles.LIGHT,
    accessToken: 'mapbox public token', // <------your publicmapbox token
    onMapCreated: _onMapCreated,
    trackCameraPosition: true,
    initialCameraPosition: const CameraPosition(
      target: LatLng(40.384950128422496, -85.56492779229464),
      zoom: 16,
    ),
    //This is a helper line that will guide you in the process
    onCameraIdle: (() {
      if (myController.listOfDrawLatLlongs.isNotEmpty && 
          !myController.isPolygonSaved.value &&
          !myController.isDiagonalSaved.value) {
        myController.drawActiveline(); // <------Here-------
      }
    }),
  ),
);

} } '''

Usage #

To see an example of how to use the mapbox polygon area calculator, check out the example directory in the package source code.

Additional information #

You can checkout from github and contribute as much you want. # mapbox_draw_polygon_area

6
likes
0
pub points
11%
popularity

Publisher

unverified uploader

A Flutter package that allows you to calculate the area of a polygon drawn on a Mapbox map.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_plugin_android_lifecycle, get, mapbox_gl_modified, maps_toolkit, snapping_sheet

More

Packages that depend on mapbox_draw_polygon_area