Last updated:
0 purchases
google map location picker flutter
google_map_location_picker_flutter #
Getting Started #
Get an API key at https://cloud.google.com/maps-platform/.
And don't forget to enable the following APIs in https://console.cloud.google.com/google/maps-apis/
Maps SDK for Android
Maps SDK for iOS
Places API
Geolocation API
Geocoding API
And ensure to enable billing for the project.
Android #
Specify your API key in the application manifest android/app/src/main/AndroidManifest.xml:
<manifest ...
<application ...
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="YOUR KEY HERE"/>
copied to clipboard
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
copied to clipboard
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)
}
}
copied to clipboard
you need also to define NSLocationWhenInUseUsageDescription
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs your location to test the location feature of the Google Maps location picker plugin.</string>
copied to clipboard
Usage #
dependencies:
google_maps_flutter: ^0.5.30
google_map_location_picker_flutter: ^latest
copied to clipboard
AddressResult result = await showGoogleMapLocationPicker(
pinWidget: Icon(Icons.location_pin,color: Colors.red,size: 55,),
pinColor: Colors.blue,
context: context,
addressPlaceHolder: "حرك الخريطة",
addressTitle: "عنوان التوصيل",
copied to clipboard
apiKey: "",
appBarTitle: "حدد موقع التوصيل",
confirmButtonColor: Colors.blue,
confirmButtonText: "تأكيد الموقع",
confirmButtonTextColor: Colors.black,
country:"sa",
language:"ar" ,
searchHint: "ابحث عن موقع", initialLocation: LatLng(26,39),
outOfBoundsMessage: "الخدمة غير متوفرة حاليا في هذه المنطقة"
);
if(result!=null){
print(result.address)
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.