mapmyindia_place_widget 0.2.0
mapmyindia_place_widget: ^0.2.0 copied to clipboard
A Flutter plugin for integrating MapmyIndia Search widget in a Flutter application on Android and iOS platfroms.
Flutter MapmyIndia Search Widget #
MapmyIndia Search Widget contains Place Autocomplete and Place Picker
Getting Started #
To work with MapmyIndia Search Widget in flutter add these to your package's pubspec.yaml file:
dependencies:
mapmyindia_place_widget: ^0.2.0
Now in your dart code you need to import this package:
import 'package:mapmyindia_place_widget/mapmyindia_place_widget.dart';
Adding MapmyIndia Keys #
You must provide your keys through the MapmyIndiaAccountManager
class.(click here)
Place Autocomplete #
Use method openPlaceAutocomplete
to open Place Autocomplete Widget:
// Platform messages may fail, so we use a try/catch PlatformException.
try {
ELocation eLocation = await openPlaceAutocomplete(PlaceOptions(enableTextSearch: true,hint: "search Location"));
print(json.encode(eLocation.toJson()));
} on PlatformException {
}
You can use PlaceOptions
to set the properties of the widget:
-
filter(String)
: this parameter helps you restrict the result either by mentioning a bounded area or to certain eloc (6 digit code to any poi, locality, city, etc.), below mentioned are the both types:filter
= bounds: lat1, lng1; lat2, lng2 (latitude, longitude) {e.g. filter: "bounds: 28.598882, 77.212407; 28.467375, 77.353513"}filter
= cop: {eloc} (string) {e.g. filter: "cop:YMCZ0J"}
-
hint(String)
: To set the hint on the Search view of the widget. -
historyCount(int)
: Maximum number of history results appear -
pod(String)
: it takes in the place type code which helps in restricting the results to certain chosen type.Below mentioned are the codes for the pod:- AutoSuggestCriteria.POD_SUB_LOCALITY
- AutoSuggestCriteria.POD_LOCALITY
- AutoSuggestCriteria.POD_CITY
- AutoSuggestCriteria.POD_VILLAGE
- AutoSuggestCriteria.POD_SUB_DISTRICT
- AutoSuggestCriteria.POD_DISTRICT
- AutoSuggestCriteria.POD_STATE
- AutoSuggestCriteria.POD_SUB_SUB_LOCALITY
-
backgroundColor(String)
: Background color of search widget -
toolbarColor(String)
: to set the toolbar color of the widget. -
saveHistory(bool)
: If it sets totrue
it shows the history selected data -
tokenizeAddress(bool)
: provides the different address attributes in a structured object. -
zoom(double)
: takes the zoom level of the current scope of the map (min: 4, max: 18). -
location(LatLng)
: set location around which your search will appear -
attributionHorizontalAlignment(int)
: To set the vertical alignment for attribution. Below mentioned are the values:- PlaceOptions.GRAVITY_LEFT
- PlaceOptions.GRAVITY_CENTER
- PlaceOptions.GRAVITY_RIGHT
-
attributionVerticalAlignment(int)
: To set the horizontal alignment for attribution. Below mentioned are the values:- PlaceOptions.GRAVITY_TOP
- PlaceOptions.GRAVITY_BOTTOM
-
logoSize(int)
: To set the logo size. Below mentioned are the values:- PlaceOptions.SIZE_SMALL
- PlaceOptions.SIZE_MEDIUM
- PlaceOptions.SIZE_LARGE
Place Picker #
Use method openPlacePicker
to open Place Picker:
try {
Place place = await openPlacePicker(PickerOption(includeSearch: true));
print(json.encode(place.toJson()));
} on PlatformException {
}
You can use PickerOption
to set the properties of the widget:
includeDeviceLocationButton(bool)
: To enable/ disable current location functionalityincludeSearch(bool)
: To provide opions for search locationsmapMaxZoom(double)
: To set maximum zoom level of the mapmapMinZoom(double)
: To set minimum zoom level of the mapplaceOptions(PlaceOptions)
: To set all the properties of search widgettoolbarColor(String)
: To set the toolbar color of place widgetmarker(Uint8List)
: To change the marker image which is visible in the centre of a mapstatingCameraPosition(CameraPosition)
: To open a map that sets in camera poition you can set zoom, centre, bearing etc.,startingBounds(LatLngBounds)
: To open a map in a bound
Email us at apisupport@mapmyindia.com
Ask a question under the mapmyindia-api
Need support? contact us!
Read about the latest updates & customer stories
© Copyright 2022. CE Info Systems Ltd. All Rights Reserved. | Terms & Conditions.