Showing
6 changed files
with
11 additions
and
24 deletions
@@ -67,12 +67,10 @@ class _FlexContext extends WidgetContext { | @@ -67,12 +67,10 @@ class _FlexContext extends WidgetContext { | ||
67 | int lastChild = 0; | 67 | int lastChild = 0; |
68 | 68 | ||
69 | @override | 69 | @override |
70 | - void apply(WidgetContext other) { | ||
71 | - if (other is _FlexContext) { | 70 | + void apply(_FlexContext other) { |
72 | firstChild = other.firstChild; | 71 | firstChild = other.firstChild; |
73 | lastChild = other.lastChild; | 72 | lastChild = other.lastChild; |
74 | } | 73 | } |
75 | - } | ||
76 | 74 | ||
77 | @override | 75 | @override |
78 | WidgetContext clone() { | 76 | WidgetContext clone() { |
@@ -504,11 +502,9 @@ class Flex extends MultiChildWidget implements SpanningWidget { | @@ -504,11 +502,9 @@ class Flex extends MultiChildWidget implements SpanningWidget { | ||
504 | bool get hasMoreWidgets => true; | 502 | bool get hasMoreWidgets => true; |
505 | 503 | ||
506 | @override | 504 | @override |
507 | - void restoreContext(WidgetContext context) { | ||
508 | - if (context is _FlexContext) { | 505 | + void restoreContext(_FlexContext context) { |
509 | _context.firstChild = context.lastChild; | 506 | _context.firstChild = context.lastChild; |
510 | } | 507 | } |
511 | - } | ||
512 | 508 | ||
513 | @override | 509 | @override |
514 | WidgetContext saveContext() { | 510 | WidgetContext saveContext() { |
@@ -32,14 +32,12 @@ class _GridViewContext extends WidgetContext { | @@ -32,14 +32,12 @@ class _GridViewContext extends WidgetContext { | ||
32 | double? childMainAxis; | 32 | double? childMainAxis; |
33 | 33 | ||
34 | @override | 34 | @override |
35 | - void apply(WidgetContext other) { | ||
36 | - if (other is _GridViewContext) { | 35 | + void apply(_GridViewContext other) { |
37 | firstChild = other.firstChild; | 36 | firstChild = other.firstChild; |
38 | lastChild = other.lastChild; | 37 | lastChild = other.lastChild; |
39 | childCrossAxis = other.childCrossAxis; | 38 | childCrossAxis = other.childCrossAxis; |
40 | childMainAxis = other.childMainAxis; | 39 | childMainAxis = other.childMainAxis; |
41 | } | 40 | } |
42 | - } | ||
43 | 41 | ||
44 | @override | 42 | @override |
45 | WidgetContext clone() { | 43 | WidgetContext clone() { |
@@ -337,11 +335,9 @@ class GridView extends MultiChildWidget implements SpanningWidget { | @@ -337,11 +335,9 @@ class GridView extends MultiChildWidget implements SpanningWidget { | ||
337 | bool get hasMoreWidgets => true; | 335 | bool get hasMoreWidgets => true; |
338 | 336 | ||
339 | @override | 337 | @override |
340 | - void restoreContext(WidgetContext context) { | ||
341 | - if (context is _GridViewContext) { | 338 | + void restoreContext(_GridViewContext context) { |
342 | _context.firstChild = context.lastChild; | 339 | _context.firstChild = context.lastChild; |
343 | } | 340 | } |
344 | - } | ||
345 | 341 | ||
346 | @override | 342 | @override |
347 | WidgetContext saveContext() { | 343 | WidgetContext saveContext() { |
@@ -34,7 +34,7 @@ import 'widget.dart'; | @@ -34,7 +34,7 @@ import 'widget.dart'; | ||
34 | abstract class WidgetContext { | 34 | abstract class WidgetContext { |
35 | WidgetContext clone(); | 35 | WidgetContext clone(); |
36 | 36 | ||
37 | - void apply(WidgetContext other); | 37 | + void apply(covariant WidgetContext other); |
38 | } | 38 | } |
39 | 39 | ||
40 | abstract class SpanningWidget extends Widget { | 40 | abstract class SpanningWidget extends Widget { |
@@ -48,7 +48,7 @@ abstract class SpanningWidget extends Widget { | @@ -48,7 +48,7 @@ abstract class SpanningWidget extends Widget { | ||
48 | 48 | ||
49 | /// Aplpy the context for next layout | 49 | /// Aplpy the context for next layout |
50 | @protected | 50 | @protected |
51 | - void restoreContext(WidgetContext context); | 51 | + void restoreContext(covariant WidgetContext context); |
52 | } | 52 | } |
53 | 53 | ||
54 | class NewPage extends Widget { | 54 | class NewPage extends Widget { |
@@ -141,12 +141,10 @@ class _TableContext extends WidgetContext { | @@ -141,12 +141,10 @@ class _TableContext extends WidgetContext { | ||
141 | int lastLine = 0; | 141 | int lastLine = 0; |
142 | 142 | ||
143 | @override | 143 | @override |
144 | - void apply(WidgetContext other) { | ||
145 | - if (other is _TableContext) { | 144 | + void apply(_TableContext other) { |
146 | firstLine = other.firstLine; | 145 | firstLine = other.firstLine; |
147 | lastLine = other.lastLine; | 146 | lastLine = other.lastLine; |
148 | } | 147 | } |
149 | - } | ||
150 | 148 | ||
151 | @override | 149 | @override |
152 | WidgetContext clone() { | 150 | WidgetContext clone() { |
@@ -425,7 +423,7 @@ class Table extends Widget implements SpanningWidget { | @@ -425,7 +423,7 @@ class Table extends Widget implements SpanningWidget { | ||
425 | } | 423 | } |
426 | 424 | ||
427 | @override | 425 | @override |
428 | - void restoreContext(WidgetContext context) { | 426 | + void restoreContext(_TableContext context) { |
429 | _context.apply(context); | 427 | _context.apply(context); |
430 | _context.firstLine = _context.lastLine; | 428 | _context.firstLine = _context.lastLine; |
431 | } | 429 | } |
@@ -50,12 +50,10 @@ class _WrapContext extends WidgetContext { | @@ -50,12 +50,10 @@ class _WrapContext extends WidgetContext { | ||
50 | int lastChild = 0; | 50 | int lastChild = 0; |
51 | 51 | ||
52 | @override | 52 | @override |
53 | - void apply(WidgetContext other) { | ||
54 | - if (other is _WrapContext) { | 53 | + void apply(_WrapContext other) { |
55 | firstChild = other.firstChild; | 54 | firstChild = other.firstChild; |
56 | lastChild = other.lastChild; | 55 | lastChild = other.lastChild; |
57 | } | 56 | } |
58 | - } | ||
59 | 57 | ||
60 | @override | 58 | @override |
61 | WidgetContext clone() { | 59 | WidgetContext clone() { |
@@ -394,11 +392,9 @@ class Wrap extends MultiChildWidget implements SpanningWidget { | @@ -394,11 +392,9 @@ class Wrap extends MultiChildWidget implements SpanningWidget { | ||
394 | } | 392 | } |
395 | 393 | ||
396 | @override | 394 | @override |
397 | - void restoreContext(WidgetContext context) { | ||
398 | - if (context is _WrapContext) { | 395 | + void restoreContext(_WrapContext context) { |
399 | _context.firstChild = context.lastChild; | 396 | _context.firstChild = context.lastChild; |
400 | } | 397 | } |
401 | - } | ||
402 | 398 | ||
403 | @override | 399 | @override |
404 | WidgetContext saveContext() { | 400 | WidgetContext saveContext() { |
-
Please register or login to post a comment