feat: 移除地图相关业务、添加锁新增安全性判断
This commit is contained in:
parent
a091bc2869
commit
c49e7cab03
@ -156,9 +156,6 @@ import 'main/lockMian/demoMode/demoModeLockSet/demoModeLockSet_page.dart';
|
||||
import 'main/lockMian/lockMain/lockMain_page.dart';
|
||||
import 'mine/about/about_page.dart';
|
||||
import 'mine/addLock/addLock/addLock_page.dart';
|
||||
import 'mine/addLock/addLockSelectCountry/addLockSelectCountry_page.dart';
|
||||
import 'mine/addLock/lockAddress/gaode/lockAddressGaoDe_page.dart';
|
||||
import 'mine/addLock/lockAddress/lockAddress/lockAddress_page.dart';
|
||||
import 'mine/addLock/nearbyLock/nearbyLock_page.dart';
|
||||
import 'mine/addLock/saveLock/saveLock_page.dart';
|
||||
import 'mine/addLock/selectLockType/selectLockType_page.dart';
|
||||
@ -715,10 +712,6 @@ abstract class AppRouters {
|
||||
name: Routers.nearbyDoorMagneticPage,
|
||||
page: () => const NearbyDoorMagneticPage(),
|
||||
),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.lockAddressPage,
|
||||
page: () => const LockAddressPage(),
|
||||
),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.remoteUnlockingPage,
|
||||
page: () => const RemoteUnlockingPage(),
|
||||
@ -1007,9 +1000,6 @@ abstract class AppRouters {
|
||||
GetPage<dynamic>(
|
||||
name: Routers.adminDetailChangeDatePage,
|
||||
page: () => const AdminDetailChangeDatePage()),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.lockAddressGaoDePage,
|
||||
page: () => const LockAddressGaoDePage()),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.safeVerifyPage, page: () => const SafeVerifyPage()),
|
||||
GetPage<dynamic>(
|
||||
@ -1023,9 +1013,6 @@ abstract class AppRouters {
|
||||
GetPage<dynamic>(
|
||||
name: Routers.demoModeLockDetailPage,
|
||||
page: () => const DemoModeLockDetailPage()),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.addLockSelectCountryPage,
|
||||
page: () => const AddLockSelectCountryPage()),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.faceUnlockPage, page: () => const FaceUnlockPage()),
|
||||
GetPage<dynamic>(
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
|
||||
import '../../../tools/baseGetXController.dart';
|
||||
import 'addLockSelectCountry_state.dart';
|
||||
|
||||
class AddLockSelectCountryLogic extends BaseGetXController {
|
||||
AddLockSelectCountryState state = AddLockSelectCountryState();
|
||||
|
||||
}
|
||||
@ -1,187 +0,0 @@
|
||||
|
||||
import 'package:azlistview/azlistview.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/addLock/addLockSelectCountry/addLockSelectCountry_state.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../login/selectCountryRegion/common/countryRegionEntity.dart';
|
||||
import '../../../network/api_repository.dart';
|
||||
import '../../../tools/commonItem.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
import 'addLockSelectCountry_logic.dart';
|
||||
|
||||
class AddLockSelectCountryPage extends StatefulWidget {
|
||||
const AddLockSelectCountryPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddLockSelectCountryPage> createState() => _AddLockSelectCountryPageState();
|
||||
}
|
||||
|
||||
class _AddLockSelectCountryPageState extends State<AddLockSelectCountryPage> {
|
||||
final AddLockSelectCountryLogic logic = Get.put(AddLockSelectCountryLogic());
|
||||
final AddLockSelectCountryState state = Get.find<AddLockSelectCountryLogic>().state;
|
||||
|
||||
List<CountryRegionModel> countriesList = [];
|
||||
int selectindex = 10000;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
SuspensionUtil.setShowSuspensionStatus(
|
||||
countriesList.cast<ISuspensionBean>());
|
||||
Future.delayed(const Duration(milliseconds: 20), getCountriesListRequest);
|
||||
}
|
||||
|
||||
//请求国家/地区json文件
|
||||
Future<void> getCountriesListRequest() async {
|
||||
final CountryRegionEntity entity = await ApiRepository.to.getCountryRegion('1');
|
||||
countriesList.clear();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
countriesList.addAll(entity.dataList!);
|
||||
_handleList(countriesList);
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> loadJsonFromAssets(String assetsPath) async {
|
||||
return await rootBundle.loadString(assetsPath);
|
||||
}
|
||||
|
||||
void _handleList(List<CountryRegionModel> list) {
|
||||
if (list.isEmpty) return;
|
||||
for (int i = 0, length = list.length; i < length; i++) {
|
||||
final CountryRegionModel countryModel = list[i];
|
||||
final String tag = countryModel.group!;
|
||||
if (RegExp('[A-Z]').hasMatch(tag)) {
|
||||
list[i].tagIndex = tag;
|
||||
} else {
|
||||
list[i].tagIndex = '#';
|
||||
}
|
||||
}
|
||||
// A-Z sort.
|
||||
SuspensionUtil.sortListBySuspensionTag(list);
|
||||
// show sus tag.
|
||||
SuspensionUtil.setShowSuspensionStatus(countriesList);
|
||||
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '请选择您的位置'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: countriesList.length,
|
||||
itemBuilder: (BuildContext c, int index) {
|
||||
final CountryRegionModel model = countriesList[index];
|
||||
return CommonItem(
|
||||
leftTitel: model.name,
|
||||
rightTitle: '',
|
||||
allHeight: 60.h,
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
action: (){
|
||||
setState(() {
|
||||
selectindex = index;
|
||||
});
|
||||
},
|
||||
rightWidget: Row(
|
||||
children: [
|
||||
Image.asset((selectindex == index) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 30.h, bottom: 30.h),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
'跳过'.tr,
|
||||
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
Get.toNamed(Routers.saveLockPage, arguments: {
|
||||
'addressInfo': {},
|
||||
'pwdTimestamp': state.pwdTimestamp.value,
|
||||
'lockInfo': state.lockInfo,
|
||||
'featureValue': state.featureValue,
|
||||
'featureSettingValue': state.featureSettingValue,
|
||||
'featureSettingParams': state.featureSettingParams,
|
||||
'isFromMap': 0,
|
||||
});
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text(
|
||||
'下一步'.tr,
|
||||
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
if(selectindex == 10000){
|
||||
logic.showToast('请选择国家'.tr);
|
||||
return;
|
||||
}
|
||||
final CountryRegionModel model = countriesList[selectindex];
|
||||
Get.toNamed(Routers.saveLockPage, arguments: {
|
||||
'addressInfo': {'country':model.name},
|
||||
'pwdTimestamp': state.pwdTimestamp.value,
|
||||
'lockInfo': state.lockInfo,
|
||||
'featureValue': state.featureValue,
|
||||
'featureSettingValue': state.featureSettingValue,
|
||||
'featureSettingParams': state.featureSettingParams,
|
||||
'isFromMap': 0,
|
||||
});
|
||||
// Navigator.pushNamed(context, Routers.saveLockPage);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
// body: AzListView(
|
||||
// data: countriesList,
|
||||
// itemCount: countriesList.length,
|
||||
// itemBuilder: (BuildContext context, int index) {
|
||||
// CountryRegionModel model = countriesList[index];
|
||||
// model.code = " ";
|
||||
// return Utils.getListItem(context, model, () {
|
||||
// Map<String, dynamic> resultMap = {};
|
||||
// resultMap['code'] = model.code;
|
||||
// resultMap['countryId'] = model.countryId.toString();
|
||||
// resultMap['countryName'] = model.name;
|
||||
// Navigator.pop(context, resultMap);
|
||||
// });
|
||||
// },
|
||||
// padding: EdgeInsets.zero,
|
||||
// susItemBuilder: (BuildContext context, int index) {
|
||||
// CountryRegionModel model = countriesList[index];
|
||||
// String tag = model.getSuspensionTag();
|
||||
// return Utils.getSusItem(context, tag);
|
||||
// },
|
||||
// // indexBarData: const ['★', ...kIndexBarData],
|
||||
// ),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class AddLockSelectCountryState{
|
||||
|
||||
var pwdTimestamp= 0.obs;
|
||||
var lockInfo = {};
|
||||
var featureValue = '';
|
||||
var featureSettingValue = '';
|
||||
var featureSettingParams = [];
|
||||
AddLockSelectCountryState() {
|
||||
Map map = Get.arguments;
|
||||
pwdTimestamp.value = map["pwdTimestamp"];
|
||||
lockInfo = map["lockInfo"];
|
||||
featureValue = map["featureValue"];
|
||||
featureSettingValue = map["featureSettingValue"];
|
||||
featureSettingParams = map["featureSettingParams"];
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import 'lockAddressGaoDe_state.dart';
|
||||
|
||||
class LockAddressGaoDeLogic extends BaseGetXController{
|
||||
LockAddressGaoDeState state = LockAddressGaoDeState();
|
||||
|
||||
void pushAddAction(){
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,386 +0,0 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:amap_flutter_base/amap_flutter_base.dart';
|
||||
import 'package:amap_flutter_location/amap_flutter_location.dart';
|
||||
import 'package:amap_flutter_location/amap_location_option.dart';
|
||||
import 'package:amap_flutter_map/amap_flutter_map.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/mine/addLock/lockAddress/gaode/lockAddressGaoDe_state.dart';
|
||||
import 'package:star_lock/widget/permission/permission_dialog.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../flavors.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import 'lockAddressGaoDe_logic.dart';
|
||||
|
||||
class LockAddressGaoDePage extends StatefulWidget {
|
||||
const LockAddressGaoDePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<LockAddressGaoDePage> createState() => _LockAddressGaoDePageState();
|
||||
}
|
||||
|
||||
class _LockAddressGaoDePageState extends State<LockAddressGaoDePage>
|
||||
with RouteAware {
|
||||
final LockAddressGaoDeLogic logic = Get.put(LockAddressGaoDeLogic());
|
||||
final LockAddressGaoDeState state = Get.find<LockAddressGaoDeLogic>().state;
|
||||
AMapController? mapController;
|
||||
Map<String, Object>? _addressInfo;
|
||||
|
||||
late StreamSubscription<Map<String, Object>> _locationListener;
|
||||
|
||||
AMapFlutterLocation _amapLocationPlugin = AMapFlutterLocation();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
/// 设置是否已经包含高德隐私政策并弹窗展示显示用户查看,如果未包含或者没有弹窗展示,高德定位SDK将不会工作
|
||||
///
|
||||
/// 高德SDK合规使用方案请参考官网地址:https://lbs.amap.com/news/sdkhgsy
|
||||
/// <b>必须保证在调用定位功能之前调用, 建议首次启动App时弹出《隐私政策》并取得用户同意</b>
|
||||
///
|
||||
/// 高德SDK合规使用方案请参考官网地址:https://lbs.amap.com/news/sdkhgsy
|
||||
///
|
||||
/// [hasContains] 隐私声明中是否包含高德隐私政策说明
|
||||
///
|
||||
/// [hasShow] 隐私权政策是否弹窗展示告知用户
|
||||
AMapFlutterLocation.updatePrivacyShow(true, true);
|
||||
|
||||
/// 设置是否已经取得用户同意,如果未取得用户同意,高德定位SDK将不会工作
|
||||
///
|
||||
/// 高德SDK合规使用方案请参考官网地址:https://lbs.amap.com/news/sdkhgsy
|
||||
///
|
||||
/// <b>必须保证在调用定位功能之前调用, 建议首次启动App时弹出《隐私政策》并取得用户同意</b>
|
||||
///
|
||||
/// [hasAgree] 隐私权政策是否已经取得用户同意
|
||||
AMapFlutterLocation.updatePrivacyAgree(true);
|
||||
AMapFlutterLocation.setApiKey(F.aMapKey.androidKey, F.aMapKey.iosKey);
|
||||
|
||||
/// 动态申请定位权限
|
||||
requestPermission();
|
||||
|
||||
///设置Android和iOS的apiKey<br>
|
||||
///
|
||||
/// 定位Flutter插件提供了单独的设置ApiKey的接口,
|
||||
/// 使用接口的优先级高于通过Native配置ApiKey的优先级(通过Api接口配置后,通过Native配置文件设置的key将不生效),
|
||||
/// 使用时可根据实际情况决定使用哪种方式
|
||||
///
|
||||
///key的申请请参考高德开放平台官网说明<br>
|
||||
///
|
||||
///Android: https://lbs.amap.com/api/android-location-sdk/guide/create-project/get-key
|
||||
///
|
||||
///iOS: https://lbs.amap.com/api/ios-location-sdk/guide/create-project/get-key
|
||||
// AMapFlutterLocation.setApiKey(
|
||||
// "anroid ApiKey", "ios ApiKey");
|
||||
|
||||
///iOS 获取native精度类型
|
||||
if (Platform.isIOS) {
|
||||
requestAccuracyAuthorization();
|
||||
}
|
||||
|
||||
///注册定位结果监听
|
||||
_locationListener = _amapLocationPlugin
|
||||
.onLocationChanged()
|
||||
.listen((Map<String, Object> result) {
|
||||
setState(() {
|
||||
_addressInfo = result;
|
||||
});
|
||||
});
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_startLocation();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
|
||||
///移除定位监听
|
||||
_locationListener.cancel();
|
||||
|
||||
///销毁定位
|
||||
_amapLocationPlugin.destroy();
|
||||
}
|
||||
|
||||
///设置定位参数
|
||||
void _setLocationOption() {
|
||||
AMapLocationOption locationOption = new AMapLocationOption();
|
||||
|
||||
///是否单次定位
|
||||
locationOption.onceLocation = false;
|
||||
|
||||
///是否需要返回逆地理信息
|
||||
locationOption.needAddress = true;
|
||||
|
||||
///逆地理信息的语言类型
|
||||
locationOption.geoLanguage = GeoLanguage.DEFAULT;
|
||||
|
||||
locationOption.desiredLocationAccuracyAuthorizationMode =
|
||||
AMapLocationAccuracyAuthorizationMode.ReduceAccuracy;
|
||||
|
||||
locationOption.fullAccuracyPurposeKey = "AMapLocationScene";
|
||||
|
||||
///设置Android端连续定位的定位间隔
|
||||
locationOption.locationInterval = 2000;
|
||||
|
||||
///设置Android端的定位模式<br>
|
||||
///可选值:<br>
|
||||
///<li>[AMapLocationMode.Battery_Saving]</li>
|
||||
///<li>[AMapLocationMode.Device_Sensors]</li>
|
||||
///<li>[AMapLocationMode.Hight_Accuracy]</li>
|
||||
locationOption.locationMode = AMapLocationMode.Hight_Accuracy;
|
||||
|
||||
///设置iOS端的定位最小更新距离<br>
|
||||
locationOption.distanceFilter = -1;
|
||||
|
||||
///设置iOS端期望的定位精度
|
||||
/// 可选值:<br>
|
||||
/// <li>[DesiredAccuracy.Best] 最高精度</li>
|
||||
/// <li>[DesiredAccuracy.BestForNavigation] 适用于导航场景的高精度 </li>
|
||||
/// <li>[DesiredAccuracy.NearestTenMeters] 10米 </li>
|
||||
/// <li>[DesiredAccuracy.Kilometer] 1000米</li>
|
||||
/// <li>[DesiredAccuracy.ThreeKilometers] 3000米</li>
|
||||
locationOption.desiredAccuracy = DesiredAccuracy.Best;
|
||||
|
||||
///设置iOS端是否允许系统暂停定位
|
||||
locationOption.pausesLocationUpdatesAutomatically = false;
|
||||
|
||||
///将定位参数设置给定位插件
|
||||
_amapLocationPlugin.setLocationOption(locationOption);
|
||||
}
|
||||
|
||||
///开始定位
|
||||
void _startLocation() {
|
||||
///开始定位之前设置定位参数
|
||||
_setLocationOption();
|
||||
_amapLocationPlugin.startLocation();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '锁地址'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 25.w, right: 25.w, top: 40.h, bottom: 40.w),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'地理位置'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 50.sp),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.visible,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
child: (_addressInfo != null &&
|
||||
_addressInfo!.containsKey('latitude'))
|
||||
? Column(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 1.sw / 5 * 4,
|
||||
width: 1.sw,
|
||||
child: AMapWidget(
|
||||
apiKey: AMapApiKey(
|
||||
iosKey: F.aMapKey.iosKey,
|
||||
androidKey: F.aMapKey.androidKey),
|
||||
// 初始化地图中心
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: LatLng(
|
||||
double.parse(
|
||||
_addressInfo!['latitude'].toString()),
|
||||
double.parse(
|
||||
_addressInfo!['longitude'].toString())),
|
||||
zoom: 10.0,
|
||||
),
|
||||
//定位小蓝点
|
||||
myLocationStyleOptions: MyLocationStyleOptions(
|
||||
true,
|
||||
),
|
||||
// 普通地图normal,卫星地图satellite,夜间视图night,导航视图 navi,公交视图bus,
|
||||
mapType: MapType.normal,
|
||||
// 缩放级别范围
|
||||
minMaxZoomPreference:
|
||||
const MinMaxZoomPreference(3, 20),
|
||||
// 隐私政策包含高德 必须填写
|
||||
privacyStatement: const AMapPrivacyStatement(
|
||||
hasAgree: true, hasContains: true, hasShow: true),
|
||||
// 地图创建成功时返回AMapController
|
||||
onMapCreated: (AMapController controller) {
|
||||
mapController = controller;
|
||||
},
|
||||
onLocationChanged: (AMapLocation location) {
|
||||
print("onLocationChanged ${location}");
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
// color: Colors.red,
|
||||
margin:
|
||||
EdgeInsets.only(left: 25.w, top: 20.h, right: 25.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Text('检查以确保以下地址是正确的'.tr,
|
||||
style: TextStyle(fontSize: 24.sp))),
|
||||
],
|
||||
),
|
||||
),
|
||||
// SizedBox(height: 20.h),
|
||||
Container(
|
||||
// color: Colors.red,
|
||||
// height: 45.h,
|
||||
margin: EdgeInsets.only(
|
||||
left: 25.w, top: 20.h, right: 25.w),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
_addressInfo!['address'].toString() ??
|
||||
'',
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
overflow: TextOverflow.clip))),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
Container(
|
||||
height: 1.h,
|
||||
color: AppColors.mainColor,
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
)
|
||||
: SizedBox(
|
||||
height: 1.sw / 5 * 4 + 65.h * 2,
|
||||
child: Center(child: Text('地图加载中,请稍候。。。'.tr))),
|
||||
),
|
||||
Container(
|
||||
constraints: BoxConstraints(maxHeight: 150.h),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: Text(
|
||||
'跳过'.tr,
|
||||
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
Get.toNamed(Routers.addLockSelectCountryPage,
|
||||
arguments: <String, Object>{
|
||||
'addressInfo': {},
|
||||
'pwdTimestamp': state.pwdTimestamp.value,
|
||||
'lockInfo': state.lockInfo,
|
||||
'featureValue': state.featureValue,
|
||||
'featureSettingValue': state.featureSettingValue,
|
||||
'featureSettingParams': state.featureSettingParams,
|
||||
});
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text(
|
||||
'下一步'.tr,
|
||||
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_addressInfo!.isEmpty) {
|
||||
logic.showToast('还未获取到位置信息哦,请耐心等待一下!'.tr);
|
||||
return;
|
||||
}
|
||||
Get.toNamed(Routers.saveLockPage,
|
||||
arguments: <String, Object?>{
|
||||
'addressInfo': _addressInfo,
|
||||
'pwdTimestamp': state.pwdTimestamp.value,
|
||||
'lockInfo': state.lockInfo,
|
||||
'featureValue': state.featureValue,
|
||||
'featureSettingValue': state.featureSettingValue,
|
||||
'featureSettingParams': state.featureSettingParams,
|
||||
'isFromMap': 1,
|
||||
});
|
||||
// Navigator.pushNamed(context, Routers.saveLockPage);
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///获取iOS native的accuracyAuthorization类型
|
||||
void requestAccuracyAuthorization() async {
|
||||
AMapAccuracyAuthorization currentAccuracyAuthorization =
|
||||
await _amapLocationPlugin.getSystemAccuracyAuthorization();
|
||||
if (currentAccuracyAuthorization ==
|
||||
AMapAccuracyAuthorization.AMapAccuracyAuthorizationFullAccuracy) {
|
||||
print("精确定位类型");
|
||||
} else if (currentAccuracyAuthorization ==
|
||||
AMapAccuracyAuthorization.AMapAccuracyAuthorizationReducedAccuracy) {
|
||||
print("模糊定位类型");
|
||||
} else {
|
||||
print("未知定位类型");
|
||||
}
|
||||
}
|
||||
|
||||
/// 动态申请定位权限
|
||||
void requestPermission() async {
|
||||
// 申请权限
|
||||
final bool hasLocationPermission =
|
||||
await PermissionDialog.request(Permission.location);
|
||||
if (hasLocationPermission) {
|
||||
print("定位权限申请通过");
|
||||
} else {
|
||||
print("定位权限申请不通过");
|
||||
}
|
||||
}
|
||||
|
||||
/// 从上级界面进入 当前界面即将出现
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
}
|
||||
|
||||
/// 返回上一个界面 当前界面即将消失
|
||||
@override
|
||||
void didPop() {
|
||||
super.didPop();
|
||||
}
|
||||
|
||||
/// 从下级返回 当前界面即将出现
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
}
|
||||
|
||||
/// 进入下级界面 当前界面即将消失
|
||||
@override
|
||||
void didPushNext() {
|
||||
super.didPushNext();
|
||||
|
||||
_amapLocationPlugin.stopLocation();
|
||||
_amapLocationPlugin.destroy();
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
|
||||
import 'package:amap_flutter_location/amap_flutter_location.dart';
|
||||
import 'package:amap_flutter_map/amap_flutter_map.dart';
|
||||
import 'package:amap_flutter_base/amap_flutter_base.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
class LockAddressGaoDeState{
|
||||
|
||||
var pwdTimestamp= 0.obs;
|
||||
var lockInfo = {};
|
||||
var featureValue = '';
|
||||
var featureSettingValue = '';
|
||||
var featureSettingParams = [];
|
||||
|
||||
LockAddressGaoDeState() {
|
||||
Map map = Get.arguments;
|
||||
pwdTimestamp.value = map["pwdTimestamp"];
|
||||
lockInfo = map["lockInfo"];
|
||||
featureValue = map["featureValue"];
|
||||
featureSettingValue = map["featureSettingValue"];
|
||||
featureSettingParams = map["featureSettingParams"];
|
||||
}
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
// import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
class LockAddressGooglePage extends StatefulWidget {
|
||||
const LockAddressGooglePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<LockAddressGooglePage> createState() => _LockAddressGooglePageState();
|
||||
}
|
||||
|
||||
class _LockAddressGooglePageState extends State<LockAddressGooglePage> {
|
||||
|
||||
var deviceFindData = Get.arguments['data'];
|
||||
var source;
|
||||
var result;
|
||||
|
||||
// LatLng _kMapCenter;
|
||||
// CameraPosition _kInitialPosition;
|
||||
|
||||
var _markers;
|
||||
var setmarkers;
|
||||
var restaurantMarker;
|
||||
bool isSetupReady = false;
|
||||
|
||||
String? currentAddress;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// doSetup();
|
||||
}
|
||||
//
|
||||
// doSetup() async {
|
||||
// List<Placemark> placemarks = await placemarkFromCoordinates(deviceFindData.latitude, deviceFindData.longitude);
|
||||
// Placemark place1 = placemarks[0];
|
||||
// currentAddress = "${place1.country} ${place1.administrativeArea} ${place1.locality} ${place1.subLocality} ${place1.name}";
|
||||
// // AppLog.log("objectfasdfasdfasdfasdf:${placemarks}fasdfasdf${place1} ${currentAddress}");
|
||||
//
|
||||
// restaurantMarker = await BitmapDescriptor.fromAssetImage(
|
||||
// ImageConfiguration(size: Size(w(27), h(31))), Platform.isIOS ? R.assetsImgsDeviceFindDeviceIcon : R.assetsImgsDeviceFindDeviceAndroidIcon);
|
||||
// _markers = [
|
||||
// Marker(
|
||||
// markerId: MarkerId("marker_2"),
|
||||
// infoWindow: InfoWindow(title: currentAddress),
|
||||
// icon: restaurantMarker,
|
||||
// // position:_kMapCenter,
|
||||
// ),
|
||||
// ];
|
||||
// setmarkers = _markers.toSet();
|
||||
// setState(() {
|
||||
// isSetupReady = true;
|
||||
// });
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Placeholder();
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
|
||||
class LockAddressLogic extends BaseGetXController {
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
|
||||
class LockAddressPage extends StatefulWidget {
|
||||
const LockAddressPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<LockAddressPage> createState() => _LockAddressPageState();
|
||||
}
|
||||
|
||||
class _LockAddressPageState extends State<LockAddressPage> with RouteAware{
|
||||
Map<String, Object>? addressInfo;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '锁地址'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
'下一步'.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
if(addressInfo!.isEmpty){
|
||||
EasyLoading.showToast('请先获取到位置信息哦'.tr, duration: 2000.milliseconds);
|
||||
return;
|
||||
}
|
||||
Get.toNamed(Routers.saveLockPage, arguments: addressInfo);
|
||||
// Navigator.pushNamed(context, Routers.saveLockPage);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
// body: LockAddressGaoDePage(callback: (addressInfoMap){
|
||||
// addressInfo = addressInfoMap;
|
||||
// },)
|
||||
body: Container(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
// routeObserver.unsubscribe(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
// 订阅 routeObserver,之后就会尝试调用抽象类 RouteAware 的方法
|
||||
// routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute);
|
||||
}
|
||||
|
||||
@override
|
||||
void didPush() {
|
||||
// 当前页面入栈
|
||||
}
|
||||
|
||||
@override
|
||||
void didPopNext() {
|
||||
// 当前路由的下个路由出栈,且当前页面显示
|
||||
}
|
||||
|
||||
}
|
||||
@ -330,13 +330,24 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
state.featureSettingParams = featureParaTotalList;
|
||||
AppLog.log('featureParaTotalList:$featureParaTotalList');
|
||||
|
||||
Get.toNamed(Routers.lockAddressGaoDePage, arguments: <String, Object>{
|
||||
'pwdTimestamp': state.timestampValue * 1000,
|
||||
'lockInfo': state.lockInfo,
|
||||
'featureValue': state.featureValue,
|
||||
'featureSettingValue': state.featureSettingValue,
|
||||
'featureSettingParams': state.featureSettingParams,
|
||||
});
|
||||
// Get.toNamed(Routers.lockAddressGaoDePage, arguments: <String, Object>{
|
||||
// 'pwdTimestamp': state.timestampValue * 1000,
|
||||
// 'lockInfo': state.lockInfo,
|
||||
// 'featureValue': state.featureValue,
|
||||
// 'featureSettingValue': state.featureSettingValue,
|
||||
// 'featureSettingParams': state.featureSettingParams,
|
||||
// });
|
||||
Get.toNamed(Routers.saveLockPage,
|
||||
arguments: <String, Object?>{
|
||||
'addressInfo': {},
|
||||
'pwdTimestamp': state.timestampValue * 1000,
|
||||
'lockInfo': state.lockInfo,
|
||||
'featureValue': state.featureValue,
|
||||
'featureSettingValue': state.featureSettingValue,
|
||||
'featureSettingParams': state.featureSettingParams,
|
||||
'isFromMap': 0,
|
||||
});
|
||||
|
||||
|
||||
break;
|
||||
case 0x06:
|
||||
|
||||
@ -15,13 +15,27 @@ class SaveLockState {
|
||||
adminPassword = getAdminPassword();
|
||||
|
||||
final Map map = Get.arguments;
|
||||
if (map['pwdTimestamp']!= null) {
|
||||
pwdTimestamp.value = map['pwdTimestamp'];
|
||||
}
|
||||
if (map['addressInfo'] != null) {
|
||||
addressInfo.value = map['addressInfo'];
|
||||
}
|
||||
if (map['lockInfo'] != null) {
|
||||
lockInfo = map['lockInfo'];
|
||||
}
|
||||
if (map['featureValue'] != null) {
|
||||
featureValue = map['featureValue'];
|
||||
}
|
||||
if (map['featureSettingValue'] != null) {
|
||||
featureSettingValue = map['featureSettingValue'];
|
||||
}
|
||||
if (map['featureSettingParams'] != null) {
|
||||
featureSettingParams = map['featureSettingParams'];
|
||||
}
|
||||
if (map['isFromMap'] != null) {
|
||||
isFromMap = map['isFromMap'];
|
||||
}
|
||||
}
|
||||
RxString aliName = ''.obs;
|
||||
RxInt pwdTimestamp = 0.obs;
|
||||
|
||||
@ -194,14 +194,14 @@ dependencies:
|
||||
easy_refresh: ^3.3.4
|
||||
|
||||
#高德地图定位
|
||||
amap_flutter_location: 3.0.0
|
||||
# amap_flutter_location: 3.0.0
|
||||
#权限使用
|
||||
permission_handler: ^11.3.1
|
||||
#高德地图地图
|
||||
amap_flutter_map: 3.0.0
|
||||
# #高德地图地图
|
||||
# amap_flutter_map: 3.0.0
|
||||
|
||||
# 谷歌地图
|
||||
google_maps_flutter: ^2.2.5
|
||||
# google_maps_flutter: ^2.2.5
|
||||
# geocoding: ^2.1.0
|
||||
|
||||
# 允许App发现网络的相关信息并且进行相应的配置
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user