Commit b74856ce authored by Ian Hickson's avatar Ian Hickson

Merge pull request #2679 from Hixie/overrides

Add @override annotations to flutter framework
parents 9bc6d281 797e27ed
...@@ -17,6 +17,7 @@ class CardModel { ...@@ -17,6 +17,7 @@ class CardModel {
} }
class CardCollection extends StatefulWidget { class CardCollection extends StatefulWidget {
@override
CardCollectionState createState() => new CardCollectionState(); CardCollectionState createState() => new CardCollectionState();
} }
...@@ -72,6 +73,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -72,6 +73,7 @@ class CardCollectionState extends State<CardCollection> {
_initVariableSizedCardModels(); _initVariableSizedCardModels();
} }
@override
void initState() { void initState() {
super.initState(); super.initState();
_initCardModels(); _initCardModels();
...@@ -403,6 +405,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -403,6 +405,7 @@ class CardCollectionState extends State<CardCollection> {
.createShader(bounds); .createShader(bounds);
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget cardCollection; Widget cardCollection;
if (_fixedSizeCards) { if (_fixedSizeCards) {
......
...@@ -7,6 +7,7 @@ import 'dart:math' as math; ...@@ -7,6 +7,7 @@ import 'dart:math' as math;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ExampleDragTarget extends StatefulWidget { class ExampleDragTarget extends StatefulWidget {
@override
ExampleDragTargetState createState() => new ExampleDragTargetState(); ExampleDragTargetState createState() => new ExampleDragTargetState();
} }
...@@ -19,6 +20,7 @@ class ExampleDragTargetState extends State<ExampleDragTarget> { ...@@ -19,6 +20,7 @@ class ExampleDragTargetState extends State<ExampleDragTarget> {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new DragTarget<Color>( return new DragTarget<Color>(
onAccept: _handleAccept, onAccept: _handleAccept,
...@@ -41,14 +43,19 @@ class ExampleDragTargetState extends State<ExampleDragTarget> { ...@@ -41,14 +43,19 @@ class ExampleDragTargetState extends State<ExampleDragTarget> {
class Dot extends StatefulWidget { class Dot extends StatefulWidget {
Dot({ Key key, this.color, this.size, this.child, this.tappable: false }) : super(key: key); Dot({ Key key, this.color, this.size, this.child, this.tappable: false }) : super(key: key);
final Color color; final Color color;
final double size; final double size;
final Widget child; final Widget child;
final bool tappable; final bool tappable;
@override
DotState createState() => new DotState(); DotState createState() => new DotState();
} }
class DotState extends State<Dot> { class DotState extends State<Dot> {
int taps = 0; int taps = 0;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new GestureDetector( return new GestureDetector(
onTap: config.tappable ? () { setState(() { taps += 1; }); } : null, onTap: config.tappable ? () { setState(() { taps += 1; }); } : null,
...@@ -84,6 +91,7 @@ class ExampleDragSource extends StatelessWidget { ...@@ -84,6 +91,7 @@ class ExampleDragSource extends StatelessWidget {
static const double kHeavyMultiplier = 1.5; static const double kHeavyMultiplier = 1.5;
static const double kFingerSize = 50.0; static const double kFingerSize = 50.0;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double size = kDotSize; double size = kDotSize;
if (heavy) if (heavy)
...@@ -146,6 +154,7 @@ class DashOutlineCirclePainter extends CustomPainter { ...@@ -146,6 +154,7 @@ class DashOutlineCirclePainter extends CustomPainter {
static const double segmentArc = deltaTheta / 2.0; // radians static const double segmentArc = deltaTheta / 2.0; // radians
static const double startOffset = 1.0; // radians static const double startOffset = 1.0; // radians
@override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
final double radius = size.shortestSide / 2.0; final double radius = size.shortestSide / 2.0;
final Paint paint = new Paint() final Paint paint = new Paint()
...@@ -159,6 +168,7 @@ class DashOutlineCirclePainter extends CustomPainter { ...@@ -159,6 +168,7 @@ class DashOutlineCirclePainter extends CustomPainter {
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
@override
bool shouldRepaint(DashOutlineCirclePainter oldPainter) => false; bool shouldRepaint(DashOutlineCirclePainter oldPainter) => false;
} }
...@@ -172,6 +182,7 @@ class MovableBall extends StatelessWidget { ...@@ -172,6 +182,7 @@ class MovableBall extends StatelessWidget {
static final GlobalKey kBallKey = new GlobalKey(); static final GlobalKey kBallKey = new GlobalKey();
static const double kBallSize = 50.0; static const double kBallSize = 50.0;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget ball = new DefaultTextStyle( Widget ball = new DefaultTextStyle(
style: Theme.of(context).textTheme.body1.copyWith( style: Theme.of(context).textTheme.body1.copyWith(
...@@ -213,14 +224,18 @@ class MovableBall extends StatelessWidget { ...@@ -213,14 +224,18 @@ class MovableBall extends StatelessWidget {
} }
class DragAndDropApp extends StatefulWidget { class DragAndDropApp extends StatefulWidget {
@override
DragAndDropAppState createState() => new DragAndDropAppState(); DragAndDropAppState createState() => new DragAndDropAppState();
} }
class DragAndDropAppState extends State<DragAndDropApp> { class DragAndDropAppState extends State<DragAndDropApp> {
int position = 1; int position = 1;
void moveBall(int newPosition) { void moveBall(int newPosition) {
setState(() { position = newPosition; }); setState(() { position = newPosition; });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
......
...@@ -46,6 +46,7 @@ class WindowDecoration extends StatelessWidget { ...@@ -46,6 +46,7 @@ class WindowDecoration extends StatelessWidget {
final GestureTapCallback onTap; final GestureTapCallback onTap;
final GesturePanUpdateCallback onPanUpdate; final GesturePanUpdateCallback onPanUpdate;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double top, right, bottom, left, width, height; double top, right, bottom, left, width, height;
...@@ -93,6 +94,7 @@ class Window extends StatefulWidget { ...@@ -93,6 +94,7 @@ class Window extends StatefulWidget {
final ChildViewConnection child; final ChildViewConnection child;
final ValueChanged<ChildViewConnection> onClose; final ValueChanged<ChildViewConnection> onClose;
@override
_WindowState createState() => new _WindowState(); _WindowState createState() => new _WindowState();
} }
...@@ -119,6 +121,7 @@ class _WindowState extends State<Window> { ...@@ -119,6 +121,7 @@ class _WindowState extends State<Window> {
config.onClose(config.child); config.onClose(config.child);
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Positioned( return new Positioned(
left: _offset.dx, left: _offset.dx,
...@@ -167,6 +170,7 @@ class LauncherItem extends StatelessWidget { ...@@ -167,6 +170,7 @@ class LauncherItem extends StatelessWidget {
final Widget child; final Widget child;
final ValueChanged<ChildViewConnection> onLaunch; final ValueChanged<ChildViewConnection> onLaunch;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RaisedButton( return new RaisedButton(
onPressed: () { onLaunch(new ChildViewConnection(url: url)); }, onPressed: () { onLaunch(new ChildViewConnection(url: url)); },
...@@ -180,6 +184,7 @@ class Launcher extends StatelessWidget { ...@@ -180,6 +184,7 @@ class Launcher extends StatelessWidget {
final List<Widget> items; final List<Widget> items;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Row( return new Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
...@@ -189,6 +194,7 @@ class Launcher extends StatelessWidget { ...@@ -189,6 +194,7 @@ class Launcher extends StatelessWidget {
} }
class WindowManager extends StatefulWidget { class WindowManager extends StatefulWidget {
@override
_WindowManagerState createState() => new _WindowManagerState(); _WindowManagerState createState() => new _WindowManagerState();
} }
...@@ -207,6 +213,7 @@ class _WindowManagerState extends State<WindowManager> { ...@@ -207,6 +213,7 @@ class _WindowManagerState extends State<WindowManager> {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Material( return new Material(
child: new Stack( child: new Stack(
......
...@@ -27,6 +27,7 @@ class _MarkerPainter extends CustomPainter { ...@@ -27,6 +27,7 @@ class _MarkerPainter extends CustomPainter {
final double size; final double size;
final MarkerType type; final MarkerType type;
@override
void paint(Canvas canvas, _) { void paint(Canvas canvas, _) {
Paint paint = new Paint()..color = const Color(0x8000FF00); Paint paint = new Paint()..color = const Color(0x8000FF00);
double r = size / 2.0; double r = size / 2.0;
...@@ -46,6 +47,7 @@ class _MarkerPainter extends CustomPainter { ...@@ -46,6 +47,7 @@ class _MarkerPainter extends CustomPainter {
} }
} }
@override
bool shouldRepaint(_MarkerPainter oldPainter) { bool shouldRepaint(_MarkerPainter oldPainter) {
return oldPainter.size != size return oldPainter.size != size
|| oldPainter.type != type; || oldPainter.type != type;
...@@ -64,6 +66,7 @@ class Marker extends StatelessWidget { ...@@ -64,6 +66,7 @@ class Marker extends StatelessWidget {
final double size; final double size;
final MarkerType type; final MarkerType type;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Positioned( return new Positioned(
left: position.x - size / 2.0, left: position.x - size / 2.0,
...@@ -83,6 +86,7 @@ class Marker extends StatelessWidget { ...@@ -83,6 +86,7 @@ class Marker extends StatelessWidget {
} }
class OverlayGeometryApp extends StatefulWidget { class OverlayGeometryApp extends StatefulWidget {
@override
OverlayGeometryAppState createState() => new OverlayGeometryAppState(); OverlayGeometryAppState createState() => new OverlayGeometryAppState();
} }
...@@ -96,6 +100,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> { ...@@ -96,6 +100,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
double markersScrollOffset; double markersScrollOffset;
ScrollListener scrollListener; ScrollListener scrollListener;
@override
void initState() { void initState() {
super.initState(); super.initState();
List<double> cardHeights = <double>[ List<double> cardHeights = <double>[
...@@ -151,6 +156,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> { ...@@ -151,6 +156,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> layers = <Widget>[ List<Widget> layers = <Widget>[
new Scaffold( new Scaffold(
......
...@@ -14,10 +14,12 @@ class CardModel { ...@@ -14,10 +14,12 @@ class CardModel {
} }
class PageableListApp extends StatefulWidget { class PageableListApp extends StatefulWidget {
@override
PageableListAppState createState() => new PageableListAppState(); PageableListAppState createState() => new PageableListAppState();
} }
class PageableListAppState extends State<PageableListApp> { class PageableListAppState extends State<PageableListApp> {
@override
void initState() { void initState() {
super.initState(); super.initState();
List<Size> cardSizes = [ List<Size> cardSizes = [
...@@ -122,6 +124,7 @@ class PageableListAppState extends State<PageableListApp> { ...@@ -122,6 +124,7 @@ class PageableListAppState extends State<PageableListApp> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new IconTheme( return new IconTheme(
data: const IconThemeData(color: Colors.white), data: const IconThemeData(color: Colors.white),
......
...@@ -33,6 +33,7 @@ void main() { ...@@ -33,6 +33,7 @@ void main() {
class RawKeyboardDemo extends StatefulWidget { class RawKeyboardDemo extends StatefulWidget {
RawKeyboardDemo({ GlobalKey key }) : super(key: key); RawKeyboardDemo({ GlobalKey key }) : super(key: key);
@override
_HardwareKeyDemoState createState() => new _HardwareKeyDemoState(); _HardwareKeyDemoState createState() => new _HardwareKeyDemoState();
} }
...@@ -45,6 +46,7 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> { ...@@ -45,6 +46,7 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
bool focused = Focus.at(context); bool focused = Focus.at(context);
Widget child; Widget child;
......
...@@ -14,6 +14,7 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate { ...@@ -14,6 +14,7 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate {
AutoLayoutRect p3 = new AutoLayoutRect(); AutoLayoutRect p3 = new AutoLayoutRect();
AutoLayoutRect p4 = new AutoLayoutRect(); AutoLayoutRect p4 = new AutoLayoutRect();
@override
List<al.Constraint> getConstraints(AutoLayoutRect parent) { List<al.Constraint> getConstraints(AutoLayoutRect parent) {
return <al.Constraint>[ return <al.Constraint>[
// Sum of widths of each box must be equal to that of the container // Sum of widths of each box must be equal to that of the container
...@@ -44,6 +45,7 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate { ...@@ -44,6 +45,7 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate {
]; ];
} }
@override
bool shouldUpdateConstraints(AutoLayoutDelegate oldDelegate) => true; bool shouldUpdateConstraints(AutoLayoutDelegate oldDelegate) => true;
} }
......
...@@ -36,9 +36,13 @@ class SectorConstraints extends Constraints { ...@@ -36,9 +36,13 @@ class SectorConstraints extends Constraints {
return deltaTheta.clamp(minDeltaTheta, maxDeltaTheta); return deltaTheta.clamp(minDeltaTheta, maxDeltaTheta);
} }
@override
bool get isTight => minDeltaTheta >= maxDeltaTheta && minDeltaTheta >= maxDeltaTheta; bool get isTight => minDeltaTheta >= maxDeltaTheta && minDeltaTheta >= maxDeltaTheta;
@override
bool get isNormalized => minDeltaRadius <= maxDeltaRadius && minDeltaTheta <= maxDeltaTheta; bool get isNormalized => minDeltaRadius <= maxDeltaRadius && minDeltaTheta <= maxDeltaTheta;
@override
bool get debugAssertIsNormalized { bool get debugAssertIsNormalized {
assert(isNormalized); assert(isNormalized);
return isNormalized; return isNormalized;
...@@ -69,6 +73,7 @@ class SectorParentData extends ParentData { ...@@ -69,6 +73,7 @@ class SectorParentData extends ParentData {
abstract class RenderSector extends RenderObject { abstract class RenderSector extends RenderObject {
@override
void setupParentData(RenderObject child) { void setupParentData(RenderObject child) {
if (child.parentData is! SectorParentData) if (child.parentData is! SectorParentData)
child.parentData = new SectorParentData(); child.parentData = new SectorParentData();
...@@ -76,13 +81,17 @@ abstract class RenderSector extends RenderObject { ...@@ -76,13 +81,17 @@ abstract class RenderSector extends RenderObject {
// RenderSectors always use SectorParentData subclasses, as they need to be // RenderSectors always use SectorParentData subclasses, as they need to be
// able to read their position information for painting and hit testing. // able to read their position information for painting and hit testing.
@override
SectorParentData get parentData => super.parentData; SectorParentData get parentData => super.parentData;
SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) { SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) {
return new SectorDimensions.withConstraints(constraints); return new SectorDimensions.withConstraints(constraints);
} }
@override
SectorConstraints get constraints => super.constraints; SectorConstraints get constraints => super.constraints;
@override
void debugAssertDoesMeetConstraints() { void debugAssertDoesMeetConstraints() {
assert(constraints != null); assert(constraints != null);
assert(deltaRadius != null); assert(deltaRadius != null);
...@@ -94,11 +103,15 @@ abstract class RenderSector extends RenderObject { ...@@ -94,11 +103,15 @@ abstract class RenderSector extends RenderObject {
assert(constraints.minDeltaTheta <= deltaTheta); assert(constraints.minDeltaTheta <= deltaTheta);
assert(deltaTheta <= math.max(constraints.minDeltaTheta, constraints.maxDeltaTheta)); assert(deltaTheta <= math.max(constraints.minDeltaTheta, constraints.maxDeltaTheta));
} }
@override
void performResize() { void performResize() {
// default behavior for subclasses that have sizedByParent = true // default behavior for subclasses that have sizedByParent = true
deltaRadius = constraints.constrainDeltaRadius(0.0); deltaRadius = constraints.constrainDeltaRadius(0.0);
deltaTheta = constraints.constrainDeltaTheta(0.0); deltaTheta = constraints.constrainDeltaTheta(0.0);
} }
@override
void performLayout() { void performLayout() {
// descendants have to either override performLayout() to set both // descendants have to either override performLayout() to set both
// the dimensions and lay out children, or, set sizedByParent to // the dimensions and lay out children, or, set sizedByParent to
...@@ -106,7 +119,10 @@ abstract class RenderSector extends RenderObject { ...@@ -106,7 +119,10 @@ abstract class RenderSector extends RenderObject {
assert(sizedByParent); assert(sizedByParent);
} }
@override
Rect get paintBounds => new Rect.fromLTWH(0.0, 0.0, 2.0 * deltaRadius, 2.0 * deltaRadius); Rect get paintBounds => new Rect.fromLTWH(0.0, 0.0, 2.0 * deltaRadius, 2.0 * deltaRadius);
@override
Rect get semanticBounds => new Rect.fromLTWH(-deltaRadius, -deltaRadius, 2.0 * deltaRadius, 2.0 * deltaRadius); Rect get semanticBounds => new Rect.fromLTWH(-deltaRadius, -deltaRadius, 2.0 * deltaRadius, 2.0 * deltaRadius);
bool hitTest(HitTestResult result, { double radius, double theta }) { bool hitTest(HitTestResult result, { double radius, double theta }) {
...@@ -137,6 +153,7 @@ abstract class RenderDecoratedSector extends RenderSector { ...@@ -137,6 +153,7 @@ abstract class RenderDecoratedSector extends RenderSector {
} }
// offset must point to the center of the circle // offset must point to the center of the circle
@override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
assert(deltaRadius != null); assert(deltaRadius != null);
assert(deltaTheta != null); assert(deltaTheta != null);
...@@ -167,6 +184,7 @@ class SectorChildListParentData extends SectorParentData with ContainerParentDat ...@@ -167,6 +184,7 @@ class SectorChildListParentData extends SectorParentData with ContainerParentDat
class RenderSectorWithChildren extends RenderDecoratedSector with ContainerRenderObjectMixin<RenderSector, SectorChildListParentData> { class RenderSectorWithChildren extends RenderDecoratedSector with ContainerRenderObjectMixin<RenderSector, SectorChildListParentData> {
RenderSectorWithChildren(BoxDecoration decoration) : super(decoration); RenderSectorWithChildren(BoxDecoration decoration) : super(decoration);
@override
void hitTestChildren(HitTestResult result, { double radius, double theta }) { void hitTestChildren(HitTestResult result, { double radius, double theta }) {
RenderSector child = lastChild; RenderSector child = lastChild;
while (child != null) { while (child != null) {
...@@ -177,6 +195,7 @@ class RenderSectorWithChildren extends RenderDecoratedSector with ContainerRende ...@@ -177,6 +195,7 @@ class RenderSectorWithChildren extends RenderDecoratedSector with ContainerRende
} }
} }
@override
void visitChildren(RenderObjectVisitor visitor) { void visitChildren(RenderObjectVisitor visitor) {
RenderSector child = lastChild; RenderSector child = lastChild;
while (child != null) { while (child != null) {
...@@ -217,12 +236,14 @@ class RenderSectorRing extends RenderSectorWithChildren { ...@@ -217,12 +236,14 @@ class RenderSectorRing extends RenderSectorWithChildren {
} }
} }
@override
void setupParentData(RenderObject child) { void setupParentData(RenderObject child) {
// TODO(ianh): avoid code duplication // TODO(ianh): avoid code duplication
if (child.parentData is! SectorChildListParentData) if (child.parentData is! SectorChildListParentData)
child.parentData = new SectorChildListParentData(); child.parentData = new SectorChildListParentData();
} }
@override
SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) { SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) {
double outerDeltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius); double outerDeltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius);
double innerDeltaRadius = outerDeltaRadius - padding * 2.0; double innerDeltaRadius = outerDeltaRadius - padding * 2.0;
...@@ -251,6 +272,7 @@ class RenderSectorRing extends RenderSectorWithChildren { ...@@ -251,6 +272,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
deltaTheta: innerTheta); deltaTheta: innerTheta);
} }
@override
void performLayout() { void performLayout() {
assert(this.parentData is SectorParentData); assert(this.parentData is SectorParentData);
deltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius); deltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius);
...@@ -284,6 +306,7 @@ class RenderSectorRing extends RenderSectorWithChildren { ...@@ -284,6 +306,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
// offset must point to the center of our circle // offset must point to the center of our circle
// each sector then knows how to paint itself at its location // each sector then knows how to paint itself at its location
@override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
// TODO(ianh): avoid code duplication // TODO(ianh): avoid code duplication
super.paint(context, offset); super.paint(context, offset);
...@@ -327,12 +350,14 @@ class RenderSectorSlice extends RenderSectorWithChildren { ...@@ -327,12 +350,14 @@ class RenderSectorSlice extends RenderSectorWithChildren {
} }
} }
@override
void setupParentData(RenderObject child) { void setupParentData(RenderObject child) {
// TODO(ianh): avoid code duplication // TODO(ianh): avoid code duplication
if (child.parentData is! SectorChildListParentData) if (child.parentData is! SectorChildListParentData)
child.parentData = new SectorChildListParentData(); child.parentData = new SectorChildListParentData();
} }
@override
SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) { SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) {
assert(this.parentData is SectorParentData); assert(this.parentData is SectorParentData);
double paddingTheta = math.atan(padding / this.parentData.radius); double paddingTheta = math.atan(padding / this.parentData.radius);
...@@ -359,6 +384,7 @@ class RenderSectorSlice extends RenderSectorWithChildren { ...@@ -359,6 +384,7 @@ class RenderSectorSlice extends RenderSectorWithChildren {
deltaTheta: outerDeltaTheta); deltaTheta: outerDeltaTheta);
} }
@override
void performLayout() { void performLayout() {
assert(this.parentData is SectorParentData); assert(this.parentData is SectorParentData);
deltaTheta = constraints.constrainDeltaTheta(desiredDeltaTheta); deltaTheta = constraints.constrainDeltaTheta(desiredDeltaTheta);
...@@ -389,6 +415,7 @@ class RenderSectorSlice extends RenderSectorWithChildren { ...@@ -389,6 +415,7 @@ class RenderSectorSlice extends RenderSectorWithChildren {
// offset must point to the center of our circle // offset must point to the center of our circle
// each sector then knows how to paint itself at its location // each sector then knows how to paint itself at its location
@override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
// TODO(ianh): avoid code duplication // TODO(ianh): avoid code duplication
super.paint(context, offset); super.paint(context, offset);
...@@ -417,29 +444,34 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil ...@@ -417,29 +444,34 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
markNeedsLayout(); markNeedsLayout();
} }
@override
void setupParentData(RenderObject child) { void setupParentData(RenderObject child) {
if (child.parentData is! SectorParentData) if (child.parentData is! SectorParentData)
child.parentData = new SectorParentData(); child.parentData = new SectorParentData();
} }
@override
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
if (child == null) if (child == null)
return super.getMinIntrinsicWidth(constraints); return super.getMinIntrinsicWidth(constraints);
return getIntrinsicDimensions(constraints).width; return getIntrinsicDimensions(constraints).width;
} }
@override
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
if (child == null) if (child == null)
return super.getMaxIntrinsicWidth(constraints); return super.getMaxIntrinsicWidth(constraints);
return getIntrinsicDimensions(constraints).width; return getIntrinsicDimensions(constraints).width;
} }
@override
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
if (child == null) if (child == null)
return super.getMinIntrinsicHeight(constraints); return super.getMinIntrinsicHeight(constraints);
return getIntrinsicDimensions(constraints).height; return getIntrinsicDimensions(constraints).height;
} }
@override
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
if (child == null) if (child == null)
return super.getMaxIntrinsicHeight(constraints); return super.getMaxIntrinsicHeight(constraints);
...@@ -456,6 +488,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil ...@@ -456,6 +488,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
return constraints.constrain(new Size(dimension, dimension)); return constraints.constrain(new Size(dimension, dimension));
} }
@override
void performLayout() { void performLayout() {
if (child == null) { if (child == null) {
size = constraints.constrain(Size.zero); size = constraints.constrain(Size.zero);
...@@ -472,6 +505,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil ...@@ -472,6 +505,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
} }
} }
@override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
super.paint(context, offset); super.paint(context, offset);
if (child != null) { if (child != null) {
...@@ -481,6 +515,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil ...@@ -481,6 +515,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
} }
} }
@override
bool hitTest(HitTestResult result, { Point position }) { bool hitTest(HitTestResult result, { Point position }) {
if (child == null) if (child == null)
return false; return false;
...@@ -516,15 +551,18 @@ class RenderSolidColor extends RenderDecoratedSector { ...@@ -516,15 +551,18 @@ class RenderSolidColor extends RenderDecoratedSector {
double desiredDeltaTheta; double desiredDeltaTheta;
final Color backgroundColor; final Color backgroundColor;
@override
SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) { SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) {
return new SectorDimensions.withConstraints(constraints, deltaTheta: desiredDeltaTheta); return new SectorDimensions.withConstraints(constraints, deltaTheta: desiredDeltaTheta);
} }
@override
void performLayout() { void performLayout() {
deltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius); deltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius);
deltaTheta = constraints.constrainDeltaTheta(desiredDeltaTheta); deltaTheta = constraints.constrainDeltaTheta(desiredDeltaTheta);
} }
@override
void handleEvent(PointerEvent event, HitTestEntry entry) { void handleEvent(PointerEvent event, HitTestEntry entry) {
if (event is PointerDownEvent) { if (event is PointerDownEvent) {
decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000)); decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000));
......
...@@ -13,34 +13,40 @@ class RenderSolidColorBox extends RenderDecoratedBox { ...@@ -13,34 +13,40 @@ class RenderSolidColorBox extends RenderDecoratedBox {
: backgroundColor = backgroundColor, : backgroundColor = backgroundColor,
super(decoration: new BoxDecoration(backgroundColor: backgroundColor)); super(decoration: new BoxDecoration(backgroundColor: backgroundColor));
@override
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
return constraints.constrainHeight( return constraints.constrainHeight(
this.desiredSize == Size.infinite ? 0.0 : desiredSize.width this.desiredSize == Size.infinite ? 0.0 : desiredSize.width
); );
} }
@override
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
return constraints.constrainWidth( return constraints.constrainWidth(
this.desiredSize == Size.infinite ? 0.0 : desiredSize.width this.desiredSize == Size.infinite ? 0.0 : desiredSize.width
); );
} }
@override
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
return constraints.constrainHeight( return constraints.constrainHeight(
this.desiredSize == Size.infinite ? 0.0 : desiredSize.height this.desiredSize == Size.infinite ? 0.0 : desiredSize.height
); );
} }
@override
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
return constraints.constrainHeight( return constraints.constrainHeight(
this.desiredSize == Size.infinite ? 0.0 : desiredSize.height this.desiredSize == Size.infinite ? 0.0 : desiredSize.height
); );
} }
@override
void performLayout() { void performLayout() {
size = constraints.constrain(desiredSize); size = constraints.constrain(desiredSize);
} }
@override
void handleEvent(PointerEvent event, BoxHitTestEntry entry) { void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
if (event is PointerDownEvent) { if (event is PointerDownEvent) {
decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000)); decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000));
......
...@@ -45,20 +45,24 @@ class RenderDots extends RenderBox { ...@@ -45,20 +45,24 @@ class RenderDots extends RenderBox {
/// Indicates that the size of this render object depends only on the /// Indicates that the size of this render object depends only on the
/// layout constraints provided by the parent. /// layout constraints provided by the parent.
@override
bool get sizedByParent => true; bool get sizedByParent => true;
/// By selecting the biggest value permitted by the incomming constraints /// By selecting the biggest value permitted by the incomming constraints
/// during layout, this function makes this render object as large as /// during layout, this function makes this render object as large as
/// possible (i.e., fills the entire screen). /// possible (i.e., fills the entire screen).
@override
void performResize() { void performResize() {
size = constraints.biggest; size = constraints.biggest;
} }
/// Makes this render object hittable so that it receives pointer events. /// Makes this render object hittable so that it receives pointer events.
@override
bool hitTestSelf(Point position) => true; bool hitTestSelf(Point position) => true;
/// Processes pointer events by mutating state and invalidating its previous /// Processes pointer events by mutating state and invalidating its previous
/// painting commands. /// painting commands.
@override
void handleEvent(PointerEvent event, BoxHitTestEntry entry) { void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
if (event is PointerDownEvent) { if (event is PointerDownEvent) {
Color color = _kColors[event.pointer.remainder(_kColors.length)]; Color color = _kColors[event.pointer.remainder(_kColors.length)];
...@@ -78,6 +82,7 @@ class RenderDots extends RenderBox { ...@@ -78,6 +82,7 @@ class RenderDots extends RenderBox {
} }
/// Issues new painting commands. /// Issues new painting commands.
@override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
final Canvas canvas = context.canvas; final Canvas canvas = context.canvas;
// The "size" property indicates the size of that this render box was // The "size" property indicates the size of that this render box was
......
...@@ -74,6 +74,7 @@ class PianoApp extends StatelessWidget { ...@@ -74,6 +74,7 @@ class PianoApp extends StatelessWidget {
} }
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> children = <Widget>[]; List<Widget> children = <Widget>[];
for (PianoKey key in keys) { for (PianoKey key in keys) {
......
...@@ -13,6 +13,7 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate { ...@@ -13,6 +13,7 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate {
AutoLayoutRect p3 = new AutoLayoutRect(); AutoLayoutRect p3 = new AutoLayoutRect();
AutoLayoutRect p4 = new AutoLayoutRect(); AutoLayoutRect p4 = new AutoLayoutRect();
@override
List<al.Constraint> getConstraints(AutoLayoutRect parent) { List<al.Constraint> getConstraints(AutoLayoutRect parent) {
return <al.Constraint>[ return <al.Constraint>[
// Sum of widths of each box must be equal to that of the container // Sum of widths of each box must be equal to that of the container
...@@ -43,16 +44,19 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate { ...@@ -43,16 +44,19 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate {
]; ];
} }
@override
bool shouldUpdateConstraints(_MyAutoLayoutDelegate oldDelegate) => true; bool shouldUpdateConstraints(_MyAutoLayoutDelegate oldDelegate) => true;
} }
class ColoredBoxes extends StatefulWidget { class ColoredBoxes extends StatefulWidget {
@override
_ColoredBoxesState createState() => new _ColoredBoxesState(); _ColoredBoxesState createState() => new _ColoredBoxesState();
} }
class _ColoredBoxesState extends State<ColoredBoxes> { class _ColoredBoxesState extends State<ColoredBoxes> {
final _MyAutoLayoutDelegate delegate = new _MyAutoLayoutDelegate(); final _MyAutoLayoutDelegate delegate = new _MyAutoLayoutDelegate();
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new AutoLayout( return new AutoLayout(
delegate: delegate, delegate: delegate,
......
...@@ -9,10 +9,12 @@ class RenderDots extends RenderConstrainedBox { ...@@ -9,10 +9,12 @@ class RenderDots extends RenderConstrainedBox {
RenderDots() : super(additionalConstraints: const BoxConstraints.expand()); RenderDots() : super(additionalConstraints: const BoxConstraints.expand());
// Makes this render box hittable so that we'll get pointer events. // Makes this render box hittable so that we'll get pointer events.
@override
bool hitTestSelf(Point position) => true; bool hitTestSelf(Point position) => true;
final Map<int, Point> _dots = <int, Point>{}; final Map<int, Point> _dots = <int, Point>{};
@override
void handleEvent(PointerEvent event, BoxHitTestEntry entry) { void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
if (event is PointerDownEvent || event is PointerMoveEvent) { if (event is PointerDownEvent || event is PointerMoveEvent) {
_dots[event.pointer] = event.position; _dots[event.pointer] = event.position;
...@@ -23,6 +25,7 @@ class RenderDots extends RenderConstrainedBox { ...@@ -23,6 +25,7 @@ class RenderDots extends RenderConstrainedBox {
} }
} }
@override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
final Canvas canvas = context.canvas; final Canvas canvas = context.canvas;
canvas.drawRect(offset & size, new Paint()..color = new Color(0xFF0000FF)); canvas.drawRect(offset & size, new Paint()..color = new Color(0xFF0000FF));
...@@ -37,6 +40,8 @@ class RenderDots extends RenderConstrainedBox { ...@@ -37,6 +40,8 @@ class RenderDots extends RenderConstrainedBox {
class Dots extends SingleChildRenderObjectWidget { class Dots extends SingleChildRenderObjectWidget {
Dots({ Key key, Widget child }) : super(key: key, child: child); Dots({ Key key, Widget child }) : super(key: key, child: child);
@override
RenderDots createRenderObject(BuildContext context) => new RenderDots(); RenderDots createRenderObject(BuildContext context) => new RenderDots();
} }
......
...@@ -25,6 +25,7 @@ class _GesturePainter extends CustomPainter { ...@@ -25,6 +25,7 @@ class _GesturePainter extends CustomPainter {
final bool doubleTapEnabled; final bool doubleTapEnabled;
final bool longPressEnabled; final bool longPressEnabled;
@override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
Point center = (size.center(Point.origin).toOffset() * zoom + offset).toPoint(); Point center = (size.center(Point.origin).toOffset() * zoom + offset).toPoint();
double radius = size.width / 2.0 * zoom; double radius = size.width / 2.0 * zoom;
...@@ -42,6 +43,7 @@ class _GesturePainter extends CustomPainter { ...@@ -42,6 +43,7 @@ class _GesturePainter extends CustomPainter {
canvas.drawCircle(center, radius, paint); canvas.drawCircle(center, radius, paint);
} }
@override
bool shouldRepaint(_GesturePainter oldPainter) { bool shouldRepaint(_GesturePainter oldPainter) {
return oldPainter.zoom != zoom return oldPainter.zoom != zoom
|| oldPainter.offset != offset || oldPainter.offset != offset
...@@ -55,6 +57,7 @@ class _GesturePainter extends CustomPainter { ...@@ -55,6 +57,7 @@ class _GesturePainter extends CustomPainter {
} }
class GestureDemo extends StatefulWidget { class GestureDemo extends StatefulWidget {
@override
_GestureDemoState createState() => new _GestureDemoState(); _GestureDemoState createState() => new _GestureDemoState();
} }
...@@ -134,6 +137,7 @@ class _GestureDemoState extends State<GestureDemo> { ...@@ -134,6 +137,7 @@ class _GestureDemoState extends State<GestureDemo> {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Stack( return new Stack(
children: <Widget>[ children: <Widget>[
......
...@@ -9,6 +9,7 @@ class AdaptedListItem extends StatelessWidget { ...@@ -9,6 +9,7 @@ class AdaptedListItem extends StatelessWidget {
final String name; final String name;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Row( return new Row(
children: <Widget>[ children: <Widget>[
...@@ -31,6 +32,7 @@ class AdaptedGridItem extends StatelessWidget { ...@@ -31,6 +32,7 @@ class AdaptedGridItem extends StatelessWidget {
final String name; final String name;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Card( return new Card(
child: new Column( child: new Column(
...@@ -70,6 +72,7 @@ class AdaptiveContainer extends StatelessWidget { ...@@ -70,6 +72,7 @@ class AdaptiveContainer extends StatelessWidget {
final List<String> names; final List<String> names;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (MediaQuery.of(context).size.width < _kGridViewBreakpoint) { if (MediaQuery.of(context).size.width < _kGridViewBreakpoint) {
return new ScrollableList( return new ScrollableList(
......
...@@ -17,6 +17,7 @@ RenderBox initCircle() { ...@@ -17,6 +17,7 @@ RenderBox initCircle() {
} }
class SectorApp extends StatefulWidget { class SectorApp extends StatefulWidget {
@override
SectorAppState createState() => new SectorAppState(); SectorAppState createState() => new SectorAppState();
} }
...@@ -147,6 +148,7 @@ class SectorAppState extends State<SectorApp> { ...@@ -147,6 +148,7 @@ class SectorAppState extends State<SectorApp> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new MaterialApp( return new MaterialApp(
theme: new ThemeData.light(), theme: new ThemeData.light(),
......
...@@ -18,7 +18,10 @@ void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex ...@@ -18,7 +18,10 @@ void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex
// Solid colour, Widget version // Solid colour, Widget version
class Rectangle extends StatelessWidget { class Rectangle extends StatelessWidget {
Rectangle(this.color, { Key key }) : super(key: key); Rectangle(this.color, { Key key }) : super(key: key);
final Color color; final Color color;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Flexible( return new Flexible(
child: new Container( child: new Container(
......
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
class SpinningSquare extends StatefulWidget { class SpinningSquare extends StatefulWidget {
@override
_SpinningSquareState createState() => new _SpinningSquareState(); _SpinningSquareState createState() => new _SpinningSquareState();
} }
class _SpinningSquareState extends State<SpinningSquare> { class _SpinningSquareState extends State<SpinningSquare> {
AnimationController _animation; AnimationController _animation;
@override
void initState() { void initState() {
super.initState(); super.initState();
// We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0 // We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0
...@@ -21,6 +23,7 @@ class _SpinningSquareState extends State<SpinningSquare> { ...@@ -21,6 +23,7 @@ class _SpinningSquareState extends State<SpinningSquare> {
)..repeat(); )..repeat();
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RotationTransition( return new RotationTransition(
turns: _animation, turns: _animation,
......
...@@ -58,6 +58,7 @@ Widget toStyledText(String name, String text) { ...@@ -58,6 +58,7 @@ Widget toStyledText(String name, String text) {
Widget toPlainText(String name, String text) => new Text(name + ":" + text); Widget toPlainText(String name, String text) => new Text(name + ":" + text);
class SpeakerSeparator extends StatelessWidget { class SpeakerSeparator extends StatelessWidget {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
constraints: const BoxConstraints.expand(height: 0.0), constraints: const BoxConstraints.expand(height: 0.0),
...@@ -72,10 +73,12 @@ class SpeakerSeparator extends StatelessWidget { ...@@ -72,10 +73,12 @@ class SpeakerSeparator extends StatelessWidget {
} }
class StyledTextDemo extends StatefulWidget { class StyledTextDemo extends StatefulWidget {
@override
_StyledTextDemoState createState() => new _StyledTextDemoState(); _StyledTextDemoState createState() => new _StyledTextDemoState();
} }
class _StyledTextDemoState extends State<StyledTextDemo> { class _StyledTextDemoState extends State<StyledTextDemo> {
@override
void initState() { void initState() {
super.initState(); super.initState();
_toText = toStyledText; _toText = toStyledText;
...@@ -89,6 +92,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> { ...@@ -89,6 +92,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> lines = _kNameLines List<Widget> lines = _kNameLines
.map((List<String> nameAndText) => Function.apply(_toText, nameAndText)) .map((List<String> nameAndText) => Function.apply(_toText, nameAndText))
......
...@@ -45,6 +45,7 @@ class _ButtonDemo { ...@@ -45,6 +45,7 @@ class _ButtonDemo {
// to recover this demo's selected tab. To enable it to compare restored // to recover this demo's selected tab. To enable it to compare restored
// _ButtonDemo objects with new ones, define hashCode and operator== . // _ButtonDemo objects with new ones, define hashCode and operator== .
@override
bool operator==(Object other) { bool operator==(Object other) {
if (other.runtimeType != runtimeType) if (other.runtimeType != runtimeType)
return false; return false;
...@@ -52,16 +53,19 @@ class _ButtonDemo { ...@@ -52,16 +53,19 @@ class _ButtonDemo {
return typedOther.title == title && typedOther.text == text; return typedOther.title == title && typedOther.text == text;
} }
@override
int get hashCode => hashValues(title.hashCode, text.hashCode); int get hashCode => hashValues(title.hashCode, text.hashCode);
} }
class ButtonsDemo extends StatefulWidget { class ButtonsDemo extends StatefulWidget {
@override
_ButtonsDemoState createState() => new _ButtonsDemoState(); _ButtonsDemoState createState() => new _ButtonsDemoState();
} }
class _ButtonsDemoState extends State<ButtonsDemo> { class _ButtonsDemoState extends State<ButtonsDemo> {
List<_ButtonDemo> demos; List<_ButtonDemo> demos;
@override
void initState() { void initState() {
super.initState(); super.initState();
demos = <_ButtonDemo>[ demos = <_ButtonDemo>[
...@@ -192,6 +196,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -192,6 +196,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new TabBarSelection<_ButtonDemo>( return new TabBarSelection<_ButtonDemo>(
values: demos, values: demos,
......
...@@ -43,6 +43,7 @@ class TravelDestinationItem extends StatelessWidget { ...@@ -43,6 +43,7 @@ class TravelDestinationItem extends StatelessWidget {
final TravelDestination destination; final TravelDestination destination;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ThemeData theme = Theme.of(context); ThemeData theme = Theme.of(context);
TextStyle titleStyle = theme.textTheme.headline.copyWith(color: Colors.white); TextStyle titleStyle = theme.textTheme.headline.copyWith(color: Colors.white);
...@@ -115,6 +116,7 @@ class TravelDestinationItem extends StatelessWidget { ...@@ -115,6 +116,7 @@ class TravelDestinationItem extends StatelessWidget {
} }
class CardsDemo extends StatelessWidget { class CardsDemo extends StatelessWidget {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ChipDemo extends StatefulWidget { class ChipDemo extends StatefulWidget {
@override
_ChipDemoState createState() => new _ChipDemoState(); _ChipDemoState createState() => new _ChipDemoState();
} }
...@@ -17,6 +18,7 @@ class _ChipDemoState extends State<ChipDemo> { ...@@ -17,6 +18,7 @@ class _ChipDemoState extends State<ChipDemo> {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> chips = <Widget>[ List<Widget> chips = <Widget>[
new Chip( new Chip(
......
...@@ -54,6 +54,7 @@ class ColorItem extends StatelessWidget { ...@@ -54,6 +54,7 @@ class ColorItem extends StatelessWidget {
String colorString() => "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; String colorString() => "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}";
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
height: kColorItemHeight, height: kColorItemHeight,
...@@ -80,6 +81,7 @@ class ColorSwatchTabView extends StatelessWidget { ...@@ -80,6 +81,7 @@ class ColorSwatchTabView extends StatelessWidget {
final TextStyle blackTextStyle = Typography.black.body1; final TextStyle blackTextStyle = Typography.black.body1;
final TextStyle whiteTextStyle = Typography.white.body1; final TextStyle whiteTextStyle = Typography.white.body1;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> colorItems = swatch.colors.keys.map((int index) { List<Widget> colorItems = swatch.colors.keys.map((int index) {
return new DefaultTextStyle( return new DefaultTextStyle(
...@@ -107,6 +109,7 @@ class ColorSwatchTabView extends StatelessWidget { ...@@ -107,6 +109,7 @@ class ColorSwatchTabView extends StatelessWidget {
} }
class ColorsDemo extends StatelessWidget { class ColorsDemo extends StatelessWidget {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new TabBarSelection<ColorSwatch>( return new TabBarSelection<ColorSwatch>(
values: colorSwatches, values: colorSwatches,
......
...@@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; ...@@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
class DatePickerDemo extends StatefulWidget { class DatePickerDemo extends StatefulWidget {
@override
_DatePickerDemoState createState() => new _DatePickerDemoState(); _DatePickerDemoState createState() => new _DatePickerDemoState();
} }
...@@ -28,6 +29,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> { ...@@ -28,6 +29,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
} }
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return return
new Scaffold( new Scaffold(
......
...@@ -28,6 +28,7 @@ class DialogDemoItem extends StatelessWidget { ...@@ -28,6 +28,7 @@ class DialogDemoItem extends StatelessWidget {
final String text; final String text;
final VoidCallback onPressed; final VoidCallback onPressed;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new InkWell( return new InkWell(
onTap: onPressed, onTap: onPressed,
...@@ -54,6 +55,7 @@ class DialogDemoItem extends StatelessWidget { ...@@ -54,6 +55,7 @@ class DialogDemoItem extends StatelessWidget {
} }
class DialogDemo extends StatefulWidget { class DialogDemo extends StatefulWidget {
@override
DialogDemoState createState() => new DialogDemoState(); DialogDemoState createState() => new DialogDemoState();
} }
...@@ -74,6 +76,7 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -74,6 +76,7 @@ class DialogDemoState extends State<DialogDemo> {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color); final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class DropDownDemo extends StatefulWidget { class DropDownDemo extends StatefulWidget {
@override
_DropDownDemoState createState() => new _DropDownDemoState(); _DropDownDemoState createState() => new _DropDownDemoState();
} }
...@@ -18,6 +19,7 @@ class _DropDownDemoState extends State<DropDownDemo> { ...@@ -18,6 +19,7 @@ class _DropDownDemoState extends State<DropDownDemo> {
.toList(); .toList();
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text("Dropdown Button")), appBar: new AppBar(title: new Text("Dropdown Button")),
......
...@@ -16,6 +16,7 @@ SpriteSheet _sprites; ...@@ -16,6 +16,7 @@ SpriteSheet _sprites;
class FitnessDemo extends StatelessWidget { class FitnessDemo extends StatelessWidget {
FitnessDemo({ Key key }) : super(key: key); FitnessDemo({ Key key }) : super(key: key);
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
...@@ -28,6 +29,8 @@ class FitnessDemo extends StatelessWidget { ...@@ -28,6 +29,8 @@ class FitnessDemo extends StatelessWidget {
class _FitnessDemoContents extends StatefulWidget { class _FitnessDemoContents extends StatefulWidget {
_FitnessDemoContents({ Key key }) : super(key: key); _FitnessDemoContents({ Key key }) : super(key: key);
@override
_FitnessDemoContentsState createState() => new _FitnessDemoContentsState(); _FitnessDemoContentsState createState() => new _FitnessDemoContentsState();
} }
...@@ -43,6 +46,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> { ...@@ -43,6 +46,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
_sprites = new SpriteSheet(_images['packages/flutter_gallery_assets/jumpingjack.png'], json); _sprites = new SpriteSheet(_images['packages/flutter_gallery_assets/jumpingjack.png'], json);
} }
@override
void initState() { void initState() {
super.initState(); super.initState();
...@@ -73,6 +77,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> { ...@@ -73,6 +77,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
_WorkoutAnimationNode workoutAnimation; _WorkoutAnimationNode workoutAnimation;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (!assetsLoaded) if (!assetsLoaded)
return new Container(); return new Container();
...@@ -248,6 +253,7 @@ class _WorkoutAnimationNode extends NodeWithSize { ...@@ -248,6 +253,7 @@ class _WorkoutAnimationNode extends NodeWithSize {
_jumpingJack.neutralPose(); _jumpingJack.neutralPose();
} }
@override
void update(double dt) { void update(double dt) {
if (workingOut) { if (workingOut) {
int millis = new DateTime.now().millisecondsSinceEpoch - _startTimeMillis; int millis = new DateTime.now().millisecondsSinceEpoch - _startTimeMillis;
...@@ -273,6 +279,7 @@ class _ProgressCircle extends NodeWithSize { ...@@ -273,6 +279,7 @@ class _ProgressCircle extends NodeWithSize {
double value; double value;
@override
void paint(Canvas canvas) { void paint(Canvas canvas) {
applyTransformForPivot(canvas); applyTransformForPivot(canvas);
...@@ -513,10 +520,12 @@ class _JumpingJackPart extends Sprite { ...@@ -513,10 +520,12 @@ class _JumpingJackPart extends Sprite {
class _Fireworks extends StatefulWidget { class _Fireworks extends StatefulWidget {
_Fireworks({ Key key }) : super(key: key); _Fireworks({ Key key }) : super(key: key);
@override
_FireworksState createState() => new _FireworksState(); _FireworksState createState() => new _FireworksState();
} }
class _FireworksState extends State<_Fireworks> { class _FireworksState extends State<_Fireworks> {
@override
void initState() { void initState() {
super.initState(); super.initState();
fireworks = new _FireworksNode(); fireworks = new _FireworksNode();
...@@ -524,6 +533,7 @@ class _FireworksState extends State<_Fireworks> { ...@@ -524,6 +533,7 @@ class _FireworksState extends State<_Fireworks> {
_FireworksNode fireworks; _FireworksNode fireworks;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new SpriteWidget(fireworks); return new SpriteWidget(fireworks);
} }
...@@ -533,6 +543,7 @@ class _FireworksNode extends NodeWithSize { ...@@ -533,6 +543,7 @@ class _FireworksNode extends NodeWithSize {
_FireworksNode() : super(const Size(1024.0, 1024.0)); _FireworksNode() : super(const Size(1024.0, 1024.0));
double _countDown = 0.0; double _countDown = 0.0;
@override
void update(double dt) { void update(double dt) {
if (_countDown <= 0.0) { if (_countDown <= 0.0) {
_addExplosion(); _addExplosion();
......
...@@ -11,6 +11,7 @@ class _ContactCategory extends StatelessWidget { ...@@ -11,6 +11,7 @@ class _ContactCategory extends StatelessWidget {
final IconData icon; final IconData icon;
final List<Widget> children; final List<Widget> children;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
padding: const EdgeInsets.symmetric(vertical: 16.0), padding: const EdgeInsets.symmetric(vertical: 16.0),
...@@ -41,6 +42,7 @@ class _ContactItem extends StatelessWidget { ...@@ -41,6 +42,7 @@ class _ContactItem extends StatelessWidget {
final IconData icon; final IconData icon;
final List<String> lines; final List<String> lines;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> columnChildren = lines.sublist(0, lines.length - 1).map((String line) => new Text(line)).toList(); List<Widget> columnChildren = lines.sublist(0, lines.length - 1).map((String line) => new Text(line)).toList();
columnChildren.add(new Text(lines.last, style: Theme.of(context).textTheme.caption)); columnChildren.add(new Text(lines.last, style: Theme.of(context).textTheme.caption));
...@@ -68,6 +70,7 @@ class _ContactItem extends StatelessWidget { ...@@ -68,6 +70,7 @@ class _ContactItem extends StatelessWidget {
} }
class FlexibleSpaceDemo extends StatefulWidget { class FlexibleSpaceDemo extends StatefulWidget {
@override
FlexibleSpaceDemoState createState() => new FlexibleSpaceDemoState(); FlexibleSpaceDemoState createState() => new FlexibleSpaceDemoState();
} }
...@@ -77,6 +80,7 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> { ...@@ -77,6 +80,7 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
final Key scrollableKey = new UniqueKey(); final Key scrollableKey = new UniqueKey();
AppBarBehavior _appBarBehavior = AppBarBehavior.scroll; AppBarBehavior _appBarBehavior = AppBarBehavior.scroll;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Theme( return new Theme(
data: new ThemeData( data: new ThemeData(
......
...@@ -27,6 +27,7 @@ class DateTimeItem extends StatelessWidget { ...@@ -27,6 +27,7 @@ class DateTimeItem extends StatelessWidget {
final TimeOfDay time; final TimeOfDay time;
final ValueChanged<DateTime> onChanged; final ValueChanged<DateTime> onChanged;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
...@@ -93,6 +94,7 @@ class DateTimeItem extends StatelessWidget { ...@@ -93,6 +94,7 @@ class DateTimeItem extends StatelessWidget {
} }
class FullScreenDialogDemo extends StatefulWidget { class FullScreenDialogDemo extends StatefulWidget {
@override
FullScreenDialogDemoState createState() => new FullScreenDialogDemoState(); FullScreenDialogDemoState createState() => new FullScreenDialogDemoState();
} }
...@@ -137,6 +139,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> { ...@@ -137,6 +139,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
......
...@@ -55,6 +55,7 @@ class GridDemoPhotoItem extends StatelessWidget { ...@@ -55,6 +55,7 @@ class GridDemoPhotoItem extends StatelessWidget {
)); ));
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Widget image = new GestureDetector( final Widget image = new GestureDetector(
onTap: () { showPhoto(context); }, onTap: () { showPhoto(context); },
...@@ -104,9 +105,12 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate { ...@@ -104,9 +105,12 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate {
assert(tileHeightFactor != null && tileHeightFactor > 0.0); assert(tileHeightFactor != null && tileHeightFactor > 0.0);
} }
@override
final int columnCount; final int columnCount;
final double tileHeightFactor; final double tileHeightFactor;
@override
GridSpecification getGridSpecification(BoxConstraints constraints, int childCount) { GridSpecification getGridSpecification(BoxConstraints constraints, int childCount) {
assert(constraints.maxWidth < double.INFINITY); assert(constraints.maxWidth < double.INFINITY);
assert(constraints.maxHeight < double.INFINITY); assert(constraints.maxHeight < double.INFINITY);
...@@ -121,6 +125,7 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate { ...@@ -121,6 +125,7 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate {
); );
} }
@override
bool shouldRelayout(GridListDemoGridDelegate oldDelegate) { bool shouldRelayout(GridListDemoGridDelegate oldDelegate) {
return columnCount != oldDelegate.columnCount return columnCount != oldDelegate.columnCount
|| tileHeightFactor != oldDelegate.tileHeightFactor || tileHeightFactor != oldDelegate.tileHeightFactor
...@@ -131,6 +136,7 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate { ...@@ -131,6 +136,7 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate {
class GridListDemo extends StatefulWidget { class GridListDemo extends StatefulWidget {
GridListDemo({ Key key }) : super(key: key); GridListDemo({ Key key }) : super(key: key);
@override
GridListDemoState createState() => new GridListDemoState(); GridListDemoState createState() => new GridListDemoState();
} }
...@@ -169,6 +175,7 @@ class GridListDemoState extends State<GridListDemo> { ...@@ -169,6 +175,7 @@ class GridListDemoState extends State<GridListDemo> {
// When the ScrollableGrid first appears we want the last row to only be // When the ScrollableGrid first appears we want the last row to only be
// partially visible, to help the user recognize that the grid is scrollable. // partially visible, to help the user recognize that the grid is scrollable.
// The GridListDemoGridDelegate's tileHeightFactor is used for this. // The GridListDemoGridDelegate's tileHeightFactor is used for this.
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Orientation orientation = MediaQuery.of(context).orientation; final Orientation orientation = MediaQuery.of(context).orientation;
return new Scaffold( return new Scaffold(
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class IconsDemo extends StatefulWidget { class IconsDemo extends StatefulWidget {
@override
IconsDemoState createState() => new IconsDemoState(); IconsDemoState createState() => new IconsDemoState();
} }
...@@ -61,6 +62,7 @@ class IconsDemoState extends State<IconsDemo> { ...@@ -61,6 +62,7 @@ class IconsDemoState extends State<IconsDemo> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
final TextStyle textStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color); final TextStyle textStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
......
...@@ -28,6 +28,7 @@ class LeaveBehindItem { ...@@ -28,6 +28,7 @@ class LeaveBehindItem {
class LeaveBehindDemo extends StatefulWidget { class LeaveBehindDemo extends StatefulWidget {
LeaveBehindDemo({ Key key }) : super(key: key); LeaveBehindDemo({ Key key }) : super(key: key);
@override
LeaveBehindDemoState createState() => new LeaveBehindDemoState(); LeaveBehindDemoState createState() => new LeaveBehindDemoState();
} }
...@@ -47,6 +48,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> { ...@@ -47,6 +48,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
}); });
} }
@override
void initState() { void initState() {
super.initState(); super.initState();
initListItems(); initListItems();
...@@ -122,6 +124,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> { ...@@ -122,6 +124,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
......
...@@ -13,6 +13,7 @@ enum ListDemoItemSize { ...@@ -13,6 +13,7 @@ enum ListDemoItemSize {
class ListDemo extends StatefulWidget { class ListDemo extends StatefulWidget {
ListDemo({ Key key }) : super(key: key); ListDemo({ Key key }) : super(key: key);
@override
ListDemoState createState() => new ListDemoState(); ListDemoState createState() => new ListDemoState();
} }
...@@ -153,6 +154,7 @@ class ListDemoState extends State<ListDemo> { ...@@ -153,6 +154,7 @@ class ListDemoState extends State<ListDemo> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final String layoutText = _dense ? " \u2013 Dense" : ""; final String layoutText = _dense ? " \u2013 Dense" : "";
String itemSizeText; String itemSizeText;
......
...@@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
class MenuDemo extends StatefulWidget { class MenuDemo extends StatefulWidget {
MenuDemo({ Key key }) : super(key: key); MenuDemo({ Key key }) : super(key: key);
@override
MenuDemoState createState() => new MenuDemoState(); MenuDemoState createState() => new MenuDemoState();
} }
...@@ -24,6 +25,7 @@ class MenuDemoState extends State<MenuDemo> { ...@@ -24,6 +25,7 @@ class MenuDemoState extends State<MenuDemo> {
final String _checkedValue4 = 'Four'; final String _checkedValue4 = 'Four';
List<String> _checkedValues; List<String> _checkedValues;
@override
void initState() { void initState() {
super.initState(); super.initState();
_simpleValue = _simpleValue2; _simpleValue = _simpleValue2;
...@@ -53,6 +55,7 @@ class MenuDemoState extends State<MenuDemo> { ...@@ -53,6 +55,7 @@ class MenuDemoState extends State<MenuDemo> {
bool isChecked(String value) => _checkedValues.contains(value); bool isChecked(String value) => _checkedValues.contains(value);
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
......
...@@ -11,6 +11,7 @@ class ModalBottomSheetDemo extends StatelessWidget { ...@@ -11,6 +11,7 @@ class ModalBottomSheetDemo extends StatelessWidget {
textAlign: TextAlign.center textAlign: TextAlign.center
); );
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text("Modal Bottom Sheet")), appBar: new AppBar(title: new Text("Modal Bottom Sheet")),
......
...@@ -12,6 +12,7 @@ class PageSelectorDemo extends StatelessWidget { ...@@ -12,6 +12,7 @@ class PageSelectorDemo extends StatelessWidget {
selection.value = selection.values[(selection.index + delta).clamp(0, selection.values.length - 1)]; selection.value = selection.values[(selection.index + delta).clamp(0, selection.values.length - 1)];
} }
@override
Widget build(BuildContext notUsed) { // Can't find the TabBarSelection from this context. Widget build(BuildContext notUsed) { // Can't find the TabBarSelection from this context.
final List<IconData> icons = <IconData>[ final List<IconData> icons = <IconData>[
Icons.event, Icons.event,
......
...@@ -26,6 +26,7 @@ class PersistentBottomSheetDemo extends StatelessWidget { ...@@ -26,6 +26,7 @@ class PersistentBottomSheetDemo extends StatelessWidget {
}); });
} }
@override
Widget build(BuildContext notUsed) { // Can't find the Scaffold from this context. Widget build(BuildContext notUsed) { // Can't find the Scaffold from this context.
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text("Persistent Bottom Sheet")), appBar: new AppBar(title: new Text("Persistent Bottom Sheet")),
......
...@@ -5,11 +5,13 @@ ...@@ -5,11 +5,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ProgressIndicatorDemo extends StatefulWidget { class ProgressIndicatorDemo extends StatefulWidget {
@override
_ProgressIndicatorDemoState createState() => new _ProgressIndicatorDemoState(); _ProgressIndicatorDemoState createState() => new _ProgressIndicatorDemoState();
} }
class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> { class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
@override
void initState() { void initState() {
super.initState(); super.initState();
controller = new AnimationController( controller = new AnimationController(
...@@ -81,6 +83,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> { ...@@ -81,6 +83,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Progress Indicators')), appBar: new AppBar(title: new Text('Progress Indicators')),
......
...@@ -19,6 +19,7 @@ class _BarGraphic extends StatelessWidget { ...@@ -19,6 +19,7 @@ class _BarGraphic extends StatelessWidget {
final String leftText; final String leftText;
final String rightText; final String rightText;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
height: height, height: height,
...@@ -85,6 +86,7 @@ class _TechniqueItem extends StatelessWidget { ...@@ -85,6 +86,7 @@ class _TechniqueItem extends StatelessWidget {
Navigator.push(context, new MaterialPageRoute<Null>(builder: builder)); Navigator.push(context, new MaterialPageRoute<Null>(builder: builder));
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Card( return new Card(
child: new InkWell( child: new InkWell(
...@@ -111,6 +113,7 @@ const String _introText = ...@@ -111,6 +113,7 @@ const String _introText =
"specified it is stacked on top of the ToolBar."; "specified it is stacked on top of the ToolBar.";
class ScrollingTechniquesDemo extends StatelessWidget { class ScrollingTechniquesDemo extends StatelessWidget {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Scrolling Techniques')), appBar: new AppBar(title: new Text('Scrolling Techniques')),
......
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class SliderDemo extends StatefulWidget { class SliderDemo extends StatefulWidget {
@override
_SliderDemoState createState() => new _SliderDemoState(); _SliderDemoState createState() => new _SliderDemoState();
} }
class _SliderDemoState extends State<SliderDemo> { class _SliderDemoState extends State<SliderDemo> {
double _value = 25.0; double _value = 25.0;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text("Sliders")), appBar: new AppBar(title: new Text("Sliders")),
......
...@@ -56,6 +56,7 @@ class SnackBarDemo extends StatelessWidget { ...@@ -56,6 +56,7 @@ class SnackBarDemo extends StatelessWidget {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
......
...@@ -23,6 +23,7 @@ class TabsDemo extends StatelessWidget { ...@@ -23,6 +23,7 @@ class TabsDemo extends StatelessWidget {
Icons.language: 'LANGUAGE', Icons.language: 'LANGUAGE',
}; };
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Color iconColor = Theme.of(context).accentColor; final Color iconColor = Theme.of(context).accentColor;
return new TabBarSelection<IconData>( return new TabBarSelection<IconData>(
......
...@@ -26,6 +26,7 @@ const String _explanatoryText = ...@@ -26,6 +26,7 @@ const String _explanatoryText =
"by its key."; "by its key.";
class TabsFabDemo extends StatefulWidget { class TabsFabDemo extends StatefulWidget {
@override
_TabsFabDemoState createState() => new _TabsFabDemoState(); _TabsFabDemoState createState() => new _TabsFabDemoState();
} }
...@@ -41,6 +42,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> { ...@@ -41,6 +42,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> {
]; ];
_Page selectedPage; _Page selectedPage;
@override
void initState() { void initState() {
super.initState(); super.initState();
selectedPage = pages[0]; selectedPage = pages[0];
...@@ -88,6 +90,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> { ...@@ -88,6 +90,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new TabBarSelection<_Page>( return new TabBarSelection<_Page>(
values: pages, values: pages,
......
...@@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; ...@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
class TextFieldDemo extends StatefulWidget { class TextFieldDemo extends StatefulWidget {
TextFieldDemo({ Key key }) : super(key: key); TextFieldDemo({ Key key }) : super(key: key);
@override
TextFieldDemoState createState() => new TextFieldDemoState(); TextFieldDemoState createState() => new TextFieldDemoState();
} }
...@@ -59,6 +60,7 @@ class TextFieldDemoState extends State<TextFieldDemo> { ...@@ -59,6 +60,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
return null; return null;
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
......
...@@ -7,6 +7,7 @@ import 'dart:async'; ...@@ -7,6 +7,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class TimePickerDemo extends StatefulWidget { class TimePickerDemo extends StatefulWidget {
@override
_TimePickerDemoState createState() => new _TimePickerDemoState(); _TimePickerDemoState createState() => new _TimePickerDemoState();
} }
...@@ -25,6 +26,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> { ...@@ -25,6 +26,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
} }
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text("Time Picker")), appBar: new AppBar(title: new Text("Time Picker")),
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ToggleControlsDemo extends StatefulWidget { class ToggleControlsDemo extends StatefulWidget {
@override
_ToggleControlsDemoState createState() => new _ToggleControlsDemoState(); _ToggleControlsDemoState createState() => new _ToggleControlsDemoState();
} }
...@@ -31,6 +32,7 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> { ...@@ -31,6 +32,7 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text("Selection Controls")), appBar: new AppBar(title: new Text("Selection Controls")),
......
...@@ -10,6 +10,7 @@ const String _introText = ...@@ -10,6 +10,7 @@ const String _introText =
"apps accessible, like screen readers."; "apps accessible, like screen readers.";
class TooltipDemo extends StatelessWidget { class TooltipDemo extends StatelessWidget {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
return new Scaffold( return new Scaffold(
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class TwoLevelListDemo extends StatelessWidget { class TwoLevelListDemo extends StatelessWidget {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Expand/Collapse List Control')), appBar: new AppBar(title: new Text('Expand/Collapse List Control')),
......
...@@ -16,6 +16,7 @@ class TextStyleItem extends StatelessWidget { ...@@ -16,6 +16,7 @@ class TextStyleItem extends StatelessWidget {
final TextStyle style; final TextStyle style;
final String text; final String text;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
final TextStyle nameStyle = theme.textTheme.body1.copyWith(color: theme.textTheme.caption.color); final TextStyle nameStyle = theme.textTheme.body1.copyWith(color: theme.textTheme.caption.color);
...@@ -38,6 +39,7 @@ class TextStyleItem extends StatelessWidget { ...@@ -38,6 +39,7 @@ class TextStyleItem extends StatelessWidget {
} }
class TypographyDemo extends StatelessWidget { class TypographyDemo extends StatelessWidget {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final TextTheme textTheme = Theme.of(context).textTheme; final TextTheme textTheme = Theme.of(context).textTheme;
final List<Widget> styleItems = <Widget>[ final List<Widget> styleItems = <Widget>[
......
...@@ -19,6 +19,8 @@ enum WeatherType { ...@@ -19,6 +19,8 @@ enum WeatherType {
class WeatherDemo extends StatefulWidget { class WeatherDemo extends StatefulWidget {
WeatherDemo({ Key key }) : super(key: key); WeatherDemo({ Key key }) : super(key: key);
@override
_WeatherDemoState createState() => new _WeatherDemoState(); _WeatherDemoState createState() => new _WeatherDemoState();
} }
...@@ -42,6 +44,7 @@ class _WeatherDemoState extends State<WeatherDemo> { ...@@ -42,6 +44,7 @@ class _WeatherDemoState extends State<WeatherDemo> {
_sprites = new SpriteSheet(_images['packages/flutter_gallery_assets/weathersprites.png'], json); _sprites = new SpriteSheet(_images['packages/flutter_gallery_assets/weathersprites.png'], json);
} }
@override
void initState() { void initState() {
super.initState(); super.initState();
...@@ -58,6 +61,7 @@ class _WeatherDemoState extends State<WeatherDemo> { ...@@ -58,6 +61,7 @@ class _WeatherDemoState extends State<WeatherDemo> {
WeatherWorld weatherWorld; WeatherWorld weatherWorld;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (!assetsLoaded) { if (!assetsLoaded) {
return new Scaffold( return new Scaffold(
...@@ -132,6 +136,7 @@ class WeatherButton extends StatelessWidget { ...@@ -132,6 +136,7 @@ class WeatherButton extends StatelessWidget {
final bool selected; final bool selected;
final VoidCallback onPressed; final VoidCallback onPressed;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Color color; Color color;
if (selected) if (selected)
...@@ -262,6 +267,7 @@ class WeatherWorld extends NodeWithSize { ...@@ -262,6 +267,7 @@ class WeatherWorld extends NodeWithSize {
_snow.active = weatherType == WeatherType.snow; _snow.active = weatherType == WeatherType.snow;
} }
@override
void spriteBoxPerformedLayout() { void spriteBoxPerformedLayout() {
_sun.position = spriteBox.visibleArea.topLeft + const Offset(350.0, 180.0); _sun.position = spriteBox.visibleArea.topLeft + const Offset(350.0, 180.0);
} }
...@@ -273,6 +279,7 @@ class GradientNode extends NodeWithSize { ...@@ -273,6 +279,7 @@ class GradientNode extends NodeWithSize {
Color colorTop; Color colorTop;
Color colorBottom; Color colorBottom;
@override
void paint(Canvas canvas) { void paint(Canvas canvas) {
applyTransformForPivot(canvas); applyTransformForPivot(canvas);
...@@ -426,6 +433,7 @@ class Ray extends Sprite { ...@@ -426,6 +433,7 @@ class Ray extends Sprite {
)); ));
} }
@override
void update(double dt) { void update(double dt) {
rotation += dt * _rotationSpeed; rotation += dt * _rotationSpeed;
} }
......
...@@ -11,6 +11,7 @@ class GalleryApp extends StatefulWidget { ...@@ -11,6 +11,7 @@ class GalleryApp extends StatefulWidget {
static GalleryAppState of(BuildContext context) => context.ancestorStateOfType(const TypeMatcher<GalleryAppState>()); static GalleryAppState of(BuildContext context) => context.ancestorStateOfType(const TypeMatcher<GalleryAppState>());
@override
GalleryAppState createState() => new GalleryAppState(); GalleryAppState createState() => new GalleryAppState();
} }
...@@ -23,6 +24,7 @@ class GalleryAppState extends State<GalleryApp> { ...@@ -23,6 +24,7 @@ class GalleryAppState extends State<GalleryApp> {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new MaterialApp( return new MaterialApp(
title: 'Flutter Material Gallery', title: 'Flutter Material Gallery',
......
...@@ -21,6 +21,7 @@ class GalleryDrawer extends StatelessWidget { ...@@ -21,6 +21,7 @@ class GalleryDrawer extends StatelessWidget {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Drawer( return new Drawer(
child: new Block( child: new Block(
......
...@@ -42,10 +42,12 @@ import '../demo/weather_demo.dart'; ...@@ -42,10 +42,12 @@ import '../demo/weather_demo.dart';
class GalleryHome extends StatefulWidget { class GalleryHome extends StatefulWidget {
GalleryHome({ Key key }) : super(key: key); GalleryHome({ Key key }) : super(key: key);
@override
GalleryHomeState createState() => new GalleryHomeState(); GalleryHomeState createState() => new GalleryHomeState();
} }
class GalleryHomeState extends State<GalleryHome> { class GalleryHomeState extends State<GalleryHome> {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBarHeight: 128.0, appBarHeight: 128.0,
......
...@@ -61,6 +61,7 @@ class GallerySection extends StatelessWidget { ...@@ -61,6 +61,7 @@ class GallerySection extends StatelessWidget {
)); ));
} }
@override
Widget build (BuildContext context) { Widget build (BuildContext context) {
final ThemeData theme = new ThemeData( final ThemeData theme = new ThemeData(
brightness: Theme.of(context).brightness, brightness: Theme.of(context).brightness,
......
...@@ -24,6 +24,7 @@ import 'stock_symbol_viewer.dart'; ...@@ -24,6 +24,7 @@ import 'stock_symbol_viewer.dart';
import 'stock_types.dart'; import 'stock_types.dart';
class StocksApp extends StatefulWidget { class StocksApp extends StatefulWidget {
@override
StocksAppState createState() => new StocksAppState(); StocksAppState createState() => new StocksAppState();
} }
...@@ -45,6 +46,7 @@ class StocksAppState extends State<StocksApp> { ...@@ -45,6 +46,7 @@ class StocksAppState extends State<StocksApp> {
showSemanticsDebugger: false showSemanticsDebugger: false
); );
@override
void initState() { void initState() {
super.initState(); super.initState();
new StockDataFetcher((StockData data) { new StockDataFetcher((StockData data) {
...@@ -99,6 +101,7 @@ class StocksAppState extends State<StocksApp> { ...@@ -99,6 +101,7 @@ class StocksAppState extends State<StocksApp> {
return StockStrings.instance; return StockStrings.instance;
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(() { assert(() {
debugPaintSizeEnabled = _configuration.debugShowSizes; debugPaintSizeEnabled = _configuration.debugShowSizes;
......
...@@ -12,6 +12,7 @@ class StockArrowPainter extends CustomPainter { ...@@ -12,6 +12,7 @@ class StockArrowPainter extends CustomPainter {
final Color color; final Color color;
final double percentChange; final double percentChange;
@override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
Paint paint = new Paint()..color = color; Paint paint = new Paint()..color = color;
paint.strokeWidth = 1.0; paint.strokeWidth = 1.0;
...@@ -44,6 +45,7 @@ class StockArrowPainter extends CustomPainter { ...@@ -44,6 +45,7 @@ class StockArrowPainter extends CustomPainter {
canvas.drawCircle(new Point(centerX, centerY), r, paint); canvas.drawCircle(new Point(centerX, centerY), r, paint);
} }
@override
bool shouldRepaint(StockArrowPainter oldPainter) { bool shouldRepaint(StockArrowPainter oldPainter) {
return oldPainter.color != color return oldPainter.color != color
|| oldPainter.percentChange != percentChange; || oldPainter.percentChange != percentChange;
...@@ -67,6 +69,7 @@ class StockArrow extends StatelessWidget { ...@@ -67,6 +69,7 @@ class StockArrow extends StatelessWidget {
return Colors.red[_colorIndexForPercentChange(percentChange)]; return Colors.red[_colorIndexForPercentChange(percentChange)];
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
width: 40.0, width: 40.0,
......
...@@ -19,6 +19,7 @@ enum _StockMenuItem { autorefresh, refresh, speedUp, speedDown } ...@@ -19,6 +19,7 @@ enum _StockMenuItem { autorefresh, refresh, speedUp, speedDown }
enum StockHomeTab { market, portfolio } enum StockHomeTab { market, portfolio }
class _NotImplementedDialog extends StatelessWidget { class _NotImplementedDialog extends StatelessWidget {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Dialog( return new Dialog(
title: new Text('Not Implemented'), title: new Text('Not Implemented'),
...@@ -58,6 +59,7 @@ class StockHome extends StatefulWidget { ...@@ -58,6 +59,7 @@ class StockHome extends StatefulWidget {
final StockConfiguration configuration; final StockConfiguration configuration;
final ValueChanged<StockConfiguration> updater; final ValueChanged<StockConfiguration> updater;
@override
StockHomeState createState() => new StockHomeState(); StockHomeState createState() => new StockHomeState();
} }
...@@ -336,6 +338,7 @@ class StockHomeState extends State<StockHome> { ...@@ -336,6 +338,7 @@ class StockHomeState extends State<StockHome> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new TabBarSelection<StockHomeTab>( return new TabBarSelection<StockHomeTab>(
values: <StockHomeTab>[StockHomeTab.market, StockHomeTab.portfolio], values: <StockHomeTab>[StockHomeTab.market, StockHomeTab.portfolio],
...@@ -356,6 +359,7 @@ class StockHomeState extends State<StockHome> { ...@@ -356,6 +359,7 @@ class StockHomeState extends State<StockHome> {
} }
class _CreateCompanySheet extends StatefulWidget { class _CreateCompanySheet extends StatefulWidget {
@override
_CreateCompanySheetState createState() => new _CreateCompanySheetState(); _CreateCompanySheetState createState() => new _CreateCompanySheetState();
} }
...@@ -368,6 +372,7 @@ class _CreateCompanySheetState extends State<_CreateCompanySheet> { ...@@ -368,6 +372,7 @@ class _CreateCompanySheetState extends State<_CreateCompanySheet> {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// TODO(ianh): Fill this out. // TODO(ianh): Fill this out.
return new Column( return new Column(
......
...@@ -16,6 +16,7 @@ class StockList extends StatelessWidget { ...@@ -16,6 +16,7 @@ class StockList extends StatelessWidget {
final StockRowActionCallback onShow; final StockRowActionCallback onShow;
final StockRowActionCallback onAction; final StockRowActionCallback onAction;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new ScrollableList( return new ScrollableList(
key: const ValueKey<String>('stock-list'), key: const ValueKey<String>('stock-list'),
......
...@@ -11,9 +11,12 @@ enum StockRowPartKind { arrow } ...@@ -11,9 +11,12 @@ enum StockRowPartKind { arrow }
class StockRowPartKey extends Key { class StockRowPartKey extends Key {
const StockRowPartKey(this.keySalt, this.stock, this.part) : super.constructor(); const StockRowPartKey(this.keySalt, this.stock, this.part) : super.constructor();
final Object keySalt; final Object keySalt;
final Stock stock; final Stock stock;
final StockRowPartKind part; final StockRowPartKind part;
@override
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (identical(this, other)) if (identical(this, other))
return true; return true;
...@@ -24,7 +27,11 @@ class StockRowPartKey extends Key { ...@@ -24,7 +27,11 @@ class StockRowPartKey extends Key {
&& stock == typedOther.stock && stock == typedOther.stock
&& part == typedOther.part; && part == typedOther.part;
} }
@override
int get hashCode => hashValues(keySalt, stock, part); int get hashCode => hashValues(keySalt, stock, part);
@override
String toString() => '[$runtimeType ${keySalt.toString().split(".")[1]}:${stock.symbol}:${part.toString().split(".")[1]}]'; String toString() => '[$runtimeType ${keySalt.toString().split(".")[1]}:${stock.symbol}:${part.toString().split(".")[1]}]';
} }
...@@ -54,6 +61,7 @@ class StockRow extends StatelessWidget { ...@@ -54,6 +61,7 @@ class StockRow extends StatelessWidget {
return callback == null ? null : () => callback(stock, _arrowKey); return callback == null ? null : () => callback(stock, _arrowKey);
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}"; final String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}";
String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%"; String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%";
......
...@@ -12,6 +12,7 @@ class StockSettings extends StatefulWidget { ...@@ -12,6 +12,7 @@ class StockSettings extends StatefulWidget {
final StockConfiguration configuration; final StockConfiguration configuration;
final ValueChanged<StockConfiguration> updater; final ValueChanged<StockConfiguration> updater;
@override
StockSettingsState createState() => new StockSettingsState(); StockSettingsState createState() => new StockSettingsState();
} }
...@@ -245,6 +246,7 @@ class StockSettingsState extends State<StockSettings> { ...@@ -245,6 +246,7 @@ class StockSettingsState extends State<StockSettings> {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: buildAppBar(context), appBar: buildAppBar(context),
......
...@@ -13,6 +13,7 @@ class StockSymbolView extends StatelessWidget { ...@@ -13,6 +13,7 @@ class StockSymbolView extends StatelessWidget {
final Stock stock; final Stock stock;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}"; String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}";
String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%"; String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%";
...@@ -71,6 +72,7 @@ class StockSymbolPage extends StatelessWidget { ...@@ -71,6 +72,7 @@ class StockSymbolPage extends StatelessWidget {
final Stock stock; final Stock stock;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
...@@ -93,6 +95,7 @@ class StockSymbolBottomSheet extends StatelessWidget { ...@@ -93,6 +95,7 @@ class StockSymbolBottomSheet extends StatelessWidget {
final Stock stock; final Stock stock;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
padding: new EdgeInsets.all(10.0), padding: new EdgeInsets.all(10.0),
......
...@@ -153,6 +153,7 @@ class Expression extends _EquationMember { ...@@ -153,6 +153,7 @@ class Expression extends _EquationMember {
return null; return null;
} }
@override
_EquationMember operator *(_EquationMember m) { _EquationMember operator *(_EquationMember m) {
_Pair<Expression, double> args = _findMulitplierAndMultiplicand(m); _Pair<Expression, double> args = _findMulitplierAndMultiplicand(m);
...@@ -166,6 +167,7 @@ class Expression extends _EquationMember { ...@@ -166,6 +167,7 @@ class Expression extends _EquationMember {
return args.first._applyMultiplicand(args.second); return args.first._applyMultiplicand(args.second);
} }
@override
_EquationMember operator /(_EquationMember m) { _EquationMember operator /(_EquationMember m) {
if (!m.isConstant) { if (!m.isConstant) {
throw new ParserException( throw new ParserException(
...@@ -176,6 +178,7 @@ class Expression extends _EquationMember { ...@@ -176,6 +178,7 @@ class Expression extends _EquationMember {
return this._applyMultiplicand(1.0 / m.value); return this._applyMultiplicand(1.0 / m.value);
} }
@override
String toString() { String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
......
...@@ -18,12 +18,15 @@ class Param extends _EquationMember { ...@@ -18,12 +18,15 @@ class Param extends _EquationMember {
dynamic context; dynamic context;
@override
bool get isConstant => false; bool get isConstant => false;
@override
double get value => variable.value; double get value => variable.value;
String get name => variable.name; String get name => variable.name;
void set name(String name) { variable.name = name; } void set name(String name) { variable.name = name; }
@override
Expression asExpression() => new Expression(<Term>[new Term(variable, 1.0)], 0.0); Expression asExpression() => new Expression(<Term>[new Term(variable, 1.0)], 0.0);
} }
...@@ -9,6 +9,7 @@ class ParserException implements Exception { ...@@ -9,6 +9,7 @@ class ParserException implements Exception {
List<_EquationMember> members; List<_EquationMember> members;
ParserException(this.message, this.members); ParserException(this.message, this.members);
@override
String toString() { String toString() {
if (message == null) return "Error while parsing constraint or expression"; if (message == null) return "Error while parsing constraint or expression";
return "Error: '$message' while trying to parse constraint or expression"; return "Error: '$message' while trying to parse constraint or expression";
......
...@@ -65,6 +65,7 @@ class _Row { ...@@ -65,6 +65,7 @@ class _Row {
insertRow(row, coefficient); insertRow(row, coefficient);
} }
@override
String toString() { String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
......
...@@ -588,6 +588,7 @@ class Solver { ...@@ -588,6 +588,7 @@ class Solver {
return entering ?? new _Symbol(_SymbolType.invalid, 0); return entering ?? new _Symbol(_SymbolType.invalid, 0);
} }
@override
String toString() { String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
String separator = "\n~~~~~~~~~"; String separator = "\n~~~~~~~~~";
......
...@@ -12,6 +12,7 @@ class _Symbol { ...@@ -12,6 +12,7 @@ class _Symbol {
_Symbol(this.type, this.tick); _Symbol(this.type, this.tick);
@override
String toString() { String toString() {
String typeString = 'unknown'; String typeString = 'unknown';
switch (type) { switch (type) {
......
...@@ -10,13 +10,17 @@ class Term extends _EquationMember { ...@@ -10,13 +10,17 @@ class Term extends _EquationMember {
final Variable variable; final Variable variable;
final double coefficient; final double coefficient;
@override
bool get isConstant => false; bool get isConstant => false;
@override
double get value => coefficient * variable.value; double get value => coefficient * variable.value;
@override
Expression asExpression() => Expression asExpression() =>
new Expression([new Term(this.variable, this.coefficient)], 0.0); new Expression([new Term(this.variable, this.coefficient)], 0.0);
@override
String toString() { String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
......
...@@ -62,6 +62,7 @@ abstract class Animation<T> { ...@@ -62,6 +62,7 @@ abstract class Animation<T> {
/// Whether this animation is stopped at the end. /// Whether this animation is stopped at the end.
bool get isCompleted => status == AnimationStatus.completed; bool get isCompleted => status == AnimationStatus.completed;
@override
String toString() { String toString() {
return '$runtimeType(${toStringDetails()})'; return '$runtimeType(${toStringDetails()})';
} }
......
...@@ -99,6 +99,7 @@ class AnimationController extends Animation<double> ...@@ -99,6 +99,7 @@ class AnimationController extends Animation<double>
/// Setting this value also stops the controller if it is currently /// Setting this value also stops the controller if it is currently
/// running; if this happens, it also notifies all the status /// running; if this happens, it also notifies all the status
/// listeners. /// listeners.
@override
double get value => _value; double get value => _value;
double _value; double _value;
void set value(double newValue) { void set value(double newValue) {
...@@ -114,6 +115,7 @@ class AnimationController extends Animation<double> ...@@ -114,6 +115,7 @@ class AnimationController extends Animation<double>
_AnimationDirection _direction; _AnimationDirection _direction;
@override
AnimationStatus get status { AnimationStatus get status {
if (!isAnimating && value == upperBound) if (!isAnimating && value == upperBound)
return AnimationStatus.completed; return AnimationStatus.completed;
...@@ -202,6 +204,7 @@ class AnimationController extends Animation<double> ...@@ -202,6 +204,7 @@ class AnimationController extends Animation<double>
} }
/// Stops running this animation. /// Stops running this animation.
@override
void dispose() { void dispose() {
stop(); stop();
} }
...@@ -224,6 +227,7 @@ class AnimationController extends Animation<double> ...@@ -224,6 +227,7 @@ class AnimationController extends Animation<double>
_checkStatusChanged(); _checkStatusChanged();
} }
@override
String toStringDetails() { String toStringDetails() {
String paused = isAnimating ? '' : '; paused'; String paused = isAnimating ? '' : '; paused';
String label = debugLabel == null ? '' : '; for $debugLabel'; String label = debugLabel == null ? '' : '; for $debugLabel';
...@@ -245,6 +249,7 @@ class _InterpolationSimulation extends Simulation { ...@@ -245,6 +249,7 @@ class _InterpolationSimulation extends Simulation {
final double _end; final double _end;
final Curve _curve; final Curve _curve;
@override
double x(double timeInSeconds) { double x(double timeInSeconds) {
assert(timeInSeconds >= 0.0); assert(timeInSeconds >= 0.0);
double t = (timeInSeconds / _durationInSeconds).clamp(0.0, 1.0); double t = (timeInSeconds / _durationInSeconds).clamp(0.0, 1.0);
...@@ -256,8 +261,10 @@ class _InterpolationSimulation extends Simulation { ...@@ -256,8 +261,10 @@ class _InterpolationSimulation extends Simulation {
return _begin + (_end - _begin) * _curve.transform(t); return _begin + (_end - _begin) * _curve.transform(t);
} }
@override
double dx(double timeInSeconds) => 1.0; double dx(double timeInSeconds) => 1.0;
@override
bool isDone(double timeInSeconds) => timeInSeconds > _durationInSeconds; bool isDone(double timeInSeconds) => timeInSeconds > _durationInSeconds;
} }
...@@ -272,13 +279,16 @@ class _RepeatingSimulation extends Simulation { ...@@ -272,13 +279,16 @@ class _RepeatingSimulation extends Simulation {
final double _periodInSeconds; final double _periodInSeconds;
@override
double x(double timeInSeconds) { double x(double timeInSeconds) {
assert(timeInSeconds >= 0.0); assert(timeInSeconds >= 0.0);
final double t = (timeInSeconds / _periodInSeconds) % 1.0; final double t = (timeInSeconds / _periodInSeconds) % 1.0;
return ui.lerpDouble(min, max, t); return ui.lerpDouble(min, max, t);
} }
@override
double dx(double timeInSeconds) => 1.0; double dx(double timeInSeconds) => 1.0;
@override
bool isDone(double timeInSeconds) => false; bool isDone(double timeInSeconds) => false;
} }
...@@ -11,11 +11,22 @@ import 'listener_helpers.dart'; ...@@ -11,11 +11,22 @@ import 'listener_helpers.dart';
class _AlwaysCompleteAnimation extends Animation<double> { class _AlwaysCompleteAnimation extends Animation<double> {
const _AlwaysCompleteAnimation(); const _AlwaysCompleteAnimation();
@override
void addListener(VoidCallback listener) { } void addListener(VoidCallback listener) { }
@override
void removeListener(VoidCallback listener) { } void removeListener(VoidCallback listener) { }
@override
void addStatusListener(AnimationStatusListener listener) { } void addStatusListener(AnimationStatusListener listener) { }
@override
void removeStatusListener(AnimationStatusListener listener) { } void removeStatusListener(AnimationStatusListener listener) { }
@override
AnimationStatus get status => AnimationStatus.completed; AnimationStatus get status => AnimationStatus.completed;
@override
double get value => 1.0; double get value => 1.0;
} }
...@@ -29,11 +40,22 @@ const Animation<double> kAlwaysCompleteAnimation = const _AlwaysCompleteAnimatio ...@@ -29,11 +40,22 @@ const Animation<double> kAlwaysCompleteAnimation = const _AlwaysCompleteAnimatio
class _AlwaysDismissedAnimation extends Animation<double> { class _AlwaysDismissedAnimation extends Animation<double> {
const _AlwaysDismissedAnimation(); const _AlwaysDismissedAnimation();
@override
void addListener(VoidCallback listener) { } void addListener(VoidCallback listener) { }
@override
void removeListener(VoidCallback listener) { } void removeListener(VoidCallback listener) { }
@override
void addStatusListener(AnimationStatusListener listener) { } void addStatusListener(AnimationStatusListener listener) { }
@override
void removeStatusListener(AnimationStatusListener listener) { } void removeStatusListener(AnimationStatusListener listener) { }
@override
AnimationStatus get status => AnimationStatus.dismissed; AnimationStatus get status => AnimationStatus.dismissed;
@override
double get value => 0.0; double get value => 0.0;
} }
...@@ -48,12 +70,22 @@ const Animation<double> kAlwaysDismissedAnimation = const _AlwaysDismissedAnimat ...@@ -48,12 +70,22 @@ const Animation<double> kAlwaysDismissedAnimation = const _AlwaysDismissedAnimat
class AlwaysStoppedAnimation<T> extends Animation<T> { class AlwaysStoppedAnimation<T> extends Animation<T> {
const AlwaysStoppedAnimation(this.value); const AlwaysStoppedAnimation(this.value);
@override
final T value; final T value;
@override
void addListener(VoidCallback listener) { } void addListener(VoidCallback listener) { }
@override
void removeListener(VoidCallback listener) { } void removeListener(VoidCallback listener) { }
@override
void addStatusListener(AnimationStatusListener listener) { } void addStatusListener(AnimationStatusListener listener) { }
@override
void removeStatusListener(AnimationStatusListener listener) { } void removeStatusListener(AnimationStatusListener listener) { }
@override
AnimationStatus get status => AnimationStatus.forward; AnimationStatus get status => AnimationStatus.forward;
} }
...@@ -123,6 +155,7 @@ class ProxyAnimation extends Animation<double> ...@@ -123,6 +155,7 @@ class ProxyAnimation extends Animation<double>
} }
} }
@override
void didStartListening() { void didStartListening() {
if (_parent != null) { if (_parent != null) {
_parent.addListener(notifyListeners); _parent.addListener(notifyListeners);
...@@ -130,6 +163,7 @@ class ProxyAnimation extends Animation<double> ...@@ -130,6 +163,7 @@ class ProxyAnimation extends Animation<double>
} }
} }
@override
void didStopListening() { void didStopListening() {
if (_parent != null) { if (_parent != null) {
_parent.removeListener(notifyListeners); _parent.removeListener(notifyListeners);
...@@ -137,7 +171,10 @@ class ProxyAnimation extends Animation<double> ...@@ -137,7 +171,10 @@ class ProxyAnimation extends Animation<double>
} }
} }
@override
AnimationStatus get status => _parent != null ? _parent.status : _status; AnimationStatus get status => _parent != null ? _parent.status : _status;
@override
double get value => _parent != null ? _parent.value : _value; double get value => _parent != null ? _parent.value : _value;
} }
...@@ -155,19 +192,24 @@ class ReverseAnimation extends Animation<double> ...@@ -155,19 +192,24 @@ class ReverseAnimation extends Animation<double>
/// The animation whose value and direction this animation is reversing. /// The animation whose value and direction this animation is reversing.
final Animation<double> parent; final Animation<double> parent;
@override
void addListener(VoidCallback listener) { void addListener(VoidCallback listener) {
didRegisterListener(); didRegisterListener();
parent.addListener(listener); parent.addListener(listener);
} }
@override
void removeListener(VoidCallback listener) { void removeListener(VoidCallback listener) {
parent.removeListener(listener); parent.removeListener(listener);
didUnregisterListener(); didUnregisterListener();
} }
@override
void didStartListening() { void didStartListening() {
parent.addStatusListener(_statusChangeHandler); parent.addStatusListener(_statusChangeHandler);
} }
@override
void didStopListening() { void didStopListening() {
parent.removeStatusListener(_statusChangeHandler); parent.removeStatusListener(_statusChangeHandler);
} }
...@@ -176,7 +218,10 @@ class ReverseAnimation extends Animation<double> ...@@ -176,7 +218,10 @@ class ReverseAnimation extends Animation<double>
notifyStatusListeners(_reverseStatus(status)); notifyStatusListeners(_reverseStatus(status));
} }
@override
AnimationStatus get status => _reverseStatus(parent.status); AnimationStatus get status => _reverseStatus(parent.status);
@override
double get value => 1.0 - parent.value; double get value => 1.0 - parent.value;
AnimationStatus _reverseStatus(AnimationStatus status) { AnimationStatus _reverseStatus(AnimationStatus status) {
...@@ -206,6 +251,7 @@ class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<do ...@@ -206,6 +251,7 @@ class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<do
} }
/// The animation to which this animation applies a curve. /// The animation to which this animation applies a curve.
@override
final Animation<double> parent; final Animation<double> parent;
/// The curve to use in the forward direction. /// The curve to use in the forward direction.
...@@ -238,6 +284,7 @@ class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<do ...@@ -238,6 +284,7 @@ class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<do
} }
} }
@override
double get value { double get value {
final bool useForwardCurve = reverseCurve == null || (_curveDirection ?? parent.status) != AnimationStatus.reverse; final bool useForwardCurve = reverseCurve == null || (_curveDirection ?? parent.status) != AnimationStatus.reverse;
Curve activeCurve = useForwardCurve ? curve : reverseCurve; Curve activeCurve = useForwardCurve ? curve : reverseCurve;
...@@ -306,6 +353,7 @@ class TrainHoppingAnimation extends Animation<double> ...@@ -306,6 +353,7 @@ class TrainHoppingAnimation extends Animation<double>
assert(_lastStatus != null); assert(_lastStatus != null);
} }
@override
AnimationStatus get status => _currentTrain.status; AnimationStatus get status => _currentTrain.status;
double _lastValue; double _lastValue;
...@@ -342,10 +390,12 @@ class TrainHoppingAnimation extends Animation<double> ...@@ -342,10 +390,12 @@ class TrainHoppingAnimation extends Animation<double>
onSwitchedTrain(); onSwitchedTrain();
} }
@override
double get value => _currentTrain.value; double get value => _currentTrain.value;
/// Frees all the resources used by this performance. /// Frees all the resources used by this performance.
/// After this is called, this object is no longer usable. /// After this is called, this object is no longer usable.
@override
void dispose() { void dispose() {
assert(_currentTrain != null); assert(_currentTrain != null);
_currentTrain.removeStatusListener(_statusChangeHandler); _currentTrain.removeStatusListener(_statusChangeHandler);
......
...@@ -31,13 +31,18 @@ abstract class Curve { ...@@ -31,13 +31,18 @@ abstract class Curve {
/// The identity map over the unit interval. /// The identity map over the unit interval.
class Linear extends Curve { class Linear extends Curve {
const Linear(); const Linear();
@override
double transform(double t) => t; double transform(double t) => t;
} }
/// A sawtooth curve that repeats a given number of times over the unit interval. /// A sawtooth curve that repeats a given number of times over the unit interval.
class SawTooth extends Curve { class SawTooth extends Curve {
const SawTooth(this.count); const SawTooth(this.count);
final int count; final int count;
@override
double transform(double t) { double transform(double t) {
t *= count; t *= count;
return t - t.truncateToDouble(); return t - t.truncateToDouble();
...@@ -57,6 +62,7 @@ class Interval extends Curve { ...@@ -57,6 +62,7 @@ class Interval extends Curve {
/// The curve to apply between [start] and [end]. /// The curve to apply between [start] and [end].
final Curve curve; final Curve curve;
@override
double transform(double t) { double transform(double t) {
assert(start >= 0.0); assert(start >= 0.0);
assert(start <= 1.0); assert(start <= 1.0);
...@@ -79,6 +85,7 @@ class Cubic extends Curve { ...@@ -79,6 +85,7 @@ class Cubic extends Curve {
final double c; final double c;
final double d; final double d;
@override
double transform(double t) { double transform(double t) {
double start = 0.0; double start = 0.0;
double end = 1.0; double end = 1.0;
...@@ -112,13 +119,18 @@ double _bounce(double t) { ...@@ -112,13 +119,18 @@ double _bounce(double t) {
/// A curve that is the reversed inversion of its given curve. /// A curve that is the reversed inversion of its given curve.
class FlippedCurve extends Curve { class FlippedCurve extends Curve {
FlippedCurve(this.curve); FlippedCurve(this.curve);
final Curve curve; final Curve curve;
@override
double transform(double t) => 1.0 - curve.transform(1.0 - t); double transform(double t) => 1.0 - curve.transform(1.0 - t);
} }
/// An oscillating curve that grows in magnitude. /// An oscillating curve that grows in magnitude.
class BounceInCurve extends Curve { class BounceInCurve extends Curve {
const BounceInCurve(); const BounceInCurve();
@override
double transform(double t) { double transform(double t) {
return 1.0 - _bounce(1.0 - t); return 1.0 - _bounce(1.0 - t);
} }
...@@ -127,6 +139,8 @@ class BounceInCurve extends Curve { ...@@ -127,6 +139,8 @@ class BounceInCurve extends Curve {
/// An oscillating curve that shrink in magnitude. /// An oscillating curve that shrink in magnitude.
class BounceOutCurve extends Curve { class BounceOutCurve extends Curve {
const BounceOutCurve(); const BounceOutCurve();
@override
double transform(double t) { double transform(double t) {
return _bounce(t); return _bounce(t);
} }
...@@ -135,6 +149,8 @@ class BounceOutCurve extends Curve { ...@@ -135,6 +149,8 @@ class BounceOutCurve extends Curve {
/// An oscillating curve that first grows and then shrink in magnitude. /// An oscillating curve that first grows and then shrink in magnitude.
class BounceInOutCurve extends Curve { class BounceInOutCurve extends Curve {
const BounceInOutCurve(); const BounceInOutCurve();
@override
double transform(double t) { double transform(double t) {
if (t < 0.5) if (t < 0.5)
return (1.0 - _bounce(1.0 - t)) * 0.5; return (1.0 - _bounce(1.0 - t)) * 0.5;
...@@ -146,7 +162,10 @@ class BounceInOutCurve extends Curve { ...@@ -146,7 +162,10 @@ class BounceInOutCurve extends Curve {
/// An oscillating curve that grows in magnitude while overshooting its bounds. /// An oscillating curve that grows in magnitude while overshooting its bounds.
class ElasticInCurve extends Curve { class ElasticInCurve extends Curve {
const ElasticInCurve([this.period = 0.4]); const ElasticInCurve([this.period = 0.4]);
final double period; final double period;
@override
double transform(double t) { double transform(double t) {
double s = period / 4.0; double s = period / 4.0;
t = t - 1.0; t = t - 1.0;
...@@ -157,7 +176,10 @@ class ElasticInCurve extends Curve { ...@@ -157,7 +176,10 @@ class ElasticInCurve extends Curve {
/// An oscillating curve that shrinks in magnitude while overshooting its bounds. /// An oscillating curve that shrinks in magnitude while overshooting its bounds.
class ElasticOutCurve extends Curve { class ElasticOutCurve extends Curve {
const ElasticOutCurve([this.period = 0.4]); const ElasticOutCurve([this.period = 0.4]);
final double period; final double period;
@override
double transform(double t) { double transform(double t) {
double s = period / 4.0; double s = period / 4.0;
return math.pow(2.0, -10 * t) * math.sin((t - s) * (math.PI * 2.0) / period) + 1.0; return math.pow(2.0, -10 * t) * math.sin((t - s) * (math.PI * 2.0) / period) + 1.0;
...@@ -167,7 +189,10 @@ class ElasticOutCurve extends Curve { ...@@ -167,7 +189,10 @@ class ElasticOutCurve extends Curve {
/// An oscillating curve that grows and then shrinks in magnitude while overshooting its bounds. /// An oscillating curve that grows and then shrinks in magnitude while overshooting its bounds.
class ElasticInOutCurve extends Curve { class ElasticInOutCurve extends Curve {
const ElasticInOutCurve([this.period = 0.4]); const ElasticInOutCurve([this.period = 0.4]);
final double period; final double period;
@override
double transform(double t) { double transform(double t) {
double s = period / 4.0; double s = period / 4.0;
t = 2.0 * t - 1.0; t = 2.0 * t - 1.0;
......
...@@ -37,6 +37,7 @@ class SpringForce extends Force { ...@@ -37,6 +37,7 @@ class SpringForce extends Force {
distance: 0.01 distance: 0.01
); );
@override
Simulation release(double position, double velocity) { Simulation release(double position, double velocity) {
double target = velocity < 0.0 ? this.left - tolerance.distance double target = velocity < 0.0 ? this.left - tolerance.distance
: this.right + tolerance.distance; : this.right + tolerance.distance;
......
...@@ -14,18 +14,23 @@ abstract class _ListenerMixin { ...@@ -14,18 +14,23 @@ abstract class _ListenerMixin {
/// A mixin that helps listen to another object only when this object has registered listeners. /// A mixin that helps listen to another object only when this object has registered listeners.
abstract class AnimationLazyListenerMixin implements _ListenerMixin { abstract class AnimationLazyListenerMixin implements _ListenerMixin {
int _listenerCounter = 0; int _listenerCounter = 0;
@override
void didRegisterListener() { void didRegisterListener() {
assert(_listenerCounter >= 0); assert(_listenerCounter >= 0);
if (_listenerCounter == 0) if (_listenerCounter == 0)
didStartListening(); didStartListening();
_listenerCounter += 1; _listenerCounter += 1;
} }
@override
void didUnregisterListener() { void didUnregisterListener() {
assert(_listenerCounter >= 1); assert(_listenerCounter >= 1);
_listenerCounter -= 1; _listenerCounter -= 1;
if (_listenerCounter == 0) if (_listenerCounter == 0)
didStopListening(); didStopListening();
} }
void didStartListening(); void didStartListening();
void didStopListening(); void didStopListening();
bool get isListening => _listenerCounter > 0; bool get isListening => _listenerCounter > 0;
...@@ -34,7 +39,10 @@ abstract class AnimationLazyListenerMixin implements _ListenerMixin { ...@@ -34,7 +39,10 @@ abstract class AnimationLazyListenerMixin implements _ListenerMixin {
/// A mixin that replaces the didRegisterListener/didUnregisterListener contract /// A mixin that replaces the didRegisterListener/didUnregisterListener contract
/// with a dispose contract. /// with a dispose contract.
abstract class AnimationEagerListenerMixin implements _ListenerMixin { abstract class AnimationEagerListenerMixin implements _ListenerMixin {
@override
void didRegisterListener() { } void didRegisterListener() { }
@override
void didUnregisterListener() { } void didUnregisterListener() { }
/// Release any resources used by this object. /// Release any resources used by this object.
......
...@@ -32,10 +32,12 @@ class _AnimatedEvaluation<T> extends Animation<T> with AnimationWithParentMixin< ...@@ -32,10 +32,12 @@ class _AnimatedEvaluation<T> extends Animation<T> with AnimationWithParentMixin<
_AnimatedEvaluation(this.parent, this._evaluatable); _AnimatedEvaluation(this.parent, this._evaluatable);
/// The animation from which this value is derived. /// The animation from which this value is derived.
@override
final Animation<double> parent; final Animation<double> parent;
final Animatable<T> _evaluatable; final Animatable<T> _evaluatable;
@override
T get value => _evaluatable.evaluate(parent); T get value => _evaluatable.evaluate(parent);
} }
...@@ -45,6 +47,7 @@ class _ChainedEvaluation<T> extends Animatable<T> { ...@@ -45,6 +47,7 @@ class _ChainedEvaluation<T> extends Animatable<T> {
final Animatable<double> _parent; final Animatable<double> _parent;
final Animatable<T> _evaluatable; final Animatable<T> _evaluatable;
@override
T evaluate(Animation<double> animation) { T evaluate(Animation<double> animation) {
double value = _parent.evaluate(animation); double value = _parent.evaluate(animation);
return _evaluatable.evaluate(new AlwaysStoppedAnimation<double>(value)); return _evaluatable.evaluate(new AlwaysStoppedAnimation<double>(value));
...@@ -65,6 +68,7 @@ class Tween<T extends dynamic> extends Animatable<T> { ...@@ -65,6 +68,7 @@ class Tween<T extends dynamic> extends Animatable<T> {
T lerp(double t) => begin + (end - begin) * t; T lerp(double t) => begin + (end - begin) * t;
/// Returns the interpolated value for the current value of the given animation. /// Returns the interpolated value for the current value of the given animation.
@override
T evaluate(Animation<double> animation) { T evaluate(Animation<double> animation) {
if (end == null) if (end == null)
return begin; return begin;
...@@ -76,6 +80,7 @@ class Tween<T extends dynamic> extends Animatable<T> { ...@@ -76,6 +80,7 @@ class Tween<T extends dynamic> extends Animatable<T> {
return lerp(t); return lerp(t);
} }
@override
String toString() => '$runtimeType($begin \u2192 $end)'; String toString() => '$runtimeType($begin \u2192 $end)';
} }
...@@ -86,6 +91,7 @@ class Tween<T extends dynamic> extends Animatable<T> { ...@@ -86,6 +91,7 @@ class Tween<T extends dynamic> extends Animatable<T> {
class ColorTween extends Tween<Color> { class ColorTween extends Tween<Color> {
ColorTween({ Color begin, Color end }) : super(begin: begin, end: end); ColorTween({ Color begin, Color end }) : super(begin: begin, end: end);
@override
Color lerp(double t) => Color.lerp(begin, end, t); Color lerp(double t) => Color.lerp(begin, end, t);
} }
...@@ -96,6 +102,7 @@ class ColorTween extends Tween<Color> { ...@@ -96,6 +102,7 @@ class ColorTween extends Tween<Color> {
class SizeTween extends Tween<Size> { class SizeTween extends Tween<Size> {
SizeTween({ Size begin, Size end }) : super(begin: begin, end: end); SizeTween({ Size begin, Size end }) : super(begin: begin, end: end);
@override
Size lerp(double t) => Size.lerp(begin, end, t); Size lerp(double t) => Size.lerp(begin, end, t);
} }
...@@ -106,6 +113,7 @@ class SizeTween extends Tween<Size> { ...@@ -106,6 +113,7 @@ class SizeTween extends Tween<Size> {
class RectTween extends Tween<Rect> { class RectTween extends Tween<Rect> {
RectTween({ Rect begin, Rect end }) : super(begin: begin, end: end); RectTween({ Rect begin, Rect end }) : super(begin: begin, end: end);
@override
Rect lerp(double t) => Rect.lerp(begin, end, t); Rect lerp(double t) => Rect.lerp(begin, end, t);
} }
...@@ -123,6 +131,7 @@ class IntTween extends Tween<int> { ...@@ -123,6 +131,7 @@ class IntTween extends Tween<int> {
// The inherited lerp() function doesn't work with ints because it multiplies // The inherited lerp() function doesn't work with ints because it multiplies
// the begin and end types by a double, and int * double returns a double. // the begin and end types by a double, and int * double returns a double.
@override
int lerp(double t) => (begin + (end - begin) * t).round(); int lerp(double t) => (begin + (end - begin) * t).round();
} }
...@@ -140,6 +149,7 @@ class StepTween extends Tween<int> { ...@@ -140,6 +149,7 @@ class StepTween extends Tween<int> {
// The inherited lerp() function doesn't work with ints because it multiplies // The inherited lerp() function doesn't work with ints because it multiplies
// the begin and end types by a double, and int * double returns a double. // the begin and end types by a double, and int * double returns a double.
@override
int lerp(double t) => (begin + (end - begin) * t).floor(); int lerp(double t) => (begin + (end - begin) * t).floor();
} }
...@@ -154,6 +164,7 @@ class CurveTween extends Animatable<double> { ...@@ -154,6 +164,7 @@ class CurveTween extends Animatable<double> {
/// The curve to use when transforming the value of the animation. /// The curve to use when transforming the value of the animation.
Curve curve; Curve curve;
@override
double evaluate(Animation<double> animation) { double evaluate(Animation<double> animation) {
double t = animation.value; double t = animation.value;
if (t == 0.0 || t == 1.0) { if (t == 0.0 || t == 1.0) {
......
...@@ -21,6 +21,7 @@ typedef void GesturerExceptionHandler(PointerEvent event, HitTestTarget target, ...@@ -21,6 +21,7 @@ typedef void GesturerExceptionHandler(PointerEvent event, HitTestTarget target,
/// A binding for the gesture subsystem. /// A binding for the gesture subsystem.
abstract class Gesturer extends BindingBase implements HitTestTarget, HitTestable { abstract class Gesturer extends BindingBase implements HitTestTarget, HitTestable {
@override
void initInstances() { void initInstances() {
super.initInstances(); super.initInstances();
_instance = this; _instance = this;
...@@ -76,6 +77,7 @@ abstract class Gesturer extends BindingBase implements HitTestTarget, HitTestabl ...@@ -76,6 +77,7 @@ abstract class Gesturer extends BindingBase implements HitTestTarget, HitTestabl
} }
/// Determine which [HitTestTarget] objects are located at a given position. /// Determine which [HitTestTarget] objects are located at a given position.
@override
void hitTest(HitTestResult result, Point position) { void hitTest(HitTestResult result, Point position) {
result.add(new HitTestEntry(this)); result.add(new HitTestEntry(this));
} }
...@@ -113,6 +115,7 @@ abstract class Gesturer extends BindingBase implements HitTestTarget, HitTestabl ...@@ -113,6 +115,7 @@ abstract class Gesturer extends BindingBase implements HitTestTarget, HitTestabl
} }
} }
@override
void handleEvent(PointerEvent event, HitTestEntry entry) { void handleEvent(PointerEvent event, HitTestEntry entry) {
pointerRouter.route(event); pointerRouter.route(event);
if (event is PointerDownEvent) { if (event is PointerDownEvent) {
......
...@@ -46,6 +46,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest ...@@ -46,6 +46,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest
Map<int, VelocityTracker> _velocityTrackers = new Map<int, VelocityTracker>(); Map<int, VelocityTracker> _velocityTrackers = new Map<int, VelocityTracker>();
@override
void addPointer(PointerEvent event) { void addPointer(PointerEvent event) {
startTrackingPointer(event.pointer); startTrackingPointer(event.pointer);
_velocityTrackers[event.pointer] = new VelocityTracker(); _velocityTrackers[event.pointer] = new VelocityTracker();
...@@ -56,6 +57,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest ...@@ -56,6 +57,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest
} }
} }
@override
void handleEvent(PointerEvent event) { void handleEvent(PointerEvent event) {
assert(_state != DragState.ready); assert(_state != DragState.ready);
if (event is PointerMoveEvent) { if (event is PointerMoveEvent) {
...@@ -75,6 +77,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest ...@@ -75,6 +77,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest
stopTrackingIfPointerNoLongerDown(event); stopTrackingIfPointerNoLongerDown(event);
} }
@override
void acceptGesture(int pointer) { void acceptGesture(int pointer) {
if (_state != DragState.accepted) { if (_state != DragState.accepted) {
_state = DragState.accepted; _state = DragState.accepted;
...@@ -87,6 +90,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest ...@@ -87,6 +90,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest
} }
} }
@override
void didStopTrackingLastPointer(int pointer) { void didStopTrackingLastPointer(int pointer) {
if (_state == DragState.possible) { if (_state == DragState.possible) {
resolve(GestureDisposition.rejected); resolve(GestureDisposition.rejected);
...@@ -108,6 +112,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest ...@@ -108,6 +112,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest
_velocityTrackers.clear(); _velocityTrackers.clear();
} }
@override
void dispose() { void dispose() {
_velocityTrackers.clear(); _velocityTrackers.clear();
super.dispose(); super.dispose();
...@@ -115,27 +120,45 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest ...@@ -115,27 +120,45 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest
} }
class VerticalDragGestureRecognizer extends _DragGestureRecognizer<double> { class VerticalDragGestureRecognizer extends _DragGestureRecognizer<double> {
@override
double get _initialPendingDragDelta => 0.0; double get _initialPendingDragDelta => 0.0;
@override
double _getDragDelta(PointerEvent event) => event.delta.dy; double _getDragDelta(PointerEvent event) => event.delta.dy;
@override
bool get _hasSufficientPendingDragDeltaToAccept => _pendingDragDelta.abs() > kTouchSlop; bool get _hasSufficientPendingDragDeltaToAccept => _pendingDragDelta.abs() > kTouchSlop;
@override
String toStringShort() => 'vertical drag'; String toStringShort() => 'vertical drag';
} }
class HorizontalDragGestureRecognizer extends _DragGestureRecognizer<double> { class HorizontalDragGestureRecognizer extends _DragGestureRecognizer<double> {
@override
double get _initialPendingDragDelta => 0.0; double get _initialPendingDragDelta => 0.0;
@override
double _getDragDelta(PointerEvent event) => event.delta.dx; double _getDragDelta(PointerEvent event) => event.delta.dx;
@override
bool get _hasSufficientPendingDragDeltaToAccept => _pendingDragDelta.abs() > kTouchSlop; bool get _hasSufficientPendingDragDeltaToAccept => _pendingDragDelta.abs() > kTouchSlop;
@override
String toStringShort() => 'horizontal drag'; String toStringShort() => 'horizontal drag';
} }
class PanGestureRecognizer extends _DragGestureRecognizer<Offset> { class PanGestureRecognizer extends _DragGestureRecognizer<Offset> {
@override
Offset get _initialPendingDragDelta => Offset.zero; Offset get _initialPendingDragDelta => Offset.zero;
@override
Offset _getDragDelta(PointerEvent event) => event.delta; Offset _getDragDelta(PointerEvent event) => event.delta;
@override
bool get _hasSufficientPendingDragDeltaToAccept { bool get _hasSufficientPendingDragDeltaToAccept {
return _pendingDragDelta.distance > kPanSlop; return _pendingDragDelta.distance > kPanSlop;
} }
@override
String toStringShort() => 'pan'; String toStringShort() => 'pan';
} }
...@@ -171,6 +171,7 @@ abstract class PointerEvent { ...@@ -171,6 +171,7 @@ abstract class PointerEvent {
/// the stylus is flat on that surface). /// the stylus is flat on that surface).
final double tilt; final double tilt;
@override
String toString() => '$runtimeType($position)'; String toString() => '$runtimeType($position)';
String toStringFull() { String toStringFull() {
......
...@@ -25,6 +25,7 @@ class HitTestEntry { ...@@ -25,6 +25,7 @@ class HitTestEntry {
/// The [HitTestTarget] encountered during the hit test. /// The [HitTestTarget] encountered during the hit test.
final HitTestTarget target; final HitTestTarget target;
@override
String toString() => '$target'; String toString() => '$target';
} }
...@@ -49,5 +50,6 @@ class HitTestResult { ...@@ -49,5 +50,6 @@ class HitTestResult {
path.add(entry); path.add(entry);
} }
@override
String toString() => 'HitTestResult(${path.isEmpty ? "<empty path>" : path.join(", ")})'; String toString() => 'HitTestResult(${path.isEmpty ? "<empty path>" : path.join(", ")})';
} }
...@@ -15,16 +15,19 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -15,16 +15,19 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer {
GestureLongPressCallback onLongPress; GestureLongPressCallback onLongPress;
@override
void didExceedDeadline() { void didExceedDeadline() {
resolve(GestureDisposition.accepted); resolve(GestureDisposition.accepted);
if (onLongPress != null) if (onLongPress != null)
onLongPress(); onLongPress();
} }
@override
void handlePrimaryPointer(PointerEvent event) { void handlePrimaryPointer(PointerEvent event) {
if (event is PointerUpEvent) if (event is PointerUpEvent)
resolve(GestureDisposition.rejected); resolve(GestureDisposition.rejected);
} }
@override
String toStringShort() => 'long press'; String toStringShort() => 'long press';
} }
...@@ -36,6 +36,7 @@ class _Vector { ...@@ -36,6 +36,7 @@ class _Vector {
double norm() => math.sqrt(this * this); double norm() => math.sqrt(this * this);
@override
String toString() { String toString() {
String result = ""; String result = "";
for (int i = 0; i < _length; i++) { for (int i = 0; i < _length; i++) {
...@@ -68,6 +69,7 @@ class _Matrix { ...@@ -68,6 +69,7 @@ class _Matrix {
_columns _columns
); );
@override
String toString() { String toString() {
String result = ""; String result = "";
for (int i = 0; i < _rows; i++) { for (int i = 0; i < _rows; i++) {
......
...@@ -125,6 +125,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten ...@@ -125,6 +125,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten
Map<int, T> _pointers = <int, T>{}; Map<int, T> _pointers = <int, T>{};
@override
void addPointer(PointerDownEvent event) { void addPointer(PointerDownEvent event) {
assert(_pointers != null); assert(_pointers != null);
assert(event.pointer != null); assert(event.pointer != null);
...@@ -163,6 +164,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten ...@@ -163,6 +164,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten
} }
} }
@override
void acceptGesture(int pointer) { void acceptGesture(int pointer) {
assert(_pointers != null); assert(_pointers != null);
T state = _pointers[pointer]; T state = _pointers[pointer];
...@@ -186,6 +188,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten ...@@ -186,6 +188,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten
return drag; return drag;
} }
@override
void rejectGesture(int pointer) { void rejectGesture(int pointer) {
assert(_pointers != null); assert(_pointers != null);
if (_pointers.containsKey(pointer)) { if (_pointers.containsKey(pointer)) {
...@@ -204,6 +207,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten ...@@ -204,6 +207,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten
_pointers.remove(pointer); _pointers.remove(pointer);
} }
@override
void dispose() { void dispose() {
for (int pointer in _pointers.keys) for (int pointer in _pointers.keys)
_removeState(pointer); _removeState(pointer);
...@@ -217,22 +221,26 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten ...@@ -217,22 +221,26 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten
class _ImmediatePointerState extends MultiDragPointerState { class _ImmediatePointerState extends MultiDragPointerState {
_ImmediatePointerState(Point initialPosition) : super(initialPosition); _ImmediatePointerState(Point initialPosition) : super(initialPosition);
@override
void checkForResolutionAfterMove() { void checkForResolutionAfterMove() {
assert(pendingDelta != null); assert(pendingDelta != null);
if (pendingDelta.distance > kTouchSlop) if (pendingDelta.distance > kTouchSlop)
resolve(GestureDisposition.accepted); resolve(GestureDisposition.accepted);
} }
@override
void accepted(GestureMultiDragStartCallback starter) { void accepted(GestureMultiDragStartCallback starter) {
starter(initialPosition); starter(initialPosition);
} }
} }
class ImmediateMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_ImmediatePointerState> { class ImmediateMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_ImmediatePointerState> {
@override
_ImmediatePointerState createNewPointerState(PointerDownEvent event) { _ImmediatePointerState createNewPointerState(PointerDownEvent event) {
return new _ImmediatePointerState(event.position); return new _ImmediatePointerState(event.position);
} }
@override
String toStringShort() => 'multidrag'; String toStringShort() => 'multidrag';
} }
...@@ -240,22 +248,26 @@ class ImmediateMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_Im ...@@ -240,22 +248,26 @@ class ImmediateMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_Im
class _HorizontalPointerState extends MultiDragPointerState { class _HorizontalPointerState extends MultiDragPointerState {
_HorizontalPointerState(Point initialPosition) : super(initialPosition); _HorizontalPointerState(Point initialPosition) : super(initialPosition);
@override
void checkForResolutionAfterMove() { void checkForResolutionAfterMove() {
assert(pendingDelta != null); assert(pendingDelta != null);
if (pendingDelta.dx.abs() > kTouchSlop) if (pendingDelta.dx.abs() > kTouchSlop)
resolve(GestureDisposition.accepted); resolve(GestureDisposition.accepted);
} }
@override
void accepted(GestureMultiDragStartCallback starter) { void accepted(GestureMultiDragStartCallback starter) {
starter(initialPosition); starter(initialPosition);
} }
} }
class HorizontalMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_HorizontalPointerState> { class HorizontalMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_HorizontalPointerState> {
@override
_HorizontalPointerState createNewPointerState(PointerDownEvent event) { _HorizontalPointerState createNewPointerState(PointerDownEvent event) {
return new _HorizontalPointerState(event.position); return new _HorizontalPointerState(event.position);
} }
@override
String toStringShort() => 'horizontal multidrag'; String toStringShort() => 'horizontal multidrag';
} }
...@@ -263,22 +275,26 @@ class HorizontalMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_H ...@@ -263,22 +275,26 @@ class HorizontalMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_H
class _VerticalPointerState extends MultiDragPointerState { class _VerticalPointerState extends MultiDragPointerState {
_VerticalPointerState(Point initialPosition) : super(initialPosition); _VerticalPointerState(Point initialPosition) : super(initialPosition);
@override
void checkForResolutionAfterMove() { void checkForResolutionAfterMove() {
assert(pendingDelta != null); assert(pendingDelta != null);
if (pendingDelta.dy.abs() > kTouchSlop) if (pendingDelta.dy.abs() > kTouchSlop)
resolve(GestureDisposition.accepted); resolve(GestureDisposition.accepted);
} }
@override
void accepted(GestureMultiDragStartCallback starter) { void accepted(GestureMultiDragStartCallback starter) {
starter(initialPosition); starter(initialPosition);
} }
} }
class VerticalMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_VerticalPointerState> { class VerticalMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_VerticalPointerState> {
@override
_VerticalPointerState createNewPointerState(PointerDownEvent event) { _VerticalPointerState createNewPointerState(PointerDownEvent event) {
return new _VerticalPointerState(event.position); return new _VerticalPointerState(event.position);
} }
@override
String toStringShort() => 'vertical multidrag'; String toStringShort() => 'vertical multidrag';
} }
...@@ -306,6 +322,7 @@ class _DelayedPointerState extends MultiDragPointerState { ...@@ -306,6 +322,7 @@ class _DelayedPointerState extends MultiDragPointerState {
assert(_starter == null); assert(_starter == null);
} }
@override
void accepted(GestureMultiDragStartCallback starter) { void accepted(GestureMultiDragStartCallback starter) {
assert(_starter == null); assert(_starter == null);
if (_timer == null) if (_timer == null)
...@@ -314,6 +331,7 @@ class _DelayedPointerState extends MultiDragPointerState { ...@@ -314,6 +331,7 @@ class _DelayedPointerState extends MultiDragPointerState {
_starter = starter; _starter = starter;
} }
@override
void checkForResolutionAfterMove() { void checkForResolutionAfterMove() {
assert(_timer != null); assert(_timer != null);
assert(pendingDelta != null); assert(pendingDelta != null);
...@@ -321,6 +339,7 @@ class _DelayedPointerState extends MultiDragPointerState { ...@@ -321,6 +339,7 @@ class _DelayedPointerState extends MultiDragPointerState {
resolve(GestureDisposition.rejected); resolve(GestureDisposition.rejected);
} }
@override
void dispose() { void dispose() {
_timer?.cancel(); _timer?.cancel();
_timer = null; _timer = null;
...@@ -342,9 +361,11 @@ class DelayedMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_Dela ...@@ -342,9 +361,11 @@ class DelayedMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_Dela
_delay = value; _delay = value;
} }
@override
_DelayedPointerState createNewPointerState(PointerDownEvent event) { _DelayedPointerState createNewPointerState(PointerDownEvent event) {
return new _DelayedPointerState(event.position, _delay); return new _DelayedPointerState(event.position, _delay);
} }
@override
String toStringShort() => 'long multidrag'; String toStringShort() => 'long multidrag';
} }
...@@ -82,6 +82,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer { ...@@ -82,6 +82,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
_TapTracker _firstTap; _TapTracker _firstTap;
final Map<int, _TapTracker> _trackers = new Map<int, _TapTracker>(); final Map<int, _TapTracker> _trackers = new Map<int, _TapTracker>();
@override
void addPointer(PointerEvent event) { void addPointer(PointerEvent event) {
// Ignore out-of-bounds second taps. // Ignore out-of-bounds second taps.
if (_firstTap != null && if (_firstTap != null &&
...@@ -112,8 +113,10 @@ class DoubleTapGestureRecognizer extends GestureRecognizer { ...@@ -112,8 +113,10 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
} }
} }
@override
void acceptGesture(int pointer) { } void acceptGesture(int pointer) { }
@override
void rejectGesture(int pointer) { void rejectGesture(int pointer) {
_TapTracker tracker = _trackers[pointer]; _TapTracker tracker = _trackers[pointer];
// If tracker isn't in the list, check if this is the first tap tracker // If tracker isn't in the list, check if this is the first tap tracker
...@@ -138,6 +141,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer { ...@@ -138,6 +141,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
_reset(); _reset();
} }
@override
void dispose() { void dispose() {
_reset(); _reset();
} }
...@@ -198,6 +202,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer { ...@@ -198,6 +202,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
} }
} }
@override
String toStringShort() => 'double tap'; String toStringShort() => 'double tap';
} }
...@@ -255,6 +260,7 @@ class _TapGesture extends _TapTracker { ...@@ -255,6 +260,7 @@ class _TapGesture extends _TapTracker {
} }
} }
@override
void stopTrackingPointer(PointerRoute route) { void stopTrackingPointer(PointerRoute route) {
_timer?.cancel(); _timer?.cancel();
_timer = null; _timer = null;
...@@ -305,6 +311,7 @@ class MultiTapGestureRecognizer extends GestureRecognizer { ...@@ -305,6 +311,7 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
final Map<int, _TapGesture> _gestureMap = new Map<int, _TapGesture>(); final Map<int, _TapGesture> _gestureMap = new Map<int, _TapGesture>();
@override
void addPointer(PointerEvent event) { void addPointer(PointerEvent event) {
assert(!_gestureMap.containsKey(event.pointer)); assert(!_gestureMap.containsKey(event.pointer));
_gestureMap[event.pointer] = new _TapGesture( _gestureMap[event.pointer] = new _TapGesture(
...@@ -316,12 +323,14 @@ class MultiTapGestureRecognizer extends GestureRecognizer { ...@@ -316,12 +323,14 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
onTapDown(event.position, event.pointer); onTapDown(event.position, event.pointer);
} }
@override
void acceptGesture(int pointer) { void acceptGesture(int pointer) {
assert(_gestureMap.containsKey(pointer)); assert(_gestureMap.containsKey(pointer));
_gestureMap[pointer]?.accept(); _gestureMap[pointer]?.accept();
assert(!_gestureMap.containsKey(pointer)); assert(!_gestureMap.containsKey(pointer));
} }
@override
void rejectGesture(int pointer) { void rejectGesture(int pointer) {
assert(_gestureMap.containsKey(pointer)); assert(_gestureMap.containsKey(pointer));
_gestureMap[pointer]?.reject(); _gestureMap[pointer]?.reject();
...@@ -347,6 +356,7 @@ class MultiTapGestureRecognizer extends GestureRecognizer { ...@@ -347,6 +356,7 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
onLongTapDown(lastPosition, pointer); onLongTapDown(lastPosition, pointer);
} }
@override
void dispose() { void dispose() {
List<_TapGesture> localGestures = new List<_TapGesture>.from(_gestureMap.values); List<_TapGesture> localGestures = new List<_TapGesture>.from(_gestureMap.values);
for (_TapGesture gesture in localGestures) for (_TapGesture gesture in localGestures)
...@@ -355,5 +365,6 @@ class MultiTapGestureRecognizer extends GestureRecognizer { ...@@ -355,5 +365,6 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
assert(_gestureMap.isEmpty); assert(_gestureMap.isEmpty);
} }
@override
String toStringShort() => 'multitap'; String toStringShort() => 'multitap';
} }
...@@ -61,8 +61,13 @@ abstract class OneSequenceGestureRecognizer extends GestureRecognizer { ...@@ -61,8 +61,13 @@ abstract class OneSequenceGestureRecognizer extends GestureRecognizer {
final Set<int> _trackedPointers = new HashSet<int>(); final Set<int> _trackedPointers = new HashSet<int>();
void handleEvent(PointerEvent event); void handleEvent(PointerEvent event);
@override
void acceptGesture(int pointer) { } void acceptGesture(int pointer) { }
@override
void rejectGesture(int pointer) { } void rejectGesture(int pointer) { }
void didStopTrackingLastPointer(int pointer); void didStopTrackingLastPointer(int pointer);
void resolve(GestureDisposition disposition) { void resolve(GestureDisposition disposition) {
...@@ -72,6 +77,7 @@ abstract class OneSequenceGestureRecognizer extends GestureRecognizer { ...@@ -72,6 +77,7 @@ abstract class OneSequenceGestureRecognizer extends GestureRecognizer {
entry.resolve(disposition); entry.resolve(disposition);
} }
@override
void dispose() { void dispose() {
resolve(GestureDisposition.rejected); resolve(GestureDisposition.rejected);
for (int pointer in _trackedPointers) for (int pointer in _trackedPointers)
...@@ -116,6 +122,7 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni ...@@ -116,6 +122,7 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni
Point initialPosition; Point initialPosition;
Timer _timer; Timer _timer;
@override
void addPointer(PointerDownEvent event) { void addPointer(PointerDownEvent event) {
startTrackingPointer(event.pointer); startTrackingPointer(event.pointer);
if (state == GestureRecognizerState.ready) { if (state == GestureRecognizerState.ready) {
...@@ -127,6 +134,7 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni ...@@ -127,6 +134,7 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni
} }
} }
@override
void handleEvent(PointerEvent event) { void handleEvent(PointerEvent event) {
assert(state != GestureRecognizerState.ready); assert(state != GestureRecognizerState.ready);
if (state == GestureRecognizerState.possible && event.pointer == primaryPointer) { if (state == GestureRecognizerState.possible && event.pointer == primaryPointer) {
...@@ -151,6 +159,7 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni ...@@ -151,6 +159,7 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni
assert(deadline == null); assert(deadline == null);
} }
@override
void rejectGesture(int pointer) { void rejectGesture(int pointer) {
if (pointer == primaryPointer) { if (pointer == primaryPointer) {
_stopTimer(); _stopTimer();
...@@ -158,11 +167,13 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni ...@@ -158,11 +167,13 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni
} }
} }
@override
void didStopTrackingLastPointer(int pointer) { void didStopTrackingLastPointer(int pointer) {
_stopTimer(); _stopTimer();
state = GestureRecognizerState.ready; state = GestureRecognizerState.ready;
} }
@override
void dispose() { void dispose() {
_stopTimer(); _stopTimer();
super.dispose(); super.dispose();
......
...@@ -31,6 +31,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -31,6 +31,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
double get _scaleFactor => _initialSpan > 0.0 ? _currentSpan / _initialSpan : 1.0; double get _scaleFactor => _initialSpan > 0.0 ? _currentSpan / _initialSpan : 1.0;
@override
void addPointer(PointerEvent event) { void addPointer(PointerEvent event) {
startTrackingPointer(event.pointer); startTrackingPointer(event.pointer);
if (_state == ScaleState.ready) { if (_state == ScaleState.ready) {
...@@ -41,6 +42,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -41,6 +42,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
} }
} }
@override
void handleEvent(PointerEvent event) { void handleEvent(PointerEvent event) {
assert(_state != ScaleState.ready); assert(_state != ScaleState.ready);
bool configChanged = false; bool configChanged = false;
...@@ -101,6 +103,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -101,6 +103,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
onUpdate(_scaleFactor, focalPoint); onUpdate(_scaleFactor, focalPoint);
} }
@override
void acceptGesture(int pointer) { void acceptGesture(int pointer) {
if (_state != ScaleState.accepted) { if (_state != ScaleState.accepted) {
_state = ScaleState.accepted; _state = ScaleState.accepted;
...@@ -108,6 +111,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -108,6 +111,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
} }
} }
@override
void didStopTrackingLastPointer(int pointer) { void didStopTrackingLastPointer(int pointer) {
switch(_state) { switch(_state) {
case ScaleState.possible: case ScaleState.possible:
...@@ -125,5 +129,6 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -125,5 +129,6 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
_state = ScaleState.ready; _state = ScaleState.ready;
} }
@override
String toStringShort() => 'scale'; String toStringShort() => 'scale';
} }
...@@ -27,6 +27,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -27,6 +27,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
bool _wonArena = false; bool _wonArena = false;
Point _finalPosition; Point _finalPosition;
@override
void handlePrimaryPointer(PointerEvent event) { void handlePrimaryPointer(PointerEvent event) {
if (event is PointerUpEvent) { if (event is PointerUpEvent) {
_finalPosition = event.position; _finalPosition = event.position;
...@@ -34,6 +35,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -34,6 +35,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
} }
} }
@override
void resolve(GestureDisposition disposition) { void resolve(GestureDisposition disposition) {
if (_wonArena && disposition == GestureDisposition.rejected) { if (_wonArena && disposition == GestureDisposition.rejected) {
if (onTapCancel != null) if (onTapCancel != null)
...@@ -43,10 +45,12 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -43,10 +45,12 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
super.resolve(disposition); super.resolve(disposition);
} }
@override
void didExceedDeadline() { void didExceedDeadline() {
_checkDown(); _checkDown();
} }
@override
void acceptGesture(int pointer) { void acceptGesture(int pointer) {
super.acceptGesture(pointer); super.acceptGesture(pointer);
if (pointer == primaryPointer) { if (pointer == primaryPointer) {
...@@ -56,6 +60,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -56,6 +60,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
} }
} }
@override
void rejectGesture(int pointer) { void rejectGesture(int pointer) {
super.rejectGesture(pointer); super.rejectGesture(pointer);
if (pointer == primaryPointer) { if (pointer == primaryPointer) {
...@@ -91,5 +96,6 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -91,5 +96,6 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
_finalPosition = null; _finalPosition = null;
} }
@override
String toStringShort() => 'tap'; String toStringShort() => 'tap';
} }
...@@ -17,6 +17,7 @@ class _Estimate { ...@@ -17,6 +17,7 @@ class _Estimate {
final int degree; final int degree;
final double confidence; final double confidence;
@override
String toString() { String toString() {
return 'Estimate(xCoefficients: $xCoefficients, ' return 'Estimate(xCoefficients: $xCoefficients, '
'yCoefficients: $yCoefficients, ' 'yCoefficients: $yCoefficients, '
...@@ -73,6 +74,7 @@ class _LeastSquaresVelocityTrackerStrategy extends _VelocityTrackerStrategy { ...@@ -73,6 +74,7 @@ class _LeastSquaresVelocityTrackerStrategy extends _VelocityTrackerStrategy {
_WeightChooser _chooseWeight; _WeightChooser _chooseWeight;
int _index; int _index;
@override
void addMovement(Duration timeStamp, Point position) { void addMovement(Duration timeStamp, Point position) {
_index += 1; _index += 1;
if (_index == kHistorySize) if (_index == kHistorySize)
...@@ -82,6 +84,7 @@ class _LeastSquaresVelocityTrackerStrategy extends _VelocityTrackerStrategy { ...@@ -82,6 +84,7 @@ class _LeastSquaresVelocityTrackerStrategy extends _VelocityTrackerStrategy {
movement.position = position; movement.position = position;
} }
@override
_Estimate getEstimate() { _Estimate getEstimate() {
// Iterate over movement samples in reverse time order and collect samples. // Iterate over movement samples in reverse time order and collect samples.
List<double> x = new List<double>(); List<double> x = new List<double>();
...@@ -145,6 +148,7 @@ class _LeastSquaresVelocityTrackerStrategy extends _VelocityTrackerStrategy { ...@@ -145,6 +148,7 @@ class _LeastSquaresVelocityTrackerStrategy extends _VelocityTrackerStrategy {
); );
} }
@override
void clear() { void clear() {
_index = -1; _index = -1;
} }
...@@ -228,6 +232,7 @@ class Velocity { ...@@ -228,6 +232,7 @@ class Velocity {
pixelsPerSecond: pixelsPerSecond + other.pixelsPerSecond); pixelsPerSecond: pixelsPerSecond + other.pixelsPerSecond);
} }
@override
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other is! Velocity) if (other is! Velocity)
return false; return false;
...@@ -235,8 +240,10 @@ class Velocity { ...@@ -235,8 +240,10 @@ class Velocity {
return pixelsPerSecond == typedOther.pixelsPerSecond; return pixelsPerSecond == typedOther.pixelsPerSecond;
} }
@override
int get hashCode => pixelsPerSecond.hashCode; int get hashCode => pixelsPerSecond.hashCode;
@override
String toString() => 'Velocity(${pixelsPerSecond.dx.toStringAsFixed(1)}, ${pixelsPerSecond.dy.toStringAsFixed(1)})'; String toString() => 'Velocity(${pixelsPerSecond.dx.toStringAsFixed(1)}, ${pixelsPerSecond.dy.toStringAsFixed(1)})';
} }
......
...@@ -71,14 +71,17 @@ class MaterialApp extends WidgetsApp { ...@@ -71,14 +71,17 @@ class MaterialApp extends WidgetsApp {
/// Only available in checked mode. /// Only available in checked mode.
final bool debugShowMaterialGrid; final bool debugShowMaterialGrid;
@override
_MaterialAppState createState() => new _MaterialAppState(); _MaterialAppState createState() => new _MaterialAppState();
} }
class _MaterialAppState extends WidgetsAppState<MaterialApp> { class _MaterialAppState extends WidgetsAppState<MaterialApp> {
final HeroController _heroController = new HeroController(); final HeroController _heroController = new HeroController();
@override
NavigatorObserver get navigatorObserver => _heroController; NavigatorObserver get navigatorObserver => _heroController;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ThemeData theme = config.theme ?? new ThemeData.fallback(); ThemeData theme = config.theme ?? new ThemeData.fallback();
Widget result = new AnimatedTheme( Widget result = new AnimatedTheme(
......
...@@ -67,6 +67,7 @@ class AppBar extends StatelessWidget { ...@@ -67,6 +67,7 @@ class AppBar extends StatelessWidget {
); );
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Color color = backgroundColor; Color color = backgroundColor;
IconThemeData iconThemeData; IconThemeData iconThemeData;
......
...@@ -32,6 +32,7 @@ class BottomSheet extends StatefulWidget { ...@@ -32,6 +32,7 @@ class BottomSheet extends StatefulWidget {
final VoidCallback onClosing; final VoidCallback onClosing;
final WidgetBuilder builder; final WidgetBuilder builder;
@override
_BottomSheetState createState() => new _BottomSheetState(); _BottomSheetState createState() => new _BottomSheetState();
static AnimationController createAnimationController() { static AnimationController createAnimationController() {
...@@ -75,6 +76,7 @@ class _BottomSheetState extends State<BottomSheet> { ...@@ -75,6 +76,7 @@ class _BottomSheetState extends State<BottomSheet> {
} }
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new GestureDetector( return new GestureDetector(
onVerticalDragUpdate: _handleDragUpdate, onVerticalDragUpdate: _handleDragUpdate,
...@@ -99,6 +101,7 @@ class _ModalBottomSheetLayout extends SingleChildLayoutDelegate { ...@@ -99,6 +101,7 @@ class _ModalBottomSheetLayout extends SingleChildLayoutDelegate {
final double progress; final double progress;
@override
BoxConstraints getConstraintsForChild(BoxConstraints constraints) { BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
return new BoxConstraints( return new BoxConstraints(
minWidth: constraints.maxWidth, minWidth: constraints.maxWidth,
...@@ -108,10 +111,12 @@ class _ModalBottomSheetLayout extends SingleChildLayoutDelegate { ...@@ -108,10 +111,12 @@ class _ModalBottomSheetLayout extends SingleChildLayoutDelegate {
); );
} }
@override
Offset getPositionForChild(Size size, Size childSize) { Offset getPositionForChild(Size size, Size childSize) {
return new Offset(0.0, size.height - childSize.height * progress); return new Offset(0.0, size.height - childSize.height * progress);
} }
@override
bool shouldRelayout(_ModalBottomSheetLayout oldDelegate) { bool shouldRelayout(_ModalBottomSheetLayout oldDelegate) {
return progress != oldDelegate.progress; return progress != oldDelegate.progress;
} }
...@@ -122,10 +127,12 @@ class _ModalBottomSheet<T> extends StatefulWidget { ...@@ -122,10 +127,12 @@ class _ModalBottomSheet<T> extends StatefulWidget {
final _ModalBottomSheetRoute<T> route; final _ModalBottomSheetRoute<T> route;
@override
_ModalBottomSheetState<T> createState() => new _ModalBottomSheetState<T>(); _ModalBottomSheetState<T> createState() => new _ModalBottomSheetState<T>();
} }
class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new GestureDetector( return new GestureDetector(
onTap: () => Navigator.pop(context), onTap: () => Navigator.pop(context),
...@@ -156,14 +163,21 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> { ...@@ -156,14 +163,21 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
final WidgetBuilder builder; final WidgetBuilder builder;
@override
Duration get transitionDuration => _kBottomSheetDuration; Duration get transitionDuration => _kBottomSheetDuration;
@override
bool get barrierDismissable => true; bool get barrierDismissable => true;
@override
Color get barrierColor => Colors.black54; Color get barrierColor => Colors.black54;
@override
AnimationController createAnimationController() { AnimationController createAnimationController() {
return BottomSheet.createAnimationController(); return BottomSheet.createAnimationController();
} }
@override
Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation) { Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation) {
return new _ModalBottomSheet<T>(route: this); return new _ModalBottomSheet<T>(route: this);
} }
......
...@@ -31,6 +31,7 @@ class ButtonTheme extends InheritedWidget { ...@@ -31,6 +31,7 @@ class ButtonTheme extends InheritedWidget {
return result?.color ?? ButtonColor.normal; return result?.color ?? ButtonColor.normal;
} }
@override
bool updateShouldNotify(ButtonTheme old) => color != old.color; bool updateShouldNotify(ButtonTheme old) => color != old.color;
} }
...@@ -63,6 +64,7 @@ abstract class MaterialButton extends StatefulWidget { ...@@ -63,6 +64,7 @@ abstract class MaterialButton extends StatefulWidget {
/// enable a button, set its [onPressed] property to a non-null value. /// enable a button, set its [onPressed] property to a non-null value.
bool get enabled => onPressed != null; bool get enabled => onPressed != null;
@override
void debugFillDescription(List<String> description) { void debugFillDescription(List<String> description) {
super.debugFillDescription(description); super.debugFillDescription(description);
if (!enabled) if (!enabled)
...@@ -110,6 +112,7 @@ abstract class MaterialButtonState<T extends MaterialButton> extends State<T> { ...@@ -110,6 +112,7 @@ abstract class MaterialButtonState<T extends MaterialButton> extends State<T> {
}); });
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterial(context));
Widget contents = new InkWell( Widget contents = new InkWell(
......
...@@ -17,6 +17,7 @@ class Card extends StatelessWidget { ...@@ -17,6 +17,7 @@ class Card extends StatelessWidget {
final Widget child; final Widget child;
final Color color; final Color color;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
margin: _kCardMargins, margin: _kCardMargins,
......
...@@ -37,6 +37,7 @@ class Checkbox extends StatelessWidget { ...@@ -37,6 +37,7 @@ class Checkbox extends StatelessWidget {
final Color activeColor; final Color activeColor;
final ValueChanged<bool> onChanged; final ValueChanged<bool> onChanged;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterial(context));
ThemeData themeData = Theme.of(context); ThemeData themeData = Theme.of(context);
...@@ -67,6 +68,7 @@ class _CheckboxRenderObjectWidget extends LeafRenderObjectWidget { ...@@ -67,6 +68,7 @@ class _CheckboxRenderObjectWidget extends LeafRenderObjectWidget {
final Color inactiveColor; final Color inactiveColor;
final ValueChanged<bool> onChanged; final ValueChanged<bool> onChanged;
@override
_RenderCheckbox createRenderObject(BuildContext context) => new _RenderCheckbox( _RenderCheckbox createRenderObject(BuildContext context) => new _RenderCheckbox(
value: value, value: value,
activeColor: activeColor, activeColor: activeColor,
...@@ -74,6 +76,7 @@ class _CheckboxRenderObjectWidget extends LeafRenderObjectWidget { ...@@ -74,6 +76,7 @@ class _CheckboxRenderObjectWidget extends LeafRenderObjectWidget {
onChanged: onChanged onChanged: onChanged
); );
@override
void updateRenderObject(BuildContext context, _RenderCheckbox renderObject) { void updateRenderObject(BuildContext context, _RenderCheckbox renderObject) {
renderObject renderObject
..value = value ..value = value
...@@ -103,6 +106,7 @@ class _RenderCheckbox extends RenderToggleable { ...@@ -103,6 +106,7 @@ class _RenderCheckbox extends RenderToggleable {
size: const Size(2 * kRadialReactionRadius, 2 * kRadialReactionRadius) size: const Size(2 * kRadialReactionRadius, 2 * kRadialReactionRadius)
); );
@override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
final Canvas canvas = context.canvas; final Canvas canvas = context.canvas;
final double offsetX = _kOffset + offset.dx; final double offsetX = _kOffset + offset.dx;
......
...@@ -33,6 +33,7 @@ class Chip extends StatelessWidget { ...@@ -33,6 +33,7 @@ class Chip extends StatelessWidget {
final Widget label; final Widget label;
final VoidCallback onDeleted; final VoidCallback onDeleted;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterial(context));
final bool deletable = onDeleted != null; final bool deletable = onDeleted != null;
......
...@@ -19,6 +19,7 @@ class CircleAvatar extends StatelessWidget { ...@@ -19,6 +19,7 @@ class CircleAvatar extends StatelessWidget {
final Color backgroundColor; final Color backgroundColor;
final double radius; final double radius;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
final Color color = backgroundColor ?? theme.primaryColor; final Color color = backgroundColor ?? theme.primaryColor;
......
...@@ -34,6 +34,7 @@ class DatePicker extends StatefulWidget { ...@@ -34,6 +34,7 @@ class DatePicker extends StatefulWidget {
final DateTime firstDate; final DateTime firstDate;
final DateTime lastDate; final DateTime lastDate;
@override
_DatePickerState createState() => new _DatePickerState(); _DatePickerState createState() => new _DatePickerState();
} }
...@@ -64,6 +65,7 @@ class _DatePickerState extends State<DatePicker> { ...@@ -64,6 +65,7 @@ class _DatePickerState extends State<DatePicker> {
static const double _calendarHeight = 210.0; static const double _calendarHeight = 210.0;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget header = new _DatePickerHeader( Widget header = new _DatePickerHeader(
selectedDate: config.selectedDate, selectedDate: config.selectedDate,
...@@ -120,6 +122,7 @@ class _DatePickerHeader extends StatelessWidget { ...@@ -120,6 +122,7 @@ class _DatePickerHeader extends StatelessWidget {
onModeChanged(value); onModeChanged(value);
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ThemeData theme = Theme.of(context); ThemeData theme = Theme.of(context);
TextTheme headerTheme = theme.primaryTextTheme; TextTheme headerTheme = theme.primaryTextTheme;
...@@ -181,6 +184,7 @@ class DayPicker extends StatelessWidget { ...@@ -181,6 +184,7 @@ class DayPicker extends StatelessWidget {
final ValueChanged<DateTime> onChanged; final ValueChanged<DateTime> onChanged;
final DateTime displayedMonth; final DateTime displayedMonth;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ThemeData themeData = Theme.of(context); ThemeData themeData = Theme.of(context);
TextStyle headerStyle = themeData.textTheme.caption.copyWith(fontWeight: FontWeight.w700); TextStyle headerStyle = themeData.textTheme.caption.copyWith(fontWeight: FontWeight.w700);
...@@ -289,10 +293,12 @@ class MonthPicker extends StatefulWidget { ...@@ -289,10 +293,12 @@ class MonthPicker extends StatefulWidget {
final DateTime lastDate; final DateTime lastDate;
final double itemExtent; final double itemExtent;
@override
_MonthPickerState createState() => new _MonthPickerState(); _MonthPickerState createState() => new _MonthPickerState();
} }
class _MonthPickerState extends State<MonthPicker> { class _MonthPickerState extends State<MonthPicker> {
@override
void initState() { void initState() {
super.initState(); super.initState();
_updateCurrentDate(); _updateCurrentDate();
...@@ -335,6 +341,7 @@ class _MonthPickerState extends State<MonthPicker> { ...@@ -335,6 +341,7 @@ class _MonthPickerState extends State<MonthPicker> {
return result; return result;
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new ScrollableLazyList( return new ScrollableLazyList(
itemExtent: config.itemExtent, itemExtent: config.itemExtent,
...@@ -343,6 +350,7 @@ class _MonthPickerState extends State<MonthPicker> { ...@@ -343,6 +350,7 @@ class _MonthPickerState extends State<MonthPicker> {
); );
} }
@override
void dispose() { void dispose() {
if (_timer != null) if (_timer != null)
_timer.cancel(); _timer.cancel();
...@@ -369,6 +377,7 @@ class YearPicker extends StatefulWidget { ...@@ -369,6 +377,7 @@ class YearPicker extends StatefulWidget {
final DateTime firstDate; final DateTime firstDate;
final DateTime lastDate; final DateTime lastDate;
@override
_YearPickerState createState() => new _YearPickerState(); _YearPickerState createState() => new _YearPickerState();
} }
...@@ -403,6 +412,7 @@ class _YearPickerState extends State<YearPicker> { ...@@ -403,6 +412,7 @@ class _YearPickerState extends State<YearPicker> {
return items; return items;
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterial(context));
return new ScrollableLazyList( return new ScrollableLazyList(
......
...@@ -22,10 +22,12 @@ class _DatePickerDialog extends StatefulWidget { ...@@ -22,10 +22,12 @@ class _DatePickerDialog extends StatefulWidget {
final DateTime firstDate; final DateTime firstDate;
final DateTime lastDate; final DateTime lastDate;
@override
_DatePickerDialogState createState() => new _DatePickerDialogState(); _DatePickerDialogState createState() => new _DatePickerDialogState();
} }
class _DatePickerDialogState extends State<_DatePickerDialog> { class _DatePickerDialogState extends State<_DatePickerDialog> {
@override
void initState() { void initState() {
super.initState(); super.initState();
_selectedDate = config.initialDate; _selectedDate = config.initialDate;
...@@ -47,6 +49,7 @@ class _DatePickerDialogState extends State<_DatePickerDialog> { ...@@ -47,6 +49,7 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
Navigator.pop(context, _selectedDate); Navigator.pop(context, _selectedDate);
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Dialog( return new Dialog(
content: new DatePicker( content: new DatePicker(
......
...@@ -54,6 +54,7 @@ class Dialog extends StatelessWidget { ...@@ -54,6 +54,7 @@ class Dialog extends StatelessWidget {
} }
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> dialogBody = new List<Widget>(); List<Widget> dialogBody = new List<Widget>();
...@@ -123,14 +124,21 @@ class _DialogRoute<T> extends PopupRoute<T> { ...@@ -123,14 +124,21 @@ class _DialogRoute<T> extends PopupRoute<T> {
final Widget child; final Widget child;
@override
Duration get transitionDuration => const Duration(milliseconds: 150); Duration get transitionDuration => const Duration(milliseconds: 150);
@override
bool get barrierDismissable => true; bool get barrierDismissable => true;
@override
Color get barrierColor => Colors.black54; Color get barrierColor => Colors.black54;
@override
Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation) { Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation) {
return child; return child;
} }
@override
Widget buildTransitions(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation, Widget child) { Widget buildTransitions(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation, Widget child) {
return new FadeTransition( return new FadeTransition(
opacity: new CurvedAnimation( opacity: new CurvedAnimation(
......
...@@ -15,6 +15,7 @@ class Divider extends StatelessWidget { ...@@ -15,6 +15,7 @@ class Divider extends StatelessWidget {
final double indent; final double indent;
final Color color; final Color color;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final double bottom = (height ~/ 2.0).toDouble(); final double bottom = (height ~/ 2.0).toDouble();
return new Container( return new Container(
......
...@@ -36,6 +36,7 @@ class Drawer extends StatelessWidget { ...@@ -36,6 +36,7 @@ class Drawer extends StatelessWidget {
final int elevation; final int elevation;
final Widget child; final Widget child;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new ConstrainedBox( return new ConstrainedBox(
constraints: const BoxConstraints.expand(width: _kWidth), constraints: const BoxConstraints.expand(width: _kWidth),
...@@ -55,10 +56,12 @@ class DrawerController extends StatefulWidget { ...@@ -55,10 +56,12 @@ class DrawerController extends StatefulWidget {
final Widget child; final Widget child;
@override
DrawerControllerState createState() => new DrawerControllerState(); DrawerControllerState createState() => new DrawerControllerState();
} }
class DrawerControllerState extends State<DrawerController> { class DrawerControllerState extends State<DrawerController> {
@override
void initState() { void initState() {
super.initState(); super.initState();
_controller = new AnimationController(duration: _kBaseSettleDuration) _controller = new AnimationController(duration: _kBaseSettleDuration)
...@@ -66,6 +69,7 @@ class DrawerControllerState extends State<DrawerController> { ...@@ -66,6 +69,7 @@ class DrawerControllerState extends State<DrawerController> {
..addStatusListener(_animationStatusChanged); ..addStatusListener(_animationStatusChanged);
} }
@override
void dispose() { void dispose() {
_controller _controller
..removeListener(_animationChanged) ..removeListener(_animationChanged)
...@@ -158,6 +162,7 @@ class DrawerControllerState extends State<DrawerController> { ...@@ -158,6 +162,7 @@ class DrawerControllerState extends State<DrawerController> {
final ColorTween _color = new ColorTween(begin: Colors.transparent, end: Colors.black54); final ColorTween _color = new ColorTween(begin: Colors.transparent, end: Colors.black54);
final GlobalKey _gestureDetectorKey = new GlobalKey(); final GlobalKey _gestureDetectorKey = new GlobalKey();
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (_controller.status == AnimationStatus.dismissed) { if (_controller.status == AnimationStatus.dismissed) {
return new Align( return new Align(
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment