我正在開發一個顫振應用程式,嘗試使用官方插件添加谷歌地圖,但是,有很多系統標記我不知道如何洗掉。
標記來自谷歌自己的資料庫,但我們真的不需要額外的資訊,它們會給我們的用戶帶來問題,因為用戶認為標記來自我們自己的應用程式!大用戶體驗問題。
我在課堂上找不到開關或類似的東西GoogleMap。
有任何想法嗎?謝謝!

uj5u.com熱心網友回復:
這可以通過將自定義谷歌地圖樣式應用于您的谷歌地圖來實作。
創建自定義谷歌地圖樣式。使用此工具生成一個map_style.json并將其保存在您的資產檔案夾中。(確保它也在 pubspec.yaml 中被參考)。
//this is the function to load custom map style json
void changeMapMode(GoogleMapController mapController) {
getJsonFile("assets/map_style.json")
.then((value) => setMapStyle(value, mapController));
}
//helper function
void setMapStyle(String mapStyle, GoogleMapController mapController) {
mapController.setMapStyle(mapStyle);
}
//helper function
Future<String> getJsonFile(String path) async {
ByteData byte = await rootBundle.load(path);
var list = byte.buffer.asUint8List(byte.offsetInBytes,byte.lengthInBytes);
return utf8.decode(list);
}
在你的谷歌地圖小部件中實作它:
GoogleMap(
...
onMapCreated: (GoogleMapController c) {
yourMapController = c;
changeMapMode(yourMapController);
},
),
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/427072.html
