David PHAM-VAN

Use covariant on SpanningWidget

... ... @@ -6,6 +6,7 @@
- Improve Text rendering
- Add individual cell decoration
- Improve Bullet Widget
- Use covariant on SpanningWidget
## 3.2.0
... ...
... ... @@ -67,11 +67,9 @@ class _FlexContext extends WidgetContext {
int lastChild = 0;
@override
void apply(WidgetContext other) {
if (other is _FlexContext) {
firstChild = other.firstChild;
lastChild = other.lastChild;
}
void apply(_FlexContext other) {
firstChild = other.firstChild;
lastChild = other.lastChild;
}
@override
... ... @@ -504,10 +502,8 @@ class Flex extends MultiChildWidget implements SpanningWidget {
bool get hasMoreWidgets => true;
@override
void restoreContext(WidgetContext context) {
if (context is _FlexContext) {
_context.firstChild = context.lastChild;
}
void restoreContext(_FlexContext context) {
_context.firstChild = context.lastChild;
}
@override
... ...
... ... @@ -32,13 +32,11 @@ class _GridViewContext extends WidgetContext {
double? childMainAxis;
@override
void apply(WidgetContext other) {
if (other is _GridViewContext) {
firstChild = other.firstChild;
lastChild = other.lastChild;
childCrossAxis = other.childCrossAxis;
childMainAxis = other.childMainAxis;
}
void apply(_GridViewContext other) {
firstChild = other.firstChild;
lastChild = other.lastChild;
childCrossAxis = other.childCrossAxis;
childMainAxis = other.childMainAxis;
}
@override
... ... @@ -337,10 +335,8 @@ class GridView extends MultiChildWidget implements SpanningWidget {
bool get hasMoreWidgets => true;
@override
void restoreContext(WidgetContext context) {
if (context is _GridViewContext) {
_context.firstChild = context.lastChild;
}
void restoreContext(_GridViewContext context) {
_context.firstChild = context.lastChild;
}
@override
... ...
... ... @@ -34,7 +34,7 @@ import 'widget.dart';
abstract class WidgetContext {
WidgetContext clone();
void apply(WidgetContext other);
void apply(covariant WidgetContext other);
}
abstract class SpanningWidget extends Widget {
... ... @@ -48,7 +48,7 @@ abstract class SpanningWidget extends Widget {
/// Aplpy the context for next layout
@protected
void restoreContext(WidgetContext context);
void restoreContext(covariant WidgetContext context);
}
class NewPage extends Widget {
... ...
... ... @@ -141,11 +141,9 @@ class _TableContext extends WidgetContext {
int lastLine = 0;
@override
void apply(WidgetContext other) {
if (other is _TableContext) {
firstLine = other.firstLine;
lastLine = other.lastLine;
}
void apply(_TableContext other) {
firstLine = other.firstLine;
lastLine = other.lastLine;
}
@override
... ... @@ -425,7 +423,7 @@ class Table extends Widget implements SpanningWidget {
}
@override
void restoreContext(WidgetContext context) {
void restoreContext(_TableContext context) {
_context.apply(context);
_context.firstLine = _context.lastLine;
}
... ...
... ... @@ -50,11 +50,9 @@ class _WrapContext extends WidgetContext {
int lastChild = 0;
@override
void apply(WidgetContext other) {
if (other is _WrapContext) {
firstChild = other.firstChild;
lastChild = other.lastChild;
}
void apply(_WrapContext other) {
firstChild = other.firstChild;
lastChild = other.lastChild;
}
@override
... ... @@ -394,10 +392,8 @@ class Wrap extends MultiChildWidget implements SpanningWidget {
}
@override
void restoreContext(WidgetContext context) {
if (context is _WrapContext) {
_context.firstChild = context.lastChild;
}
void restoreContext(_WrapContext context) {
_context.firstChild = context.lastChild;
}
@override
... ...