Update task detail page

This commit is contained in:
2024-05-26 12:15:28 +08:00
parent 2ab5a88807
commit 87a7b4e888
4 changed files with 34 additions and 8 deletions

View File

@@ -6,10 +6,16 @@ class FitText extends StatelessWidget {
required this.texts,
this.style,
this.separator = " ",
this.selectable = false,
this.overflow,
this.maxLines,
});
final List<(String, int)> texts;
final TextStyle? style;
final String separator;
final bool selectable;
final TextOverflow? overflow;
final int? maxLines;
Size _textSize(String text, TextStyle? style) {
final TextPainter textPainter = TextPainter(
@@ -37,10 +43,13 @@ class FitText extends StatelessWidget {
final double maxWidth = constraints.maxWidth;
for (int i = sizes.length - 1; i >= 0; i--) {
if (sizes[i] <= maxWidth) {
return Text(texts[i], style: style);
return selectable
? SelectableText(texts[i], style: style)
: Text(texts[i], style: style, overflow: overflow);
}
}
return Text(texts[0], style: style);
return Text(texts[0],
style: style, overflow: overflow, maxLines: maxLines);
});
}
}