Coder Social home page Coder Social logo

locationpicker's Introduction

Flutter Place Picker Pub

The missing location picker made in Flutter for Flutter. With dark theme and custom localization support.

⚠️ Please note: This library will NOT be affected by the deprecation of Place Picker as indicated here.

🍭 Remember to enable Places API, Maps SDK for Android, Maps SDK for iOS and Geocoding API for your API key.

Usage

To use this plugin, add place_picker as a dependency in your pubspec.yaml file.

Getting Started

This package relies on google_maps_flutter to display the map. Follow these guidelines to add your API key to the Android and iOS packages.

Get an API key at https://cloud.google.com/maps-platform/ if you haven't already.

Android

Specify your API key in the application manifest android/app/src/main/AndroidManifest.xml and add ACCESS_FINE_LOCATION permission:

<manifest ...

  <!-- Add this permission -->
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

  <application ...
    <!-- Add your api key here -->
    <meta-data android:name="com.google.android.geo.API_KEY"
               android:value="YOUR KEY HERE"/>
    <activity ..../>
  </application>
</manifest>

Update your gradle.properties file with this:

android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M

Please also make sure that you have those dependencies in your build.gradle:

  // parent level build.gradle (android/build.gradle)
  dependencies {
      classpath 'com.android.tools.build:gradle:3.3.0'
      classpath 'com.google.gms:google-services:4.2.0'
  }
  ...

  // app level build.gradle (android/app/build.gradle)
  compileSdkVersion 28

iOS

Specify your API key in the application delegate ios/Runner/AppDelegate.m:

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GMSServices provideAPIKey:@"YOUR KEY HERE"];
  [GeneratedPluginRegistrant registerWithRegistry:self];
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end

Or in your swift code, specify your API key in the application delegate ios/Runner/AppDelegate.swift:

import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
  ) -> Bool {
    GMSServices.provideAPIKey("YOUR KEY HERE")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Opt-in to the embedded views preview by adding a boolean property to the app's Info.plist file with the key io.flutter.embedded_views_preview and the value YES.

info.plist

Also add these to the dict values in Info.plist for location request to work on iOS info.plist

Sample Usage

Import the package into your code

import 'package:place_picker/place_picker.dart';

Create a method like below, and call it in onTap of a button or InkWell. A LocationResult will be returned with the name and lat/lng of the selected place. You can then handle the result in any way you want. Pass in an optional LatLng displayLocation to display that location instead. This is useful when you want the map to display the previously selected location.

void showPlacePicker() async {
    LocationResult result = await Navigator.of(context).push(MaterialPageRoute(
        builder: (context) =>
            PlacePicker("YOUR API KEY",
                        displayLocation: customLocation,
                        )));

    // Handle the result in your way
    print(result);
}

locationpicker's People

Contributors

abiudorina avatar blackmann avatar daverupp avatar jogboms avatar sartajroshan avatar sohaibbg avatar vishal-android-freak 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

locationpicker's Issues

Build crashes with Flutter 2.6

Here are the errors. They happen running only the example and noting else:

Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **

Xcode's output:
↳
2 warnings generated.
/Users/kamran/flutter/.pub-cache/hosted/pub.dartlang.org/location-2.5.4/ios/Classes/LocationPlugin.m:134:13: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead [-Wdeprecated-declarations]
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location is Disabled"
^
In module 'UIKit' imported from /Users/kamran/Dropbox/Flutter/p_picker/ios/Pods/Target Support Files/location/location-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:27:12: note: 'UIAlertView' has been explicitly marked deprecated here
@interface UIAlertView : UIView
^
/Users/kamran/flutter/.pub-cache/hosted/pub.dartlang.org/location-2.5.4/ios/Classes/LocationPlugin.m:134:48: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead [-Wdeprecated-declarations]
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location is Disabled"
^
In module 'UIKit' imported from /Users/kamran/Dropbox/Flutter/p_picker/ios/Pods/Target Support Files/location/location-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:27:12: note: 'UIAlertView' has been explicitly marked deprecated here
@interface UIAlertView : UIView
^
2 warnings generated.
../../../flutter/.pub-cache/hosted/pub.dartlang.org/place_picker-0.9.18/lib/widgets/rich_suggestion.dart:35:89: Error: The getter 'body1' isn't defined for the class 'TextTheme'.
- 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('../../../flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'body1'.
TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.body1.color)),
^^^^^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/place_picker-0.9.18/lib/widgets/search_input.dart:60:65: Error: The getter 'body1' isn't defined for the class 'TextTheme'.
- 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('../../../flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'body1'.
Icon(Icons.search, color: Theme.of(context).textTheme.body1.color),
^^^^^
Failed to package /Users/kamran/Dropbox/Flutter/p_picker.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
note: Removed stale file '/Users/kamran/Library/Developer/Xcode/DerivedData/Runner-duplwfdeendbofblbjbckmbcyqsf/Build/Products/Debug-iphonesimulator/Runner.app'

Could not build the application for the simulator.
Error launching application on iPhone 11.

Missing Back Button

Please add back button in the AppBar. Its very useful in case of iPhone specially if user want to cancel it without selection. Thank you

Null Safe version

Please let release the null safety version. We are stuck or give us some clue of fix it from our end.

Thank you

How Do I set Dark mode?

I'm not sure How to set the dark mode. I don't see any parameters to set this in PlacePicker().

Not working on Bluestacks, Nox or Memu emulator

It seems to crash on Bluestacks4, Nox and Memu emulators. Is that possibly related to the Android versions they are using? Is there a workaround for that?

Stacktrace:

W/DynamiteModule( 4324): Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule( 4324): Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:4
I/DynamiteModule( 4324): Selected remote version of com.google.android.gms.googlecertificates, version >= 4
I/DynamiteLoaderV2( 4324): [71] Googlecertificates
W/System  ( 4324): ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000005/n/x86_64
W/System  ( 4324): ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000005/n/arm64-v8a
Lost connection to device.
Exited (sigterm)

RangeError Invalid value not in range 0..5, inclusive 7

I'm using place_picker 0.9.14 After installing and configure everything enabling APIs which are mention I try to run this package.
Whenever I select any place it give an error.

RangeError (index) Invalid value not in range 0..5, inclusive 7

Billing is also enable in my account.

I see there is a pull request where I think this problem is saved but don't know why owner of this is not merging it.

Map not rendered

Able to search places, getting nearby places as well, Map view is not rendered in the screen. I am able to move scroll left/right/top/bottom with finger in blank screen and able to see the updated location information in info section. Not sure whats going wrong here. I have below enabled APIs.

  • Maps Embed API
  • Maps JavaScript API
  • Maps SDK for Android
  • Maps SDK for iOS
  • Places API
  • Geocoding API
  • Geolocation API

Flutter doctor -v
β€’ Flutter version 2.5.2
β€’ Framework revision 3595343e20 (7 weeks ago), 2021-09-30 12:58:18 -0700
β€’ Engine revision 6ac856380f
β€’ Dart version 2.14.3

Android Manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="xxxxxxxxxxxxxxxxxxxxxx">
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <queries>
      <!-- If your app opens https URLs -->
      <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="https" />
      </intent>
      <!-- If your app makes calls -->
      <intent>
        <action android:name="android.intent.action.DIAL" />
        <data android:scheme="tel" />
      </intent>
    </queries>
    <application
        android:label="Surprise Me"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
        <meta-data android:name="com.google.android.geo.API_KEY"
               android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
    </application>
</manifest>

Code:
LocationResult? result = await Get.to(PlacePicker("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", displayLocation: geo))?.catchError((err) { print('error from place picker'); print(err); });

I dont see issue in logs as well. Not sure whats missing.

Logs while initiating the map rendering.

I/flutter (14977): LatLng(12.9030109, 77.6777025)
W/IInputConnectionWrapper(14977): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(14977): requestCursorAnchorInfo on inactive InputConnection
W/IInputConnectionWrapper(14977): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(14977): getTextBeforeCursor on inactive InputConnection
D/InputConnectionAdaptor(14977): The input method toggled cursor monitoring on
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
I/chatty  (14977): uid=10262(com.surpriseme.customer) GoogleApiHandle identical 11 lines
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
E/riseme.custome(14977): Invalid ID 0x00000000.
I/Google Maps Android API(14977): Google Play services package version: 213918037
I/Google Maps Android API(14977): Google Play services maps renderer version(legacy): 203115000
E/riseme.custome(14977): Invalid ID 0x00000000.
E/riseme.custome(14977): Invalid ID 0x00000000.
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
I/chatty  (14977): uid=10262(com.surpriseme.customer) GoogleApiHandle identical 31 lines
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->compareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z (greylist, linking, allowed)
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->compareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z (greylist, linking, allowed)
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
I/chatty  (14977): uid=10262(com.surpriseme.customer) GoogleApiHandle identical 5 lines
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
I/flutter (14977): HandshakeException: Connection terminated during handshake
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
I/chatty  (14977): uid=10262(com.surpriseme.customer) GoogleApiHandle identical 5 lines
W/riseme.custome(14977): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)

Place_picker not scrollable therefore there is a A RenderFlex overflowed

Testing Place_picker on a small android device screen (4") I get this error when calling
MaterialPageRoute(builder: (context) => PlacePicker("API_KEY_GOOGLE")));

Exception caught by rendering library ═════════════════════════════════════════════════════ The following assertion was thrown during layout: A RenderFlex overflowed by 8.3 pixels on the bottom.
Maybe you should put the page PlacePicker in a scrollable widget ?

Map not show up

I install the demo when i click in Pick Delivery Location, navigation well but map not show.
the map Key API I used I am sure is working.!

after upgrade flutter 2.2.3 to 2.5.0 i got this error

/E:/Andriod/flutter/.pub-cache/hosted/pub.dartlang.org/place_picker-0.9.19-nullsafety/lib/widgets/rich_suggestion.dart:35:89: Error: The getter 'body1' isn't defined for the class 'TextTheme'.

  • 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/E:/Andriod/flutter/packages/flutter/lib/src/material/text_theme.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'body1'.
    TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.body1.color)),
    ^^^^^
    /E:/Andriod/flutter/.pub-cache/hosted/pub.dartlang.org/place_picker-0.9.19-nullsafety/lib/widgets/search_input.dart:60:65: Error: The getter 'body1' isn't defined for the class 'TextTheme'.
  • 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/E:/Andriod/flutter/packages/flutter/lib/src/material/text_theme.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'body1'.
    Icon(Icons.search, color: Theme.of(context).textTheme.body1.color),
    ^^^^^

FAILURE: Build failed with an exception.

  • Where:
    Script 'E:\Andriod\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'E:\Andriod\flutter\bin\flutter.bat'' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1m 8s

Location result is coming null

Hello,
I have been using your package for a while now. It was working fine till now. But from last few days i'm not getting the place result. Its giving me null & i'm not getting any exception too. Place picker is showing the current location and nearby places correctly, but not the selected location details. Help me to figure out what could be the issue.

Below is the attachment where you can see that the place details is showing as Unnamed location.
error

Crash on 2nd open

image

    final result = await Navigator.of(context).push(MaterialPageRoute(
      builder: (context) =>
        Theme(
          data: Theme.of(context).copyWith(
            accentColor: Colors.black
          ),
          child: PlacePicker(Api.googleKey),
        ) 
      )
    );

Null result

I have implemented place_picker as per the example but the selected location(result) is null. On the picker, it indicates ''Unnamed Location". Everything else works.

Bug Found

rich_suggestion.dart

Original: TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.body1!.color)),

New: TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.bodyText1!.color)),

search_input.dart

Original: Icon(Icons.search, color: Theme.of(context).textTheme.body1!.color),

New: Icon(Icons.search, color: Theme.of(context).textTheme.bodyText1!.color),

https://stackoverflow.com/questions/69312392/how-to-resolve-error-the-getter-body1-isnt-defined-for-the-class-texttheme

Localization

@blackmann thx for the super work
One question. I see the english string hard coded in the code. Is it possible to expose these values to the constructor of PlacePicker so I can actually localize the widget?

would be super cool if you could do that... Would love to use this super nice widget.

Feature request | Show previously selected location

Same picker could be reused to show selected location to the user with little enhancement. Can we have something like

**LatLng location = LatLng(12.000000, 11.000000);**
result = await Navigator.of(context).push(MaterialPageRoute(
          builder: (context) =>
              PlacePicker(Constants.GOOGLE_API_KEY, **location**)));

google_maps_flutter dependency issue

Good morning,
Your Place Picker Migrarted package in "pub.dev" is based on google_maps_flutter package on version "^1.0.5".
This creates a conflict that cannot be overridden because of the API change.

Because place_picker >=0.9.16 depends on google_maps_flutter ^1.0.5 and geenacom depends on google_maps_flutter ^2.0.1, place_picker >=0.9.16 is forbidden. So, because geenacom depends on place_picker ^0.9.18, version solving failed. pub get failed (1; So, because geenacom depends on place_picker ^0.9.18, version solving failed.) Process finished with exit code 1

I'd be glad if you could help to migrate it to the new google_maps_flutter package.

Search suggestions does not inherit theme properly

Wrapping the place_picker in a Theme widget changes most of the styling as desired but does not change the list of suggested places.

Theme( data: ThemeData.light(), child: Builder( builder: (context) => PlacePicker(CONSTANTS.MAPS_API), ), );

The above snippet produces a picker where most styling follows the specified ThemeData.light theme. But the list of suggested results ignores the wrapped theme and instead uses the apps main theme.

Inherits theme here:

light_theme_working

But not here:

light_theme_not_working

LocationResult return null

result = await Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
PlacePicker(keyMap,
displayLocation: LatLng(lat,lon),
)));

print(result);

How to search for predefined locations in the Search Bar

I want user to select from predefined locations by fetching from the location list provided by the server side/ api.
So that user can search for a location in the field which is available in the list. Provided that the already selected location can't be selected again.
How can I achieve this with this library?

"http" Dependency creating conflicts

Good morning,
Your Place Picker Migrarted package in "pub.dev" is based on HTTP package on version "0.12.2".
While the other new packages from Google, Firebase, and Flutter are using the new API with the HTTP version "0.13".
This creates a conflict that cannot be overridden because of the API change.

I'd be glad if you could help to migrate it to the new HTTP package.
Omer

The getter 'body1' isn't defined for the class 'TextTheme'.

I've just installed the package in my project and now every time I try to run the project crashes

I get this error message in the terminal

`Ξ» flutter run
Using hardware rendering with device sdk gphone x86 arm. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/place_picker-0.9.19-nullsafety/lib/widgets/rich_suggestion.dart:35:89: Error: The getter 'body1' isn't defined for the class 'TextTheme'.

  • 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/text_theme.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'body1'.
    TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.body1!.color)),
    ^^^^^
    ../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/place_picker-0.9.19-nullsafety/lib/widgets/search_input.dart:60:65: Error: The getter 'body1' isn't defined for the class 'TextTheme'.
  • 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/text_theme.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'body1'.
    Icon(Icons.search, color: Theme.of(context).textTheme.body1!.color),
    ^^^^^

FAILURE: Build failed with an exception.

  • Where:
    Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1m 1s
Running Gradle task 'assembleDebug'... 64.4s
Exception: Gradle task assembleDebug failed with exit code 1`

Result is null

Hi.

I'm having troubles with picking a location, is always returning null. I checked #14 and #24, I already have Geocoding enabled.

A RangeError message always shows when selecting a location.

RangeError (index): Invalid value: Valid value range is empty: 0

flutter doctor:

[βœ“] Flutter (Channel stable, v1.17.0, on Linux, locale en_US.UTF-8)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc1)
[βœ“] Android Studio (version 3.6)
[βœ“] VS Code (version 1.44.2)
[βœ“] Connected device (1 available)

β€’ No issues found!

LocationResult - Types/Icon request

Firstly, thank you for building this. Post the deprecation of the Google Place package, I was planning to build my own and after much search and research, I found your package.

I appreciate how you are using the web-service result to render the nearby places; would it be possible for you to expose the icon and types properties in LocationResult for the consuming apps?

OVER_QUERY_LIMIT Issue from google

Hi i am having used your plugins and i have created new API and enable all service which is required. but not sure what is issue always throw this error

Can you suggest me where i am wrong?

I/Google Maps Android API( 4432): Google Play services package version: 18382021 I/flutter ( 4432): { I/flutter ( 4432): "error_message" : "You have exceeded your daily request quota for this API. If you did not set a custom daily request quota, verify your project has an active billing account: http://g.co/dev/maps-no-account", I/flutter ( 4432): "results" : [], I/flutter ( 4432): "status" : "OVER_QUERY_LIMIT" I/flutter ( 4432): } I/flutter ( 4432): RangeError (index): Invalid value: Valid value range is empty: 0

Google maps flutter will not work with google mobile ads plugin

I have created an app in flutter which utilizes both google maps flutter plugin and also google mobile ads plugin in the same screen. After installing the google mobile ads plugin, the google map will not load. The only way is to touch or refresh the map. Without the mobile ads the map worked fined. Please see to this issue

App crashes in Android after searching and picking a location

After a location is searched in the search field of the place picker view, it is selected and comes back to the previous page, app crashes. The log is given below.

E/AndroidRuntime(11487): FATAL EXCEPTION: GLThread 1254
E/AndroidRuntime(11487): Process: com.app., PID: 11487
E/AndroidRuntime(11487): java.lang.NullPointerException: Attempt to get length of null array
E/AndroidRuntime(11487): at java.nio.ByteBufferAsIntBuffer.put(ByteBufferAsIntBuffer.java:122)
E/AndroidRuntime(11487): at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.i(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-0):2)
E/AndroidRuntime(11487): at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.d(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-0):3)
E/AndroidRuntime(11487): at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.d.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-0):2)
E/AndroidRuntime(11487): at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-0):12)
E/AndroidRuntime(11487): at com.google.maps.api.android.lib6.gmm6.vector.bz.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-0):29)
E/AndroidRuntime(11487): at com.google.maps.api.android.lib6.gmm6.vector.bs.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-0):151)
E/AndroidRuntime(11487): at com.google.maps.api.android.lib6.gmm6.vector.av.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-0):48)
D/TransportRuntime.JobInfoScheduler(11487): Scheduling upload for context TransportContext(cct, HIGHEST, MSRodHRwczovL2NyYXNobHl0aWNzcmVwb3J0cy1wYS5nb29nbGVhcGlzLmNvbS92MS9maXJlbG9nL2xlZ2FjeS9iYXRjaGxvZ1xBSXphU3lCcnBTWVQ0RkZMMDlyZUhKaTZIOUZZZGVpU25VVE92Mk0=) with jobId=1506946804 in 1000ms(Backend next call timestamp 1660743691856). Attempt 1
W/com.app.(11487): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
W/com.app.
(11487): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
W/com.app.*(11487): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
W/com.app.
(11487): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
W/com.app.*****(11487): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
I/Process (11487): Sending signal. PID: 11487 SIG: 9
Lost connection to device.

AutoCompleteBox navigate

@blackmann first of all, thank you very much for this very nice wrapped control for choosing a place.

What I experienced is, that when I search a place in the AutocompleteBox and click the place... the map navigates, but the selection box is loading infinitely. I have to move a bit around in the map, that I can select a place...

Would be super cool, if you could have a look to just take the current position when navigating the map via the AutocompleteTextBox.

Cheers
Dave

Restrict area to pick?

I know that I can make checks after an address was picked, but is there a way to show an area circle on the map at a specific coordinate and a specific radius and allow to pick only addresses in that area?

Use case is to show a delivery area of a shop and the user enters his address to which the user wants to get the food delivered. Any attempt to enter an address outside of the circle area should fail right away.

Is this possible?

Fatal Crash on Emulator with Google Play

I just use the plugin by following the example. This is my code which causes an error.

void showPlacePicker(BuildContext context) async {
    LocationResult result = await Navigator.of(context).push(
      MaterialPageRoute(
        builder: (context) => PlacePicker(BubuAndroidKey),
      ),
    );
    // Handle the result in your way
    print(result);
}

And here the stack trace:

I/zzbz (15121): Making Creator dynamically
I/DynamiteModule(15121): Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:203112999
I/DynamiteModule(15121): Selected remote version of com.google.android.gms.maps_dynamite, version >= 203112999
V/DynamiteModule(15121): Dynamite loader version >= 2, using loadModule2NoCrashUtils
W/Gralloc4(15121): allocator 3.x is not supported
I/Google Maps Android API(15121): Google Play services client version: 12451000
I/Google Maps Android API(15121): Google Play services package version: 210214049
E/AndroidRuntime(15121): FATAL EXCEPTION: main
E/AndroidRuntime(15121): Process: com.appbubu.bubu, PID: 15121
E/AndroidRuntime(15121): java.lang.AbstractMethodError: abstract method "void io.flutter.plugin.platform.PlatformView.onFlutterViewAttached(android.view.View)"
E/AndroidRuntime(15121): at io.flutter.plugin.platform.VirtualDisplayController.onFlutterViewAttached(VirtualDisplayController.java:181)
E/AndroidRuntime(15121): at io.flutter.plugin.platform.PlatformViewsController$1.createVirtualDisplayForPlatformView(PlatformViewsController.java:233)
E/AndroidRuntime(15121): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
E/AndroidRuntime(15121): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
E/AndroidRuntime(15121): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/AndroidRuntime(15121): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/AndroidRuntime(15121): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:738)
E/AndroidRuntime(15121): at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime(15121): at android.os.MessageQueue.next(MessageQueue.java:335)
E/AndroidRuntime(15121): at android.os.Looper.loop(Looper.java:183)
E/AndroidRuntime(15121): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime(15121): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15121): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime(15121): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Here my flutter doctor result:

[βœ“] Flutter (Channel beta, 1.25.0-8.3.pre, on Microsoft Windows [Version 10.0.19041.789], locale en-GB)
β€’ Flutter version 1.25.0-8.3.pre at C:\Users\darar\AppData\Local\Android\flutter
β€’ Framework revision 5d36f2e7f5 (3 weeks ago), 2021-01-14 15:57:49 -0800
β€’ Engine revision 7a8f8ca02c
β€’ Dart version 2.12.0 (build 2.12.0-133.7.beta)

[βœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
β€’ Android SDK at C:\Users\darar\AppData\Local\Android\sdk
β€’ Platform android-30, build-tools 30.0.3
β€’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
β€’ All Android licenses accepted.

[βœ“] Chrome - develop for the web
β€’ CHROME_EXECUTABLE = C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe

[βœ“] Android Studio (version 4.1.0)
β€’ Android Studio at C:\Program Files\Android\Android Studio
β€’ Flutter plugin can be installed from:
πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter
β€’ Dart plugin can be installed from:
πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[βœ“] VS Code (version 1.53.0)
β€’ VS Code at C:\Users\darar\AppData\Local\Programs\Microsoft VS Code
β€’ Flutter extension version 3.19.0

[βœ“] VS Code, 32-bit edition
β€’ VS Code at C:\Program Files (x86)\Microsoft VS Code
β€’ Flutter extension version 3.19.0

[βœ“] Connected device (3 available)
β€’ sdk gphone x86 (mobile) β€’ emulator-5554 β€’ android-x86 β€’ Android 11 (API 30) (emulator)
β€’ Chrome (web) β€’ chrome β€’ web-javascript β€’ Google Chrome 88.0.4324.150
β€’ Edge (web) β€’ edge β€’ web-javascript β€’ Microsoft Edge 88.0.705.63

β€’ No issues found!

Example Code doesn't show results when entering a search

I tried the example out of the box with my own google maps api key and there were no results when I typed anything into the search box. I tried removing the location and radius restrictions as well but still no results came up.

Just wondering if there was an issue this.

I'm using the latest version and am on the latest stable version of flutter.

Update google_maps_flutter

update google_maps_flutter to stable release. release link.
this will ensure the library is up to date and will allow me to be inline with google maps future updates

Issues when using the dark theme.

Screenshot_20191208-171837

When using dark theme the text is not visible anymore.

Code to reproduce this:

    return MaterialApp(
      title: 'Google Maps',
      darkTheme: ThemeData.dark(),
      theme: ThemeData.dark(),
      home: Home(),
    );

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.