polymaker 0.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 64

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

[0.0.4] - 2020-05-18 #

  • getLocation return type is now Future<List
  • Added Tracking Mode Options [TrackingMode.LINEAR and TrackingMode.PLANAR]
  • Added initial camera locations
  • Added Map Type Control
  • Added functionality to use GPS data as tracking points

[0.0.3+1] - 2020-05-18 #

  • Fixing some warning

[0.0.3] - 2020-05-18 #

  • Adding Point Distance
  • Adding AutoEditMode option
  • Adding PointDistance option

[0.0.2+2] - 2020-05-15 #

  • Fixing Readme Error

[0.0.2+1] - 2020-05-15 #

  • Cleaning & Formatting Some Code
  • Updating Readme

[0.0.2] - 2020-05-15 #

  • Adding Custom Marker as Pointing Number
  • Adding support SDK Version 1.17.1

[0.0.1] - 2020-05-14 #

  • First release package

example/lib/main.dart

import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:polymaker/core/models/trackingmode.dart';
import 'package:polymaker/polymaker.dart' as polymaker;

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'PolyMaker Demo',
        debugShowCheckedModeBanner: false,
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: HomeScreen());
  }
}

class HomeScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("PolyMaker Demo"),
      ),
      body: HomeBody(),
    );
  }
}

class HomeBody extends StatefulWidget {
  @override
  _HomeBodyState createState() => _HomeBodyState();
}

class _HomeBodyState extends State<HomeBody> {
  List<LatLng> locationList;
  void getLocation() async {
    var result =
        await polymaker.getLocation(context, trackingMode: TrackingMode.PLANAR);
    if (result != null) {
      setState(() {
        locationList = result;
      });
    }
  }

  @override
  void initState() {
    super.initState();
    locationList = new List<LatLng>();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: MediaQuery.of(context).size.width,
      height: MediaQuery.of(context).size.height,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Text(
            "Location Result: \n" +
                (locationList != null
                    ? locationList
                        .map((val) => "[${val.latitude}, ${val.longitude}]\n")
                        .toString()
                    : ""),
            textAlign: TextAlign.center,
            style: TextStyle(fontSize: 18),
          ),
          SizedBox(height: 10),
          Container(
            height: 45,
            child: RaisedButton(
              color: Colors.blue,
              shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(10)),
              onPressed: () => getLocation(),
              child: Text(
                "Get Polygon Location",
                style: TextStyle(fontSize: 16, color: Colors.white),
              ),
            ),
          ),
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  polymaker: ^0.0.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:polymaker/polymaker.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
36
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:polymaker/polymaker.dart that imports:
  • package:polymaker/ui/screens/map_screen.dart that imports:
  • package:polymaker/core/viewmodels/map_provider.dart that imports:
  • package:location/location.dart that declares support for platforms: android, ios, macos, web

Package does not support Flutter platform macos

Because:

  • package:polymaker/polymaker.dart that imports:
  • package:polymaker/ui/screens/map_screen.dart that imports:
  • package:polymaker/core/viewmodels/map_provider.dart that imports:
  • package:google_maps_flutter/google_maps_flutter.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:polymaker/polymaker.dart that imports:
  • package:polymaker/ui/screens/map_screen.dart that imports:
  • package:polymaker/core/viewmodels/map_provider.dart that imports:
  • package:google_maps_flutter/google_maps_flutter.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:polymaker/polymaker.dart that imports:
  • package:polymaker/ui/screens/map_screen.dart that imports:
  • package:polymaker/core/viewmodels/map_provider.dart that imports:
  • package:location/location.dart that declares support for platforms: android, ios, macos, web

Package not compatible with SDK dart

Because:

  • polymaker that is a package requiring null.

Health suggestions

Fix lib/polymaker.dart. (-0.50 points)

Analysis of lib/polymaker.dart reported 1 hint:

line 5 col 8: Unused import: 'package:polymaker/core/models/location_polygon.dart'.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (simple_animations).

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
flutter 0.0.0
google_maps_flutter ^0.5.27+3 0.5.28+1
location ^3.0.2 3.0.2
provider ^4.1.2 4.3.1
simple_animations ^1.3.3 1.3.12 2.2.1
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
flutter_plugin_android_lifecycle 1.0.8
flutter_web_plugins 0.0.0
google_maps_flutter_platform_interface 1.0.2
http_parser 3.1.4
js 0.6.2
location_platform_interface 1.0.0
location_web 1.0.0
meta 1.1.8 1.2.2
nested 0.0.4
path 1.7.0
plugin_platform_interface 1.0.2
sky_engine 0.0.99
source_span 1.7.0
stream_transform 1.2.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test