优化输入框输入需要点击两次问题
This commit is contained in:
parent
c7d0495ebe
commit
5bb1e9c438
@ -88,7 +88,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
height: 0.5.h,
|
height: 0.5.h,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.phoneController,
|
controller: state.phoneController,
|
||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.phoneController);
|
logic.checkNext(state.phoneController);
|
||||||
@ -107,7 +107,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
LengthLimitingTextInputFormatter(30),
|
LengthLimitingTextInputFormatter(30),
|
||||||
]),
|
]),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.pwdController,
|
controller: state.pwdController,
|
||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.pwdController);
|
logic.checkNext(state.pwdController);
|
||||||
@ -134,7 +134,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
color: AppColors.placeholderTextColor, fontSize: 20.sp),
|
color: AppColors.placeholderTextColor, fontSize: 20.sp),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.w),
|
SizedBox(height: 10.w),
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.sureController,
|
controller: state.sureController,
|
||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.sureController);
|
logic.checkNext(state.sureController);
|
||||||
@ -158,7 +158,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: LoginInput().tfInput(
|
child: LoginInput(
|
||||||
controller: state.codeController,
|
controller: state.codeController,
|
||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.codeController);
|
logic.checkNext(state.codeController);
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
@ -7,6 +8,7 @@ import 'package:star_lock/flavors.dart';
|
|||||||
import '../../appRouters.dart';
|
import '../../appRouters.dart';
|
||||||
import '../../app_settings/app_colors.dart';
|
import '../../app_settings/app_colors.dart';
|
||||||
import '../../common/XSConstantMacro/XSConstantMacro.dart';
|
import '../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
|
import '../../tools/commonItem.dart';
|
||||||
import '../../tools/tf_loginInput.dart';
|
import '../../tools/tf_loginInput.dart';
|
||||||
import '../../tools/submitBtn.dart';
|
import '../../tools/submitBtn.dart';
|
||||||
import '../../tools/titleAppBar.dart';
|
import '../../tools/titleAppBar.dart';
|
||||||
@ -54,15 +56,19 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
child: Image.asset('images/icon_main_1024.png',
|
child: Image.asset('images/icon_main_1024.png',
|
||||||
width: 110.w, height: 110.w))),
|
width: 110.w, height: 110.w))),
|
||||||
SizedBox(height: 50.w),
|
SizedBox(height: 50.w),
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.emailOrPhoneController,
|
controller: state.emailOrPhoneController,
|
||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.emailOrPhoneController);
|
logic.checkNext(state.emailOrPhoneController);
|
||||||
},
|
},
|
||||||
leftWidget: Image.asset(
|
leftWidget: Padding(
|
||||||
'images/icon_login_account.png',
|
padding: EdgeInsets.only(
|
||||||
width: 36.w,
|
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||||
height: 36.w,
|
child: Image.asset(
|
||||||
|
'images/icon_login_account.png',
|
||||||
|
width: 36.w,
|
||||||
|
height: 36.w,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
hintText:
|
hintText:
|
||||||
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||||
@ -72,16 +78,20 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
LengthLimitingTextInputFormatter(30),
|
LengthLimitingTextInputFormatter(30),
|
||||||
]),
|
]),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.pwdController,
|
controller: state.pwdController,
|
||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.pwdController);
|
logic.checkNext(state.pwdController);
|
||||||
},
|
},
|
||||||
isPwd: true,
|
isPwd: true,
|
||||||
leftWidget: Image.asset(
|
leftWidget: Padding(
|
||||||
'images/icon_login_password.png',
|
padding: EdgeInsets.only(
|
||||||
width: 36.w,
|
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||||
height: 36.w,
|
child: Image.asset(
|
||||||
|
'images/icon_login_password.png',
|
||||||
|
width: 36.w,
|
||||||
|
height: 36.w,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
hintText:
|
hintText:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||||
@ -215,4 +225,71 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget loginInput({
|
||||||
|
TextEditingController? controller,
|
||||||
|
List<TextInputFormatter>? inputFormatters,
|
||||||
|
String? hintText,
|
||||||
|
bool? isHaveLeftWidget,
|
||||||
|
Widget? leftWidget,
|
||||||
|
String? label,
|
||||||
|
bool? isPwd,
|
||||||
|
BlockStrCallback? onchangeAction}) {
|
||||||
|
return Container(
|
||||||
|
// color: Colors.red,
|
||||||
|
width: 1.sp,
|
||||||
|
// height: 200.h,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.red,
|
||||||
|
child: Image.asset(
|
||||||
|
'images/icon_login_password.png',
|
||||||
|
width: 36.w,
|
||||||
|
height: 36.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 40.w,),
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
//输入框一行
|
||||||
|
maxLines: 1,
|
||||||
|
controller: controller,
|
||||||
|
onChanged: onchangeAction,
|
||||||
|
// autofocus: false,
|
||||||
|
inputFormatters:inputFormatters,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
//输入里面输入文字内边距设置
|
||||||
|
contentPadding: const EdgeInsets.only(
|
||||||
|
top: 8.0, left: -19.0, right: -15.0, bottom: 8.0),
|
||||||
|
labelText: label,
|
||||||
|
labelStyle: TextStyle(fontSize: 22.sp),
|
||||||
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
|
hintText: hintText,
|
||||||
|
//不需要输入框下划线
|
||||||
|
border: InputBorder.none,
|
||||||
|
//左边图标设置
|
||||||
|
// icon: isHaveLeftWidget == true
|
||||||
|
// ? leftWidget
|
||||||
|
// : SizedBox(
|
||||||
|
// width: 20.w,
|
||||||
|
// height: 40.w,
|
||||||
|
// ),
|
||||||
|
),
|
||||||
|
obscureText: isPwd ?? false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 0.5.h,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,8 +13,6 @@ class StarLockLoginState {
|
|||||||
|
|
||||||
TextEditingController emailOrPhoneController = TextEditingController();
|
TextEditingController emailOrPhoneController = TextEditingController();
|
||||||
TextEditingController pwdController = TextEditingController();
|
TextEditingController pwdController = TextEditingController();
|
||||||
late FocusNode myFocusNode1;
|
|
||||||
late FocusNode myFocusNode2;
|
|
||||||
|
|
||||||
StarLockLoginState() {
|
StarLockLoginState() {
|
||||||
// emailOrPhone.value = StoreService.to.getLastUserAccount() as String;
|
// emailOrPhone.value = StoreService.to.getLastUserAccount() as String;
|
||||||
|
|||||||
@ -196,7 +196,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
Widget middleTFWidget() {
|
Widget middleTFWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.phoneOrEmailController,
|
controller: state.phoneOrEmailController,
|
||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.phoneOrEmailController);
|
logic.checkNext(state.phoneOrEmailController);
|
||||||
@ -218,7 +218,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
LengthLimitingTextInputFormatter(30),
|
LengthLimitingTextInputFormatter(30),
|
||||||
]),
|
]),
|
||||||
SizedBox(height: 10.w),
|
SizedBox(height: 10.w),
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.pwdController,
|
controller: state.pwdController,
|
||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.pwdController);
|
logic.checkNext(state.pwdController);
|
||||||
@ -244,7 +244,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
|
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.w),
|
SizedBox(height: 10.w),
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.sureController,
|
controller: state.sureController,
|
||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.sureController);
|
logic.checkNext(state.sureController);
|
||||||
@ -267,7 +267,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: LoginInput().tfInput(
|
child: LoginInput(
|
||||||
controller: state.codeController,
|
controller: state.codeController,
|
||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.codeController);
|
logic.checkNext(state.codeController);
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
|
|||||||
),
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
margin: EdgeInsets.only(left: 20.w, right: 20.w),
|
margin: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||||
child: LoginInput().tfInput(
|
child: LoginInput(
|
||||||
controller: state.changeLockNameController,
|
controller: state.changeLockNameController,
|
||||||
leftWidget: const SizedBox(),
|
leftWidget: const SizedBox(),
|
||||||
hintText: "请输入名称",
|
hintText: "请输入名称",
|
||||||
|
|||||||
@ -242,7 +242,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
// 获取到锁给的字符数组
|
// 获取到锁给的字符数组
|
||||||
var featureNetxLength = index + featureValueLength + 1;
|
var featureNetxLength = index + featureValueLength + 1;
|
||||||
if(reply.data.length < featureNetxLength){
|
if(reply.data.length < featureNetxLength){
|
||||||
showToast("锁特征值数据获取失败,请重新点击获取");
|
showToast("锁数据异常,请重试");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var featureValue = reply.data.sublist(index + 1, index + featureValueLength + 1);
|
var featureValue = reply.data.sublist(index + 1, index + featureValueLength + 1);
|
||||||
@ -257,7 +257,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
// 使能锁特征值说明(本机启用的功能)
|
// 使能锁特征值说明(本机启用的功能)
|
||||||
var featureEnNextLength = index + featureEnValLength + 1;
|
var featureEnNextLength = index + featureEnValLength + 1;
|
||||||
if(reply.data.length < featureEnNextLength){
|
if(reply.data.length < featureEnNextLength){
|
||||||
showToast("锁使能特征值数据获取失败,请重新点击获取");
|
showToast("锁数据异常,请重试");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var featureEnVal = reply.data.sublist(index + 1, index + featureEnValLength + 1);
|
var featureEnVal = reply.data.sublist(index + 1, index + featureEnValLength + 1);
|
||||||
|
|||||||
@ -89,7 +89,7 @@ class _MinePersonInfoEditIphonePageState
|
|||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.w),
|
SizedBox(height: 10.w),
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: _phoneController,
|
controller: _phoneController,
|
||||||
isPwd: true,
|
isPwd: true,
|
||||||
leftWidget: const SizedBox(),
|
leftWidget: const SizedBox(),
|
||||||
@ -102,7 +102,7 @@ class _MinePersonInfoEditIphonePageState
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: LoginInput().tfInput(
|
child: LoginInput(
|
||||||
controller: _codeController,
|
controller: _codeController,
|
||||||
isPwd: true,
|
isPwd: true,
|
||||||
leftWidget: const SizedBox(),
|
leftWidget: const SizedBox(),
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class _MinePersonInfoEditNamePageState
|
|||||||
padding: EdgeInsets.all(15.w),
|
padding: EdgeInsets.all(15.w),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.nickNameController,
|
controller: state.nickNameController,
|
||||||
onchangeAction: (textStr) {
|
onchangeAction: (textStr) {
|
||||||
logic.checkNext(state.nickNameController);
|
logic.checkNext(state.nickNameController);
|
||||||
|
|||||||
@ -45,7 +45,7 @@ class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
|
|||||||
: TranslationLoader.lanKeys!.changeEmailTip!.tr,
|
: TranslationLoader.lanKeys!.changeEmailTip!.tr,
|
||||||
style: TextStyle(fontSize: 20.sp),
|
style: TextStyle(fontSize: 20.sp),
|
||||||
)),
|
)),
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.accountController,
|
controller: state.accountController,
|
||||||
isPwd: false,
|
isPwd: false,
|
||||||
onchangeAction: (textStr) {
|
onchangeAction: (textStr) {
|
||||||
@ -62,7 +62,7 @@ class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: LoginInput().tfInput(
|
child: LoginInput(
|
||||||
controller: state.codeController,
|
controller: state.codeController,
|
||||||
isPwd: false,
|
isPwd: false,
|
||||||
leftWidget: const SizedBox(),
|
leftWidget: const SizedBox(),
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class _MinePersonInfoResetPasswordPageState
|
|||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w),
|
margin: EdgeInsets.only(left: 30.w, right: 30.w),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.oldPwdController,
|
controller: state.oldPwdController,
|
||||||
onchangeAction: (textStr) {
|
onchangeAction: (textStr) {
|
||||||
logic.changeInput(state.oldPwdController);
|
logic.changeInput(state.oldPwdController);
|
||||||
@ -50,7 +50,7 @@ class _MinePersonInfoResetPasswordPageState
|
|||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.newPwdController,
|
controller: state.newPwdController,
|
||||||
onchangeAction: (textStr) {
|
onchangeAction: (textStr) {
|
||||||
logic.changeInput(state.newPwdController);
|
logic.changeInput(state.newPwdController);
|
||||||
@ -64,7 +64,7 @@ class _MinePersonInfoResetPasswordPageState
|
|||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
LoginInput().tfInput(
|
LoginInput(
|
||||||
controller: state.surePwdController,
|
controller: state.surePwdController,
|
||||||
onchangeAction: (textStr) {
|
onchangeAction: (textStr) {
|
||||||
logic.changeInput(state.surePwdController);
|
logic.changeInput(state.surePwdController);
|
||||||
|
|||||||
@ -11,12 +11,22 @@ class LockUserManageListLogic extends BaseGetXController {
|
|||||||
final LockUserManageListState state = LockUserManageListState();
|
final LockUserManageListState state = LockUserManageListState();
|
||||||
|
|
||||||
//请求锁用户列表
|
//请求锁用户列表
|
||||||
void lockUserListRequest() async {
|
Future<LockUserListEntity> lockUserListRequest() async {
|
||||||
LockUserListEntity entity =
|
LockUserListEntity entity =
|
||||||
await ApiRepository.to.lockUserList('1', '20', state.searchController.text);
|
await ApiRepository.to.lockUserList(pageNo.toString(), '20', state.searchController.text);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
state.dataList.value = entity.data!;
|
if (pageNo == 1) {
|
||||||
|
state.dataList.value = entity.data!;
|
||||||
|
pageNo++;
|
||||||
|
} else {
|
||||||
|
if (entity.data!.isNotEmpty) {
|
||||||
|
state.dataList.value.addAll(entity.data!);
|
||||||
|
print("state.itemDataList.value.length:${state.dataList.value.length}");
|
||||||
|
pageNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除锁用户管理
|
//删除锁用户管理
|
||||||
@ -24,7 +34,10 @@ class LockUserManageListLogic extends BaseGetXController {
|
|||||||
var entity = await ApiRepository.to.deletLockUser(uid);
|
var entity = await ApiRepository.to.deletLockUser(uid);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
EasyLoading.showToast('删除成功',duration: 2000.milliseconds);
|
EasyLoading.showToast('删除成功',duration: 2000.milliseconds);
|
||||||
lockUserListRequest();
|
showToast('删除成功', something: (){
|
||||||
|
pageNo = 1;
|
||||||
|
lockUserListRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +46,7 @@ class LockUserManageListLogic extends BaseGetXController {
|
|||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
lockUserListRequest();
|
// lockUserListRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
@ -8,6 +9,8 @@ import '../../../../../appRouters.dart';
|
|||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../../translations/trans_lib.dart';
|
import '../../../../../translations/trans_lib.dart';
|
||||||
|
import '../../../../tools/EasyRefreshTool.dart';
|
||||||
|
import '../../../../tools/keySearchWidget.dart';
|
||||||
import '../../../../tools/left_slide_actions.dart';
|
import '../../../../tools/left_slide_actions.dart';
|
||||||
import '../../../../tools/showIosTipView.dart';
|
import '../../../../tools/showIosTipView.dart';
|
||||||
import 'lockUserManageList_logic.dart';
|
import 'lockUserManageList_logic.dart';
|
||||||
@ -23,6 +26,19 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
|||||||
final logic = Get.put(LockUserManageListLogic());
|
final logic = Get.put(LockUserManageListLogic());
|
||||||
final state = Get.find<LockUserManageListLogic>().state;
|
final state = Get.find<LockUserManageListLogic>().state;
|
||||||
|
|
||||||
|
Future<void> getHttpData() async {
|
||||||
|
logic.lockUserListRequest().then((LockUserListEntity value){
|
||||||
|
if(mounted) setState(() {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
getHttpData();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -43,75 +59,53 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: EasyRefreshTool(
|
||||||
children: [
|
onRefresh: (){
|
||||||
_searchWidget(),
|
logic.pageNo = 1;
|
||||||
SizedBox(
|
getHttpData();
|
||||||
height: 20.h,
|
|
||||||
),
|
|
||||||
Obx(() => Expanded(child: _buildMainUI())),
|
|
||||||
SizedBox(
|
|
||||||
width: ScreenUtil().screenWidth - 40.w,
|
|
||||||
height: 90.h,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.massSendElectronicKeyManagePage)
|
|
||||||
.then((value) {
|
|
||||||
logic.lockUserListRequest();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
TranslationLoader.lanKeys!.sendGroupKey!.tr,
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 24.sp,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 64.h,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _searchWidget() {
|
|
||||||
return Container(
|
|
||||||
height: 60.h,
|
|
||||||
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 20.w),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
|
||||||
child: TextField(
|
|
||||||
//输入框一行
|
|
||||||
maxLines: 1,
|
|
||||||
controller: state.searchController,
|
|
||||||
autofocus: false,
|
|
||||||
onSubmitted: (value) {
|
|
||||||
logic.lockUserListRequest();
|
|
||||||
},
|
},
|
||||||
decoration: InputDecoration(
|
onLoad: (){
|
||||||
//输入里面输入文字内边距设置
|
getHttpData();
|
||||||
contentPadding: const EdgeInsets.only(
|
},
|
||||||
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
|
child: Column(
|
||||||
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
children: [
|
||||||
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
|
KeySearchWidget(
|
||||||
//不需要输入框下划线
|
editingController: state.searchController,
|
||||||
border: InputBorder.none,
|
onSubmittedAction: () {
|
||||||
//左边图标设置
|
logic.pageNo = 1;
|
||||||
icon: Padding(
|
getHttpData();
|
||||||
padding: EdgeInsets.only(
|
},
|
||||||
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
|
|
||||||
child: Image.asset(
|
|
||||||
'images/main/icon_main_search.png',
|
|
||||||
width: 40.w,
|
|
||||||
height: 40.w,
|
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
Obx(() => Expanded(child: _buildMainUI())),
|
||||||
|
SizedBox(
|
||||||
|
width: ScreenUtil().screenWidth - 40.w,
|
||||||
|
height: 90.h,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.massSendElectronicKeyManagePage)
|
||||||
|
.then((value) {
|
||||||
|
logic.lockUserListRequest();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
TranslationLoader.lanKeys!.sendGroupKey!.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 64.h,
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -119,34 +113,56 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
|||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return state.dataList.isEmpty
|
return state.dataList.isEmpty
|
||||||
? NoData()
|
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
||||||
: ListView.separated(
|
: SlidableAutoCloseBehavior(
|
||||||
itemCount: state.dataList.length,
|
child: ListView.separated(
|
||||||
itemBuilder: (c, index) {
|
itemCount: state.dataList.length,
|
||||||
LockUserData indexEntity = state.dataList[index];
|
itemBuilder: (c, index) {
|
||||||
if (index < state.dataList.length) {
|
LockUserData indexEntity = state.dataList[index];
|
||||||
return LeftSlideActions(
|
if (index < state.dataList.length) {
|
||||||
key: Key(indexEntity.userid!),
|
return Slidable(
|
||||||
actionsWidth: 60,
|
key:ValueKey(indexEntity.uid),
|
||||||
actions: [
|
endActionPane: ActionPane(
|
||||||
_buildDeleteBtn(indexEntity),
|
extentRatio: 0.2,
|
||||||
],
|
motion: const ScrollMotion(),
|
||||||
decoration: const BoxDecoration(
|
children: [
|
||||||
borderRadius: BorderRadius.all(Radius.circular(1)),
|
SlidableAction(
|
||||||
),
|
onPressed: (BuildContext context){
|
||||||
child: _electronicKeyItem(indexEntity),
|
showIosTipViewDialog(context, indexEntity);
|
||||||
|
},
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
label: '删除',
|
||||||
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: _electronicKeyItem(indexEntity),
|
||||||
|
);
|
||||||
|
|
||||||
|
// return LeftSlideActions(
|
||||||
|
// key: Key(indexEntity.userid!),
|
||||||
|
// actionsWidth: 60,
|
||||||
|
// actions: [
|
||||||
|
// _buildDeleteBtn(indexEntity),
|
||||||
|
// ],
|
||||||
|
// decoration: const BoxDecoration(
|
||||||
|
// borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||||
|
// ),
|
||||||
|
// child: _electronicKeyItem(indexEntity),
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
// return _electronicKeyItem(indexEntity);
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
return const SizedBox.shrink();
|
),
|
||||||
// return _electronicKeyItem(indexEntity);
|
);
|
||||||
},
|
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
|
||||||
return const Divider(
|
|
||||||
height: 1,
|
|
||||||
color: AppColors.greyLineColor,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(LockUserData itemData) {
|
Widget _electronicKeyItem(LockUserData itemData) {
|
||||||
@ -217,28 +233,28 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDeleteBtn(LockUserData passwordKeyListItem) {
|
// Widget _buildDeleteBtn(LockUserData passwordKeyListItem) {
|
||||||
return GestureDetector(
|
// return GestureDetector(
|
||||||
onTap: () {
|
// onTap: () {
|
||||||
// 省略: 弹出是否删除的确认对话框。
|
// // 省略: 弹出是否删除的确认对话框。
|
||||||
showIosTipViewDialog(context, passwordKeyListItem);
|
// showIosTipViewDialog(context, passwordKeyListItem);
|
||||||
},
|
// },
|
||||||
child: Container(
|
// child: Container(
|
||||||
width: 60,
|
// width: 60,
|
||||||
color: const Color(0xFFF20101),
|
// color: const Color(0xFFF20101),
|
||||||
alignment: Alignment.center,
|
// alignment: Alignment.center,
|
||||||
child: const Text(
|
// child: const Text(
|
||||||
'删除',
|
// '删除',
|
||||||
style: TextStyle(
|
// style: TextStyle(
|
||||||
fontSize: 16,
|
// fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
// fontWeight: FontWeight.w500,
|
||||||
color: Colors.white,
|
// color: Colors.white,
|
||||||
height: 1,
|
// height: 1,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
void showIosTipViewDialog(BuildContext context, LockUserData lockUserData) {
|
void showIosTipViewDialog(BuildContext context, LockUserData lockUserData) {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
|||||||
@ -763,9 +763,9 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//锁用户列表
|
//锁用户列表
|
||||||
Future<LockUserListEntity> deletLockUser(int uid) async {
|
Future<LoginEntity> deletLockUser(int uid) async {
|
||||||
final res = await apiProvider.deletLockUser(uid);
|
final res = await apiProvider.deletLockUser(uid);
|
||||||
return LockUserListEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
//用户拥有的钥匙
|
//用户拥有的钥匙
|
||||||
|
|||||||
@ -8,61 +8,74 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
* */
|
* */
|
||||||
|
|
||||||
typedef BlockStrCallback = void Function(dynamic textStr);
|
typedef BlockStrCallback = void Function(dynamic textStr);
|
||||||
|
typedef BlockClickCallback = void Function();
|
||||||
|
class LoginInput extends StatelessWidget {
|
||||||
|
TextEditingController? controller;
|
||||||
|
FocusNode? focusNode;
|
||||||
|
List<TextInputFormatter>? inputFormatters;
|
||||||
|
TextInputType? keyboardType;
|
||||||
|
Color? background;
|
||||||
|
String? hintText;
|
||||||
|
bool? isHaveLeftWidget;
|
||||||
|
Widget? leftWidget;
|
||||||
|
String? label;
|
||||||
|
bool? isPwd;
|
||||||
|
Widget? rightSlot;
|
||||||
|
BlockStrCallback? onchangeAction;
|
||||||
|
BlockClickCallback? onTapAction;
|
||||||
|
LoginInput(
|
||||||
|
{Key? key,
|
||||||
|
required this.controller,
|
||||||
|
this.focusNode,
|
||||||
|
this.rightSlot,
|
||||||
|
this.label,
|
||||||
|
this.isPwd,
|
||||||
|
this.inputFormatters,
|
||||||
|
this.keyboardType,
|
||||||
|
this.background,
|
||||||
|
this.hintText,
|
||||||
|
this.isHaveLeftWidget = true,
|
||||||
|
this.leftWidget,
|
||||||
|
this.onchangeAction,
|
||||||
|
this.onTapAction})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
class LoginInput{
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
Widget tfInput({
|
return Container(
|
||||||
TextEditingController? controller,
|
|
||||||
List<TextInputFormatter>? inputFormatters,
|
|
||||||
TextInputType? keyboardType,
|
|
||||||
Color? background,
|
|
||||||
String? hintText,
|
|
||||||
bool? isHaveLeftWidget,
|
|
||||||
Widget? leftWidget,
|
|
||||||
String? label,
|
|
||||||
bool? isPwd,
|
|
||||||
Widget? rightSlot,
|
|
||||||
BlockStrCallback? onchangeAction}) {
|
|
||||||
return SizedBox(
|
|
||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
width: 1.sp,
|
// width: 1.sp,
|
||||||
// height: 200.h,
|
// height: 200.h,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
TextField(
|
||||||
children: [
|
//输入框一行
|
||||||
leftWidget ?? SizedBox(width: 36.w, height: 36.w),
|
maxLines: 1,
|
||||||
SizedBox(width: 40.w,),
|
controller: controller,
|
||||||
Expanded(
|
focusNode: focusNode,
|
||||||
child: TextField(
|
onChanged: onchangeAction,
|
||||||
//输入框一行
|
onTap: onTapAction,
|
||||||
maxLines: 1,
|
autofocus: false,
|
||||||
controller: controller,
|
inputFormatters:inputFormatters,
|
||||||
onChanged: onchangeAction,
|
decoration: InputDecoration(
|
||||||
// autofocus: false,
|
//输入里面输入文字内边距设置
|
||||||
inputFormatters:inputFormatters,
|
contentPadding: const EdgeInsets.only(
|
||||||
decoration: InputDecoration(
|
top: 8.0, left: -19.0, right: -15.0, bottom: 8.0),
|
||||||
//输入里面输入文字内边距设置
|
labelText: label,
|
||||||
contentPadding: const EdgeInsets.only(
|
labelStyle: TextStyle(fontSize: 22.sp),
|
||||||
top: 8.0, left: -19.0, right: -15.0, bottom: 8.0),
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
labelText: label,
|
hintText: hintText,
|
||||||
labelStyle: TextStyle(fontSize: 22.sp),
|
//不需要输入框下划线
|
||||||
hintStyle: TextStyle(fontSize: 22.sp),
|
border: InputBorder.none,
|
||||||
hintText: hintText,
|
//左边图标设置
|
||||||
//不需要输入框下划线
|
icon: isHaveLeftWidget == true
|
||||||
border: InputBorder.none,
|
? leftWidget
|
||||||
//左边图标设置
|
: SizedBox(
|
||||||
// icon: isHaveLeftWidget == true
|
width: 20.w,
|
||||||
// ? leftWidget
|
height: 40.w,
|
||||||
// : SizedBox(
|
),
|
||||||
// width: 20.w,
|
),
|
||||||
// height: 40.w,
|
obscureText: isPwd ?? false,
|
||||||
// ),
|
|
||||||
),
|
|
||||||
obscureText: isPwd ?? false,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 0.5.h,
|
height: 0.5.h,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user