Add @override annotations to flutter framework

This commit is contained in:
Hixie
2016-03-14 13:31:43 -07:00
parent 9bc6d281fe
commit 797e27edd3
322 changed files with 2544 additions and 9 deletions

View File

@@ -45,6 +45,7 @@ class _ButtonDemo {
// to recover this demo's selected tab. To enable it to compare restored
// _ButtonDemo objects with new ones, define hashCode and operator== .
@override
bool operator==(Object other) {
if (other.runtimeType != runtimeType)
return false;
@@ -52,16 +53,19 @@ class _ButtonDemo {
return typedOther.title == title && typedOther.text == text;
}
@override
int get hashCode => hashValues(title.hashCode, text.hashCode);
}
class ButtonsDemo extends StatefulWidget {
@override
_ButtonsDemoState createState() => new _ButtonsDemoState();
}
class _ButtonsDemoState extends State<ButtonsDemo> {
List<_ButtonDemo> demos;
@override
void initState() {
super.initState();
demos = <_ButtonDemo>[
@@ -192,6 +196,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
);
}
@override
Widget build(BuildContext context) {
return new TabBarSelection<_ButtonDemo>(
values: demos,

View File

@@ -43,6 +43,7 @@ class TravelDestinationItem extends StatelessWidget {
final TravelDestination destination;
@override
Widget build(BuildContext context) {
ThemeData theme = Theme.of(context);
TextStyle titleStyle = theme.textTheme.headline.copyWith(color: Colors.white);
@@ -115,6 +116,7 @@ class TravelDestinationItem extends StatelessWidget {
}
class CardsDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(

View File

@@ -5,6 +5,7 @@
import 'package:flutter/material.dart';
class ChipDemo extends StatefulWidget {
@override
_ChipDemoState createState() => new _ChipDemoState();
}
@@ -17,6 +18,7 @@ class _ChipDemoState extends State<ChipDemo> {
});
}
@override
Widget build(BuildContext context) {
List<Widget> chips = <Widget>[
new Chip(

View File

@@ -54,6 +54,7 @@ class ColorItem extends StatelessWidget {
String colorString() => "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}";
@override
Widget build(BuildContext context) {
return new Container(
height: kColorItemHeight,
@@ -80,6 +81,7 @@ class ColorSwatchTabView extends StatelessWidget {
final TextStyle blackTextStyle = Typography.black.body1;
final TextStyle whiteTextStyle = Typography.white.body1;
@override
Widget build(BuildContext context) {
List<Widget> colorItems = swatch.colors.keys.map((int index) {
return new DefaultTextStyle(
@@ -107,6 +109,7 @@ class ColorSwatchTabView extends StatelessWidget {
}
class ColorsDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new TabBarSelection<ColorSwatch>(
values: colorSwatches,

View File

@@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class DatePickerDemo extends StatefulWidget {
@override
_DatePickerDemoState createState() => new _DatePickerDemoState();
}
@@ -28,6 +29,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
}
}
@override
Widget build(BuildContext context) {
return
new Scaffold(

View File

@@ -28,6 +28,7 @@ class DialogDemoItem extends StatelessWidget {
final String text;
final VoidCallback onPressed;
@override
Widget build(BuildContext context) {
return new InkWell(
onTap: onPressed,
@@ -54,6 +55,7 @@ class DialogDemoItem extends StatelessWidget {
}
class DialogDemo extends StatefulWidget {
@override
DialogDemoState createState() => new DialogDemoState();
}
@@ -74,6 +76,7 @@ class DialogDemoState extends State<DialogDemo> {
});
}
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);

View File

@@ -5,6 +5,7 @@
import 'package:flutter/material.dart';
class DropDownDemo extends StatefulWidget {
@override
_DropDownDemoState createState() => new _DropDownDemoState();
}
@@ -18,6 +19,7 @@ class _DropDownDemoState extends State<DropDownDemo> {
.toList();
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text("Dropdown Button")),

View File

@@ -16,6 +16,7 @@ SpriteSheet _sprites;
class FitnessDemo extends StatelessWidget {
FitnessDemo({ Key key }) : super(key: key);
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
@@ -28,6 +29,8 @@ class FitnessDemo extends StatelessWidget {
class _FitnessDemoContents extends StatefulWidget {
_FitnessDemoContents({ Key key }) : super(key: key);
@override
_FitnessDemoContentsState createState() => new _FitnessDemoContentsState();
}
@@ -43,6 +46,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
_sprites = new SpriteSheet(_images['packages/flutter_gallery_assets/jumpingjack.png'], json);
}
@override
void initState() {
super.initState();
@@ -73,6 +77,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
_WorkoutAnimationNode workoutAnimation;
@override
Widget build(BuildContext context) {
if (!assetsLoaded)
return new Container();
@@ -248,6 +253,7 @@ class _WorkoutAnimationNode extends NodeWithSize {
_jumpingJack.neutralPose();
}
@override
void update(double dt) {
if (workingOut) {
int millis = new DateTime.now().millisecondsSinceEpoch - _startTimeMillis;
@@ -273,6 +279,7 @@ class _ProgressCircle extends NodeWithSize {
double value;
@override
void paint(Canvas canvas) {
applyTransformForPivot(canvas);
@@ -513,10 +520,12 @@ class _JumpingJackPart extends Sprite {
class _Fireworks extends StatefulWidget {
_Fireworks({ Key key }) : super(key: key);
@override
_FireworksState createState() => new _FireworksState();
}
class _FireworksState extends State<_Fireworks> {
@override
void initState() {
super.initState();
fireworks = new _FireworksNode();
@@ -524,6 +533,7 @@ class _FireworksState extends State<_Fireworks> {
_FireworksNode fireworks;
@override
Widget build(BuildContext context) {
return new SpriteWidget(fireworks);
}
@@ -533,6 +543,7 @@ class _FireworksNode extends NodeWithSize {
_FireworksNode() : super(const Size(1024.0, 1024.0));
double _countDown = 0.0;
@override
void update(double dt) {
if (_countDown <= 0.0) {
_addExplosion();

View File

@@ -11,6 +11,7 @@ class _ContactCategory extends StatelessWidget {
final IconData icon;
final List<Widget> children;
@override
Widget build(BuildContext context) {
return new Container(
padding: const EdgeInsets.symmetric(vertical: 16.0),
@@ -41,6 +42,7 @@ class _ContactItem extends StatelessWidget {
final IconData icon;
final List<String> lines;
@override
Widget build(BuildContext context) {
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));
@@ -68,6 +70,7 @@ class _ContactItem extends StatelessWidget {
}
class FlexibleSpaceDemo extends StatefulWidget {
@override
FlexibleSpaceDemoState createState() => new FlexibleSpaceDemoState();
}
@@ -77,6 +80,7 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
final Key scrollableKey = new UniqueKey();
AppBarBehavior _appBarBehavior = AppBarBehavior.scroll;
@override
Widget build(BuildContext context) {
return new Theme(
data: new ThemeData(

View File

@@ -27,6 +27,7 @@ class DateTimeItem extends StatelessWidget {
final TimeOfDay time;
final ValueChanged<DateTime> onChanged;
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
@@ -93,6 +94,7 @@ class DateTimeItem extends StatelessWidget {
}
class FullScreenDialogDemo extends StatefulWidget {
@override
FullScreenDialogDemoState createState() => new FullScreenDialogDemoState();
}
@@ -137,6 +139,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
);
}
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);

View File

@@ -55,6 +55,7 @@ class GridDemoPhotoItem extends StatelessWidget {
));
}
@override
Widget build(BuildContext context) {
final Widget image = new GestureDetector(
onTap: () { showPhoto(context); },
@@ -104,9 +105,12 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate {
assert(tileHeightFactor != null && tileHeightFactor > 0.0);
}
@override
final int columnCount;
final double tileHeightFactor;
@override
GridSpecification getGridSpecification(BoxConstraints constraints, int childCount) {
assert(constraints.maxWidth < double.INFINITY);
assert(constraints.maxHeight < double.INFINITY);
@@ -121,6 +125,7 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate {
);
}
@override
bool shouldRelayout(GridListDemoGridDelegate oldDelegate) {
return columnCount != oldDelegate.columnCount
|| tileHeightFactor != oldDelegate.tileHeightFactor
@@ -131,6 +136,7 @@ class GridListDemoGridDelegate extends FixedColumnCountGridDelegate {
class GridListDemo extends StatefulWidget {
GridListDemo({ Key key }) : super(key: key);
@override
GridListDemoState createState() => new GridListDemoState();
}
@@ -169,6 +175,7 @@ class GridListDemoState extends State<GridListDemo> {
// 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.
// The GridListDemoGridDelegate's tileHeightFactor is used for this.
@override
Widget build(BuildContext context) {
final Orientation orientation = MediaQuery.of(context).orientation;
return new Scaffold(

View File

@@ -5,6 +5,7 @@
import 'package:flutter/material.dart';
class IconsDemo extends StatefulWidget {
@override
IconsDemoState createState() => new IconsDemoState();
}
@@ -61,6 +62,7 @@ class IconsDemoState extends State<IconsDemo> {
);
}
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final TextStyle textStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);

View File

@@ -28,6 +28,7 @@ class LeaveBehindItem {
class LeaveBehindDemo extends StatefulWidget {
LeaveBehindDemo({ Key key }) : super(key: key);
@override
LeaveBehindDemoState createState() => new LeaveBehindDemoState();
}
@@ -47,6 +48,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
});
}
@override
void initState() {
super.initState();
initListItems();
@@ -122,6 +124,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
);
}
@override
Widget build(BuildContext context) {
return new Scaffold(
key: _scaffoldKey,

View File

@@ -13,6 +13,7 @@ enum ListDemoItemSize {
class ListDemo extends StatefulWidget {
ListDemo({ Key key }) : super(key: key);
@override
ListDemoState createState() => new ListDemoState();
}
@@ -153,6 +154,7 @@ class ListDemoState extends State<ListDemo> {
);
}
@override
Widget build(BuildContext context) {
final String layoutText = _dense ? " \u2013 Dense" : "";
String itemSizeText;

View File

@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
class MenuDemo extends StatefulWidget {
MenuDemo({ Key key }) : super(key: key);
@override
MenuDemoState createState() => new MenuDemoState();
}
@@ -24,6 +25,7 @@ class MenuDemoState extends State<MenuDemo> {
final String _checkedValue4 = 'Four';
List<String> _checkedValues;
@override
void initState() {
super.initState();
_simpleValue = _simpleValue2;
@@ -53,6 +55,7 @@ class MenuDemoState extends State<MenuDemo> {
bool isChecked(String value) => _checkedValues.contains(value);
@override
Widget build(BuildContext context) {
return new Scaffold(
key: _scaffoldKey,

View File

@@ -11,6 +11,7 @@ class ModalBottomSheetDemo extends StatelessWidget {
textAlign: TextAlign.center
);
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text("Modal Bottom Sheet")),

View File

@@ -12,6 +12,7 @@ class PageSelectorDemo extends StatelessWidget {
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.
final List<IconData> icons = <IconData>[
Icons.event,

View File

@@ -26,6 +26,7 @@ class PersistentBottomSheetDemo extends StatelessWidget {
});
}
@override
Widget build(BuildContext notUsed) { // Can't find the Scaffold from this context.
return new Scaffold(
appBar: new AppBar(title: new Text("Persistent Bottom Sheet")),

View File

@@ -5,11 +5,13 @@
import 'package:flutter/material.dart';
class ProgressIndicatorDemo extends StatefulWidget {
@override
_ProgressIndicatorDemoState createState() => new _ProgressIndicatorDemoState();
}
class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
@override
void initState() {
super.initState();
controller = new AnimationController(
@@ -81,6 +83,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
);
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text('Progress Indicators')),

View File

@@ -19,6 +19,7 @@ class _BarGraphic extends StatelessWidget {
final String leftText;
final String rightText;
@override
Widget build(BuildContext context) {
return new Container(
height: height,
@@ -85,6 +86,7 @@ class _TechniqueItem extends StatelessWidget {
Navigator.push(context, new MaterialPageRoute<Null>(builder: builder));
}
@override
Widget build(BuildContext context) {
return new Card(
child: new InkWell(
@@ -111,6 +113,7 @@ const String _introText =
"specified it is stacked on top of the ToolBar.";
class ScrollingTechniquesDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text('Scrolling Techniques')),

View File

@@ -5,12 +5,14 @@
import 'package:flutter/material.dart';
class SliderDemo extends StatefulWidget {
@override
_SliderDemoState createState() => new _SliderDemoState();
}
class _SliderDemoState extends State<SliderDemo> {
double _value = 25.0;
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text("Sliders")),

View File

@@ -56,6 +56,7 @@ class SnackBarDemo extends StatelessWidget {
);
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(

View File

@@ -23,6 +23,7 @@ class TabsDemo extends StatelessWidget {
Icons.language: 'LANGUAGE',
};
@override
Widget build(BuildContext context) {
final Color iconColor = Theme.of(context).accentColor;
return new TabBarSelection<IconData>(

View File

@@ -26,6 +26,7 @@ const String _explanatoryText =
"by its key.";
class TabsFabDemo extends StatefulWidget {
@override
_TabsFabDemoState createState() => new _TabsFabDemoState();
}
@@ -41,6 +42,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> {
];
_Page selectedPage;
@override
void initState() {
super.initState();
selectedPage = pages[0];
@@ -88,6 +90,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> {
);
}
@override
Widget build(BuildContext context) {
return new TabBarSelection<_Page>(
values: pages,

View File

@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
class TextFieldDemo extends StatefulWidget {
TextFieldDemo({ Key key }) : super(key: key);
@override
TextFieldDemoState createState() => new TextFieldDemoState();
}
@@ -59,6 +60,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
return null;
}
@override
Widget build(BuildContext context) {
return new Scaffold(
key: _scaffoldKey,

View File

@@ -7,6 +7,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
class TimePickerDemo extends StatefulWidget {
@override
_TimePickerDemoState createState() => new _TimePickerDemoState();
}
@@ -25,6 +26,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
}
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text("Time Picker")),

View File

@@ -5,6 +5,7 @@
import 'package:flutter/material.dart';
class ToggleControlsDemo extends StatefulWidget {
@override
_ToggleControlsDemoState createState() => new _ToggleControlsDemoState();
}
@@ -31,6 +32,7 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text("Selection Controls")),

View File

@@ -10,6 +10,7 @@ const String _introText =
"apps accessible, like screen readers.";
class TooltipDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
return new Scaffold(

View File

@@ -5,6 +5,7 @@
import 'package:flutter/material.dart';
class TwoLevelListDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text('Expand/Collapse List Control')),

View File

@@ -16,6 +16,7 @@ class TextStyleItem extends StatelessWidget {
final TextStyle style;
final String text;
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final TextStyle nameStyle = theme.textTheme.body1.copyWith(color: theme.textTheme.caption.color);
@@ -38,6 +39,7 @@ class TextStyleItem extends StatelessWidget {
}
class TypographyDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
final TextTheme textTheme = Theme.of(context).textTheme;
final List<Widget> styleItems = <Widget>[

View File

@@ -19,6 +19,8 @@ enum WeatherType {
class WeatherDemo extends StatefulWidget {
WeatherDemo({ Key key }) : super(key: key);
@override
_WeatherDemoState createState() => new _WeatherDemoState();
}
@@ -42,6 +44,7 @@ class _WeatherDemoState extends State<WeatherDemo> {
_sprites = new SpriteSheet(_images['packages/flutter_gallery_assets/weathersprites.png'], json);
}
@override
void initState() {
super.initState();
@@ -58,6 +61,7 @@ class _WeatherDemoState extends State<WeatherDemo> {
WeatherWorld weatherWorld;
@override
Widget build(BuildContext context) {
if (!assetsLoaded) {
return new Scaffold(
@@ -132,6 +136,7 @@ class WeatherButton extends StatelessWidget {
final bool selected;
final VoidCallback onPressed;
@override
Widget build(BuildContext context) {
Color color;
if (selected)
@@ -262,6 +267,7 @@ class WeatherWorld extends NodeWithSize {
_snow.active = weatherType == WeatherType.snow;
}
@override
void spriteBoxPerformedLayout() {
_sun.position = spriteBox.visibleArea.topLeft + const Offset(350.0, 180.0);
}
@@ -273,6 +279,7 @@ class GradientNode extends NodeWithSize {
Color colorTop;
Color colorBottom;
@override
void paint(Canvas canvas) {
applyTransformForPivot(canvas);
@@ -426,6 +433,7 @@ class Ray extends Sprite {
));
}
@override
void update(double dt) {
rotation += dt * _rotationSpeed;
}

View File

@@ -11,6 +11,7 @@ class GalleryApp extends StatefulWidget {
static GalleryAppState of(BuildContext context) => context.ancestorStateOfType(const TypeMatcher<GalleryAppState>());
@override
GalleryAppState createState() => new GalleryAppState();
}
@@ -23,6 +24,7 @@ class GalleryAppState extends State<GalleryApp> {
});
}
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Material Gallery',

View File

@@ -21,6 +21,7 @@ class GalleryDrawer extends StatelessWidget {
});
}
@override
Widget build(BuildContext context) {
return new Drawer(
child: new Block(

View File

@@ -42,10 +42,12 @@ import '../demo/weather_demo.dart';
class GalleryHome extends StatefulWidget {
GalleryHome({ Key key }) : super(key: key);
@override
GalleryHomeState createState() => new GalleryHomeState();
}
class GalleryHomeState extends State<GalleryHome> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBarHeight: 128.0,

View File

@@ -61,6 +61,7 @@ class GallerySection extends StatelessWidget {
));
}
@override
Widget build (BuildContext context) {
final ThemeData theme = new ThemeData(
brightness: Theme.of(context).brightness,