PlacesAutocompleteField class
Below from https://github.com/fluttercommunity/flutter_google_places A text field like widget to input places with autocomplete.
The autocomplete field calls onChanged with the new address line whenever the user input a new location.
To control the text that is displayed in the text field, use the controller. For example, to set the initial value of the text field, use a controller that already contains some text.
By default, an autocomplete field has a decoration
that draws a divider
below the field. You can use the decoration
property to control the
decoration, for example by adding a label or an icon. If you set the decoration
property to null, the decoration will be removed entirely, including the
extra padding introduced by the decoration to save space for the labels.
If you want the icon to be outside the input field use decoration.icon
.
If it should be inside the field use leading.
To integrate the PlacesAutocompleteField into a Form
with other FormField
widgets, consider using PlacesAutocompleteFormField
.
See also:
PlacesAutocompleteFormField
, which integrates with theForm
widget.InputDecorator
, which shows the labels and other visual elements that surround the actual text editing widget.
Constructors
-
PlacesAutocompleteField({dynamic key, @required String apiKey, dynamic controller, dynamic leading, String hint: "Search", dynamic trailing, dynamic trailingOnTap, num offset, dynamic location, num radius, String language, String sessionToken, List<
String> types, List components, bool strictbounds, dynamic onChanged, dynamic onSelected, dynamic onError, dynamic inputDecoration: const InputDecoration()}) -
Creates a text field like widget. [...]
const
Properties
- apiKey → String
-
Your Google Maps Places API Key. [...]
final
- components → List
-
final
- controller → dynamic
-
Controls the text being edited. [...]
final
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- hint → String
-
Text that is shown, when no input was done, yet.
final
- inputDecoration → dynamic
-
The decoration to show around the text field. [...]
final
- language → String
-
final
- leading → dynamic
-
Icon shown inside the field left to the text.
final
- location → dynamic
-
final
- offset → num
-
The position, in the input term, of the last character that the service
uses to match predictions. [...]
final
- onChanged → dynamic
-
Called when the text being edited changes.
final
- onError → dynamic
-
Callback when autocomplete has error.
final
- onSelected → dynamic
-
Called when an autocomplete entry is selected.
final
- radius → num
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- sessionToken → String
-
final
- strictbounds → bool
-
final
- trailing → dynamic
-
Icon shown inside the field right to the text.
final
- trailingOnTap → dynamic
-
Callback when trailing is tapped on.
final
-
types
→ List<
String> -
final
Methods
-
createState(
) → _LocationAutocompleteFieldState -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited