Skip to content

Commit d0f476d

Browse files
committed
chore: add max height constraint for board text cell
1 parent 96429e2 commit d0f476d

File tree

2 files changed

+23
-35
lines changed

2 files changed

+23
-35
lines changed

frontend/app_flowy/lib/plugins/board/presentation/card/board_text_cell.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ class _BoardTextCellState extends State<BoardTextCell> {
4040
return Align(
4141
alignment: Alignment.centerLeft,
4242
child: Padding(
43-
padding:
44-
EdgeInsets.symmetric(vertical: BoardSizes.cardCellVPadding),
45-
child: FlowyText.medium(
46-
state.content,
47-
fontSize: 14,
43+
padding: EdgeInsets.symmetric(
44+
vertical: BoardSizes.cardCellVPadding,
45+
),
46+
child: ConstrainedBox(
47+
constraints: const BoxConstraints(maxHeight: 120),
48+
child: FlowyText.medium(state.content, fontSize: 14),
4849
),
4950
),
5051
);

frontend/app_flowy/packages/flowy_infra_ui/lib/style_widget/text.dart

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,50 @@ import 'package:provider/provider.dart';
44

55
class FlowyText extends StatelessWidget {
66
final String title;
7-
final TextOverflow overflow;
7+
final TextOverflow? overflow;
88
final double fontSize;
99
final FontWeight fontWeight;
1010
final TextAlign? textAlign;
1111
final Color? color;
12+
1213
const FlowyText(
1314
this.title, {
1415
Key? key,
15-
this.overflow = TextOverflow.ellipsis,
16+
this.overflow = TextOverflow.clip,
1617
this.fontSize = 16,
1718
this.fontWeight = FontWeight.w400,
1819
this.textAlign,
1920
this.color,
2021
}) : super(key: key);
2122

2223
const FlowyText.semibold(this.title,
23-
{Key? key,
24-
this.fontSize = 16,
25-
TextOverflow? overflow,
26-
this.color,
27-
this.textAlign})
24+
{Key? key, this.fontSize = 16, this.overflow, this.color, this.textAlign})
2825
: fontWeight = FontWeight.w600,
29-
overflow = overflow ?? TextOverflow.ellipsis,
3026
super(key: key);
3127

3228
const FlowyText.medium(this.title,
33-
{Key? key,
34-
this.fontSize = 16,
35-
TextOverflow? overflow,
36-
this.color,
37-
this.textAlign})
29+
{Key? key, this.fontSize = 16, this.overflow, this.color, this.textAlign})
3830
: fontWeight = FontWeight.w500,
39-
overflow = overflow ?? TextOverflow.ellipsis,
4031
super(key: key);
4132

4233
const FlowyText.regular(this.title,
43-
{Key? key,
44-
this.fontSize = 16,
45-
TextOverflow? overflow,
46-
this.color,
47-
this.textAlign})
34+
{Key? key, this.fontSize = 16, this.overflow, this.color, this.textAlign})
4835
: fontWeight = FontWeight.w400,
49-
overflow = overflow ?? TextOverflow.ellipsis,
5036
super(key: key);
5137

5238
@override
5339
Widget build(BuildContext context) {
5440
final theme = context.watch<AppTheme>();
55-
return Text(title,
56-
softWrap: false,
57-
textAlign: textAlign,
58-
overflow: overflow,
59-
style: TextStyle(
60-
color: color ?? theme.textColor,
61-
fontWeight: fontWeight,
62-
fontSize: fontSize,
63-
fontFamily: 'Mulish',
64-
));
41+
return Text(
42+
title,
43+
textAlign: textAlign,
44+
overflow: overflow ?? TextOverflow.clip,
45+
style: TextStyle(
46+
color: color ?? theme.textColor,
47+
fontWeight: fontWeight,
48+
fontSize: fontSize,
49+
fontFamily: 'Mulish',
50+
),
51+
);
6552
}
6653
}

0 commit comments

Comments
 (0)