hyzp_ybqx-Commit186:已经基本实现在“点位地图”中添加“导航”功能,能够保存用户选择的默认导航地图
This commit is contained in:
@@ -36,6 +36,9 @@
|
|||||||
<!-- 请求忽略电池优化,用于后台定时提醒等 -->
|
<!-- 请求忽略电池优化,用于后台定时提醒等 -->
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
||||||
|
|
||||||
|
<!-- Permissions options for the `location` group -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name="com.flutter.hyzp_ybqx.MyApplication"
|
android:name="com.flutter.hyzp_ybqx.MyApplication"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
classpath 'com.android.tools.build:gradle:3.5.4'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -7,7 +7,6 @@ import 'dart:math';
|
|||||||
import 'package:ai_save_account/ai_save_account.dart';
|
import 'package:ai_save_account/ai_save_account.dart';
|
||||||
import 'package:audioplayers/audio_cache.dart';
|
import 'package:audioplayers/audio_cache.dart';
|
||||||
import 'package:audioplayers/audioplayers.dart';
|
import 'package:audioplayers/audioplayers.dart';
|
||||||
|
|
||||||
import 'package:camera/camera.dart';
|
import 'package:camera/camera.dart';
|
||||||
import 'package:convert/convert.dart';
|
import 'package:convert/convert.dart';
|
||||||
import 'package:crypto/crypto.dart' as crypto;
|
import 'package:crypto/crypto.dart' as crypto;
|
||||||
@@ -15,17 +14,13 @@ import 'package:device_info/device_info.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:hyzp_ybqx/provider/player_region.dart';
|
import 'package:hyzp_ybqx/provider/player_region.dart';
|
||||||
|
|
||||||
import 'UserInfo.dart';
|
import 'UserInfo.dart';
|
||||||
import 'dioFun.dart';
|
|
||||||
|
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
double g_radioImage = 10 / 16; // 违章图片默认宽高比率
|
double g_radioImage = 10 / 16; // 违章图片默认宽高比率
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AudioPlayer playerClick;
|
AudioPlayer playerClick;
|
||||||
AudioPlayer playerClacks;
|
AudioPlayer playerClacks;
|
||||||
@@ -124,6 +119,52 @@ List listReviewed = [];
|
|||||||
bool g_bVoiceRemind = false; // 用户设置是否开启语音提醒
|
bool g_bVoiceRemind = false; // 用户设置是否开启语音提醒
|
||||||
int g_remindGap = 60; // 提醒间隔默认为60S,0表示取消定时提醒
|
int g_remindGap = 60; // 提醒间隔默认为60S,0表示取消定时提醒
|
||||||
|
|
||||||
|
bool g_bSaveDefaultMap = false; // 是否保存默认地图
|
||||||
|
String g_defaultMapName = ''; // 用户选择的默认地图名称
|
||||||
|
// 获取地图的中文名称
|
||||||
|
String getMapChsName(String mapName) {
|
||||||
|
if (mapName.length == 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
mapName = mapName.toLowerCase();
|
||||||
|
String mapKey = '';
|
||||||
|
String _mapChsName = '';
|
||||||
|
|
||||||
|
// 查找包含 mapName 的最短 key
|
||||||
|
for (var key in mapChsName.keys) {
|
||||||
|
// print('$key ${mapChsName[key]}');
|
||||||
|
if (mapName.indexOf(key) > -1) {
|
||||||
|
if (mapKey.length == 0 || key.length < mapKey.length) {
|
||||||
|
mapKey = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mapChsName = mapChsName[mapKey];
|
||||||
|
|
||||||
|
if (_mapChsName == null) {
|
||||||
|
_mapChsName = mapName + (mapName.length > 0 ? '地图' : '');
|
||||||
|
}
|
||||||
|
return _mapChsName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// key 全部小写
|
||||||
|
Map<String, String> mapChsName = {
|
||||||
|
'apple': '苹果地图',
|
||||||
|
'google': '谷歌地图',
|
||||||
|
'googlego': '谷歌地图轻量版',
|
||||||
|
'amap': '高德地图',
|
||||||
|
'baidu': '百度地图',
|
||||||
|
'waze': '位智地图',
|
||||||
|
'yandexmaps': 'Yandex地图',
|
||||||
|
'yandexnavi': 'Yandex导航地图',
|
||||||
|
'citymapper': '城市地图',
|
||||||
|
'mapswithme': '离线地图',
|
||||||
|
'osmand': 'OsmAnd地图',
|
||||||
|
'doubleGis': 'doubleGis地图',
|
||||||
|
'tencent': '腾讯地图',
|
||||||
|
};
|
||||||
|
|
||||||
// Timer g_remindTimer; //定时提醒变量
|
// Timer g_remindTimer; //定时提醒变量
|
||||||
//
|
//
|
||||||
// // 设置定时提醒
|
// // 设置定时提醒
|
||||||
|
|||||||
+1
-1
@@ -119,7 +119,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
// g_bVoiceRemind = (null == g_bVoiceRemind) ? false : g_bVoiceRemind; // 默认关闭
|
// g_bVoiceRemind = (null == g_bVoiceRemind) ? false : g_bVoiceRemind; // 默认关闭
|
||||||
g_bVoiceRemind = (null == g_bVoiceRemind) ? true : g_bVoiceRemind; // 默认开启
|
g_bVoiceRemind = (null == g_bVoiceRemind) ? true : g_bVoiceRemind; // 默认开启
|
||||||
// print('g_bVoiceRemind = $g_bVoiceRemind');
|
// print('g_bVoiceRemind = $g_bVoiceRemind');
|
||||||
g_remindGap = await Storage.getInt('nRemindGap');
|
g_remindGap = await Storage.getInt('nRemindGap');
|
||||||
g_remindGap = (null == g_remindGap) ? 60 : g_remindGap; // 提醒间隔默认为60S
|
g_remindGap = (null == g_remindGap) ? 60 : g_remindGap; // 提醒间隔默认为60S
|
||||||
|
|
||||||
eventBus.fire(VoiceRemindUpdate('g_bVoiceRemind 数据已更新'));
|
eventBus.fire(VoiceRemindUpdate('g_bVoiceRemind 数据已更新'));
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import 'package:flutter_bmfmap/BaiduMap/bmfmap_map.dart';
|
|||||||
import 'package:flutter_screenutil/screen_util.dart';
|
import 'package:flutter_screenutil/screen_util.dart';
|
||||||
import 'package:hyzp_ybqx/components/commonFun.dart';
|
import 'package:hyzp_ybqx/components/commonFun.dart';
|
||||||
import 'package:hyzp_ybqx/components/hyxx_data_handle.dart';
|
import 'package:hyzp_ybqx/components/hyxx_data_handle.dart';
|
||||||
|
import 'package:map_launcher/map_launcher.dart';
|
||||||
|
|
||||||
import '../../../components/dioFun.dart';
|
import '../../../components/dioFun.dart';
|
||||||
|
import '../../../services/Storage.dart';
|
||||||
import 'dwInfoDialog.dart';
|
import 'dwInfoDialog.dart';
|
||||||
import 'dwInfo_data.dart';
|
import 'dwInfo_data.dart';
|
||||||
|
|
||||||
@@ -20,6 +22,11 @@ class BasicMap extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _BasicMapState extends State<BasicMap> {
|
class _BasicMapState extends State<BasicMap> {
|
||||||
|
// 导航相关代码
|
||||||
|
double destinationLatitude = 28.45382237207785;
|
||||||
|
double destinationLongitude = 104.7506958256658;
|
||||||
|
String destinationTitle = '珙县大坪上';
|
||||||
|
|
||||||
Size screenSize;
|
Size screenSize;
|
||||||
BMFMapOptions mapOptions;
|
BMFMapOptions mapOptions;
|
||||||
BMFMapController myMapController;
|
BMFMapController myMapController;
|
||||||
@@ -32,9 +39,18 @@ class _BasicMapState extends State<BasicMap> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<AvailableMap> availableMaps;
|
||||||
|
|
||||||
|
void init() async {
|
||||||
|
// 获取用户选择的默认地图
|
||||||
|
availableMaps = await MapLauncher.installedMaps;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
init();
|
||||||
|
|
||||||
mapOptions = BMFMapOptions(
|
mapOptions = BMFMapOptions(
|
||||||
//center: BMFCoordinate(39.965, 116.404),//北京市
|
//center: BMFCoordinate(39.965, 116.404),//北京市
|
||||||
//30 116.395645038,39.9299857781 北京-北京市
|
//30 116.395645038,39.9299857781 北京-北京市
|
||||||
@@ -291,8 +307,17 @@ class _BasicMapState extends State<BasicMap> {
|
|||||||
.push(
|
.push(
|
||||||
PageRouteBuilder(
|
PageRouteBuilder(
|
||||||
opaque: false,
|
opaque: false,
|
||||||
pageBuilder: (context, animation, secondaryAnimation) =>
|
pageBuilder: (context, animation, secondaryAnimation) => dwInfoDialog(
|
||||||
dwInfoDialog(id: id, dwIndex: dwIndex, title: title, content: content),
|
id: id,
|
||||||
|
dwIndex: dwIndex,
|
||||||
|
title: title,
|
||||||
|
content: content,
|
||||||
|
parentContext: context,
|
||||||
|
destinationLatitude: double.parse(listCoordinate[1]),
|
||||||
|
destinationLongitude: double.parse(listCoordinate[0]),
|
||||||
|
destinationTitle: listDwinfoGetList2[dwIndex]["dwmc"],
|
||||||
|
availableMaps: availableMaps,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.then((value) async {
|
.then((value) async {
|
||||||
|
|||||||
@@ -1,21 +1,38 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:hyzp_ybqx/components/dioFun.dart';
|
import 'package:hyzp_ybqx/components/dioFun.dart';
|
||||||
|
import 'package:map_launcher/map_launcher.dart';
|
||||||
|
|
||||||
//import 'package:hyzp_ybqx/widget/player_pro.dart';
|
//import 'package:hyzp_ybqx/widget/player_pro.dart';
|
||||||
import '../../../components/commonFun.dart';
|
import '../../../components/commonFun.dart';
|
||||||
|
import '../../../services/Storage.dart';
|
||||||
|
import 'maps_sheet.dart';
|
||||||
|
|
||||||
//确认对话框
|
//确认对话框
|
||||||
class dwInfoDialog extends Dialog {
|
class dwInfoDialog extends Dialog {
|
||||||
dwInfoDialog({@required this.id, this.title = "", @required this.dwIndex, this.content});
|
dwInfoDialog({
|
||||||
|
@required this.id,
|
||||||
|
this.title = "",
|
||||||
|
@required this.dwIndex,
|
||||||
|
this.content,
|
||||||
|
// 导航相关参数
|
||||||
|
this.parentContext,
|
||||||
|
this.destinationLatitude,
|
||||||
|
this.destinationLongitude,
|
||||||
|
this.destinationTitle,
|
||||||
|
this.availableMaps,
|
||||||
|
});
|
||||||
|
|
||||||
int dwIndex;
|
int dwIndex;
|
||||||
String id;
|
String id;
|
||||||
String title;
|
String title;
|
||||||
String content;
|
String content;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
BuildContext parentContext;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
getCurrentPosition();
|
||||||
Size mediaSize = MediaQuery.of(context).size;
|
Size mediaSize = MediaQuery.of(context).size;
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
child: Material(
|
child: Material(
|
||||||
@@ -90,9 +107,9 @@ class dwInfoDialog extends Dialog {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
ret = true;
|
ret = true;
|
||||||
getingDwVideo = false;
|
getingDwVideo = false;
|
||||||
Navigator.pop(context, ret); //关闭弹框,返回sRet
|
navigationMap(context);
|
||||||
},
|
},
|
||||||
child: Text("确认"),
|
child: Text("导航"),
|
||||||
),
|
),
|
||||||
RaisedButton(
|
RaisedButton(
|
||||||
child: Text("取消"),
|
child: Text("取消"),
|
||||||
@@ -115,4 +132,102 @@ class dwInfoDialog extends Dialog {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导航相关代码
|
||||||
|
double destinationLatitude = 28.45382237207785;
|
||||||
|
double destinationLongitude = 104.7506958256658;
|
||||||
|
String destinationTitle = '珙县大坪上';
|
||||||
|
|
||||||
|
double originLatitude;
|
||||||
|
double originLongitude;
|
||||||
|
String originTitle = '我的位置';
|
||||||
|
|
||||||
|
List<Coords> waypoints = [
|
||||||
|
// Coords(37.7705112, -122.4108267),
|
||||||
|
// Coords(37.6988984, -122.4830961),
|
||||||
|
// Coords(37.7935754, -122.483654),
|
||||||
|
];
|
||||||
|
|
||||||
|
DirectionsMode directionsMode = DirectionsMode.driving;
|
||||||
|
|
||||||
|
List<AvailableMap> availableMaps;
|
||||||
|
|
||||||
|
// String defaultMapName = 'Amap';
|
||||||
|
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) {
|
||||||
|
defalutMap.showDirections(
|
||||||
|
destination: Coords(
|
||||||
|
destinationLatitude,
|
||||||
|
destinationLongitude,
|
||||||
|
),
|
||||||
|
destinationTitle: destinationTitle,
|
||||||
|
origin: originLatitude == null || originLongitude == null
|
||||||
|
? null
|
||||||
|
: Coords(originLatitude, originLongitude),
|
||||||
|
originTitle: originTitle,
|
||||||
|
waypoints: waypoints,
|
||||||
|
directionsMode: directionsMode,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
MapsSheet.show(
|
||||||
|
context: parentContext,
|
||||||
|
onMapTap: (map) {
|
||||||
|
if (g_bSaveDefaultMap) {
|
||||||
|
g_defaultMapName = map.mapName;
|
||||||
|
Storage.setString('defaultMapName', g_defaultMapName);
|
||||||
|
}
|
||||||
|
|
||||||
|
map.showDirections(
|
||||||
|
destination: Coords(
|
||||||
|
destinationLatitude,
|
||||||
|
destinationLongitude,
|
||||||
|
),
|
||||||
|
destinationTitle: destinationTitle,
|
||||||
|
origin: originLatitude == null || originLongitude == null
|
||||||
|
? null
|
||||||
|
: Coords(originLatitude, originLongitude),
|
||||||
|
originTitle: originTitle,
|
||||||
|
waypoints: waypoints,
|
||||||
|
directionsMode: directionsMode,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Navigator.pop(context, ret); //关闭弹框,返回sRet
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:map_launcher/map_launcher.dart';
|
||||||
|
|
||||||
|
class MapsSheet {
|
||||||
|
static show({
|
||||||
|
@required BuildContext context,
|
||||||
|
@required Function(AvailableMap map) onMapTap,
|
||||||
|
}) async {
|
||||||
|
final availableMaps = await MapLauncher.installedMaps;
|
||||||
|
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return SafeArea(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
child: Wrap(
|
||||||
|
children: <Widget>[
|
||||||
|
for (var map in availableMaps)
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
print('map.mapName = ${map.mapName}');
|
||||||
|
// map.mapName = Amap
|
||||||
|
Navigator.pop(context);
|
||||||
|
onMapTap(map);
|
||||||
|
},
|
||||||
|
title: Text(map.mapName),
|
||||||
|
leading: SvgPicture.asset(
|
||||||
|
map.icon,
|
||||||
|
height: 30.0,
|
||||||
|
width: 30.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ import 'package:hyzp_ybqx/pages/Works/TJXX/tj_data.dart';
|
|||||||
import 'package:hyzp_ybqx/pages/tabs/page5_userManager.dart';
|
import 'package:hyzp_ybqx/pages/tabs/page5_userManager.dart';
|
||||||
import 'package:hyzp_ybqx/pages/tabs/page6_download.dart';
|
import 'package:hyzp_ybqx/pages/tabs/page6_download.dart';
|
||||||
import 'package:hyzp_ybqx/pages/tabs/page7_setRemind.dart';
|
import 'package:hyzp_ybqx/pages/tabs/page7_setRemind.dart';
|
||||||
|
import 'package:hyzp_ybqx/pages/tabs/page8_defaultMap.dart';
|
||||||
import 'package:hyzp_ybqx/services/EventBus.dart';
|
import 'package:hyzp_ybqx/services/EventBus.dart';
|
||||||
import 'package:hyzp_ybqx/widget/JdButton.dart';
|
import 'package:hyzp_ybqx/widget/JdButton.dart';
|
||||||
import 'package:package_info/package_info.dart';
|
import 'package:package_info/package_info.dart';
|
||||||
@@ -111,35 +112,35 @@ class _Page4_MyMsicsNewState extends State<Page4_MyMsicsNew>
|
|||||||
static onNullFun() {}
|
static onNullFun() {}
|
||||||
|
|
||||||
Widget _getListTile(
|
Widget _getListTile(
|
||||||
title, {
|
title, {
|
||||||
String leadPath = '',
|
String leadPath = '',
|
||||||
Color leadColor,
|
Color leadColor,
|
||||||
Color textColor,
|
Color textColor,
|
||||||
onTapFun = onNullFun,
|
onTapFun = onNullFun,
|
||||||
onLongPressFun = onNullFun,
|
onLongPressFun = onNullFun,
|
||||||
size = 16.0,
|
size = 16.0,
|
||||||
bool bBadge = false,
|
bool bBadge = false,
|
||||||
Widget trailWidget = const Icon(Icons.arrow_forward_ios),
|
Widget trailWidget = const Icon(Icons.arrow_forward_ios),
|
||||||
}) {
|
}) {
|
||||||
// print("_getListTile bVoiceRemind = $bVoiceRemind"); // _getListTile bVoiceRemind = false
|
// print("_getListTile bVoiceRemind = $bVoiceRemind"); // _getListTile bVoiceRemind = false
|
||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: bBadge
|
leading: bBadge
|
||||||
? Badge(
|
? Badge(
|
||||||
position: BadgePosition.topEnd(top: -7, end: -12),
|
position: BadgePosition.topEnd(top: -7, end: -12),
|
||||||
badgeContent: null,
|
badgeContent: null,
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
leadPath,
|
leadPath,
|
||||||
height: ScreenUtil().setHeight(78),
|
height: ScreenUtil().setHeight(78),
|
||||||
fit: BoxFit.fitHeight,
|
fit: BoxFit.fitHeight,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Image.asset(
|
: Image.asset(
|
||||||
leadPath,
|
leadPath,
|
||||||
height: ScreenUtil().setHeight(78),
|
height: ScreenUtil().setHeight(78),
|
||||||
fit: BoxFit.fitHeight,
|
fit: BoxFit.fitHeight,
|
||||||
),
|
),
|
||||||
title: Text(title, style: TextStyle(fontSize: size, color: textColor)),
|
title: Text(title, style: TextStyle(fontSize: size, color: textColor)),
|
||||||
trailing: trailWidget,
|
trailing: trailWidget,
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 0),
|
contentPadding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 0),
|
||||||
@@ -202,6 +203,10 @@ class _Page4_MyMsicsNewState extends State<Page4_MyMsicsNew>
|
|||||||
leadPath: 'assets/images/账户管理.png',
|
leadPath: 'assets/images/账户管理.png',
|
||||||
leadColor: _deepBlueColor,
|
leadColor: _deepBlueColor,
|
||||||
onTapFun: OnTap_user_manager),
|
onTapFun: OnTap_user_manager),
|
||||||
|
_getListTile('默认导航',
|
||||||
|
leadPath: 'assets/images/默认地图3.png',
|
||||||
|
leadColor: _deepBlueColor,
|
||||||
|
onTapFun: OnTap_DefaultMap),
|
||||||
//bNewVer:是否发现新版本
|
//bNewVer:是否发现新版本
|
||||||
_getListTile('版本更新',
|
_getListTile('版本更新',
|
||||||
leadPath: 'assets/images/版本更新.png',
|
leadPath: 'assets/images/版本更新.png',
|
||||||
@@ -213,9 +218,7 @@ class _Page4_MyMsicsNewState extends State<Page4_MyMsicsNew>
|
|||||||
leadColor: _deepBlueColor,
|
leadColor: _deepBlueColor,
|
||||||
onTapFun: OnTap_download),
|
onTapFun: OnTap_download),
|
||||||
_getListTile('提醒设置',
|
_getListTile('提醒设置',
|
||||||
leadPath: 'assets/images/语音提醒.png',
|
leadPath: 'assets/images/语音提醒.png', leadColor: _deepGreyColor, onTapFun: OnTap_Remind),
|
||||||
leadColor: _deepGreyColor,
|
|
||||||
onTapFun: OnTap_Remind),
|
|
||||||
_getListTile('关于',
|
_getListTile('关于',
|
||||||
leadPath: 'assets/images/关于.png', leadColor: _deepBlueColor, onTapFun: OnTap_MyAbout)
|
leadPath: 'assets/images/关于.png', leadColor: _deepBlueColor, onTapFun: OnTap_MyAbout)
|
||||||
|
|
||||||
@@ -511,6 +514,10 @@ class _Page4_MyMsicsNewState extends State<Page4_MyMsicsNew>
|
|||||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => page5_userManager()));
|
Navigator.of(context).push(MaterialPageRoute(builder: (context) => page5_userManager()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OnTap_DefaultMap() async {
|
||||||
|
Navigator.of(context).push(MaterialPageRoute(builder: (context) => page8_defaultMap()));
|
||||||
|
}
|
||||||
|
|
||||||
OnTap_download() {
|
OnTap_download() {
|
||||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => page6_download()));
|
Navigator.of(context).push(MaterialPageRoute(builder: (context) => page6_download()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,284 @@
|
|||||||
|
import 'package:badges/badges.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:hyzp_ybqx/pages/Login/FaceReg.dart';
|
||||||
|
import 'package:hyzp_ybqx/pages/Login/ModifyPassword.dart';
|
||||||
|
import 'package:hyzp_ybqx/services/Storage.dart';
|
||||||
|
|
||||||
|
import '../../components/commonFun.dart';
|
||||||
|
import '../../widget/JdButton.dart';
|
||||||
|
|
||||||
|
class page8_defaultMap extends StatefulWidget {
|
||||||
|
page8_defaultMap({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
_LoginPageState createState() => _LoginPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LoginPageState extends State<page8_defaultMap> {
|
||||||
|
bool bSaveDefaultMap = false;
|
||||||
|
String defaultMapName = '';
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void init() async {
|
||||||
|
// 从磁盘读取变量
|
||||||
|
// 是否保存默认地图
|
||||||
|
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; // 默认为空字符串
|
||||||
|
|
||||||
|
bSaveDefaultMap = g_bSaveDefaultMap;
|
||||||
|
// bSaveDefaultMap = false;
|
||||||
|
// defaultMapName = g_defaultMapName;
|
||||||
|
// defaultMapName = '高德地图';
|
||||||
|
// defaultMapName = getMapChsName('amap');
|
||||||
|
defaultMapName = getMapChsName(g_defaultMapName);
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
|
////////
|
||||||
|
static onNullFun() {}
|
||||||
|
|
||||||
|
Widget _getListTile(
|
||||||
|
title, {
|
||||||
|
String leadPath = '',
|
||||||
|
Color leadColor,
|
||||||
|
Color textColor,
|
||||||
|
onTapFun = onNullFun,
|
||||||
|
onLongPressFun = onNullFun,
|
||||||
|
size = 16.0,
|
||||||
|
bool bBadge = false,
|
||||||
|
Widget trailWidget = const Icon(Icons.arrow_forward_ios),
|
||||||
|
}) {
|
||||||
|
// print("_getListTile bSaveDefaultMap = $bSaveDefaultMap "); // _getListTile bSaveDefaultMap = false
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
ListTile(
|
||||||
|
leading: bBadge
|
||||||
|
? Badge(
|
||||||
|
position: BadgePosition.topEnd(top: -7, end: -12),
|
||||||
|
badgeContent: null,
|
||||||
|
child: Image.asset(
|
||||||
|
leadPath,
|
||||||
|
height: ScreenUtil().setHeight(78),
|
||||||
|
fit: BoxFit.fitHeight,
|
||||||
|
// color: leadColor, // 无效
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Image.asset(
|
||||||
|
leadPath,
|
||||||
|
height: ScreenUtil().setHeight(78),
|
||||||
|
fit: BoxFit.fitHeight,
|
||||||
|
),
|
||||||
|
title: Text(title, style: TextStyle(fontSize: size, color: textColor)),
|
||||||
|
trailing: trailWidget,
|
||||||
|
contentPadding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 0),
|
||||||
|
enabled: true,
|
||||||
|
onTap: onTapFun,
|
||||||
|
onLongPress: onLongPressFun,
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
height: 1.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> _listViewUser = [];
|
||||||
|
|
||||||
|
Color _greenColor = Color.fromRGBO(36, 206, 192, 1); //绿色
|
||||||
|
Color _deepBlueColor = Color.fromRGBO(79, 118, 230, 1); //深蓝
|
||||||
|
Color _deepGreyColor = Color.fromRGBO(116, 139, 161, 1); //深灰
|
||||||
|
Color _ligthBlueColor = Color.fromRGBO(80, 159, 245, 1); //亮蓝
|
||||||
|
|
||||||
|
OnTap_FaceReg() async {
|
||||||
|
Navigator.of(context).push(MaterialPageRoute(builder: (context) => FaceReg()));
|
||||||
|
}
|
||||||
|
|
||||||
|
OnTap_modify_password() {
|
||||||
|
Navigator.of(context).push(MaterialPageRoute(builder: (context) => ModifyPassword()));
|
||||||
|
}
|
||||||
|
|
||||||
|
OnTap_Remind() {
|
||||||
|
setState(() {
|
||||||
|
bSaveDefaultMap = !bSaveDefaultMap;
|
||||||
|
print("bSaveDefaultMap = $bSaveDefaultMap");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getTextField() {
|
||||||
|
return Container(
|
||||||
|
width: ScreenUtil().setWidth(400),
|
||||||
|
child: TextField(
|
||||||
|
readOnly: !bSaveDefaultMap,
|
||||||
|
focusNode: FocusNode(),
|
||||||
|
textAlignVertical: TextAlignVertical(y: 1.0),
|
||||||
|
controller: TextEditingController.fromValue(TextEditingValue(
|
||||||
|
text: defaultMapName.toString(),
|
||||||
|
// 保持光标在最后
|
||||||
|
selection: TextSelection.fromPosition(TextPosition(
|
||||||
|
affinity: TextAffinity.downstream, offset: defaultMapName.toString().length)))),
|
||||||
|
maxLines: 1,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
//contentPadding: EdgeInsets.only(bottom: 16),
|
||||||
|
// hintText: widget.text,
|
||||||
|
// border: OutlineInputBorder(
|
||||||
|
// borderRadius: BorderRadius.circular(30), borderSide: BorderSide.none),
|
||||||
|
border: UnderlineInputBorder(borderSide: BorderSide(color: Colors.lightBlue)),
|
||||||
|
focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.lightBlue)),
|
||||||
|
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.lightBlue)),
|
||||||
|
),
|
||||||
|
onChanged: (v) {
|
||||||
|
defaultMapName = v;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getText(String text) {
|
||||||
|
return Container(
|
||||||
|
child: Text(text,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.blueAccent,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: PreferredSize(
|
||||||
|
preferredSize: Size.fromHeight(ScreenUtil().setHeight(173)), // 设置appBar高度
|
||||||
|
// 设置appBar高度
|
||||||
|
child: AppBar(
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
centerTitle: true,
|
||||||
|
titleSpacing: 0.0,
|
||||||
|
//设置title的左边距
|
||||||
|
flexibleSpace: Container(
|
||||||
|
//SizedBox(height: ScreenUtil().statusBarHeight), //显示顶部状态栏
|
||||||
|
// SizedBox(height: ScreenUtil().setHeight(10)), //显示顶部状态栏
|
||||||
|
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight), //留出顶部状态栏高度
|
||||||
|
child: Container(
|
||||||
|
//height: ScreenUtil().setHeight(173),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.centerLeft,
|
||||||
|
end: Alignment.centerRight,
|
||||||
|
colors: [
|
||||||
|
Color.fromRGBO(12, 186, 156, 1),
|
||||||
|
Color.fromRGBO(39, 127, 235, 1),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// gradient: LinearGradient(colors: [
|
||||||
|
// Color(0xFF0018EB),
|
||||||
|
// Color(0xFF01C1D9),
|
||||||
|
// ], begin: Alignment.bottomCenter, end: Alignment.topCenter),
|
||||||
|
// ),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
title: Padding(
|
||||||
|
padding: EdgeInsets.only(left: 0, right: 0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
getIconAndTextButton(
|
||||||
|
iconColor: Colors.white,
|
||||||
|
iconData: Icons.chevron_left_outlined,
|
||||||
|
onPress: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Text("默认导航设置",
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 20),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
overflow: TextOverflow.ellipsis),
|
||||||
|
),
|
||||||
|
SizedBox(width: 50),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
padding: EdgeInsets.only(top: 30, bottom: 20, left: 20, right: 20),
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
Center(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(top: 30),
|
||||||
|
height: ScreenUtil().setWidth(160),
|
||||||
|
width: ScreenUtil().setWidth(160),
|
||||||
|
//child: Image.asset('assets/images/user.png', fit: BoxFit.cover),
|
||||||
|
child: Image.asset('assets/images/ybsthbj.png', fit: BoxFit.fitHeight),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 50),
|
||||||
|
_getListTile('保存默认导航地图',
|
||||||
|
leadPath: 'assets/images/地图选中.png',
|
||||||
|
leadColor: _deepGreyColor,
|
||||||
|
// textColor: bSaveDefaultMap ? Colors.blue : null,
|
||||||
|
onTapFun: OnTap_Remind,
|
||||||
|
trailWidget: bSaveDefaultMap
|
||||||
|
? Icon(Icons.check_box, color: Colors.blue)
|
||||||
|
: Icon(Icons.check_box_outline_blank, color: Colors.blueAccent)),
|
||||||
|
_getListTile('已选默认导航地图:',
|
||||||
|
leadPath: 'assets/images/用户选择.png',
|
||||||
|
leadColor: _deepBlueColor,
|
||||||
|
trailWidget: getText(defaultMapName)),
|
||||||
|
SizedBox(height: 60),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
JdButton(
|
||||||
|
height: 128,
|
||||||
|
width: 282,
|
||||||
|
//height: 126,
|
||||||
|
text: "确认",
|
||||||
|
color: Colors.blueAccent,
|
||||||
|
onTop: () async {
|
||||||
|
g_bSaveDefaultMap = bSaveDefaultMap;
|
||||||
|
await Storage.setBool('bSaveDefaultMap', g_bSaveDefaultMap);
|
||||||
|
if (!g_bSaveDefaultMap) {
|
||||||
|
await Storage.setString('defaultMapName', '');
|
||||||
|
}
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
JdButton(
|
||||||
|
height: 128,
|
||||||
|
width: 282,
|
||||||
|
//height: 126,
|
||||||
|
text: "取消",
|
||||||
|
color: Colors.blueAccent,
|
||||||
|
onTop: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -377,6 +377,13 @@ packages:
|
|||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "0.0.3"
|
version: "0.0.3"
|
||||||
|
flutter_svg:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_svg
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.19.1"
|
||||||
flutter_swiper:
|
flutter_swiper:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -408,6 +415,27 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.1"
|
version: "4.0.1"
|
||||||
|
geolocator:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: geolocator
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "6.2.1"
|
||||||
|
geolocator_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_platform_interface
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.9"
|
||||||
|
geolocator_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_web
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.1"
|
||||||
get_it:
|
get_it:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -485,6 +513,13 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.1"
|
version: "1.1.1"
|
||||||
|
map_launcher:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: map_launcher
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.3+1"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -210,6 +210,11 @@ dependencies:
|
|||||||
# 添加水印插件
|
# 添加水印插件
|
||||||
disable_screenshots: ^0.1.0
|
disable_screenshots: ^0.1.0
|
||||||
|
|
||||||
|
# 导航相关插件
|
||||||
|
map_launcher: ^1.1.3+1
|
||||||
|
flutter_svg: ^0.19.1
|
||||||
|
geolocator: ^6.2.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|||||||
Reference in New Issue
Block a user