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,12 +67,10 @@ class _FlexContext extends WidgetContext {
int lastChild = 0;
@override
void apply(WidgetContext other) {
if (other is _FlexContext) {
void apply(_FlexContext other) {
firstChild = other.firstChild;
lastChild = other.lastChild;
}
}
@override
WidgetContext clone() {
... ... @@ -504,11 +502,9 @@ class Flex extends MultiChildWidget implements SpanningWidget {
bool get hasMoreWidgets => true;
@override
void restoreContext(WidgetContext context) {
if (context is _FlexContext) {
void restoreContext(_FlexContext context) {
_context.firstChild = context.lastChild;
}
}
@override
WidgetContext saveContext() {
... ...
... ... @@ -32,14 +32,12 @@ class _GridViewContext extends WidgetContext {
double? childMainAxis;
@override
void apply(WidgetContext other) {
if (other is _GridViewContext) {
void apply(_GridViewContext other) {
firstChild = other.firstChild;
lastChild = other.lastChild;
childCrossAxis = other.childCrossAxis;
childMainAxis = other.childMainAxis;
}
}
@override
WidgetContext clone() {
... ... @@ -337,11 +335,9 @@ class GridView extends MultiChildWidget implements SpanningWidget {
bool get hasMoreWidgets => true;
@override
void restoreContext(WidgetContext context) {
if (context is _GridViewContext) {
void restoreContext(_GridViewContext context) {
_context.firstChild = context.lastChild;
}
}
@override
WidgetContext saveContext() {
... ...
... ... @@ -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,12 +141,10 @@ class _TableContext extends WidgetContext {
int lastLine = 0;
@override
void apply(WidgetContext other) {
if (other is _TableContext) {
void apply(_TableContext other) {
firstLine = other.firstLine;
lastLine = other.lastLine;
}
}
@override
WidgetContext clone() {
... ... @@ -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,12 +50,10 @@ class _WrapContext extends WidgetContext {
int lastChild = 0;
@override
void apply(WidgetContext other) {
if (other is _WrapContext) {
void apply(_WrapContext other) {
firstChild = other.firstChild;
lastChild = other.lastChild;
}
}
@override
WidgetContext clone() {
... ... @@ -394,11 +392,9 @@ class Wrap extends MultiChildWidget implements SpanningWidget {
}
@override
void restoreContext(WidgetContext context) {
if (context is _WrapContext) {
void restoreContext(_WrapContext context) {
_context.firstChild = context.lastChild;
}
}
@override
WidgetContext saveContext() {
... ...