修改样式

This commit is contained in:
czz
2025-08-15 17:42:34 +08:00
parent 4c2728eb2e
commit 8731f7c335
10 changed files with 36 additions and 22 deletions

View File

@@ -165,11 +165,14 @@ class _MinePageState extends State<MinePage> {
CrossAxisAlignment.start,
children: [
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
@@ -678,3 +681,10 @@ class _MinePageState extends State<MinePage> {
);
}
}
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() + '...';
}