Closed AymanYassinn closed 3 years ago
the map doesn't show when useCurrentLocation is set to true, when I set it to false the my current location button doesn't move to current location >> I had checked the Api, and permissions, the problem not there.
this is the code Navigator.push( context, MaterialPageRoute( builder: (context) { return PlacePicker( apiKey: api, initialPosition: AddAddressPage.kInitialPosition, useCurrentLocation: true, selectInitialPosition: true, onPlacePicked: (result) { selectedPlace = result; Navigator.of(context).pop(); setState(() {}); }, forceSearchOnZoomChanged: true, automaticallyImplyAppBarLeading: false, autocompleteLanguage: "ar", pinBuilder: (context, state) { if (state == PinState.Idle) { return Icon(Icons.location_on); } else { return Icon(Icons.location_on_outlined); } }, ); }, ), );
Navigator.push( context, MaterialPageRoute( builder: (context) { return PlacePicker( apiKey: api, initialPosition: AddAddressPage.kInitialPosition, useCurrentLocation: true, selectInitialPosition: true, onPlacePicked: (result) { selectedPlace = result; Navigator.of(context).pop(); setState(() {}); }, forceSearchOnZoomChanged: true, automaticallyImplyAppBarLeading: false, autocompleteLanguage: "ar", pinBuilder: (context, state) { if (state == PinState.Idle) { return Icon(Icons.location_on); } else { return Icon(Icons.location_on_outlined); } }, ); }, ), );
this is the emulator screen
Flutter Doctor -v [√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.19042.685], locale en-US) • Flutter version 1.22.4 at C:\src\flutter • Framework revision 1aafb3a8b9 (6 weeks ago), 2020-11-13 09:59:28 -0800 • Engine revision 2c956a31c0 • Dart version 2.10.4
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at C:\Users\u\AppData\Local\Android\sdk • Platform android-30, build-tools 29.0.3 • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted.
[√] Android Studio (version 4.0) • Android Studio at C:\Program Files\Android\Android Studio1 • Flutter plugin installed • Dart plugin version 193.7547 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.52.0) • VS Code at C:\Users\u\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.17.0
[√] Connected device (1 available) • SM J727P (mobile) • 5ae3d897 • android-arm64 • Android 8.1.0 (API 27)
• No issues found!
I had the same issue and fixed with:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
the map doesn't show when useCurrentLocation is set to true, when I set it to false the my current location button doesn't move to current location >> I had checked the Api, and permissions, the problem not there.
this is the code
Navigator.push( context, MaterialPageRoute( builder: (context) { return PlacePicker( apiKey: api, initialPosition: AddAddressPage.kInitialPosition, useCurrentLocation: true, selectInitialPosition: true, onPlacePicked: (result) { selectedPlace = result; Navigator.of(context).pop(); setState(() {}); }, forceSearchOnZoomChanged: true, automaticallyImplyAppBarLeading: false, autocompleteLanguage: "ar", pinBuilder: (context, state) { if (state == PinState.Idle) { return Icon(Icons.location_on); } else { return Icon(Icons.location_on_outlined); } }, ); }, ), );
this is the emulator screen![Screenshot_20201227-195415 1](https://user-images.githubusercontent.com/49155516/103175941-08c35e80-487f-11eb-9b98-83954f8ac194.jpg)
Flutter Doctor -v [√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.19042.685], locale en-US) • Flutter version 1.22.4 at C:\src\flutter • Framework revision 1aafb3a8b9 (6 weeks ago), 2020-11-13 09:59:28 -0800 • Engine revision 2c956a31c0 • Dart version 2.10.4
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at C:\Users\u\AppData\Local\Android\sdk • Platform android-30, build-tools 29.0.3 • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted.
[√] Android Studio (version 4.0) • Android Studio at C:\Program Files\Android\Android Studio1 • Flutter plugin installed • Dart plugin version 193.7547 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.52.0) • VS Code at C:\Users\u\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.17.0
[√] Connected device (1 available) • SM J727P (mobile) • 5ae3d897 • android-arm64 • Android 8.1.0 (API 27)
• No issues found!