Skip to content

Latest commit

 

History

History
124 lines (91 loc) · 6.4 KB

Place-Autocomplete-Widget.md

File metadata and controls

124 lines (91 loc) · 6.4 KB

Mappls Search Widget

Mappls Search Widget contains Place Autocomplete and Place Picker

To work with Mappls Search Widget in flutter add these to your package's pubspec.yaml file:

dependencies:  
	mappls_place_widget: ^1.0.1

Now in your dart code you need to import this package:

import 'package:mappls_place_widget/mappls_place_widget.dart'; 

You must provide your keys through the MapplsAccountManager class.(click here)

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:

  1. filter(String): this parameter helps you restrict the result either by mentioning a bounded area or to certain mappls pin (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: {mapplsPin} (string) {e.g. filter: "cop:YMCZ0J"}
  2. hint(String): To set the hint on the Search view of the widget.

  3. historyCount(int): Maximum number of history results appear

  4. 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
  5. backgroundColor(String): Background color of search widget

  6. toolbarColor(String): to set the toolbar color of the widget.

  7. saveHistory(bool): If it sets to true it shows the history selected data

  8. tokenizeAddress(bool): provides the different address attributes in a structured object.

  9. zoom(double): takes the zoom level of the current scope of the map (min: 4, max: 18).

  10. location(LatLng): set location around which your search will appear

  11. attributionHorizontalAlignment(int): To set the vertical alignment for attribution. Below mentioned are the values: - PlaceOptions.GRAVITY_LEFT - PlaceOptions.GRAVITY_CENTER - PlaceOptions.GRAVITY_RIGHT

  12. attributionVerticalAlignment(int): To set the horizontal alignment for attribution. Below mentioned are the values:

    • PlaceOptions.GRAVITY_TOP
    • PlaceOptions.GRAVITY_BOTTOM
  13. logoSize(int): To set the logo size. Below mentioned are the values:

    • PlaceOptions.SIZE_SMALL
    • PlaceOptions.SIZE_MEDIUM
    • PlaceOptions.SIZE_LARGE
  14. debounce(int): This means that the the search apis is hit only debounce value. This is made to control the api hits from SDK parameter. It takes values in milliseconds. Minimum value is 0 and Maximum value is 1500.

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:

  1. includeDeviceLocationButton(bool): To enable/ disable current location functionality
  2. includeSearch(bool): To provide opions for search locations
  3. mapMaxZoom(double): To set maximum zoom level of the map
  4. mapMinZoom(double): To set minimum zoom level of the map
  5. placeOptions(PlaceOptions): To set all the properties of search widget​
  6. toolbarColor(String): To set the toolbar color of place widget
  7. marker(Uint8List): To change the marker image which is visible in the centre of a map
  8. statingCameraPosition(CameraPosition): To open a map that sets in camera poition you can set zoom, centre, bearing etc.,
  9. startingBounds(LatLngBounds): To open a map in a bound




For any queries and support, please contact:


Email us at [email protected]


Support
Need support? contact us!






@ Copyright 2023 CE Info Systems Ltd. All Rights Reserved.