David PHAM-VAN

Fix some Spanning Widgets issues

1 # Changelog 1 # Changelog
2 2
  3 +## 3.6.3
  4 +
  5 +- Fix some Spanning Widgets issues
  6 +
3 ## 3.6.2 7 ## 3.6.2
4 8
5 - Fix arabic ranges according to Wikipedia [elibyy] 9 - Fix arabic ranges according to Wikipedia [elibyy]
@@ -105,7 +109,7 @@ @@ -105,7 +109,7 @@
105 - A borderRadius can only be given for a uniform Border 109 - A borderRadius can only be given for a uniform Border
106 - Add LayoutWidgetBuilder 110 - Add LayoutWidgetBuilder
107 - Add GridPaper widget 111 - Add GridPaper widget
108 -- Improve internal sructure 112 +- Improve internal structure
109 - Add some asserts on the TtfParser 113 - Add some asserts on the TtfParser
110 - Add document loading 114 - Add document loading
111 - Remove deprecated methods 115 - Remove deprecated methods
@@ -117,7 +121,7 @@ @@ -117,7 +121,7 @@
117 121
118 ## 1.13.0 122 ## 1.13.0
119 123
120 -- Implement different border radius on all corners 124 +- Implement different border-radius on all corners
121 - Add AcroForm widgets 125 - Add AcroForm widgets
122 - Add document outline support 126 - Add document outline support
123 - Update analysis options 127 - Update analysis options
@@ -130,7 +134,7 @@ @@ -130,7 +134,7 @@
130 - Automatically calculate Shape() bounding box 134 - Automatically calculate Shape() bounding box
131 - Improve gradient functions 135 - Improve gradient functions
132 - Add blend mode 136 - Add blend mode
133 -- Add soft mask 137 +- Add soft-mask support
134 - Remove dependency to the deprecated utf library 138 - Remove dependency to the deprecated utf library
135 - Fix RichText.maxLines with multiple TextSpan 139 - Fix RichText.maxLines with multiple TextSpan
136 - Fix Exif parsing 140 - Fix Exif parsing
@@ -171,7 +175,7 @@ @@ -171,7 +175,7 @@
171 175
172 ## 1.9.0 176 ## 1.9.0
173 177
174 -- Allow MultiPage to relayout individual pages with support for flex 178 +- Allow MultiPage to re-layout individual pages with support for flex
175 - Implement BoxShadow for rect and circle BoxDecorations 179 - Implement BoxShadow for rect and circle BoxDecorations
176 - Implement TextStyle.letterSpacing 180 - Implement TextStyle.letterSpacing
177 - Implement Arabic writing support [Anas Altair] 181 - Implement Arabic writing support [Anas Altair]
@@ -336,6 +336,7 @@ class GridView extends MultiChildWidget with SpanningWidget { @@ -336,6 +336,7 @@ class GridView extends MultiChildWidget with SpanningWidget {
336 336
337 @override 337 @override
338 void restoreContext(_GridViewContext context) { 338 void restoreContext(_GridViewContext context) {
  339 + _context.apply(context);
339 _context.firstChild = context.lastChild; 340 _context.firstChild = context.lastChild;
340 } 341 }
341 342
@@ -96,7 +96,7 @@ class _PartitionsContext extends WidgetContext { @@ -96,7 +96,7 @@ class _PartitionsContext extends WidgetContext {
96 WidgetContext clone() { 96 WidgetContext clone() {
97 final context = _PartitionsContext(partitionContext.length); 97 final context = _PartitionsContext(partitionContext.length);
98 for (var index = 0; index < partitionContext.length; index++) { 98 for (var index = 0; index < partitionContext.length; index++) {
99 - context.partitionContext[index] = partitionContext[index]!.clone(); 99 + context.partitionContext[index] = partitionContext[index]?.clone();
100 } 100 }
101 101
102 return context; 102 return context;
@@ -224,7 +224,9 @@ class Partitions extends Widget with SpanningWidget { @@ -224,7 +224,9 @@ class Partitions extends Widget with SpanningWidget {
224 _context.apply(context); 224 _context.apply(context);
225 var index = 0; 225 var index = 0;
226 for (final child in children) { 226 for (final child in children) {
227 - child.restoreContext(_context.partitionContext[index]!); 227 + if (child.canSpan) {
  228 + child.restoreContext(_context.partitionContext[index]!);
  229 + }
228 index++; 230 index++;
229 } 231 }
230 } 232 }
@@ -233,7 +235,9 @@ class Partitions extends Widget with SpanningWidget { @@ -233,7 +235,9 @@ class Partitions extends Widget with SpanningWidget {
233 WidgetContext saveContext() { 235 WidgetContext saveContext() {
234 var index = 0; 236 var index = 0;
235 for (final child in children) { 237 for (final child in children) {
236 - _context.partitionContext[index] = child.saveContext(); 238 + if (child.canSpan) {
  239 + _context.partitionContext[index] = child.saveContext();
  240 + }
237 index++; 241 index++;
238 } 242 }
239 return _context; 243 return _context;
@@ -256,7 +256,9 @@ abstract class StatelessWidget extends Widget with SpanningWidget { @@ -256,7 +256,9 @@ abstract class StatelessWidget extends Widget with SpanningWidget {
256 256
257 @override 257 @override
258 bool get canSpan => 258 bool get canSpan =>
259 - _child is SpanningWidget && (_child as SpanningWidget).canSpan; 259 + _child != null &&
  260 + _child is SpanningWidget &&
  261 + (_child as SpanningWidget).canSpan;
260 262
261 @override 263 @override
262 bool get hasMoreWidgets => 264 bool get hasMoreWidgets =>
@@ -393,6 +393,7 @@ class Wrap extends MultiChildWidget with SpanningWidget { @@ -393,6 +393,7 @@ class Wrap extends MultiChildWidget with SpanningWidget {
393 393
394 @override 394 @override
395 void restoreContext(_WrapContext context) { 395 void restoreContext(_WrapContext context) {
  396 + _context.apply(context);
396 _context.firstChild = context.lastChild; 397 _context.firstChild = context.lastChild;
397 } 398 }
398 399
@@ -3,7 +3,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl @@ -3,7 +3,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl
3 homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf 3 homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf
4 repository: https://github.com/DavBfr/dart_pdf 4 repository: https://github.com/DavBfr/dart_pdf
5 issue_tracker: https://github.com/DavBfr/dart_pdf/issues 5 issue_tracker: https://github.com/DavBfr/dart_pdf/issues
6 -version: 3.6.2 6 +version: 3.6.3
7 7
8 environment: 8 environment:
9 sdk: ">=2.12.0 <3.0.0" 9 sdk: ">=2.12.0 <3.0.0"