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

bound_location_picker 封面
套件詳情v0.0.1

bound_location_picker

一個由官方 google_maps_flutter 插件創建的 Flutter 套件,可幫助您在邊界內選擇位置。

AndroidiOSWeb
近 30 天下載
47
喜歡數
3
Pub 分數
140

安裝套件

flutter pub add bound_location_picker

套件介紹

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

一個 Flutter 套件,透過整合 Google 地圖功能,讓使用者能在定義的範圍內選擇地點。此套件是基於官方的 google_maps_flutter 插件所建構,提供對地點選擇的增強控制,將選擇限制在特定地理區域內。適用於需要在預先定義區域內進行精確位置輸入的應用程式,例如送貨服務或活動簽到。該套件支援 Android、iOS 和 Web 平台,確保跨平台的一致性。

適用情境

  • 配送區域選擇
  • 事件位置註冊
  • 地理圍欄區域導航
  • 基於地圖的表單輸入
  • 邊界內的位置驗證

主要特色

  • 邊界限制的位置選擇
  • 與 google_maps_flutter 的整合
  • 跨平台支援(Android、iOS、Web)
  • 可自訂的地圖邊界
  • 即時位置反饋

適合對象

  • 需要地理圍欄的應用程式
  • 位置感知表單
  • 配送和物流應用
  • 事件管理工具
  • 以地圖為中心的使用者介面

使用建議

  • 需要 Google Maps API 金鑰
  • 限制為有界區域選擇
  • 依賴於 google_maps_flutter
  • Web 支援可能有呈現差異
  • 用戶必須啟用位置權限

原始 README

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

Bound Location Picker for Flutter

Pub Version

A Flutter package created by the official google_maps_flutter plugin, which can help you to picked locations within a boundary.

Highlighted feature
  • Pick location within the Polygon boundary
  • Pick location within the Circular Radius boundary

Made by @Hasan

Android iOS Web
Support SDK 20+ iOS 11+ Same as Flutter's
Regular Picker Circle Boundary Polygon Boundary

💻 Usage

First, add bound_location_picker as a dependency in your pubspec.yaml file.

dependencies:
  flutter:
    sdk: flutter

  bound_location_picker: ^update_version

Don't forget to flutter pub get.

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"/>
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)
  }
}
Web

You'll need to modify the web/index.html file of your Flutter Web application to include the Google Maps JS SDK.

Check the google_maps_flutter_web README for the latest information on how to prepare your App to use Google Maps on the web.

Sample Usage
class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: BoundLocationPicker(
          initialCameraPosition: const LatLng(24.540725, 89.631088),
          onPickedLocation: (LatLng? location) {
            ///TODO do something using location 
          },
          onLocationUpdateListener: (LatLng? location) {
            ///TODO do something with current location
          },
          locationPickerImage: const AssetImage("assets/pin_point.png"),
          circleBoundary: CircleBoundary(radius: 800),
          enablePickedButton: true,
        ),
      ),
    );
  }
}
👨🏻‍💻Contribute to the project

All contributions are welcome.

GitHub

所屬分類

依賴

依賴清單 4 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。