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

套件詳情v8.0.3

flutter_map_dragmarker

flutter_map 的 Dragmarker 類

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2.7萬
喜歡數
33
Pub 分數
130

安裝套件

flutter pub add flutter_map_dragmarker

套件介紹

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

一個用於 flutter_map 的拖曳標記小工具,可讓使用者在地圖上互動式地放置與移動標記。它擴展了 flutter_map 的功能,讓使用者能將標記拖曳至指定位置,非常適合需要精確地理定位輸入的應用程式。此套件與 flutter_map 現有的 API 完全整合,並支援所有主要平台,包含行動裝置、網頁與桌面系統。輕量且設計簡潔,同時不犧牲核心功能。

適用情境

  • 互動式地圖標記放置
  • 地理位置資料輸入
  • 基於地圖的表單輸入
  • 實時位置調整
  • 可自訂的標記拖曳行為

主要特色

  • 可拖曳標記支援
  • 與 flutter_map 的無縫整合
  • 跨平台相容性
  • 可自定義的拖曳行為
  • 輕量且易於實作

適合對象

  • 開發互動地圖的開發者
  • 需要使用者定義座標的應用程式
  • 位置感知表單
  • 地圖編輯工具
  • 原型化地理空間功能

使用建議

  • 需要安裝 flutter_map
  • 僅限標記特定的互動
  • 位置無內建驗證
  • 可能需要額外的樣式設定以實現自訂視覺效果
  • 不適合複雜的多標記操作

原始 README

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

flutter_map_dragmarker

A drag marker for flutter_map.

See the example/lib/main.dart for usage, but the included example below in this file should show pretty much everything.

ko-fi

Usage

  • This layer should probably be the last layer so IF it needs to be dragged (otherwise why would you use this :)). If not, other layers may intercept the gestures.
  • offset and dragOffset are there for tweaking icon/images if they should not get displayed centered.
  • height is mainly for Images, use Icon(..., size: ...), but be aware internal calculations are based on size.
  • rotateMarker toggles the markers' rotation on and off. True keeping markers upright.
  • Use scrollMapNearEdge if the map should scroll when a marker is dragged near the edge.
  • Enable useLongPress if you want to enable dragging after a long press
  FlutterMap(
    options: MapOptions(center: LatLng(45.5231, -122.6765), zoom: 9),
    children: [
      TileLayer(
        urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
      ),
      DragMarkers(
        markers: [
          DragMarker(
            point: LatLng(45.535, -122.675),
            offset: const Offset(0.0, -8.0),
            builder: (ctx) => const Icon(Icons.location_on, size: 50),
            onDragUpdate: (details, latLng) => print(latLng),
          ),
        ],
      ),
    ],
  ),

Further notes

It may be interesting to move the map alternately to marker, too. So the marker stays in place, but then technically you aren't dragging anymore, so thoughts welcome.

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案