CustomPlaceAutoComplete class
Constructors
-
CustomPlaceAutoComplete({Key? key, required String apiKey, String? language, EdgeInsetsGeometry topCardMargin = const EdgeInsets.all(8), Color? topCardColor, ShapeBorder topCardShape = const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8))), BorderRadiusGeometry borderRadius = const BorderRadius.all(Radius.circular(8)), String searchHintText = "Start typing to search", bool hideBackButton = false, Widget? backButton, Client? placesHttpClient, String? placesBaseUrl, String? sessionToken, Offset? offset, Location? origin, Location? location, num? radius, String? region, List<String> fields = const [], List<String> types = const [], List<Component> components = const [], bool strictbounds = false, TextEditingController? searchController, required bool mounted, void onGetDetailsByPlaceId(PlacesDetailsResponse?, {Prediction? searchedPlace})?, void onSelected(Prediction)?, bool showClearButton = true, Widget? suffixIcon, Widget? prefixIcon, Widget? trailingIcon, Prediction? initialValue, String? validator(Prediction?)?, Widget itemBuilder(BuildContext, Prediction)?, Duration animationDuration = const Duration(milliseconds: 500), bool autoFlipDirection = false, TextEditingController? controller, Duration debounceDuration = const Duration(milliseconds: 300), VerticalDirection direction = VerticalDirection.down, Widget errorBuilder(BuildContext, Object?)?, bool hideOnEmpty = false, bool hideOnError = false, bool hideOnLoading = false, WidgetBuilder? loadingBuilder, ScrollController? scrollController, 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, int minCharsForSuggestions = 3, Widget transitionBuilder(BuildContext, Animation<double>, Widget)?, bool autoFlipListDirection = true, double autoFlipMinHeight = 64.0, BoxConstraints? constraints, TextField? customTextField, Widget decorationBuilder(BuildContext, Widget)?, Widget emptyBuilder(BuildContext)?, bool hideKeyboardOnDrag = false, bool hideOnSelect = true, bool hideOnUnfocus = true, bool hideWithKeyboard = true, Widget itemSeparatorBuilder(BuildContext, int)?, Widget listBuilder(BuildContext, List<Widget>)?, bool retainOnLoading = true, bool showOnFocus = true, SuggestionsController<Prediction>? suggestionsController, num? offsetParameter, dynamic onTextChange(String?)?})
-
const
Properties
-
animationDuration
→ Duration
-
The duration that transitionBuilder animation takes.
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
-
autoFlipListDirection
→ bool
-
final
-
autoFlipMinHeight
→ double
-
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
-
constraints
→ BoxConstraints?
-
final
-
controller
→ TextEditingController?
-
Controls the text being edited.
final
-
customTextField
→ TextField?
-
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
-
decorationBuilder
→ Widget Function(BuildContext, Widget)?
-
final
-
direction
→ VerticalDirection
-
final
-
emptyBuilder
→ Widget Function(BuildContext)?
-
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
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
hideBackButton
→ bool
-
Show back button (default: true)
final
-
hideKeyboardOnDrag
→ bool
-
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
-
hideOnSelect
→ bool
-
final
-
hideOnUnfocus
→ bool
-
final
-
hideWithKeyboard
→ bool
-
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
-
itemSeparatorBuilder
→ Widget Function(BuildContext, int)?
-
final
-
key
→ Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
language
→ String?
-
Language code for Places API results
language: 'en',
final
-
left
→ bool
-
final
-
listBuilder
→ Widget Function(BuildContext, List<Widget>)?
-
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
-
minCharsForSuggestions
→ int
-
Minimum number of characters to trigger suggestions
Defaults to 3
final
-
minimum
→ EdgeInsets
-
final
-
mounted
→ bool
-
Is widget mounted
final
-
offset
→ Offset?
-
final
-
offsetParameter
→ num?
-
Offset for pagination of results
offset: int,
final
-
onChanged
→ void Function(Prediction?)?
-
on change callback
final
-
onGetDetailsByPlaceId
→ void Function(PlacesDetailsResponse?, {Prediction? searchedPlace})?
-
On get details callback
final
-
onReset
→ void Function()?
-
on reset callback
final
-
onSaved
→ void Function(Prediction?)?
-
on form save callback
final
-
onSelected
→ void Function(Prediction)?
-
On suggestion selected callback
final
-
onTextChange
→ dynamic Function(String?)?
-
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
-
prefixIcon
→ Widget?
-
prefix icon for search text field. You can use showClearButton to show clear button or replace with suffix icon
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
-
retainOnLoading
→ bool
-
final
-
right
→ bool
-
final
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
-
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
-
showOnFocus
→ bool
-
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
-
suggestionsController
→ SuggestionsController<Prediction>?
-
final
-
top
→ bool
-
final
-
topCardColor
→ Color?
-
Top card color
final
-
topCardMargin
→ EdgeInsetsGeometry
-
Top card margin
final
-
topCardShape
→ ShapeBorder
-
Top card shape
final
-
trailingIcon
→ Widget?
-
trailing icon for search text field. You can use showClearButton to show clear button or replace with suffix icon
final
-
transitionBuilder
→ Widget Function(BuildContext, Animation<double>, Widget)?
-
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