forked from firka/flutter
Add @override annotations to flutter framework
This commit is contained in:
@@ -13,6 +13,7 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate {
|
||||
AutoLayoutRect p3 = new AutoLayoutRect();
|
||||
AutoLayoutRect p4 = new AutoLayoutRect();
|
||||
|
||||
@override
|
||||
List<al.Constraint> getConstraints(AutoLayoutRect parent) {
|
||||
return <al.Constraint>[
|
||||
// Sum of widths of each box must be equal to that of the container
|
||||
@@ -43,16 +44,19 @@ class _MyAutoLayoutDelegate extends AutoLayoutDelegate {
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldUpdateConstraints(_MyAutoLayoutDelegate oldDelegate) => true;
|
||||
}
|
||||
|
||||
class ColoredBoxes extends StatefulWidget {
|
||||
@override
|
||||
_ColoredBoxesState createState() => new _ColoredBoxesState();
|
||||
}
|
||||
|
||||
class _ColoredBoxesState extends State<ColoredBoxes> {
|
||||
final _MyAutoLayoutDelegate delegate = new _MyAutoLayoutDelegate();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new AutoLayout(
|
||||
delegate: delegate,
|
||||
|
||||
@@ -9,10 +9,12 @@ class RenderDots extends RenderConstrainedBox {
|
||||
RenderDots() : super(additionalConstraints: const BoxConstraints.expand());
|
||||
|
||||
// Makes this render box hittable so that we'll get pointer events.
|
||||
@override
|
||||
bool hitTestSelf(Point position) => true;
|
||||
|
||||
final Map<int, Point> _dots = <int, Point>{};
|
||||
|
||||
@override
|
||||
void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
|
||||
if (event is PointerDownEvent || event is PointerMoveEvent) {
|
||||
_dots[event.pointer] = event.position;
|
||||
@@ -23,6 +25,7 @@ class RenderDots extends RenderConstrainedBox {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
final Canvas canvas = context.canvas;
|
||||
canvas.drawRect(offset & size, new Paint()..color = new Color(0xFF0000FF));
|
||||
@@ -37,6 +40,8 @@ class RenderDots extends RenderConstrainedBox {
|
||||
|
||||
class Dots extends SingleChildRenderObjectWidget {
|
||||
Dots({ Key key, Widget child }) : super(key: key, child: child);
|
||||
|
||||
@override
|
||||
RenderDots createRenderObject(BuildContext context) => new RenderDots();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ class _GesturePainter extends CustomPainter {
|
||||
final bool doubleTapEnabled;
|
||||
final bool longPressEnabled;
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
Point center = (size.center(Point.origin).toOffset() * zoom + offset).toPoint();
|
||||
double radius = size.width / 2.0 * zoom;
|
||||
@@ -42,6 +43,7 @@ class _GesturePainter extends CustomPainter {
|
||||
canvas.drawCircle(center, radius, paint);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(_GesturePainter oldPainter) {
|
||||
return oldPainter.zoom != zoom
|
||||
|| oldPainter.offset != offset
|
||||
@@ -55,6 +57,7 @@ class _GesturePainter extends CustomPainter {
|
||||
}
|
||||
|
||||
class GestureDemo extends StatefulWidget {
|
||||
@override
|
||||
_GestureDemoState createState() => new _GestureDemoState();
|
||||
}
|
||||
|
||||
@@ -134,6 +137,7 @@ class _GestureDemoState extends State<GestureDemo> {
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Stack(
|
||||
children: <Widget>[
|
||||
|
||||
@@ -9,6 +9,7 @@ class AdaptedListItem extends StatelessWidget {
|
||||
|
||||
final String name;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Row(
|
||||
children: <Widget>[
|
||||
@@ -31,6 +32,7 @@ class AdaptedGridItem extends StatelessWidget {
|
||||
|
||||
final String name;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Card(
|
||||
child: new Column(
|
||||
@@ -70,6 +72,7 @@ class AdaptiveContainer extends StatelessWidget {
|
||||
|
||||
final List<String> names;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (MediaQuery.of(context).size.width < _kGridViewBreakpoint) {
|
||||
return new ScrollableList(
|
||||
|
||||
@@ -17,6 +17,7 @@ RenderBox initCircle() {
|
||||
}
|
||||
|
||||
class SectorApp extends StatefulWidget {
|
||||
@override
|
||||
SectorAppState createState() => new SectorAppState();
|
||||
}
|
||||
|
||||
@@ -147,6 +148,7 @@ class SectorAppState extends State<SectorApp> {
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new MaterialApp(
|
||||
theme: new ThemeData.light(),
|
||||
|
||||
@@ -18,7 +18,10 @@ void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex
|
||||
// Solid colour, Widget version
|
||||
class Rectangle extends StatelessWidget {
|
||||
Rectangle(this.color, { Key key }) : super(key: key);
|
||||
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Flexible(
|
||||
child: new Container(
|
||||
|
||||
@@ -5,12 +5,14 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class SpinningSquare extends StatefulWidget {
|
||||
@override
|
||||
_SpinningSquareState createState() => new _SpinningSquareState();
|
||||
}
|
||||
|
||||
class _SpinningSquareState extends State<SpinningSquare> {
|
||||
AnimationController _animation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0
|
||||
@@ -21,6 +23,7 @@ class _SpinningSquareState extends State<SpinningSquare> {
|
||||
)..repeat();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new RotationTransition(
|
||||
turns: _animation,
|
||||
|
||||
@@ -58,6 +58,7 @@ Widget toStyledText(String name, String text) {
|
||||
Widget toPlainText(String name, String text) => new Text(name + ":" + text);
|
||||
|
||||
class SpeakerSeparator extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
constraints: const BoxConstraints.expand(height: 0.0),
|
||||
@@ -72,10 +73,12 @@ class SpeakerSeparator extends StatelessWidget {
|
||||
}
|
||||
|
||||
class StyledTextDemo extends StatefulWidget {
|
||||
@override
|
||||
_StyledTextDemoState createState() => new _StyledTextDemoState();
|
||||
}
|
||||
|
||||
class _StyledTextDemoState extends State<StyledTextDemo> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_toText = toStyledText;
|
||||
@@ -89,6 +92,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Widget> lines = _kNameLines
|
||||
.map((List<String> nameAndText) => Function.apply(_toText, nameAndText))
|
||||
|
||||
Reference in New Issue
Block a user