diff --git a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart index 59d29e1d..a017903b 100644 --- a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart +++ b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart @@ -88,7 +88,7 @@ class _StarLockForgetPasswordPageState height: 0.5.h, color: Colors.grey, ), - LoginInput().tfInput( + LoginInput( controller: state.phoneController, onchangeAction: (v) { logic.checkNext(state.phoneController); @@ -107,7 +107,7 @@ class _StarLockForgetPasswordPageState LengthLimitingTextInputFormatter(30), ]), SizedBox(height: 10.h), - LoginInput().tfInput( + LoginInput( controller: state.pwdController, onchangeAction: (v) { logic.checkNext(state.pwdController); @@ -134,7 +134,7 @@ class _StarLockForgetPasswordPageState color: AppColors.placeholderTextColor, fontSize: 20.sp), ), SizedBox(height: 10.w), - LoginInput().tfInput( + LoginInput( controller: state.sureController, onchangeAction: (v) { logic.checkNext(state.sureController); @@ -158,7 +158,7 @@ class _StarLockForgetPasswordPageState Row( children: [ Expanded( - child: LoginInput().tfInput( + child: LoginInput( controller: state.codeController, onchangeAction: (v) { logic.checkNext(state.codeController); diff --git a/star_lock/lib/login/login/starLock_login_page.dart b/star_lock/lib/login/login/starLock_login_page.dart index c349dae8..cef26e15 100644 --- a/star_lock/lib/login/login/starLock_login_page.dart +++ b/star_lock/lib/login/login/starLock_login_page.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -7,6 +8,7 @@ import 'package:star_lock/flavors.dart'; import '../../appRouters.dart'; import '../../app_settings/app_colors.dart'; import '../../common/XSConstantMacro/XSConstantMacro.dart'; +import '../../tools/commonItem.dart'; import '../../tools/tf_loginInput.dart'; import '../../tools/submitBtn.dart'; import '../../tools/titleAppBar.dart'; @@ -54,15 +56,19 @@ class _StarLockLoginPageState extends State { child: Image.asset('images/icon_main_1024.png', width: 110.w, height: 110.w))), SizedBox(height: 50.w), - LoginInput().tfInput( + LoginInput( controller: state.emailOrPhoneController, onchangeAction: (v) { logic.checkNext(state.emailOrPhoneController); }, - leftWidget: Image.asset( - 'images/icon_login_account.png', - width: 36.w, - height: 36.w, + leftWidget: Padding( + padding: EdgeInsets.only( + top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), + child: Image.asset( + 'images/icon_login_account.png', + width: 36.w, + height: 36.w, + ), ), hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, @@ -72,16 +78,20 @@ class _StarLockLoginPageState extends State { LengthLimitingTextInputFormatter(30), ]), SizedBox(height: 10.h), - LoginInput().tfInput( + LoginInput( controller: state.pwdController, onchangeAction: (v) { logic.checkNext(state.pwdController); }, isPwd: true, - leftWidget: Image.asset( - 'images/icon_login_password.png', - width: 36.w, - height: 36.w, + leftWidget: Padding( + padding: EdgeInsets.only( + top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), + child: Image.asset( + 'images/icon_login_password.png', + width: 36.w, + height: 36.w, + ), ), hintText: "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}", @@ -215,4 +225,71 @@ class _StarLockLoginPageState extends State { ], )); } + + Widget loginInput({ + TextEditingController? controller, + List? 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, + ), + ], + ), + ); + } + } diff --git a/star_lock/lib/login/login/starLock_login_state.dart b/star_lock/lib/login/login/starLock_login_state.dart index 5d79baf6..1eae1236 100644 --- a/star_lock/lib/login/login/starLock_login_state.dart +++ b/star_lock/lib/login/login/starLock_login_state.dart @@ -13,8 +13,6 @@ class StarLockLoginState { TextEditingController emailOrPhoneController = TextEditingController(); TextEditingController pwdController = TextEditingController(); - late FocusNode myFocusNode1; - late FocusNode myFocusNode2; StarLockLoginState() { // emailOrPhone.value = StoreService.to.getLastUserAccount() as String; diff --git a/star_lock/lib/login/register/starLock_register_page.dart b/star_lock/lib/login/register/starLock_register_page.dart index 0f1c25d6..0f7c57ac 100644 --- a/star_lock/lib/login/register/starLock_register_page.dart +++ b/star_lock/lib/login/register/starLock_register_page.dart @@ -196,7 +196,7 @@ class _StarLockRegisterPageState extends State { Widget middleTFWidget() { return Column( children: [ - LoginInput().tfInput( + LoginInput( controller: state.phoneOrEmailController, onchangeAction: (v) { logic.checkNext(state.phoneOrEmailController); @@ -218,7 +218,7 @@ class _StarLockRegisterPageState extends State { LengthLimitingTextInputFormatter(30), ]), SizedBox(height: 10.w), - LoginInput().tfInput( + LoginInput( controller: state.pwdController, onchangeAction: (v) { logic.checkNext(state.pwdController); @@ -244,7 +244,7 @@ class _StarLockRegisterPageState extends State { TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp), ), SizedBox(height: 10.w), - LoginInput().tfInput( + LoginInput( controller: state.sureController, onchangeAction: (v) { logic.checkNext(state.sureController); @@ -267,7 +267,7 @@ class _StarLockRegisterPageState extends State { Row( children: [ Expanded( - child: LoginInput().tfInput( + child: LoginInput( controller: state.codeController, onchangeAction: (v) { logic.checkNext(state.codeController); diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart index 04039e89..36666840 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_page.dart @@ -42,7 +42,7 @@ class _EditLockNamePageState extends State { ), body: Container( margin: EdgeInsets.only(left: 20.w, right: 20.w), - child: LoginInput().tfInput( + child: LoginInput( controller: state.changeLockNameController, leftWidget: const SizedBox(), hintText: "请输入名称", diff --git a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index b46e508b..0f2ed33e 100644 --- a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -242,7 +242,7 @@ class NearbyLockLogic extends BaseGetXController { // 获取到锁给的字符数组 var featureNetxLength = index + featureValueLength + 1; if(reply.data.length < featureNetxLength){ - showToast("锁特征值数据获取失败,请重新点击获取"); + showToast("锁数据异常,请重试"); return; } var featureValue = reply.data.sublist(index + 1, index + featureValueLength + 1); @@ -257,7 +257,7 @@ class NearbyLockLogic extends BaseGetXController { // 使能锁特征值说明(本机启用的功能) var featureEnNextLength = index + featureEnValLength + 1; if(reply.data.length < featureEnNextLength){ - showToast("锁使能特征值数据获取失败,请重新点击获取"); + showToast("锁数据异常,请重试"); return; } var featureEnVal = reply.data.sublist(index + 1, index + featureEnValLength + 1); diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoEditIphone/minePersonInfoEditIphone_page.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoEditIphone/minePersonInfoEditIphone_page.dart index cae1e879..93bff920 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoEditIphone/minePersonInfoEditIphone_page.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoEditIphone/minePersonInfoEditIphone_page.dart @@ -89,7 +89,7 @@ class _MinePersonInfoEditIphonePageState color: Colors.grey, ), SizedBox(height: 10.w), - LoginInput().tfInput( + LoginInput( controller: _phoneController, isPwd: true, leftWidget: const SizedBox(), @@ -102,7 +102,7 @@ class _MinePersonInfoEditIphonePageState Row( children: [ Expanded( - child: LoginInput().tfInput( + child: LoginInput( controller: _codeController, isPwd: true, leftWidget: const SizedBox(), diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart index f25d9c32..b843c979 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart @@ -50,7 +50,7 @@ class _MinePersonInfoEditNamePageState padding: EdgeInsets.all(15.w), child: Column( children: [ - LoginInput().tfInput( + LoginInput( controller: state.nickNameController, onchangeAction: (textStr) { logic.checkNext(state.nickNameController); diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart index 3ede9d13..169bc5c0 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart @@ -45,7 +45,7 @@ class _MineBindPhoneOrEmailPageState extends State { : TranslationLoader.lanKeys!.changeEmailTip!.tr, style: TextStyle(fontSize: 20.sp), )), - LoginInput().tfInput( + LoginInput( controller: state.accountController, isPwd: false, onchangeAction: (textStr) { @@ -62,7 +62,7 @@ class _MineBindPhoneOrEmailPageState extends State { Row( children: [ Expanded( - child: LoginInput().tfInput( + child: LoginInput( controller: state.codeController, isPwd: false, leftWidget: const SizedBox(), diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart index fd1b7ca7..2d450d8a 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart @@ -36,7 +36,7 @@ class _MinePersonInfoResetPasswordPageState margin: EdgeInsets.only(left: 30.w, right: 30.w), child: Column( children: [ - LoginInput().tfInput( + LoginInput( controller: state.oldPwdController, onchangeAction: (textStr) { logic.changeInput(state.oldPwdController); @@ -50,7 +50,7 @@ class _MinePersonInfoResetPasswordPageState inputFormatters: [ LengthLimitingTextInputFormatter(20), ]), - LoginInput().tfInput( + LoginInput( controller: state.newPwdController, onchangeAction: (textStr) { logic.changeInput(state.newPwdController); @@ -64,7 +64,7 @@ class _MinePersonInfoResetPasswordPageState inputFormatters: [ LengthLimitingTextInputFormatter(20), ]), - LoginInput().tfInput( + LoginInput( controller: state.surePwdController, onchangeAction: (textStr) { logic.changeInput(state.surePwdController); diff --git a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart index b7d5ed0f..f01e8dce 100644 --- a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart +++ b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_logic.dart @@ -11,12 +11,22 @@ class LockUserManageListLogic extends BaseGetXController { final LockUserManageListState state = LockUserManageListState(); //请求锁用户列表 - void lockUserListRequest() async { + Future lockUserListRequest() async { LockUserListEntity entity = - await ApiRepository.to.lockUserList('1', '20', state.searchController.text); - if (entity.errorCode!.codeIsSuccessful) { - state.dataList.value = entity.data!; + await ApiRepository.to.lockUserList(pageNo.toString(), '20', state.searchController.text); + if(entity.errorCode!.codeIsSuccessful){ + 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); if (entity.errorCode!.codeIsSuccessful) { EasyLoading.showToast('删除成功',duration: 2000.milliseconds); - lockUserListRequest(); + showToast('删除成功', something: (){ + pageNo = 1; + lockUserListRequest(); + }); } } @@ -33,7 +46,7 @@ class LockUserManageListLogic extends BaseGetXController { // TODO: implement onReady super.onReady(); - lockUserListRequest(); + // lockUserListRequest(); } @override diff --git a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.dart b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.dart index 141f9df4..749d9c3a 100644 --- a/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.dart +++ b/star_lock/lib/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart'; import 'package:star_lock/tools/noData.dart'; @@ -8,6 +9,8 @@ import '../../../../../appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/titleAppBar.dart'; import '../../../../../translations/trans_lib.dart'; +import '../../../../tools/EasyRefreshTool.dart'; +import '../../../../tools/keySearchWidget.dart'; import '../../../../tools/left_slide_actions.dart'; import '../../../../tools/showIosTipView.dart'; import 'lockUserManageList_logic.dart'; @@ -22,7 +25,20 @@ class LockUserManageListPage extends StatefulWidget { class _LockUserManageListPageState extends State { final logic = Get.put(LockUserManageListLogic()); final state = Get.find().state; - + + Future getHttpData() async { + logic.lockUserListRequest().then((LockUserListEntity value){ + if(mounted) setState(() {}); + }); + } + + @override + void initState() { + super.initState(); + + getHttpData(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -43,75 +59,53 @@ class _LockUserManageListPageState extends State { ), ], ), - body: Column( - children: [ - _searchWidget(), - 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, - ) - ], - ), - ); - } - - 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(); + body: EasyRefreshTool( + onRefresh: (){ + logic.pageNo = 1; + getHttpData(); }, - decoration: InputDecoration( - //输入里面输入文字内边距设置 - contentPadding: const EdgeInsets.only( - top: 12.0, left: -19.0, right: -15.0, bottom: 8.0), - hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr, - hintStyle: TextStyle(fontSize: 22.sp, height: 3.0), - //不需要输入框下划线 - border: InputBorder.none, - //左边图标设置 - icon: Padding( - 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, + onLoad: (){ + getHttpData(); + }, + child: Column( + children: [ + KeySearchWidget( + editingController: state.searchController, + onSubmittedAction: () { + logic.pageNo = 1; + getHttpData(); + }, ), - ), + 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 { Widget _buildMainUI() { return state.dataList.isEmpty - ? NoData() - : ListView.separated( - itemCount: state.dataList.length, - itemBuilder: (c, index) { - LockUserData indexEntity = state.dataList[index]; - if (index < state.dataList.length) { - return LeftSlideActions( - key: Key(indexEntity.userid!), - actionsWidth: 60, - actions: [ - _buildDeleteBtn(indexEntity), - ], - decoration: const BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(1)), - ), - child: _electronicKeyItem(indexEntity), + ? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h) + : SlidableAutoCloseBehavior( + child: ListView.separated( + itemCount: state.dataList.length, + itemBuilder: (c, index) { + LockUserData indexEntity = state.dataList[index]; + if (index < state.dataList.length) { + return Slidable( + key:ValueKey(indexEntity.uid), + endActionPane: ActionPane( + extentRatio: 0.2, + motion: const ScrollMotion(), + children: [ + SlidableAction( + onPressed: (BuildContext context){ + 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) { @@ -217,28 +233,28 @@ class _LockUserManageListPageState extends State { ); } - Widget _buildDeleteBtn(LockUserData passwordKeyListItem) { - return GestureDetector( - onTap: () { - // 省略: 弹出是否删除的确认对话框。 - showIosTipViewDialog(context, passwordKeyListItem); - }, - child: Container( - width: 60, - color: const Color(0xFFF20101), - alignment: Alignment.center, - child: const Text( - '删除', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - color: Colors.white, - height: 1, - ), - ), - ), - ); - } + // Widget _buildDeleteBtn(LockUserData passwordKeyListItem) { + // return GestureDetector( + // onTap: () { + // // 省略: 弹出是否删除的确认对话框。 + // showIosTipViewDialog(context, passwordKeyListItem); + // }, + // child: Container( + // width: 60, + // color: const Color(0xFFF20101), + // alignment: Alignment.center, + // child: const Text( + // '删除', + // style: TextStyle( + // fontSize: 16, + // fontWeight: FontWeight.w500, + // color: Colors.white, + // height: 1, + // ), + // ), + // ), + // ); + // } void showIosTipViewDialog(BuildContext context, LockUserData lockUserData) { showDialog( diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index 99175bdf..f93b3be6 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -763,9 +763,9 @@ class ApiRepository { } //锁用户列表 - Future deletLockUser(int uid) async { + Future deletLockUser(int uid) async { final res = await apiProvider.deletLockUser(uid); - return LockUserListEntity.fromJson(res.body); + return LoginEntity.fromJson(res.body); } //用户拥有的钥匙 diff --git a/star_lock/lib/tools/tf_loginInput.dart b/star_lock/lib/tools/tf_loginInput.dart index 9e162c0c..a737fec7 100644 --- a/star_lock/lib/tools/tf_loginInput.dart +++ b/star_lock/lib/tools/tf_loginInput.dart @@ -8,61 +8,74 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; * */ typedef BlockStrCallback = void Function(dynamic textStr); +typedef BlockClickCallback = void Function(); +class LoginInput extends StatelessWidget { + TextEditingController? controller; + FocusNode? focusNode; + List? 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{ - - Widget tfInput({ - TextEditingController? controller, - List? inputFormatters, - TextInputType? keyboardType, - Color? background, - String? hintText, - bool? isHaveLeftWidget, - Widget? leftWidget, - String? label, - bool? isPwd, - Widget? rightSlot, - BlockStrCallback? onchangeAction}) { - return SizedBox( + @override + Widget build(BuildContext context) { + return Container( // color: Colors.red, - width: 1.sp, + // width: 1.sp, // height: 200.h, child: Column( children: [ - Row( - children: [ - leftWidget ?? SizedBox(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, - ), - ), - ], + TextField( + //输入框一行 + maxLines: 1, + controller: controller, + focusNode: focusNode, + onChanged: onchangeAction, + onTap: onTapAction, + 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,