Polymaker

Fork  Star  Watches  Get the library  Example

Polymaker is a flutter package to make it easier to map polygon locations in Google Maps, because the appearance is realtime when in Edit Mode, so we know the exact position without guessing through the backend system.

Polymaker can be run with only one line of code, and returns the location's List value.

Tools Feature:

  • Get Current Location
  • Entering Edit Mode
  • Closing Edit Mode
  • Done Editing
  • Undo Editing to Previous Location
  • Realtime polygon to view result
  • Custom Marker as Pointing Number
  • Point Distance
  • Tracking Mode LINEAR & PLANAR
  • Custom Map Type

Billing

You must enable some API in google cloud to use this features

  • Google Maps for Android/iOS

Setup

ANDROID

Adding Permission in android/app/src/main/AndroidManifest.xml

<uses-permission  android:name="android.permission.INTERNET"/>
<uses-permission  android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission  android:name="android.permission.ACCESS_FINE_LOCATION" />

Insert Google Maps Key in android/app/src/main/AndroidManifest.xml

<application
	android:name="io.flutter.app.FlutterApplication"
	android:label="example"
	android:icon="@mipmap/ic_launcher">
	.....
	<meta-data  android:name="com.google.android.geo.API_KEY"
		android:value="<YOUR API KEY>"/>
	<meta-data  android:name="com.google.android.gms.version"
		android:value="@integer/google_play_services_version" />
</application>

IOS

Specify your API key in the application delegate ios/Runner/AppDelegate.m:

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GMSServices provideAPIKey:@"YOUR KEY HERE"];
  [GeneratedPluginRegistrant registerWithRegistry:self];
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end

Or in your swift code, specify your API key in the application delegate ios/Runner/AppDelegate.swift:

import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
  ) -> Bool {
    GMSServices.provideAPIKey("YOUR KEY HERE")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Opt-in to the embedded views preview by adding a boolean property to the app's Info.plist file with the key io.flutter.embedded_views_preview and the value YES; you need also to define NSLocationWhenInUseUsageDescription

  <key>NSLocationWhenInUseUsageDescription</key>
  <string>This app needs your location to test the location feature of the Google Maps location picker plugin.</string>
  <key>io.flutter.embedded_views_preview</key>
  <true/>

How To Use

Using polymaker is very easy and only needs to use one line of code

import  'package:polymaker/polymaker.dart'  as polymaker;

// Open polymaker and get return List<LocationPolygon>
var result =  await polymaker.getLocation(context);

Custom Property in getLocation()

PropertyDescriptionData Type
toolColorProperty to customize tool colorColor
polygonColorProperty to customize polygon colorColor
iconLocationProperty to customize location iconIconData
iconEditModeProperty to customize edit mode iconIconData
iconCloseEditProperty to customize close tool iconIconData
iconDoneEditProperty to customize done iconIconData
iconUndoEditProperty to customize undo iconIconData
iconGPSPointProperty to use GPS data as tracking pointIconData
autoEditModeAutomatic enable edit modeBoolean
pointDistanceEnable / Disable Point DistanceBoolean
trackingModeChoose Tracking mode between polygon or polylineTrackingMode
targetCameraPositionSet initial camera locationsLatLng

Libraries

FadeAnimation
location_polygon
map_provider
map_screen
polymaker
trackingmode