widget_to_marker 套件讓開發者能夠將任何 Flutter 小工具轉換為 BitmapDescriptor,進而透過 google_maps_flutter 插件將自訂設計的小工具用作 Google 地圖標記上的圖示。這對於建立視覺豐富、動態的標記特別有用,這些標記超越了標準圖示。此套件支援 Android、iOS 和 Web 平台,確保跨平台的一致性。它簡化了在地圖上直接渲染複雜 UI 元素(如頭像、徽章或自訂形狀)的過程。
適用情境
帶有動態內容的自定義地圖標記
在地圖上顯示用戶頭像
建立品牌或主題標記
即時標記更新與動畫小部件
在地圖上疊加互動式使用者介面元素
主要特色
將任何 Flutter widget 轉換為 BitmapDescriptor
支援 Android、iOS 與 Web
與 google_maps_flutter 的簡單整合
複雜組件的高效渲染
跨平台相容性
適合對象
開發互動地圖的開發者
需要品牌化或個性化標記的應用程式
使用動態或動畫標記內容的專案
優先考慮跨平台的視覺一致性
尋找靜態圖標圖像替代方案的使用者
使用建議
複雜或頻繁更新的組件對效能的影響
位圖生成可能帶來的記憶體開銷
需要妥善處理產生的描述符
僅限靜態快照(非互動式小部件)
可能需要針對高頻率更新進行優化
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
Features
When using Google Maps, we always have a problem with adding a marker on the map, and the available tools were either drawing the marker through canvas path or using an image, but the problem is if we want to add words or data or add custom edit to this marker, but this package has solved the problem and now you can use any widget in flutter as a marker for google map !
using the .toBitmapDescriptor() function on the widget to use it as a marker icon!