David PHAM-VAN

Fix RichText.maxLines with multiple TextSpan

... ... @@ -17,6 +17,7 @@
- Add blend mode
- Add soft mask
- Remove dependency to the deprecated utf library
- Fix RichText.maxLines with multiple TextSpan
## 1.12.0
... ...
... ... @@ -629,7 +629,7 @@ class RichText extends Widget {
lines++;
if (maxLines != null && lines > maxLines) {
break;
return false;
}
offsetX = 0.0;
... ... @@ -693,7 +693,7 @@ class RichText extends Widget {
lines++;
if (maxLines != null && lines > maxLines) {
break;
return false;
}
offsetX = 0.0;
... ...
... ... @@ -270,6 +270,26 @@ void main() {
));
});
test('Text Widgets RichText maxLines', () {
final rnd = math.Random(42);
final para = LoremText(random: rnd).paragraph(30);
pdf.addPage(
Page(
build: (Context context) => RichText(
maxLines: 3,
text: TextSpan(
text: para,
children: List<TextSpan>.generate(
4,
(index) => TextSpan(text: para),
),
),
),
),
);
});
tearDownAll(() {
final file = File('widgets-text.pdf');
file.writeAsBytesSync(pdf.save());
... ...