David PHAM-VAN

Fix a bug with the RichText Widget

# 1.3.3
* Fix a bug with the RichText Widget
# 1.3.2
* Fix dart lint warnings
* Improve font bounds calculation
... ...
... ... @@ -165,8 +165,9 @@ class Table extends Widget implements SpanningWidget {
child.layout(context, const BoxConstraints());
final double calculatedWidth =
child.box.width == double.infinity ? 0.0 : child.box.width;
final double childFlex =
child is Expanded ? child.flex.toDouble() : 0.0;
final double childFlex = child is Expanded
? child.flex.toDouble()
: (child.box.width == double.infinity ? 1.0 : 0.0);
if (flex.length < n + 1) {
flex.add(childFlex);
_widths.add(calculatedWidth);
... ... @@ -280,7 +281,13 @@ class Table extends Widget implements SpanningWidget {
continue;
}
for (Widget child in row.children) {
context.canvas
..saveContext()
..drawRect(
child.box.x, child.box.y, child.box.width, child.box.height)
..clipPath();
child.paint(context);
context.canvas.restoreContext();
}
if (index >= _context.lastLine) {
break;
... ...
... ... @@ -186,10 +186,7 @@ class RichText extends Widget {
final PdfFontMetrics metrics =
font.stringMetrics(word) * (style.fontSize * textScaleFactor);
if (offsetX + metrics.width > constraintWidth) {
if (wCount == 0) {
break;
}
if (offsetX + metrics.width > constraintWidth && wCount > 0) {
width = math.max(
width,
_realignLine(_words.sublist(lineStart), constraintWidth,
... ... @@ -229,6 +226,10 @@ class RichText extends Widget {
width,
_realignLine(
_words.sublist(lineStart), constraintWidth, offsetX, true, bottom));
bottom ??= 0.0;
top ??= 0.0;
box = PdfRect(0.0, 0.0, constraints.constrainWidth(width),
constraints.constrainHeight(offsetY + bottom - top));
}
... ...
... ... @@ -2,7 +2,7 @@ name: pdf
author: David PHAM-VAN <dev.nfet.net@gmail.com>
description: A pdf producer for Dart. It can create pdf files for both web or flutter.
homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf
version: 1.3.2
version: 1.3.3
environment:
sdk: ">=1.8.0 <3.0.0"
... ...