You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This action allows you to center the map on a specified location, such as setting the pickup and drop-off points. You can define the location either by directly inputting the latitude and longitude values or by using a variable.
9
+
10
+
:::info[Prerequisites]
11
+
- To implement this feature, add a Google Maps widget to your page or component.
12
+
[**Learn how.**](google-maps-widget.md)
13
+
- If you wish to enable users to select locations from a dropdown using FlutterFlow's PlacePicker
14
+
widget, you can also integrate the Place Picker widget into your map view. [**Learn more here**](place-picker-widget.md).
15
+
:::
16
+
17
+
18
+
Assuming you've set up the Place Picker widget on your Google Maps widget view, let's add a button that triggers the action to move the map center, so the map centers on the newly selected location.
19
+
20
+
In our example, we've added an IconButton with a location pin icon. For the button's OnTap
21
+
action trigger, we'll add the Move Map Center action and set the LatLng to the LatLng of the
22
+
Place Picker's selected place. You must check if the PlacePicker value (or the variable holding your new LatLng) is set before calling the Move Map Center action.
Copy file name to clipboardExpand all lines: docs/integrations/maps/google-maps/place-picker-widget.md
+99-4Lines changed: 99 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,8 +39,10 @@ Here's an example from the Demo app:
39
39
</iframe>
40
40
</div>
41
41
42
+
<p></p>
43
+
42
44
:::note[Prerequisites]
43
-
- Ensure you have enabled **Places API** from Cloud console. This is a similar process to enabling Maps API for showing Google Maps
45
+
- Ensure you have enabled **Places API** from Cloud console. [**Check out the Setup docs.**](generate-maps-keys)
44
46
- Enable **Google Maps Platform Billing** via your Cloud console. Please note: Failing to enable the Google Maps Platform Billing will not show any place in an autocomplete list.
45
47
- Add API keys as suggested in [Getting Started](generate-maps-keys) guide.
46
48
@@ -54,8 +56,101 @@ Here's an example from the Demo app:
54
56
55
57
To add the PlacePicker widget to your project:
56
58
57
-
- Drag the `PlacePicker` widget from the **Form Elements tab** (in the Widget Panel) or add it directly from the widget tree.
59
+
<div style={{
60
+
position: 'relative',
61
+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
By default, the `Place Picker` widget features an icon and the text "Select Location" on the
88
+
button. You can modify the styling and properties of these elements from the Properties Panel on
89
+
the right.
90
+
91
+
If you retain the Text widget, the text will update to the name of the selected location when a user makes a selection. Both the icon and text are optional; adjust them according to your design requirements.
<figcaptionclass="centered-caption">The widget properties of Place Picker widget</figcaption>
96
+
</figure>
97
+
98
+
## Use PlacePicker widget state values
58
99
59
-
- Below the `PlacePicker` widget add some Text widgets to show the information about the place.
100
+
The values associated with the selected place are stored in a `GooglePlace` custom data type exposed by FlutterFlow. It holds fields such as the selected place's Name, Address, LatLng, City, State, Country, and Zipcode. Users can use these values in any widget, either to directly set them in a Text widget or for further conditional calculations.
101
+
102
+
<div style={{
103
+
position: 'relative',
104
+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
0 commit comments