Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
This commit is contained in:
commit
694b576894
@ -45,8 +45,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _resetCanNext() {
|
void _resetCanNext() {
|
||||||
state.canNext.value =
|
state.canNext.value = state.pwdIsOK && state.isEmailOrPhone;
|
||||||
state.pwdIsOK && state.isEmailOrPhone && state.agree.value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
|
import 'package:flutter/cupertino.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:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/flavors.dart';
|
||||||
|
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||||
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
|
||||||
import '../../appRouters.dart';
|
import '../../appRouters.dart';
|
||||||
import '../../app_settings/app_colors.dart';
|
import '../../app_settings/app_colors.dart';
|
||||||
@ -165,7 +169,12 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
isDisabled: state.canNext.value,
|
isDisabled: state.canNext.value,
|
||||||
onClick: state.canNext.value
|
onClick: state.canNext.value
|
||||||
? () {
|
? () {
|
||||||
logic.login();
|
if (state.agree.value == false) {
|
||||||
|
logic.showToast('请先同意用户协议及隐私政策');
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
logic.login();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
: null)),
|
: null)),
|
||||||
SizedBox(height: 50.w),
|
SizedBox(height: 50.w),
|
||||||
@ -193,21 +202,25 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 10.sp,
|
width: 10.sp,
|
||||||
)),
|
)),
|
||||||
GestureDetector(
|
//上架审核注释 提交Google暂时屏蔽
|
||||||
child: SizedBox(
|
F.appFlavor == Flavor.sky
|
||||||
// width: 150.w,
|
? Container()
|
||||||
height: 50.h,
|
: GestureDetector(
|
||||||
// color: Colors.red,
|
child: SizedBox(
|
||||||
child: Center(
|
// width: 150.w,
|
||||||
child: Text('演示模式',
|
height: 50.h,
|
||||||
style: TextStyle(
|
// color: Colors.red,
|
||||||
fontSize: 22.sp, color: AppColors.mainColor)),
|
child: Center(
|
||||||
),
|
child: Text('演示模式',
|
||||||
),
|
style: TextStyle(
|
||||||
onTap: () {
|
fontSize: 22.sp,
|
||||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
color: AppColors.mainColor)),
|
||||||
},
|
),
|
||||||
)
|
),
|
||||||
|
onTap: () {
|
||||||
|
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||||
|
},
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../tools/store_service.dart';
|
|
||||||
|
|
||||||
class StarLockLoginState {
|
class StarLockLoginState {
|
||||||
var passwordShow = true.obs;
|
var passwordShow = true.obs;
|
||||||
var agree = false.obs;
|
var agree = false.obs;
|
||||||
|
|||||||
@ -30,11 +30,11 @@ class StarLockRegisterLogic extends BaseGetXController {
|
|||||||
|
|
||||||
void register() async {
|
void register() async {
|
||||||
var entity = await ApiRepository.to.register(
|
var entity = await ApiRepository.to.register(
|
||||||
receiverType:state.isIphoneType.value == true ? 1 : 2,
|
receiverType: state.isIphoneType.value == true ? 1 : 2,
|
||||||
countryCode:state.countryCode.value,
|
countryCode: state.countryCode.value,
|
||||||
account:state.phoneOrEmailStr.value,
|
account: state.phoneOrEmailStr.value,
|
||||||
password:state.pwd.value,
|
password: state.pwd.value,
|
||||||
verificationCode:state.verificationCode.value);
|
verificationCode: state.verificationCode.value);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
// await loginSuccess(loginEntity: entity);
|
// await loginSuccess(loginEntity: entity);
|
||||||
// Toast.show(msg: "注册成功");
|
// Toast.show(msg: "注册成功");
|
||||||
@ -46,16 +46,18 @@ class StarLockRegisterLogic extends BaseGetXController {
|
|||||||
void sendValidationCode() async {
|
void sendValidationCode() async {
|
||||||
var entity = await ApiRepository.to.sendValidationCode(
|
var entity = await ApiRepository.to.sendValidationCode(
|
||||||
// state.countryCode.value,
|
// state.countryCode.value,
|
||||||
countryCode:state.countryCode.value.toString(),
|
countryCode: state.countryCode.value.toString(),
|
||||||
account:state.phoneOrEmailStr.value,
|
account: state.phoneOrEmailStr.value,
|
||||||
channel:state.isIphoneType.value ? "1" : "2",
|
channel: state.isIphoneType.value ? "1" : "2",
|
||||||
codeType:'1',
|
codeType: '1',
|
||||||
xWidth:state.xWidth.value.toString());
|
xWidth: state.xWidth.value.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
_startTimer();
|
_startTimer();
|
||||||
} else {
|
} else {}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
void changeAgreeState() {
|
||||||
|
_resetCanSub();
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkNext(TextEditingController controller) {
|
void checkNext(TextEditingController controller) {
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
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';
|
||||||
@ -51,7 +50,12 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
isDisabled: state.canSub.value,
|
isDisabled: state.canSub.value,
|
||||||
onClick: state.canSub.value
|
onClick: state.canSub.value
|
||||||
? () {
|
? () {
|
||||||
logic.register();
|
if (state.agree.value == false) {
|
||||||
|
logic.showToast('请先同意用户协议及隐私政策');
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
logic.register();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
: null);
|
: null);
|
||||||
}),
|
}),
|
||||||
@ -294,7 +298,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
"countryCode": state.countryCode,
|
"countryCode": state.countryCode,
|
||||||
"account": state.phoneOrEmailStr.value
|
"account": state.phoneOrEmailStr.value
|
||||||
});
|
});
|
||||||
state.xWidth.value = (result as Map<String, dynamic>)['xWidth'];
|
state.xWidth.value =
|
||||||
|
(result as Map<String, dynamic>)['xWidth'];
|
||||||
logic.sendValidationCode();
|
logic.sendValidationCode();
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
@ -303,7 +308,9 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
height: 60.h,
|
height: 60.h,
|
||||||
padding: EdgeInsets.all(5.h),
|
padding: EdgeInsets.all(5.h),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: state.phoneOrEmailStrIsOK.value ? AppColors.mainColor : Colors.grey,
|
color: state.phoneOrEmailStrIsOK.value
|
||||||
|
? AppColors.mainColor
|
||||||
|
: Colors.grey,
|
||||||
borderRadius: BorderRadius.circular(5)),
|
borderRadius: BorderRadius.circular(5)),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(state.btnText.value,
|
child: Text(state.btnText.value,
|
||||||
@ -326,15 +333,18 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Obx(() => GestureDetector(
|
||||||
'images/icon_select_circle.png',
|
onTap: () {
|
||||||
width: 28.w,
|
state.agree.value = !state.agree.value;
|
||||||
height: 28.w,
|
logic.changeAgreeState();
|
||||||
),
|
},
|
||||||
// SizedBox(
|
child: Image.asset(
|
||||||
// height: 20.h,
|
state.agree.value
|
||||||
// width: 26.w,
|
? 'images/icon_round_select.png'
|
||||||
// child: Checkbox(value: false, onChanged: (value) {})),
|
: 'images/icon_round_unSelect.png',
|
||||||
|
width: 30.w,
|
||||||
|
height: 30.w,
|
||||||
|
))),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 15.w,
|
width: 15.w,
|
||||||
),
|
),
|
||||||
@ -352,11 +362,10 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.mainColor, fontSize: 20.sp)),
|
color: AppColors.mainColor, fontSize: 20.sp)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.toNamed(Routers.webviewShowPage,
|
Get.toNamed(Routers.webviewShowPage, arguments: {
|
||||||
arguments: {
|
"url": XSConstantMacro.userAgreementURL,
|
||||||
"url": XSConstantMacro.userAgreementURL,
|
"title": '用户协议'
|
||||||
"title": '用户协议'
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
@ -368,9 +377,9 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
color: AppColors.mainColor, fontSize: 20.sp)),
|
color: AppColors.mainColor, fontSize: 20.sp)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.toNamed(Routers.webviewShowPage, arguments: {
|
Get.toNamed(Routers.webviewShowPage, arguments: {
|
||||||
"url": XSConstantMacro.privacyPolicyURL,
|
"url": XSConstantMacro.privacyPolicyURL,
|
||||||
"title": '隐私政策'
|
"title": '隐私政策'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -21,6 +21,7 @@ class StarLockRegisterState {
|
|||||||
var xWidth = ''.obs; // 滑动验证码滑动位置
|
var xWidth = ''.obs; // 滑动验证码滑动位置
|
||||||
var isIphoneType = true.obs;
|
var isIphoneType = true.obs;
|
||||||
var canSub = false.obs;
|
var canSub = false.obs;
|
||||||
|
var agree = false.obs;
|
||||||
|
|
||||||
bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
|
bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
|
||||||
bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
|
bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
import 'app.dart';
|
import 'app.dart';
|
||||||
import 'package:star_lock/tools/device_info_service.dart';
|
import 'package:star_lock/tools/device_info_service.dart';
|
||||||
@ -20,22 +21,27 @@ FutureOr<void> main() async {
|
|||||||
|
|
||||||
if (AppPlatform.isAndroid) {
|
if (AppPlatform.isAndroid) {
|
||||||
SystemUiOverlayStyle systemUiOverlayStyle =
|
SystemUiOverlayStyle systemUiOverlayStyle =
|
||||||
const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
|
const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
|
||||||
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
|
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置国际化信息
|
// 设置国际化信息
|
||||||
Future _initTranslation() async => TranslationLoader.loadTranslation(
|
Future _initTranslation() async => TranslationLoader.loadTranslation(
|
||||||
zhSource: "images/lan/lan_zh.json",
|
zhSource: "images/lan/lan_zh.json",
|
||||||
enSource: "images/lan/lan_en.json",
|
enSource: "images/lan/lan_en.json",
|
||||||
keySource: "images/lan/lan_keys.json",
|
keySource: "images/lan/lan_keys.json",
|
||||||
);
|
);
|
||||||
|
|
||||||
// 设置包名服务设备信息
|
// 设置包名服务设备信息
|
||||||
Future _setCommonServices() async {
|
Future _setCommonServices() async {
|
||||||
await Get.putAsync(() => StoreService().init());
|
await Get.putAsync(() => StoreService().init());
|
||||||
await Get.putAsync(() => PlatformInfoService().init());
|
await Get.putAsync(() => PlatformInfoService().init());
|
||||||
await Get.putAsync(() => DeviceInfoService().init());
|
if (F.appFlavor == Flavor.sky) {
|
||||||
|
//上架审核注释 获取设备信息
|
||||||
|
// await Get.putAsync(() => DeviceInfoService().init());
|
||||||
|
} else {
|
||||||
|
await Get.putAsync(() => DeviceInfoService().init());
|
||||||
|
}
|
||||||
// Get.log(PlatformInfoService.to.info.version);
|
// Get.log(PlatformInfoService.to.info.version);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -397,12 +397,13 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
// SizedBox(
|
// SizedBox(
|
||||||
// height: 10.h,
|
// height: 10.h,
|
||||||
// ),
|
// ),
|
||||||
OutLineBtn(
|
//田总说不要标记为已入住
|
||||||
btnName: '标记为已入住',
|
// OutLineBtn(
|
||||||
onClick: () {
|
// btnName: '标记为已入住',
|
||||||
updateRoomCheckIn();
|
// onClick: () {
|
||||||
},
|
// updateRoomCheckIn();
|
||||||
),
|
// },
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
@ -21,7 +20,6 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -45,8 +43,9 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
|
|||||||
barTitle: F.navTitle,
|
barTitle: F.navTitle,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: LockDetailPage(isOnlyOneData:isOnlyOneData, lockListInfoItemEntity: keyInfos),
|
body: LockDetailPage(
|
||||||
// body: Container(),
|
isOnlyOneData: isOnlyOneData, lockListInfoItemEntity: keyInfos),
|
||||||
|
// body: Container(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
|||||||
// 根据权限显示不同的列表
|
// 根据权限显示不同的列表
|
||||||
List<Widget> getListWidget() {
|
List<Widget> getListWidget() {
|
||||||
// print("state.lockBasicInfo.value.isLockOwner:${state.lockBasicInfo.value.isLockOwner} state.lockBasicInfo.value.keyRight:${state.lockBasicInfo.value.keyRight}");
|
// print("state.lockBasicInfo.value.isLockOwner:${state.lockBasicInfo.value.isLockOwner} state.lockBasicInfo.value.keyRight:${state.lockBasicInfo.value.keyRight}");
|
||||||
if (state.lockBasicInfo.value.isLockOwner == 1 || state.lockBasicInfo.value.keyRight == 1) {
|
if (state.lockBasicInfo.value.isLockOwner == 1 ||
|
||||||
|
state.lockBasicInfo.value.keyRight == 1) {
|
||||||
// 超级管理员、授权管理员
|
// 超级管理员、授权管理员
|
||||||
return getAllWidget();
|
return getAllWidget();
|
||||||
} else {
|
} else {
|
||||||
@ -449,26 +450,26 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
|||||||
//-----新增至此
|
//-----新增至此
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
// 标记房态
|
// 标记房态
|
||||||
Obx(() {
|
// Obx(() {
|
||||||
var title = "";
|
// var title = "";
|
||||||
if (state.lockStatus.value.roomStatus == 1) {
|
// if (state.lockStatus.value.roomStatus == 1) {
|
||||||
title = TranslationLoader.lanKeys!.checkedIn!.tr;
|
// title = TranslationLoader.lanKeys!.checkedIn!.tr;
|
||||||
} else if (state.lockStatus.value.roomStatus == 0) {
|
// } else if (state.lockStatus.value.roomStatus == 0) {
|
||||||
title = TranslationLoader.lanKeys!.leisure!.tr;
|
// title = TranslationLoader.lanKeys!.leisure!.tr;
|
||||||
}
|
// }
|
||||||
return Visibility(
|
// return Visibility(
|
||||||
visible: state.lockStatus.value.roomStatus == 1 ? true : false,
|
// visible: state.lockStatus.value.roomStatus == 1 ? true : false,
|
||||||
child: CommonItem(
|
// child: CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.markedHouseState!.tr,
|
// leftTitel: TranslationLoader.lanKeys!.markedHouseState!.tr,
|
||||||
rightTitle: title,
|
// rightTitle: title,
|
||||||
isHaveLine: true,
|
// isHaveLine: true,
|
||||||
isHaveDirection: true,
|
// isHaveDirection: true,
|
||||||
action: () {
|
// action: () {
|
||||||
Get.toNamed(Routers.markedHouseStatePage, arguments: {
|
// Get.toNamed(Routers.markedHouseStatePage, arguments: {
|
||||||
'lockSetInfoData': state.lockSetInfoData.value
|
// 'lockSetInfoData': state.lockSetInfoData.value
|
||||||
});
|
// });
|
||||||
}));
|
// }));
|
||||||
}),
|
// }),
|
||||||
// 考勤
|
// 考勤
|
||||||
Obx(
|
Obx(
|
||||||
() => Visibility(
|
() => Visibility(
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
@ -19,12 +18,10 @@ class DemoModeLockSetPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -43,7 +40,7 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
|||||||
// 基本信息
|
// 基本信息
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
TranslationLoader.lanKeys!.basicInformation!.tr,
|
TranslationLoader.lanKeys!.basicInformation!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
@ -53,7 +50,9 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
|||||||
// 'keyInfo': state.getKeyInfosData.value
|
// 'keyInfo': state.getKeyInfosData.value
|
||||||
// });
|
// });
|
||||||
}),
|
}),
|
||||||
SizedBox(height: 10.h,),
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
// 门磁
|
// 门磁
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.doorMagnetic!.tr,
|
leftTitel: TranslationLoader.lanKeys!.doorMagnetic!.tr,
|
||||||
@ -68,7 +67,7 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
|||||||
// 无线键盘
|
// 无线键盘
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
|
TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
@ -99,7 +98,7 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
|||||||
// 自动闭锁
|
// 自动闭锁
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
TranslationLoader.lanKeys!.automaticBlocking!.tr,
|
TranslationLoader.lanKeys!.automaticBlocking!.tr,
|
||||||
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
@ -133,7 +132,7 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
|||||||
// 常开模式
|
// 常开模式
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
TranslationLoader.lanKeys!.normallyOpenMode!.tr,
|
TranslationLoader.lanKeys!.normallyOpenMode!.tr,
|
||||||
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
@ -216,23 +215,22 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
|||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
//-----新增至此
|
//-----新增至此
|
||||||
// 标记房态
|
// 标记房态
|
||||||
CommonItem(
|
// CommonItem(
|
||||||
leftTitel:
|
// leftTitel:
|
||||||
TranslationLoader.lanKeys!.markedHouseState!.tr,
|
// TranslationLoader.lanKeys!.markedHouseState!.tr,
|
||||||
rightTitle: "",
|
// rightTitle: "",
|
||||||
isHaveLine: true,
|
// isHaveLine: true,
|
||||||
isHaveDirection: true,
|
// isHaveDirection: true,
|
||||||
action: () {
|
// action: () {
|
||||||
gotoAddLock();
|
// gotoAddLock();
|
||||||
}),
|
// }),
|
||||||
// 考勤
|
// 考勤
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
|
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: _openCheckInSwitch()
|
rightWidget: _openCheckInSwitch()),
|
||||||
),
|
|
||||||
// 开锁提醒
|
// 开锁提醒
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
|
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
|
||||||
@ -304,7 +302,8 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
|||||||
}),
|
}),
|
||||||
SizedBox(height: 30.h),
|
SizedBox(height: 30.h),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 30.h),
|
padding:
|
||||||
|
EdgeInsets.only(left: 20.w, right: 20.w, bottom: 30.h),
|
||||||
child: SubmitBtn(
|
child: SubmitBtn(
|
||||||
btnName: "退出演示模式",
|
btnName: "退出演示模式",
|
||||||
isDelete: true,
|
isDelete: true,
|
||||||
@ -343,9 +342,8 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gotoAddLock(){
|
void gotoAddLock() {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
EasyLoading.showToast("演示模式",duration: 2000.milliseconds);
|
EasyLoading.showToast("演示模式", duration: 2000.milliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -205,12 +205,15 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 160.h,
|
height: 160.h,
|
||||||
),
|
),
|
||||||
SubmitBtn(
|
//上架审核注释 提交Google暂时屏蔽
|
||||||
btnName: '演示模式',
|
F.appFlavor == Flavor.sky
|
||||||
onClick: () {
|
? Container()
|
||||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
: SubmitBtn(
|
||||||
},
|
btnName: '演示模式',
|
||||||
)
|
onClick: () {
|
||||||
|
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||||
|
},
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -13,12 +13,12 @@ class StarLockMinePage extends StatefulWidget {
|
|||||||
const StarLockMinePage({Key? key}) : super(key: key);
|
const StarLockMinePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StarLockMinePage> createState() => _StarLockMinePageState();
|
State<StarLockMinePage> createState() => StarLockMinePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalKey<_StarLockMinePageState> starLockMineKey = GlobalKey();
|
GlobalKey<StarLockMinePageState> starLockMineKey = GlobalKey();
|
||||||
|
|
||||||
class _StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||||
final logic = Get.put(StarLockMineLogic());
|
final logic = Get.put(StarLockMineLogic());
|
||||||
final state = Get.find<StarLockMineLogic>().state;
|
final state = Get.find<StarLockMineLogic>().state;
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
||||||
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
||||||
@ -69,7 +70,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
action: () {
|
action: () {
|
||||||
_openModalBottomSheet();
|
requestCameraPermission();
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
@ -169,6 +170,51 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> requestCameraPermission() async {
|
||||||
|
// 检查是否已经授予相机权限
|
||||||
|
PermissionStatus status = await Permission.camera.status;
|
||||||
|
|
||||||
|
if (status.isGranted) {
|
||||||
|
// 如果权限已经被授予,执行您的相机操作
|
||||||
|
// 这里可以调用打开相机的方法或者跳转到相机页面等
|
||||||
|
_openModalBottomSheet();
|
||||||
|
} else {
|
||||||
|
// 如果权限尚未被授予,请求相机权限
|
||||||
|
// 此处会显示系统权限请求对话框
|
||||||
|
status = await Permission.camera.request();
|
||||||
|
|
||||||
|
if (status.isGranted) {
|
||||||
|
// 如果用户授予了相机权限,执行您的相机操作
|
||||||
|
_openModalBottomSheet();
|
||||||
|
} else {
|
||||||
|
// 如果用户拒绝了相机权限,您可以提供适当的提示
|
||||||
|
// 或者引导用户手动授予权限
|
||||||
|
_showPermissinDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future _showPermissinDialog() async {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('Permission Required'),
|
||||||
|
content: const Text(
|
||||||
|
'You need to grant camera permission to use this feature.'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text('OK'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future _openModalBottomSheet() async {
|
Future _openModalBottomSheet() async {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.dart';
|
import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.dart';
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
@ -184,30 +185,37 @@ class _MineSetPageState extends State<MineSetPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
CommonItem(
|
//上架审核注释
|
||||||
leftTitel: "Amazon Alexa",
|
F.appFlavor == Flavor.sky
|
||||||
rightTitle: "",
|
? Container()
|
||||||
isHaveLine: true,
|
: CommonItem(
|
||||||
isHaveDirection: true,
|
leftTitel: "Amazon Alexa",
|
||||||
action: () {
|
rightTitle: "",
|
||||||
logic.showToast("功能暂未开放");
|
isHaveLine: true,
|
||||||
}),
|
isHaveDirection: true,
|
||||||
CommonItem(
|
action: () {
|
||||||
leftTitel: "Google Home",
|
logic.showToast("功能暂未开放");
|
||||||
rightTitle: "",
|
}),
|
||||||
isHaveLine: true,
|
F.appFlavor == Flavor.sky
|
||||||
isHaveDirection: true,
|
? Container()
|
||||||
action: () {
|
: CommonItem(
|
||||||
logic.showToast("功能暂未开放");
|
leftTitel: "Google Home",
|
||||||
}),
|
rightTitle: "",
|
||||||
CommonItem(
|
isHaveLine: true,
|
||||||
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,
|
isHaveDirection: true,
|
||||||
rightTitle: "",
|
action: () {
|
||||||
isHaveLine: false,
|
logic.showToast("功能暂未开放");
|
||||||
isHaveDirection: true,
|
}),
|
||||||
action: () {
|
F.appFlavor == Flavor.sky
|
||||||
logic.showToast("功能暂未开放");
|
? Container()
|
||||||
}),
|
: CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: false,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
logic.showToast("功能暂未开放");
|
||||||
|
}),
|
||||||
// CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){
|
||||||
//
|
//
|
||||||
// }),
|
// }),
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_state.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
class ValueAddedServicesBuyLogic extends BaseGetXController {
|
||||||
|
final ValueAddedServicesBuyState state = ValueAddedServicesBuyState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onReady() async {
|
||||||
|
print("ready home");
|
||||||
|
super.onReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
print("init home");
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
print("close home");
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_logic.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
import '../../../translations/trans_lib.dart';
|
import '../../../translations/trans_lib.dart';
|
||||||
@ -16,17 +16,13 @@ class ValueAddedServicesBuyPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ValueAddedServicesBuyPageState extends State<ValueAddedServicesBuyPage> {
|
class _ValueAddedServicesBuyPageState extends State<ValueAddedServicesBuyPage> {
|
||||||
final data = [
|
|
||||||
"1",
|
|
||||||
"2",
|
|
||||||
"3",
|
|
||||||
"4",
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var type = ModalRoute.of(context)?.settings.arguments as int;
|
var type = ModalRoute.of(context)?.settings.arguments as int;
|
||||||
|
|
||||||
|
final logic = Get.put(ValueAddedServicesBuyLogic());
|
||||||
|
final state = Get.find<ValueAddedServicesBuyLogic>().state;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.greyBackgroundColor,
|
backgroundColor: AppColors.greyBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -59,7 +55,9 @@ class _ValueAddedServicesBuyPageState extends State<ValueAddedServicesBuyPage> {
|
|||||||
mainAxisSpacing: 10.h,
|
mainAxisSpacing: 10.h,
|
||||||
crossAxisSpacing: 10.w,
|
crossAxisSpacing: 10.w,
|
||||||
childAspectRatio: 1 / 0.5,
|
childAspectRatio: 1 / 0.5,
|
||||||
children: data.map((title) => _buildItem(title)).toList(),
|
children: state.topData.value
|
||||||
|
.map((title) => _buildItem(title))
|
||||||
|
.toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -123,16 +121,21 @@ class _ValueAddedServicesBuyPageState extends State<ValueAddedServicesBuyPage> {
|
|||||||
color: AppColors.mainColor,
|
color: AppColors.mainColor,
|
||||||
fontWeight: FontWeight.w500))),
|
fontWeight: FontWeight.w500))),
|
||||||
SizedBox(width: 5.w),
|
SizedBox(width: 5.w),
|
||||||
Container(
|
GestureDetector(
|
||||||
width: 180.w,
|
onTap: () {
|
||||||
height: 100.h,
|
logic.showToast("支付成功");
|
||||||
color: AppColors.mainColor,
|
},
|
||||||
child: Center(
|
child: Container(
|
||||||
child: Text(TranslationLoader.lanKeys!.goToPay!.tr,
|
width: 180.w,
|
||||||
style: TextStyle(
|
height: 100.h,
|
||||||
fontSize: 24.sp,
|
color: AppColors.mainColor,
|
||||||
color: Colors.white,
|
child: Center(
|
||||||
fontWeight: FontWeight.w500))))
|
child: Text(TranslationLoader.lanKeys!.goToPay!.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24.sp,
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.w500)))),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class ValueAddedServicesBuyState {
|
||||||
|
final topData = [
|
||||||
|
"1",
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"4",
|
||||||
|
].obs;
|
||||||
|
|
||||||
|
void onClose() {}
|
||||||
|
}
|
||||||
@ -152,8 +152,8 @@ class _ValueAddedServicesHighFunctionPageState
|
|||||||
TranslationLoader.lanKeys!.lockGroup!.tr),
|
TranslationLoader.lanKeys!.lockGroup!.tr),
|
||||||
_buildItem("images/mine/icon_mine_highFunctionContent_bjft.png",
|
_buildItem("images/mine/icon_mine_highFunctionContent_bjft.png",
|
||||||
TranslationLoader.lanKeys!.sendGroupKey!.tr),
|
TranslationLoader.lanKeys!.sendGroupKey!.tr),
|
||||||
_buildItem("images/mine/icon_mine_highFunctionContent_bjft.png",
|
// _buildItem("images/mine/icon_mine_highFunctionContent_bjft.png",
|
||||||
TranslationLoader.lanKeys!.markedHouseState!.tr),
|
// TranslationLoader.lanKeys!.markedHouseState!.tr),
|
||||||
_buildItem("images/mine/icon_mine_highFunctionContent_fkgj.png",
|
_buildItem("images/mine/icon_mine_highFunctionContent_fkgj.png",
|
||||||
TranslationLoader.lanKeys!.cardIssuingtool!.tr),
|
TranslationLoader.lanKeys!.cardIssuingtool!.tr),
|
||||||
_buildItem(
|
_buildItem(
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../tools/commonItem.dart';
|
import '../../../tools/commonItem.dart';
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
@ -92,9 +90,9 @@ class _ValueAddedServicesRealNamePageState
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pushNamed(
|
// Navigator.pushNamed(
|
||||||
context, Routers.valueAddedServicesBuyPage,
|
// context, Routers.valueAddedServicesBuyPage,
|
||||||
arguments: 3);
|
// arguments: 3);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 200.w,
|
width: 200.w,
|
||||||
@ -103,7 +101,8 @@ class _ValueAddedServicesRealNamePageState
|
|||||||
child: Center(
|
child: Center(
|
||||||
child: Text(TranslationLoader.lanKeys!.buy!.tr,
|
child: Text(TranslationLoader.lanKeys!.buy!.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.mainColor,
|
// color: AppColors.mainColor,
|
||||||
|
color: AppColors.blackColor,
|
||||||
fontSize: 24.sp)))),
|
fontSize: 24.sp)))),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -4,16 +4,13 @@ import 'package:get/get.dart';
|
|||||||
import 'package:get/get_connect/http/src/request/request.dart';
|
import 'package:get/get_connect/http/src/request/request.dart';
|
||||||
import 'package:star_lock/login/login/entity/LoginData.dart';
|
import 'package:star_lock/login/login/entity/LoginData.dart';
|
||||||
|
|
||||||
import '../login/login/entity/LoginData.dart';
|
|
||||||
import '../login/login/entity/LoginEntity.dart';
|
|
||||||
import '../tools/platform_info_services.dart';
|
import '../tools/platform_info_services.dart';
|
||||||
import '../tools/storage.dart';
|
import '../tools/storage.dart';
|
||||||
import '../tools/store_service.dart';
|
|
||||||
|
|
||||||
FutureOr<Request> requestInterceptor(Request request) async {
|
FutureOr<Request> requestInterceptor(Request request) async {
|
||||||
request.headers['User-Agent'] =
|
request.headers['User-Agent'] =
|
||||||
'StarLock/${PlatformInfoService.to.info.version}/${PlatformInfoService.to.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}';
|
'StarLock/${PlatformInfoService.to.info.version}/${PlatformInfoService.to.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}';
|
||||||
request.headers['Accept-Language'] = 'zh_CN';
|
request.headers['Accept-Language'] = 'zh-CN';
|
||||||
// request.headers['Content-Type'] = 'application/json';
|
// request.headers['Content-Type'] = 'application/json';
|
||||||
// request.headers['token'] = StoreService.to.userToken!;
|
// request.headers['token'] = StoreService.to.userToken!;
|
||||||
// print("11111${StoreService.to.userToken}");
|
// print("11111${StoreService.to.userToken}");
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:star_lock/login/login/starLock_login_page.dart';
|
||||||
|
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||||
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
|
||||||
import '../main/lockMian/lockMain/lockMain_page.dart';
|
import '../main/lockMian/lockMain/lockMain_page.dart';
|
||||||
|
|
||||||
|
|
||||||
class StarLockApplication extends StatefulWidget {
|
class StarLockApplication extends StatefulWidget {
|
||||||
const StarLockApplication({Key? key}) : super(key: key);
|
const StarLockApplication({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@ -12,11 +13,37 @@ class StarLockApplication extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _StarLockApplicationState extends State<StarLockApplication> {
|
class _StarLockApplicationState extends State<StarLockApplication> {
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// return NavPages();
|
AppFirstEnterHandle().getAppFirstEnter(context);
|
||||||
return const StarLockMainPage();
|
|
||||||
|
return FutureBuilder<bool>(
|
||||||
|
future: getLoginStatus(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
// 如果异步操作尚未完成,返回一个加载指示器或其他等待状态的小部件
|
||||||
|
return const CircularProgressIndicator();
|
||||||
|
} else if (snapshot.hasData) {
|
||||||
|
if (snapshot.data!) {
|
||||||
|
// 如果用户已登录,返回主页面
|
||||||
|
return const StarLockMainPage();
|
||||||
|
} else {
|
||||||
|
// 如果用户未登录,返回登录页面
|
||||||
|
return const StarLockLoginPage();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果没有数据,返回一个空白的小部件
|
||||||
|
return const StarLockLoginPage();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> getLoginStatus() async {
|
||||||
|
final data = await Storage.getString(saveUserLoginData);
|
||||||
|
if (data != null && data.isNotEmpty) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
94
star_lock/lib/tools/appFirstEnterHandle.dart
Normal file
94
star_lock/lib/tools/appFirstEnterHandle.dart
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
class AppFirstEnterHandle {
|
||||||
|
Future getAppFirstEnter(BuildContext widgetContext) async {
|
||||||
|
var isFirstTime = await Storage.getString(isFirstEnter);
|
||||||
|
if (isFirstTime != isFirstEnter) {
|
||||||
|
showPrivacyAgreementAlert(widgetContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//隐私协议弹窗
|
||||||
|
void showPrivacyAgreementAlert(BuildContext widgetContext) {
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: widgetContext,
|
||||||
|
builder: (context) {
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
title: const Text('用户协议和隐私政策概要\n'),
|
||||||
|
content: Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
text: '感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读',
|
||||||
|
style: const TextStyle(fontSize: 16.0),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: '《用户协议》',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.blue, decoration: TextDecoration.underline),
|
||||||
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
// 处理用户协议点击事件
|
||||||
|
_launchURL(XSConstantMacro.userAgreementURL);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const TextSpan(text: '和'),
|
||||||
|
TextSpan(
|
||||||
|
text: '《隐私政策》',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.blue, decoration: TextDecoration.underline),
|
||||||
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
// 处理隐私政策点击事件
|
||||||
|
_launchURL(XSConstantMacro.privacyPolicyURL);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const TextSpan(
|
||||||
|
text:
|
||||||
|
'的全部内容。点击“同意”即表示您同意并接受全部条款。若选择不同意,将无法使用我们的产品和服务,并会退出应用。'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: const Text(
|
||||||
|
'不同意',
|
||||||
|
style: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
_exitApp();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: const Text(
|
||||||
|
'同意',
|
||||||
|
style: TextStyle(color: Colors.blue),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Storage.setString(isFirstEnter, isFirstEnter);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_launchURL(String url) async {
|
||||||
|
if (await canLaunchUrl(Uri.parse(url))) {
|
||||||
|
await launchUrl(Uri.parse(url));
|
||||||
|
} else {
|
||||||
|
throw '无法打开链接 $url';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _exitApp() {
|
||||||
|
exit(0); // 退出应用程序
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -15,6 +15,7 @@ const saveBlueToken = "BlueGetToken";
|
|||||||
const currentConnectionLockId = "CurrentConnectionLockId";
|
const currentConnectionLockId = "CurrentConnectionLockId";
|
||||||
const currentConnectionMacAddress = "CurrentConnectionMacAddress";
|
const currentConnectionMacAddress = "CurrentConnectionMacAddress";
|
||||||
const ifIsDemoModeOrNot = "IfIsDemoModeOrNot";
|
const ifIsDemoModeOrNot = "IfIsDemoModeOrNot";
|
||||||
|
const isFirstEnter = "isFirstEnter"; //是否首次进入应用
|
||||||
|
|
||||||
const saveUserLoginData = "userLoginData";
|
const saveUserLoginData = "userLoginData";
|
||||||
|
|
||||||
@ -182,5 +183,4 @@ class Storage {
|
|||||||
static Future<void> saveLoginData(LoginData? data) async {
|
static Future<void> saveLoginData(LoginData? data) async {
|
||||||
await Storage.setString(saveUserLoginData, jsonEncode(data));
|
await Storage.setString(saveUserLoginData, jsonEncode(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,7 +125,7 @@ dependencies:
|
|||||||
image_gallery_saver: ^2.0.3
|
image_gallery_saver: ^2.0.3
|
||||||
convert: ^3.1.1
|
convert: ^3.1.1
|
||||||
just_audio: ^0.9.36
|
just_audio: ^0.9.36
|
||||||
flutter_sound: ^9.2.13
|
# flutter_sound: ^9.2.13
|
||||||
# ffmpeg_kit_flutter: 5.1.0-LTS
|
# ffmpeg_kit_flutter: 5.1.0-LTS
|
||||||
fast_gbk: ^1.0.0
|
fast_gbk: ^1.0.0
|
||||||
flutter_pcm_sound: ^1.1.0
|
flutter_pcm_sound: ^1.1.0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user