Showing
4 changed files
with
18 additions
and
7 deletions
@@ -165,8 +165,9 @@ class Table extends Widget implements SpanningWidget { | @@ -165,8 +165,9 @@ class Table extends Widget implements SpanningWidget { | ||
165 | child.layout(context, const BoxConstraints()); | 165 | child.layout(context, const BoxConstraints()); |
166 | final double calculatedWidth = | 166 | final double calculatedWidth = |
167 | child.box.width == double.infinity ? 0.0 : child.box.width; | 167 | child.box.width == double.infinity ? 0.0 : child.box.width; |
168 | - final double childFlex = | ||
169 | - child is Expanded ? child.flex.toDouble() : 0.0; | 168 | + final double childFlex = child is Expanded |
169 | + ? child.flex.toDouble() | ||
170 | + : (child.box.width == double.infinity ? 1.0 : 0.0); | ||
170 | if (flex.length < n + 1) { | 171 | if (flex.length < n + 1) { |
171 | flex.add(childFlex); | 172 | flex.add(childFlex); |
172 | _widths.add(calculatedWidth); | 173 | _widths.add(calculatedWidth); |
@@ -280,7 +281,13 @@ class Table extends Widget implements SpanningWidget { | @@ -280,7 +281,13 @@ class Table extends Widget implements SpanningWidget { | ||
280 | continue; | 281 | continue; |
281 | } | 282 | } |
282 | for (Widget child in row.children) { | 283 | for (Widget child in row.children) { |
284 | + context.canvas | ||
285 | + ..saveContext() | ||
286 | + ..drawRect( | ||
287 | + child.box.x, child.box.y, child.box.width, child.box.height) | ||
288 | + ..clipPath(); | ||
283 | child.paint(context); | 289 | child.paint(context); |
290 | + context.canvas.restoreContext(); | ||
284 | } | 291 | } |
285 | if (index >= _context.lastLine) { | 292 | if (index >= _context.lastLine) { |
286 | break; | 293 | break; |
@@ -186,10 +186,7 @@ class RichText extends Widget { | @@ -186,10 +186,7 @@ class RichText extends Widget { | ||
186 | final PdfFontMetrics metrics = | 186 | final PdfFontMetrics metrics = |
187 | font.stringMetrics(word) * (style.fontSize * textScaleFactor); | 187 | font.stringMetrics(word) * (style.fontSize * textScaleFactor); |
188 | 188 | ||
189 | - if (offsetX + metrics.width > constraintWidth) { | ||
190 | - if (wCount == 0) { | ||
191 | - break; | ||
192 | - } | 189 | + if (offsetX + metrics.width > constraintWidth && wCount > 0) { |
193 | width = math.max( | 190 | width = math.max( |
194 | width, | 191 | width, |
195 | _realignLine(_words.sublist(lineStart), constraintWidth, | 192 | _realignLine(_words.sublist(lineStart), constraintWidth, |
@@ -229,6 +226,10 @@ class RichText extends Widget { | @@ -229,6 +226,10 @@ class RichText extends Widget { | ||
229 | width, | 226 | width, |
230 | _realignLine( | 227 | _realignLine( |
231 | _words.sublist(lineStart), constraintWidth, offsetX, true, bottom)); | 228 | _words.sublist(lineStart), constraintWidth, offsetX, true, bottom)); |
229 | + | ||
230 | + bottom ??= 0.0; | ||
231 | + top ??= 0.0; | ||
232 | + | ||
232 | box = PdfRect(0.0, 0.0, constraints.constrainWidth(width), | 233 | box = PdfRect(0.0, 0.0, constraints.constrainWidth(width), |
233 | constraints.constrainHeight(offsetY + bottom - top)); | 234 | constraints.constrainHeight(offsetY + bottom - top)); |
234 | } | 235 | } |
@@ -2,7 +2,7 @@ name: pdf | @@ -2,7 +2,7 @@ name: pdf | ||
2 | author: David PHAM-VAN <dev.nfet.net@gmail.com> | 2 | author: David PHAM-VAN <dev.nfet.net@gmail.com> |
3 | description: A pdf producer for Dart. It can create pdf files for both web or flutter. | 3 | description: A pdf producer for Dart. It can create pdf files for both web or flutter. |
4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf | 4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf |
5 | -version: 1.3.2 | 5 | +version: 1.3.3 |
6 | 6 | ||
7 | environment: | 7 | environment: |
8 | sdk: ">=1.8.0 <3.0.0" | 8 | sdk: ">=1.8.0 <3.0.0" |
-
Please register or login to post a comment