flutter_map_picker 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 82

flutter_map_picker #

Pick an area or a place on google maps

Getting Started #

Follow the steps to integrate Google Maps (https://pub.dev/packages/google_maps_flutter)

Pick area #

AreaPickerResult pickerResult = await Navigator.push(context, MaterialPageRoute(builder: (context) =>  AreaPickerScreen(
        googlePlacesApiKey: GOOGLE_PLACES_API_KEY,
        initialPosition: DEFAULT_LAT_LNG,
        mainColor: Colors.cyan,
        markerAsset: 'assets/images/icon_look_area.png',
        enableFreeDraw: true,
      )));

Pick address #

PlacePickerResult pickerResult = await Navigator.push(context, MaterialPageRoute(builder: (context) =>  PlacePickerScreen(
        googlePlacesApiKey: GOOGLE_PLACES_API_KEY,
        initialPosition: DEFAULT_LAT_LNG,
        mainColor: Colors.cyan,
      )));

[0.0.1] - TODO: Add release date. #

Initial release

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_map_picker/map_area_picker.dart';
import 'package:flutter_map_picker/map_place_picker.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'google_places_api_key.dart';

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

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

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  static const LatLng DEFAULT_LAT_LNG = LatLng(40.416775, 	-3.703790); //Madrid

  String result = '';

  @override
  Widget build(BuildContext context) {


    pickArea() async{
      AreaPickerResult pickerResult = await Navigator.push(context, MaterialPageRoute(builder: (context) =>  AreaPickerScreen(
        googlePlacesApiKey: GOOGLE_PLACES_API_KEY,
        initialPosition: DEFAULT_LAT_LNG,
        mainColor: Colors.cyan,
        markerAsset: 'assets/images/icon_look_area.png',
      )));

      setState(() {
        result = pickerResult.toString();
      });
    }

    pickPlace() async {
      PlacePickerResult pickerResult = await Navigator.push(context, MaterialPageRoute(builder: (context) =>  PlacePickerScreen(
        googlePlacesApiKey: GOOGLE_PLACES_API_KEY,
        initialPosition: DEFAULT_LAT_LNG,
        mainColor: Colors.cyan,
      )));

      setState(() {
        result = pickerResult.toString();
      });
    }

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          children: <Widget>[
            RaisedButton(
              onPressed: pickArea,
              child: Text("Pick area"),
            ),
            RaisedButton(
              onPressed: pickPlace,
              child: Text("Pick place"),
            ),
            Padding(
              padding: EdgeInsets.all(16),
              child: Text(result),
            )
          ],
        ),
      )
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_map_picker: ^0.0.1

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:flutter_map_picker/map_area_picker.dart';
import 'package:flutter_map_picker/map_place_picker.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
79
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
82
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:flutter_map_picker/map_area_picker.dart, package:location/location.dart]

Package does not support Flutter platform macos

Because of import path [package:flutter_map_picker/map_area_picker.dart, package:location/location.dart]

Package does not support Flutter platform web

Because of import path [package:flutter_map_picker/map_area_picker.dart, package:location/location.dart]

Package does not support Flutter platform windows

Because of import path [package:flutter_map_picker/map_area_picker.dart, package:location/location.dart]

Package not compatible with SDK dart

because of import path [flutter_map_picker]

Health suggestions

Format lib/map_area_picker.dart.

Run flutter format to format lib/map_area_picker.dart.

Format lib/map_place_picker.dart.

Run flutter format to format lib/map_place_picker.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 (location).

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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.3.0 <3.0.0
flutter 0.0.0
flutter_google_places ^0.2.4 0.2.5
geocoder ^0.2.1 0.2.1
google_maps_flutter ^0.5.25 0.5.28+1
google_maps_utils ^1.2.0+3 1.2.1+1
location ^2.3.5 2.5.4 3.0.2
Transitive dependencies
charcode 1.1.3
collection 1.14.12
csv 4.0.3
flutter_plugin_android_lifecycle 1.0.8
google_maps_flutter_platform_interface 1.0.2
google_maps_webservice 0.0.17
http 0.12.1
http_parser 3.1.4
meta 1.1.8
path 1.7.0
pedantic 1.9.0
plugin_platform_interface 1.0.2
poly 1.0.7+2
rxdart 0.24.1
sky_engine 0.0.99
source_span 1.7.0
stack 0.1.0
stream_transform 1.2.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test