A Swipe Drawer Library for Easy and Quick Usage.
- Checkout the Original Author : ![GitHub followers])
The source code is 100% Dart, and everything resides in the /lib folder.
In the dependencies:
section of your pubspec.yaml
, add the following line:
map_pin_picker: <latest_version>
import 'package:map_pin_picker/map_pin_picker.dart';
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 ?? ''}';
},
),
),
),
],
),
);
}
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 |
Thanks goes to these wonderful people (emoji key):
Ahmed Eslayed 💻 |
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.
For help getting started with Flutter, view our online documentation.
For help on editing package code, view the documentation.