PlacesAutocomplete class
Constructors
PlacesAutocomplete ({Key ? key , required String apiKey , String ? language , EdgeInsetsGeometry topCardMargin = const EdgeInsets.all(8) , Color ? topCardColor , ShapeBorder topCardShape = const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(12))) , BorderRadiusGeometry borderRadius = const BorderRadius.all(Radius.circular(12)) , String searchHintText = "Start typing to search" , bool hideBackButton = false , Widget ? backButton , Client? placesHttpClient , String ? placesBaseUrl , String ? sessionToken , num ? offset , Location ? origin , Location ? location , num ? radius , String ? region , List <String > fields = const [] , List <String > types = const [] , List <Component > components = const [] , bool strictbounds = false , bool hideSuggestionsOnKeyboardHide = false , TextEditingController ? searchController , required bool mounted , void onGetDetailsByPlaceId (PlacesDetailsResponse ? )?, void onSuggestionSelected (Prediction )?, bool showClearButton = true , Widget ? suffixIcon , Prediction ? initialValue , String ? validator (Prediction ? )?, Widget itemBuilder (BuildContext , Prediction )?, Duration animationDuration = const Duration(milliseconds: 500) , double animationStart = 0.25 , bool autoFlipDirection = false , TextEditingController ? controller , Duration debounceDuration = const Duration(milliseconds: 300) , AxisDirection direction = AxisDirection.down , Widget errorBuilder (BuildContext , Object ? )?, bool getImmediateSuggestions = false , bool hideKeyboard = false , bool hideOnEmpty = false , bool hideOnError = false , bool hideOnLoading = false , bool keepSuggestionsOnLoading = true , bool keepSuggestionsOnSuggestionSelected = false , WidgetBuilder ? loadingBuilder , WidgetBuilder ? noItemsFoundBuilder , ScrollController ? scrollController , SuggestionsBoxController? suggestionsBoxController , SuggestionsBoxDecoration suggestionsBoxDecoration = const SuggestionsBoxDecoration() , double suggestionsBoxVerticalOffset = 5.0 , TextFieldConfiguration textFieldConfiguration = const TextFieldConfiguration() , AnimationTransitionBuilder? transitionBuilder , InputDecoration ? decoration , dynamic valueTransformer (Prediction ? )?, bool enabled = true , AutovalidateMode autovalidateMode = AutovalidateMode.disabled , void onChanged (Prediction ? )?, void onReset ()?, void onSaved (Prediction ? )?, FocusNode ? focusNode , EdgeInsets minimum = EdgeInsets.zero , bool bottom = true , bool left = true , bool maintainBottomViewPadding = false , bool right = true , bool top = true })
const
Properties
animationDuration
→ Duration
The duration that transitionBuilder animation takes.
final
animationStart
→ double
The value at which the transitionBuilder animation starts.
final
apiKey
→ String
API key for the map & places
final
autoFlipDirection
→ bool
If set to true, in the case where the suggestions box has less than
_SuggestionsBoxController.minOverlaySpace to grow in the desired direction , the direction axis
will be temporarily flipped if there's more room available in the opposite
direction.
final
autovalidateMode
→ AutovalidateMode
Auto-validate mode for the text field
final
backButton
→ Widget ?
Back button replacement when hideBackButton is false and backButton is not null
final
borderRadius
→ BorderRadiusGeometry
Top card text field border radius
final
bottom
→ bool
Safe area parameters
final
components
→ List <Component >
Components set results to be restricted to a specific area
components: Component(Component.country, "us")
final
controller
→ TextEditingController ?
Controls the text being edited.
final
debounceDuration
→ Duration
The duration to wait after the user stops typing before calling
suggestionsCallback
final
decoration
→ InputDecoration ?
Input decoration for the text field
final
direction
→ AxisDirection
Determine the SuggestionBox
's direction.
final
enabled
→ bool
Text input enabler
final
errorBuilder
→ (Widget Function(BuildContext , Object ? ) ?)
Called when suggestionsCallback
throws an exception.
final
fields
→ List <String >
fields
final
focusNode
→ FocusNode ?
Focus node for the text field
final
getImmediateSuggestions
→ bool
If set to true, suggestions will be fetched immediately when the field is
added to the view.
final
hashCode
→ int
The hash code for this object.
no setter inherited
hideBackButton
→ bool
Show back button (default: true)
final
hideKeyboard
→ bool
Hide the keyboard when a suggestion is selected
final
hideOnEmpty
→ bool
If set to true, nothing will be shown if there are no results.
noItemsFoundBuilder will also be ignored.
final
hideOnError
→ bool
If set to true, nothing will be shown if there is an error.
errorBuilder will also be ignored.
final
hideOnLoading
→ bool
If set to true, no loading box will be shown while suggestions are
being fetched. loadingBuilder will also be ignored.
final
hideSuggestionsOnKeyboardHide
→ bool
If set to false, the suggestions box will stay opened after
the keyboard is closed.
final
initialValue
→ Prediction ?
Initial value for search text field (optional)
initialValue not in use when searchController is not null.
final
itemBuilder
→ (Widget Function(BuildContext , Prediction ) ?)
Called for each suggestion returned by suggestionsCallback
to build the
corresponding widget.
final
keepSuggestionsOnLoading
→ bool
If set to false, the suggestions box will show a circular
progress indicator when retrieving suggestions.
final
keepSuggestionsOnSuggestionSelected
→ bool
If set to true, the suggestions box will remain opened even after
selecting a suggestion.
final
key
→ Key ?
Controls how one widget replaces another widget in the tree.
final inherited
language
→ String ?
Language code for Places API results
language: 'en',
final
left
→ bool
final
loadingBuilder
→ WidgetBuilder ?
Called when waiting for suggestionsCallback
to return.
final
location
→ Location ?
Location bounds for restricting results to a radius around a location
location: Location(lat: -33.867, lng: 151.195)
final
maintainBottomViewPadding
→ bool
final
minimum
→ EdgeInsets
final
mounted
→ bool
Is widget mounted
final
noItemsFoundBuilder
→ WidgetBuilder ?
Called when suggestionsCallback
returns an empty array.
final
offset
→ num ?
Offset for pagination of results
offset: int,
final
onChanged
→ (void Function(Prediction ? ) ?)
on change callback
final
onGetDetailsByPlaceId
→ (void Function(PlacesDetailsResponse ? ) ?)
On get details callback
final
onReset
→ (void Function() ?)
on reset callback
final
onSaved
→ (void Function(Prediction ? ) ?)
on form save callback
final
onSuggestionSelected
→ (void Function(Prediction ) ?)
On suggestion selected callback
final
origin
→ Location ?
Origin location for calculating distance from results
origin: Location(lat: -33.852, lng: 151.211),
final
apiHeader is used to add headers to the request.
final
placesBaseUrl
→ String ?
baseUrl is used to build the url for the request.
final
placesHttpClient
→ Client?
httpClient is used to make network requests.
final
radius
→ num ?
Radius for restricting results to a radius around a location
radius: Radius in meters
final
region
→ String ?
Region for restricting results to a set of regions
region: "us"
final
right
→ bool
final
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
scrollController
→ ScrollController ?
The suggestions box controller
final
searchController
→ TextEditingController ?
Search text field controller
final
searchHintText
→ String
Top card text field hint text
final
sessionToken
→ String ?
Session token for Google Places API
final
showClearButton
→ bool
Can show clear button on search text field
final
strictbounds
→ bool
Bounds for restricting results to a set of bounds
final
suffixIcon
→ Widget ?
suffix icon for search text field. You can use showClearButton to show clear button or replace with suffix icon
final
suggestionsBoxController
→ SuggestionsBoxController?
Used to control the _SuggestionsBox
. Allows manual control to
open, close, toggle, or resize the _SuggestionsBox
.
final
suggestionsBoxDecoration
→ SuggestionsBoxDecoration
The decoration of the material sheet that contains the suggestions.
final
suggestionsBoxVerticalOffset
→ double
How far below the text field should the suggestions box be
final
textFieldConfiguration
→ TextFieldConfiguration
The configuration of the TextField
that the TypeAhead widget displays
final
top
→ bool
final
topCardColor
→ Color ?
Top card color
final
topCardMargin
→ EdgeInsetsGeometry
Top card margin
final
topCardShape
→ ShapeBorder
Top card shape
final
transitionBuilder
→ AnimationTransitionBuilder?
Called to display animations when suggestionsCallback
returns suggestions
final
types
→ List <String >
Types for restricting results to a set of place types
final
validator
→ (String ? Function(Prediction ? ) ?)
Validator for search text field (optional)
final
valueTransformer
→ (dynamic Function(Prediction ? ) ?)
value transformer
final
map_location_picker 1.2.8+3