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() {
|
||||
state.canNext.value =
|
||||
state.pwdIsOK && state.isEmailOrPhone && state.agree.value;
|
||||
state.canNext.value = state.pwdIsOK && state.isEmailOrPhone;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
import 'package:flutter/cupertino.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/flavors.dart';
|
||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
@ -165,7 +169,12 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
isDisabled: state.canNext.value,
|
||||
onClick: state.canNext.value
|
||||
? () {
|
||||
logic.login();
|
||||
if (state.agree.value == false) {
|
||||
logic.showToast('请先同意用户协议及隐私政策');
|
||||
return;
|
||||
} else {
|
||||
logic.login();
|
||||
}
|
||||
}
|
||||
: null)),
|
||||
SizedBox(height: 50.w),
|
||||
@ -193,21 +202,25 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
child: SizedBox(
|
||||
width: 10.sp,
|
||||
)),
|
||||
GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
child: Text('演示模式',
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.mainColor)),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},
|
||||
)
|
||||
//上架审核注释 提交Google暂时屏蔽
|
||||
F.appFlavor == Flavor.sky
|
||||
? Container()
|
||||
: GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
child: Text('演示模式',
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.mainColor)),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../tools/store_service.dart';
|
||||
|
||||
class StarLockLoginState {
|
||||
var passwordShow = true.obs;
|
||||
var agree = false.obs;
|
||||
|
||||
@ -30,11 +30,11 @@ class StarLockRegisterLogic extends BaseGetXController {
|
||||
|
||||
void register() async {
|
||||
var entity = await ApiRepository.to.register(
|
||||
receiverType:state.isIphoneType.value == true ? 1 : 2,
|
||||
countryCode:state.countryCode.value,
|
||||
account:state.phoneOrEmailStr.value,
|
||||
password:state.pwd.value,
|
||||
verificationCode:state.verificationCode.value);
|
||||
receiverType: state.isIphoneType.value == true ? 1 : 2,
|
||||
countryCode: state.countryCode.value,
|
||||
account: state.phoneOrEmailStr.value,
|
||||
password: state.pwd.value,
|
||||
verificationCode: state.verificationCode.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
// await loginSuccess(loginEntity: entity);
|
||||
// Toast.show(msg: "注册成功");
|
||||
@ -46,16 +46,18 @@ class StarLockRegisterLogic extends BaseGetXController {
|
||||
void sendValidationCode() async {
|
||||
var entity = await ApiRepository.to.sendValidationCode(
|
||||
// state.countryCode.value,
|
||||
countryCode:state.countryCode.value.toString(),
|
||||
account:state.phoneOrEmailStr.value,
|
||||
channel:state.isIphoneType.value ? "1" : "2",
|
||||
codeType:'1',
|
||||
xWidth:state.xWidth.value.toString());
|
||||
countryCode: state.countryCode.value.toString(),
|
||||
account: state.phoneOrEmailStr.value,
|
||||
channel: state.isIphoneType.value ? "1" : "2",
|
||||
codeType: '1',
|
||||
xWidth: state.xWidth.value.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
_startTimer();
|
||||
} else {
|
||||
} else {}
|
||||
}
|
||||
|
||||
}
|
||||
void changeAgreeState() {
|
||||
_resetCanSub();
|
||||
}
|
||||
|
||||
void checkNext(TextEditingController controller) {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -51,7 +50,12 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
isDisabled: state.canSub.value,
|
||||
onClick: state.canSub.value
|
||||
? () {
|
||||
logic.register();
|
||||
if (state.agree.value == false) {
|
||||
logic.showToast('请先同意用户协议及隐私政策');
|
||||
return;
|
||||
} else {
|
||||
logic.register();
|
||||
}
|
||||
}
|
||||
: null);
|
||||
}),
|
||||
@ -294,7 +298,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
"countryCode": state.countryCode,
|
||||
"account": state.phoneOrEmailStr.value
|
||||
});
|
||||
state.xWidth.value = (result as Map<String, dynamic>)['xWidth'];
|
||||
state.xWidth.value =
|
||||
(result as Map<String, dynamic>)['xWidth'];
|
||||
logic.sendValidationCode();
|
||||
}
|
||||
: null,
|
||||
@ -303,7 +308,9 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
height: 60.h,
|
||||
padding: EdgeInsets.all(5.h),
|
||||
decoration: BoxDecoration(
|
||||
color: state.phoneOrEmailStrIsOK.value ? AppColors.mainColor : Colors.grey,
|
||||
color: state.phoneOrEmailStrIsOK.value
|
||||
? AppColors.mainColor
|
||||
: Colors.grey,
|
||||
borderRadius: BorderRadius.circular(5)),
|
||||
child: Center(
|
||||
child: Text(state.btnText.value,
|
||||
@ -326,15 +333,18 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Image.asset(
|
||||
'images/icon_select_circle.png',
|
||||
width: 28.w,
|
||||
height: 28.w,
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 20.h,
|
||||
// width: 26.w,
|
||||
// child: Checkbox(value: false, onChanged: (value) {})),
|
||||
Obx(() => GestureDetector(
|
||||
onTap: () {
|
||||
state.agree.value = !state.agree.value;
|
||||
logic.changeAgreeState();
|
||||
},
|
||||
child: Image.asset(
|
||||
state.agree.value
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
))),
|
||||
SizedBox(
|
||||
width: 15.w,
|
||||
),
|
||||
@ -352,11 +362,10 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor, fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage,
|
||||
arguments: {
|
||||
"url": XSConstantMacro.userAgreementURL,
|
||||
"title": '用户协议'
|
||||
});
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: {
|
||||
"url": XSConstantMacro.userAgreementURL,
|
||||
"title": '用户协议'
|
||||
});
|
||||
},
|
||||
)),
|
||||
WidgetSpan(
|
||||
@ -368,9 +377,9 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
color: AppColors.mainColor, fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: {
|
||||
"url": XSConstantMacro.privacyPolicyURL,
|
||||
"title": '隐私政策'
|
||||
});
|
||||
"url": XSConstantMacro.privacyPolicyURL,
|
||||
"title": '隐私政策'
|
||||
});
|
||||
},
|
||||
)),
|
||||
],
|
||||
|
||||
@ -21,6 +21,7 @@ class StarLockRegisterState {
|
||||
var xWidth = ''.obs; // 滑动验证码滑动位置
|
||||
var isIphoneType = true.obs;
|
||||
var canSub = false.obs;
|
||||
var agree = false.obs;
|
||||
|
||||
bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
|
||||
bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
import 'app.dart';
|
||||
import 'package:star_lock/tools/device_info_service.dart';
|
||||
@ -20,22 +21,27 @@ FutureOr<void> main() async {
|
||||
|
||||
if (AppPlatform.isAndroid) {
|
||||
SystemUiOverlayStyle systemUiOverlayStyle =
|
||||
const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
|
||||
const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
|
||||
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置国际化信息
|
||||
Future _initTranslation() async => TranslationLoader.loadTranslation(
|
||||
zhSource: "images/lan/lan_zh.json",
|
||||
enSource: "images/lan/lan_en.json",
|
||||
keySource: "images/lan/lan_keys.json",
|
||||
);
|
||||
zhSource: "images/lan/lan_zh.json",
|
||||
enSource: "images/lan/lan_en.json",
|
||||
keySource: "images/lan/lan_keys.json",
|
||||
);
|
||||
|
||||
// 设置包名服务设备信息
|
||||
Future _setCommonServices() async {
|
||||
await Get.putAsync(() => StoreService().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);
|
||||
}
|
||||
|
||||
@ -397,12 +397,13 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
// SizedBox(
|
||||
// height: 10.h,
|
||||
// ),
|
||||
OutLineBtn(
|
||||
btnName: '标记为已入住',
|
||||
onClick: () {
|
||||
updateRoomCheckIn();
|
||||
},
|
||||
),
|
||||
//田总说不要标记为已入住
|
||||
// OutLineBtn(
|
||||
// btnName: '标记为已入住',
|
||||
// onClick: () {
|
||||
// updateRoomCheckIn();
|
||||
// },
|
||||
// ),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@ -21,7 +20,6 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
@ -45,8 +43,9 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
|
||||
barTitle: F.navTitle,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: LockDetailPage(isOnlyOneData:isOnlyOneData, lockListInfoItemEntity: keyInfos),
|
||||
// body: Container(),
|
||||
body: LockDetailPage(
|
||||
isOnlyOneData: isOnlyOneData, lockListInfoItemEntity: keyInfos),
|
||||
// body: Container(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +74,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
// 根据权限显示不同的列表
|
||||
List<Widget> getListWidget() {
|
||||
// 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();
|
||||
} else {
|
||||
@ -449,26 +450,26 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
//-----新增至此
|
||||
SizedBox(height: 10.h),
|
||||
// 标记房态
|
||||
Obx(() {
|
||||
var title = "";
|
||||
if (state.lockStatus.value.roomStatus == 1) {
|
||||
title = TranslationLoader.lanKeys!.checkedIn!.tr;
|
||||
} else if (state.lockStatus.value.roomStatus == 0) {
|
||||
title = TranslationLoader.lanKeys!.leisure!.tr;
|
||||
}
|
||||
return Visibility(
|
||||
visible: state.lockStatus.value.roomStatus == 1 ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.markedHouseState!.tr,
|
||||
rightTitle: title,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.markedHouseStatePage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
}));
|
||||
}),
|
||||
// Obx(() {
|
||||
// var title = "";
|
||||
// if (state.lockStatus.value.roomStatus == 1) {
|
||||
// title = TranslationLoader.lanKeys!.checkedIn!.tr;
|
||||
// } else if (state.lockStatus.value.roomStatus == 0) {
|
||||
// title = TranslationLoader.lanKeys!.leisure!.tr;
|
||||
// }
|
||||
// return Visibility(
|
||||
// visible: state.lockStatus.value.roomStatus == 1 ? true : false,
|
||||
// child: CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.markedHouseState!.tr,
|
||||
// rightTitle: title,
|
||||
// isHaveLine: true,
|
||||
// isHaveDirection: true,
|
||||
// action: () {
|
||||
// Get.toNamed(Routers.markedHouseStatePage, arguments: {
|
||||
// 'lockSetInfoData': state.lockSetInfoData.value
|
||||
// });
|
||||
// }));
|
||||
// }),
|
||||
// 考勤
|
||||
Obx(
|
||||
() => Visibility(
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
@ -19,12 +18,10 @@ class DemoModeLockSetPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
@ -43,7 +40,7 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
||||
// 基本信息
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.basicInformation!.tr,
|
||||
TranslationLoader.lanKeys!.basicInformation!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
@ -53,7 +50,9 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
||||
// 'keyInfo': state.getKeyInfosData.value
|
||||
// });
|
||||
}),
|
||||
SizedBox(height: 10.h,),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
// 门磁
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.doorMagnetic!.tr,
|
||||
@ -68,7 +67,7 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
||||
// 无线键盘
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
|
||||
TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
@ -99,7 +98,7 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
||||
// 自动闭锁
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.automaticBlocking!.tr,
|
||||
TranslationLoader.lanKeys!.automaticBlocking!.tr,
|
||||
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
@ -133,7 +132,7 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
||||
// 常开模式
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.normallyOpenMode!.tr,
|
||||
TranslationLoader.lanKeys!.normallyOpenMode!.tr,
|
||||
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
@ -216,23 +215,22 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
||||
SizedBox(height: 10.h),
|
||||
//-----新增至此
|
||||
// 标记房态
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.markedHouseState!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
gotoAddLock();
|
||||
}),
|
||||
// CommonItem(
|
||||
// leftTitel:
|
||||
// TranslationLoader.lanKeys!.markedHouseState!.tr,
|
||||
// rightTitle: "",
|
||||
// isHaveLine: true,
|
||||
// isHaveDirection: true,
|
||||
// action: () {
|
||||
// gotoAddLock();
|
||||
// }),
|
||||
// 考勤
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: _openCheckInSwitch()
|
||||
),
|
||||
rightWidget: _openCheckInSwitch()),
|
||||
// 开锁提醒
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
|
||||
@ -304,7 +302,8 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
||||
}),
|
||||
SizedBox(height: 30.h),
|
||||
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(
|
||||
btnName: "退出演示模式",
|
||||
isDelete: true,
|
||||
@ -343,9 +342,8 @@ class _DemoModeLockSetPageState extends State<DemoModeLockSetPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void gotoAddLock(){
|
||||
void gotoAddLock() {
|
||||
// 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(
|
||||
height: 160.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '演示模式',
|
||||
onClick: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},
|
||||
)
|
||||
//上架审核注释 提交Google暂时屏蔽
|
||||
F.appFlavor == Flavor.sky
|
||||
? Container()
|
||||
: SubmitBtn(
|
||||
btnName: '演示模式',
|
||||
onClick: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@ -13,12 +13,12 @@ class StarLockMinePage extends StatefulWidget {
|
||||
const StarLockMinePage({Key? key}) : super(key: key);
|
||||
|
||||
@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 state = Get.find<StarLockMineLogic>().state;
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.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/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
||||
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
||||
@ -69,7 +70,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
),
|
||||
),
|
||||
action: () {
|
||||
_openModalBottomSheet();
|
||||
requestCameraPermission();
|
||||
},
|
||||
)),
|
||||
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 {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.dart';
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
@ -184,30 +185,37 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: "Amazon Alexa",
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast("功能暂未开放");
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: "Google Home",
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast("功能暂未开放");
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast("功能暂未开放");
|
||||
}),
|
||||
//上架审核注释
|
||||
F.appFlavor == Flavor.sky
|
||||
? Container()
|
||||
: CommonItem(
|
||||
leftTitel: "Amazon Alexa",
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast("功能暂未开放");
|
||||
}),
|
||||
F.appFlavor == Flavor.sky
|
||||
? Container()
|
||||
: CommonItem(
|
||||
leftTitel: "Google Home",
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast("功能暂未开放");
|
||||
}),
|
||||
F.appFlavor == Flavor.sky
|
||||
? 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: (){
|
||||
//
|
||||
// }),
|
||||
|
||||
@ -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_screenutil/flutter_screenutil.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 '../../../tools/titleAppBar.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
@ -16,17 +16,13 @@ class ValueAddedServicesBuyPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ValueAddedServicesBuyPageState extends State<ValueAddedServicesBuyPage> {
|
||||
final data = [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var type = ModalRoute.of(context)?.settings.arguments as int;
|
||||
|
||||
final logic = Get.put(ValueAddedServicesBuyLogic());
|
||||
final state = Get.find<ValueAddedServicesBuyLogic>().state;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.greyBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
@ -59,7 +55,9 @@ class _ValueAddedServicesBuyPageState extends State<ValueAddedServicesBuyPage> {
|
||||
mainAxisSpacing: 10.h,
|
||||
crossAxisSpacing: 10.w,
|
||||
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,
|
||||
fontWeight: FontWeight.w500))),
|
||||
SizedBox(width: 5.w),
|
||||
Container(
|
||||
width: 180.w,
|
||||
height: 100.h,
|
||||
color: AppColors.mainColor,
|
||||
child: Center(
|
||||
child: Text(TranslationLoader.lanKeys!.goToPay!.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500))))
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
logic.showToast("支付成功");
|
||||
},
|
||||
child: Container(
|
||||
width: 180.w,
|
||||
height: 100.h,
|
||||
color: AppColors.mainColor,
|
||||
child: Center(
|
||||
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),
|
||||
_buildItem("images/mine/icon_mine_highFunctionContent_bjft.png",
|
||||
TranslationLoader.lanKeys!.sendGroupKey!.tr),
|
||||
_buildItem("images/mine/icon_mine_highFunctionContent_bjft.png",
|
||||
TranslationLoader.lanKeys!.markedHouseState!.tr),
|
||||
// _buildItem("images/mine/icon_mine_highFunctionContent_bjft.png",
|
||||
// TranslationLoader.lanKeys!.markedHouseState!.tr),
|
||||
_buildItem("images/mine/icon_mine_highFunctionContent_fkgj.png",
|
||||
TranslationLoader.lanKeys!.cardIssuingtool!.tr),
|
||||
_buildItem(
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/commonItem.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
@ -92,9 +90,9 @@ class _ValueAddedServicesRealNamePageState
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.valueAddedServicesBuyPage,
|
||||
arguments: 3);
|
||||
// Navigator.pushNamed(
|
||||
// context, Routers.valueAddedServicesBuyPage,
|
||||
// arguments: 3);
|
||||
},
|
||||
child: Container(
|
||||
width: 200.w,
|
||||
@ -103,7 +101,8 @@ class _ValueAddedServicesRealNamePageState
|
||||
child: Center(
|
||||
child: Text(TranslationLoader.lanKeys!.buy!.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
// color: AppColors.mainColor,
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 24.sp)))),
|
||||
),
|
||||
],
|
||||
|
||||
@ -4,16 +4,13 @@ import 'package:get/get.dart';
|
||||
import 'package:get/get_connect/http/src/request/request.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/storage.dart';
|
||||
import '../tools/store_service.dart';
|
||||
|
||||
FutureOr<Request> requestInterceptor(Request request) async {
|
||||
request.headers['User-Agent'] =
|
||||
'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['token'] = StoreService.to.userToken!;
|
||||
// print("11111${StoreService.to.userToken}");
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
|
||||
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';
|
||||
|
||||
|
||||
class StarLockApplication extends StatefulWidget {
|
||||
const StarLockApplication({Key? key}) : super(key: key);
|
||||
|
||||
@ -12,11 +13,37 @@ class StarLockApplication extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _StarLockApplicationState extends State<StarLockApplication> {
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// return NavPages();
|
||||
return const StarLockMainPage();
|
||||
AppFirstEnterHandle().getAppFirstEnter(context);
|
||||
|
||||
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 currentConnectionMacAddress = "CurrentConnectionMacAddress";
|
||||
const ifIsDemoModeOrNot = "IfIsDemoModeOrNot";
|
||||
const isFirstEnter = "isFirstEnter"; //是否首次进入应用
|
||||
|
||||
const saveUserLoginData = "userLoginData";
|
||||
|
||||
@ -182,5 +183,4 @@ class Storage {
|
||||
static Future<void> saveLoginData(LoginData? data) async {
|
||||
await Storage.setString(saveUserLoginData, jsonEncode(data));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ dependencies:
|
||||
image_gallery_saver: ^2.0.3
|
||||
convert: ^3.1.1
|
||||
just_audio: ^0.9.36
|
||||
flutter_sound: ^9.2.13
|
||||
# flutter_sound: ^9.2.13
|
||||
# ffmpeg_kit_flutter: 5.1.0-LTS
|
||||
fast_gbk: ^1.0.0
|
||||
flutter_pcm_sound: ^1.1.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user