|
|
|
@ -163,7 +163,8 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
|
|
|
|
|
Expanded( |
|
|
|
|
child: Container( |
|
|
|
|
//BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 |
|
|
|
|
child: (Platform.isAndroid) ? BMFTextureMapWidget( |
|
|
|
|
child: (Platform.isAndroid) |
|
|
|
|
? BMFTextureMapWidget( |
|
|
|
|
mapOptions: BMFMapOptions( |
|
|
|
|
center: BMFCoordinate( |
|
|
|
|
double.tryParse(widget.arguments["lat"]), |
|
|
|
@ -175,8 +176,8 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
|
|
|
|
|
zoomLevel: 15, |
|
|
|
|
), |
|
|
|
|
onBMFMapCreated: onMapCreated, |
|
|
|
|
) : |
|
|
|
|
BMFMapWidget( |
|
|
|
|
) |
|
|
|
|
: BMFMapWidget( |
|
|
|
|
mapOptions: BMFMapOptions( |
|
|
|
|
center: BMFCoordinate( |
|
|
|
|
double.tryParse(widget.arguments["lat"]), |
|
|
|
@ -306,7 +307,8 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
|
|
|
|
|
onTap: () { |
|
|
|
|
if (myCity == null) { |
|
|
|
|
// onOpenBaiduMap(); |
|
|
|
|
SmartDialog.showToast("您定位服务未开启,请前往系统设置中开启定位服务", |
|
|
|
|
SmartDialog.showToast( |
|
|
|
|
"您定位服务未开启,请前往系统设置中开启定位服务", |
|
|
|
|
alignment: Alignment.center); |
|
|
|
|
} else { |
|
|
|
|
navigationState = 1; |
|
|
|
@ -408,7 +410,8 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void onOpenBaiduMap() async { |
|
|
|
|
launch("baidumap://map/marker?location=${storeInfo.latitude},${storeInfo.longitude}&title=${storeInfo.storeName}&content=${storeInfo.storeName}&traffic=on&src=andr.baidu.openAPIdemo&coord_type=gcj02"); |
|
|
|
|
launch( |
|
|
|
|
"baidumap://map/marker?location=${storeInfo.latitude},${storeInfo.longitude}&title=${storeInfo.storeName}&content=${storeInfo.storeName}&traffic=on&src=andr.baidu.openAPIdemo&coord_type=gcj02"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//調取百度地圖APP |
|
|
|
@ -452,7 +455,7 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
updateMapLine(List<BMFCoordinate> coordinates, int needHours, int needMinutes, |
|
|
|
|
double needDistance) { |
|
|
|
|
double needDistance) async { |
|
|
|
|
try { |
|
|
|
|
//刪除之前的創建的點和綫 |
|
|
|
|
_mapController.cleanAllMarkers(); |
|
|
|
@ -499,12 +502,23 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
|
|
|
|
|
draggable: false, |
|
|
|
|
); |
|
|
|
|
_mapController.addMarker(terminalBmfMarker); |
|
|
|
|
_mapController.setVisibleMapRectWithPadding( |
|
|
|
|
SmartDialog.showToast( |
|
|
|
|
"${startLocation.longitude} ${startLocation.latitude} ${endLocation.longitude} ${endLocation.latitude}", |
|
|
|
|
alignment: Alignment.center); |
|
|
|
|
bool tryFlag = await _mapController.setVisibleMapRectWithPadding( |
|
|
|
|
visibleMapBounds: BMFCoordinateBounds( |
|
|
|
|
northeast: startLocation, southwest: endLocation), |
|
|
|
|
animated: true, |
|
|
|
|
insets: |
|
|
|
|
EdgeInsets.only(top: 500, bottom: 200, left: 200, right: 200)); |
|
|
|
|
if (!tryFlag) { |
|
|
|
|
tryFlag = await _mapController.setVisibleMapBounds( |
|
|
|
|
BMFCoordinateBounds(northeast: startLocation, southwest: endLocation), |
|
|
|
|
true, |
|
|
|
|
); |
|
|
|
|
if (!tryFlag) |
|
|
|
|
SmartDialog.showToast("还是不行", alignment: Alignment.center); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hours = needHours == 0 ? "" : "$needHours小时"; |
|
|
|
|
minutes = needMinutes == 0 ? "" : "$needMinutes分钟"; |
|
|
|
|