ソースを参照

[fix]优化首页好友名称过长的问题

zk 5 ヶ月 前
コミット
0ae548c2c0
1 ファイル変更15 行追加7 行削除
  1. 15 7
      lib/module/main/main_page.dart

+ 15 - 7
lib/module/main/main_page.dart

@@ -505,12 +505,20 @@ class MainPage extends BasePage<MainController> {
                     Row(
                       children: [
                         Obx(() {
-                          return Text(
-                            controller.selectedFriend?.getUserNickName() ?? '',
-                            style: TextStyle(
-                                fontWeight: FontWeight.bold,
-                                fontSize: 16.sp,
-                                color: '#202020'.color),
+                          return ConstrainedBox(
+                            constraints: BoxConstraints(
+                              maxWidth: 0.26.sw,
+                            ),
+                            child: Text(
+                              maxLines: 1,
+                              controller.selectedFriend?.getUserNickName() ??
+                                  '',
+                              overflow: TextOverflow.ellipsis,
+                              style: TextStyle(
+                                  fontWeight: FontWeight.bold,
+                                  fontSize: 16.sp,
+                                  color: '#202020'.color),
+                            ),
                           );
                         }),
                         SizedBox(width: 7.w),
@@ -529,7 +537,7 @@ class MainPage extends BasePage<MainController> {
                                   onTap: () => controller.onViewTraceClick(
                                       controller.selectedFriend!),
                                   child: Container(
-                                      margin: EdgeInsets.only(right: 16.w),
+                                      margin: EdgeInsets.only(right: 12.w),
                                       decoration: getPrimaryBtnDecoration(32.w),
                                       padding: EdgeInsets.symmetric(
                                           horizontal: 21.w, vertical: 5.w),