Merge branch 'develop' into 'canary_release'

Develop

See merge request StarlockTeam/app-starlock!27
This commit is contained in:
李仪 2025-05-08 08:28:18 +00:00
commit e9c06cc66d
21 changed files with 144 additions and 917 deletions

View File

@ -328,7 +328,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// implementation('com.amap.api:location:5.6.0')
// implementation('com.amap.api:3dmap:8.1.0')
implementation('com.amap.api:3dmap-location-search:latest.integration')
// implementation('com.amap.api:3dmap-location-search:latest.integration')
implementation 'cn.jiguang.sdk:jpush:5.2.3'
//

View File

@ -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>(

View File

@ -262,7 +262,7 @@ class BlueManage {
for (final ScanResult scanResult in results) {
if (scanResult.advertisementData.serviceUuids.isNotEmpty) {
// AppLog.log(
// '扫描到的设备:${scanResult.advertisementData.serviceUuids[0].toString()}');
// '扫描到的设备:${scanResult.advertisementData.serviceUuids[0].toString()}====${scanResult.advertisementData.advName}');
} else {
continue;
}
@ -315,20 +315,30 @@ class BlueManage {
}
/// uuid
bool _isMatch(List<String> serviceUuids,
{DeviceType deviceType = DeviceType.blue}) {
//
List<String> deviceTypeList = getDeviceType(deviceType);
// serviceUuids deviceTypeList
if (serviceUuids != null && serviceUuids.isNotEmpty) {
return serviceUuids.any((uuid) {
return deviceTypeList
.any((type) => uuid.toLowerCase().contains(type.toLowerCase()));
});
bool _isMatch(List<String> serviceUuids, {DeviceType deviceType = DeviceType.blue}) {
final List<String> prefixes = getDeviceType(deviceType).map((e) => e.toLowerCase()).toList();
for (String uuid in serviceUuids) {
final String cleanUuid = uuid.replaceAll('-', '').toLowerCase();
if (cleanUuid.length == 8) {
// 8
for (final prefix in prefixes) {
if (cleanUuid.startsWith(prefix)) {
return true;
}
}
} else if (cleanUuid.length == 32) {
// 128834
final String first8 = cleanUuid.substring(0, 8);
if (first8.length >= 4) {
final String thirdAndFourth = first8.substring(2, 4); // 23
for (final prefix in prefixes) {
if (thirdAndFourth == prefix) {
return true;
}
}
}
}
}
// serviceUuids false
return false;
}

View File

@ -9,7 +9,7 @@ List<String> getDeviceType(DeviceType deviceType) {
List<String> t = ['758824'];
switch (deviceType) {
case DeviceType.blue:
t = ['758824', '75'];
t = ['758824', '75', '768824', '76'];
break;
case DeviceType.gateway:
t = ['758825'];

View File

@ -76,7 +76,6 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Container(
width: 340.w,
height: 60.h,
// color: Colors.red,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(30.h)),
border:
@ -119,28 +118,22 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
child: Obx(
() => Container(
height: 60.h,
// color: Colors.red,
decoration: state.isIphoneType.value
? null
: BoxDecoration(
decoration: !state.isIphoneType.value
? BoxDecoration(
color: AppColors.mainColor,
borderRadius: BorderRadius.all(
Radius.circular(
30.h,
),
),
borderRadius:
BorderRadius.all(Radius.circular(30.h)),
border: Border.all(
width: 1.0,
color: AppColors.greyLineColor,
),
),
width: 1.0,
color: AppColors.greyLineColor))
: null,
child: Center(
child: Text(
'邮箱'.tr,
style: TextStyle(
color: state.isIphoneType.value
? Colors.black
: Colors.white,
color: !state.isIphoneType.value
? Colors.white
: Colors.black,
),
),
),

View File

@ -3,8 +3,11 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
class StarLockRegisterState {
StarLockRegisterState() {
// tab
final Locale? systemLocale = Get.deviceLocale;
isIphoneType.value = systemLocale?.languageCode == 'zh';
resetResend();
}
final TextEditingController phoneOrEmailController = TextEditingController();
@ -22,16 +25,21 @@ class StarLockRegisterState {
RxString verificationCode = ''.obs;
RxString xWidth = ''.obs; //
RxBool isIphoneType = true.obs;
RxBool canSub = false.obs;//
RxBool canSub = false.obs; //
RxBool agree = false.obs;
RxBool canSendCode = false.obs;//
RxBool canSendCode = false.obs; //
// bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
// bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty && pwd.value.length >= 8 && surePwd.value.length >= 8;
bool get codeIsOK => verificationCode.value.isNotEmpty && verificationCode.value.length >= 6 ;
bool get pwdIsOK =>
pwd.value.isNotEmpty &&
surePwd.value.isNotEmpty &&
pwd.value.length >= 8 &&
surePwd.value.length >= 8;
bool get codeIsOK =>
verificationCode.value.isNotEmpty && verificationCode.value.length >= 6;
RxBool canResend = false.obs;//
RxBool canResend = false.obs; //
RxString btnText = ''.obs;
int totalSeconds = 120;
int currentSecond = 120;
@ -39,9 +47,8 @@ class StarLockRegisterState {
void resetResend() {
canResend.value = totalSeconds == currentSecond;
btnText.value = !canResend.value
? '$currentSecond s'
: btnText.value = '获取验证码'.tr;
btnText.value =
!canResend.value ? '$currentSecond s' : btnText.value = '获取验证码'.tr;
}
void onClose() {

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -74,6 +73,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
height: 80.h,
child: DefaultTabController(
length: 2,
initialIndex: state.isIphoneType.value ? 0 : 1,
child: TabBar(
onTap: (int index) {
state.isIphoneType.value = index == 0;
@ -84,10 +84,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
}),
dividerHeight: 0,
indicatorSize: TabBarIndicatorSize.tab,
tabs: <Widget>[
Text('手机'.tr),
Text('邮箱'.tr)
],
tabs: <Widget>[Text('手机'.tr), Text('邮箱'.tr)],
indicatorColor: AppColors.mainColor,
labelStyle:
TextStyle(color: AppColors.mainColor, fontSize: 26.sp),
@ -144,7 +141,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
logic.checkNext(state.phoneOrEmailController);
},
leftWidget: SizedBox(),
label:state.isIphoneType.value ? '请输入手机号'.tr : '请输入邮箱'.tr,
label: state.isIphoneType.value ? '请输入手机号'.tr : '请输入邮箱'.tr,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(30),
@ -163,7 +160,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
Text(
'密码必须是8-20位至少包括数字/字母/符号中的2种'.tr,
style:
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
),
LoginInput(
controller: state.sureController,
@ -235,32 +232,31 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
Widget _buildBottomAgreement() {
return Padding(
padding: EdgeInsets.only(bottom:20.w),
padding: EdgeInsets.only(bottom: 20.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Obx(() => GestureDetector(
onTap: () {
state.agree.value = !state.agree.value;
logic.changeAgreeState();
},
child: Container(
width: 40.w,
height: 40.w,
// color: Colors.red,
padding: EdgeInsets.only(
left: 5.w,
right: 10.w,
),
child: Image.asset(
state.agree.value
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 20.w,
height: 20.w,
),
)
)),
onTap: () {
state.agree.value = !state.agree.value;
logic.changeAgreeState();
},
child: Container(
width: 40.w,
height: 40.w,
// color: Colors.red,
padding: EdgeInsets.only(
left: 5.w,
right: 10.w,
),
child: Image.asset(
state.agree.value
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 20.w,
height: 20.w,
),
))),
SizedBox(
width: 10.w,
),
@ -268,14 +264,12 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
child: RichText(
text: TextSpan(
text: '我已阅读并同意'.tr,
style:
TextStyle(color: const Color(0xff333333), fontSize: 20.sp),
style: TextStyle(color: const Color(0xff333333), fontSize: 20.sp),
children: <InlineSpan>[
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: GestureDetector(
child: Text(
'${'用户协议'.tr}',
child: Text('${'用户协议'.tr}',
style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () {
@ -289,8 +283,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: GestureDetector(
child: Text(
'${'隐私政策'.tr}',
child: Text('${'隐私政策'.tr}',
style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () {

View File

@ -1,8 +0,0 @@
import '../../../tools/baseGetXController.dart';
import 'addLockSelectCountry_state.dart';
class AddLockSelectCountryLogic extends BaseGetXController {
AddLockSelectCountryState state = AddLockSelectCountryState();
}

View File

@ -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],
// ),
);
}
}

View File

@ -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"];
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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"];
}
}

View File

@ -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();
}
}

View File

@ -1,6 +0,0 @@
import '../../../../tools/baseGetXController.dart';
class LockAddressLogic extends BaseGetXController {
}

View File

@ -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() {
//
}
}

View File

@ -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:

View File

@ -365,15 +365,15 @@ class SaveLockLogic extends BaseGetXController {
void bindBlueAdmin() async {
state.lockInfo['adminPwd'] = state.adminPassword;
final Map<String, dynamic> positionMap = <String, dynamic>{};
positionMap['longitude'] = state.addressInfo['longitude'];
positionMap['latitude'] = state.addressInfo['latitude'];
positionMap['country'] = state.addressInfo['country'];
positionMap['province'] = state.addressInfo['province'];
positionMap['city'] = state.addressInfo['city'];
positionMap['district'] = state.addressInfo['district'];
positionMap['township'] = state.addressInfo['street'];
positionMap['address'] = state.addressInfo['address'];
// final Map<String, dynamic> positionMap = <String, dynamic>{};
// positionMap['longitude'] = state.addressInfo['longitude'];
// positionMap['latitude'] = state.addressInfo['latitude'];
// positionMap['country'] = state.addressInfo['country'];
// positionMap['province'] = state.addressInfo['province'];
// positionMap['city'] = state.addressInfo['city'];
// positionMap['district'] = state.addressInfo['district'];
// positionMap['township'] = state.addressInfo['street'];
// positionMap['address'] = state.addressInfo['address'];
final Map<String, dynamic> bluetooth = <String, dynamic>{};
bluetooth['bluetoothDeviceId'] = BlueManage().connectDeviceMacAddress;
@ -395,7 +395,7 @@ class SaveLockLogic extends BaseGetXController {
final SaveLockEntity entity = await ApiRepository.to.bindingBlueAdmin(
lockAlias: state.aliName.value,
position: positionMap,
position: {},
bluetooth: bluetooth,
lockInfo: state.lockInfo,
lockUserNo: state.lockUserNo.toString(),
@ -505,9 +505,10 @@ class SaveLockLogic extends BaseGetXController {
} else {
eventBus.fire(RefreshLockListInfoDataEvent(clearScanDevices: true,isUnShowLoading: true));
Future<void>.delayed(const Duration(seconds: 1), () {
Get.close(state.isFromMap == 1
? (CommonDataManage().seletLockType == 0 ? 4 : 5)
: (CommonDataManage().seletLockType == 0 ? 5 : 6));
// Get.close(state.isFromMap == 1
// ? (CommonDataManage().seletLockType == 0 ? 4 : 5)
// : (CommonDataManage().seletLockType == 0 ? 5 : 6));
Get.until((route) => route.isFirst);
});
// 2
Future<void>.delayed(const Duration(milliseconds: 200), () {
@ -521,9 +522,10 @@ class SaveLockLogic extends BaseGetXController {
} else {
eventBus.fire(RefreshLockListInfoDataEvent(clearScanDevices: true,isUnShowLoading: true));
Future<void>.delayed(const Duration(seconds: 1), () {
Get.close(state.isFromMap == 1
? (CommonDataManage().seletLockType == 0 ? 4 : 5)
: (CommonDataManage().seletLockType == 0 ? 5 : 6));
// Get.close(state.isFromMap == 1
// ? (CommonDataManage().seletLockType == 0 ? 4 : 5)
// : (CommonDataManage().seletLockType == 0 ? 5 : 6));
Get.until((route) => route.isFirst);
});
// 2
Future<void>.delayed(const Duration(milliseconds: 200), () {

View File

@ -15,17 +15,31 @@ class SaveLockState {
adminPassword = getAdminPassword();
final Map map = Get.arguments;
if (map['pwdTimestamp']!= null) {
pwdTimestamp.value = map['pwdTimestamp'];
addressInfo.value = map['addressInfo'];
}
// 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'];
isFromMap = map['isFromMap'];
}
// if (map['isFromMap'] != null) {
// isFromMap = map['isFromMap'];
// }
}
RxString aliName = ''.obs;
RxInt pwdTimestamp = 0.obs;
RxMap addressInfo = {}.obs;
// RxMap addressInfo = {}.obs;
final Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
TextEditingController aliNameController = TextEditingController();
FocusNode focusNode = FocusNode();
@ -35,7 +49,7 @@ class SaveLockState {
String featureValue = '';
String featureSettingValue = '';
List featureSettingParams = [];
int isFromMap = 0; // 0: 1:
// int isFromMap = 0; // 0: 1:
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs; // 0 1

View File

@ -1,5 +1,7 @@
import 'dart:async';
import 'package:flutter_app_badger/flutter_app_badger.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../network/api_repository.dart';
import '../../../tools/eventBusEventManage.dart';
@ -46,6 +48,8 @@ class MessageListLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
pageNo = 1;
messageListDataRequest();
//
FlutterAppBadger.removeBadge();
}
}

View File

@ -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发现网络的相关信息并且进行相应的配置
@ -275,6 +275,8 @@ dependencies:
provider: ^6.1.2
dio: ^4.0.6 # 网络请求库
video_thumbnail: ^0.5.3
# 角标管理
flutter_app_badger: ^1.3.0