在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):humazed/google_map_location_picker开源软件地址(OpenSource Url):https://github.com/humazed/google_map_location_picker开源编程语言(OpenSource Language):Dart 90.7%开源软件介绍(OpenSource Introduction):google_map_location_pickerLocation picker using the official google_maps_flutter. I made This plugin because google deprecated Place Picker. UsingPubspec changes:
For message localization inside the library please add in import 'package:google_map_location_picker/generated/l10n.dart' as location_picker;
import 'package:flutter_localizations/flutter_localizations.dart';
MaterialApp(
localizationsDelegates: const [
location_picker.S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const <Locale>[
Locale('en', ''),
Locale('ar', ''),
],
home: ...
) import 'package:google_map_location_picker/google_map_location_picker.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
LocationResult result = await showLocationPicker(context, apiKey); Getting Started
AndroidSpecify your API key in the application manifest <manifest ...
<application ...
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="YOUR KEY HERE"/> iOSSpecify your API key in the application delegate #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 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)
}
} you need also to define
NoteThe following permissions are not required to use Google Maps Android API v2, but are recommended.
You must also explicitly declare that your app uses the android.hardware.location.network or android.hardware.location.gps hardware features if your app targets Android 5.0 (API level 21) or higher and uses the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in order to receive location updates from the network or a GPS, respectively. <uses-feature android:name="android.hardware.location.network" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" /> The following permissions are defined in the package manifest, and are automatically merged into your app's manifest at build time. You don't need to add them explicitly to your manifest:
Restricting Autocomplete Search to RegionThe The example below restricts Autocomplete Search to the United Arab Emirates and Nigeria showLocationPicker(
context, "YOUR API KEY HERE",
initialCenter: LatLng(31.1975844, 29.9598339),
myLocationButtonEnabled: true,
layersButtonEnabled: true,
countries: ['AE', 'NG'],
); CreditsThe google map from Flutter's google_maps_flutter package current location and permission from BaseflowIT's flutter-geolocator package. The search bar from Degreat's locationpicker package. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论