Commit 3eb87830 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Constants! Constants everywhere! (#9286)

Aggressively apply the const lint.
parent 54bbb6fb
...@@ -14,7 +14,7 @@ class TestTestBinding extends AutomatedTestWidgetsFlutterBinding { ...@@ -14,7 +14,7 @@ class TestTestBinding extends AutomatedTestWidgetsFlutterBinding {
Future<Null> guardedHelper(WidgetTester tester) { Future<Null> guardedHelper(WidgetTester tester) {
return TestAsyncUtils.guard(() async { return TestAsyncUtils.guard(() async {
await tester.pumpWidget(new Text('Hello')); await tester.pumpWidget(const Text('Hello'));
}); });
} }
......
...@@ -57,7 +57,7 @@ class ComplexLayoutState extends State<ComplexLayout> { ...@@ -57,7 +57,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Advanced Layout'), title: const Text('Advanced Layout'),
actions: <Widget>[ actions: <Widget>[
new IconButton( new IconButton(
icon: new Icon(Icons.create), icon: new Icon(Icons.create),
...@@ -356,9 +356,9 @@ class UserHeader extends StatelessWidget { ...@@ -356,9 +356,9 @@ class UserHeader extends StatelessWidget {
class ItemDescription extends StatelessWidget { class ItemDescription extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Padding( return const Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.') child: const Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.')
); );
} }
} }
...@@ -579,7 +579,7 @@ class GalleryDrawer extends StatelessWidget { ...@@ -579,7 +579,7 @@ class GalleryDrawer extends StatelessWidget {
new FancyDrawerHeader(), new FancyDrawerHeader(),
new ListTile( new ListTile(
leading: new Icon(Icons.brightness_5), leading: new Icon(Icons.brightness_5),
title: new Text('Light'), title: const Text('Light'),
onTap: () { _changeTheme(context, true); }, onTap: () { _changeTheme(context, true); },
selected: ComplexLayoutApp.of(context).lightTheme, selected: ComplexLayoutApp.of(context).lightTheme,
trailing: new Radio<bool>( trailing: new Radio<bool>(
...@@ -590,7 +590,7 @@ class GalleryDrawer extends StatelessWidget { ...@@ -590,7 +590,7 @@ class GalleryDrawer extends StatelessWidget {
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.brightness_7), leading: new Icon(Icons.brightness_7),
title: new Text('Dark'), title: const Text('Dark'),
onTap: () { _changeTheme(context, false); }, onTap: () { _changeTheme(context, false); },
selected: !ComplexLayoutApp.of(context).lightTheme, selected: !ComplexLayoutApp.of(context).lightTheme,
trailing: new Radio<bool>( trailing: new Radio<bool>(
...@@ -602,7 +602,7 @@ class GalleryDrawer extends StatelessWidget { ...@@ -602,7 +602,7 @@ class GalleryDrawer extends StatelessWidget {
new Divider(), new Divider(),
new ListTile( new ListTile(
leading: new Icon(Icons.hourglass_empty), leading: new Icon(Icons.hourglass_empty),
title: new Text('Animate Slowly'), title: const Text('Animate Slowly'),
selected: timeDilation != 1.0, selected: timeDilation != 1.0,
onTap: () { ComplexLayoutApp.of(context).toggleAnimationSpeed(); }, onTap: () { ComplexLayoutApp.of(context).toggleAnimationSpeed(); },
trailing: new Checkbox( trailing: new Checkbox(
......
...@@ -15,7 +15,7 @@ import 'package:stack_trace/stack_trace.dart'; ...@@ -15,7 +15,7 @@ import 'package:stack_trace/stack_trace.dart';
String cwd = Directory.current.path; String cwd = Directory.current.path;
List<ProcessInfo> _runningProcesses = <ProcessInfo>[]; List<ProcessInfo> _runningProcesses = <ProcessInfo>[];
ProcessManager _processManager = new LocalProcessManager(); ProcessManager _processManager = const LocalProcessManager();
class ProcessInfo { class ProcessInfo {
ProcessInfo(this.command, this.process); ProcessInfo(this.command, this.process);
......
...@@ -10,7 +10,7 @@ import 'package:process/process.dart'; ...@@ -10,7 +10,7 @@ import 'package:process/process.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {
final ProcessManager processManager = new LocalProcessManager(); final ProcessManager processManager = const LocalProcessManager();
group('run.dart script', () { group('run.dart script', () {
Future<int> runScript(List<String> testNames) async { Future<int> runScript(List<String> testNames) async {
......
...@@ -88,7 +88,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -88,7 +88,7 @@ class CardCollectionState extends State<CardCollection> {
data: const IconThemeData(color: Colors.black), data: const IconThemeData(color: Colors.black),
child: new ListView( child: new ListView(
children: <Widget>[ children: <Widget>[
new DrawerHeader(child: new Center(child: new Text('Options'))), const DrawerHeader(child: const Center(child: const Text('Options'))),
buildDrawerCheckbox("Make card labels editable", _editable, _toggleEditable), buildDrawerCheckbox("Make card labels editable", _editable, _toggleEditable),
buildDrawerCheckbox("Fixed size cards", _fixedSizeCards, _toggleFixedSizeCards), buildDrawerCheckbox("Fixed size cards", _fixedSizeCards, _toggleFixedSizeCards),
buildDrawerCheckbox("Let the sun shine", _sunshine, _toggleSunshine), buildDrawerCheckbox("Let the sun shine", _sunshine, _toggleSunshine),
...@@ -110,7 +110,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -110,7 +110,7 @@ class CardCollectionState extends State<CardCollection> {
new ListTile( new ListTile(
leading: new Icon(Icons.dvr), leading: new Icon(Icons.dvr),
onTap: () { debugDumpApp(); debugDumpRenderTree(); }, onTap: () { debugDumpApp(); debugDumpRenderTree(); },
title: new Text('Dump App to Console'), title: const Text('Dump App to Console'),
), ),
], ],
), ),
......
...@@ -42,7 +42,7 @@ class ExampleDragTargetState extends State<ExampleDragTarget> { ...@@ -42,7 +42,7 @@ 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); const 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;
...@@ -193,13 +193,13 @@ class MovableBall extends StatelessWidget { ...@@ -193,13 +193,13 @@ class MovableBall extends StatelessWidget {
color: Colors.blue.shade700, color: Colors.blue.shade700,
size: kBallSize, size: kBallSize,
tappable: true, tappable: true,
child: new Center(child: new Text('BALL')) child: const Center(child: const Text('BALL'))
) )
); );
final Widget dashedBall = new Container( final Widget dashedBall = new Container(
width: kBallSize, width: kBallSize,
height: kBallSize, height: kBallSize,
child: new CustomPaint( child: const CustomPaint(
painter: const DashOutlineCirclePainter() painter: const DashOutlineCirclePainter()
) )
); );
...@@ -238,7 +238,7 @@ class DragAndDropAppState extends State<DragAndDropApp> { ...@@ -238,7 +238,7 @@ class DragAndDropAppState extends State<DragAndDropApp> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Drag and Drop Flutter Demo') title: const Text('Drag and Drop Flutter Demo')
), ),
body: new Column( body: new Column(
children: <Widget>[ children: <Widget>[
...@@ -251,19 +251,19 @@ class DragAndDropAppState extends State<DragAndDropApp> { ...@@ -251,19 +251,19 @@ class DragAndDropAppState extends State<DragAndDropApp> {
color: Colors.yellow.shade300, color: Colors.yellow.shade300,
under: true, under: true,
heavy: false, heavy: false,
child: new Text('under') child: const Text('under')
), ),
new ExampleDragSource( new ExampleDragSource(
color: Colors.green.shade300, color: Colors.green.shade300,
under: false, under: false,
heavy: true, heavy: true,
child: new Text('long-press above') child: const Text('long-press above')
), ),
new ExampleDragSource( new ExampleDragSource(
color: Colors.indigo.shade300, color: Colors.indigo.shade300,
under: false, under: false,
heavy: false, heavy: false,
child: new Text('above') child: const Text('above')
), ),
], ],
) )
......
...@@ -444,7 +444,7 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM ...@@ -444,7 +444,7 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
length: _allDemos.length, length: _allDemos.length,
child: new Scaffold( child: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Animation'), title: const Text('Animation'),
bottom: new TabBar( bottom: new TabBar(
tabs: _allDemos.map((_ArcDemo demo) => new Tab(text: demo.title)).toList(), tabs: _allDemos.map((_ArcDemo demo) => new Tab(text: demo.title)).toList(),
), ),
......
...@@ -181,7 +181,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> { ...@@ -181,7 +181,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<Widget> layers = <Widget>[ final List<Widget> layers = <Widget>[
new Scaffold( new Scaffold(
appBar: new AppBar(title: new Text('Tap a Card')), appBar: new AppBar(title: const Text('Tap a Card')),
body: new Container( body: new Container(
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0), padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
child: new NotificationListener<ScrollNotification>( child: new NotificationListener<ScrollNotification>(
......
...@@ -84,22 +84,22 @@ class PageViewAppState extends State<PageViewApp> { ...@@ -84,22 +84,22 @@ class PageViewAppState extends State<PageViewApp> {
return new Drawer( return new Drawer(
child: new ListView( child: new ListView(
children: <Widget>[ children: <Widget>[
new DrawerHeader(child: new Center(child: new Text('Options'))), const DrawerHeader(child: const Center(child: const Text('Options'))),
new ListTile( new ListTile(
leading: new Icon(Icons.more_horiz), leading: new Icon(Icons.more_horiz),
selected: scrollDirection == Axis.horizontal, selected: scrollDirection == Axis.horizontal,
trailing: new Text('Horizontal Layout'), trailing: const Text('Horizontal Layout'),
onTap: switchScrollDirection, onTap: switchScrollDirection,
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.more_vert), leading: new Icon(Icons.more_vert),
selected: scrollDirection == Axis.vertical, selected: scrollDirection == Axis.vertical,
trailing: new Text('Vertical Layout'), trailing: const Text('Vertical Layout'),
onTap: switchScrollDirection, onTap: switchScrollDirection,
), ),
new ListTile( new ListTile(
onTap: toggleItemsWrap, onTap: toggleItemsWrap,
title: new Text('Scrolling wraps around'), title: const Text('Scrolling wraps around'),
// TODO(abarth): Actually make this checkbox change this value. // TODO(abarth): Actually make this checkbox change this value.
trailing: new Checkbox(value: itemsWrap, onChanged: null), trailing: new Checkbox(value: itemsWrap, onChanged: null),
), ),
...@@ -110,7 +110,7 @@ class PageViewAppState extends State<PageViewApp> { ...@@ -110,7 +110,7 @@ class PageViewAppState extends State<PageViewApp> {
Widget _buildAppBar() { Widget _buildAppBar() {
return new AppBar( return new AppBar(
title: new Text('PageView'), title: const Text('PageView'),
actions: <Widget>[ actions: <Widget>[
new Text(scrollDirection == Axis.horizontal ? "horizontal" : "vertical"), new Text(scrollDirection == Axis.horizontal ? "horizontal" : "vertical"),
], ],
......
...@@ -10,7 +10,7 @@ void main() { ...@@ -10,7 +10,7 @@ void main() {
title: 'Hardware Key Demo', title: 'Hardware Key Demo',
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Hardware Key Demo'), title: const Text('Hardware Key Demo'),
), ),
body: new Center( body: new Center(
child: new RawKeyboardDemo(), child: new RawKeyboardDemo(),
......
...@@ -125,7 +125,7 @@ class ColorsDemo extends StatelessWidget { ...@@ -125,7 +125,7 @@ class ColorsDemo extends StatelessWidget {
child: new Scaffold( child: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
elevation: 0, elevation: 0,
title: new Text('Colors'), title: const Text('Colors'),
bottom: new TabBar( bottom: new TabBar(
isScrollable: true, isScrollable: true,
tabs: allPalettes.map((Palette swatch) => new Tab(text: swatch.name)).toList(), tabs: allPalettes.map((Palette swatch) => new Tab(text: swatch.name)).toList(),
......
...@@ -113,11 +113,11 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -113,11 +113,11 @@ class ContactsDemoState extends State<ContactsDemo> {
floating: _appBarBehavior == AppBarBehavior.floating, floating: _appBarBehavior == AppBarBehavior.floating,
actions: <Widget>[ actions: <Widget>[
new IconButton( new IconButton(
icon: new Icon(Icons.create), icon: const Icon(Icons.create),
tooltip: 'Edit', tooltip: 'Edit',
onPressed: () { onPressed: () {
_scaffoldKey.currentState.showSnackBar(new SnackBar( _scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('This is actually just a demo. Editing isn\'t supported.') content: const Text('This is actually just a demo. Editing isn\'t supported.')
)); ));
}, },
), ),
...@@ -130,21 +130,21 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -130,21 +130,21 @@ class ContactsDemoState extends State<ContactsDemo> {
itemBuilder: (BuildContext context) => <PopupMenuItem<AppBarBehavior>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<AppBarBehavior>>[
new PopupMenuItem<AppBarBehavior>( new PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.normal, value: AppBarBehavior.normal,
child: new Text('App bar scrolls away') child: const Text('App bar scrolls away')
), ),
new PopupMenuItem<AppBarBehavior>( new PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.pinned, value: AppBarBehavior.pinned,
child: new Text('App bar stays put') child: const Text('App bar stays put')
), ),
new PopupMenuItem<AppBarBehavior>( new PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.floating, value: AppBarBehavior.floating,
child: new Text('App bar floats') child: const Text('App bar floats')
), ),
], ],
), ),
], ],
flexibleSpace: new FlexibleSpaceBar( flexibleSpace: new FlexibleSpaceBar(
title: new Text('Ali Connors'), title: const Text('Ali Connors'),
background: new Stack( background: new Stack(
children: <Widget>[ children: <Widget>[
new Image.asset( new Image.asset(
...@@ -154,7 +154,7 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -154,7 +154,7 @@ class ContactsDemoState extends State<ContactsDemo> {
), ),
// This gradient ensures that the toolbar icons are distinct // This gradient ensures that the toolbar icons are distinct
// against the background image. // against the background image.
new DecoratedBox( const DecoratedBox(
decoration: const BoxDecoration( decoration: const BoxDecoration(
gradient: const LinearGradient( gradient: const LinearGradient(
begin: const FractionalOffset(0.5, 0.0), begin: const FractionalOffset(0.5, 0.0),
...@@ -177,7 +177,7 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -177,7 +177,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send message', tooltip: 'Send message',
onPressed: () { onPressed: () {
_scaffoldKey.currentState.showSnackBar(new SnackBar( _scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('Pretend that this opened your SMS application.') content: const Text('Pretend that this opened your SMS application.')
)); ));
}, },
lines: <String>[ lines: <String>[
...@@ -190,7 +190,7 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -190,7 +190,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send message', tooltip: 'Send message',
onPressed: () { onPressed: () {
_scaffoldKey.currentState.showSnackBar(new SnackBar( _scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('In this demo, this button doesn\'t do anything.') content: const Text('In this demo, this button doesn\'t do anything.')
)); ));
}, },
lines: <String>[ lines: <String>[
...@@ -203,7 +203,7 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -203,7 +203,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send message', tooltip: 'Send message',
onPressed: () { onPressed: () {
_scaffoldKey.currentState.showSnackBar(new SnackBar( _scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('Imagine if you will, a messaging application.') content: const Text('Imagine if you will, a messaging application.')
)); ));
}, },
lines: <String>[ lines: <String>[
...@@ -221,7 +221,7 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -221,7 +221,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send personal e-mail', tooltip: 'Send personal e-mail',
onPressed: () { onPressed: () {
_scaffoldKey.currentState.showSnackBar(new SnackBar( _scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('Here, your e-mail application would open.') content: const Text('Here, your e-mail application would open.')
)); ));
}, },
lines: <String>[ lines: <String>[
...@@ -234,7 +234,7 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -234,7 +234,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send work e-mail', tooltip: 'Send work e-mail',
onPressed: () { onPressed: () {
_scaffoldKey.currentState.showSnackBar(new SnackBar( _scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('This is a demo, so this button does not actually work.') content: const Text('This is a demo, so this button does not actually work.')
)); ));
}, },
lines: <String>[ lines: <String>[
...@@ -252,7 +252,7 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -252,7 +252,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Open map', tooltip: 'Open map',
onPressed: () { onPressed: () {
_scaffoldKey.currentState.showSnackBar(new SnackBar( _scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('This would show a map of San Francisco.') content: const Text('This would show a map of San Francisco.')
)); ));
}, },
lines: <String>[ lines: <String>[
...@@ -266,7 +266,7 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -266,7 +266,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Open map', tooltip: 'Open map',
onPressed: () { onPressed: () {
_scaffoldKey.currentState.showSnackBar(new SnackBar( _scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('This would show a map of Mountain View.') content: const Text('This would show a map of Mountain View.')
)); ));
}, },
lines: <String>[ lines: <String>[
...@@ -280,7 +280,7 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -280,7 +280,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Open map', tooltip: 'Open map',
onPressed: () { onPressed: () {
_scaffoldKey.currentState.showSnackBar(new SnackBar( _scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('This would also show a map, if this was not a demo.') content: const Text('This would also show a map, if this was not a demo.')
)); ));
}, },
lines: <String>[ lines: <String>[
......
...@@ -12,7 +12,7 @@ class CupertinoProgressIndicatorDemo extends StatelessWidget { ...@@ -12,7 +12,7 @@ class CupertinoProgressIndicatorDemo extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Cupertino Activity Indicator'), title: const Text('Cupertino Activity Indicator'),
), ),
body: new Center( body: new Center(
child: new CupertinoActivityIndicator(), child: new CupertinoActivityIndicator(),
......
...@@ -21,13 +21,13 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> { ...@@ -21,13 +21,13 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Cupertino Buttons'), title: const Text('Cupertino Buttons'),
), ),
body: new Column( body: new Column(
children: <Widget> [ children: <Widget> [
new Padding( const Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: new Text('iOS themed buttons are flat. They can have borders or backgrounds but ' child: const Text('iOS themed buttons are flat. They can have borders or backgrounds but '
'only when necessary.'), 'only when necessary.'),
), ),
new Expanded( new Expanded(
...@@ -35,36 +35,36 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> { ...@@ -35,36 +35,36 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget> [ children: <Widget> [
new Text(_pressedCount > 0 ? "Button pressed $_pressedCount times" : " "), new Text(_pressedCount > 0 ? "Button pressed $_pressedCount times" : " "),
new Padding(padding: const EdgeInsets.all(12.0)), const Padding(padding: const EdgeInsets.all(12.0)),
new Align( new Align(
alignment: const FractionalOffset(0.5, 0.4), alignment: const FractionalOffset(0.5, 0.4),
child: new Row( child: new Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
new CupertinoButton( new CupertinoButton(
child: new Text('Cupertino Button'), child: const Text('Cupertino Button'),
onPressed: () { onPressed: () {
setState(() {_pressedCount++;}); setState(() {_pressedCount++;});
} }
), ),
new CupertinoButton( new CupertinoButton(
child: new Text('Disabled'), child: const Text('Disabled'),
onPressed: null, onPressed: null,
), ),
], ],
), ),
), ),
new Padding(padding: const EdgeInsets.all(12.0)), const Padding(padding: const EdgeInsets.all(12.0)),
new CupertinoButton( new CupertinoButton(
child: new Text('With Background'), child: const Text('With Background'),
color: _kBlue, color: _kBlue,
onPressed: () { onPressed: () {
setState(() {_pressedCount++;}); setState(() {_pressedCount++;});
} }
), ),
new Padding(padding: const EdgeInsets.all(12.0)), const Padding(padding: const EdgeInsets.all(12.0)),
new CupertinoButton( new CupertinoButton(
child: new Text('Disabled'), child: const Text('Disabled'),
color: _kBlue, color: _kBlue,
onPressed: null, onPressed: null,
), ),
......
...@@ -37,27 +37,27 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> { ...@@ -37,27 +37,27 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Cupertino Dialogs'), title: const Text('Cupertino Dialogs'),
), ),
body: new ListView( body: new ListView(
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0), padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
children: <Widget> [ children: <Widget> [
new CupertinoButton( new CupertinoButton(
child: new Text('Alert'), child: const Text('Alert'),
color: _kBlue, color: _kBlue,
onPressed: () { onPressed: () {
showDemoDialog<String>( showDemoDialog<String>(
context: context, context: context,
child: new CupertinoAlertDialog( child: new CupertinoAlertDialog(
content: new Text('Discard draft?'), content: const Text('Discard draft?'),
actions: <Widget>[ actions: <Widget>[
new CupertinoDialogAction( new CupertinoDialogAction(
child: new Text('Discard'), child: const Text('Discard'),
isDestructive: true, isDestructive: true,
onPressed: () { Navigator.pop(context, 'OK'); } onPressed: () { Navigator.pop(context, 'OK'); }
), ),
new CupertinoDialogAction( new CupertinoDialogAction(
child: new Text('Cancel', style: const TextStyle(fontWeight: FontWeight.w600)), child: const Text('Cancel', style: const TextStyle(fontWeight: FontWeight.w600)),
onPressed: () { Navigator.pop(context, 'Cancel'); } onPressed: () { Navigator.pop(context, 'Cancel'); }
), ),
] ]
...@@ -65,27 +65,27 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> { ...@@ -65,27 +65,27 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
); );
}, },
), ),
new Padding(padding: const EdgeInsets.all(8.0)), const Padding(padding: const EdgeInsets.all(8.0)),
new CupertinoButton( new CupertinoButton(
child: new Text('Alert with Title'), child: const Text('Alert with Title'),
color: _kBlue, color: _kBlue,
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0),
onPressed: () { onPressed: () {
showDemoDialog<String>( showDemoDialog<String>(
context: context, context: context,
child: new CupertinoAlertDialog( child: new CupertinoAlertDialog(
title: new Text('Allow "Maps" to access your location while you use the app?'), title: const Text('Allow "Maps" to access your location while you use the app?'),
content: new Text( content: const Text(
'Your current location will be displayed on the map and used for directions, ' 'Your current location will be displayed on the map and used for directions, '
'nearby search results, and estimated travel times.' 'nearby search results, and estimated travel times.'
), ),
actions: <Widget>[ actions: <Widget>[
new CupertinoDialogAction( new CupertinoDialogAction(
child: new Text('Don\'t Allow'), child: const Text('Don\'t Allow'),
onPressed: () { Navigator.pop(context, 'Disallow'); } onPressed: () { Navigator.pop(context, 'Disallow'); }
), ),
new CupertinoDialogAction( new CupertinoDialogAction(
child: new Text('Allow'), child: const Text('Allow'),
onPressed: () { Navigator.pop(context, 'Allow'); } onPressed: () { Navigator.pop(context, 'Allow'); }
), ),
] ]
......
...@@ -20,7 +20,7 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> { ...@@ -20,7 +20,7 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Cupertino Sliders'), title: const Text('Cupertino Sliders'),
), ),
body: new Center( body: new Center(
child: new Column( child: new Column(
...@@ -39,7 +39,7 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> { ...@@ -39,7 +39,7 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
}); });
} }
), ),
new Text('Cupertino Continuous'), const Text('Cupertino Continuous'),
] ]
), ),
new Column( new Column(
...@@ -56,7 +56,7 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> { ...@@ -56,7 +56,7 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
}); });
} }
), ),
new Text('Cupertino Discrete'), const Text('Cupertino Discrete'),
] ]
), ),
], ],
......
...@@ -20,7 +20,7 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> { ...@@ -20,7 +20,7 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Cupertino Switch'), title: const Text('Cupertino Switch'),
), ),
body: new Center( body: new Center(
child: new CupertinoSwitch( child: new CupertinoSwitch(
......
...@@ -23,7 +23,7 @@ class NavigationIconView { ...@@ -23,7 +23,7 @@ class NavigationIconView {
) { ) {
_animation = new CurvedAnimation( _animation = new CurvedAnimation(
parent: controller, parent: controller,
curve: new Interval(0.5, 1.0, curve: Curves.fastOutSlowIn), curve: const Interval(0.5, 1.0, curve: Curves.fastOutSlowIn),
); );
} }
...@@ -96,32 +96,32 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> ...@@ -96,32 +96,32 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
super.initState(); super.initState();
_navigationViews = <NavigationIconView>[ _navigationViews = <NavigationIconView>[
new NavigationIconView( new NavigationIconView(
icon: new Icon(Icons.access_alarm), icon: const Icon(Icons.access_alarm),
title: new Text('Alarm'), title: const Text('Alarm'),
color: Colors.deepPurple, color: Colors.deepPurple,
vsync: this, vsync: this,
), ),
new NavigationIconView( new NavigationIconView(
icon: new CustomIcon(), icon: new CustomIcon(),
title: new Text('Box'), title: const Text('Box'),
color: Colors.deepOrange, color: Colors.deepOrange,
vsync: this, vsync: this,
), ),
new NavigationIconView( new NavigationIconView(
icon: new Icon(Icons.cloud), icon: const Icon(Icons.cloud),
title: new Text('Cloud'), title: const Text('Cloud'),
color: Colors.teal, color: Colors.teal,
vsync: this, vsync: this,
), ),
new NavigationIconView( new NavigationIconView(
icon: new Icon(Icons.favorite), icon: const Icon(Icons.favorite),
title: new Text('Favorites'), title: const Text('Favorites'),
color: Colors.indigo, color: Colors.indigo,
vsync: this, vsync: this,
), ),
new NavigationIconView( new NavigationIconView(
icon: new Icon(Icons.event_available), icon: const Icon(Icons.event_available),
title: new Text('Event'), title: const Text('Event'),
color: Colors.pink, color: Colors.pink,
vsync: this, vsync: this,
) )
...@@ -183,7 +183,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> ...@@ -183,7 +183,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Bottom navigation'), title: const Text('Bottom navigation'),
actions: <Widget>[ actions: <Widget>[
new PopupMenuButton<BottomNavigationBarType>( new PopupMenuButton<BottomNavigationBarType>(
onSelected: (BottomNavigationBarType value) { onSelected: (BottomNavigationBarType value) {
...@@ -194,11 +194,11 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> ...@@ -194,11 +194,11 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
itemBuilder: (BuildContext context) => <PopupMenuItem<BottomNavigationBarType>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<BottomNavigationBarType>>[
new PopupMenuItem<BottomNavigationBarType>( new PopupMenuItem<BottomNavigationBarType>(
value: BottomNavigationBarType.fixed, value: BottomNavigationBarType.fixed,
child: new Text('Fixed'), child: const Text('Fixed'),
), ),
new PopupMenuItem<BottomNavigationBarType>( new PopupMenuItem<BottomNavigationBarType>(
value: BottomNavigationBarType.shifting, value: BottomNavigationBarType.shifting,
child: new Text('Shifting'), child: const Text('Shifting'),
) )
], ],
) )
......
...@@ -95,13 +95,13 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -95,13 +95,13 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
new RaisedButton( new RaisedButton(
child: new Text('RAISED BUTTON'), child: const Text('RAISED BUTTON'),
onPressed: () { onPressed: () {
// Perform some action // Perform some action
}, },
), ),
new RaisedButton( new RaisedButton(
child: new Text('DISABLED'), child: const Text('DISABLED'),
onPressed: null, onPressed: null,
) )
], ],
...@@ -116,13 +116,13 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -116,13 +116,13 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
new FlatButton( new FlatButton(
child: new Text('FLAT BUTTON'), child: const Text('FLAT BUTTON'),
onPressed: () { onPressed: () {
// Perform some action // Perform some action
}, },
), ),
new FlatButton( new FlatButton(
child: new Text('DISABLED'), child: const Text('DISABLED'),
onPressed: null, onPressed: null,
) )
], ],
...@@ -142,7 +142,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -142,7 +142,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
new ListTile( new ListTile(
title: new Text('Simple dropdown:'), title: const Text('Simple dropdown:'),
trailing: new DropdownButton<String>( trailing: new DropdownButton<String>(
value: dropdown1Value, value: dropdown1Value,
onChanged: (String newValue) { onChanged: (String newValue) {
...@@ -162,10 +162,10 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -162,10 +162,10 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
height: 24.0, height: 24.0,
), ),
new ListTile( new ListTile(
title: new Text('Dropdown with a hint:'), title: const Text('Dropdown with a hint:'),
trailing: new DropdownButton<String>( trailing: new DropdownButton<String>(
value: dropdown2Value, value: dropdown2Value,
hint: new Text('Choose'), hint: const Text('Choose'),
onChanged: (String newValue) { onChanged: (String newValue) {
setState(() { setState(() {
dropdown2Value = newValue; dropdown2Value = newValue;
...@@ -183,7 +183,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -183,7 +183,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
height: 24.0, height: 24.0,
), ),
new ListTile( new ListTile(
title: new Text('Scrollable dropdown:'), title: const Text('Scrollable dropdown:'),
trailing: new DropdownButton<String>( trailing: new DropdownButton<String>(
value: dropdown3Value, value: dropdown3Value,
onChanged: (String newValue) { onChanged: (String newValue) {
...@@ -218,14 +218,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -218,14 +218,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
new IconButton( new IconButton(
icon: new Icon(Icons.thumb_up), icon: const Icon(Icons.thumb_up),
onPressed: () { onPressed: () {
setState(() => iconButtonToggle = !iconButtonToggle); setState(() => iconButtonToggle = !iconButtonToggle);
}, },
color: iconButtonToggle ? Theme.of(context).primaryColor : null, color: iconButtonToggle ? Theme.of(context).primaryColor : null,
), ),
new IconButton( const IconButton(
icon: new Icon(Icons.thumb_up), icon: const Icon(Icons.thumb_up),
onPressed: null, onPressed: null,
) )
] ]
...@@ -239,7 +239,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -239,7 +239,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
return new Align( return new Align(
alignment: const FractionalOffset(0.5, 0.4), alignment: const FractionalOffset(0.5, 0.4),
child: new FloatingActionButton( child: new FloatingActionButton(
child: new Icon(Icons.add), child: const Icon(Icons.add),
onPressed: () { onPressed: () {
// Perform some action // Perform some action
}, },
......
...@@ -116,12 +116,12 @@ class TravelDestinationItem extends StatelessWidget { ...@@ -116,12 +116,12 @@ class TravelDestinationItem extends StatelessWidget {
alignment: MainAxisAlignment.start, alignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
new FlatButton( new FlatButton(
child: new Text('SHARE'), child: const Text('SHARE'),
textColor: Colors.amber.shade500, textColor: Colors.amber.shade500,
onPressed: () { /* do nothing */ }, onPressed: () { /* do nothing */ },
), ),
new FlatButton( new FlatButton(
child: new Text('EXPLORE'), child: const Text('EXPLORE'),
textColor: Colors.amber.shade500, textColor: Colors.amber.shade500,
onPressed: () { /* do nothing */ }, onPressed: () { /* do nothing */ },
), ),
...@@ -142,7 +142,7 @@ class CardsDemo extends StatelessWidget { ...@@ -142,7 +142,7 @@ class CardsDemo extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Travel stream') title: const Text('Travel stream')
), ),
body: new ListView( body: new ListView(
itemExtent: TravelDestinationItem.height, itemExtent: TravelDestinationItem.height,
......
...@@ -23,24 +23,24 @@ class _ChipDemoState extends State<ChipDemo> { ...@@ -23,24 +23,24 @@ class _ChipDemoState extends State<ChipDemo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<Widget> chips = <Widget>[ final List<Widget> chips = <Widget>[
new Chip( const Chip(
label: new Text('Apple') label: const Text('Apple')
), ),
new Chip( new Chip(
avatar: new CircleAvatar(child: new Text('B')), avatar: new CircleAvatar(child: const Text('B')),
label: new Text('Blueberry') label: const Text('Blueberry')
), ),
]; ];
if (_showBananas) { if (_showBananas) {
chips.add(new Chip( chips.add(new Chip(
label: new Text('Bananas'), label: const Text('Bananas'),
onDeleted: _deleteBananas onDeleted: _deleteBananas
)); ));
} }
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Chips')), appBar: new AppBar(title: const Text('Chips')),
body: new ListView( body: new ListView(
children: chips.map((Widget widget) { children: chips.map((Widget widget) {
return new Container( return new Container(
......
...@@ -164,12 +164,12 @@ class _DataTableDemoState extends State<DataTableDemo> { ...@@ -164,12 +164,12 @@ class _DataTableDemoState extends State<DataTableDemo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Data tables')), appBar: new AppBar(title: const Text('Data tables')),
body: new ListView( body: new ListView(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
children: <Widget>[ children: <Widget>[
new PaginatedDataTable( new PaginatedDataTable(
header: new Text('Nutrition'), header: const Text('Nutrition'),
rowsPerPage: _rowsPerPage, rowsPerPage: _rowsPerPage,
onRowsPerPageChanged: (int value) { setState(() { _rowsPerPage = value; }); }, onRowsPerPageChanged: (int value) { setState(() { _rowsPerPage = value; }); },
sortColumnIndex: _sortColumnIndex, sortColumnIndex: _sortColumnIndex,
...@@ -177,43 +177,43 @@ class _DataTableDemoState extends State<DataTableDemo> { ...@@ -177,43 +177,43 @@ class _DataTableDemoState extends State<DataTableDemo> {
onSelectAll: _dessertsDataSource._selectAll, onSelectAll: _dessertsDataSource._selectAll,
columns: <DataColumn>[ columns: <DataColumn>[
new DataColumn( new DataColumn(
label: new Text('Dessert (100g serving)'), label: const Text('Dessert (100g serving)'),
onSort: (int columnIndex, bool ascending) => _sort<String>((Dessert d) => d.name, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<String>((Dessert d) => d.name, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Calories'), label: const Text('Calories'),
tooltip: 'The total amount of food energy in the given serving size.', tooltip: 'The total amount of food energy in the given serving size.',
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.calories, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.calories, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Fat (g)'), label: const Text('Fat (g)'),
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.fat, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.fat, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Carbs (g)'), label: const Text('Carbs (g)'),
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.carbs, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.carbs, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Protein (g)'), label: const Text('Protein (g)'),
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.protein, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.protein, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Sodium (mg)'), label: const Text('Sodium (mg)'),
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.sodium, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.sodium, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Calcium (%)'), label: const Text('Calcium (%)'),
tooltip: 'The amount of calcium as a percentage of the recommended daily amount.', tooltip: 'The amount of calcium as a percentage of the recommended daily amount.',
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.calcium, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.calcium, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Iron (%)'), label: const Text('Iron (%)'),
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.iron, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.iron, columnIndex, ascending)
), ),
......
...@@ -129,7 +129,7 @@ class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> { ...@@ -129,7 +129,7 @@ class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Date and time pickers')), appBar: new AppBar(title: const Text('Date and time pickers')),
body: new DropdownButtonHideUnderline( body: new DropdownButtonHideUnderline(
child: new ListView( child: new ListView(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
......
...@@ -87,13 +87,13 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -87,13 +87,13 @@ class DialogDemoState extends State<DialogDemo> {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Dialogs') title: const Text('Dialogs')
), ),
body: new ListView( body: new ListView(
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0), padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
children: <Widget>[ children: <Widget>[
new RaisedButton( new RaisedButton(
child: new Text('ALERT'), child: const Text('ALERT'),
onPressed: () { onPressed: () {
showDemoDialog<DialogDemoAction>( showDemoDialog<DialogDemoAction>(
context: context, context: context,
...@@ -104,11 +104,11 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -104,11 +104,11 @@ class DialogDemoState extends State<DialogDemo> {
), ),
actions: <Widget>[ actions: <Widget>[
new FlatButton( new FlatButton(
child: new Text('CANCEL'), child: const Text('CANCEL'),
onPressed: () { Navigator.pop(context, DialogDemoAction.cancel); } onPressed: () { Navigator.pop(context, DialogDemoAction.cancel); }
), ),
new FlatButton( new FlatButton(
child: new Text('DISCARD'), child: const Text('DISCARD'),
onPressed: () { Navigator.pop(context, DialogDemoAction.discard); } onPressed: () { Navigator.pop(context, DialogDemoAction.discard); }
) )
] ]
...@@ -117,23 +117,23 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -117,23 +117,23 @@ class DialogDemoState extends State<DialogDemo> {
} }
), ),
new RaisedButton( new RaisedButton(
child: new Text('ALERT WITH TITLE'), child: const Text('ALERT WITH TITLE'),
onPressed: () { onPressed: () {
showDemoDialog<DialogDemoAction>( showDemoDialog<DialogDemoAction>(
context: context, context: context,
child: new AlertDialog( child: new AlertDialog(
title: new Text('Use Google\'s location service?'), title: const Text('Use Google\'s location service?'),
content: new Text( content: new Text(
_alertWithTitleText, _alertWithTitleText,
style: dialogTextStyle style: dialogTextStyle
), ),
actions: <Widget>[ actions: <Widget>[
new FlatButton( new FlatButton(
child: new Text('DISAGREE'), child: const Text('DISAGREE'),
onPressed: () { Navigator.pop(context, DialogDemoAction.disagree); } onPressed: () { Navigator.pop(context, DialogDemoAction.disagree); }
), ),
new FlatButton( new FlatButton(
child: new Text('AGREE'), child: const Text('AGREE'),
onPressed: () { Navigator.pop(context, DialogDemoAction.agree); } onPressed: () { Navigator.pop(context, DialogDemoAction.agree); }
) )
] ]
...@@ -142,12 +142,12 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -142,12 +142,12 @@ class DialogDemoState extends State<DialogDemo> {
} }
), ),
new RaisedButton( new RaisedButton(
child: new Text('SIMPLE'), child: const Text('SIMPLE'),
onPressed: () { onPressed: () {
showDemoDialog<String>( showDemoDialog<String>(
context: context, context: context,
child: new SimpleDialog( child: new SimpleDialog(
title: new Text('Set backup account'), title: const Text('Set backup account'),
children: <Widget>[ children: <Widget>[
new DialogDemoItem( new DialogDemoItem(
icon: Icons.account_circle, icon: Icons.account_circle,
...@@ -172,7 +172,7 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -172,7 +172,7 @@ class DialogDemoState extends State<DialogDemo> {
} }
), ),
new RaisedButton( new RaisedButton(
child: new Text('CONFIRMATION'), child: const Text('CONFIRMATION'),
onPressed: () { onPressed: () {
showTimePicker( showTimePicker(
context: context, context: context,
...@@ -189,7 +189,7 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -189,7 +189,7 @@ class DialogDemoState extends State<DialogDemo> {
} }
), ),
new RaisedButton( new RaisedButton(
child: new Text('FULLSCREEN'), child: const Text('FULLSCREEN'),
onPressed: () { onPressed: () {
Navigator.push(context, new MaterialPageRoute<DismissDialogAction>( Navigator.push(context, new MaterialPageRoute<DismissDialogAction>(
builder: (BuildContext context) => new FullScreenDialogDemo(), builder: (BuildContext context) => new FullScreenDialogDemo(),
......
...@@ -68,7 +68,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin { ...@@ -68,7 +68,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
void _showNotImplementedMessage() { void _showNotImplementedMessage() {
Navigator.of(context).pop(); // Dismiss the drawer. Navigator.of(context).pop(); // Dismiss the drawer.
_scaffoldKey.currentState.showSnackBar(new SnackBar( _scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text("The drawer's items don't do anything") content: const Text("The drawer's items don't do anything")
)); ));
} }
...@@ -85,14 +85,14 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin { ...@@ -85,14 +85,14 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
title: new Text('Navigation drawer'), title: const Text('Navigation drawer'),
), ),
drawer: new Drawer( drawer: new Drawer(
child: new ListView( child: new ListView(
children: <Widget>[ children: <Widget>[
new UserAccountsDrawerHeader( new UserAccountsDrawerHeader(
accountName: new Text('Zach Widget'), accountName: const Text('Zach Widget'),
accountEmail: new Text('zach.widget@example.com'), accountEmail: const Text('zach.widget@example.com'),
currentAccountPicture: new CircleAvatar(backgroundImage: new AssetImage(_kAsset0)), currentAccountPicture: new CircleAvatar(backgroundImage: new AssetImage(_kAsset0)),
otherAccountsPictures: <Widget>[ otherAccountsPictures: <Widget>[
new CircleAvatar(backgroundImage: new AssetImage(_kAsset1)), new CircleAvatar(backgroundImage: new AssetImage(_kAsset1)),
...@@ -134,13 +134,13 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin { ...@@ -134,13 +134,13 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
new ListTile( new ListTile(
leading: new Icon(Icons.add), leading: const Icon(Icons.add),
title: new Text('Add account'), title: const Text('Add account'),
onTap: _showNotImplementedMessage, onTap: _showNotImplementedMessage,
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.settings), leading: const Icon(Icons.settings),
title: new Text('Manage accounts'), title: const Text('Manage accounts'),
onTap: _showNotImplementedMessage, onTap: _showNotImplementedMessage,
), ),
], ],
......
...@@ -30,8 +30,8 @@ class DualHeaderWithHint extends StatelessWidget { ...@@ -30,8 +30,8 @@ class DualHeaderWithHint extends StatelessWidget {
return new AnimatedCrossFade( return new AnimatedCrossFade(
firstChild: first, firstChild: first,
secondChild: second, secondChild: second,
firstCurve: new Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn),
secondCurve: new Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), secondCurve: const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn),
sizeCurve: Curves.fastOutSlowIn, sizeCurve: Curves.fastOutSlowIn,
crossFadeState: isExpanded ? CrossFadeState.showSecond : CrossFadeState.showFirst, crossFadeState: isExpanded ? CrossFadeState.showSecond : CrossFadeState.showFirst,
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
...@@ -118,7 +118,7 @@ class CollapsibleBody extends StatelessWidget { ...@@ -118,7 +118,7 @@ class CollapsibleBody extends StatelessWidget {
margin: const EdgeInsets.only(right: 8.0), margin: const EdgeInsets.only(right: 8.0),
child: new FlatButton( child: new FlatButton(
onPressed: onCancel, onPressed: onCancel,
child: new Text('CANCEL', style: new TextStyle( child: const Text('CANCEL', style: const TextStyle(
color: Colors.black54, color: Colors.black54,
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.w500 fontWeight: FontWeight.w500
...@@ -130,7 +130,7 @@ class CollapsibleBody extends StatelessWidget { ...@@ -130,7 +130,7 @@ class CollapsibleBody extends StatelessWidget {
child: new FlatButton( child: new FlatButton(
onPressed: onSave, onPressed: onSave,
textTheme: ButtonTextTheme.accent, textTheme: ButtonTextTheme.accent,
child: new Text('SAVE') child: const Text('SAVE')
) )
) )
] ]
...@@ -254,7 +254,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> { ...@@ -254,7 +254,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
groupValue: field.value, groupValue: field.value,
onChanged: field.onChanged, onChanged: field.onChanged,
), ),
new Text('Bahamas') const Text('Bahamas')
] ]
), ),
new Row( new Row(
...@@ -265,7 +265,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> { ...@@ -265,7 +265,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
groupValue: field.value, groupValue: field.value,
onChanged: field.onChanged, onChanged: field.onChanged,
), ),
new Text('Barbados') const Text('Barbados')
] ]
), ),
new Row( new Row(
...@@ -276,7 +276,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> { ...@@ -276,7 +276,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
groupValue: field.value, groupValue: field.value,
onChanged: field.onChanged, onChanged: field.onChanged,
), ),
new Text('Bermuda') const Text('Bermuda')
] ]
) )
] ]
...@@ -334,7 +334,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> { ...@@ -334,7 +334,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Expansion panels')), appBar: new AppBar(title: const Text('Expansion panels')),
body: new SingleChildScrollView( body: new SingleChildScrollView(
child: new Container( child: new Container(
margin: const EdgeInsets.all(24.0), margin: const EdgeInsets.all(24.0),
......
...@@ -57,7 +57,7 @@ class DateTimeItem extends StatelessWidget { ...@@ -57,7 +57,7 @@ class DateTimeItem extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
new Text(new DateFormat('EEE, MMM d yyyy').format(date)), new Text(new DateFormat('EEE, MMM d yyyy').format(date)),
new Icon(Icons.arrow_drop_down, color: Colors.black54), const Icon(Icons.arrow_drop_down, color: Colors.black54),
] ]
) )
) )
...@@ -82,7 +82,7 @@ class DateTimeItem extends StatelessWidget { ...@@ -82,7 +82,7 @@ class DateTimeItem extends StatelessWidget {
child: new Row( child: new Row(
children: <Widget>[ children: <Widget>[
new Text('$time'), new Text('$time'),
new Icon(Icons.arrow_drop_down, color: Colors.black54), const Icon(Icons.arrow_drop_down, color: Colors.black54),
] ]
) )
) )
...@@ -122,11 +122,11 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> { ...@@ -122,11 +122,11 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
), ),
actions: <Widget>[ actions: <Widget>[
new FlatButton( new FlatButton(
child: new Text('CANCEL'), child: const Text('CANCEL'),
onPressed: () { Navigator.pop(context, DismissDialogAction.cancel); } onPressed: () { Navigator.pop(context, DismissDialogAction.cancel); }
), ),
new FlatButton( new FlatButton(
child: new Text('DISCARD'), child: const Text('DISCARD'),
onPressed: () { onPressed: () {
Navigator.of(context) Navigator.of(context)
..pop(DismissDialogAction.discard) // pop the cancel/discard dialog ..pop(DismissDialogAction.discard) // pop the cancel/discard dialog
...@@ -145,10 +145,10 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> { ...@@ -145,10 +145,10 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
leading: new IconButton( leading: new IconButton(
icon: new Icon(Icons.clear), icon: const Icon(Icons.clear),
onPressed: () { handleDismissButton(context); } onPressed: () { handleDismissButton(context); }
), ),
title: new Text('New event'), title: const Text('New event'),
actions: <Widget> [ actions: <Widget> [
new FlatButton( new FlatButton(
child: new Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)), child: new Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)),
...@@ -222,7 +222,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> { ...@@ -222,7 +222,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
}); });
} }
), ),
new Text('All-day') const Text('All-day')
] ]
) )
) )
......
...@@ -316,22 +316,22 @@ class GridListDemoState extends State<GridListDemo> { ...@@ -316,22 +316,22 @@ class GridListDemoState extends State<GridListDemo> {
final Orientation orientation = MediaQuery.of(context).orientation; final Orientation orientation = MediaQuery.of(context).orientation;
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Grid list'), title: const Text('Grid list'),
actions: <Widget>[ actions: <Widget>[
new PopupMenuButton<GridDemoTileStyle>( new PopupMenuButton<GridDemoTileStyle>(
onSelected: changeTileStyle, onSelected: changeTileStyle,
itemBuilder: (BuildContext context) => <PopupMenuItem<GridDemoTileStyle>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<GridDemoTileStyle>>[
new PopupMenuItem<GridDemoTileStyle>( new PopupMenuItem<GridDemoTileStyle>(
value: GridDemoTileStyle.imageOnly, value: GridDemoTileStyle.imageOnly,
child: new Text('Image only'), child: const Text('Image only'),
), ),
new PopupMenuItem<GridDemoTileStyle>( new PopupMenuItem<GridDemoTileStyle>(
value: GridDemoTileStyle.oneLine, value: GridDemoTileStyle.oneLine,
child: new Text('One line'), child: const Text('One line'),
), ),
new PopupMenuItem<GridDemoTileStyle>( new PopupMenuItem<GridDemoTileStyle>(
value: GridDemoTileStyle.twoLine, value: GridDemoTileStyle.twoLine,
child: new Text('Two line'), child: const Text('Two line'),
), ),
], ],
), ),
......
...@@ -71,7 +71,7 @@ class IconsDemoState extends State<IconsDemo> { ...@@ -71,7 +71,7 @@ class IconsDemoState extends State<IconsDemo> {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Icons') title: const Text('Icons')
), ),
body: new IconTheme( body: new IconTheme(
data: new IconThemeData(opacity: iconOpacity), data: new IconThemeData(opacity: iconOpacity),
......
...@@ -104,13 +104,13 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> { ...@@ -104,13 +104,13 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
background: new Container( background: new Container(
color: theme.primaryColor, color: theme.primaryColor,
child: new ListTile( child: new ListTile(
leading: new Icon(Icons.delete, color: Colors.white, size: 36.0) leading: const Icon(Icons.delete, color: Colors.white, size: 36.0)
) )
), ),
secondaryBackground: new Container( secondaryBackground: new Container(
color: theme.primaryColor, color: theme.primaryColor,
child: new ListTile( child: new ListTile(
trailing: new Icon(Icons.archive, color: Colors.white, size: 36.0) trailing: const Icon(Icons.archive, color: Colors.white, size: 36.0)
) )
), ),
child: new Container( child: new Container(
...@@ -132,30 +132,30 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> { ...@@ -132,30 +132,30 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Swipe to dismiss'), title: const Text('Swipe to dismiss'),
actions: <Widget>[ actions: <Widget>[
new PopupMenuButton<LeaveBehindDemoAction>( new PopupMenuButton<LeaveBehindDemoAction>(
onSelected: handleDemoAction, onSelected: handleDemoAction,
itemBuilder: (BuildContext context) => <PopupMenuEntry<LeaveBehindDemoAction>>[ itemBuilder: (BuildContext context) => <PopupMenuEntry<LeaveBehindDemoAction>>[
new PopupMenuItem<LeaveBehindDemoAction>( new PopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.reset, value: LeaveBehindDemoAction.reset,
child: new Text('Reset the list') child: const Text('Reset the list')
), ),
new PopupMenuDivider(), // ignore: list_element_type_not_assignable, https://github.com/flutter/flutter/issues/5771 new PopupMenuDivider(), // ignore: list_element_type_not_assignable, https://github.com/flutter/flutter/issues/5771
new CheckedPopupMenuItem<LeaveBehindDemoAction>( new CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.horizontalSwipe, value: LeaveBehindDemoAction.horizontalSwipe,
checked: _dismissDirection == DismissDirection.horizontal, checked: _dismissDirection == DismissDirection.horizontal,
child: new Text('Hoizontal swipe') child: const Text('Hoizontal swipe')
), ),
new CheckedPopupMenuItem<LeaveBehindDemoAction>( new CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.leftSwipe, value: LeaveBehindDemoAction.leftSwipe,
checked: _dismissDirection == DismissDirection.endToStart, checked: _dismissDirection == DismissDirection.endToStart,
child: new Text('Only swipe left') child: const Text('Only swipe left')
), ),
new CheckedPopupMenuItem<LeaveBehindDemoAction>( new CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.rightSwipe, value: LeaveBehindDemoAction.rightSwipe,
checked: _dismissDirection == DismissDirection.startToEnd, checked: _dismissDirection == DismissDirection.startToEnd,
child: new Text('Only swipe right') child: const Text('Only swipe right')
) )
] ]
) )
......
...@@ -37,15 +37,15 @@ class _ListDemoState extends State<ListDemo> { ...@@ -37,15 +37,15 @@ class _ListDemoState extends State<ListDemo> {
void _showConfigurationSheet() { void _showConfigurationSheet() {
final PersistentBottomSheetController<Null> bottomSheet = scaffoldKey.currentState.showBottomSheet((BuildContext bottomSheetContext) { final PersistentBottomSheetController<Null> bottomSheet = scaffoldKey.currentState.showBottomSheet((BuildContext bottomSheetContext) {
return new Container( return new Container(
decoration: new BoxDecoration( decoration: const BoxDecoration(
border: new Border(top: new BorderSide(color: Colors.black26)), border: const Border(top: const BorderSide(color: Colors.black26)),
), ),
child: new ListView( child: new ListView(
shrinkWrap: true, shrinkWrap: true,
children: <Widget>[ children: <Widget>[
new ListTile( new ListTile(
dense: true, dense: true,
title: new Text('One-line'), title: const Text('One-line'),
trailing: new Radio<MaterialListType>( trailing: new Radio<MaterialListType>(
value: _showAvatars ? MaterialListType.oneLineWithAvatar : MaterialListType.oneLine, value: _showAvatars ? MaterialListType.oneLineWithAvatar : MaterialListType.oneLine,
groupValue: _itemType, groupValue: _itemType,
...@@ -54,7 +54,7 @@ class _ListDemoState extends State<ListDemo> { ...@@ -54,7 +54,7 @@ class _ListDemoState extends State<ListDemo> {
), ),
new ListTile( new ListTile(
dense: true, dense: true,
title: new Text('Two-line'), title: const Text('Two-line'),
trailing: new Radio<MaterialListType>( trailing: new Radio<MaterialListType>(
value: MaterialListType.twoLine, value: MaterialListType.twoLine,
groupValue: _itemType, groupValue: _itemType,
...@@ -63,7 +63,7 @@ class _ListDemoState extends State<ListDemo> { ...@@ -63,7 +63,7 @@ class _ListDemoState extends State<ListDemo> {
), ),
new ListTile( new ListTile(
dense: true, dense: true,
title: new Text('Three-line'), title: const Text('Three-line'),
trailing: new Radio<MaterialListType>( trailing: new Radio<MaterialListType>(
value: MaterialListType.threeLine, value: MaterialListType.threeLine,
groupValue: _itemType, groupValue: _itemType,
...@@ -72,7 +72,7 @@ class _ListDemoState extends State<ListDemo> { ...@@ -72,7 +72,7 @@ class _ListDemoState extends State<ListDemo> {
), ),
new ListTile( new ListTile(
dense: true, dense: true,
title: new Text('Show avatar'), title: const Text('Show avatar'),
trailing: new Checkbox( trailing: new Checkbox(
value: _showAvatars, value: _showAvatars,
onChanged: (bool value) { onChanged: (bool value) {
...@@ -85,7 +85,7 @@ class _ListDemoState extends State<ListDemo> { ...@@ -85,7 +85,7 @@ class _ListDemoState extends State<ListDemo> {
), ),
new ListTile( new ListTile(
dense: true, dense: true,
title: new Text('Show icon'), title: const Text('Show icon'),
trailing: new Checkbox( trailing: new Checkbox(
value: _showIcons, value: _showIcons,
onChanged: (bool value) { onChanged: (bool value) {
...@@ -98,7 +98,7 @@ class _ListDemoState extends State<ListDemo> { ...@@ -98,7 +98,7 @@ class _ListDemoState extends State<ListDemo> {
), ),
new ListTile( new ListTile(
dense: true, dense: true,
title: new Text('Show dividers'), title: const Text('Show dividers'),
trailing: new Checkbox( trailing: new Checkbox(
value: _showDividers, value: _showDividers,
onChanged: (bool value) { onChanged: (bool value) {
...@@ -111,7 +111,7 @@ class _ListDemoState extends State<ListDemo> { ...@@ -111,7 +111,7 @@ class _ListDemoState extends State<ListDemo> {
), ),
new ListTile( new ListTile(
dense: true, dense: true,
title: new Text('Dense layout'), title: const Text('Dense layout'),
trailing: new Checkbox( trailing: new Checkbox(
value: _dense, value: _dense,
onChanged: (bool value) { onChanged: (bool value) {
...@@ -143,9 +143,9 @@ class _ListDemoState extends State<ListDemo> { ...@@ -143,9 +143,9 @@ class _ListDemoState extends State<ListDemo> {
Widget buildListTile(BuildContext context, String item) { Widget buildListTile(BuildContext context, String item) {
Widget secondary; Widget secondary;
if (_itemType == MaterialListType.twoLine) { if (_itemType == MaterialListType.twoLine) {
secondary = new Text("Additional item information."); secondary = const Text("Additional item information.");
} else if (_itemType == MaterialListType.threeLine) { } else if (_itemType == MaterialListType.threeLine) {
secondary = new Text( secondary = const Text(
"Even more additional list item information appears on line three.", "Even more additional list item information appears on line three.",
); );
} }
...@@ -186,7 +186,7 @@ class _ListDemoState extends State<ListDemo> { ...@@ -186,7 +186,7 @@ class _ListDemoState extends State<ListDemo> {
title: new Text('Scrolling list\n$itemTypeText$layoutText'), title: new Text('Scrolling list\n$itemTypeText$layoutText'),
actions: <Widget>[ actions: <Widget>[
new IconButton( new IconButton(
icon: new Icon(Icons.sort_by_alpha), icon: const Icon(Icons.sort_by_alpha),
tooltip: 'Sort', tooltip: 'Sort',
onPressed: () { onPressed: () {
setState(() { setState(() {
...@@ -196,7 +196,7 @@ class _ListDemoState extends State<ListDemo> { ...@@ -196,7 +196,7 @@ class _ListDemoState extends State<ListDemo> {
}, },
), ),
new IconButton( new IconButton(
icon: new Icon(Icons.more_vert), icon: const Icon(Icons.more_vert),
tooltip: 'Show menu', tooltip: 'Show menu',
onPressed: _bottomSheet == null ? _showConfigurationSheet : null, onPressed: _bottomSheet == null ? _showConfigurationSheet : null,
), ),
......
...@@ -62,22 +62,22 @@ class MenuDemoState extends State<MenuDemo> { ...@@ -62,22 +62,22 @@ class MenuDemoState extends State<MenuDemo> {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Menus'), title: const Text('Menus'),
actions: <Widget>[ actions: <Widget>[
new PopupMenuButton<String>( new PopupMenuButton<String>(
onSelected: showMenuSelection, onSelected: showMenuSelection,
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem<String>( new PopupMenuItem<String>(
value: 'Toolbar menu', value: 'Toolbar menu',
child: new Text('Toolbar menu') child: const Text('Toolbar menu')
), ),
new PopupMenuItem<String>( new PopupMenuItem<String>(
value: 'Right here', value: 'Right here',
child: new Text('Right here') child: const Text('Right here')
), ),
new PopupMenuItem<String>( new PopupMenuItem<String>(
value: 'Hooray!', value: 'Hooray!',
child: new Text('Hooray!') child: const Text('Hooray!')
), ),
] ]
) )
...@@ -90,22 +90,22 @@ class MenuDemoState extends State<MenuDemo> { ...@@ -90,22 +90,22 @@ class MenuDemoState extends State<MenuDemo> {
// a simple menu with one disabled item. Typically the contents // a simple menu with one disabled item. Typically the contents
// of this "contextual menu" would reflect the app's state. // of this "contextual menu" would reflect the app's state.
new ListTile( new ListTile(
title: new Text('An item with a context menu button'), title: const Text('An item with a context menu button'),
trailing: new PopupMenuButton<String>( trailing: new PopupMenuButton<String>(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
onSelected: showMenuSelection, onSelected: showMenuSelection,
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem<String>( new PopupMenuItem<String>(
value: _simpleValue1, value: _simpleValue1,
child: new Text('Context menu item one') child: const Text('Context menu item one')
), ),
new PopupMenuItem<String>( new PopupMenuItem<String>(
enabled: false, enabled: false,
child: new Text('A disabled menu item') child: const Text('A disabled menu item')
), ),
new PopupMenuItem<String>( new PopupMenuItem<String>(
value: _simpleValue3, value: _simpleValue3,
child: new Text('Context menu item three') child: const Text('Context menu item three')
), ),
] ]
) )
...@@ -114,7 +114,7 @@ class MenuDemoState extends State<MenuDemo> { ...@@ -114,7 +114,7 @@ class MenuDemoState extends State<MenuDemo> {
// a menu whose items have text labels and icons and a divider // a menu whose items have text labels and icons and a divider
// That separates the first three items from the last one. // That separates the first three items from the last one.
new ListTile( new ListTile(
title: new Text('An item with a sectioned menu'), title: const Text('An item with a sectioned menu'),
trailing: new PopupMenuButton<String>( trailing: new PopupMenuButton<String>(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
onSelected: showMenuSelection, onSelected: showMenuSelection,
...@@ -122,30 +122,30 @@ class MenuDemoState extends State<MenuDemo> { ...@@ -122,30 +122,30 @@ class MenuDemoState extends State<MenuDemo> {
new PopupMenuItem<String>( new PopupMenuItem<String>(
value: 'Preview', value: 'Preview',
child: new ListTile( child: new ListTile(
leading: new Icon(Icons.visibility), leading: const Icon(Icons.visibility),
title: new Text('Preview') title: const Text('Preview')
) )
), ),
new PopupMenuItem<String>( new PopupMenuItem<String>(
value: 'Share', value: 'Share',
child: new ListTile( child: new ListTile(
leading: new Icon(Icons.person_add), leading: const Icon(Icons.person_add),
title: new Text('Share') title: const Text('Share')
) )
), ),
new PopupMenuItem<String>( new PopupMenuItem<String>(
value: 'Get Link', value: 'Get Link',
child: new ListTile( child: new ListTile(
leading: new Icon(Icons.link), leading: const Icon(Icons.link),
title: new Text('Get link') title: const Text('Get link')
) )
), ),
new PopupMenuDivider(), // ignore: list_element_type_not_assignable, https://github.com/flutter/flutter/issues/5771 new PopupMenuDivider(), // ignore: list_element_type_not_assignable, https://github.com/flutter/flutter/issues/5771
new PopupMenuItem<String>( new PopupMenuItem<String>(
value: 'Remove', value: 'Remove',
child: new ListTile( child: new ListTile(
leading: new Icon(Icons.delete), leading: const Icon(Icons.delete),
title: new Text('Remove') title: const Text('Remove')
) )
) )
] ]
...@@ -159,7 +159,7 @@ class MenuDemoState extends State<MenuDemo> { ...@@ -159,7 +159,7 @@ class MenuDemoState extends State<MenuDemo> {
initialValue: _simpleValue, initialValue: _simpleValue,
onSelected: showMenuSelection, onSelected: showMenuSelection,
child: new ListTile( child: new ListTile(
title: new Text('An item with a simple menu'), title: const Text('An item with a simple menu'),
subtitle: new Text(_simpleValue) subtitle: new Text(_simpleValue)
), ),
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
...@@ -180,7 +180,7 @@ class MenuDemoState extends State<MenuDemo> { ...@@ -180,7 +180,7 @@ class MenuDemoState extends State<MenuDemo> {
// Pressing the PopupMenuButton on the right of this item shows a menu // Pressing the PopupMenuButton on the right of this item shows a menu
// whose items have checked icons that reflect this app's state. // whose items have checked icons that reflect this app's state.
new ListTile( new ListTile(
title: new Text('An item with a checklist menu'), title: const Text('An item with a checklist menu'),
trailing: new PopupMenuButton<String>( trailing: new PopupMenuButton<String>(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
onSelected: showCheckedMenuSelections, onSelected: showCheckedMenuSelections,
......
...@@ -10,10 +10,10 @@ class ModalBottomSheetDemo extends StatelessWidget { ...@@ -10,10 +10,10 @@ class ModalBottomSheetDemo extends StatelessWidget {
@override @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: const Text('Modal bottom sheet')),
body: new Center( body: new Center(
child: new RaisedButton( child: new RaisedButton(
child: new Text('SHOW BOTTOM SHEET'), child: const Text('SHOW BOTTOM SHEET'),
onPressed: () { onPressed: () {
showModalBottomSheet<Null>(context: context, builder: (BuildContext context) { showModalBottomSheet<Null>(context: context, builder: (BuildContext context) {
return new Container( return new Container(
......
...@@ -29,7 +29,7 @@ class OverscrollDemoState extends State<OverscrollDemo> { ...@@ -29,7 +29,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
new Timer(const Duration(seconds: 3), () { completer.complete(null); }); new Timer(const Duration(seconds: 3), () { completer.complete(null); });
return completer.future.then((_) { return completer.future.then((_) {
_scaffoldKey.currentState?.showSnackBar(new SnackBar( _scaffoldKey.currentState?.showSnackBar(new SnackBar(
content: new Text("Refresh complete"), content: const Text("Refresh complete"),
action: new SnackBarAction( action: new SnackBarAction(
label: 'RETRY', label: 'RETRY',
onPressed: () { onPressed: () {
...@@ -45,10 +45,10 @@ class OverscrollDemoState extends State<OverscrollDemo> { ...@@ -45,10 +45,10 @@ class OverscrollDemoState extends State<OverscrollDemo> {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Pull to refresh'), title: const Text('Pull to refresh'),
actions: <Widget>[ actions: <Widget>[
new IconButton( new IconButton(
icon: new Icon(Icons.refresh), icon: const Icon(Icons.refresh),
tooltip: 'Refresh', tooltip: 'Refresh',
onPressed: () { onPressed: () {
_refreshIndicatorKey.currentState.show(); _refreshIndicatorKey.currentState.show();
...@@ -68,7 +68,7 @@ class OverscrollDemoState extends State<OverscrollDemo> { ...@@ -68,7 +68,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
isThreeLine: true, isThreeLine: true,
leading: new CircleAvatar(child: new Text(item)), leading: new CircleAvatar(child: new Text(item)),
title: new Text('This item represents $item.'), title: new Text('This item represents $item.'),
subtitle: new Text('Even more additional list item information appears on line three.'), subtitle: const Text('Even more additional list item information appears on line three.'),
); );
}, },
), ),
......
...@@ -26,14 +26,14 @@ class _PageSelector extends StatelessWidget { ...@@ -26,14 +26,14 @@ class _PageSelector extends StatelessWidget {
child: new Row( child: new Row(
children: <Widget>[ children: <Widget>[
new IconButton( new IconButton(
icon: new Icon(Icons.chevron_left), icon: const Icon(Icons.chevron_left),
color: color, color: color,
onPressed: () { _handleArrowButtonPress(context, -1); }, onPressed: () { _handleArrowButtonPress(context, -1); },
tooltip: 'Page back' tooltip: 'Page back'
), ),
new TabPageSelector(controller: controller), new TabPageSelector(controller: controller),
new IconButton( new IconButton(
icon: new Icon(Icons.chevron_right), icon: const Icon(Icons.chevron_right),
color: color, color: color,
onPressed: () { _handleArrowButtonPress(context, 1); }, onPressed: () { _handleArrowButtonPress(context, 1); },
tooltip: 'Page forward' tooltip: 'Page forward'
...@@ -76,7 +76,7 @@ class PageSelectorDemo extends StatelessWidget { ...@@ -76,7 +76,7 @@ class PageSelectorDemo extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Page selector')), appBar: new AppBar(title: const Text('Page selector')),
body: new DefaultTabController( body: new DefaultTabController(
length: icons.length, length: icons.length,
child: new _PageSelector(icons: icons), child: new _PageSelector(icons: icons),
......
...@@ -57,11 +57,11 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> { ...@@ -57,11 +57,11 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
showDialog<Null>( showDialog<Null>(
context: context, context: context,
child: new AlertDialog( child: new AlertDialog(
content: new Text('You tapped the floating action button.'), content: const Text('You tapped the floating action button.'),
actions: <Widget>[ actions: <Widget>[
new FlatButton( new FlatButton(
onPressed: () { Navigator.pop(context); }, onPressed: () { Navigator.pop(context); },
child: new Text('OK') child: const Text('OK')
) )
] ]
) )
...@@ -72,16 +72,16 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> { ...@@ -72,16 +72,16 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: new AppBar(title: new Text('Persistent bottom sheet')), appBar: new AppBar(title: const Text('Persistent bottom sheet')),
floatingActionButton: new FloatingActionButton( floatingActionButton: new FloatingActionButton(
onPressed: _showMessage, onPressed: _showMessage,
backgroundColor: Colors.redAccent, backgroundColor: Colors.redAccent,
child: new Icon(Icons.add) child: const Icon(Icons.add)
), ),
body: new Center( body: new Center(
child: new RaisedButton( child: new RaisedButton(
onPressed: _showBottomSheetCallback, onPressed: _showBottomSheetCallback,
child: new Text('SHOW BOTTOM SHEET') child: const Text('SHOW BOTTOM SHEET')
) )
) )
); );
......
...@@ -25,7 +25,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing ...@@ -25,7 +25,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
_animation = new CurvedAnimation( _animation = new CurvedAnimation(
parent: _controller, parent: _controller,
curve: new Interval(0.0, 0.9, curve: Curves.fastOutSlowIn), curve: const Interval(0.0, 0.9, curve: Curves.fastOutSlowIn),
reverseCurve: Curves.fastOutSlowIn reverseCurve: Curves.fastOutSlowIn
)..addStatusListener((AnimationStatus status) { )..addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.dismissed) if (status == AnimationStatus.dismissed)
...@@ -99,7 +99,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing ...@@ -99,7 +99,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
@override @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: const Text('Progress indicators')),
body: new Center( body: new Center(
child: new SingleChildScrollView( child: new SingleChildScrollView(
child: new DefaultTextStyle( child: new DefaultTextStyle(
......
...@@ -59,22 +59,22 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke ...@@ -59,22 +59,22 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
final Color iconColor = Theme.of(context).accentColor; final Color iconColor = Theme.of(context).accentColor;
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Scrollable tabs'), title: const Text('Scrollable tabs'),
actions: <Widget>[ actions: <Widget>[
new PopupMenuButton<TabsDemoStyle>( new PopupMenuButton<TabsDemoStyle>(
onSelected: changeDemoStyle, onSelected: changeDemoStyle,
itemBuilder: (BuildContext context) => <PopupMenuItem<TabsDemoStyle>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<TabsDemoStyle>>[
new PopupMenuItem<TabsDemoStyle>( new PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.iconsAndText, value: TabsDemoStyle.iconsAndText,
child: new Text('Icons and text') child: const Text('Icons and text')
), ),
new PopupMenuItem<TabsDemoStyle>( new PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.iconsOnly, value: TabsDemoStyle.iconsOnly,
child: new Text('Icons only') child: const Text('Icons only')
), ),
new PopupMenuItem<TabsDemoStyle>( new PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.textOnly, value: TabsDemoStyle.textOnly,
child: new Text('Text only') child: const Text('Text only')
), ),
], ],
), ),
......
...@@ -18,7 +18,7 @@ class _SliderDemoState extends State<SliderDemo> { ...@@ -18,7 +18,7 @@ class _SliderDemoState extends State<SliderDemo> {
@override @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: const Text('Sliders')),
body: new Center( body: new Center(
child: new Column( child: new Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
...@@ -37,14 +37,14 @@ class _SliderDemoState extends State<SliderDemo> { ...@@ -37,14 +37,14 @@ class _SliderDemoState extends State<SliderDemo> {
}); });
} }
), ),
new Text('Continuous'), const Text('Continuous'),
] ]
), ),
new Column( new Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget> [ children: <Widget> [
new Slider(value: 0.25, thumbOpenAtMin: true, onChanged: null), new Slider(value: 0.25, thumbOpenAtMin: true, onChanged: null),
new Text('Disabled'), const Text('Disabled'),
] ]
), ),
new Column( new Column(
...@@ -63,7 +63,7 @@ class _SliderDemoState extends State<SliderDemo> { ...@@ -63,7 +63,7 @@ class _SliderDemoState extends State<SliderDemo> {
}); });
} }
), ),
new Text('Discrete'), const Text('Discrete'),
], ],
), ),
], ],
......
...@@ -32,11 +32,11 @@ class _SnackBarDemoState extends State<SnackBarDemo> { ...@@ -32,11 +32,11 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
return new ListView( return new ListView(
padding: const EdgeInsets.all(24.0), padding: const EdgeInsets.all(24.0),
children: <Widget>[ children: <Widget>[
new Text(_text1), const Text(_text1),
new Text(_text2), const Text(_text2),
new Center( new Center(
child: new RaisedButton( child: new RaisedButton(
child: new Text('SHOW A SNACKBAR'), child: const Text('SHOW A SNACKBAR'),
onPressed: () { onPressed: () {
final int thisSnackBarIndex = _snackBarIndex++; final int thisSnackBarIndex = _snackBarIndex++;
Scaffold.of(context).showSnackBar(new SnackBar( Scaffold.of(context).showSnackBar(new SnackBar(
...@@ -53,7 +53,7 @@ class _SnackBarDemoState extends State<SnackBarDemo> { ...@@ -53,7 +53,7 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
} }
) )
), ),
new Text(_text3), const Text(_text3),
] ]
.map((Widget child) { .map((Widget child) {
return new Container( return new Container(
...@@ -69,7 +69,7 @@ class _SnackBarDemoState extends State<SnackBarDemo> { ...@@ -69,7 +69,7 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Snackbar') title: const Text('Snackbar')
), ),
body: new Builder( body: new Builder(
// Create an inner BuildContext so that the snackBar onPressed methods // Create an inner BuildContext so that the snackBar onPressed methods
......
...@@ -120,7 +120,7 @@ class TabsDemo extends StatelessWidget { ...@@ -120,7 +120,7 @@ class TabsDemo extends StatelessWidget {
length: _allPages.length, length: _allPages.length,
child: new Scaffold( child: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Tabs and scrolling'), title: const Text('Tabs and scrolling'),
bottom: new TabBar( bottom: new TabBar(
tabs: _allPages.keys.map((_Page page) => new Tab(text: page.label)).toList(), tabs: _allPages.keys.map((_Page page) => new Tab(text: page.label)).toList(),
), ),
......
...@@ -106,7 +106,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat ...@@ -106,7 +106,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('FAB per tab'), title: const Text('FAB per tab'),
bottom: new TabBar( bottom: new TabBar(
controller: _controller, controller: _controller,
tabs: _allPages.map((_Page page) => new Tab(text: page.label.toUpperCase())).toList(), tabs: _allPages.map((_Page page) => new Tab(text: page.label.toUpperCase())).toList(),
......
...@@ -83,15 +83,15 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> { ...@@ -83,15 +83,15 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
return await showDialog<bool>( return await showDialog<bool>(
context: context, context: context,
child: new AlertDialog( child: new AlertDialog(
title: new Text('This form has errors'), title: const Text('This form has errors'),
content: new Text('Really leave this form?'), content: const Text('Really leave this form?'),
actions: <Widget> [ actions: <Widget> [
new FlatButton( new FlatButton(
child: new Text('YES'), child: const Text('YES'),
onPressed: () { Navigator.of(context).pop(true); }, onPressed: () { Navigator.of(context).pop(true); },
), ),
new FlatButton( new FlatButton(
child: new Text('NO'), child: const Text('NO'),
onPressed: () { Navigator.of(context).pop(false); }, onPressed: () { Navigator.of(context).pop(false); },
), ),
], ],
...@@ -104,7 +104,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> { ...@@ -104,7 +104,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Text fields'), title: const Text('Text fields'),
), ),
body: new Form( body: new Form(
key: _formKey, key: _formKey,
...@@ -170,7 +170,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> { ...@@ -170,7 +170,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
alignment: const FractionalOffset(0.5, 0.5), alignment: const FractionalOffset(0.5, 0.5),
child: new RaisedButton( child: new RaisedButton(
child: new Text('SUBMIT'), child: const Text('SUBMIT'),
onPressed: _handleSubmitted, onPressed: _handleSubmitted,
), ),
), ),
......
...@@ -18,7 +18,7 @@ class TooltipDemo extends StatelessWidget { ...@@ -18,7 +18,7 @@ class TooltipDemo extends StatelessWidget {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Tooltips') title: const Text('Tooltips')
), ),
body: new Builder( body: new Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
...@@ -42,12 +42,12 @@ class TooltipDemo extends StatelessWidget { ...@@ -42,12 +42,12 @@ class TooltipDemo extends StatelessWidget {
new Center( new Center(
child: new IconButton( child: new IconButton(
iconSize: 48.0, iconSize: 48.0,
icon: new Icon(Icons.call), icon: const Icon(Icons.call),
color: theme.iconTheme.color, color: theme.iconTheme.color,
tooltip: 'Place a phone call', tooltip: 'Place a phone call',
onPressed: () { onPressed: () {
Scaffold.of(context).showSnackBar(new SnackBar( Scaffold.of(context).showSnackBar(new SnackBar(
content: new Text('That was an ordinary tap.') content: const Text('That was an ordinary tap.')
)); ));
} }
) )
......
...@@ -10,23 +10,23 @@ class TwoLevelListDemo extends StatelessWidget { ...@@ -10,23 +10,23 @@ class TwoLevelListDemo extends StatelessWidget {
@override @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: const Text('Expand/collapse list control')),
body: new TwoLevelList( body: new TwoLevelList(
type: MaterialListType.oneLine, type: MaterialListType.oneLine,
children: <Widget>[ children: <Widget>[
new TwoLevelListItem(title: new Text('Top')), new TwoLevelListItem(title: const Text('Top')),
new TwoLevelSublist( new TwoLevelSublist(
title: new Text('Sublist'), title: const Text('Sublist'),
backgroundColor: Theme.of(context).accentColor.withOpacity(0.025), backgroundColor: Theme.of(context).accentColor.withOpacity(0.025),
children: <Widget>[ children: <Widget>[
new TwoLevelListItem(title: new Text('One')), new TwoLevelListItem(title: const Text('One')),
new TwoLevelListItem(title: new Text('Two')), new TwoLevelListItem(title: const Text('Two')),
// https://en.wikipedia.org/wiki/Free_Four // https://en.wikipedia.org/wiki/Free_Four
new TwoLevelListItem(title: new Text('Free')), new TwoLevelListItem(title: const Text('Free')),
new TwoLevelListItem(title: new Text('Four')) new TwoLevelListItem(title: const Text('Four'))
] ]
), ),
new TwoLevelListItem(title: new Text('Bottom')) new TwoLevelListItem(title: const Text('Bottom'))
] ]
) )
); );
......
...@@ -82,10 +82,10 @@ class _RecipeGridPageState extends State<RecipeGridPage> { ...@@ -82,10 +82,10 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
child: new Scaffold( child: new Scaffold(
key: scaffoldKey, key: scaffoldKey,
floatingActionButton: new FloatingActionButton( floatingActionButton: new FloatingActionButton(
child: new Icon(Icons.edit), child: const Icon(Icons.edit),
onPressed: () { onPressed: () {
scaffoldKey.currentState.showSnackBar(new SnackBar( scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('Not supported.'), content: const Text('Not supported.'),
)); ));
}, },
), ),
...@@ -105,11 +105,11 @@ class _RecipeGridPageState extends State<RecipeGridPage> { ...@@ -105,11 +105,11 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
expandedHeight: _kAppBarHeight, expandedHeight: _kAppBarHeight,
actions: <Widget>[ actions: <Widget>[
new IconButton( new IconButton(
icon: new Icon(Icons.search), icon: const Icon(Icons.search),
tooltip: 'Search', tooltip: 'Search',
onPressed: () { onPressed: () {
scaffoldKey.currentState.showSnackBar(new SnackBar( scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('Not supported.'), content: const Text('Not supported.'),
)); ));
}, },
), ),
......
...@@ -181,7 +181,7 @@ class _Heading extends StatelessWidget { ...@@ -181,7 +181,7 @@ class _Heading extends StatelessWidget {
), ),
new LayoutId( new LayoutId(
id: _HeadingLayout.icon, id: _HeadingLayout.icon,
child: new Icon( child: const Icon(
Icons.info_outline, Icons.info_outline,
size: 24.0, size: 24.0,
color: const Color(0xFFFFE0E0), color: const Color(0xFFFFE0E0),
...@@ -275,7 +275,7 @@ class _OrderPageState extends State<OrderPage> { ...@@ -275,7 +275,7 @@ class _OrderPageState extends State<OrderPage> {
); );
}, },
backgroundColor: const Color(0xFF16F0F0), backgroundColor: const Color(0xFF16F0F0),
child: new Icon( child: const Icon(
Icons.add_shopping_cart, Icons.add_shopping_cart,
color: Colors.black, color: Colors.black,
), ),
......
...@@ -54,9 +54,9 @@ class ShrinePageState extends State<ShrinePage> { ...@@ -54,9 +54,9 @@ class ShrinePageState extends State<ShrinePage> {
void _showShoppingCart() { void _showShoppingCart() {
showModalBottomSheet<Null>(context: context, builder: (BuildContext context) { showModalBottomSheet<Null>(context: context, builder: (BuildContext context) {
if (config.shoppingCart.isEmpty) { if (config.shoppingCart.isEmpty) {
return new Padding( return const Padding(
padding: const EdgeInsets.all(24.0), padding: const EdgeInsets.all(24.0),
child: new Text('The shopping cart is empty') child: const Text('The shopping cart is empty')
); );
} }
return new ListView( return new ListView(
...@@ -82,7 +82,7 @@ class ShrinePageState extends State<ShrinePage> { ...@@ -82,7 +82,7 @@ class ShrinePageState extends State<ShrinePage> {
void _emptyCart() { void _emptyCart() {
config.shoppingCart.clear(); config.shoppingCart.clear();
config.scaffoldKey.currentState.showSnackBar(new SnackBar(content: new Text('Shopping cart is empty'))); config.scaffoldKey.currentState.showSnackBar(new SnackBar(content: const Text('Shopping cart is empty')));
} }
@override @override
...@@ -107,7 +107,7 @@ class ShrinePageState extends State<ShrinePage> { ...@@ -107,7 +107,7 @@ class ShrinePageState extends State<ShrinePage> {
), ),
actions: <Widget>[ actions: <Widget>[
new IconButton( new IconButton(
icon: new Icon(Icons.shopping_cart), icon: const Icon(Icons.shopping_cart),
tooltip: 'Shopping cart', tooltip: 'Shopping cart',
onPressed: _showShoppingCart onPressed: _showShoppingCart
), ),
...@@ -115,15 +115,15 @@ class ShrinePageState extends State<ShrinePage> { ...@@ -115,15 +115,15 @@ class ShrinePageState extends State<ShrinePage> {
itemBuilder: (BuildContext context) => <PopupMenuItem<ShrineAction>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<ShrineAction>>[
new PopupMenuItem<ShrineAction>( new PopupMenuItem<ShrineAction>(
value: ShrineAction.sortByPrice, value: ShrineAction.sortByPrice,
child: new Text('Sort by price') child: const Text('Sort by price')
), ),
new PopupMenuItem<ShrineAction>( new PopupMenuItem<ShrineAction>(
value: ShrineAction.sortByProduct, value: ShrineAction.sortByProduct,
child: new Text('Sort by product') child: const Text('Sort by product')
), ),
new PopupMenuItem<ShrineAction>( new PopupMenuItem<ShrineAction>(
value: ShrineAction.emptyCart, value: ShrineAction.emptyCart,
child: new Text('Empty shopping cart') child: const Text('Empty shopping cart')
) )
], ],
onSelected: (ShrineAction action) { onSelected: (ShrineAction action) {
......
...@@ -71,7 +71,7 @@ class TypographyDemo extends StatelessWidget { ...@@ -71,7 +71,7 @@ class TypographyDemo extends StatelessWidget {
} }
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Typography')), appBar: new AppBar(title: const Text('Typography')),
body: new ListView(children: styleItems) body: new ListView(children: styleItems)
); );
} }
......
...@@ -61,7 +61,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget { ...@@ -61,7 +61,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
new Builder( new Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return new IconButton( return new IconButton(
icon: new Icon(Icons.description), icon: const Icon(Icons.description),
tooltip: 'Show example code', tooltip: 'Show example code',
onPressed: () { onPressed: () {
_showExampleCode(context); _showExampleCode(context);
...@@ -150,10 +150,10 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> { ...@@ -150,10 +150,10 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
leading: new IconButton( leading: new IconButton(
icon: new Icon(Icons.clear), icon: const Icon(Icons.clear),
onPressed: () { Navigator.pop(context); } onPressed: () { Navigator.pop(context); }
), ),
title: new Text('Example code') title: const Text('Example code')
), ),
body: body body: body
); );
......
...@@ -127,8 +127,8 @@ class GalleryDrawer extends StatelessWidget { ...@@ -127,8 +127,8 @@ class GalleryDrawer extends StatelessWidget {
final TextStyle linkStyle = themeData.textTheme.body2.copyWith(color: themeData.accentColor); final TextStyle linkStyle = themeData.textTheme.body2.copyWith(color: themeData.accentColor);
final Widget lightThemeItem = new ListTile( final Widget lightThemeItem = new ListTile(
leading: new Icon(Icons.brightness_5), leading: const Icon(Icons.brightness_5),
title: new Text('Light'), title: const Text('Light'),
trailing: new Radio<bool>( trailing: new Radio<bool>(
value: true, value: true,
groupValue: useLightTheme, groupValue: useLightTheme,
...@@ -141,8 +141,8 @@ class GalleryDrawer extends StatelessWidget { ...@@ -141,8 +141,8 @@ class GalleryDrawer extends StatelessWidget {
); );
final Widget darkThemeItem = new ListTile( final Widget darkThemeItem = new ListTile(
leading: new Icon(Icons.brightness_7), leading: const Icon(Icons.brightness_7),
title: new Text('Dark'), title: const Text('Dark'),
trailing: new Radio<bool>( trailing: new Radio<bool>(
value: false, value: false,
groupValue: useLightTheme, groupValue: useLightTheme,
...@@ -157,7 +157,7 @@ class GalleryDrawer extends StatelessWidget { ...@@ -157,7 +157,7 @@ class GalleryDrawer extends StatelessWidget {
final Widget mountainViewItem = new ListTile( final Widget mountainViewItem = new ListTile(
// on iOS, we don't want to show an Android phone icon // on iOS, we don't want to show an Android phone icon
leading: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star : Icons.phone_android), leading: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star : Icons.phone_android),
title: new Text('Android'), title: const Text('Android'),
trailing: new Radio<TargetPlatform>( trailing: new Radio<TargetPlatform>(
value: TargetPlatform.android, value: TargetPlatform.android,
groupValue: Theme.of(context).platform, groupValue: Theme.of(context).platform,
...@@ -172,7 +172,7 @@ class GalleryDrawer extends StatelessWidget { ...@@ -172,7 +172,7 @@ class GalleryDrawer extends StatelessWidget {
final Widget cupertinoItem = new ListTile( final Widget cupertinoItem = new ListTile(
// on iOS, we don't want to show the iPhone icon // on iOS, we don't want to show the iPhone icon
leading: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star_border : Icons.phone_iphone), leading: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star_border : Icons.phone_iphone),
title: new Text('iOS'), title: const Text('iOS'),
trailing: new Radio<TargetPlatform>( trailing: new Radio<TargetPlatform>(
value: TargetPlatform.iOS, value: TargetPlatform.iOS,
groupValue: Theme.of(context).platform, groupValue: Theme.of(context).platform,
...@@ -185,8 +185,8 @@ class GalleryDrawer extends StatelessWidget { ...@@ -185,8 +185,8 @@ class GalleryDrawer extends StatelessWidget {
); );
final Widget animateSlowlyItem = new ListTile( final Widget animateSlowlyItem = new ListTile(
leading: new Icon(Icons.hourglass_empty), leading: const Icon(Icons.hourglass_empty),
title: new Text('Animate Slowly'), title: const Text('Animate Slowly'),
trailing: new Checkbox( trailing: new Checkbox(
value: timeDilation != 1.0, value: timeDilation != 1.0,
onChanged: (bool value) { onChanged: (bool value) {
...@@ -200,8 +200,8 @@ class GalleryDrawer extends StatelessWidget { ...@@ -200,8 +200,8 @@ class GalleryDrawer extends StatelessWidget {
); );
final Widget sendFeedbackItem = new ListTile( final Widget sendFeedbackItem = new ListTile(
leading: new Icon(Icons.report), leading: const Icon(Icons.report),
title: new Text('Send feedback'), title: const Text('Send feedback'),
onTap: onSendFeedback ?? () { onTap: onSendFeedback ?? () {
UrlLauncher.launch('https://github.com/flutter/flutter/issues/new'); UrlLauncher.launch('https://github.com/flutter/flutter/issues/new');
}, },
...@@ -266,8 +266,8 @@ class GalleryDrawer extends StatelessWidget { ...@@ -266,8 +266,8 @@ class GalleryDrawer extends StatelessWidget {
if (onShowPerformanceOverlayChanged != null) { if (onShowPerformanceOverlayChanged != null) {
allDrawerItems.insert(8, new ListTile( allDrawerItems.insert(8, new ListTile(
leading: new Icon(Icons.assessment), leading: const Icon(Icons.assessment),
title: new Text('Performance Overlay'), title: const Text('Performance Overlay'),
trailing: new Checkbox( trailing: new Checkbox(
value: showPerformanceOverlay, value: showPerformanceOverlay,
onChanged: (bool value) { onChanged: (bool value) {
...@@ -283,8 +283,8 @@ class GalleryDrawer extends StatelessWidget { ...@@ -283,8 +283,8 @@ class GalleryDrawer extends StatelessWidget {
if (onCheckerboardRasterCacheImagesChanged != null) { if (onCheckerboardRasterCacheImagesChanged != null) {
allDrawerItems.insert(8, new ListTile( allDrawerItems.insert(8, new ListTile(
leading: new Icon(Icons.assessment), leading: const Icon(Icons.assessment),
title: new Text('Checkerboard Raster Cache Images'), title: const Text('Checkerboard Raster Cache Images'),
trailing: new Checkbox( trailing: new Checkbox(
value: checkerboardRasterCacheImages, value: checkerboardRasterCacheImages,
onChanged: (bool value) { onChanged: (bool value) {
......
...@@ -16,7 +16,7 @@ class ButtonsDemo { ...@@ -16,7 +16,7 @@ class ButtonsDemo {
// START buttons_raised // START buttons_raised
// Create a raised button. // Create a raised button.
new RaisedButton( new RaisedButton(
child: new Text('BUTTON TITLE'), child: const Text('BUTTON TITLE'),
onPressed: () { onPressed: () {
// Perform some action // Perform some action
} }
...@@ -26,7 +26,7 @@ new RaisedButton( ...@@ -26,7 +26,7 @@ new RaisedButton(
// Buttons are disabled when onPressed isn't // Buttons are disabled when onPressed isn't
// specified or is null. // specified or is null.
new RaisedButton( new RaisedButton(
child: new Text('BUTTON TITLE'), child: const Text('BUTTON TITLE'),
onPressed: null onPressed: null
); );
// END // END
...@@ -35,7 +35,7 @@ new RaisedButton( ...@@ -35,7 +35,7 @@ new RaisedButton(
// START buttons_flat // START buttons_flat
// Create a flat button. // Create a flat button.
new FlatButton( new FlatButton(
child: new Text('BUTTON TITLE'), child: const Text('BUTTON TITLE'),
onPressed: () { onPressed: () {
// Perform some action // Perform some action
} }
...@@ -45,7 +45,7 @@ new FlatButton( ...@@ -45,7 +45,7 @@ new FlatButton(
// Buttons are disabled when onPressed isn't // Buttons are disabled when onPressed isn't
// specified or is null. // specified or is null.
new FlatButton( new FlatButton(
child: new Text('BUTTON TITLE'), child: const Text('BUTTON TITLE'),
onPressed: null onPressed: null
); );
// END // END
...@@ -83,7 +83,7 @@ bool value; ...@@ -83,7 +83,7 @@ bool value;
// Toggleable icon button. // Toggleable icon button.
new IconButton( new IconButton(
icon: new Icon(Icons.thumb_up), icon: const Icon(Icons.thumb_up),
onPressed: () { onPressed: () {
setState(() => value = !value); setState(() => value = !value);
}, },
...@@ -96,10 +96,10 @@ new IconButton( ...@@ -96,10 +96,10 @@ new IconButton(
// Floating action button in Scaffold. // Floating action button in Scaffold.
new Scaffold( new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Demo') title: const Text('Demo')
), ),
floatingActionButton: new FloatingActionButton( floatingActionButton: const FloatingActionButton(
child: new Icon(Icons.add), child: const Icon(Icons.add),
onPressed: null onPressed: null
) )
); );
......
...@@ -170,7 +170,7 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState ...@@ -170,7 +170,7 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState
pinned: true, pinned: true,
expandedHeight: _kFlexibleSpaceMaxHeight, expandedHeight: _kFlexibleSpaceMaxHeight,
flexibleSpace: new FlexibleSpaceBar( flexibleSpace: new FlexibleSpaceBar(
title: new Text('Flutter Gallery'), title: const Text('Flutter Gallery'),
// TODO(abarth): Wire up to the parallax in a way that doesn't pop during hero transition. // TODO(abarth): Wire up to the parallax in a way that doesn't pop during hero transition.
background: new _AppBarBackground(animation: kAlwaysDismissedAnimation), background: new _AppBarBackground(animation: kAlwaysDismissedAnimation),
), ),
...@@ -194,7 +194,7 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState ...@@ -194,7 +194,7 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState
home, home,
new FadeTransition( new FadeTransition(
opacity: new CurvedAnimation(parent: _controller, curve: Curves.easeInOut), opacity: new CurvedAnimation(parent: _controller, curve: Curves.easeInOut),
child: new Banner( child: const Banner(
message: 'PREVIEW', message: 'PREVIEW',
location: BannerLocation.topRight, location: BannerLocation.topRight,
) )
......
...@@ -51,16 +51,16 @@ class UpdaterState extends State<Updater> { ...@@ -51,16 +51,16 @@ class UpdaterState extends State<Updater> {
final TextStyle dialogTextStyle = final TextStyle dialogTextStyle =
theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color); theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
return new AlertDialog( return new AlertDialog(
title: new Text('Update Flutter Gallery?'), title: const Text('Update Flutter Gallery?'),
content: new Text('A newer version is available.', style: dialogTextStyle), content: new Text('A newer version is available.', style: dialogTextStyle),
actions: <Widget>[ actions: <Widget>[
new FlatButton( new FlatButton(
child: new Text('NO THANKS'), child: const Text('NO THANKS'),
onPressed: () { onPressed: () {
Navigator.pop(context, false); Navigator.pop(context, false);
}), }),
new FlatButton( new FlatButton(
child: new Text('UPDATE'), child: const Text('UPDATE'),
onPressed: () { onPressed: () {
Navigator.pop(context, true); Navigator.pop(context, true);
}), }),
......
...@@ -61,7 +61,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -61,7 +61,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: new Center( child: new Center(
child: new Text( child: new Text(
'Platform button tapped $_counter time${ _counter == 1 ? '' : 's' }.', 'Platform button tapped $_counter time${ _counter == 1 ? '' : 's' }.',
style: new TextStyle(fontSize: 17.0)) style: const TextStyle(fontSize: 17.0))
), ),
), ),
new Container( new Container(
...@@ -69,7 +69,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -69,7 +69,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: new Row( child: new Row(
children: <Widget>[ children: <Widget>[
new Image.asset('assets/flutter-mark-square-64.png', scale: 1.5), new Image.asset('assets/flutter-mark-square-64.png', scale: 1.5),
new Text('Flutter', style: new TextStyle(fontSize: 30.0)), const Text('Flutter', style: const TextStyle(fontSize: 30.0)),
], ],
), ),
), ),
...@@ -77,7 +77,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -77,7 +77,7 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
floatingActionButton: new FloatingActionButton( floatingActionButton: new FloatingActionButton(
onPressed: _sendFlutterIncrement, onPressed: _sendFlutterIncrement,
child: new Icon(Icons.add), child: const Icon(Icons.add),
), ),
); );
} }
......
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
void main() => runApp(new Center(child: new Text('Hello, world!'))); void main() => runApp(const Center(child: const Text('Hello, world!')));
...@@ -102,8 +102,8 @@ class RenderDots extends RenderBox { ...@@ -102,8 +102,8 @@ class RenderDots extends RenderBox {
void main() { void main() {
// Create some styled text to tell the user to interact with the app. // Create some styled text to tell the user to interact with the app.
final RenderParagraph paragraph = new RenderParagraph( final RenderParagraph paragraph = new RenderParagraph(
new TextSpan( const TextSpan(
style: new TextStyle(color: Colors.black87), style: const TextStyle(color: Colors.black87),
text: "Touch me!" text: "Touch me!"
) )
); );
......
...@@ -35,7 +35,7 @@ class _LifecycleWatcherState extends State<LifecycleWatcher> ...@@ -35,7 +35,7 @@ class _LifecycleWatcherState extends State<LifecycleWatcher>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (_lastLifecyleState == null) if (_lastLifecyleState == null)
return new Text('This widget has not observed any lifecycle changes.'); return const Text('This widget has not observed any lifecycle changes.');
return new Text('The most recent lifecycle state this widget observed was: $_lastLifecyleState.'); return new Text('The most recent lifecycle state this widget observed was: $_lastLifecyleState.');
} }
} }
......
...@@ -46,5 +46,5 @@ class Dots extends SingleChildRenderObjectWidget { ...@@ -46,5 +46,5 @@ class Dots extends SingleChildRenderObjectWidget {
} }
void main() { void main() {
runApp(new Dots(child: new Center(child: new Text('Touch me!')))); runApp(new Dots(child: const Center(child: const Text('Touch me!'))));
} }
...@@ -188,7 +188,7 @@ class _GestureDemoState extends State<GestureDemo> { ...@@ -188,7 +188,7 @@ class _GestureDemoState extends State<GestureDemo> {
value: _scaleEnabled, value: _scaleEnabled,
onChanged: (bool value) { setState(() { _scaleEnabled = value; }); } onChanged: (bool value) { setState(() { _scaleEnabled = value; }); }
), ),
new Text('Scale'), const Text('Scale'),
] ]
), ),
new Row( new Row(
...@@ -197,7 +197,7 @@ class _GestureDemoState extends State<GestureDemo> { ...@@ -197,7 +197,7 @@ class _GestureDemoState extends State<GestureDemo> {
value: _tapEnabled, value: _tapEnabled,
onChanged: (bool value) { setState(() { _tapEnabled = value; }); } onChanged: (bool value) { setState(() { _tapEnabled = value; }); }
), ),
new Text('Tap'), const Text('Tap'),
] ]
), ),
new Row( new Row(
...@@ -206,7 +206,7 @@ class _GestureDemoState extends State<GestureDemo> { ...@@ -206,7 +206,7 @@ class _GestureDemoState extends State<GestureDemo> {
value: _doubleTapEnabled, value: _doubleTapEnabled,
onChanged: (bool value) { setState(() { _doubleTapEnabled = value; }); } onChanged: (bool value) { setState(() { _doubleTapEnabled = value; }); }
), ),
new Text('Double Tap'), const Text('Double Tap'),
] ]
), ),
new Row( new Row(
...@@ -215,7 +215,7 @@ class _GestureDemoState extends State<GestureDemo> { ...@@ -215,7 +215,7 @@ class _GestureDemoState extends State<GestureDemo> {
value: _longPressEnabled, value: _longPressEnabled,
onChanged: (bool value) { setState(() { _longPressEnabled = value; }); } onChanged: (bool value) { setState(() { _longPressEnabled = value; }); }
), ),
new Text('Long Press'), const Text('Long Press'),
] ]
), ),
], ],
...@@ -233,7 +233,7 @@ void main() { ...@@ -233,7 +233,7 @@ void main() {
runApp(new MaterialApp( runApp(new MaterialApp(
theme: new ThemeData.dark(), theme: new ThemeData.dark(),
home: new Scaffold( home: new Scaffold(
appBar: new AppBar(title: new Text('Gestures Demo')), appBar: new AppBar(title: const Text('Gestures Demo')),
body: new GestureDemo() body: new GestureDemo()
) )
)); ));
......
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
void main() => runApp(new Center(child: new Text('Hello, world!'))); void main() => runApp(const Center(child: const Text('Hello, world!')));
...@@ -51,8 +51,8 @@ class AdaptedGridItem extends StatelessWidget { ...@@ -51,8 +51,8 @@ class AdaptedGridItem extends StatelessWidget {
new Expanded( new Expanded(
child: new Text(name) child: new Text(name)
), ),
new IconButton( const IconButton(
icon: new Icon(Icons.more_vert), icon: const Icon(Icons.more_vert),
onPressed: null onPressed: null
) )
] ]
...@@ -103,7 +103,7 @@ void main() { ...@@ -103,7 +103,7 @@ void main() {
title: 'Media Query Example', title: 'Media Query Example',
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Media Query Example') title: const Text('Media Query Example')
), ),
body: new Material(child: new AdaptiveContainer(names: _kNames)) body: new Material(child: new AdaptiveContainer(names: _kNames))
) )
......
...@@ -106,7 +106,7 @@ class SectorAppState extends State<SectorApp> { ...@@ -106,7 +106,7 @@ class SectorAppState extends State<SectorApp> {
margin: const EdgeInsets.only(right: 10.0), margin: const EdgeInsets.only(right: 10.0),
child: new WidgetToRenderBoxAdapter(renderBox: sectorAddIcon) child: new WidgetToRenderBoxAdapter(renderBox: sectorAddIcon)
), ),
new Text('ADD SECTOR'), const Text('ADD SECTOR'),
] ]
) )
) )
...@@ -121,7 +121,7 @@ class SectorAppState extends State<SectorApp> { ...@@ -121,7 +121,7 @@ class SectorAppState extends State<SectorApp> {
margin: const EdgeInsets.only(right: 10.0), margin: const EdgeInsets.only(right: 10.0),
child: new WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon) child: new WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon)
), ),
new Text('REMOVE SECTOR'), const Text('REMOVE SECTOR'),
] ]
) )
) )
...@@ -155,7 +155,7 @@ class SectorAppState extends State<SectorApp> { ...@@ -155,7 +155,7 @@ class SectorAppState extends State<SectorApp> {
title: 'Sector Layout', title: 'Sector Layout',
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Sector Layout in a Widget Tree') title: const Text('Sector Layout in a Widget Tree')
), ),
body: buildBody() body: buildBody()
) )
......
...@@ -52,7 +52,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) { ...@@ -52,7 +52,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
child: new Row( child: new Row(
children: <Widget>[ children: <Widget>[
new Image.network('https://flutter.io/images/favicon.png'), new Image.network('https://flutter.io/images/favicon.png'),
new Text('PRESS ME'), const Text('PRESS ME'),
] ]
), ),
onPressed: () { onPressed: () {
......
...@@ -124,7 +124,7 @@ void main() { ...@@ -124,7 +124,7 @@ void main() {
theme: new ThemeData.light(), theme: new ThemeData.light(),
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Hal and Dave') title: const Text('Hal and Dave')
), ),
body: new Material( body: new Material(
color: Colors.grey.shade50, color: Colors.grey.shade50,
......
...@@ -62,11 +62,11 @@ class _PlatformChannelState extends State<PlatformChannel> { ...@@ -62,11 +62,11 @@ class _PlatformChannelState extends State<PlatformChannel> {
new Column( new Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
new Text(_batteryLevel, key: new Key('Battery level label')), new Text(_batteryLevel, key: const Key('Battery level label')),
new Padding( new Padding(
padding: new EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: new RaisedButton( child: new RaisedButton(
child: new Text('Refresh'), child: const Text('Refresh'),
onPressed: _getBatteryLevel, onPressed: _getBatteryLevel,
), ),
), ),
......
...@@ -37,10 +37,10 @@ class _PlatformChannelState extends State<PlatformChannel> { ...@@ -37,10 +37,10 @@ class _PlatformChannelState extends State<PlatformChannel> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
new RaisedButton( new RaisedButton(
child: new Text('Get Battery Level'), child: const Text('Get Battery Level'),
onPressed: _getBatteryLevel, onPressed: _getBatteryLevel,
), ),
new Text(_batteryLevel, key: new Key('Battery level label')), new Text(_batteryLevel, key: const Key('Battery level label')),
], ],
), ),
), ),
......
...@@ -20,21 +20,21 @@ class _NotImplementedDialog extends StatelessWidget { ...@@ -20,21 +20,21 @@ class _NotImplementedDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new AlertDialog( return new AlertDialog(
title: new Text('Not Implemented'), title: const Text('Not Implemented'),
content: new Text('This feature has not yet been implemented.'), content: const Text('This feature has not yet been implemented.'),
actions: <Widget>[ actions: <Widget>[
new FlatButton( new FlatButton(
onPressed: debugDumpApp, onPressed: debugDumpApp,
child: new Row( child: new Row(
children: <Widget>[ children: <Widget>[
new Icon( const Icon(
Icons.dvr, Icons.dvr,
size: 18.0, size: 18.0,
), ),
new Container( new Container(
width: 8.0, width: 8.0,
), ),
new Text('DUMP APP TO CONSOLE'), const Text('DUMP APP TO CONSOLE'),
], ],
), ),
), ),
...@@ -42,7 +42,7 @@ class _NotImplementedDialog extends StatelessWidget { ...@@ -42,7 +42,7 @@ class _NotImplementedDialog extends StatelessWidget {
onPressed: () { onPressed: () {
Navigator.pop(context, false); Navigator.pop(context, false);
}, },
child: new Text('OH WELL'), child: const Text('OH WELL'),
), ),
], ],
); );
...@@ -117,20 +117,20 @@ class StockHomeState extends State<StockHome> { ...@@ -117,20 +117,20 @@ class StockHomeState extends State<StockHome> {
return new Drawer( return new Drawer(
child: new ListView( child: new ListView(
children: <Widget>[ children: <Widget>[
new DrawerHeader(child: new Center(child: new Text('Stocks'))), const DrawerHeader(child: const Center(child: const Text('Stocks'))),
new ListTile( new ListTile(
leading: new Icon(Icons.assessment), leading: const Icon(Icons.assessment),
title: new Text('Stock List'), title: const Text('Stock List'),
selected: true, selected: true,
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.account_balance), leading: const Icon(Icons.account_balance),
title: new Text('Account Balance'), title: const Text('Account Balance'),
enabled: false, enabled: false,
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.dvr), leading: const Icon(Icons.dvr),
title: new Text('Dump App to Console'), title: const Text('Dump App to Console'),
onTap: () { onTap: () {
try { try {
debugDumpApp(); debugDumpApp();
...@@ -144,8 +144,8 @@ class StockHomeState extends State<StockHome> { ...@@ -144,8 +144,8 @@ class StockHomeState extends State<StockHome> {
), ),
new Divider(), new Divider(),
new ListTile( new ListTile(
leading: new Icon(Icons.thumb_up), leading: const Icon(Icons.thumb_up),
title: new Text('Optimistic'), title: const Text('Optimistic'),
trailing: new Radio<StockMode>( trailing: new Radio<StockMode>(
value: StockMode.optimistic, value: StockMode.optimistic,
groupValue: config.configuration.stockMode, groupValue: config.configuration.stockMode,
...@@ -156,8 +156,8 @@ class StockHomeState extends State<StockHome> { ...@@ -156,8 +156,8 @@ class StockHomeState extends State<StockHome> {
}, },
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.thumb_down), leading: const Icon(Icons.thumb_down),
title: new Text('Pessimistic'), title: const Text('Pessimistic'),
trailing: new Radio<StockMode>( trailing: new Radio<StockMode>(
value: StockMode.pessimistic, value: StockMode.pessimistic,
groupValue: config.configuration.stockMode, groupValue: config.configuration.stockMode,
...@@ -169,13 +169,13 @@ class StockHomeState extends State<StockHome> { ...@@ -169,13 +169,13 @@ class StockHomeState extends State<StockHome> {
), ),
new Divider(), new Divider(),
new ListTile( new ListTile(
leading: new Icon(Icons.settings), leading: const Icon(Icons.settings),
title: new Text('Settings'), title: const Text('Settings'),
onTap: _handleShowSettings, onTap: _handleShowSettings,
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.help), leading: const Icon(Icons.help),
title: new Text('About'), title: const Text('About'),
onTap: _handleShowAbout, onTap: _handleShowAbout,
), ),
], ],
...@@ -197,7 +197,7 @@ class StockHomeState extends State<StockHome> { ...@@ -197,7 +197,7 @@ class StockHomeState extends State<StockHome> {
title: new Text(StockStrings.of(context).title()), title: new Text(StockStrings.of(context).title()),
actions: <Widget>[ actions: <Widget>[
new IconButton( new IconButton(
icon: new Icon(Icons.search), icon: const Icon(Icons.search),
onPressed: _handleSearchBegin, onPressed: _handleSearchBegin,
tooltip: 'Search', tooltip: 'Search',
), ),
...@@ -207,19 +207,19 @@ class StockHomeState extends State<StockHome> { ...@@ -207,19 +207,19 @@ class StockHomeState extends State<StockHome> {
new CheckedPopupMenuItem<_StockMenuItem>( new CheckedPopupMenuItem<_StockMenuItem>(
value: _StockMenuItem.autorefresh, value: _StockMenuItem.autorefresh,
checked: _autorefresh, checked: _autorefresh,
child: new Text('Autorefresh'), child: const Text('Autorefresh'),
), ),
new PopupMenuItem<_StockMenuItem>( new PopupMenuItem<_StockMenuItem>(
value: _StockMenuItem.refresh, value: _StockMenuItem.refresh,
child: new Text('Refresh'), child: const Text('Refresh'),
), ),
new PopupMenuItem<_StockMenuItem>( new PopupMenuItem<_StockMenuItem>(
value: _StockMenuItem.speedUp, value: _StockMenuItem.speedUp,
child: new Text('Increase animation speed'), child: const Text('Increase animation speed'),
), ),
new PopupMenuItem<_StockMenuItem>( new PopupMenuItem<_StockMenuItem>(
value: _StockMenuItem.speedDown, value: _StockMenuItem.speedDown,
child: new Text('Decrease animation speed'), child: const Text('Decrease animation speed'),
), ),
], ],
), ),
...@@ -287,7 +287,7 @@ class StockHomeState extends State<StockHome> { ...@@ -287,7 +287,7 @@ class StockHomeState extends State<StockHome> {
Widget buildSearchBar() { Widget buildSearchBar() {
return new AppBar( return new AppBar(
leading: new IconButton( leading: new IconButton(
icon: new Icon(Icons.arrow_back), icon: const Icon(Icons.arrow_back),
color: Theme.of(context).accentColor, color: Theme.of(context).accentColor,
onPressed: _handleSearchEnd, onPressed: _handleSearchEnd,
tooltip: 'Back', tooltip: 'Back',
...@@ -313,7 +313,7 @@ class StockHomeState extends State<StockHome> { ...@@ -313,7 +313,7 @@ class StockHomeState extends State<StockHome> {
Widget buildFloatingActionButton() { Widget buildFloatingActionButton() {
return new FloatingActionButton( return new FloatingActionButton(
tooltip: 'Create company', tooltip: 'Create company',
child: new Icon(Icons.add), child: const Icon(Icons.add),
backgroundColor: Colors.redAccent, backgroundColor: Colors.redAccent,
onPressed: _handleCreateCompany, onPressed: _handleCreateCompany,
); );
......
...@@ -68,17 +68,17 @@ class StockSettingsState extends State<StockSettings> { ...@@ -68,17 +68,17 @@ class StockSettingsState extends State<StockSettings> {
showDialog<bool>( showDialog<bool>(
context: context, context: context,
child: new AlertDialog( child: new AlertDialog(
title: new Text("Change mode?"), title: const Text("Change mode?"),
content: new Text("Optimistic mode means everything is awesome. Are you sure you can handle that?"), content: const Text("Optimistic mode means everything is awesome. Are you sure you can handle that?"),
actions: <Widget>[ actions: <Widget>[
new FlatButton( new FlatButton(
child: new Text('NO THANKS'), child: const Text('NO THANKS'),
onPressed: () { onPressed: () {
Navigator.pop(context, false); Navigator.pop(context, false);
} }
), ),
new FlatButton( new FlatButton(
child: new Text('AGREE'), child: const Text('AGREE'),
onPressed: () { onPressed: () {
Navigator.pop(context, true); Navigator.pop(context, true);
} }
...@@ -97,15 +97,15 @@ class StockSettingsState extends State<StockSettings> { ...@@ -97,15 +97,15 @@ class StockSettingsState extends State<StockSettings> {
Widget buildAppBar(BuildContext context) { Widget buildAppBar(BuildContext context) {
return new AppBar( return new AppBar(
title: new Text('Settings') title: const Text('Settings')
); );
} }
Widget buildSettingsPane(BuildContext context) { Widget buildSettingsPane(BuildContext context) {
final List<Widget> rows = <Widget>[ final List<Widget> rows = <Widget>[
new ListTile( new ListTile(
leading: new Icon(Icons.thumb_up), leading: const Icon(Icons.thumb_up),
title: new Text('Everything is awesome'), title: const Text('Everything is awesome'),
onTap: _confirmOptimismChange, onTap: _confirmOptimismChange,
trailing: new Checkbox( trailing: new Checkbox(
value: config.configuration.stockMode == StockMode.optimistic, value: config.configuration.stockMode == StockMode.optimistic,
...@@ -113,8 +113,8 @@ class StockSettingsState extends State<StockSettings> { ...@@ -113,8 +113,8 @@ class StockSettingsState extends State<StockSettings> {
), ),
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.backup), leading: const Icon(Icons.backup),
title: new Text('Back up stock list to the cloud'), title: const Text('Back up stock list to the cloud'),
onTap: () { _handleBackupChanged(!(config.configuration.backupMode == BackupMode.enabled)); }, onTap: () { _handleBackupChanged(!(config.configuration.backupMode == BackupMode.enabled)); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.backupMode == BackupMode.enabled, value: config.configuration.backupMode == BackupMode.enabled,
...@@ -122,8 +122,8 @@ class StockSettingsState extends State<StockSettings> { ...@@ -122,8 +122,8 @@ class StockSettingsState extends State<StockSettings> {
), ),
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.picture_in_picture), leading: const Icon(Icons.picture_in_picture),
title: new Text('Show rendering performance overlay'), title: const Text('Show rendering performance overlay'),
onTap: () { _handleShowPerformanceOverlayChanged(!config.configuration.showPerformanceOverlay); }, onTap: () { _handleShowPerformanceOverlayChanged(!config.configuration.showPerformanceOverlay); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.showPerformanceOverlay, value: config.configuration.showPerformanceOverlay,
...@@ -131,8 +131,8 @@ class StockSettingsState extends State<StockSettings> { ...@@ -131,8 +131,8 @@ class StockSettingsState extends State<StockSettings> {
), ),
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.accessibility), leading: const Icon(Icons.accessibility),
title: new Text('Show semantics overlay'), title: const Text('Show semantics overlay'),
onTap: () { _handleShowSemanticsDebuggerChanged(!config.configuration.showSemanticsDebugger); }, onTap: () { _handleShowSemanticsDebuggerChanged(!config.configuration.showSemanticsDebugger); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.showSemanticsDebugger, value: config.configuration.showSemanticsDebugger,
...@@ -144,8 +144,8 @@ class StockSettingsState extends State<StockSettings> { ...@@ -144,8 +144,8 @@ class StockSettingsState extends State<StockSettings> {
// material grid and size construction lines are only available in checked mode // material grid and size construction lines are only available in checked mode
rows.addAll(<Widget>[ rows.addAll(<Widget>[
new ListTile( new ListTile(
leading: new Icon(Icons.border_clear), leading: const Icon(Icons.border_clear),
title: new Text('Show material grid (for debugging)'), title: const Text('Show material grid (for debugging)'),
onTap: () { _handleShowGridChanged(!config.configuration.debugShowGrid); }, onTap: () { _handleShowGridChanged(!config.configuration.debugShowGrid); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowGrid, value: config.configuration.debugShowGrid,
...@@ -153,8 +153,8 @@ class StockSettingsState extends State<StockSettings> { ...@@ -153,8 +153,8 @@ class StockSettingsState extends State<StockSettings> {
), ),
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.border_all), leading: const Icon(Icons.border_all),
title: new Text('Show construction lines (for debugging)'), title: const Text('Show construction lines (for debugging)'),
onTap: () { _handleShowSizesChanged(!config.configuration.debugShowSizes); }, onTap: () { _handleShowSizesChanged(!config.configuration.debugShowSizes); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowSizes, value: config.configuration.debugShowSizes,
...@@ -162,8 +162,8 @@ class StockSettingsState extends State<StockSettings> { ...@@ -162,8 +162,8 @@ class StockSettingsState extends State<StockSettings> {
), ),
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.format_color_text), leading: const Icon(Icons.format_color_text),
title: new Text('Show baselines (for debugging)'), title: const Text('Show baselines (for debugging)'),
onTap: () { _handleShowBaselinesChanged(!config.configuration.debugShowBaselines); }, onTap: () { _handleShowBaselinesChanged(!config.configuration.debugShowBaselines); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowBaselines, value: config.configuration.debugShowBaselines,
...@@ -171,8 +171,8 @@ class StockSettingsState extends State<StockSettings> { ...@@ -171,8 +171,8 @@ class StockSettingsState extends State<StockSettings> {
), ),
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.filter_none), leading: const Icon(Icons.filter_none),
title: new Text('Show layer boundaries (for debugging)'), title: const Text('Show layer boundaries (for debugging)'),
onTap: () { _handleShowLayersChanged(!config.configuration.debugShowLayers); }, onTap: () { _handleShowLayersChanged(!config.configuration.debugShowLayers); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowLayers, value: config.configuration.debugShowLayers,
...@@ -180,8 +180,8 @@ class StockSettingsState extends State<StockSettings> { ...@@ -180,8 +180,8 @@ class StockSettingsState extends State<StockSettings> {
), ),
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.mouse), leading: const Icon(Icons.mouse),
title: new Text('Show pointer hit-testing (for debugging)'), title: const Text('Show pointer hit-testing (for debugging)'),
onTap: () { _handleShowPointersChanged(!config.configuration.debugShowPointers); }, onTap: () { _handleShowPointersChanged(!config.configuration.debugShowPointers); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowPointers, value: config.configuration.debugShowPointers,
...@@ -189,8 +189,8 @@ class StockSettingsState extends State<StockSettings> { ...@@ -189,8 +189,8 @@ class StockSettingsState extends State<StockSettings> {
), ),
), ),
new ListTile( new ListTile(
leading: new Icon(Icons.gradient), leading: const Icon(Icons.gradient),
title: new Text('Show repaint rainbow (for debugging)'), title: const Text('Show repaint rainbow (for debugging)'),
onTap: () { _handleShowRainbowChanged(!config.configuration.debugShowRainbow); }, onTap: () { _handleShowRainbowChanged(!config.configuration.debugShowRainbow); },
trailing: new Switch( trailing: new Switch(
value: config.configuration.debugShowRainbow, value: config.configuration.debugShowRainbow,
......
...@@ -100,8 +100,8 @@ class StockSymbolBottomSheet extends StatelessWidget { ...@@ -100,8 +100,8 @@ class StockSymbolBottomSheet extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
decoration: new BoxDecoration( decoration: const BoxDecoration(
border: new Border(top: new BorderSide(color: Colors.black26)) border: const Border(top: const BorderSide(color: Colors.black26))
), ),
child: new _StockSymbolView( child: new _StockSymbolView(
stock: stock, stock: stock,
......
...@@ -290,7 +290,7 @@ class AboutDialog extends StatelessWidget { ...@@ -290,7 +290,7 @@ class AboutDialog extends StatelessWidget {
), ),
actions: <Widget>[ actions: <Widget>[
new FlatButton( new FlatButton(
child: new Text('VIEW LICENSES'), child: const Text('VIEW LICENSES'),
onPressed: () { onPressed: () {
showLicensePage( showLicensePage(
context: context, context: context,
...@@ -302,7 +302,7 @@ class AboutDialog extends StatelessWidget { ...@@ -302,7 +302,7 @@ class AboutDialog extends StatelessWidget {
} }
), ),
new FlatButton( new FlatButton(
child: new Text('CLOSE'), child: const Text('CLOSE'),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
} }
...@@ -377,9 +377,9 @@ class _LicensePageState extends State<LicensePage> { ...@@ -377,9 +377,9 @@ class _LicensePageState extends State<LicensePage> {
if (!mounted) if (!mounted)
return; return;
setState(() { setState(() {
_licenses.add(new Padding( _licenses.add(const Padding(
padding: const EdgeInsets.symmetric(vertical: 18.0), padding: const EdgeInsets.symmetric(vertical: 18.0),
child: new Text( child: const Text(
'🍀‬', // That's U+1F340. Could also use U+2766 (❦) if U+1F340 doesn't work everywhere. '🍀‬', // That's U+1F340. Could also use U+2766 (❦) if U+1F340 doesn't work everywhere.
textAlign: TextAlign.center textAlign: TextAlign.center
) )
...@@ -443,7 +443,7 @@ class _LicensePageState extends State<LicensePage> { ...@@ -443,7 +443,7 @@ class _LicensePageState extends State<LicensePage> {
} }
return new Scaffold( return new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Licenses') title: const Text('Licenses')
), ),
body: new DefaultTextStyle( body: new DefaultTextStyle(
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.caption,
......
...@@ -450,7 +450,7 @@ class DataTable extends StatelessWidget { ...@@ -450,7 +450,7 @@ class DataTable extends StatelessWidget {
}) { }) {
final bool isLightTheme = Theme.of(context).brightness == Brightness.light; final bool isLightTheme = Theme.of(context).brightness == Brightness.light;
if (showEditIcon) { if (showEditIcon) {
final Widget icon = new Icon(Icons.edit, size: 18.0); final Widget icon = const Icon(Icons.edit, size: 18.0);
label = new Expanded(child: label); label = new Expanded(child: label);
label = new Row(children: numeric ? <Widget>[ icon, label ] : <Widget>[ label, icon ]); label = new Row(children: numeric ? <Widget>[ icon, label ] : <Widget>[ label, icon ]);
} }
...@@ -523,7 +523,7 @@ class DataTable extends StatelessWidget { ...@@ -523,7 +523,7 @@ class DataTable extends StatelessWidget {
int displayColumnIndex = 0; int displayColumnIndex = 0;
if (showCheckboxColumn) { if (showCheckboxColumn) {
tableColumns[0] = new FixedColumnWidth(_kTablePadding + Checkbox.width + _kTablePadding / 2.0); tableColumns[0] = const FixedColumnWidth(_kTablePadding + Checkbox.width + _kTablePadding / 2.0);
tableRows[0].children[0] = _buildCheckbox( tableRows[0].children[0] = _buildCheckbox(
color: theme.accentColor, color: theme.accentColor,
checked: allChecked, checked: allChecked,
......
...@@ -677,11 +677,11 @@ class _DatePickerDialogState extends State<_DatePickerDialog> { ...@@ -677,11 +677,11 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
child: new ButtonBar( child: new ButtonBar(
children: <Widget>[ children: <Widget>[
new FlatButton( new FlatButton(
child: new Text('CANCEL'), child: const Text('CANCEL'),
onPressed: _handleCancel, onPressed: _handleCancel,
), ),
new FlatButton( new FlatButton(
child: new Text('OK'), child: const Text('OK'),
onPressed: _handleOk, onPressed: _handleOk,
), ),
], ],
......
...@@ -107,7 +107,7 @@ class _ExpandIconState extends State<ExpandIcon> with SingleTickerProviderStateM ...@@ -107,7 +107,7 @@ class _ExpandIconState extends State<ExpandIcon> with SingleTickerProviderStateM
onPressed: config.onPressed == null ? null : _handlePressed, onPressed: config.onPressed == null ? null : _handlePressed,
icon: new RotationTransition( icon: new RotationTransition(
turns: _iconTurns, turns: _iconTurns,
child: new Icon(Icons.expand_more) child: const Icon(Icons.expand_more)
) )
); );
} }
......
...@@ -305,7 +305,7 @@ class InputDecorator extends StatelessWidget { ...@@ -305,7 +305,7 @@ class InputDecorator extends StatelessWidget {
if (decoration.hideDivider) { if (decoration.hideDivider) {
return new Container( return new Container(
margin: margin + new EdgeInsets.only(bottom: bottomBorder), margin: margin + const EdgeInsets.only(bottom: bottomBorder),
padding: padding, padding: padding,
child: child, child: child,
); );
......
...@@ -106,7 +106,7 @@ class ListTileTheme extends InheritedWidget { ...@@ -106,7 +106,7 @@ class ListTileTheme extends InheritedWidget {
/// ``` /// ```
static ListTileTheme of(BuildContext context) { static ListTileTheme of(BuildContext context) {
final ListTileTheme result = context.inheritFromWidgetOfExactType(ListTileTheme); final ListTileTheme result = context.inheritFromWidgetOfExactType(ListTileTheme);
return result ?? new ListTileTheme(); return result ?? const ListTileTheme();
} }
@override @override
......
...@@ -298,7 +298,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -298,7 +298,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
} }
} else if (_selectedRowCount == 1) { } else if (_selectedRowCount == 1) {
// TODO(ianh): Real l10n. // TODO(ianh): Real l10n.
headerWidgets.add(new Expanded(child: new Text('1 item selected'))); headerWidgets.add(const Expanded(child: const Text('1 item selected')));
} else { } else {
headerWidgets.add(new Expanded(child: new Text('$_selectedRowCount items selected'))); headerWidgets.add(new Expanded(child: new Text('$_selectedRowCount items selected')));
} }
...@@ -328,7 +328,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -328,7 +328,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
}) })
.toList(); .toList();
footerWidgets.addAll(<Widget>[ footerWidgets.addAll(<Widget>[
new Text('Rows per page:'), const Text('Rows per page:'),
new DropdownButtonHideUnderline( new DropdownButtonHideUnderline(
child: new DropdownButton<int>( child: new DropdownButton<int>(
items: availableRowsPerPage, items: availableRowsPerPage,
...@@ -347,7 +347,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -347,7 +347,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
), ),
new Container(width: 32.0), new Container(width: 32.0),
new IconButton( new IconButton(
icon: new Icon(Icons.chevron_left), icon: const Icon(Icons.chevron_left),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
tooltip: 'Previous page', tooltip: 'Previous page',
onPressed: _firstRowIndex <= 0 ? null : () { onPressed: _firstRowIndex <= 0 ? null : () {
...@@ -356,7 +356,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -356,7 +356,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
), ),
new Container(width: 24.0), new Container(width: 24.0),
new IconButton( new IconButton(
icon: new Icon(Icons.chevron_right), icon: const Icon(Icons.chevron_right),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
tooltip: 'Next page', tooltip: 'Next page',
onPressed: (!_rowCountApproximate && (_firstRowIndex + config.rowsPerPage >= _rowCount)) ? null : () { onPressed: (!_rowCountApproximate && (_firstRowIndex + config.rowsPerPage >= _rowCount)) ? null : () {
......
...@@ -547,7 +547,7 @@ class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> { ...@@ -547,7 +547,7 @@ class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (config.child == null) { if (config.child == null) {
return new IconButton( return new IconButton(
icon: new Icon(Icons.more_vert), icon: const Icon(Icons.more_vert),
padding: config.padding, padding: config.padding,
tooltip: config.tooltip, tooltip: config.tooltip,
onPressed: showButtonMenu, onPressed: showButtonMenu,
......
...@@ -249,7 +249,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin { ...@@ -249,7 +249,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
color: isDarkActive ? _kCircleActiveDark : _kCircleActiveLight, color: isDarkActive ? _kCircleActiveDark : _kCircleActiveLight,
); );
case StepState.error: case StepState.error:
return new Text('!', style: _kStepStyle); return const Text('!', style: _kStepStyle);
} }
return null; return null;
} }
...@@ -351,7 +351,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin { ...@@ -351,7 +351,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
color: _isDark() ? themeData.backgroundColor : themeData.primaryColor, color: _isDark() ? themeData.backgroundColor : themeData.primaryColor,
textColor: Colors.white, textColor: Colors.white,
textTheme: ButtonTextTheme.normal, textTheme: ButtonTextTheme.normal,
child: new Text('CONTINUE'), child: const Text('CONTINUE'),
), ),
new Container( new Container(
margin: const EdgeInsets.only(left: 8.0), margin: const EdgeInsets.only(left: 8.0),
...@@ -359,7 +359,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin { ...@@ -359,7 +359,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
onPressed: config.onStepCancel, onPressed: config.onStepCancel,
textColor: cancelColor, textColor: cancelColor,
textTheme: ButtonTextTheme.normal, textTheme: ButtonTextTheme.normal,
child: new Text('CANCEL'), child: const Text('CANCEL'),
), ),
), ),
], ],
......
...@@ -27,17 +27,17 @@ class _TextSelectionToolbar extends StatelessWidget { ...@@ -27,17 +27,17 @@ class _TextSelectionToolbar extends StatelessWidget {
final List<Widget> items = <Widget>[]; final List<Widget> items = <Widget>[];
if (!value.selection.isCollapsed) { if (!value.selection.isCollapsed) {
items.add(new FlatButton(child: new Text('CUT'), onPressed: _handleCut)); items.add(new FlatButton(child: const Text('CUT'), onPressed: _handleCut));
items.add(new FlatButton(child: new Text('COPY'), onPressed: _handleCopy)); items.add(new FlatButton(child: const Text('COPY'), onPressed: _handleCopy));
} }
items.add(new FlatButton( items.add(new FlatButton(
child: new Text('PASTE'), child: const Text('PASTE'),
// TODO(mpcomplete): This should probably be grayed-out if there is nothing to paste. // TODO(mpcomplete): This should probably be grayed-out if there is nothing to paste.
onPressed: _handlePaste onPressed: _handlePaste
)); ));
if (value.text.isNotEmpty) { if (value.text.isNotEmpty) {
if (value.selection.isCollapsed) if (value.selection.isCollapsed)
items.add(new FlatButton(child: new Text('SELECT ALL'), onPressed: _handleSelectAll)); items.add(new FlatButton(child: const Text('SELECT ALL'), onPressed: _handleSelectAll));
} }
return new Material( return new Material(
......
...@@ -702,11 +702,11 @@ class _TimePickerDialogState extends State<_TimePickerDialog> { ...@@ -702,11 +702,11 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
child: new ButtonBar( child: new ButtonBar(
children: <Widget>[ children: <Widget>[
new FlatButton( new FlatButton(
child: new Text('CANCEL'), child: const Text('CANCEL'),
onPressed: _handleCancel onPressed: _handleCancel
), ),
new FlatButton( new FlatButton(
child: new Text('OK'), child: const Text('OK'),
onPressed: _handleOk onPressed: _handleOk
), ),
] ]
......
...@@ -213,7 +213,7 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv ...@@ -213,7 +213,7 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv
), ),
trailing: new RotationTransition( trailing: new RotationTransition(
turns: _iconTurns, turns: _iconTurns,
child: new Icon(Icons.expand_more) child: const Icon(Icons.expand_more)
) )
) )
), ),
......
...@@ -21,15 +21,14 @@ class DecoratedBox extends SingleChildRenderObjectWidget { ...@@ -21,15 +21,14 @@ class DecoratedBox extends SingleChildRenderObjectWidget {
/// ///
/// The [decoration] and [position] arguments must not be null. By default the /// The [decoration] and [position] arguments must not be null. By default the
/// decoration paints behind the child. /// decoration paints behind the child.
DecoratedBox({ const DecoratedBox({
Key key, Key key,
@required this.decoration, @required this.decoration,
this.position: DecorationPosition.background, this.position: DecorationPosition.background,
Widget child Widget child
}) : super(key: key, child: child) { }) : assert(decoration != null),
assert(decoration != null); assert(position != null),
assert(position != null); super(key: key, child: child);
}
/// What decoration to paint. /// What decoration to paint.
/// ///
......
...@@ -14,7 +14,7 @@ class DefaultTextStyle extends InheritedWidget { ...@@ -14,7 +14,7 @@ class DefaultTextStyle extends InheritedWidget {
/// ///
/// Consider using [DefaultTextStyle.merge] to inherit styling information /// Consider using [DefaultTextStyle.merge] to inherit styling information
/// from the current default text style for a given [BuildContext]. /// from the current default text style for a given [BuildContext].
DefaultTextStyle({ const DefaultTextStyle({
Key key, Key key,
@required this.style, @required this.style,
this.textAlign, this.textAlign,
...@@ -22,12 +22,11 @@ class DefaultTextStyle extends InheritedWidget { ...@@ -22,12 +22,11 @@ class DefaultTextStyle extends InheritedWidget {
this.overflow: TextOverflow.clip, this.overflow: TextOverflow.clip,
this.maxLines, this.maxLines,
@required Widget child, @required Widget child,
}) : super(key: key, child: child) { }) : assert(style != null),
assert(style != null); assert(softWrap != null),
assert(softWrap != null); assert(overflow != null),
assert(overflow != null); assert(child != null),
assert(child != null); super(key: key, child: child);
}
/// A const-constructible default text style that provides fallback values. /// A const-constructible default text style that provides fallback values.
/// ///
...@@ -140,7 +139,7 @@ class Text extends StatelessWidget { ...@@ -140,7 +139,7 @@ class Text extends StatelessWidget {
/// ///
/// If the [style] argument is null, the text will use the style from the /// If the [style] argument is null, the text will use the style from the
/// closest enclosing [DefaultTextStyle]. /// closest enclosing [DefaultTextStyle].
Text(this.data, { const Text(this.data, {
Key key, Key key,
this.style, this.style,
this.textAlign, this.textAlign,
...@@ -148,9 +147,8 @@ class Text extends StatelessWidget { ...@@ -148,9 +147,8 @@ class Text extends StatelessWidget {
this.overflow, this.overflow,
this.textScaleFactor, this.textScaleFactor,
this.maxLines, this.maxLines,
}) : super(key: key) { }) : assert(data != null),
assert(data != null); super(key: key);
}
/// The text to display. /// The text to display.
final String data; final String data;
......
...@@ -16,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
testWidgets('Default layout minimum size', (WidgetTester tester) async { testWidgets('Default layout minimum size', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Center(child: new CupertinoButton( new Center(child: new CupertinoButton(
child: new Text('X', style: testStyle), child: const Text('X', style: testStyle),
onPressed: null, onPressed: null,
)) ))
); );
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
final double minSize = 60.0; final double minSize = 60.0;
await tester.pumpWidget( await tester.pumpWidget(
new Center(child: new CupertinoButton( new Center(child: new CupertinoButton(
child: new Text('X', style: testStyle), child: const Text('X', style: testStyle),
onPressed: null, onPressed: null,
minSize: minSize, minSize: minSize,
)) ))
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
testWidgets('Size grows with text', (WidgetTester tester) async { testWidgets('Size grows with text', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Center(child: new CupertinoButton( new Center(child: new CupertinoButton(
child: new Text('XXXX', style: testStyle), child: const Text('XXXX', style: testStyle),
onPressed: null, onPressed: null,
)) ))
); );
...@@ -62,7 +62,7 @@ void main() { ...@@ -62,7 +62,7 @@ void main() {
testWidgets('Button with background is wider', (WidgetTester tester) async { testWidgets('Button with background is wider', (WidgetTester tester) async {
await tester.pumpWidget(new Center(child: new CupertinoButton( await tester.pumpWidget(new Center(child: new CupertinoButton(
child: new Text('X', style: testStyle), child: const Text('X', style: testStyle),
onPressed: null, onPressed: null,
color: const Color(0xFFFFFFFF), color: const Color(0xFFFFFFFF),
))); )));
...@@ -76,7 +76,7 @@ void main() { ...@@ -76,7 +76,7 @@ void main() {
testWidgets('Custom padding', (WidgetTester tester) async { testWidgets('Custom padding', (WidgetTester tester) async {
await tester.pumpWidget(new Center(child: new CupertinoButton( await tester.pumpWidget(new Center(child: new CupertinoButton(
child: new Text(' ', style: testStyle), child: const Text(' ', style: testStyle),
onPressed: null, onPressed: null,
padding: const EdgeInsets.all(100.0), padding: const EdgeInsets.all(100.0),
))); )));
...@@ -94,7 +94,7 @@ void main() { ...@@ -94,7 +94,7 @@ void main() {
builder: (BuildContext context, StateSetter setState) { builder: (BuildContext context, StateSetter setState) {
return new Center( return new Center(
child: new CupertinoButton( child: new CupertinoButton(
child: new Text('Tap me'), child: const Text('Tap me'),
onPressed: () { onPressed: () {
setState(() { setState(() {
value = true; value = true;
...@@ -117,7 +117,7 @@ void main() { ...@@ -117,7 +117,7 @@ void main() {
testWidgets('Disabled button doesn\'t animate', (WidgetTester tester) async { testWidgets('Disabled button doesn\'t animate', (WidgetTester tester) async {
await tester.pumpWidget(new Center(child: new CupertinoButton( await tester.pumpWidget(new Center(child: new CupertinoButton(
child: new Text('Tap me'), child: const Text('Tap me'),
onPressed: null, onPressed: null,
))); )));
expect(SchedulerBinding.instance.transientCallbackCount, equals(0)); expect(SchedulerBinding.instance.transientCallbackCount, equals(0));
...@@ -128,7 +128,7 @@ void main() { ...@@ -128,7 +128,7 @@ void main() {
testWidgets('pressedOpacity defaults to 0.1', (WidgetTester tester) async { testWidgets('pressedOpacity defaults to 0.1', (WidgetTester tester) async {
await tester.pumpWidget(new Center(child: new CupertinoButton( await tester.pumpWidget(new Center(child: new CupertinoButton(
child: new Text('Tap me'), child: const Text('Tap me'),
onPressed: () { }, onPressed: () { },
))); )));
...@@ -149,7 +149,7 @@ void main() { ...@@ -149,7 +149,7 @@ void main() {
final double pressedOpacity = 0.5; final double pressedOpacity = 0.5;
await tester.pumpWidget(new Center(child: new CupertinoButton( await tester.pumpWidget(new Center(child: new CupertinoButton(
pressedOpacity: pressedOpacity, pressedOpacity: pressedOpacity,
child: new Text('Tap me'), child: const Text('Tap me'),
onPressed: () { }, onPressed: () { },
))); )));
......
...@@ -20,11 +20,11 @@ void main() { ...@@ -20,11 +20,11 @@ void main() {
showDialog<Null>( showDialog<Null>(
context: context, context: context,
child: new CupertinoAlertDialog( child: new CupertinoAlertDialog(
title: new Text('The title'), title: const Text('The title'),
content: new Text('The content'), content: const Text('The content'),
actions: <Widget>[ actions: <Widget>[
new CupertinoDialogAction( new CupertinoDialogAction(
child: new Text('Cancel'), child: const Text('Cancel'),
), ),
new CupertinoDialogAction( new CupertinoDialogAction(
isDestructive: true, isDestructive: true,
...@@ -32,13 +32,13 @@ void main() { ...@@ -32,13 +32,13 @@ void main() {
didDelete = true; didDelete = true;
Navigator.pop(context); Navigator.pop(context);
}, },
child: new Text('Delete'), child: const Text('Delete'),
), ),
], ],
), ),
); );
}, },
child: new Text('Go'), child: const Text('Go'),
); );
}, },
), ),
...@@ -66,7 +66,7 @@ void main() { ...@@ -66,7 +66,7 @@ void main() {
testWidgets('Dialog action styles', (WidgetTester tester) async { testWidgets('Dialog action styles', (WidgetTester tester) async {
await tester.pumpWidget(new CupertinoDialogAction( await tester.pumpWidget(new CupertinoDialogAction(
isDestructive: true, isDestructive: true,
child: new Text('Ok'), child: const Text('Ok'),
)); ));
final DefaultTextStyle widget = tester.widget(find.byType(DefaultTextStyle)); final DefaultTextStyle widget = tester.widget(find.byType(DefaultTextStyle));
......
...@@ -199,7 +199,7 @@ Future<Null> main() async { ...@@ -199,7 +199,7 @@ Future<Null> main() async {
test('Error reporting - NoSuchMethodError', () async { test('Error reporting - NoSuchMethodError', () async {
expect(console, isEmpty); expect(console, isEmpty);
FlutterError.dumpErrorToConsole(new FlutterErrorDetails( FlutterError.dumpErrorToConsole(const FlutterErrorDetails(
exception: 'hello', exception: 'hello',
)); ));
expect(console.join('\n'), matches(new RegExp( expect(console.join('\n'), matches(new RegExp(
...@@ -209,7 +209,7 @@ Future<Null> main() async { ...@@ -209,7 +209,7 @@ Future<Null> main() async {
'════════════════════════════════════════════════════════════════════════════════════════════════════\$', '════════════════════════════════════════════════════════════════════════════════════════════════════\$',
))); )));
console.clear(); console.clear();
FlutterError.dumpErrorToConsole(new FlutterErrorDetails( FlutterError.dumpErrorToConsole(const FlutterErrorDetails(
exception: 'hello again', exception: 'hello again',
)); ));
expect(console.join('\n'), 'Another exception was thrown: hello again'); expect(console.join('\n'), 'Another exception was thrown: hello again');
......
...@@ -15,7 +15,7 @@ void main() { ...@@ -15,7 +15,7 @@ void main() {
title: 'Pirate app', title: 'Pirate app',
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('Home'), title: const Text('Home'),
), ),
drawer: new Drawer( drawer: new Drawer(
child: new ListView( child: new ListView(
...@@ -25,7 +25,7 @@ void main() { ...@@ -25,7 +25,7 @@ void main() {
applicationIcon: const FlutterLogo(), applicationIcon: const FlutterLogo(),
applicationLegalese: 'I am the very model of a modern major general.', applicationLegalese: 'I am the very model of a modern major general.',
aboutBoxChildren: <Widget>[ aboutBoxChildren: <Widget>[
new Text('About box'), const Text('About box'),
] ]
), ),
], ],
...@@ -89,7 +89,7 @@ void main() { ...@@ -89,7 +89,7 @@ void main() {
]); ]);
}); });
await tester.pumpWidget(new Center( await tester.pumpWidget(const Center(
child: const LicensePage() child: const LicensePage()
)); ));
......
...@@ -15,7 +15,7 @@ Widget buildSliverAppBarApp({ bool floating, bool pinned, double expandedHeight ...@@ -15,7 +15,7 @@ Widget buildSliverAppBarApp({ bool floating, bool pinned, double expandedHeight
primary: true, primary: true,
slivers: <Widget>[ slivers: <Widget>[
new SliverAppBar( new SliverAppBar(
title: new Text('AppBar Title'), title: const Text('AppBar Title'),
floating: floating, floating: floating,
pinned: pinned, pinned: pinned,
expandedHeight: expandedHeight, expandedHeight: expandedHeight,
...@@ -63,7 +63,7 @@ void main() { ...@@ -63,7 +63,7 @@ void main() {
theme: new ThemeData(platform: TargetPlatform.android), theme: new ThemeData(platform: TargetPlatform.android),
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('X'), title: const Text('X'),
), ),
), ),
), ),
...@@ -82,7 +82,7 @@ void main() { ...@@ -82,7 +82,7 @@ void main() {
theme: new ThemeData(platform: TargetPlatform.iOS), theme: new ThemeData(platform: TargetPlatform.iOS),
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('X'), title: const Text('X'),
), ),
), ),
), ),
...@@ -101,7 +101,7 @@ void main() { ...@@ -101,7 +101,7 @@ void main() {
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
centerTitle: true, centerTitle: true,
title: new Text('X'), title: const Text('X'),
) )
) )
) )
...@@ -121,7 +121,7 @@ void main() { ...@@ -121,7 +121,7 @@ void main() {
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
centerTitle: false, centerTitle: false,
title: new Text('X'), title: const Text('X'),
), ),
), ),
), ),
...@@ -138,7 +138,7 @@ void main() { ...@@ -138,7 +138,7 @@ void main() {
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
centerTitle: false, centerTitle: false,
title: new Text('X'), title: const Text('X'),
), ),
// A drawer causes a leading hamburger. // A drawer causes a leading hamburger.
drawer: new Drawer(), drawer: new Drawer(),
...@@ -254,9 +254,9 @@ void main() { ...@@ -254,9 +254,9 @@ void main() {
new SizedBox( new SizedBox(
height: kToolbarHeight, height: kToolbarHeight,
child: new AppBar( child: new AppBar(
leading: new Text('L'), leading: const Text('L'),
title: new Text('No Scaffold'), title: const Text('No Scaffold'),
actions: <Widget>[new Text('A1'), new Text('A2')], actions: <Widget>[const Text('A1'), const Text('A2')],
), ),
), ),
); );
...@@ -276,7 +276,7 @@ void main() { ...@@ -276,7 +276,7 @@ void main() {
width: 0.0, width: 0.0,
child: new Scaffold( child: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('X'), title: const Text('X'),
), ),
), ),
), ),
...@@ -325,7 +325,7 @@ void main() { ...@@ -325,7 +325,7 @@ void main() {
theme: new ThemeData(platform: TargetPlatform.android), theme: new ThemeData(platform: TargetPlatform.android),
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('X'), title: const Text('X'),
), ),
drawer: new Column(), // Doesn't really matter. Triggers a hamburger regardless. drawer: new Column(), // Doesn't really matter. Triggers a hamburger regardless.
), ),
...@@ -343,16 +343,16 @@ void main() { ...@@ -343,16 +343,16 @@ void main() {
theme: new ThemeData(platform: TargetPlatform.android), theme: new ThemeData(platform: TargetPlatform.android),
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: new Text('X'), title: const Text('X'),
actions: <Widget> [ actions: <Widget> [
new IconButton( const IconButton(
icon: new Icon(Icons.share), icon: const Icon(Icons.share),
onPressed: null, onPressed: null,
tooltip: 'Share', tooltip: 'Share',
iconSize: 20.0, iconSize: 20.0,
), ),
new IconButton( const IconButton(
icon: new Icon(Icons.add), icon: const Icon(Icons.add),
onPressed: null, onPressed: null,
tooltip: 'Add', tooltip: 'Add',
iconSize: 60.0, iconSize: 60.0,
......
...@@ -30,7 +30,7 @@ void main() { ...@@ -30,7 +30,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new MaterialApp( new MaterialApp(
home: new MaterialApp( home: new MaterialApp(
home: new Text('Home sweet home'), home: const Text('Home sweet home'),
), ),
), ),
); );
...@@ -58,7 +58,7 @@ void main() { ...@@ -58,7 +58,7 @@ void main() {
autofocus: true, autofocus: true,
node: focusScopeNode, node: focusScopeNode,
child: new MaterialApp( child: new MaterialApp(
home: new Text('Home'), home: const Text('Home'),
), ),
)); ));
...@@ -95,7 +95,7 @@ void main() { ...@@ -95,7 +95,7 @@ void main() {
builder: (BuildContext context) { builder: (BuildContext context) {
return new Material( return new Material(
child: new RaisedButton( child: new RaisedButton(
child: new Text('X'), child: const Text('X'),
onPressed: () { Navigator.of(context).pushNamed('/next'); }, onPressed: () { Navigator.of(context).pushNamed('/next'); },
), ),
); );
...@@ -132,7 +132,7 @@ void main() { ...@@ -132,7 +132,7 @@ void main() {
}); });
testWidgets('Cannot pop the initial route', (WidgetTester tester) async { testWidgets('Cannot pop the initial route', (WidgetTester tester) async {
await tester.pumpWidget(new MaterialApp(home: new Text('Home'))); await tester.pumpWidget(new MaterialApp(home: const Text('Home')));
expect(find.text('Home'), findsOneWidget); expect(find.text('Home'), findsOneWidget);
......
...@@ -9,11 +9,11 @@ void main() { ...@@ -9,11 +9,11 @@ void main() {
testWidgets('BackButton control test', (WidgetTester tester) async { testWidgets('BackButton control test', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new MaterialApp( new MaterialApp(
home: new Material(child: new Text('Home')), home: new Material(child: const Text('Home')),
routes: <String, WidgetBuilder>{ routes: <String, WidgetBuilder>{
'/next': (BuildContext context) { '/next': (BuildContext context) {
return new Material( return new Material(
child: new Center( child: const Center(
child: const BackButton(), child: const BackButton(),
) )
); );
......
...@@ -14,12 +14,12 @@ void main() { ...@@ -14,12 +14,12 @@ void main() {
bottomNavigationBar: new BottomNavigationBar( bottomNavigationBar: new BottomNavigationBar(
items: <BottomNavigationBarItem>[ items: <BottomNavigationBarItem>[
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.ac_unit), icon: const Icon(Icons.ac_unit),
title: new Text('AC') title: const Text('AC')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.access_alarm), icon: const Icon(Icons.access_alarm),
title: new Text('Alarm') title: const Text('Alarm')
) )
], ],
onTap: (int index) { onTap: (int index) {
...@@ -40,12 +40,12 @@ void main() { ...@@ -40,12 +40,12 @@ void main() {
bottomNavigationBar: new BottomNavigationBar( bottomNavigationBar: new BottomNavigationBar(
items: <BottomNavigationBarItem>[ items: <BottomNavigationBarItem>[
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.ac_unit), icon: const Icon(Icons.ac_unit),
title: new Text('AC') title: const Text('AC')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.access_alarm), icon: const Icon(Icons.access_alarm),
title: new Text('Alarm') title: const Text('Alarm')
) )
] ]
) )
...@@ -65,12 +65,12 @@ void main() { ...@@ -65,12 +65,12 @@ void main() {
type: BottomNavigationBarType.shifting, type: BottomNavigationBarType.shifting,
items: <BottomNavigationBarItem>[ items: <BottomNavigationBarItem>[
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.ac_unit), icon: const Icon(Icons.ac_unit),
title: new Text('AC') title: const Text('AC')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.access_alarm), icon: const Icon(Icons.access_alarm),
title: new Text('Alarm') title: const Text('Alarm')
) )
] ]
) )
...@@ -89,12 +89,12 @@ void main() { ...@@ -89,12 +89,12 @@ void main() {
type: BottomNavigationBarType.shifting, type: BottomNavigationBarType.shifting,
items: <BottomNavigationBarItem>[ items: <BottomNavigationBarItem>[
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.ac_unit), icon: const Icon(Icons.ac_unit),
title: new Text('AC') title: const Text('AC')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.access_alarm), icon: const Icon(Icons.access_alarm),
title: new Text('Alarm') title: const Text('Alarm')
) )
] ]
) )
...@@ -116,20 +116,20 @@ void main() { ...@@ -116,20 +116,20 @@ void main() {
type: BottomNavigationBarType.shifting, type: BottomNavigationBarType.shifting,
items: <BottomNavigationBarItem>[ items: <BottomNavigationBarItem>[
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.ac_unit), icon: const Icon(Icons.ac_unit),
title: new Text('AC') title: const Text('AC')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.access_alarm), icon: const Icon(Icons.access_alarm),
title: new Text('Alarm') title: const Text('Alarm')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.access_time), icon: const Icon(Icons.access_time),
title: new Text('Time') title: const Text('Time')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.add), icon: const Icon(Icons.add),
title: new Text('Add') title: const Text('Add')
) )
] ]
) )
...@@ -176,20 +176,20 @@ void main() { ...@@ -176,20 +176,20 @@ void main() {
type: BottomNavigationBarType.shifting, type: BottomNavigationBarType.shifting,
items: <BottomNavigationBarItem>[ items: <BottomNavigationBarItem>[
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.ac_unit), icon: const Icon(Icons.ac_unit),
title: new Text('AC') title: const Text('AC')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.access_alarm), icon: const Icon(Icons.access_alarm),
title: new Text('Alarm') title: const Text('Alarm')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.access_time), icon: const Icon(Icons.access_time),
title: new Text('Time') title: const Text('Time')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.add), icon: const Icon(Icons.add),
title: new Text('Add') title: const Text('Add')
) )
] ]
) )
...@@ -214,20 +214,20 @@ void main() { ...@@ -214,20 +214,20 @@ void main() {
type: BottomNavigationBarType.fixed, type: BottomNavigationBarType.fixed,
items: <BottomNavigationBarItem>[ items: <BottomNavigationBarItem>[
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.ac_unit), icon: const Icon(Icons.ac_unit),
title: new Text('AC') title: const Text('AC')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.access_alarm), icon: const Icon(Icons.access_alarm),
title: new Text('Alarm') title: const Text('Alarm')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.access_time), icon: const Icon(Icons.access_time),
title: new Text('Time') title: const Text('Time')
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
icon: new Icon(Icons.add), icon: const Icon(Icons.add),
title: new Text('Add') title: const Text('Add')
) )
] ]
) )
...@@ -249,11 +249,11 @@ void main() { ...@@ -249,11 +249,11 @@ void main() {
iconSize: 12.0, iconSize: 12.0,
items: <BottomNavigationBarItem>[ items: <BottomNavigationBarItem>[
new BottomNavigationBarItem( new BottomNavigationBarItem(
title: new Text('A'), title: const Text('A'),
icon: new Icon(Icons.ac_unit), icon: const Icon(Icons.ac_unit),
), ),
new BottomNavigationBarItem( new BottomNavigationBarItem(
title: new Text('B'), title: const Text('B'),
icon: new Builder( icon: new Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
builderIconSize = IconTheme.of(context).size; builderIconSize = IconTheme.of(context).size;
......
...@@ -18,7 +18,7 @@ void main() { ...@@ -18,7 +18,7 @@ void main() {
child: new Center( child: new Center(
child: new FlatButton( child: new FlatButton(
onPressed: () { }, onPressed: () { },
child: new Text('ABC') child: const Text('ABC')
) )
) )
) )
...@@ -43,8 +43,8 @@ void main() { ...@@ -43,8 +43,8 @@ void main() {
}); });
testWidgets('Does button highlight + splash colors work if set directly', (WidgetTester tester) async { testWidgets('Does button highlight + splash colors work if set directly', (WidgetTester tester) async {
final Color directSplashColor = new Color(0xFF000011); final Color directSplashColor = const Color(0xFF000011);
final Color directHighlightColor = new Color(0xFF000011); final Color directHighlightColor = const Color(0xFF000011);
Widget buttonWidget = new Material( Widget buttonWidget = new Material(
child: new Center( child: new Center(
...@@ -66,7 +66,7 @@ void main() { ...@@ -66,7 +66,7 @@ void main() {
final Point center = tester.getCenter(find.byType(MaterialButton)); final Point center = tester.getCenter(find.byType(MaterialButton));
final TestGesture gesture = await tester.startGesture(center); final TestGesture gesture = await tester.startGesture(center);
await tester.pump(); // start gesture await tester.pump(); // start gesture
await tester.pump(new Duration(milliseconds: 200)); // wait for splash to be well under way await tester.pump(const Duration(milliseconds: 200)); // wait for splash to be well under way
expect( expect(
Material.of(tester.element(find.byType(MaterialButton))), Material.of(tester.element(find.byType(MaterialButton))),
...@@ -75,8 +75,8 @@ void main() { ...@@ -75,8 +75,8 @@ void main() {
..rrect(color: directHighlightColor) ..rrect(color: directHighlightColor)
); );
final Color themeSplashColor1 = new Color(0xFF001100); final Color themeSplashColor1 = const Color(0xFF001100);
final Color themeHighlightColor1 = new Color(0xFF001100); final Color themeHighlightColor1 = const Color(0xFF001100);
buttonWidget = new Material( buttonWidget = new Material(
child: new Center( child: new Center(
...@@ -103,8 +103,8 @@ void main() { ...@@ -103,8 +103,8 @@ void main() {
..rrect(color: themeHighlightColor1) ..rrect(color: themeHighlightColor1)
); );
final Color themeSplashColor2 = new Color(0xFF002200); final Color themeSplashColor2 = const Color(0xFF002200);
final Color themeHighlightColor2 = new Color(0xFF002200); final Color themeHighlightColor2 = const Color(0xFF002200);
await tester.pumpWidget( await tester.pumpWidget(
new Theme( new Theme(
......
...@@ -14,9 +14,9 @@ void main() { ...@@ -14,9 +14,9 @@ void main() {
child: new Center( child: new Center(
child: new Chip( child: new Chip(
avatar: new CircleAvatar( avatar: new CircleAvatar(
child: new Text('C') child: const Text('C')
), ),
label: new Text('Chip'), label: const Text('Chip'),
onDeleted: () { onDeleted: () {
didDeleteChip = true; didDeleteChip = true;
} }
......
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
child: new CircleAvatar( child: new CircleAvatar(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
radius: 50.0, radius: 50.0,
child: new Text('Z'), child: const Text('Z'),
), ),
), ),
); );
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
new Center( new Center(
child: new CircleAvatar( child: new CircleAvatar(
foregroundColor: foregroundColor, foregroundColor: foregroundColor,
child: new Text('Z'), child: const Text('Z'),
), ),
), ),
); );
...@@ -64,7 +64,7 @@ void main() { ...@@ -64,7 +64,7 @@ void main() {
data: theme, data: theme,
child: new Center( child: new Center(
child: new CircleAvatar( child: new CircleAvatar(
child: new Text('Z'), child: const Text('Z'),
), ),
), ),
), ),
......
...@@ -11,7 +11,7 @@ const List<int> accentKeys = const <int>[100, 200, 400, 700]; ...@@ -11,7 +11,7 @@ const List<int> accentKeys = const <int>[100, 200, 400, 700];
void main() { void main() {
test('MaterialColor basic functionality', () { test('MaterialColor basic functionality', () {
final MaterialColor color = new MaterialColor( final MaterialColor color = const MaterialColor(
500, 500,
const <int, Color>{ const <int, Color>{
50: const Color(50), 50: const Color(50),
......
...@@ -19,12 +19,12 @@ void main() { ...@@ -19,12 +19,12 @@ void main() {
log.add('select-all: $value'); log.add('select-all: $value');
}, },
columns: <DataColumn>[ columns: <DataColumn>[
new DataColumn( const DataColumn(
label: new Text('Name'), label: const Text('Name'),
tooltip: 'Name', tooltip: 'Name',
), ),
new DataColumn( new DataColumn(
label: new Text('Calories'), label: const Text('Calories'),
tooltip: 'Calories', tooltip: 'Calories',
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) { onSort: (int columnIndex, bool ascending) {
......
...@@ -127,7 +127,7 @@ void main() { ...@@ -127,7 +127,7 @@ void main() {
onPressed: () { onPressed: () {
buttonContext = context; buttonContext = context;
}, },
child: new Text('Go'), child: const Text('Go'),
); );
}, },
), ),
......
...@@ -9,7 +9,7 @@ void main() { ...@@ -9,7 +9,7 @@ void main() {
testWidgets('debugCheckHasMaterial control test', (WidgetTester tester) async { testWidgets('debugCheckHasMaterial control test', (WidgetTester tester) async {
await tester.pumpWidget(new FlatButton( await tester.pumpWidget(new FlatButton(
onPressed: null, onPressed: null,
child: new Text('Go'), child: const Text('Go'),
)); ));
expect(tester.takeException(), isFlutterError); expect(tester.takeException(), isFlutterError);
}); });
......
...@@ -16,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
builder: (BuildContext context) { builder: (BuildContext context) {
return new Center( return new Center(
child: new RaisedButton( child: new RaisedButton(
child: new Text('X'), child: const Text('X'),
onPressed: () { onPressed: () {
showDialog<Null>( showDialog<Null>(
context: context, context: context,
...@@ -33,7 +33,7 @@ void main() { ...@@ -33,7 +33,7 @@ void main() {
onPressed: () { onPressed: () {
didPressOk = true; didPressOk = true;
}, },
child: new Text('OK') child: const Text('OK')
) )
] ]
) )
...@@ -66,13 +66,13 @@ void main() { ...@@ -66,13 +66,13 @@ void main() {
builder: (BuildContext context) { builder: (BuildContext context) {
return new Center( return new Center(
child: new RaisedButton( child: new RaisedButton(
child: new Text('X'), child: const Text('X'),
onPressed: () { onPressed: () {
showDialog<Null>( showDialog<Null>(
context: context, context: context,
child: new AlertDialog( child: new AlertDialog(
title: new Text('Title'), title: const Text('Title'),
content: new Text('Y'), content: const Text('Y'),
actions: <Widget>[ ], actions: <Widget>[ ],
), ),
); );
...@@ -104,7 +104,7 @@ void main() { ...@@ -104,7 +104,7 @@ void main() {
child: new Center( child: new Center(
child: new RaisedButton( child: new RaisedButton(
onPressed: null, onPressed: null,
child: new Text('Go'), child: const Text('Go'),
), ),
), ),
), ),
...@@ -116,16 +116,16 @@ void main() { ...@@ -116,16 +116,16 @@ void main() {
final Future<int> result = showDialog( final Future<int> result = showDialog(
context: context, context: context,
child: new SimpleDialog( child: new SimpleDialog(
title: new Text('Title'), title: const Text('Title'),
children: <Widget>[ children: <Widget>[
new SimpleDialogOption( new SimpleDialogOption(
onPressed: () { onPressed: () {
Navigator.pop(context, 42); Navigator.pop(context, 42);
}, },
child: new Text('First option'), child: const Text('First option'),
), ),
new SimpleDialogOption( new SimpleDialogOption(
child: new Text('Second option'), child: const Text('Second option'),
), ),
], ],
), ),
...@@ -145,7 +145,7 @@ void main() { ...@@ -145,7 +145,7 @@ void main() {
child: new Center( child: new Center(
child: new RaisedButton( child: new RaisedButton(
onPressed: null, onPressed: null,
child: new Text('Go'), child: const Text('Go'),
), ),
), ),
), ),
...@@ -160,7 +160,7 @@ void main() { ...@@ -160,7 +160,7 @@ void main() {
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: new Text('Dialog1'), child: const Text('Dialog1'),
), ),
); );
...@@ -180,7 +180,7 @@ void main() { ...@@ -180,7 +180,7 @@ void main() {
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: new Text('Dialog2'), child: const Text('Dialog2'),
), ),
); );
......
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