1.取消用手机号码登陆
2.添加设备页直接跳到扫描设备页
This commit is contained in:
parent
4fa076565f
commit
b0506a8910
@ -52,6 +52,13 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
|
||||
Future<void> login() async {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode()); //关闭键盘
|
||||
|
||||
// 添加邮箱格式验证
|
||||
if (!GetUtils.isEmail(state.emailOrPhone.value)) {
|
||||
showToast('请输入有效的邮箱地址');
|
||||
return;
|
||||
}
|
||||
|
||||
final LoginEntity entity = await ApiRepository.to.login(
|
||||
loginType: '1',
|
||||
password: state.pwd.value,
|
||||
|
||||
@ -90,28 +90,29 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
padding: EdgeInsets.all(10.w),
|
||||
child: Center(child: Image.asset('images/icon_main_drlock_1024.png', width: 110.w, height: 110.w))),
|
||||
SizedBox(height: 50.w),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '你所在的国家/地区'.tr,
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isPadding: false,
|
||||
isHaveRightWidget: true,
|
||||
isHaveDirection: true,
|
||||
rightWidget: Text(
|
||||
'${state.countryName} +${state.countryCode.value}',
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
action: () async {
|
||||
final result = await Get.toNamed(Routers.selectCountryRegionPage);
|
||||
if (result != null) {
|
||||
result as Map<String, dynamic>;
|
||||
state.countryCode.value = result['code'];
|
||||
state.countryKey.value = result['countryName'];
|
||||
logic.checkIpAction();
|
||||
}
|
||||
},
|
||||
)),
|
||||
// Obx(() =>
|
||||
// CommonItem(
|
||||
// leftTitel: '你所在的国家/地区'.tr,
|
||||
// rightTitle: '',
|
||||
// isHaveLine: true,
|
||||
// isPadding: false,
|
||||
// isHaveRightWidget: true,
|
||||
// isHaveDirection: true,
|
||||
// rightWidget: Text(
|
||||
// '${state.countryName} +${state.countryCode.value}',
|
||||
// textAlign: TextAlign.end,
|
||||
// style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
// ),
|
||||
// action: () async {
|
||||
// final result = await Get.toNamed(Routers.selectCountryRegionPage);
|
||||
// if (result != null) {
|
||||
// result as Map<String, dynamic>;
|
||||
// state.countryCode.value = result['code'];
|
||||
// state.countryKey.value = result['countryName'];
|
||||
// logic.checkIpAction();
|
||||
// }
|
||||
// },
|
||||
// )),
|
||||
LoginInput(
|
||||
focusNode: logic.state.emailOrPhoneFocusNode,
|
||||
controller: state.emailOrPhoneController,
|
||||
|
||||
@ -30,7 +30,8 @@ class StarLockLoginState {
|
||||
RxString emailOrPhone = ''.obs;
|
||||
RxString pwd = ''.obs;
|
||||
RxBool canNext = false.obs;
|
||||
bool get isEmailOrPhone => emailOrPhone.value.isNotEmpty;
|
||||
// bool get isEmailOrPhone => emailOrPhone.value.isNotEmpty;
|
||||
bool get isEmailOrPhone => GetUtils.isEmail(emailOrPhone.value);
|
||||
bool get pwdIsOK => pwd.value.isNotEmpty;
|
||||
|
||||
TextEditingController emailOrPhoneController = TextEditingController();
|
||||
|
||||
@ -41,7 +41,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
child: ListView(
|
||||
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
|
||||
children: <Widget>[
|
||||
topSelectCountryAndRegionWidget(),
|
||||
// topSelectCountryAndRegionWidget(),
|
||||
middleTFWidget(),
|
||||
Obx(() {
|
||||
return SubmitBtn(
|
||||
@ -75,73 +75,73 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
Widget topSelectCountryAndRegionWidget() {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
// SizedBox(height: 50.h),
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: <Widget>[
|
||||
// Container(
|
||||
// width: 340.w,
|
||||
// height: 60.h,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
||||
// border: Border.all(width: 1.0, color: AppColors.greyLineColor)),
|
||||
// child: Row(
|
||||
// children: <Widget>[
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// state.isIphoneType.value = true;
|
||||
// },
|
||||
// child: Obx(
|
||||
// () => Container(
|
||||
// width: 170.w,
|
||||
// height: 60.h,
|
||||
// decoration: state.isIphoneType.value
|
||||
// ? BoxDecoration(
|
||||
// color: AppColors.mainColor,
|
||||
// borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
||||
// border: Border.all(width: 1.0, color: AppColors.greyLineColor))
|
||||
// : null,
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// '手机'.tr,
|
||||
// style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: GestureDetector(
|
||||
// onTap: () {
|
||||
// state.isIphoneType.value = false;
|
||||
// },
|
||||
// child: Obx(
|
||||
// () => Container(
|
||||
// height: 60.h,
|
||||
// decoration: !state.isIphoneType.value
|
||||
// ? BoxDecoration(
|
||||
// color: AppColors.mainColor,
|
||||
// borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
||||
// border: Border.all(width: 1.0, color: AppColors.greyLineColor))
|
||||
// : null,
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// '邮箱'.tr,
|
||||
// style: TextStyle(
|
||||
// color: !state.isIphoneType.value ? Colors.white : Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// SizedBox(height: 60.h),
|
||||
SizedBox(height: 50.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 340.w,
|
||||
height: 60.h,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
||||
border: Border.all(width: 1.0, color: AppColors.greyLineColor)),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
state.isIphoneType.value = true;
|
||||
},
|
||||
child: Obx(
|
||||
() => Container(
|
||||
width: 170.w,
|
||||
height: 60.h,
|
||||
decoration: state.isIphoneType.value
|
||||
? BoxDecoration(
|
||||
color: AppColors.mainColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
||||
border: Border.all(width: 1.0, color: AppColors.greyLineColor))
|
||||
: null,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'手机'.tr,
|
||||
style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
state.isIphoneType.value = false;
|
||||
},
|
||||
child: Obx(
|
||||
() => Container(
|
||||
height: 60.h,
|
||||
decoration: !state.isIphoneType.value
|
||||
? BoxDecoration(
|
||||
color: AppColors.mainColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
||||
border: Border.all(width: 1.0, color: AppColors.greyLineColor))
|
||||
: null,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'邮箱'.tr,
|
||||
style: TextStyle(
|
||||
color: !state.isIphoneType.value ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 60.h),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
final result = await Get.toNamed(Routers.selectCountryRegionPage);
|
||||
|
||||
@ -23,9 +23,11 @@ import 'package:star_lock/tools/submitBtn.dart';
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../baseWidget.dart';
|
||||
import '../../../flavors.dart';
|
||||
import '../../../mine/addLock/selectLockType/selectLockType_logic.dart';
|
||||
import '../../../mine/message/messageList/messageList_page.dart';
|
||||
import '../../../mine/mine/starLockMine_page.dart';
|
||||
import '../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../tools/commonDataManage.dart';
|
||||
import '../../../tools/eventBusEventManage.dart';
|
||||
import '../../../tools/storage.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
@ -48,6 +50,8 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
||||
final LockMainLogic logic = Get.put(LockMainLogic());
|
||||
final LockMainState state = Get.find<LockMainLogic>().state;
|
||||
|
||||
final SelectLockTypeLogic logicType = Get.put(SelectLockTypeLogic());
|
||||
|
||||
Future<void> getHttpData({bool clearScanDevices = false, bool isUnShowLoading = false}) async {
|
||||
LockListInfoGroupEntity? lockListInfoGroupEntity = await Storage.getLockMainListData();
|
||||
if (lockListInfoGroupEntity != null) {
|
||||
@ -161,37 +165,45 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
||||
switch (type) {
|
||||
case 0:
|
||||
// 显示无数据模式
|
||||
returnWidget = unHaveData();
|
||||
returnWidget = MainBg(child: unHaveData());
|
||||
break;
|
||||
case 1:
|
||||
// 只有一条数据
|
||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||
returnWidget = LockDetailPage(
|
||||
returnWidget = MainBg(child: LockDetailPage(
|
||||
isOnlyOneData: true,
|
||||
lockListInfoItemEntity: state.lockListInfoGroupEntity.value.groupList![0].lockList![0]);
|
||||
lockListInfoItemEntity: state.lockListInfoGroupEntity.value.groupList![0].lockList![0]));
|
||||
break;
|
||||
case 2:
|
||||
// 有多条数据
|
||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||
returnWidget = F.sw(
|
||||
skyCall: () => LockListPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value),
|
||||
xhjCall: () => LockListXHJPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value));
|
||||
skyCall: () => MainBg(child: LockListPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)),
|
||||
xhjCall: () => MainBg(child: LockListXHJPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)));
|
||||
break;
|
||||
default:
|
||||
returnWidget = NoData();
|
||||
returnWidget = MainBg(child: NoData());
|
||||
break;
|
||||
}
|
||||
} else if (state.selectedIndex.value == 1) {
|
||||
returnWidget = MessageListPage();
|
||||
returnWidget = MainBg(child: MessageListPage());
|
||||
} else {
|
||||
returnWidget = StarLockMinePage();
|
||||
returnWidget = MainBg(child: StarLockMinePage());
|
||||
}
|
||||
return returnWidget;
|
||||
}
|
||||
|
||||
//鑫泓佳背景
|
||||
Widget XHJBg({required Widget child}) {
|
||||
return Container();
|
||||
//背景
|
||||
Widget MainBg({required Widget child}) {
|
||||
return Container(
|
||||
child: child,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('images/lockMain_bg.jpg'),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget unHaveData() {
|
||||
@ -223,10 +235,14 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
//实现回调函数
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routers.selectLockTypePage,
|
||||
);
|
||||
// Navigator.pushNamed(
|
||||
// context,
|
||||
// Routers.selectLockTypePage,
|
||||
// );
|
||||
|
||||
// 跳转到扫描设备页
|
||||
CommonDataManage().seletLockType = 0;
|
||||
logicType.getNearByLimits();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.add_circle_outline_rounded,
|
||||
@ -257,10 +273,14 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
||||
),
|
||||
onTap: () {
|
||||
//实现回调函数
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routers.selectLockTypePage,
|
||||
);
|
||||
// Navigator.pushNamed(
|
||||
// context,
|
||||
// Routers.selectLockTypePage,
|
||||
// );
|
||||
|
||||
// 跳转到扫描设备页
|
||||
CommonDataManage().seletLockType = 0;
|
||||
logicType.getNearByLimits();
|
||||
},
|
||||
)),
|
||||
],
|
||||
|
||||
@ -55,6 +55,9 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
logicSet.userSettingsInfoRequest();
|
||||
|
||||
logic.getUserInfoRequest();
|
||||
|
||||
// 初始化时检查推送权限状态
|
||||
_checkNotificationPermission();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -245,11 +248,11 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.w),
|
||||
child: Column(
|
||||
children: [
|
||||
mineItem('images/mine/icon_mine_main_set.png', '设置'.tr, () {
|
||||
Get.back();
|
||||
Get.toNamed(Routers.mineSetPage);
|
||||
}),
|
||||
SizedBox(height: 20.h),
|
||||
// mineItem('images/mine/icon_mine_main_set.png', '设置'.tr, () {
|
||||
// Get.back();
|
||||
// Get.toNamed(Routers.mineSetPage);
|
||||
// }),
|
||||
// SizedBox(height: 20.h),
|
||||
mineItem('images/mine/icon_mine_main_vip.png', '增值服务'.tr, () async {
|
||||
final bool? isVip = await Storage.getBool(saveIsVip);
|
||||
if (isVip == null || !isVip) {
|
||||
@ -289,7 +292,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
SizedBox(width: 15.w),
|
||||
Text(
|
||||
lockTypeTitle,
|
||||
style: TextStyle(fontSize: 22.sp),
|
||||
style: TextStyle(fontSize: 28.sp),
|
||||
),
|
||||
const Spacer(),
|
||||
Icon(
|
||||
@ -345,7 +348,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w,
|
||||
height: 50.h,
|
||||
child: Obx(() => _isPushNotificationSwitch())
|
||||
child: Obx(_isPushNotificationSwitch)
|
||||
)),
|
||||
// if (F.appFlavor == Flavor.sky)
|
||||
Visibility(
|
||||
@ -596,14 +599,20 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: stateSet.isPushNotification.value,
|
||||
onChanged: (bool value) {
|
||||
onChanged: (bool value) async {
|
||||
// stateSet.isPushNotification.value = !stateSet.isPushNotification.value;
|
||||
stateSet.isPushNotification.value = value;
|
||||
openAppSettings();
|
||||
final PermissionStatus newStatus = await Permission.notification.status;
|
||||
stateSet.isPushNotification.value = newStatus.isGranted;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _checkNotificationPermission() async {
|
||||
final PermissionStatus status = await Permission.notification.status;
|
||||
stateSet.isPushNotification.value = status.isGranted;
|
||||
}
|
||||
|
||||
Widget otherItem(
|
||||
{String? leftTitle,
|
||||
bool? isHaveLine,
|
||||
@ -669,8 +678,10 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
onClick: () {
|
||||
//退出登录
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'确定要退出吗?'.tr, logic.userLogoutRequest);
|
||||
// showLoginOutAlertTipDialog();
|
||||
'确定要退出吗?'.tr, () async {
|
||||
await logicSet.userLogoutRequest();
|
||||
// showLoginOutAlertTipDialog();
|
||||
});
|
||||
}),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 30.w, top: 30.h),
|
||||
|
||||
@ -67,7 +67,7 @@ class CommonItem extends StatelessWidget {
|
||||
),
|
||||
child: Text(
|
||||
leftTitel!,
|
||||
style: leftTitleStyle ?? TextStyle(fontSize: 22.sp),
|
||||
style: leftTitleStyle ?? TextStyle(fontSize: 28.sp),
|
||||
overflow: TextOverflow.ellipsis, // 超出部分显示省略号
|
||||
maxLines: 3, // 最多显示2行
|
||||
),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user