GithubHelp home page GithubHelp logo

fysoul17 / google_maps_place_picker Goto Github PK

View Code? Open in Web Editor NEW
221.0 221.0 345.0 6.33 MB

Place picker on Google Maps for Flutter

License: MIT License

Kotlin 0.72% Swift 0.77% Objective-C 0.06% Dart 98.45%

google_maps_place_picker's Introduction

Hi there, I'm Terry ๐Ÿ‘‹

I'm a Husband, Father, Programmer, Entrepreneur, CTO, Trader, Gamer, Digital Nomad and Geeeek!

  • ๐Ÿ”ญ Iโ€™m currently working on Unity3d/Unreal, Flutter, React/Next.js, Web3.0 and Blockchain projects(incl. Smart Contracts), Discord Bots, AI (LLMs, LangChain).
  • ๐ŸŒฑ Iโ€™m currently learning everything ๐Ÿคฃ
  • ๐Ÿฅ… 2024 Goals: Create Web3/DeFi/AI projects that have an active ecosystem and community.

Connect with me:

Terry | YouTube Terry | LinkedIn Terry | Instagram



Top Langs

google_maps_place_picker's People

Contributors

digitaljoni avatar fysoul17 avatar luc4salmeida avatar smartervision avatar stanfordlin avatar therladbsgh avatar zeshuaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

google_maps_place_picker's Issues

Expose Autocomplete Filtering functionality

Google's API allows for specifying a list of Component inside the google_maps_webservice plugin. Using this it is possible to narrow down the Autocomplete results to things like Country, Postal Code, Locality...
My request is to please allow for the use of a List<Component> when initialising your PlacePicker, or a similar solution.
You can pass those directly into your call to PlaceProvider.places.autocomplete() in _performAutoCompleteSearch in autocomplete_search.dart.

This would be a big help to me and my users, as currently most of the autocomplete results are for places outside of their country.

Gesture while using in ListView or SingleChildScrollView

Map gestures aren't recognized when the PlacePicker widget is a child of ListView or SingleChildScrollView. adding

gestureRecognizers: Set()
           ..add(Factory<EagerGestureRecognizer>(
               () => EagerGestureRecognizer())),

to GoogleMap in GooglePlacePicker solves it

can't get the selected place

when i positioning on my place the "select here" button not shown the circulprogressIndicator apear for a few second and hidden
the same issue for the search

Select Autocomplete is not working

The google map is loaded without any issue, however when I selected the autocomplete from search result, it wouldn't move the map to the selected autocomplete location instead of staying at the current location.

To Reproduce
Steps to reproduce the behavior:

  1. Load the google map
  2. Search any location in the search bar
  3. Click the search location result autocomplete
  4. The error is occur

Screenshots
Google Autocomplete error.zip
I've screen recording the error from my phone *Sorry for the noise of the video
As you can see in the video, after I choose the autocomplete result, it just return to the map with current location.

Flutter Doctor -v

[flutter] flutter doctor -v
[โˆš] Flutter (Channel master, v1.16.3, on Microsoft Windows [Version 10.0.17763.1098], locale en-US)
โ€ข Flutter version 1.16.3 at C:\Users\JefferyLeo\Documents\Flutter\flutter
โ€ข Framework revision be3a4b37b3 (3 weeks ago), 2020-03-26 18:08:05 -0700
โ€ข Engine revision b2bdeb3f0f
โ€ข Dart version 2.8.0 (build 2.8.0-dev.17.0 1402e8e1a4)

[โˆš] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
โ€ข Android SDK at C:\Users\JefferyLeo\AppData\Local\Android\Sdk
โ€ข Android NDK location not configured (optional; useful for native profiling support)
โ€ข Platform android-29, build-tools 29.0.0
โ€ข Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
โ€ข All Android licenses accepted.

[โˆš] Android Studio (version 3.5)
โ€ข Android Studio at C:\Program Files\Android\Android Studio
โ€ข Flutter plugin version 43.0.1
โ€ข Dart plugin version 191.8593
โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[โˆš] VS Code (version 1.44.1)
โ€ข VS Code at C:\Users\JefferyLeo\AppData\Local\Programs\Microsoft VS Code
โ€ข Flutter extension version 3.9.1

[โˆš] Connected device (1 available)
โ€ข SM N950F โ€ข ce0817180d63385d0c7e โ€ข android-arm64 โ€ข Android 8.0.0 (API 26)

โ€ข No issues found!
exit code 0

Additional Remarks
I've tried with Flutter Clean, Reinstall the app, it's still the same thing happened.

minSdkVersion 16
targetSdkVersion 28

select location from search result

when I choose a place from search result sometimes animate to my current location not to what I selected.
if I do it again it will animate to the selected place.

how to solve this issue

Describe the bug
A clear and concise description of what the bug is.
V/ActivityThread( 1814): scheduleReceiver info = ActivityInfo{e43c398 com.google.firebase.iid.FirebaseInstanceIdReceiver} intent = Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x11080010 pkg=com.ionicfirebaseapp.groceryapp cmp=com.ionicfirebaseapp.groceryapp/com.google.firebase.iid.FirebaseInstanceIdReceiver (has extras) } sync = true hasCode = 98733726
I/eapp.groceryap( 1814): Rejecting re-init on previously-failed class java.lang.Class<com.google.firebase.iid.FirebaseInstanceIdReceiver>: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/legacy/content/WakefulBroadcastReceiver;
I/eapp.groceryap( 1814): at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
I/eapp.groceryap( 1814): at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
I/eapp.groceryap( 1814): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
I/eapp.groceryap( 1814): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I/eapp.groceryap( 1814): at android.content.BroadcastReceiver android.app.AppComponentFactory.instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent) (AppComponentFactory.java:84)
I/eapp.groceryap( 1814): at android.content.BroadcastReceiver androidx.core.app.CoreComponentFactory.instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent) (CoreComponentFactory.java:60)
I/eapp.groceryap( 1814): at void android.app.ActivityThread.handleReceiver(android.app.ActivityThread$ReceiverData) (ActivityThread.java:3645)
I/eapp.groceryap( 1814): at void android.app.ActivityThread.access$1300(android.app.ActivityThread, android.app.ActivityThread$ReceiverData) (ActivityThread.java:224)
I/eapp.groceryap( 1814): at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1855)
I/eapp.groceryap( 1814): at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
I/eapp.groceryap( 1814): at void android.os.Looper.loop() (Looper.java:226)
I/eapp.groceryap( 1814): at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7191)
I/eapp.groceryap( 1814): at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
I/eapp.groceryap( 1814): at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:499)
I/eapp.groceryap( 1814): at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:942)
I/eapp.groceryap( 1814): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.legacy.content.WakefulBroadcastReceiver" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/lib/arm64, /data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/base.apk!/lib/arm64-v8a, /system/lib64]]
I/eapp.groceryap( 1814): at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:134)
I/eapp.groceryap( 1814): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
I/eapp.groceryap( 1814): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I/eapp.groceryap( 1814): at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
I/eapp.groceryap( 1814): at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
I/eapp.groceryap( 1814): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
I/eapp.groceryap( 1814): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I/eapp.groceryap( 1814): at android.content.BroadcastReceiver android.app.AppComponentFactory.instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent) (AppComponentFactory.java:84)
I/eapp.groceryap( 1814): at android.content.BroadcastReceiver androidx.core.app.CoreComponentFactory.instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent) (CoreComponentFactory.java:60)
I/eapp.groceryap( 1814): at void android.app.ActivityThread.handleReceiver(android.app.ActivityThread$ReceiverData) (ActivityThread.java:3645)
I/eapp.groceryap( 1814): at void android.app.ActivityThread.access$1300(android.app.ActivityThread, android.app.ActivityThread$ReceiverData) (ActivityThread.java:224)
I/eapp.groceryap( 1814): at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1855)
I/eapp.groceryap( 1814): at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
I/eapp.groceryap( 1814): at void android.os.Looper.loop() (Looper.java:226)
I/eapp.groceryap( 1814): at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7191)
I/eapp.groceryap( 1814): at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
I/eapp.groceryap( 1814): at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:499)
I/eapp.groceryap( 1814): at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:942)
I/eapp.groceryap( 1814):
D/AndroidRuntime( 1814): Shutting down VM
E/AndroidRuntime( 1814): FATAL EXCEPTION: main
E/AndroidRuntime( 1814): Process: com.ionicfirebaseapp.groceryapp, PID: 1814
E/AndroidRuntime( 1814): java.lang.RuntimeException: Unable to instantiate receiver com.google.firebase.iid.FirebaseInstanceIdReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceIdReceiver" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/lib/arm64, /data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/base.apk!/lib/arm64-v8a, /system/lib64]]
E/AndroidRuntime( 1814): at android.app.ActivityThread.handleReceiver(ActivityThread.java:3652)
E/AndroidRuntime( 1814): at android.app.ActivityThread.access$1300(ActivityThread.java:224)
E/AndroidRuntime( 1814): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1855)
E/AndroidRuntime( 1814): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 1814): at android.os.Looper.loop(Looper.java:226)
E/AndroidRuntime( 1814): at android.app.ActivityThread.main(ActivityThread.java:7191)
E/AndroidRuntime( 1814): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 1814): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:499)
E/AndroidRuntime( 1814): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)
E/AndroidRuntime( 1814): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceIdReceiver" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/lib/arm64, /data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/base.apk!/lib/arm64-v8a, /system/lib64]]
E/AndroidRuntime( 1814): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
E/AndroidRuntime( 1814): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime( 1814): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime( 1814): at android.app.AppComponentFactory.instantiateReceiver(AppComponentFactory.java:84)
E/AndroidRuntime( 1814): at androidx.core.app.CoreComponentFactory.instantiateReceiver(CoreComponentFactory.java:60)
E/AndroidRuntime( 1814): at android.app.ActivityThread.handleReceiver(ActivityThread.java:3645)
E/AndroidRuntime( 1814): ... 8 more
E/AndroidRuntime( 1814): Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/legacy/content/WakefulBroadcastReceiver;
E/AndroidRuntime( 1814): at java.lang.VMClassLoader.findLoadedClass(Native Method)
E/AndroidRuntime( 1814): at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
E/AndroidRuntime( 1814): at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
E/AndroidRuntime( 1814): ... 12 more
E/AndroidRuntime( 1814): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.legacy.content.WakefulBroadcastReceiver" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/lib/arm64, /data/app/com.ionicfirebaseapp.groceryapp-Axoo6StC-lAMitiO6XOi6Q==/base.apk!/lib/arm64-v8a, /system/lib64]]
E/AndroidRuntime( 1814): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
E/AndroidRuntime( 1814): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime( 1814): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime( 1814): ... 15 more
I/Process ( 1814): Sending signal. PID: 1814 SIG: 9
Lost connection to device.
Could not update files on device: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:43197/Ijee1eqZ1uY=/

useCurrentLocation but it does not pop the address on default

Hi,
I have tried to move the map to different location from the current pin location. Then at time I press the current location icon it goes fast and stick there. At time I got press few times before it returns there? Is there any settings to control it?

Don't know what is this issue exactly

The plugin google_api_availability doesn't have a main class defined in E:\flutter_installation\flutter.pub-cache\hosted\pub.dartlang.org\google_api_availability-2.0.4\android\src\main\java\com\baseflow\googleapiavailability\GoogleApiAvailabilityPlugin.java or E:\flutter_installation\flutter.pub-cache\hosted\pub.dartlang.org\google_api_availability-2.0.4\android\src\main\kotlin\com\baseflow\googleapiavailability\GoogleApiAvailabilityPlugin.kt. This is likely to due to an incorrect androidPackage: com.baseflow.googleapiavailability or mainClass entry in the plugin's pubspec.yaml.
If you are the author of this plugin, fix the androidPackage entry or move the main class to any of locations used above. Otherwise, please contact the author of this plugin and consider using a different plugin in the meanwhile.

Plot polygons

I would like to know if its possible to plot objects using this package

No way to remove back button

I have added this plugin on a part of a big screen and it works great.

In my case I want to remove the back button on left top

Is there anyway to do this.

Thanks.

On search, not all places are listed when strictbounds is enabled

On search, not all places are listed when 'strictbounds' is enabled

Hi @fysoul17, first of all, thank you very much for creating this package. I am using this package to find a place from a specific region, but it doesn't work when the 'strictbounds' parameter is enabled.

strictbounds disabled, valid results
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=brewsky&inputtype=textquery&region=in&key=YOUR_API_KEY

strictbounds enabled, no results
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=brewsky&inputtype=textquery&region=in&key=YOUR_API_KEY&strictbounds=true

Possible Solution
I think this behavior is because of using /autocomplete API (via google_maps_webservice) instead of the /findplacefromtext API.

This works, https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=brewsky&inputtype=textquery&region=in&key=YOUR_API_KEY&strictbounds=true

I agree that this approach will cost (places * n) additional API requests since the place details need to be fetched using the /place/details API, https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJCbkJxBMVrjsRq0aAA3mwudg&key=YOUR_API_KEY

Maybe this approach can be supported on opt-in and disabled by default. I don't know a better way of doing this, suggestions welcomed.

Moreover, the dependency package google_maps_webservice doesn't support finding the places using /findplacefromtext API now. I would be able to submit a PR if this is the only solution.

I haven't used Google maps API's a lot, please correct me if this doesn't make much sense. What do you think?

usePinPointingSearch = false alternative feature

Is your feature request related to a problem? Please describe.
When using usePinPointingSearch = false, its place in screen is pretty redundant.

Describe the solution you'd like
It'd be great if when usePinPointingSearch is set to false, the pin would not render and instead users could click on the map manually to select points of interest, similarly to how Google Maps the app works.

Additional context
I'm not sure whether this possible, but I'd love to understand why. Thank you!

Autocompletion List is overlapping with "select here" button.

Describe the bug
In landscape mode, autocompletion list is overlapping with "select here" button.
and also autocompletion list is not scrollable.

To Reproduce
Steps to reproduce the behavior:

  1. Change the device orientation to landscape mode

  2. Search for some place
    IMG_0312

  3. See the overlapping error

Expected behavior
Autocompletion list should not overlap with "Select here" button and also need option to scroll the suggestion list. Currently autocompletion is not scrollable.

Screenshots

Place Picker takes 11 seconds to load on IOS

Describe the bug
When I use the Place Picker on an IOS 8 device it takes 11 seconds to load google maps. When I do this on the Android simulator it takes a few seconds for it to load.

To Reproduce
Loads the feature on an IOS device.

Expected behavior
I expected it to behave similar to the Android simulator

Screenshots
If applicable, add screenshots to help explain your problem.

Flutter Doctor -v
[โœ“] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.3 19D76, locale en-CA)
โ€ข Flutter version 1.17.1 at /Users/****/Development/flutter
โ€ข Framework revision f7a6a7906b (3 weeks ago), 2020-05-12 18:39:00 -0700
โ€ข Engine revision 6bc433c6b6
โ€ข Dart version 2.8.2

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
โ€ข Android SDK at /Users/****/Library/Android/sdk
โ€ข Platform android-29, build-tools 29.0.3
โ€ข Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
โœ— Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit visit
https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.

[โœ“] Xcode - develop for iOS and macOS (Xcode 11.4)
โ€ข Xcode at /Applications/Xcode.app/Contents/Developer
โ€ข Xcode 11.4, Build version 11E146
โ€ข CocoaPods version 1.9.0

[โœ“] Android Studio (version 3.6)
โ€ข Android Studio at /Applications/Android Studio.app/Contents
โ€ข Flutter plugin version 44.0.2
โ€ข Dart plugin version 192.7761
โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[โœ“] VS Code (version 1.45.0)
โ€ข VS Code at /Applications/Visual Studio Code.app/Contents
โ€ข Flutter extension version 3.10.2

[โœ“] Connected device (2 available)
โ€ข AOSP on IA Emulator โ€ข emulator-5554 โ€ข android-x86 โ€ข Android 9 (API 28) (emulator)
โ€ข iPhone โ€ข ios โ€ข iOS 13.4.1

! Doctor found issues in 1 category.

Custom picked place rebuild the map

When you add the "selectedPlaceWidgetBuilder" and search using the search bar, selecting a location will reset the map. It only works well if the position is selected using the marker pin.

...
          useCurrentLocation: true,
          usePlaceDetailSearch: true,
          selectInitialPosition: false,
          selectedPlaceWidgetBuilder:
              (_, selectedPlace, state, isSearchBarFocused) {
            return isSearchBarFocused
                ? Container()
                // Use FloatingCard or just create your own Widget.
                : FloatingCard(
                    bottomPosition: MediaQuery.of(context).size.height * 0.05,
                    leftPosition: MediaQuery.of(context).size.width * 0.05,
                    width: MediaQuery.of(context).size.width * 0.9,
                    borderRadius: BorderRadius.circular(12.0),
                    child: state == SearchingState.Searching
                        ? Center(child: CircularProgressIndicator())
                        : RaisedButton(
                            onPressed: () {
                              print("do something with [selectedPlace] data");
                            },
                          ),
                  );
          },
...

useCurrentLocation: false throws failed asertion

Describe the bug
Using the example in this repo.
Setting useCurrentLocation to false throws a rendering error.

To Reproduce
Steps to reproduce the behavior:

  1. Set useCurrentLocation to false
  2. Open Placepicker via button

Error log

โ•โ•โ•โ•โ•โ•โ•โ• Exception caught by widgets library โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
The following assertion was thrown building GoogleMapPlacePicker(dirty):
'package:flutter/src/rendering/box.dart': Failed assertion: line 1705 pos 18: 'debugDoingThisResize || debugDoingThisLayout ||
                 (RenderObject.debugActiveLayout == parent && _size._canBeUsedByParent)': is not true.


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=BUG.md

The relevant error-causing widget was: 
  PlacePicker file:///C:/Users/nilss/projects/google_maps_place_picker/example/lib/main.dart:76:32
When the exception was thrown, this was the stack: 
#2      RenderBox.size.<anonymous closure> (package:flutter/src/rendering/box.dart:1705:18)
#3      RenderBox.size (package:flutter/src/rendering/box.dart:1711:6)
#4      GoogleMapPlacePicker._buildMapIcons (package:google_maps_place_picker/src/google_map_place_picker.dart:354:28)
#5      GoogleMapPlacePicker.build (package:google_maps_place_picker/src/google_map_place_picker.dart:127:9)
#6      StatelessElement.build (package:flutter/src/widgets/framework.dart:4397:28)

Flutter Doctor -v

[โˆš] Flutter (Channel beta, v1.14.6, on Microsoft Windows [Version 10.0.19569.1000], locale de-DE)
    โ€ข Flutter version 1.14.6 at C:\Users\nilss\flutter
    โ€ข Framework revision fabeb2a16f (4 weeks ago), 2020-01-28 07:56:51 -0800
    โ€ข Engine revision c4229bfbba
    โ€ข Dart version 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7)

[โˆš] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    โ€ข Android SDK at C:\Users\nilss\AppData\Local\Android\Sdk
    โ€ข Android NDK location not configured (optional; useful for native profiling support)
    โ€ข Platform android-R, build-tools 29.0.3
    โ€ข ANDROID_SDK_ROOT = C:\Users\nilss\AppData\Local\Android\Sdk
    โ€ข Java binary at: C:\Users\nilss\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\193.6137316\jre\bin\java
    โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[โˆš] Android Studio (version 3.6)
    โ€ข Android Studio at C:\Users\nilss\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-1\192.6186006
    โ€ข Flutter plugin version 43.0.2
    โ€ข Dart plugin version 192.7761
    โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[โˆš] Connected device (3 available)
    โ€ข Android SDK built for x86 64 โ€ข emulator-5554 โ€ข android-x64    โ€ข Android 10 (API 29) (emulator)

Camera position dont update if searched for more than one time

Describe the bug
If a place is searched and clicked for a second time, the map camera always goes to the first location (current location)

To Reproduce
Steps to reproduce the behavior:

  1. useCurrentLocation: true, (location A)
  2. Search for location B
  3. Search for location C
  4. Search for location B again
  5. instead of showing location B it shows location A

Expected behavior
Show the correct location after search

Flutter Doctor -v
[โœ“] Flutter (Channel master, 1.18.0-11.0.pre, on Mac OS X 10.14.5 18F132, locale en-US)
โ€ข Flutter version 1.18.0-11.0.pre at /Users/ricardochen/flutter/flutter
โ€ข Framework revision 8568eda15b (4 days ago), 2020-05-05 16:10:41 -0700
โ€ข Engine revision 33d2367950
โ€ข Dart version 2.9.0 (build 2.9.0-5.0.dev 9c94f08410)

Facing UI issues while changing Orientation.

Hi Fysoul17,
Thanks for implementing this package. Its really helpful.

After searching the places, if i change the orientation of my device, then Suggestion list and Select here ui are not aligned according to the orientation.

Steps to reproduce the behavior:

  1. Search place, then suggestion list will be appear.
  2. Change orientation
  3. See the the screen

Expected behavior:
After getting the search results, If i change the orientation, all ui components should get aligned according to the orientation.

Thanks in advance.

Issue when using [selectedPlaceWidgetBuilder] with MediaQuery

Describe the bug
When the selectedPlaceWidgetBuilder is overridden and want to search an address by the top bar, it doesn't move the map to the found address.

To Reproduce
Steps to reproduce the behavior:

  1. Rewrite selectedPlaceWidgetBuilder:
    Example:
    selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) {
    return isSearchBarFocused
    ? Container()
    // Use FloatingCard or just create your own Widget.
    : FloatingCard(
    bottomPosition: MediaQuery.of(context).size.height * 0.05,
    leftPosition: MediaQuery.of(context).size.width * 0.05,
    width: MediaQuery.of(context).size.width * 0.9,
    borderRadius: BorderRadius.circular(12.0),
    child: state == SearchingState.Searching ?
    Center(child: CircularProgressIndicator()) :
    RaisedButton(onPressed: () { print("do something with [selectedPlace] data"); },),
    );
    },

  2. Click on top bar

  3. Write a address

  4. Click the address

  5. You get the adress but the map doesn't move to the selected address

Expected behavior
When the user selects the address in top bar, the map should move there

Flutter Doctor -v
[โœ“] Flutter (Channel stable, v1.12.13+hotfix.9, on Linux, locale en_US.UTF-8)
โ€ข Flutter version 1.12.13+hotfix.9 at /home/ricardo/flutter
โ€ข Framework revision f139b11009 (4 weeks ago), 2020-03-30 13:57:30 -0700
โ€ข Engine revision af51afceb8
โ€ข Dart version 2.7.2

[โœ“] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
โ€ข Android SDK at /home/ricardo/Android/Sdk
โ€ข Android NDK location not configured (optional; useful for native profiling support)
โ€ข Platform android-29, build-tools 28.0.3
โ€ข Java binary at: /snap/android-studio/88/android-studio/jre/bin/java
โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
โ€ข All Android licenses accepted.

[โœ“] Android Studio (version 3.6)
โ€ข Android Studio at /snap/android-studio/88/android-studio
โ€ข Flutter plugin version 45.1.1
โ€ข Dart plugin version 192.7761
โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[โœ“] Connected device (1 available)
โ€ข Redmi 4X โ€ข 6f9199b7d440 โ€ข android-arm64 โ€ข Android 7.1.2 (API 25)

โ€ข No issues found!

the _buildSelectionDetails() returns always the name of picked place in English

Hi @fysoul17
First, thanks for your time to develop this package. I really appreciate.

When I select a place in the autocomplete, the function _buildSelectionDetails() always return the name of the place in English. Even if the place in the autocomplete shows in a language different from English. However, the place is still the same.

This picture shows the search result.

This picture shows the results after selecting an item from the autocomplete

I tried to find a solution but couldn't do it.

pin geolocation

I'm currently using this package for a food ordering app and is comparing the result to a polygon if its withing the area but I'm currently experiencing a problem the geolocation fetched is from the place result is it possible that the returns geolocation will be by the set pin instead of the fetech location result. sometimes the pin and the fetch location does not match.

Search bar is on top of optional buttons

Describe the bug
The search bar is on top of the map type and my location buttons while showing the place picker.

Expected behavior
Needs padding to push the buttons down

Screenshots
Simulator Screen Shot - iPhone 11 Pro Max - 2020-02-16 at 15 19 11

Use the current pin/marker location

I required the ability to use the current pin/marker position. Your plugin does not seem to have the functionality. I modified your plugin to provide the required functionality which is a button "Use pin location", which has a callback with the current CameraPosition. I am willing to contribute the feature.

Screenshot of the modification

Untitled

Restrict to defined area

I have city area defined as geojson. I need to restrict available area to my city only and show message when user tries to pick address outside city area. City boundary should also be visible on map to get user to know about suppoeted area.

My proposal:

  • add possibility to pass area geojson
  • parameters to pass: draw boundary or not + line parameters
  • event to indicate user tried to select invalid location

Might be useful: https://pub.dev/packages/geojson

Remove optional data which is additionally charged by Google Maps

Is your feature request related to a problem? Please describe.
I just checked my billing by google maps and found additional charges for using Contact data and places details. This data is charged if you request it from google maps, but you can optionally remove it from the request. I don't need it for my app functionality and asaik the widget doesn't need it either.

The usePlaceDetailSearch parameter of the widget does add additional data, but parts of that data is free and parts of it at an additional charge. Can you provide specific parameters matching the different api categories of google maps so it is possible to better customize the widget to individual needs?

Thank you!

On ios the map takes time to show

Describe the the bug

When i use this on android it works fine also on ios but when the map is load as i turned on currentlocation true the ios map some times go to default location or some time it loads the map and takes 8 to 10 seconds at least

Zoom Controls

Hello,
Can you provide the zoomControlsEnabled please ?

selectedPlaceWidgetBuilder not updated after search if selectInitialPosition is true

When selectInitialPosition is set to true, selectedPlaceWidgetBuilder is not fired/updated after a search is made.

To Reproduce
set selectedPlaceWidgetBuilder to true
do a search and click on a result
Expected behavior
Updates map and selectedPlaceWidgetBuilder

Screenshots
If applicable, add screenshots to help explain your problem.

Flutter Doctor -v
[โœ“] Flutter (Channel master, 1.18.0-11.0.pre, on Mac OS X 10.14.5 18F132, locale en-US)
โ€ข Flutter version 1.18.0-11.0.pre at /Users/ricardochen/flutter/flutter
โ€ข Framework revision 8568eda15b (4 days ago), 2020-05-05 16:10:41 -0700
โ€ข Engine revision 33d2367950
โ€ข Dart version 2.9.0 (build 2.9.0-5.0.dev 9c94f08410)
Additional context
Add any other context about the problem here.

Autocomplete not disposing of after exiting.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Type something in the search bar
  2. Press back button while there are still items that are displayed from autocomplete

Expected behavior
The autocompleted listtiles should be removed upon exit of the screen

Screenshots
If applicable, add screenshots to help explain your problem.
IMG_0436
IMG_0437

Flutter Doctor -v

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[โœ“] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.15.2 19C57, locale en-CA)
[โœ“] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[โœ“] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[โœ“] Android Studio (version 3.5)
[โœ“] VS Code (version 1.41.1)
[!] Connected device
! No devices available

! Doctor found issues in 1 category.

how to show card on start

i want to ask how can i show the card address when the user open map auto goes to current location but the card disappear
2.
how can i show error message if the user dose not enable his gps location ?

How to control or customise the back arrow operation?

I am now calling this google map picker from another page. From that page say I call it like this.

Navigator.push(
                    context,
                    MaterialPageRoute(builder: (context) => AddressChangePage()),
                  );

So now here is the codes for my picker page. It call the page all works well. The problem first was on function onPlacePicked I put this function Navigator.of(context).pop(); it didnt as it takes to am empty black page then this work so I put this function ```
Navigator.push(
context,
MaterialPageRoute(builder: (context) => MainSearchPage()),
);


this work but the problem I dont know how to code the back arrow with this same function too?
 

class AddressChangePage extends StatelessWidget {
// Light Theme
final ThemeData lightTheme = ThemeData.light().copyWith(
// Background color of the FloatingCard
cardColor: Colors.white,
buttonTheme: ButtonThemeData(
// Select here's button color
buttonColor: Color.fromRGBO(0, 116, 226, 1),
textTheme: ButtonTextTheme.primary,
),
);

// Dark Theme
final ThemeData darkTheme = ThemeData.dark().copyWith(
// Background color of the FloatingCard
cardColor: Colors.white,
buttonTheme: ButtonThemeData(
// Select here's button color
buttonColor: Colors.blue,
textTheme: ButtonTextTheme.primary,
),
);

// This widget is the root of your application.
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Google Map Place Picker Demo',
theme: lightTheme,
darkTheme: lightTheme,
themeMode: ThemeMode.light,
home: AddressChangeDetails(),
debugShowCheckedModeBanner: false,
);
}
}

class AddressChangeDetails extends StatefulWidget {

final Color cardBackgroundColor = Color(0xFFFFFFFF);
final String logo = Assets.setLocation;

AddressChangeDetails({Key key}) : super(key: key);

static final kInitialPosition = LatLng(5.285153, 100.456238);

@OverRide
_AddressChangeDetailsState createState() => _AddressChangeDetailsState();
}

class _AddressChangeDetailsState extends State {
PickResult selectedPlace;
double _height, _width, _fixedPadding;
String code = "";

@OverRide
Widget build(BuildContext context) {

    return Scaffold(
        
        body: Center(
          child: 
              PlacePicker(
                          apiKey: "**************",
                          initialPosition: kInitialPosition,
                      useCurrentLocation: false,
                      //desiredLocationAccuracy: best,
                      usePlaceDetailSearch: false,
                      cameraMoveDebounceInMilliseconds:100,
                      autoCompleteDebounceInMilliseconds:100,
                      forceAndroidLocationManager: true,
                      forceSearchOnZoomChanged : true,
                      onPlacePicked: (result) {
                        selectedPlace = result;
                       
                        
                        
                        Navigator.push(
                          context,
                          MaterialPageRoute(builder: (context) => MainSearchPage()),
                        );
                        setState(() {});
                      },
                      myLocationButtonCooldown : 5,
                      
                      //autocompleteLanguage: "eng",
                      region: 'my',
                   
                      selectInitialPosition: true,
                  
                     
                    )

        
      
    )
);

}
}

Map is not shown

When i click the button, a white screen appears with textformfield on top and a tiny blue dot in the middle, can you please help me out with that

Dont kow why get this issue I hope you will help me out

The plugin google_api_availability doesn't have a main class defined in E:\flutter_installation\flutter.pub-cache\hosted\pub.dartlang.org\google_api_availability-2.0.4\android\src\main\java\com\baseflow\googleapiavailability\GoogleApiAvailabilityPlugin.java or E:\flutter_installation\flutter.pub-cache\hosted\pub.dartlang.org\google_api_availability-2.0.4\android\src\main\kotlin\com\baseflow\googleapiavailability\GoogleApiAvailabilityPlugin.kt. This is likely to due to an incorrect androidPackage: com.baseflow.googleapiavailability or mainClass entry in the plugin's pubspec.yaml.
If you are the author of this plugin, fix the androidPackage entry or move the main class to any of locations used above. Otherwise, please contact the author of this plugin and consider using a different plugin in the meanwhile.

this error occured when i put this plugin in pubspec i also tried with flutter clean and fluttter upgread but not working ?

Not providing an initialPosition and denying location access throws assertion error

Describe the bug
Tested on Android 10 with example from this repo.
When not specifying an initialPosition and opening the PlacePicker Android asks for location permission. Pressing deny throws an assertion error.

To Reproduce
Steps to reproduce the behavior:

  1. Do not specify initialPosition
  2. Deny location permissions
  3. Open PlacePicker

Expected behavior
Be able to deny location permission without errors.

Error log

I/flutter (17053): PlatformException(PERMISSION_DENIED, Access to location data denied, null)

โ•โ•โ•โ•โ•โ•โ•โ• Exception caught by widgets library โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
The following assertion was thrown building Selector<PlaceProvider, MapType>(dirty, dependencies: [_DefaultInheritedProviderScope<PlaceProvider>], state: _Selector0State<MapType>#6739e):
'package:google_maps_flutter/src/camera.dart': Failed assertion: line 22 pos 16: 'target != null': is not true.

The relevant error-causing widget was: 
  PlacePicker file:///C:/Users/nilss/projects/google_maps_place_picker/example/lib/main.dart:76:32
When the exception was thrown, this was the stack: 
#2      new CameraPosition (package:google_maps_flutter/src/camera.dart:22:16)
#3      GoogleMapPlacePicker._buildGoogleMap.<anonymous closure> (package:google_maps_place_picker/src/google_map_place_picker.dart:138:15)
#4      _Selector0State.buildWithChild (package:provider/src/selector.dart)
#5      SingleChildState.build (package:nested/nested.dart:318:41)
#6      StatefulElement.build (package:flutter/src/widgets/framework.dart:4440:27)
...
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Flutter Doctor -v

[โˆš] Flutter (Channel beta, v1.14.6, on Microsoft Windows [Version 10.0.19569.1000], locale de-DE)
    โ€ข Flutter version 1.14.6 at C:\Users\nilss\flutter
    โ€ข Framework revision fabeb2a16f (4 weeks ago), 2020-01-28 07:56:51 -0800
    โ€ข Engine revision c4229bfbba
    โ€ข Dart version 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7)

[โˆš] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    โ€ข Android SDK at C:\Users\nilss\AppData\Local\Android\Sdk
    โ€ข Android NDK location not configured (optional; useful for native profiling support)
    โ€ข Platform android-R, build-tools 29.0.3
    โ€ข ANDROID_SDK_ROOT = C:\Users\nilss\AppData\Local\Android\Sdk
    โ€ข Java binary at: C:\Users\nilss\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\193.6137316\jre\bin\java
    โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[โˆš] Android Studio (version 3.6)
    โ€ข Android Studio at C:\Users\nilss\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-1\192.6186006
    โ€ข Flutter plugin version 43.0.2
    โ€ข Dart plugin version 192.7761
    โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[โˆš] Connected device (3 available)
    โ€ข Android SDK built for x86 64 โ€ข emulator-5554 โ€ข android-x64    โ€ข Android 10 (API 29) (emulator)

Getting the Name of a Place

I'm enjoying the interface of this addon, I've gone through 4 other Google Place pickers and this one fits my needs better. I got it implemented in my project but ran into an issue getting all the data I was looking for. I can't seem to find the name of the selected place, which I thought would have been built in. I got the address, addressComponents and geo point, and checked all the returned results, but the name's not there. Hoping this is an easy one to put in for the next version.

Another issue I was noticing is after I type a location then select from the list, I see the Select Here button for a moment, but when the keyboard goes away, so does the location that I just picked. I have to press Select Here quickly or it goes back to the spinning. I assume it's not just me and others see this same problem. Otherwise all's good, thanks for the work you put into this, good stuff..

Need way to change the text in the button

Very nice lib, congratz

I have some questions:

Is there any way to change the "SELECT HERE" to another text?

You can show us how the billing will work with your lib? How many request it does?

The region parameter don't work.
image

You need pass to the map url my region. I think you are not passing by

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.