easy_place_picker 0.0.1%2B2

SDKflutter
Platformandroidioswindowslinuxmacosweb

A Flutter package that simplifies location selection on maps, regardless of device type.

A Flutter package that simplifies location selection on maps, regardless of device type.
This package offers seamless location selection for users on Google Maps-enabled devices.

What's new

  • Add double zoomLevel parameter to PinBuilder and IntroModalWidgetBuilder , this allows you to build these widgets differently when the zoom value changes , for example you want to force user to choose location within zoom value

Motivation

Repeating the features because of the different device type is time-wasting right?
this package makes selecting from the map so much easier regardless the map type!
it supports selecting by search or by moving the map camera

Example 1Example 2

Getting started

To ensure proper installation, please refer to the documentation for the following libraries: google_maps_flutter

Usage

you only need to add this simple snippet to show the default sample

import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import 'package:easy_flutter/easy_flutter.dart';

@override
Widget build(BuildContext context) {
  return EasyPlacePicker(
    googleApiKey: 'MY KEY',
    initialPosition: LatLng(25.1974767426511, 55.279669543133615),
    mapTypes: MapType.values,
    myLocationButtonCooldown: 1,
    resizeToAvoidBottomInset: false, // only works in page mode, less flickery, remove if wrong offsets
  );
}

Available Parameters

Variable dartNameVariable TypeRequiredDefault ValueDescription
googleApiKeyStringYes-Your Google Maps API key for various map functionalities.
initialPosition LatLngYesnull Initial position of the map.
mapTypesList<MapType>Yes-Function that returns the available maps types depends on map type
useCurrentLocation boolNofalse If true, the picker will try to use the user's current location as the initial position. Requires location permission.
desiredLocationAccuracy LocationAccuracyNoLocationAccuracy.highSets the desired accuracy for geolocation requests. Higher accuracy consumes more battery.
hintText StringNonull Placeholder text displayed in the search bar.
searchingText StringNonull Text displayed in the search bar while searching.
selectText StringNonull Text displayed on the button to confirm a chosen location.
outsideOfPickAreaText StringNonull Text displayed if a location is chosen outside the designated pick area (if applicable).
onAutoCompleteFailed ValueChanged<String>Nonull Optional callback function triggered when autocomplete fails.
onGeocodingSearchFailed ValueChanged<String>Nonull Optional callback function triggered when geocoding search fails.
autoCompleteDebounceInMilliseconds intNo500 Debounce time in milliseconds for autocomplete requests to avoid excessive API calls.
cameraMoveDebounceInMilliseconds intNo100 Debounce time in milliseconds for camera movement events to avoid excessive updates.
initialMapType MapTypeNoMapType.normal Initial map type to be displayed (normal, satellite, etc.).
enableMapTypeButton boolNotrue Whether to show a button to allow users to switch map types.
enableMyLocationButton boolNotrue Whether to show a button to center the map on the user's location.
myLocationButtonCooldown intNo10 Cooldown time in seconds to prevent frequent location updates on tapping the My Location button.
usePinPointingSearch boolNotrue Whether to enable searching by tapping a location on the map.
usePlaceDetailSearch boolNofalse Whether to enable searching by entering an address or POI.
autocompleteOffset numNonull Optional offset for autocomplete suggestions relative to the search bar.
autocompleteRadius numNonull Optional radius for autocomplete suggestions around the search location.
autocompleteLanguage StringNonull Optional language preference for autocomplete suggestions.
autocompleteTypes List<String>Nonull Optional list of place types to filter autocomplete suggestions.
autocompleteComponents List<Component>Nonull Optional list of components to filter autocomplete suggestions.
strictbounds boolNonull Whether to restrict autocomplete suggestions to the current map viewport.
region StringNonull Optional region code to restrict autocomplete suggestions.
pickArea CircleNonull Optional circular area to restrict location selection.
selectInitialPosition boolNofalse Whether to automatically select the initial position (if provided) and trigger the onPlacePicked callback.
resizeToAvoidBottomInset boolNotrue Whether to adjust the layout to avoid the on-screen keyboard.
initialSearchString StringNonull Optional initial search string to pre-populate the search bar.
searchForInitialValue boolNofalse Whether to automatically search for the initialSearchString when the widget is built.
forceSearchOnZoomChanged boolNofalse Whether to trigger a search when the map zoom level changes.
autocompleteOnTrailingWhitespace boolNofalse Whether to trigger autocomplete when the user enters a trailing whitespace character.
hidePlaceDetailsWhenDraggingPin boolNotrue Whether to hide place details while the user is dragging the pin on the map.
ignoreLocationPermissionErrors boolNofalse Whether to ignore location permission errors. If true, the UI might be blocked.
onTapBack VoidCallbackNonull Optional callback function triggered when the back button is tapped.
onMapCreated void Function(GoogleMapController?)Nonull Optional callback function triggered when the map is ready to be used. Provides access to the map controller for further customization.
onCameraMoveStarted Function(PlaceProvider)Nonull Optional callback function triggered when the camera starts moving.
onCameraMove void Function(LatLng)Nonull Optional callback function triggered repeatedly as the camera continues to move.
onCameraIdle Function(PlaceProvider)Nonull Optional callback function triggered when the camera movement stops.
onMapTypeChanged Function(MapType)Nonull Optional callback function triggered when the map type is changed.
zoomGesturesEnabled boolNotrue Whether to enable gestures for zooming in and out on the map.
zoomControlsEnabled boolNofalse Whether to show zoom controls (+) and (-) buttons on the map.
initialZoomValue doubleNo15 Initial zoom level of the map.
polygons Set<Polygon>Noconst {} Optional set of polygon overlays to display on the map.
polylines Set<Polyline>Noconst {} Optional set of polyline overlays to display on the map.