소스 검색

Merge pull request #1317 from alemoreau/grid-incomplete_display_of_the_property_names

fix: add overflow ellipsis in FieldCellButton
Lucas.Xu 2 년 전
부모
커밋
31ed88364a
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 1
      frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_cell.dart

+ 8 - 1
frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_cell.dart

@@ -161,15 +161,22 @@ class FieldCellButton extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     final theme = context.watch<AppTheme>();
+
+    // Using this technique to have proper text ellipsis
+    // https://github.com/flutter/flutter/issues/18761#issuecomment-812390920
+    final text = Characters(field.name)
+        .replaceAll(Characters(''), Characters('\u{200B}'))
+        .toString();
     return FlowyButton(
       radius: BorderRadius.zero,
       hoverColor: theme.shader6,
       onTap: onTap,
       leftIcon: svgWidget(field.fieldType.iconName(), color: theme.iconColor),
       text: FlowyText.medium(
-        field.name,
+        text,
         fontSize: 12,
         maxLines: maxLines,
+        overflow: TextOverflow.ellipsis,
       ),
       margin: GridSize.cellContentInsets,
     );