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

A Flutter package for creating pin in map center and animate it with map movement so the user can select his location .

Map Pin Picker #

Say Thanks!

A Swipe Drawer Library for Easy and Quick Usage.

The source code is 100% Dart, and everything resides in the /lib folder.

Show some ❤️ and star the repo to support the project #

Open Source Love License

GIF #

GIF

💻 Installation #

In the dependencies: section of your pubspec.yaml, add the following line:

map_pin_picker: <latest_version>

❔ Usage #

Import this class #

import 'package:map_pin_picker/map_pin_picker.dart';

Use MapPicker #

import 'package:geocoder/geocoder.dart'; //import geocoder to get address line from coordinates
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:map_pin_picker/map_pin_picker.dart';

  @override
  Widget build(BuildContext context) {
 return new Scaffold(
      body: Column(
        children: [
          Expanded(
            child: MapPicker(
              // pass icon widget
              iconWidget: Icon(Icons.location_pin,
                size: 50,
              ),
              //add map picker controller
              mapPickerController: mapPickerController,
              child: GoogleMap(
                zoomControlsEnabled: false,
                // hide location button
                myLocationButtonEnabled: false,
                mapType: MapType.normal,
                //  camera position
                initialCameraPosition: cameraPosition,
                onMapCreated: (GoogleMapController controller) {
                  _controller.complete(controller);
                },
                onCameraMoveStarted: () {
                  // notify map is moving
                  mapPickerController.mapMoving();
                },
                onCameraMove: (cameraPosition) {
                  this.cameraPosition = cameraPosition;
                },
                onCameraIdle: () async {
                  // notify map stopped moving
                  mapPickerController.mapFinishedMoving();
                  //get address name from camera position
                  List<Address> addresses = await Geocoder.local
                      .findAddressesFromCoordinates(Coordinates(
                      cameraPosition.target.latitude,
                      cameraPosition.target.longitude));
                  // update the ui with the address
                  textController.text='${addresses.first?.addressLine ?? ''}';
                },
              ),
            ),
          ),
        ],
      ),
    );
  }

🎨 Customization and Attributes #

MapPicker attributes

Attribute Name Example Value Description
child GoogleMap() Google map widget
iconWidget Icon( Icons.location_pin, size: 50, ) Pin icon widget
mapPickerController 20.0 body radius value the default value is 0.0
bodyBackgroundPeekSize MapPickerController() The controller that control pin animation
showDot true show dot under the pin ,the default value is true

Contributors ✨ #

Thanks goes to these wonderful people (emoji key):


Ahmed Eslayed

💻

📃 License #

Copyright (c) 2012 Pharous

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

39
likes
40
pub points
75%
popularity

Publisher

verified publisherpharous.com

A Flutter package for creating pin in map center and animate it with map movement so the user can select his location .

Homepage
Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on map_pin_picker