设备名称 人员名称 显示长度限制

This commit is contained in:
czz
2025-08-05 17:55:12 +08:00
parent 00215e99d2
commit 16a304cae8
5 changed files with 312 additions and 219 deletions

View File

@@ -85,7 +85,6 @@ class _UpdateUserPageState extends State<EditUserPage> {
left: 0.rpx,
child: returnIconButtomNew(),
),
],
),
),
@@ -165,6 +164,144 @@ class _UpdateUserPageState extends State<EditUserPage> {
),
),
),
// Padding(
// padding: EdgeInsetsDirectional.fromSTEB(
// 30.rpx, 79.rpx, 30.rpx, 0.rpx),
// child: Container(
// width: double.infinity,
// decoration: BoxDecoration(
// border: Border(
// top: BorderSide(
// color: themeController.currentColor.sc4
// .withOpacity(0.5),
// width: AppConstants().border_width,
// ),
// bottom: BorderSide(
// color: themeController.currentColor.sc4
// .withOpacity(0.5),
// width: AppConstants().border_width,
// ),
// ),
// ),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// Expanded(
// child: Row(
// mainAxisSize: MainAxisSize.max,
// children: [
// Expanded(
// child: Stack(
// children: [
// TextFormField(
// initialValue: userInfoController
// .model.user!.nick_name,
// onChanged: (value) {
// userInfoController.model.user!
// .tmpNickName = value;
// },
// maxLength:
// AppConstants().text_length,
// maxLines: 1,
// textAlign: TextAlign.center,
// textAlignVertical:
// TextAlignVertical.center,
// buildCounter: (_,
// {int? currentLength,
// bool? isFocused,
// int? maxLength}) =>
// null, // 禁用默认计数器
// decoration: InputDecoration(
// contentPadding:
// EdgeInsets.symmetric(
// vertical: 30.rpx),
// isDense: true,
// hintText: '未命名'.tr,
// hintStyle: TextStyle(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// color: themeController
// .currentColor.sc4,
// ),
// enabledBorder:
// OutlineInputBorder(
// borderSide: BorderSide(
// color:
// Colors.transparent,
// width: 1.rpx),
// borderRadius:
// BorderRadius.circular(
// 8.rpx),
// ),
// focusedBorder:
// OutlineInputBorder(
// borderSide: BorderSide(
// color:
// Colors.transparent,
// width: 1.rpx),
// borderRadius:
// BorderRadius.circular(
// 8.rpx),
// ),
// errorBorder:
// OutlineInputBorder(
// borderSide: BorderSide(
// width: 1.rpx),
// borderRadius:
// BorderRadius.circular(
// 8.rpx),
// ),
// focusedErrorBorder:
// OutlineInputBorder(
// borderSide: BorderSide(
// width: 1.rpx),
// borderRadius:
// BorderRadius.circular(
// 8.rpx),
// ),
// filled: false,
// ),
// style: TextStyle(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// color: themeController
// .currentColor.sc3,
// ),
// cursorColor: themeController
// .currentColor.sc3,
// ),
// // 自定义右下角计数器
// Positioned(
// bottom: 4.rpx,
// right: 8.rpx,
// child: Obx(() {
// final text =
// userInfoController
// .model
// .user!
// .tmpNickName ??
// '';
// return Text(
// '${text.length} / ${AppConstants().text_length}',
// style: TextStyle(
// fontSize: 20.rpx,
// color: Colors.grey,
// ),
// );
// }),
// ),
// ],
// )),
// ].divide(SizedBox(width: 27.rpx)),
// ),
// ),
// ],
// ),
// ),
// ),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 79.rpx, 30.rpx, 0.rpx),
@@ -194,17 +331,16 @@ class _UpdateUserPageState extends State<EditUserPage> {
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Stack(
children: [
TextFormField(
child: Center(
// 让输入框垂直居中对齐
child: TextFormField(
initialValue: userInfoController
.model.user!.nick_name,
onChanged: (value) {
userInfoController.model.user!
.tmpNickName = value;
},
maxLength:
AppConstants().text_length,
maxLength: null, // 不限制字数
maxLines: 1,
textAlign: TextAlign.center,
textAlignVertical:
@@ -213,11 +349,12 @@ class _UpdateUserPageState extends State<EditUserPage> {
{int? currentLength,
bool? isFocused,
int? maxLength}) =>
null, // 禁用默认计数器
null,
decoration: InputDecoration(
contentPadding:
EdgeInsets.symmetric(
vertical: 30.rpx),
vertical: 26.rpx,
horizontal: 10.rpx),
isDense: true,
hintText: '未命名'.tr,
hintStyle: TextStyle(
@@ -266,43 +403,23 @@ class _UpdateUserPageState extends State<EditUserPage> {
),
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
fontSize: 30.rpx,
color: themeController
.currentColor.sc3,
height: 1.0, // 防止偏移
),
cursorColor: themeController
.currentColor.sc3,
),
// 自定义右下角计数器
Positioned(
bottom: 4.rpx,
right: 8.rpx,
child: Obx(() {
final text =
userInfoController
.model
.user!
.tmpNickName ??
'';
return Text(
'${text.length} / ${AppConstants().text_length}',
style: TextStyle(
fontSize: 20.rpx,
color: Colors.grey,
),
);
}),
),
],
)),
),
),
].divide(SizedBox(width: 27.rpx)),
),
),
],
),
),
),
)
],
),
),