fix:修改 xhj 布局(我的,设置页),修复实名认证 bug

This commit is contained in:
anfe 2024-05-28 17:26:02 +08:00
parent 8df9c7e0ef
commit fbd1adf4e1
10 changed files with 909 additions and 900 deletions

File diff suppressed because it is too large Load Diff

View File

@ -239,9 +239,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
child: SizedBox(
width: 10.sp,
)),
F.isLite
? Container()
: GestureDetector(
if (F.isLite) Container() else GestureDetector(
child: SizedBox(
// width: 150.w,
height: 50.h,

View File

@ -3,6 +3,7 @@ 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/login/login/starLock_login_state.dart';
import '../../appRouters.dart';
import '../../app_settings/app_colors.dart';
@ -22,10 +23,8 @@ class StarLockLoginXHJPage extends StatefulWidget {
}
class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
final logic = Get.put(StarLockLoginLogic());
final state = Get
.find<StarLockLoginLogic>()
.state;
final StarLockLoginLogic logic = Get.put(StarLockLoginLogic());
final StarLockLoginState state = Get.find<StarLockLoginLogic>().state;
@override
Widget build(BuildContext context) {
@ -33,269 +32,291 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF),
body: ListView(
padding: EdgeInsets.only(top: 120.h, left: 40.w, right: 40.w),
children: [
Text(
'${"欢迎使用".tr}${F.title}',
style: TextStyle(
color: AppColors.darkGrayTextColor,
fontSize: 48.sp,
padding: EdgeInsets.only(
top: 120.h,
),
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 40.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'${"欢迎使用".tr}${F.title}',
style: TextStyle(
color: AppColors.darkGrayTextColor,
fontSize: 48.sp,
),
),
SizedBox(height: 30.h),
GestureDetector(
onTap: () async {
final result =
await Get.toNamed(Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
}
},
child: Container(
color: Colors.transparent,
child: Row(
children: <Widget>[
SizedBox(
width: 5.w,
),
Text(
TranslationLoader.lanKeys!.countryAndRegion!.tr,
style: TextStyle(
fontSize: 22.sp,
color: AppColors.darkGrayTextColor),
),
SizedBox(
width: 40.w,
),
Obx(() {
return Text(
'${state.countryName.value} +${state.countryCode.value}',
style: TextStyle(
fontSize: 22.sp, color: AppColors.mainColor),
);
})
],
),
),
),
LoginInput(
controller: state.emailOrPhoneController,
onchangeAction: (v) {
logic.checkNext(state.emailOrPhoneController);
},
leftWidget: Padding(
padding: EdgeInsets.only(
top: 30.w,
bottom: 20.w,
),
),
rightSlot: IconButton(
icon: const Icon(Icons.close),
onPressed: () {},
),
label: TranslationLoader
.lanKeys!.pleaseEnterNumberOrEmail!.tr,
// keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(30),
]),
LoginInput(
controller: state.pwdController,
onchangeAction: (v) {
logic.checkNext(state.pwdController);
},
isPwd: true,
// isSuffixIcon: 2,
leftWidget: Padding(
padding: EdgeInsets.only(
top: 30.w,
bottom: 20.w,
),
),
label:
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
SizedBox(height: 10.h),
],
),
),
SizedBox(height: 30.h),
GestureDetector(
onTap: () async {
var result = await Get.toNamed(Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
}
},
child: Container(
color: Colors.transparent,
child: Row(
children: [
SizedBox(
width: 5.w,
),
Text(
TranslationLoader.lanKeys!.countryAndRegion!.tr,
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
SizedBox(
width: 40.w,
),
Obx(() {
return Text(
'${state.countryName.value} +${state.countryCode
.value}',
style: TextStyle(
fontSize: 22.sp, color: AppColors.mainColor),
);
})
],
),
),
),
LoginInput(
controller: state.emailOrPhoneController,
onchangeAction: (v) {
logic.checkNext(state.emailOrPhoneController);
},
leftWidget: Padding(
padding: EdgeInsets.only(
top: 30.w,
bottom: 20.w,
),
),
rightSlot: IconButton(
icon: Icon(Icons.close),
onPressed: () {},
),
label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
// keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(30),
]),
LoginInput(
controller: state.pwdController,
onchangeAction: (v) {
logic.checkNext(state.pwdController);
},
isPwd: true,
// isSuffixIcon: 2,
leftWidget: Padding(
padding: EdgeInsets.only(
top: 30.w,
bottom: 20.w,
),
),
label:
"${TranslationLoader.lanKeys!.pleaseEnter!
.tr}${TranslationLoader.lanKeys!.password!.tr}",
inputFormatters: [
LengthLimitingTextInputFormatter(20),
]),
SizedBox(height: 30.h),
GestureDetector(
onTap: () {
state.agree.value = !state.agree.value;
logic.changeAgreeState();
},
child: Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Container(
color: Colors.transparent,
padding: EdgeInsets.symmetric(vertical: 30.h, horizontal: 40.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
children: <Widget>[
Obx(
() =>
Container(
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,
),
),
() => Container(
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,
),
),
),
Flexible(
child: RichText(
text: TextSpan(
text: TranslationLoader.lanKeys!.readAndAgree!.tr,
style: TextStyle(
color: const Color(0xff333333),
fontSize: 20.sp),
children: [
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: GestureDetector(
child: Text(
'${TranslationLoader.lanKeys!
.userAgreement!.tr}',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 20.sp)),
onTap: () {
Get.toNamed(Routers.webviewShowPage,
arguments: {
"url": XSConstantMacro
.userAgreementURL,
"title": '用户协议'.tr
});
},
)),
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: GestureDetector(
child: Text(
'${TranslationLoader.lanKeys!
.privacyPolicy!.tr}',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 20.sp)),
onTap: () {
Get.toNamed(Routers.webviewShowPage,
arguments: {
"url": XSConstantMacro
.privacyPolicyURL,
"title": '隐私政策'.tr
});
},
)),
],
)),
text: TranslationLoader.lanKeys!.readAndAgree!.tr,
style: TextStyle(
color: const Color(0xff333333), fontSize: 20.sp),
children: <InlineSpan>[
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: GestureDetector(
child: Text(
'${TranslationLoader.lanKeys!.userAgreement!.tr}',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 20.sp)),
onTap: () {
Get.toNamed(Routers.webviewShowPage,
arguments: <String, String>{
'url': XSConstantMacro.userAgreementURL,
'title': '用户协议'.tr
});
},
)),
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: GestureDetector(
child: Text(
'${TranslationLoader.lanKeys!.privacyPolicy!.tr}',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 20.sp)),
onTap: () {
Get.toNamed(Routers.webviewShowPage,
arguments: <String, String>{
'url': XSConstantMacro.privacyPolicyURL,
'title': '隐私政策'.tr
});
},
)),
],
)),
)
],
),
),
),
SizedBox(height: 15.w),
Obx(() =>
SubmitBtn(
btnName: TranslationLoader.lanKeys!.login!.tr,
fontSize: 28.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canNext.value,
onClick: state.canNext.value
? () {
if (state.agree.value == false) {
logic.showToast('请先同意用户协议及隐私政策'.tr);
return;
} else {
logic.login();
}
}
: null)),
SizedBox(height: 10.h),
ElevatedButton(
onPressed: () async {
var data = await Get.toNamed(Routers.starLockRegisterPage);
if (data != null) {
state.emailOrPhoneController.text = data['phoneOrEmailStr'];
logic.checkNext(state.emailOrPhoneController);
state.pwdController.text = data['pwd'];
logic.checkNext(state.pwdController);
setState(() {});
}
},
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.mainColor),
child: Text(
TranslationLoader.lanKeys!.register!.tr,
style: TextStyle(fontSize: 22.sp, color: Colors.white),
),
),
SizedBox(height: 5.w),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
child: SizedBox(
// width: 150.w,
height: 50.h,
// color: Colors.red,
child: Center(
Padding(
padding: EdgeInsets.symmetric(horizontal: 40.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 5.w),
Obx(() => SubmitBtn(
btnName: TranslationLoader.lanKeys!.login!.tr,
fontSize: 28.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canNext.value,
onClick: state.canNext.value
? () {
if (state.agree.value == false) {
logic.showToast('请先同意用户协议及隐私政策'.tr);
return;
} else {
logic.login();
}
}
: null)),
SizedBox(height: 10.h),
SizedBox(
width: Get.width,
child: ElevatedButton(
onPressed: () async {
final dynamic data =
await Get.toNamed(Routers.starLockRegisterPage);
if (data != null) {
state.emailOrPhoneController.text =
data['phoneOrEmailStr'];
logic.checkNext(state.emailOrPhoneController);
state.pwdController.text = data['pwd'];
logic.checkNext(state.pwdController);
setState(() {});
}
},
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.mainColor),
child: Text(
'${TranslationLoader.lanKeys!.forgetPassword!.tr}',
style: TextStyle(
fontSize: 22.sp, color: AppColors.mainColor)),
TranslationLoader.lanKeys!.register!.tr,
style: TextStyle(fontSize: 22.sp, color: Colors.white),
),
),
),
onTap: () {
Navigator.pushNamed(
context, Routers.starLockForgetPasswordPage);
},
),
Expanded(
child: SizedBox(
width: 10.sp,
)),
F.isLite
? Container()
: GestureDetector(
child: SizedBox(
// width: 150.w,
height: 50.h,
// color: Colors.red,
child: Center(
child: Text('演示模式'.tr,
style: TextStyle(
fontSize: 22.sp,
color: AppColors.mainColor)),
),
SizedBox(height: 5.w),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: SizedBox(
// width: 150.w,
height: 50.h,
// color: Colors.red,
child: Center(
child: Text(
'${TranslationLoader.lanKeys!.forgetPassword!.tr}',
style: TextStyle(
fontSize: 22.sp,
color: AppColors.mainColor)),
),
),
onTap: () {
Navigator.pushNamed(
context, Routers.starLockForgetPasswordPage);
},
),
Expanded(
child: SizedBox(
width: 10.sp,
)),
if (F.isLite)
Container()
else
GestureDetector(
child: SizedBox(
// width: 150.w,
height: 50.h,
// color: Colors.red,
child: Center(
child: Text('演示模式'.tr,
style: TextStyle(
fontSize: 22.sp,
color: AppColors.mainColor)),
),
),
onTap: () {
Get.toNamed(Routers.demoModeLockDetailPage);
},
)
],
),
onTap: () {
Get.toNamed(Routers.demoModeLockDetailPage);
},
)
],
),
],
),
)
],
));
}
Widget loginInput({TextEditingController? controller,
List<TextInputFormatter>? inputFormatters,
String? hintText,
bool? isHaveLeftWidget,
Widget? leftWidget,
String? label,
bool? isPwd,
BlockStrCallback? onchangeAction}) {
Widget loginInput(
{TextEditingController? controller,
List<TextInputFormatter>? inputFormatters,
String? hintText,
bool? isHaveLeftWidget,
Widget? leftWidget,
String? label,
bool? isPwd,
BlockStrCallback? onchangeAction}) {
return Container(
width: 1.sp,
color: Colors.transparent,
child: Column(
children: [
children: <Widget>[
Row(
children: [
children: <Widget>[
Container(
color: Colors.red,
child: Image.asset(

View File

@ -295,32 +295,6 @@ class LockDetailLogic extends BaseGetXController {
resetOpenDoorState();
}
});
// BlueManage()
// .blueStart((BluetoothConnectionState deviceConnectionState) async {
// if (deviceConnectionState == BluetoothConnectionState.connected) {
// BlueManage().writeDirectlyBLE(
// 'DC:8F:92:83:69:ED',
// OpenLockCommand(
// lockID: BlueManage().connectDeviceName,
// userID: await Storage.getUid(),
// openMode: state.openDoorModel,
// openTime: getUTCNetTime(),
// onlineToken: state.lockNetToken,
// token: getTokenList,
// needAuthor: 1,
// signKey: signKeyDataList,
// privateKey: getPrivateKeyList,
// ).packageData());
// } else if (deviceConnectionState ==
// BluetoothConnectionState.disconnected) {
// cancelBlueConnetctToastTimer();
// if (state.ifCurrentScreen.value == true) {
// showBlueConnetctToast();
// }
// resetOpenDoorState();
// }
// });
}
//
@ -530,8 +504,8 @@ class LockDetailLogic extends BaseGetXController {
void resetOpenDoorState() {
state.openLockBtnState.value = 0;
state.openDoorBtnisUneable.value = false;
state.animationController!.reset();
state.animationController!.forward();
state.animationController?.reset();
state.animationController?.forward();
eventBus.fire(RefreshLockDetailInfoDataEvent());
}

View File

@ -14,7 +14,6 @@ import 'lockListGroup_view.dart';
import 'lockList_logic.dart';
class LockListXHJPage extends StatefulWidget {
const LockListXHJPage({required this.lockListInfoGroupEntity, Key? key})
: super(key: key);
final LockListInfoGroupEntity lockListInfoGroupEntity;
@ -120,9 +119,9 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
isLast = true;
}
list.add(Slidable(
key: ValueKey(keyInfo.keyId),
key: ValueKey<int?>(keyInfo.keyId),
endActionPane: ActionPane(
extentRatio: 0.2,
extentRatio: 0.5,
motion: const ScrollMotion(),
children: <Widget>[
SlidableAction(
@ -133,6 +132,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除'.tr,
borderRadius: BorderRadius.all(Radius.circular(20.w)),
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],

View File

@ -12,6 +12,7 @@ import 'package:star_lock/mine/mall/lockMall_page.dart';
import 'package:star_lock/mine/message/messageList/messageList_page.dart';
import 'package:star_lock/mine/message/messageList/messageList_xhj_page.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
import 'package:star_lock/mine/mineSet/mineSet/mineSet_page.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/translations/trans_lib.dart';
@ -76,7 +77,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
pageView(
widget: SafeArea(
bottom: false,
child: MinePersonInfoPage(
child: MineSetPage(
showAppBar: false,
showAbout: true,
),

View File

@ -100,7 +100,7 @@ class _MessageListXHJPageState extends State<MessageListXHJPage>
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'智能分析',
'智能分析'.tr,
style: TextStyle(
color: AppColors.blackColor,
fontSize: 28.sp,
@ -108,7 +108,7 @@ class _MessageListXHJPageState extends State<MessageListXHJPage>
),
),
Text(
'精准识别设备事件,过滤无效信息',
'精准识别设备事件,过滤无效信息'.tr,
style: TextStyle(
color: AppColors.blackColor.withOpacity(0.6),
fontSize: 20.sp,

View File

@ -4,7 +4,9 @@ import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart';
import 'package:star_lock/tools/custom_bottom_sheet.dart';
import '../../../appRouters.dart';
@ -14,9 +16,8 @@ import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart';
class MinePersonInfoPage extends StatefulWidget {
MinePersonInfoPage({Key? key, this.showAppBar = true, this.showAbout = false})
MinePersonInfoPage({Key? key, this.showAbout = false})
: super(key: key);
bool showAppBar;
bool showAbout;
@override
@ -24,8 +25,8 @@ class MinePersonInfoPage extends StatefulWidget {
}
class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
final logic = Get.put(MinePersonInfoLogic());
final state = Get.find<MinePersonInfoLogic>().state;
final MinePersonInfoLogic logic = Get.put(MinePersonInfoLogic());
final MinePersonInfoState state = Get.find<MinePersonInfoLogic>().state;
@override
Widget build(BuildContext context) {
@ -33,60 +34,12 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
backgroundColor: F.sw(
skyCall: () => AppColors.mainBackgroundColor,
xhjCall: () => AppColors.mainBackgroundColor),
appBar: widget.showAppBar
? TitleAppBar(
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.personalInformation!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor)
: null,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
F.sw(
skyCall: () => SizedBox(),
xhjCall: () => Container(
width: 1.sw,
height: 0.2.sw,
margin:
EdgeInsets.only(top: 15.h, left: 20.w, right: 20.w),
padding: EdgeInsets.symmetric(horizontal: 25.w),
decoration: BoxDecoration(
image: const DecorationImage(
image: AssetImage('images/xhj_main_bg.jpg'),
fit: BoxFit.cover,
),
borderRadius: BorderRadius.circular(20.r),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
blurRadius: 10.r,
spreadRadius: 0,
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'系统设置',
style: TextStyle(
color: AppColors.blackColor,
fontSize: 28.sp,
fontWeight: FontWeight.w600,
),
),
Text(
'系统的全局配置在此项内进行设置',
style: TextStyle(
color: AppColors.blackColor.withOpacity(0.6),
fontSize: 20.sp,
fontWeight: FontWeight.w600,
),
),
],
),
)),
children: <Widget>[
SizedBox(
height: 20.h,
),
@ -95,10 +48,10 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
child: ClipRRect(
borderRadius: BorderRadius.circular(20.r),
child: Column(
children: [
children: <Widget>[
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
rightTitle: "",
rightTitle: '',
allHeight: 100.h,
isHaveLine: true,
isHaveDirection: true,
@ -119,15 +72,15 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: state.mineInfoData.value.nickname != null
? state.mineInfoData.value.nickname!
: "",
: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage,
arguments: {
arguments: <String, MinePersonInfoData>{
'mineInfoData': state.mineInfoData.value
}).then((value) => logic.getUserInfoRequest());
}).then((Object? value) => logic.getUserInfoRequest());
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
@ -141,17 +94,17 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
if (state.mineInfoData.value.mobile!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
arguments: <String, String>{
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
}).then((Object? value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage,
arguments: {
arguments: <String, String>{
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
}).then((Object? value) => logic.getUserInfoRequest());
}
})),
Obx(() => CommonItem(
@ -166,23 +119,23 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
if (state.mineInfoData.value.email!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
arguments: <String, String>{
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
}).then((Object? value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage,
arguments: {
arguments: <String, String>{
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
}).then((Object? value) => logic.getUserInfoRequest());
}
})),
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.resetPasswords!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
@ -192,15 +145,15 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0
? "去设置".tr
: "",
? '去设置'.tr
: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
if (state.mineInfoData.value.haveSafeAnswer == 0) {
Navigator.pushNamed(context,
Routers.minePersonInfoSetSafetyProblemPage)
.then((value) => logic.getUserInfoRequest());
.then((Object? value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(context,
Routers.minePersonInfoViewSafetyProblemPage);
@ -211,40 +164,11 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.mineInfoData.value.countryName != null
? state.mineInfoData.value.countryName!
: "",
: '',
isHaveLine: true,
isHaveDirection: false)),
if (F.isLite == false && widget.showAbout)
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.valueAddedServices!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.valueAddedServicesPage);
},
),
if (widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.set!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.mineSetPage);
},
),
if (widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.about!.tr,
isHaveLine: false,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.aboutPage);
},
),
],
),
),
@ -261,7 +185,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
builder: (BuildContext context) {
return AlertBottomWidget(
topTitle: '',
items: const ['拍照', '从相册选择'],
items: const <String>['拍照', '从相册选择'],
chooseCallback: logic.chooseCallback,
);
});

View File

@ -8,6 +8,7 @@ import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.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_state.dart';
import 'package:star_lock/tools/appFirstEnterHandle.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
@ -18,15 +19,18 @@ import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart';
class MineSetPage extends StatefulWidget {
const MineSetPage({Key? key}) : super(key: key);
MineSetPage({Key? key, this.showAppBar = true, this.showAbout = false})
: super(key: key);
bool showAppBar;
bool showAbout;
@override
State<MineSetPage> createState() => _MineSetPageState();
}
class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
final logic = Get.put(MineSetLogic());
final state = Get.find<MineSetLogic>().state;
final MineSetLogic logic = Get.put(MineSetLogic());
final MineSetState state = Get.find<MineSetLogic>().state;
@override
void initState() {
@ -53,19 +57,21 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw(
skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
xhjCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
haveBack: true,
backgroundColor: Colors.white,
iconColor: AppColors.blackColor,
titleColor: AppColors.blackColor,
)),
appBar: widget.showAppBar
? F.sw(
skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
xhjCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
haveBack: true,
backgroundColor: Colors.white,
iconColor: AppColors.blackColor,
titleColor: AppColors.blackColor,
))
: null,
body: SingleChildScrollView(
child: styleHierarchy(),
),
@ -77,23 +83,72 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
Widget view = getListDataView();
view = F.sw(
skyCall: () => view,
xhjCall: () => Container(
margin: EdgeInsets.only(
top: 20.h, left: 20.w, right: 20.w, bottom: 40.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(20.r))),
child: ClipRRect(
borderRadius: BorderRadius.circular(20.r),
child: view,
),
xhjCall: () => Column(
children: <Widget>[
Container(
width: 1.sw,
height: 0.2.sw,
margin: EdgeInsets.only(
top: 15.h, left: 20.w, right: 20.w, bottom: 20.h),
padding: EdgeInsets.symmetric(horizontal: 25.w),
decoration: BoxDecoration(
image: const DecorationImage(
image: AssetImage('images/xhj_main_bg.jpg'),
fit: BoxFit.cover,
),
borderRadius: BorderRadius.circular(20.r),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
blurRadius: 10.r,
spreadRadius: 0,
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'系统设置'.tr,
style: TextStyle(
color: AppColors.blackColor,
fontSize: 28.sp,
fontWeight: FontWeight.w600,
),
),
Text(
'系统的全局配置在此项内进行设置'.tr,
style: TextStyle(
color: AppColors.blackColor.withOpacity(0.6),
fontSize: 20.sp,
fontWeight: FontWeight.w600,
),
),
],
),
),
Container(
margin: EdgeInsets.only(
top: 20.h, left: 20.w, right: 20.w, bottom: 40.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(20.r))),
child: ClipRRect(
borderRadius: BorderRadius.circular(20.r),
child: view,
),
),
F.sw(skyCall: () => const SizedBox(), xhjCall: keyBottomWidget),
],
));
return view;
}
Widget getListDataView() {
return Column(
children: [
children: <Widget>[
/* 2024-01-12 by DaisyWu
CommonItem(
leftTitel: TranslationLoader.lanKeys!.prompTone!.tr,
@ -114,29 +169,42 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
height: 50.h,
child: Obx(() => _isTouchUnlockSwitch()))),
*/
F.sw(
skyCall: () => const SizedBox(),
xhjCall: () => CommonItem(
leftTitel: TranslationLoader.lanKeys!.personalInformation!.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.minePersonInfoPage);
})),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.pushNotification!.tr,
rightTitle: "",
rightTitle: '',
isHaveRightWidget: true,
isHaveLine: F.appFlavor == Flavor.sky ? true : false,
isHaveLine: F.sw(
skyCall: () => F.appFlavor == Flavor.sky, xhjCall: () => true),
rightWidget: SizedBox(
width: 60.w,
height: 50.h,
child: Obx(() => _isPushNotificationSwitch()))),
F.appFlavor == Flavor.sky
? CommonItem(
leftTitel: "微信公众号推送".tr,
rightTitle: "",
isHaveRightWidget: true,
rightWidget: SizedBox(
width: 60.w,
height: 50.h,
child: Obx(() => _isWechatPublicAccountPushSwitch())))
: Container(),
child: Obx(_isPushNotificationSwitch))),
if (F.appFlavor == Flavor.sky)
CommonItem(
leftTitel: '微信公众号推送'.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: SizedBox(
width: 60.w,
height: 50.h,
child: Obx(_isWechatPublicAccountPushSwitch)))
else
Container(),
SizedBox(height: 10.h),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockUserManagement!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
@ -144,7 +212,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
@ -153,7 +221,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
//by DaisyWu --
CommonItem(
leftTitel: TranslationLoader.lanKeys!.authorityManagement!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
@ -162,7 +230,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
@ -170,7 +238,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.transferSmartLock!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
@ -178,7 +246,8 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.selectGetewayListPage);
@ -224,16 +293,17 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.hideInvalidUnlockPermissionsPage,
arguments: {'isOn': state.hideExpiredAccessFlag.value})
.then((value) {
context, Routers.hideInvalidUnlockPermissionsPage,
arguments: <String, int>{
'isOn': state.hideExpiredAccessFlag.value
}).then((Object? value) {
logic.userSettingsInfoRequest();
});
})),
CommonItem(
leftTitel: TranslationLoader
.lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
rightTitle: "",
rightTitle: '',
// allHeight: 100.h,
isHaveLine: true,
isHaveDirection: true,
@ -245,41 +315,58 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
height: 10.h,
),
//
F.isLite
? Container()
: CommonItem(
leftTitel: "Amazon Alexa",
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
logic.showToast("功能暂未开放".tr);
}),
F.isLite
? Container()
: CommonItem(
leftTitel: "Google Home",
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
logic.showToast("功能暂未开放".tr);
}),
F.isLite
? Container()
: CommonItem(
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,
rightTitle: "",
isHaveLine: false,
isHaveDirection: true,
action: () {
logic.showToast("功能暂未开放".tr);
}),
if (!F.isLite)
CommonItem(
leftTitel: 'Amazon Alexa',
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
logic.showToast('功能暂未开放'.tr);
}),
if (!F.isLite)
CommonItem(
leftTitel: 'Google Home',
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
logic.showToast('功能暂未开放'.tr);
}),
if (!F.isLite)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,
rightTitle: '',
isHaveLine: widget.showAbout,
isHaveDirection: true,
action: () {
logic.showToast('功能暂未开放'.tr);
}),
if (!F.isLite && widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.valueAddedServices!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.valueAddedServicesPage);
},
),
if (widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.about!.tr,
isHaveLine: false,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.aboutPage);
},
),
// CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){
//
// }),
SizedBox(
height: 50.h,
height: F.sw(skyCall: () => 50.h, xhjCall: () => 0.0),
),
// CommonItem(leftTitel:TranslationLoader.lanKeys!.about!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
//
@ -300,52 +387,56 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
// CommonItem(leftTitel:TranslationLoader.lanKeys!.thirdPartyInformationSharingList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
//
// }),
keyBottomWidget()
F.sw(skyCall: keyBottomWidget, xhjCall: () => const SizedBox())
],
);
}
Widget keyBottomWidget() {
return Column(
children: [
SubmitBtn(
btnName: TranslationLoader.lanKeys!.logout!.tr,
isDelete: true,
padding: EdgeInsets.symmetric(horizontal: 15.w),
onClick: () {
//退
ShowTipView().showIosTipWithContentDialog("确定要退出吗?".tr, () {
logic.userLogoutRequest();
});
// showLoginOutAlertTipDialog();
}),
Container(
padding: EdgeInsets.only(right: 30.w, top: 30.h),
// color: Colors.red,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
child: Text(
TranslationLoader.lanKeys!.deleteAccount!.tr,
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 18.sp),
return Padding(
padding: F.sw(
skyCall: () => EdgeInsets.zero,
xhjCall: () => EdgeInsets.symmetric(horizontal: 15.w)),
child: Column(
children: <Widget>[
SubmitBtn(
btnName: TranslationLoader.lanKeys!.logout!.tr,
isDelete: true,
padding: EdgeInsets.symmetric(horizontal: 15.w),
onClick: () {
//退
ShowTipView().showIosTipWithContentDialog(
'确定要退出吗?'.tr, logic.userLogoutRequest);
// showLoginOutAlertTipDialog();
}),
Container(
padding: EdgeInsets.only(right: 30.w, top: 30.h),
// color: Colors.red,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
child: Text(
TranslationLoader.lanKeys!.deleteAccount!.tr,
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 18.sp),
),
onPressed: () {
ShowTipView().showIosTipWithContentDialog(
TranslationLoader.lanKeys!.deleteAccountTips!.tr, () {
//
Get.toNamed(Routers.safeVerifyPage);
});
},
),
onPressed: () {
ShowTipView().showIosTipWithContentDialog(
TranslationLoader.lanKeys!.deleteAccountTips!.tr, () {
//
Get.toNamed(Routers.safeVerifyPage);
});
},
),
],
],
),
),
),
SizedBox(
height: 30.h,
)
],
SizedBox(
height: 30.h,
)
],
),
);
}
@ -411,7 +502,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isPrompTone.value,
onChanged: (value) {
onChanged: (bool value) {
state.isPrompTone.value = !state.isPrompTone.value;
logic.updatePrompToneRequest();
},
@ -424,7 +515,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isTouchUnlock.value,
onChanged: (value) {
onChanged: (bool value) {
state.isTouchUnlock.value = !state.isTouchUnlock.value;
logic.updateTouchUnlockRequest();
},
@ -438,7 +529,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isWechatPublicAccountPush.value,
onChanged: (value) {
onChanged: (bool value) {
state.isWechatPublicAccountPush.value =
!state.isWechatPublicAccountPush.value;
logic.setMpWechatPushSwitchRequest(context);
@ -452,7 +543,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isPushNotification.value,
onChanged: (value) {
onChanged: (bool value) {
// state.isPushNotification.value = !state.isPushNotification.value;
openAppSettings();
},

View File

@ -26,7 +26,7 @@ class BaseProvider extends GetConnect with Api {
Future<Response<T>> post<T>(
String? url,
body, {
String? contentType = "application/json",
String? contentType = 'application/json',
Map<String, String>? headers,
Map<String, dynamic>? query,
Decoder<T>? decoder,
@ -35,7 +35,7 @@ class BaseProvider extends GetConnect with Api {
bool? isUnShowLoading = false, // loading
bool? isUserBaseUrl = true, // 使baseUrl
}) async {
AppLog.log("post: url:$url body:$body");
AppLog.log('post: url:$url body:$body');
if (isUnShowLoading == false){
EasyLoading.show();
}
@ -55,14 +55,14 @@ class BaseProvider extends GetConnect with Api {
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
if (res.statusCode == null) {
EasyLoading.showToast("网络访问失败,请检查网络是否正常".tr, duration: 2000.milliseconds);
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds);
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
}
var rs = {
"errorMsg": "Network Error!",
"errorCode": -1,
"data": null,
"description": "表示成功或是。"
'errorMsg': 'Network Error!',
'errorCode': -1,
'data': null,
'description': '表示成功或是。'
};
return Response(
request: res.request,
@ -78,24 +78,24 @@ class BaseProvider extends GetConnect with Api {
}
getDataResult(T) {
switch (T["errorCode"]) {
switch (T['errorCode']) {
case 403:
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
break;
case 500:
EasyLoading.showToast("服务器错误", duration: 2000.milliseconds);
EasyLoading.showToast('服务器错误', duration: 2000.milliseconds);
break;
case 421:
case 422:
case 430: //ErrorMsg
EasyLoading.showToast(T["errorMsg"], duration: 2000.milliseconds);
EasyLoading.showToast(T['errorMsg'], duration: 2000.milliseconds);
break;
//
// case 425:
// Toast.show(msg: "用户不存在");
// break;
case 10001:
EasyLoading.showToast("数据不存在", duration: 2000.milliseconds);
EasyLoading.showToast('数据不存在', duration: 2000.milliseconds);
break;
}
}