设备名称 人员名称 显示长度限制
This commit is contained in:
@@ -117,7 +117,7 @@ class _MinePageState extends State<NewMinePage> {
|
||||
child: Row(
|
||||
children: [
|
||||
Obx(() {
|
||||
userInfoController.model.login!;
|
||||
userInfoController.model.login!;
|
||||
return Container(
|
||||
width: 120.rpx,
|
||||
height: 120.rpx,
|
||||
@@ -151,12 +151,29 @@ class _MinePageState extends State<NewMinePage> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
// Text(
|
||||
// login == 1
|
||||
// ? (userInfoController
|
||||
// .model.user!.nick_name ??
|
||||
// '未命名'.tr)
|
||||
// : "未命名".tr,
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Inter',
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontSize:
|
||||
// AppConstants().title_text_fontSize,
|
||||
// letterSpacing: 0.0,
|
||||
// ),
|
||||
// ),
|
||||
Text(
|
||||
login == 1
|
||||
? (userInfoController
|
||||
.model.user!.nick_name ??
|
||||
'未命名'.tr)
|
||||
: "未命名".tr,
|
||||
limitText(
|
||||
login == 1
|
||||
? userInfoController
|
||||
.model.user?.nick_name
|
||||
: '未命名'.tr,
|
||||
AppConstants()
|
||||
.text_length, // 这里设置最大长度,按你需求改,比如 6~10 字符
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
color: themeController.currentColor.sc3,
|
||||
@@ -491,3 +508,10 @@ class _MinePageState extends State<NewMinePage> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String limitText(String? text, int maxLength) {
|
||||
if (text == null || text.isEmpty) return '';
|
||||
if (text.characters.length <= maxLength) return text;
|
||||
|
||||
return text.characters.take(maxLength).toString() + '...';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user