|
|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:geolocator/geolocator.dart';
|
|
|
|
|
import 'package:hyzp_ybqx/components/dioFun.dart';
|
|
|
|
|
import 'package:map_launcher/map_launcher.dart';
|
|
|
|
|
|
|
|
|
|
@ -32,7 +31,6 @@ class dwInfoDialog extends Dialog {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
getCurrentPosition();
|
|
|
|
|
Size mediaSize = MediaQuery.of(context).size;
|
|
|
|
|
return WillPopScope(
|
|
|
|
|
child: Material(
|
|
|
|
|
@ -156,37 +154,6 @@ class dwInfoDialog extends Dialog {
|
|
|
|
|
String defaultMapName = g_defaultMapName;
|
|
|
|
|
AvailableMap defalutMap;
|
|
|
|
|
|
|
|
|
|
void getCurrentPosition() async {
|
|
|
|
|
print('getCurrentPosition begin');
|
|
|
|
|
|
|
|
|
|
// 是否保存默认地图
|
|
|
|
|
g_bSaveDefaultMap = await Storage.getBool('bSaveDefaultMap');
|
|
|
|
|
g_bSaveDefaultMap = (null == g_bSaveDefaultMap) ? false : g_bSaveDefaultMap; // 默认不保存
|
|
|
|
|
// 用户选择的默认地图名称
|
|
|
|
|
g_defaultMapName = await Storage.getString('defaultMapName');
|
|
|
|
|
g_defaultMapName = (null == g_defaultMapName) ? '' : g_defaultMapName; // 默认为空字符串
|
|
|
|
|
defaultMapName = g_defaultMapName;
|
|
|
|
|
|
|
|
|
|
// 获取用户选择的默认地图
|
|
|
|
|
// availableMaps = await MapLauncher.installedMaps; // 为避免延迟错乱,该变量由父组件传入
|
|
|
|
|
if (defaultMapName != null && defaultMapName.length > 0) {
|
|
|
|
|
for (var map in availableMaps) {
|
|
|
|
|
if (defaultMapName.toLowerCase() == map.mapName.toLowerCase()) {
|
|
|
|
|
defalutMap = map;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await Geolocator.getCurrentPosition().then((Position value) {
|
|
|
|
|
originLatitude = value.latitude;
|
|
|
|
|
originLongitude = value.longitude;
|
|
|
|
|
print('value = ${value.toString()}');
|
|
|
|
|
// value = Latitude: 28.796201, Longitude: 104.607751
|
|
|
|
|
print('getCurrentPosition end');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
navigationMap(BuildContext context) {
|
|
|
|
|
print('this.defalutMap = ${defalutMap}');
|
|
|
|
|
if (defalutMap != null) {
|
|
|
|
|
|