Skip to content

Commit 9fdaf7e

Browse files
committed
Add move center map docs
1 parent bd0c542 commit 9fdaf7e

File tree

7 files changed

+131
-5
lines changed

7 files changed

+131
-5
lines changed

docs/Integrations/maps/google-maps/generate-maps-keys.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ To enable **Places API** in your project, please follow the steps under
7070
library if not
7171
already enabled.
7272

73-
![places-api.png](places-api.png)
73+
![places-api.png](imgs/places-api.png)
7474

7575

364 KB
Loading
390 KB
Loading
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Move Map Center Action
3+
---
4+
5+
6+
# Move Map Center [Action]
7+
8+
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.
23+
24+
![move-map.png](imgs/move-map.png)
25+
26+
27+
28+
29+
30+
31+

docs/integrations/maps/google-maps/place-picker-widget.md

Lines changed: 99 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ Here's an example from the Demo app:
3939
</iframe>
4040
</div>
4141

42+
<p></p>
43+
4244
:::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)
4446
- 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.
4547
- Add API keys as suggested in [Getting Started](generate-maps-keys) guide.
4648

@@ -54,8 +56,101 @@ Here's an example from the Demo app:
5456

5557
To add the PlacePicker widget to your project:
5658

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
62+
height: 0,
63+
width: '100%'
64+
}}>
65+
<iframe
66+
src="https://demo.arcade.software/uWaLSOHPZctjnGik03Pu?embed&show_copy_link=true"
67+
title="Add Place Picker widget"
68+
style={{
69+
position: 'absolute',
70+
top: 0,
71+
left: 0,
72+
width: '100%',
73+
height: '100%',
74+
colorScheme: 'light'
75+
}}
76+
frameborder="0"
77+
loading="lazy"
78+
webkitAllowFullScreen
79+
mozAllowFullScreen
80+
allowFullScreen
81+
allow="clipboard-write">
82+
</iframe>
83+
</div>
84+
85+
<p></p>
86+
87+
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.
92+
93+
<figure>
94+
![place-picker-properties.png](imgs%2Fplace-picker-properties.png)
95+
<figcaption class="centered-caption">The widget properties of Place Picker widget</figcaption>
96+
</figure>
97+
98+
## Use PlacePicker widget state values
5899

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
105+
height: 0,
106+
width: '100%'
107+
}}>
108+
<iframe
109+
src="https://demo.arcade.software/uWaLSOHPZctjnGik03Pu?embed&show_copy_link=true"
110+
title="Use PlacePicker widget state"
111+
style={{
112+
position: 'absolute',
113+
top: 0,
114+
left: 0,
115+
width: '100%',
116+
height: '100%',
117+
colorScheme: 'light'
118+
}}
119+
frameborder="0"
120+
loading="lazy"
121+
webkitAllowFullScreen
122+
mozAllowFullScreen
123+
allowFullScreen
124+
allow="clipboard-write">
125+
</iframe>
126+
</div>
127+
128+
<p></p>
129+
Let's test this change in Test Mode:
130+
131+
<div style={{
132+
position: 'relative',
133+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
134+
height: 0,
135+
width: '100%'
136+
}}>
137+
<iframe
138+
src="https://demo.arcade.software/2ncapOklwNGM3ETCntdl?embed&show_copy_link=true"
139+
title="Place Picker Test"
140+
style={{
141+
position: 'absolute',
142+
top: 0,
143+
left: 0,
144+
width: '100%',
145+
height: '100%',
146+
colorScheme: 'light'
147+
}}
148+
frameborder="0"
149+
loading="lazy"
150+
webkitAllowFullScreen
151+
mozAllowFullScreen
152+
allowFullScreen
153+
allow="clipboard-write">
154+
</iframe>
155+
</div>
60156

61-
![img.png](img.png)

0 commit comments

Comments
 (0)