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( child: SizedBox(
width: 10.sp, width: 10.sp,
)), )),
F.isLite if (F.isLite) Container() else GestureDetector(
? Container()
: GestureDetector(
child: SizedBox( child: SizedBox(
// width: 150.w, // width: 150.w,
height: 50.h, height: 50.h,

View File

@ -3,6 +3,7 @@ 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/flavors.dart';
import 'package:star_lock/login/login/starLock_login_state.dart';
import '../../appRouters.dart'; import '../../appRouters.dart';
import '../../app_settings/app_colors.dart'; import '../../app_settings/app_colors.dart';
@ -22,10 +23,8 @@ class StarLockLoginXHJPage extends StatefulWidget {
} }
class _StarLockLoginPageState extends State<StarLockLoginXHJPage> { class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
final logic = Get.put(StarLockLoginLogic()); final StarLockLoginLogic logic = Get.put(StarLockLoginLogic());
final state = Get final StarLockLoginState state = Get.find<StarLockLoginLogic>().state;
.find<StarLockLoginLogic>()
.state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -33,8 +32,15 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF), backgroundColor: const Color(0xFFFFFFFF),
body: ListView( body: ListView(
padding: EdgeInsets.only(top: 120.h, left: 40.w, right: 40.w), padding: EdgeInsets.only(
children: [ top: 120.h,
),
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 40.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text( Text(
'${"欢迎使用".tr}${F.title}', '${"欢迎使用".tr}${F.title}',
style: TextStyle( style: TextStyle(
@ -45,7 +51,8 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
SizedBox(height: 30.h), SizedBox(height: 30.h),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
var result = await Get.toNamed(Routers.selectCountryRegionPage); final result =
await Get.toNamed(Routers.selectCountryRegionPage);
if (result != null) { if (result != null) {
result as Map<String, dynamic>; result as Map<String, dynamic>;
state.countryCode.value = result['code']; state.countryCode.value = result['code'];
@ -55,22 +62,22 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
child: Container( child: Container(
color: Colors.transparent, color: Colors.transparent,
child: Row( child: Row(
children: [ children: <Widget>[
SizedBox( SizedBox(
width: 5.w, width: 5.w,
), ),
Text( Text(
TranslationLoader.lanKeys!.countryAndRegion!.tr, TranslationLoader.lanKeys!.countryAndRegion!.tr,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor), fontSize: 22.sp,
color: AppColors.darkGrayTextColor),
), ),
SizedBox( SizedBox(
width: 40.w, width: 40.w,
), ),
Obx(() { Obx(() {
return Text( return Text(
'${state.countryName.value} +${state.countryCode '${state.countryName.value} +${state.countryCode.value}',
.value}',
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.mainColor), fontSize: 22.sp, color: AppColors.mainColor),
); );
@ -91,12 +98,13 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
), ),
), ),
rightSlot: IconButton( rightSlot: IconButton(
icon: Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: () {}, onPressed: () {},
), ),
label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, label: TranslationLoader
.lanKeys!.pleaseEnterNumberOrEmail!.tr,
// keyboardType: TextInputType.number, // keyboardType: TextInputType.number,
inputFormatters: [ inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(30), LengthLimitingTextInputFormatter(30),
]), ]),
LoginInput( LoginInput(
@ -113,25 +121,27 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
), ),
), ),
label: label:
"${TranslationLoader.lanKeys!.pleaseEnter! '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
.tr}${TranslationLoader.lanKeys!.password!.tr}", inputFormatters: <TextInputFormatter>[
inputFormatters: [
LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
SizedBox(height: 30.h), SizedBox(height: 10.h),
],
),
),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
state.agree.value = !state.agree.value; state.agree.value = !state.agree.value;
logic.changeAgreeState(); logic.changeAgreeState();
}, },
child: Padding( child: Container(
padding: EdgeInsets.symmetric(vertical: 10.h), color: Colors.transparent,
padding: EdgeInsets.symmetric(vertical: 30.h, horizontal: 40.w),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Obx( Obx(
() => () => Container(
Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 5.w, left: 5.w,
right: 10.w, right: 10.w,
@ -150,24 +160,21 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
text: TextSpan( text: TextSpan(
text: TranslationLoader.lanKeys!.readAndAgree!.tr, text: TranslationLoader.lanKeys!.readAndAgree!.tr,
style: TextStyle( style: TextStyle(
color: const Color(0xff333333), color: const Color(0xff333333), fontSize: 20.sp),
fontSize: 20.sp), children: <InlineSpan>[
children: [
WidgetSpan( WidgetSpan(
alignment: PlaceholderAlignment.middle, alignment: PlaceholderAlignment.middle,
child: GestureDetector( child: GestureDetector(
child: Text( child: Text(
'${TranslationLoader.lanKeys! '${TranslationLoader.lanKeys!.userAgreement!.tr}',
.userAgreement!.tr}',
style: TextStyle( style: TextStyle(
color: AppColors.mainColor, color: AppColors.mainColor,
fontSize: 20.sp)), fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, Get.toNamed(Routers.webviewShowPage,
arguments: { arguments: <String, String>{
"url": XSConstantMacro 'url': XSConstantMacro.userAgreementURL,
.userAgreementURL, 'title': '用户协议'.tr
"title": '用户协议'.tr
}); });
}, },
)), )),
@ -175,17 +182,15 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
alignment: PlaceholderAlignment.middle, alignment: PlaceholderAlignment.middle,
child: GestureDetector( child: GestureDetector(
child: Text( child: Text(
'${TranslationLoader.lanKeys! '${TranslationLoader.lanKeys!.privacyPolicy!.tr}',
.privacyPolicy!.tr}',
style: TextStyle( style: TextStyle(
color: AppColors.mainColor, color: AppColors.mainColor,
fontSize: 20.sp)), fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, Get.toNamed(Routers.webviewShowPage,
arguments: { arguments: <String, String>{
"url": XSConstantMacro 'url': XSConstantMacro.privacyPolicyURL,
.privacyPolicyURL, 'title': '隐私政策'.tr
"title": '隐私政策'.tr
}); });
}, },
)), )),
@ -196,9 +201,13 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
), ),
), ),
), ),
SizedBox(height: 15.w), Padding(
Obx(() => padding: EdgeInsets.symmetric(horizontal: 40.w),
SubmitBtn( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 5.w),
Obx(() => SubmitBtn(
btnName: TranslationLoader.lanKeys!.login!.tr, btnName: TranslationLoader.lanKeys!.login!.tr,
fontSize: 28.sp, fontSize: 28.sp,
borderRadius: 20.w, borderRadius: 20.w,
@ -215,11 +224,15 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
} }
: null)), : null)),
SizedBox(height: 10.h), SizedBox(height: 10.h),
ElevatedButton( SizedBox(
width: Get.width,
child: ElevatedButton(
onPressed: () async { onPressed: () async {
var data = await Get.toNamed(Routers.starLockRegisterPage); final dynamic data =
await Get.toNamed(Routers.starLockRegisterPage);
if (data != null) { if (data != null) {
state.emailOrPhoneController.text = data['phoneOrEmailStr']; state.emailOrPhoneController.text =
data['phoneOrEmailStr'];
logic.checkNext(state.emailOrPhoneController); logic.checkNext(state.emailOrPhoneController);
state.pwdController.text = data['pwd']; state.pwdController.text = data['pwd'];
logic.checkNext(state.pwdController); logic.checkNext(state.pwdController);
@ -233,10 +246,11 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
style: TextStyle(fontSize: 22.sp, color: Colors.white), style: TextStyle(fontSize: 22.sp, color: Colors.white),
), ),
), ),
),
SizedBox(height: 5.w), SizedBox(height: 5.w),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
GestureDetector( GestureDetector(
child: SizedBox( child: SizedBox(
// width: 150.w, // width: 150.w,
@ -246,7 +260,8 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
child: Text( child: Text(
'${TranslationLoader.lanKeys!.forgetPassword!.tr}', '${TranslationLoader.lanKeys!.forgetPassword!.tr}',
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.mainColor)), fontSize: 22.sp,
color: AppColors.mainColor)),
), ),
), ),
onTap: () { onTap: () {
@ -258,9 +273,10 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
child: SizedBox( child: SizedBox(
width: 10.sp, width: 10.sp,
)), )),
F.isLite if (F.isLite)
? Container() Container()
: GestureDetector( else
GestureDetector(
child: SizedBox( child: SizedBox(
// width: 150.w, // width: 150.w,
height: 50.h, height: 50.h,
@ -279,10 +295,14 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
], ],
), ),
], ],
),
)
],
)); ));
} }
Widget loginInput({TextEditingController? controller, Widget loginInput(
{TextEditingController? controller,
List<TextInputFormatter>? inputFormatters, List<TextInputFormatter>? inputFormatters,
String? hintText, String? hintText,
bool? isHaveLeftWidget, bool? isHaveLeftWidget,
@ -292,10 +312,11 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
BlockStrCallback? onchangeAction}) { BlockStrCallback? onchangeAction}) {
return Container( return Container(
width: 1.sp, width: 1.sp,
color: Colors.transparent,
child: Column( child: Column(
children: [ children: <Widget>[
Row( Row(
children: [ children: <Widget>[
Container( Container(
color: Colors.red, color: Colors.red,
child: Image.asset( child: Image.asset(

View File

@ -295,32 +295,6 @@ class LockDetailLogic extends BaseGetXController {
resetOpenDoorState(); 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() { void resetOpenDoorState() {
state.openLockBtnState.value = 0; state.openLockBtnState.value = 0;
state.openDoorBtnisUneable.value = false; state.openDoorBtnisUneable.value = false;
state.animationController!.reset(); state.animationController?.reset();
state.animationController!.forward(); state.animationController?.forward();
eventBus.fire(RefreshLockDetailInfoDataEvent()); eventBus.fire(RefreshLockDetailInfoDataEvent());
} }

View File

@ -14,7 +14,6 @@ import 'lockListGroup_view.dart';
import 'lockList_logic.dart'; import 'lockList_logic.dart';
class LockListXHJPage extends StatefulWidget { class LockListXHJPage extends StatefulWidget {
const LockListXHJPage({required this.lockListInfoGroupEntity, Key? key}) const LockListXHJPage({required this.lockListInfoGroupEntity, Key? key})
: super(key: key); : super(key: key);
final LockListInfoGroupEntity lockListInfoGroupEntity; final LockListInfoGroupEntity lockListInfoGroupEntity;
@ -120,9 +119,9 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
isLast = true; isLast = true;
} }
list.add(Slidable( list.add(Slidable(
key: ValueKey(keyInfo.keyId), key: ValueKey<int?>(keyInfo.keyId),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.5,
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: <Widget>[ children: <Widget>[
SlidableAction( SlidableAction(
@ -133,6 +132,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
backgroundColor: Colors.red, backgroundColor: Colors.red,
foregroundColor: Colors.white, foregroundColor: Colors.white,
label: '删除'.tr, label: '删除'.tr,
borderRadius: BorderRadius.all(Radius.circular(20.w)),
padding: EdgeInsets.only(left: 5.w, right: 5.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_page.dart';
import 'package:star_lock/mine/message/messageList/messageList_xhj_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/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/noData.dart';
import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/translations/trans_lib.dart'; import 'package:star_lock/translations/trans_lib.dart';
@ -76,7 +77,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
pageView( pageView(
widget: SafeArea( widget: SafeArea(
bottom: false, bottom: false,
child: MinePersonInfoPage( child: MineSetPage(
showAppBar: false, showAppBar: false,
showAbout: true, showAbout: true,
), ),

View File

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

View File

@ -4,7 +4,9 @@ import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.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/flavors.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_logic.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart';
import 'package:star_lock/tools/custom_bottom_sheet.dart'; import 'package:star_lock/tools/custom_bottom_sheet.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
@ -14,9 +16,8 @@ import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
class MinePersonInfoPage extends StatefulWidget { class MinePersonInfoPage extends StatefulWidget {
MinePersonInfoPage({Key? key, this.showAppBar = true, this.showAbout = false}) MinePersonInfoPage({Key? key, this.showAbout = false})
: super(key: key); : super(key: key);
bool showAppBar;
bool showAbout; bool showAbout;
@override @override
@ -24,8 +25,8 @@ class MinePersonInfoPage extends StatefulWidget {
} }
class _MinePersonInfoPageState extends State<MinePersonInfoPage> { class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
final logic = Get.put(MinePersonInfoLogic()); final MinePersonInfoLogic logic = Get.put(MinePersonInfoLogic());
final state = Get.find<MinePersonInfoLogic>().state; final MinePersonInfoState state = Get.find<MinePersonInfoLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -33,60 +34,12 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
backgroundColor: F.sw( backgroundColor: F.sw(
skyCall: () => AppColors.mainBackgroundColor, skyCall: () => AppColors.mainBackgroundColor,
xhjCall: () => AppColors.mainBackgroundColor), xhjCall: () => AppColors.mainBackgroundColor),
appBar: widget.showAppBar appBar: TitleAppBar(
? TitleAppBar(
barTitle: TranslationLoader.lanKeys!.personalInformation!.tr, barTitle: TranslationLoader.lanKeys!.personalInformation!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor) backgroundColor: AppColors.mainColor),
: null,
body: Column( body: Column(
children: [ children: <Widget>[
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,
),
),
],
),
)),
SizedBox( SizedBox(
height: 20.h, height: 20.h,
), ),
@ -95,10 +48,10 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(20.r), borderRadius: BorderRadius.circular(20.r),
child: Column( child: Column(
children: [ children: <Widget>[
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.avatar!.tr, leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
rightTitle: "", rightTitle: '',
allHeight: 100.h, allHeight: 100.h,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
@ -119,15 +72,15 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
leftTitel: TranslationLoader.lanKeys!.nickName!.tr, leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: state.mineInfoData.value.nickname != null rightTitle: state.mineInfoData.value.nickname != null
? state.mineInfoData.value.nickname! ? state.mineInfoData.value.nickname!
: "", : '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage, context, Routers.minePersonInfoEditNamePage,
arguments: { arguments: <String, MinePersonInfoData>{
'mineInfoData': state.mineInfoData.value 'mineInfoData': state.mineInfoData.value
}).then((value) => logic.getUserInfoRequest()); }).then((Object? value) => logic.getUserInfoRequest());
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr, leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
@ -141,17 +94,17 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
if (state.mineInfoData.value.mobile!.isNotEmpty) { if (state.mineInfoData.value.mobile!.isNotEmpty) {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage, context, Routers.mineUnbindPhoneOrEmailPage,
arguments: { arguments: <String, String>{
'mobile': state.mineInfoData.value.mobile!, 'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1' 'isFrom': '1'
}).then((value) => logic.getUserInfoRequest()); }).then((Object? value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, context, Routers.mineBindPhoneOrEmailPage,
arguments: { arguments: <String, String>{
'mobile': state.mineInfoData.value.mobile!, 'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1' 'isFrom': '1'
}).then((value) => logic.getUserInfoRequest()); }).then((Object? value) => logic.getUserInfoRequest());
} }
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
@ -166,23 +119,23 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
if (state.mineInfoData.value.email!.isNotEmpty) { if (state.mineInfoData.value.email!.isNotEmpty) {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage, context, Routers.mineUnbindPhoneOrEmailPage,
arguments: { arguments: <String, String>{
'isFrom': '2', 'isFrom': '2',
'email': state.mineInfoData.value.email! 'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest()); }).then((Object? value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, context, Routers.mineBindPhoneOrEmailPage,
arguments: { arguments: <String, String>{
'isFrom': '2', 'isFrom': '2',
'email': state.mineInfoData.value.email! 'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest()); }).then((Object? value) => logic.getUserInfoRequest());
} }
})), })),
CommonItem( CommonItem(
leftTitel: leftTitel:
TranslationLoader.lanKeys!.resetPasswords!.tr, TranslationLoader.lanKeys!.resetPasswords!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -192,15 +145,15 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr, leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 rightTitle: state.mineInfoData.value.haveSafeAnswer == 0
? "去设置".tr ? '去设置'.tr
: "", : '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
if (state.mineInfoData.value.haveSafeAnswer == 0) { if (state.mineInfoData.value.haveSafeAnswer == 0) {
Navigator.pushNamed(context, Navigator.pushNamed(context,
Routers.minePersonInfoSetSafetyProblemPage) Routers.minePersonInfoSetSafetyProblemPage)
.then((value) => logic.getUserInfoRequest()); .then((Object? value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed(context, Navigator.pushNamed(context,
Routers.minePersonInfoViewSafetyProblemPage); Routers.minePersonInfoViewSafetyProblemPage);
@ -211,40 +164,11 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
TranslationLoader.lanKeys!.countryAndRegion!.tr, TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.mineInfoData.value.countryName != null rightTitle: state.mineInfoData.value.countryName != null
? state.mineInfoData.value.countryName! ? state.mineInfoData.value.countryName!
: "", : '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: false)), 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) { builder: (BuildContext context) {
return AlertBottomWidget( return AlertBottomWidget(
topTitle: '', topTitle: '',
items: const ['拍照', '从相册选择'], items: const <String>['拍照', '从相册选择'],
chooseCallback: logic.chooseCallback, chooseCallback: logic.chooseCallback,
); );
}); });

View File

@ -8,6 +8,7 @@ import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/flavors.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 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart';
import 'package:star_lock/tools/appFirstEnterHandle.dart'; import 'package:star_lock/tools/appFirstEnterHandle.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
@ -18,15 +19,18 @@ import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
class MineSetPage extends StatefulWidget { 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 @override
State<MineSetPage> createState() => _MineSetPageState(); State<MineSetPage> createState() => _MineSetPageState();
} }
class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver { class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
final logic = Get.put(MineSetLogic()); final MineSetLogic logic = Get.put(MineSetLogic());
final state = Get.find<MineSetLogic>().state; final MineSetState state = Get.find<MineSetLogic>().state;
@override @override
void initState() { void initState() {
@ -53,7 +57,8 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw( appBar: widget.showAppBar
? F.sw(
skyCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.moreSet!.tr, barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
haveBack: true, haveBack: true,
@ -65,7 +70,8 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
backgroundColor: Colors.white, backgroundColor: Colors.white,
iconColor: AppColors.blackColor, iconColor: AppColors.blackColor,
titleColor: AppColors.blackColor, titleColor: AppColors.blackColor,
)), ))
: null,
body: SingleChildScrollView( body: SingleChildScrollView(
child: styleHierarchy(), child: styleHierarchy(),
), ),
@ -77,7 +83,53 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
Widget view = getListDataView(); Widget view = getListDataView();
view = F.sw( view = F.sw(
skyCall: () => view, skyCall: () => view,
xhjCall: () => Container( 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( margin: EdgeInsets.only(
top: 20.h, left: 20.w, right: 20.w, bottom: 40.h), top: 20.h, left: 20.w, right: 20.w, bottom: 40.h),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -87,13 +139,16 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
borderRadius: BorderRadius.circular(20.r), borderRadius: BorderRadius.circular(20.r),
child: view, child: view,
), ),
),
F.sw(skyCall: () => const SizedBox(), xhjCall: keyBottomWidget),
],
)); ));
return view; return view;
} }
Widget getListDataView() { Widget getListDataView() {
return Column( return Column(
children: [ children: <Widget>[
/* 2024-01-12 by DaisyWu /* 2024-01-12 by DaisyWu
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.prompTone!.tr, leftTitel: TranslationLoader.lanKeys!.prompTone!.tr,
@ -114,29 +169,42 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
height: 50.h, height: 50.h,
child: Obx(() => _isTouchUnlockSwitch()))), 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( CommonItem(
leftTitel: TranslationLoader.lanKeys!.pushNotification!.tr, leftTitel: TranslationLoader.lanKeys!.pushNotification!.tr,
rightTitle: "", rightTitle: '',
isHaveRightWidget: true, isHaveRightWidget: true,
isHaveLine: F.appFlavor == Flavor.sky ? true : false, isHaveLine: F.sw(
skyCall: () => F.appFlavor == Flavor.sky, xhjCall: () => true),
rightWidget: SizedBox( rightWidget: SizedBox(
width: 60.w, width: 60.w,
height: 50.h, height: 50.h,
child: Obx(() => _isPushNotificationSwitch()))), child: Obx(_isPushNotificationSwitch))),
F.appFlavor == Flavor.sky if (F.appFlavor == Flavor.sky)
? CommonItem( CommonItem(
leftTitel: "微信公众号推送".tr, leftTitel: '微信公众号推送'.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: SizedBox( rightWidget: SizedBox(
width: 60.w, width: 60.w,
height: 50.h, height: 50.h,
child: Obx(() => _isWechatPublicAccountPushSwitch()))) child: Obx(_isWechatPublicAccountPushSwitch)))
: Container(), else
Container(),
SizedBox(height: 10.h), SizedBox(height: 10.h),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockUserManagement!.tr, leftTitel: TranslationLoader.lanKeys!.lockUserManagement!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -144,7 +212,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr, leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -153,7 +221,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
//by DaisyWu -- //by DaisyWu --
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.authorityManagement!.tr, leftTitel: TranslationLoader.lanKeys!.authorityManagement!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -162,7 +230,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr, leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -170,7 +238,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.transferSmartLock!.tr, leftTitel: TranslationLoader.lanKeys!.transferSmartLock!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -178,7 +246,8 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr, leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.selectGetewayListPage); Get.toNamed(Routers.selectGetewayListPage);
@ -225,15 +294,16 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
action: () { action: () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.hideInvalidUnlockPermissionsPage, context, Routers.hideInvalidUnlockPermissionsPage,
arguments: {'isOn': state.hideExpiredAccessFlag.value}) arguments: <String, int>{
.then((value) { 'isOn': state.hideExpiredAccessFlag.value
}).then((Object? value) {
logic.userSettingsInfoRequest(); logic.userSettingsInfoRequest();
}); });
})), })),
CommonItem( CommonItem(
leftTitel: TranslationLoader leftTitel: TranslationLoader
.lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr, .lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
rightTitle: "", rightTitle: '',
// allHeight: 100.h, // allHeight: 100.h,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
@ -245,41 +315,58 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
height: 10.h, height: 10.h,
), ),
// //
F.isLite if (!F.isLite)
? Container() CommonItem(
: CommonItem( leftTitel: 'Amazon Alexa',
leftTitel: "Amazon Alexa", rightTitle: '',
rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
logic.showToast("功能暂未开放".tr); logic.showToast('功能暂未开放'.tr);
}), }),
F.isLite if (!F.isLite)
? Container() CommonItem(
: CommonItem( leftTitel: 'Google Home',
leftTitel: "Google Home", rightTitle: '',
rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
logic.showToast("功能暂未开放".tr); logic.showToast('功能暂未开放'.tr);
}), }),
F.isLite if (!F.isLite)
? Container() CommonItem(
: CommonItem(
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr, leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,
rightTitle: "", 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, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
logic.showToast("功能暂未开放".tr); Get.back();
}), Get.toNamed(Routers.aboutPage);
},
),
// CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){ // CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){
// //
// }), // }),
SizedBox( 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: (){ // CommonItem(leftTitel:TranslationLoader.lanKeys!.about!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
// //
@ -300,23 +387,26 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
// CommonItem(leftTitel:TranslationLoader.lanKeys!.thirdPartyInformationSharingList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){ // CommonItem(leftTitel:TranslationLoader.lanKeys!.thirdPartyInformationSharingList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
// //
// }), // }),
keyBottomWidget() F.sw(skyCall: keyBottomWidget, xhjCall: () => const SizedBox())
], ],
); );
} }
Widget keyBottomWidget() { Widget keyBottomWidget() {
return Column( return Padding(
children: [ padding: F.sw(
skyCall: () => EdgeInsets.zero,
xhjCall: () => EdgeInsets.symmetric(horizontal: 15.w)),
child: Column(
children: <Widget>[
SubmitBtn( SubmitBtn(
btnName: TranslationLoader.lanKeys!.logout!.tr, btnName: TranslationLoader.lanKeys!.logout!.tr,
isDelete: true, isDelete: true,
padding: EdgeInsets.symmetric(horizontal: 15.w), padding: EdgeInsets.symmetric(horizontal: 15.w),
onClick: () { onClick: () {
//退 //退
ShowTipView().showIosTipWithContentDialog("确定要退出吗?".tr, () { ShowTipView().showIosTipWithContentDialog(
logic.userLogoutRequest(); '确定要退出吗?'.tr, logic.userLogoutRequest);
});
// showLoginOutAlertTipDialog(); // showLoginOutAlertTipDialog();
}), }),
Container( Container(
@ -324,7 +414,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
// color: Colors.red, // color: Colors.red,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: <Widget>[
TextButton( TextButton(
child: Text( child: Text(
TranslationLoader.lanKeys!.deleteAccount!.tr, TranslationLoader.lanKeys!.deleteAccount!.tr,
@ -346,6 +436,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
height: 30.h, height: 30.h,
) )
], ],
),
); );
} }
@ -411,7 +502,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isPrompTone.value, value: state.isPrompTone.value,
onChanged: (value) { onChanged: (bool value) {
state.isPrompTone.value = !state.isPrompTone.value; state.isPrompTone.value = !state.isPrompTone.value;
logic.updatePrompToneRequest(); logic.updatePrompToneRequest();
}, },
@ -424,7 +515,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isTouchUnlock.value, value: state.isTouchUnlock.value,
onChanged: (value) { onChanged: (bool value) {
state.isTouchUnlock.value = !state.isTouchUnlock.value; state.isTouchUnlock.value = !state.isTouchUnlock.value;
logic.updateTouchUnlockRequest(); logic.updateTouchUnlockRequest();
}, },
@ -438,7 +529,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isWechatPublicAccountPush.value, value: state.isWechatPublicAccountPush.value,
onChanged: (value) { onChanged: (bool value) {
state.isWechatPublicAccountPush.value = state.isWechatPublicAccountPush.value =
!state.isWechatPublicAccountPush.value; !state.isWechatPublicAccountPush.value;
logic.setMpWechatPushSwitchRequest(context); logic.setMpWechatPushSwitchRequest(context);
@ -452,7 +543,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isPushNotification.value, value: state.isPushNotification.value,
onChanged: (value) { onChanged: (bool value) {
// state.isPushNotification.value = !state.isPushNotification.value; // state.isPushNotification.value = !state.isPushNotification.value;
openAppSettings(); openAppSettings();
}, },

View File

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