搜尋套件、儲存庫與 APP 分類

套件詳情v0.0.10

location_map_picker

從地圖上選擇位置,並在Google地圖中搜尋任何地點,取得輸出以及地點名稱和LatLng,使用Google地圖和Geolocator。

近 30 天下載
17
喜歡數
10
Pub 分數
75

安裝套件

flutter pub add location_map_picker

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter 套件,讓使用者可以直接在應用程式內從 Google 地圖選取位置。它整合了 Google 地圖與地理定位服務,讓使用者能夠搜尋地點並取得精確資訊,例如地點名稱與 LatLng 座標。基於 Geolocator 插件建構,支援無縫的地圖互動與位址解析。非常適合需要透過直覺式地圖介面進行精準位置輸入的應用程式。

適用情境

  • 基於地圖的位置選擇
  • 地址搜尋帶自動補全
  • 透過 Google 地圖進行地理編碼
  • 表單中的位置共享
  • 即時位置追蹤
  • 帶有位置輸入的使用者引導

主要特色

  • 互動式 Google 地圖整合
  • 地點名稱和LatLng輸出
  • 可搜尋的位置輸入
  • 基於定位器的地理編碼
  • 地圖互動的簡單 API
  • 行動裝置的響應式使用者介面

適合對象

  • 旅行與配送應用
  • 事件註冊平台
  • 配送和物流系統
  • 帶有位置標記的社交媒體
  • 用戶資料設定位置
  • 需要精確地理位置資料的應用程式

使用建議

  • 需要網路存取權限以使用 Google 地圖
  • 需要 Google 地圖的 API 金鑰
  • 僅限 Android 與 iOS(無 Web 支援)
  • 依賴於 Geolocator 插件
  • 對低階裝置可能產生的效能影響
  • 位置資料的隱私考量

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

location_map_picker:

widget to pick a location on a map with google map.

# 👨‍💻 Developed by:

profile

Nasr Al-Rahbi @abom_me

👨🏻‍💻 Find me in :

Twitter Instagram LinkedIn Stack Overflow



  • Compatibility with Geolocator
  • Use of Google map APIs
Android iOS Flutter Web
Support SDK 20+ iOS 9+ Not yet

Location picker using the official google_maps_flutter.

Setup

Pubspec changes:

      dependencies:
        map_location_picker: ^0.0.7

Sample example:

import 'package:location_map_picker/location_map_picker.dart';
MapPicker(
apiKey: "YOUR_API_KEY",
onPin: (PinData? result) {
...
},
);

Getting Started

For more details, see Getting started with Google Maps Platform.

Android
  1. Set the minSdkVersion in android/app/build.gradle:
android {
    defaultConfig {
        minSdkVersion 20
    }
}

This means that app will only be available for users that run Android SDK 20 or higher.

  1. 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"/>
Hybrid Composition

To use Hybrid Composition to render the GoogleMap widget on Android, set AndroidGoogleMapsFlutter.useAndroidViewSurface to true.

if (defaultTargetPlatform == TargetPlatform.android) {
  AndroidGoogleMapsFlutter.useAndroidViewSurface = true;
}
iOS

To set up, 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: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GMSServices.provideAPIKey("YOUR KEY HERE")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}
Note

The following permissions are not required to use Google Maps Android API v2, but are recommended.

android.permission.ACCESS_COARSE_LOCATION Allows the API to use WiFi or mobile cell data (or both) to determine the device's location. The API returns the location with an accuracy approximately equivalent to a city block.

android.permission.ACCESS_FINE_LOCATION Allows the API to determine as precise a location as possible from the available location providers, including the Global Positioning System (GPS) as well as WiFi and mobile cell data.


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:

android.permission.INTERNET Used by the API to download map tiles from Google Maps servers.

android.permission.ACCESS_NETWORK_STATE Allows the API to check the connection status in order to determine whether data can be downloaded.

See the example directory for a complete sample app.

Parameters of the MapPicker
/// Here add the starting location, this location will appear directly when entering the widget
  /// You can leave it blank and it will use a default location

   LatLng? startLocation;


  /// Here, type the text that appears below before choosing a location, you can leave it blank

String? inputText;


  /// Here is the widget that will appear in the submit button
  /// You can leave it blank and it will use the default send icon

  Widget? sendBtnIcon = const Icon(Icons.send);


  ///Here is the text color of the text box, it is black by default
  Color? textInputColor;



  /// Here is the icon that appears next to the text box for the position name, at the bottom
  Widget? inputIcon;



  /// This String is required and mandatory, here  type your API key from Google Cloud
 
  final String apiKey;


  /// Here is the text that will appear in the search box at the top
  /// default phrase (Search For A Place)

   String? searchBoxHintText;


  /// Here is the language of the map and the name of the places, just type the language code
  /// For example: for Arabic (ar) for English (en)
  /// You can leave it blank and it will be in English by default
  String? mapLanguage;


  ///Here is type of the map, if it is normal, satellite, etc
  MapType? mapType;


  /// Here comes the data after selecting the location, including the name of the place and its LatLng
  final void Function(PinData pinData) onPin;

Real Example:

Video Example

👨🏻‍💻 Follow me :

Twitter

Instagram

LinkedIn

Stack Overflow

所屬分類

依賴

依賴清單 5 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。