Constants! Constants everywhere! (#9286)

Aggressively apply the const lint.
This commit is contained in:
Ian Hickson
2017-04-07 12:24:32 -07:00
committed by GitHub
parent 54bbb6fb4d
commit 3eb87830e9
197 changed files with 1312 additions and 1315 deletions

View File

@@ -125,7 +125,7 @@ class ColorsDemo extends StatelessWidget {
child: new Scaffold(
appBar: new AppBar(
elevation: 0,
title: new Text('Colors'),
title: const Text('Colors'),
bottom: new TabBar(
isScrollable: true,
tabs: allPalettes.map((Palette swatch) => new Tab(text: swatch.name)).toList(),

View File

@@ -113,11 +113,11 @@ class ContactsDemoState extends State<ContactsDemo> {
floating: _appBarBehavior == AppBarBehavior.floating,
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.create),
icon: const Icon(Icons.create),
tooltip: 'Edit',
onPressed: () {
_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> {
itemBuilder: (BuildContext context) => <PopupMenuItem<AppBarBehavior>>[
new PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.normal,
child: new Text('App bar scrolls away')
child: const Text('App bar scrolls away')
),
new PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.pinned,
child: new Text('App bar stays put')
child: const Text('App bar stays put')
),
new PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.floating,
child: new Text('App bar floats')
child: const Text('App bar floats')
),
],
),
],
flexibleSpace: new FlexibleSpaceBar(
title: new Text('Ali Connors'),
title: const Text('Ali Connors'),
background: new Stack(
children: <Widget>[
new Image.asset(
@@ -154,7 +154,7 @@ class ContactsDemoState extends State<ContactsDemo> {
),
// This gradient ensures that the toolbar icons are distinct
// against the background image.
new DecoratedBox(
const DecoratedBox(
decoration: const BoxDecoration(
gradient: const LinearGradient(
begin: const FractionalOffset(0.5, 0.0),
@@ -177,7 +177,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send message',
onPressed: () {
_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>[
@@ -190,7 +190,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send message',
onPressed: () {
_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>[
@@ -203,7 +203,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send message',
onPressed: () {
_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>[
@@ -221,7 +221,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send personal e-mail',
onPressed: () {
_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>[
@@ -234,7 +234,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send work e-mail',
onPressed: () {
_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>[
@@ -252,7 +252,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Open map',
onPressed: () {
_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>[
@@ -266,7 +266,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Open map',
onPressed: () {
_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>[
@@ -280,7 +280,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Open map',
onPressed: () {
_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>[

View File

@@ -12,7 +12,7 @@ class CupertinoProgressIndicatorDemo extends StatelessWidget {
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Cupertino Activity Indicator'),
title: const Text('Cupertino Activity Indicator'),
),
body: new Center(
child: new CupertinoActivityIndicator(),

View File

@@ -21,13 +21,13 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Cupertino Buttons'),
title: const Text('Cupertino Buttons'),
),
body: new Column(
children: <Widget> [
new Padding(
const Padding(
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.'),
),
new Expanded(
@@ -35,36 +35,36 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget> [
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(
alignment: const FractionalOffset(0.5, 0.4),
child: new Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new CupertinoButton(
child: new Text('Cupertino Button'),
child: const Text('Cupertino Button'),
onPressed: () {
setState(() {_pressedCount++;});
}
),
new CupertinoButton(
child: new Text('Disabled'),
child: const Text('Disabled'),
onPressed: null,
),
],
),
),
new Padding(padding: const EdgeInsets.all(12.0)),
const Padding(padding: const EdgeInsets.all(12.0)),
new CupertinoButton(
child: new Text('With Background'),
child: const Text('With Background'),
color: _kBlue,
onPressed: () {
setState(() {_pressedCount++;});
}
),
new Padding(padding: const EdgeInsets.all(12.0)),
const Padding(padding: const EdgeInsets.all(12.0)),
new CupertinoButton(
child: new Text('Disabled'),
child: const Text('Disabled'),
color: _kBlue,
onPressed: null,
),

View File

@@ -37,27 +37,27 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
return new Scaffold(
key: _scaffoldKey,
appBar: new AppBar(
title: new Text('Cupertino Dialogs'),
title: const Text('Cupertino Dialogs'),
),
body: new ListView(
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
children: <Widget> [
new CupertinoButton(
child: new Text('Alert'),
child: const Text('Alert'),
color: _kBlue,
onPressed: () {
showDemoDialog<String>(
context: context,
child: new CupertinoAlertDialog(
content: new Text('Discard draft?'),
content: const Text('Discard draft?'),
actions: <Widget>[
new CupertinoDialogAction(
child: new Text('Discard'),
child: const Text('Discard'),
isDestructive: true,
onPressed: () { Navigator.pop(context, 'OK'); }
),
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'); }
),
]
@@ -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(
child: new Text('Alert with Title'),
child: const Text('Alert with Title'),
color: _kBlue,
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0),
onPressed: () {
showDemoDialog<String>(
context: context,
child: new CupertinoAlertDialog(
title: new Text('Allow "Maps" to access your location while you use the app?'),
content: new Text(
title: const Text('Allow "Maps" to access your location while you use the app?'),
content: const Text(
'Your current location will be displayed on the map and used for directions, '
'nearby search results, and estimated travel times.'
),
actions: <Widget>[
new CupertinoDialogAction(
child: new Text('Don\'t Allow'),
child: const Text('Don\'t Allow'),
onPressed: () { Navigator.pop(context, 'Disallow'); }
),
new CupertinoDialogAction(
child: new Text('Allow'),
child: const Text('Allow'),
onPressed: () { Navigator.pop(context, 'Allow'); }
),
]

View File

@@ -20,7 +20,7 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Cupertino Sliders'),
title: const Text('Cupertino Sliders'),
),
body: new Center(
child: new Column(
@@ -39,7 +39,7 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
});
}
),
new Text('Cupertino Continuous'),
const Text('Cupertino Continuous'),
]
),
new Column(
@@ -56,7 +56,7 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
});
}
),
new Text('Cupertino Discrete'),
const Text('Cupertino Discrete'),
]
),
],

View File

@@ -20,7 +20,7 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Cupertino Switch'),
title: const Text('Cupertino Switch'),
),
body: new Center(
child: new CupertinoSwitch(

View File

@@ -23,7 +23,7 @@ class NavigationIconView {
) {
_animation = new CurvedAnimation(
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>
super.initState();
_navigationViews = <NavigationIconView>[
new NavigationIconView(
icon: new Icon(Icons.access_alarm),
title: new Text('Alarm'),
icon: const Icon(Icons.access_alarm),
title: const Text('Alarm'),
color: Colors.deepPurple,
vsync: this,
),
new NavigationIconView(
icon: new CustomIcon(),
title: new Text('Box'),
title: const Text('Box'),
color: Colors.deepOrange,
vsync: this,
),
new NavigationIconView(
icon: new Icon(Icons.cloud),
title: new Text('Cloud'),
icon: const Icon(Icons.cloud),
title: const Text('Cloud'),
color: Colors.teal,
vsync: this,
),
new NavigationIconView(
icon: new Icon(Icons.favorite),
title: new Text('Favorites'),
icon: const Icon(Icons.favorite),
title: const Text('Favorites'),
color: Colors.indigo,
vsync: this,
),
new NavigationIconView(
icon: new Icon(Icons.event_available),
title: new Text('Event'),
icon: const Icon(Icons.event_available),
title: const Text('Event'),
color: Colors.pink,
vsync: this,
)
@@ -183,7 +183,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
return new Scaffold(
appBar: new AppBar(
title: new Text('Bottom navigation'),
title: const Text('Bottom navigation'),
actions: <Widget>[
new PopupMenuButton<BottomNavigationBarType>(
onSelected: (BottomNavigationBarType value) {
@@ -194,11 +194,11 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
itemBuilder: (BuildContext context) => <PopupMenuItem<BottomNavigationBarType>>[
new PopupMenuItem<BottomNavigationBarType>(
value: BottomNavigationBarType.fixed,
child: new Text('Fixed'),
child: const Text('Fixed'),
),
new PopupMenuItem<BottomNavigationBarType>(
value: BottomNavigationBarType.shifting,
child: new Text('Shifting'),
child: const Text('Shifting'),
)
],
)

View File

@@ -95,13 +95,13 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new RaisedButton(
child: new Text('RAISED BUTTON'),
child: const Text('RAISED BUTTON'),
onPressed: () {
// Perform some action
},
),
new RaisedButton(
child: new Text('DISABLED'),
child: const Text('DISABLED'),
onPressed: null,
)
],
@@ -116,13 +116,13 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new FlatButton(
child: new Text('FLAT BUTTON'),
child: const Text('FLAT BUTTON'),
onPressed: () {
// Perform some action
},
),
new FlatButton(
child: new Text('DISABLED'),
child: const Text('DISABLED'),
onPressed: null,
)
],
@@ -142,7 +142,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
new ListTile(
title: new Text('Simple dropdown:'),
title: const Text('Simple dropdown:'),
trailing: new DropdownButton<String>(
value: dropdown1Value,
onChanged: (String newValue) {
@@ -162,10 +162,10 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
height: 24.0,
),
new ListTile(
title: new Text('Dropdown with a hint:'),
title: const Text('Dropdown with a hint:'),
trailing: new DropdownButton<String>(
value: dropdown2Value,
hint: new Text('Choose'),
hint: const Text('Choose'),
onChanged: (String newValue) {
setState(() {
dropdown2Value = newValue;
@@ -183,7 +183,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
height: 24.0,
),
new ListTile(
title: new Text('Scrollable dropdown:'),
title: const Text('Scrollable dropdown:'),
trailing: new DropdownButton<String>(
value: dropdown3Value,
onChanged: (String newValue) {
@@ -218,14 +218,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new IconButton(
icon: new Icon(Icons.thumb_up),
icon: const Icon(Icons.thumb_up),
onPressed: () {
setState(() => iconButtonToggle = !iconButtonToggle);
},
color: iconButtonToggle ? Theme.of(context).primaryColor : null,
),
new IconButton(
icon: new Icon(Icons.thumb_up),
const IconButton(
icon: const Icon(Icons.thumb_up),
onPressed: null,
)
]
@@ -239,7 +239,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
return new Align(
alignment: const FractionalOffset(0.5, 0.4),
child: new FloatingActionButton(
child: new Icon(Icons.add),
child: const Icon(Icons.add),
onPressed: () {
// Perform some action
},

View File

@@ -116,12 +116,12 @@ class TravelDestinationItem extends StatelessWidget {
alignment: MainAxisAlignment.start,
children: <Widget>[
new FlatButton(
child: new Text('SHARE'),
child: const Text('SHARE'),
textColor: Colors.amber.shade500,
onPressed: () { /* do nothing */ },
),
new FlatButton(
child: new Text('EXPLORE'),
child: const Text('EXPLORE'),
textColor: Colors.amber.shade500,
onPressed: () { /* do nothing */ },
),
@@ -142,7 +142,7 @@ class CardsDemo extends StatelessWidget {
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Travel stream')
title: const Text('Travel stream')
),
body: new ListView(
itemExtent: TravelDestinationItem.height,

View File

@@ -23,24 +23,24 @@ class _ChipDemoState extends State<ChipDemo> {
@override
Widget build(BuildContext context) {
final List<Widget> chips = <Widget>[
new Chip(
label: new Text('Apple')
const Chip(
label: const Text('Apple')
),
new Chip(
avatar: new CircleAvatar(child: new Text('B')),
label: new Text('Blueberry')
avatar: new CircleAvatar(child: const Text('B')),
label: const Text('Blueberry')
),
];
if (_showBananas) {
chips.add(new Chip(
label: new Text('Bananas'),
label: const Text('Bananas'),
onDeleted: _deleteBananas
));
}
return new Scaffold(
appBar: new AppBar(title: new Text('Chips')),
appBar: new AppBar(title: const Text('Chips')),
body: new ListView(
children: chips.map((Widget widget) {
return new Container(

View File

@@ -164,12 +164,12 @@ class _DataTableDemoState extends State<DataTableDemo> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text('Data tables')),
appBar: new AppBar(title: const Text('Data tables')),
body: new ListView(
padding: const EdgeInsets.all(20.0),
children: <Widget>[
new PaginatedDataTable(
header: new Text('Nutrition'),
header: const Text('Nutrition'),
rowsPerPage: _rowsPerPage,
onRowsPerPageChanged: (int value) { setState(() { _rowsPerPage = value; }); },
sortColumnIndex: _sortColumnIndex,
@@ -177,43 +177,43 @@ class _DataTableDemoState extends State<DataTableDemo> {
onSelectAll: _dessertsDataSource._selectAll,
columns: <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)
),
new DataColumn(
label: new Text('Calories'),
label: const Text('Calories'),
tooltip: 'The total amount of food energy in the given serving size.',
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.calories, columnIndex, ascending)
),
new DataColumn(
label: new Text('Fat (g)'),
label: const Text('Fat (g)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.fat, columnIndex, ascending)
),
new DataColumn(
label: new Text('Carbs (g)'),
label: const Text('Carbs (g)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.carbs, columnIndex, ascending)
),
new DataColumn(
label: new Text('Protein (g)'),
label: const Text('Protein (g)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.protein, columnIndex, ascending)
),
new DataColumn(
label: new Text('Sodium (mg)'),
label: const Text('Sodium (mg)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.sodium, columnIndex, ascending)
),
new DataColumn(
label: new Text('Calcium (%)'),
label: const Text('Calcium (%)'),
tooltip: 'The amount of calcium as a percentage of the recommended daily amount.',
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.calcium, columnIndex, ascending)
),
new DataColumn(
label: new Text('Iron (%)'),
label: const Text('Iron (%)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.iron, columnIndex, ascending)
),

View File

@@ -129,7 +129,7 @@ class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> {
@override
Widget build(BuildContext context) {
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(
child: new ListView(
padding: const EdgeInsets.all(16.0),

View File

@@ -87,13 +87,13 @@ class DialogDemoState extends State<DialogDemo> {
return new Scaffold(
key: _scaffoldKey,
appBar: new AppBar(
title: new Text('Dialogs')
title: const Text('Dialogs')
),
body: new ListView(
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
children: <Widget>[
new RaisedButton(
child: new Text('ALERT'),
child: const Text('ALERT'),
onPressed: () {
showDemoDialog<DialogDemoAction>(
context: context,
@@ -104,11 +104,11 @@ class DialogDemoState extends State<DialogDemo> {
),
actions: <Widget>[
new FlatButton(
child: new Text('CANCEL'),
child: const Text('CANCEL'),
onPressed: () { Navigator.pop(context, DialogDemoAction.cancel); }
),
new FlatButton(
child: new Text('DISCARD'),
child: const Text('DISCARD'),
onPressed: () { Navigator.pop(context, DialogDemoAction.discard); }
)
]
@@ -117,23 +117,23 @@ class DialogDemoState extends State<DialogDemo> {
}
),
new RaisedButton(
child: new Text('ALERT WITH TITLE'),
child: const Text('ALERT WITH TITLE'),
onPressed: () {
showDemoDialog<DialogDemoAction>(
context: context,
child: new AlertDialog(
title: new Text('Use Google\'s location service?'),
title: const Text('Use Google\'s location service?'),
content: new Text(
_alertWithTitleText,
style: dialogTextStyle
),
actions: <Widget>[
new FlatButton(
child: new Text('DISAGREE'),
child: const Text('DISAGREE'),
onPressed: () { Navigator.pop(context, DialogDemoAction.disagree); }
),
new FlatButton(
child: new Text('AGREE'),
child: const Text('AGREE'),
onPressed: () { Navigator.pop(context, DialogDemoAction.agree); }
)
]
@@ -142,12 +142,12 @@ class DialogDemoState extends State<DialogDemo> {
}
),
new RaisedButton(
child: new Text('SIMPLE'),
child: const Text('SIMPLE'),
onPressed: () {
showDemoDialog<String>(
context: context,
child: new SimpleDialog(
title: new Text('Set backup account'),
title: const Text('Set backup account'),
children: <Widget>[
new DialogDemoItem(
icon: Icons.account_circle,
@@ -172,7 +172,7 @@ class DialogDemoState extends State<DialogDemo> {
}
),
new RaisedButton(
child: new Text('CONFIRMATION'),
child: const Text('CONFIRMATION'),
onPressed: () {
showTimePicker(
context: context,
@@ -189,7 +189,7 @@ class DialogDemoState extends State<DialogDemo> {
}
),
new RaisedButton(
child: new Text('FULLSCREEN'),
child: const Text('FULLSCREEN'),
onPressed: () {
Navigator.push(context, new MaterialPageRoute<DismissDialogAction>(
builder: (BuildContext context) => new FullScreenDialogDemo(),

View File

@@ -68,7 +68,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
void _showNotImplementedMessage() {
Navigator.of(context).pop(); // Dismiss the drawer.
_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 {
Navigator.pop(context);
},
),
title: new Text('Navigation drawer'),
title: const Text('Navigation drawer'),
),
drawer: new Drawer(
child: new ListView(
children: <Widget>[
new UserAccountsDrawerHeader(
accountName: new Text('Zach Widget'),
accountEmail: new Text('zach.widget@example.com'),
accountName: const Text('Zach Widget'),
accountEmail: const Text('zach.widget@example.com'),
currentAccountPicture: new CircleAvatar(backgroundImage: new AssetImage(_kAsset0)),
otherAccountsPictures: <Widget>[
new CircleAvatar(backgroundImage: new AssetImage(_kAsset1)),
@@ -134,13 +134,13 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
new ListTile(
leading: new Icon(Icons.add),
title: new Text('Add account'),
leading: const Icon(Icons.add),
title: const Text('Add account'),
onTap: _showNotImplementedMessage,
),
new ListTile(
leading: new Icon(Icons.settings),
title: new Text('Manage accounts'),
leading: const Icon(Icons.settings),
title: const Text('Manage accounts'),
onTap: _showNotImplementedMessage,
),
],

View File

@@ -30,8 +30,8 @@ class DualHeaderWithHint extends StatelessWidget {
return new AnimatedCrossFade(
firstChild: first,
secondChild: second,
firstCurve: new Interval(0.0, 0.6, curve: Curves.fastOutSlowIn),
secondCurve: new Interval(0.4, 1.0, curve: Curves.fastOutSlowIn),
firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn),
secondCurve: const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn),
sizeCurve: Curves.fastOutSlowIn,
crossFadeState: isExpanded ? CrossFadeState.showSecond : CrossFadeState.showFirst,
duration: const Duration(milliseconds: 200),
@@ -118,7 +118,7 @@ class CollapsibleBody extends StatelessWidget {
margin: const EdgeInsets.only(right: 8.0),
child: new FlatButton(
onPressed: onCancel,
child: new Text('CANCEL', style: new TextStyle(
child: const Text('CANCEL', style: const TextStyle(
color: Colors.black54,
fontSize: 15.0,
fontWeight: FontWeight.w500
@@ -130,7 +130,7 @@ class CollapsibleBody extends StatelessWidget {
child: new FlatButton(
onPressed: onSave,
textTheme: ButtonTextTheme.accent,
child: new Text('SAVE')
child: const Text('SAVE')
)
)
]
@@ -254,7 +254,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
groupValue: field.value,
onChanged: field.onChanged,
),
new Text('Bahamas')
const Text('Bahamas')
]
),
new Row(
@@ -265,7 +265,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
groupValue: field.value,
onChanged: field.onChanged,
),
new Text('Barbados')
const Text('Barbados')
]
),
new Row(
@@ -276,7 +276,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
groupValue: field.value,
onChanged: field.onChanged,
),
new Text('Bermuda')
const Text('Bermuda')
]
)
]
@@ -334,7 +334,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text('Expansion panels')),
appBar: new AppBar(title: const Text('Expansion panels')),
body: new SingleChildScrollView(
child: new Container(
margin: const EdgeInsets.all(24.0),

View File

@@ -57,7 +57,7 @@ class DateTimeItem extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
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 {
child: new Row(
children: <Widget>[
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> {
),
actions: <Widget>[
new FlatButton(
child: new Text('CANCEL'),
child: const Text('CANCEL'),
onPressed: () { Navigator.pop(context, DismissDialogAction.cancel); }
),
new FlatButton(
child: new Text('DISCARD'),
child: const Text('DISCARD'),
onPressed: () {
Navigator.of(context)
..pop(DismissDialogAction.discard) // pop the cancel/discard dialog
@@ -145,10 +145,10 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
return new Scaffold(
appBar: new AppBar(
leading: new IconButton(
icon: new Icon(Icons.clear),
icon: const Icon(Icons.clear),
onPressed: () { handleDismissButton(context); }
),
title: new Text('New event'),
title: const Text('New event'),
actions: <Widget> [
new FlatButton(
child: new Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)),
@@ -222,7 +222,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
});
}
),
new Text('All-day')
const Text('All-day')
]
)
)

View File

@@ -316,22 +316,22 @@ class GridListDemoState extends State<GridListDemo> {
final Orientation orientation = MediaQuery.of(context).orientation;
return new Scaffold(
appBar: new AppBar(
title: new Text('Grid list'),
title: const Text('Grid list'),
actions: <Widget>[
new PopupMenuButton<GridDemoTileStyle>(
onSelected: changeTileStyle,
itemBuilder: (BuildContext context) => <PopupMenuItem<GridDemoTileStyle>>[
new PopupMenuItem<GridDemoTileStyle>(
value: GridDemoTileStyle.imageOnly,
child: new Text('Image only'),
child: const Text('Image only'),
),
new PopupMenuItem<GridDemoTileStyle>(
value: GridDemoTileStyle.oneLine,
child: new Text('One line'),
child: const Text('One line'),
),
new PopupMenuItem<GridDemoTileStyle>(
value: GridDemoTileStyle.twoLine,
child: new Text('Two line'),
child: const Text('Two line'),
),
],
),

View File

@@ -71,7 +71,7 @@ class IconsDemoState extends State<IconsDemo> {
return new Scaffold(
appBar: new AppBar(
title: new Text('Icons')
title: const Text('Icons')
),
body: new IconTheme(
data: new IconThemeData(opacity: iconOpacity),

View File

@@ -104,13 +104,13 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
background: new Container(
color: theme.primaryColor,
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(
color: theme.primaryColor,
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(
@@ -132,30 +132,30 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
return new Scaffold(
key: _scaffoldKey,
appBar: new AppBar(
title: new Text('Swipe to dismiss'),
title: const Text('Swipe to dismiss'),
actions: <Widget>[
new PopupMenuButton<LeaveBehindDemoAction>(
onSelected: handleDemoAction,
itemBuilder: (BuildContext context) => <PopupMenuEntry<LeaveBehindDemoAction>>[
new PopupMenuItem<LeaveBehindDemoAction>(
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 CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.horizontalSwipe,
checked: _dismissDirection == DismissDirection.horizontal,
child: new Text('Hoizontal swipe')
child: const Text('Hoizontal swipe')
),
new CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.leftSwipe,
checked: _dismissDirection == DismissDirection.endToStart,
child: new Text('Only swipe left')
child: const Text('Only swipe left')
),
new CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.rightSwipe,
checked: _dismissDirection == DismissDirection.startToEnd,
child: new Text('Only swipe right')
child: const Text('Only swipe right')
)
]
)

View File

@@ -37,15 +37,15 @@ class _ListDemoState extends State<ListDemo> {
void _showConfigurationSheet() {
final PersistentBottomSheetController<Null> bottomSheet = scaffoldKey.currentState.showBottomSheet((BuildContext bottomSheetContext) {
return new Container(
decoration: new BoxDecoration(
border: new Border(top: new BorderSide(color: Colors.black26)),
decoration: const BoxDecoration(
border: const Border(top: const BorderSide(color: Colors.black26)),
),
child: new ListView(
shrinkWrap: true,
children: <Widget>[
new ListTile(
dense: true,
title: new Text('One-line'),
title: const Text('One-line'),
trailing: new Radio<MaterialListType>(
value: _showAvatars ? MaterialListType.oneLineWithAvatar : MaterialListType.oneLine,
groupValue: _itemType,
@@ -54,7 +54,7 @@ class _ListDemoState extends State<ListDemo> {
),
new ListTile(
dense: true,
title: new Text('Two-line'),
title: const Text('Two-line'),
trailing: new Radio<MaterialListType>(
value: MaterialListType.twoLine,
groupValue: _itemType,
@@ -63,7 +63,7 @@ class _ListDemoState extends State<ListDemo> {
),
new ListTile(
dense: true,
title: new Text('Three-line'),
title: const Text('Three-line'),
trailing: new Radio<MaterialListType>(
value: MaterialListType.threeLine,
groupValue: _itemType,
@@ -72,7 +72,7 @@ class _ListDemoState extends State<ListDemo> {
),
new ListTile(
dense: true,
title: new Text('Show avatar'),
title: const Text('Show avatar'),
trailing: new Checkbox(
value: _showAvatars,
onChanged: (bool value) {
@@ -85,7 +85,7 @@ class _ListDemoState extends State<ListDemo> {
),
new ListTile(
dense: true,
title: new Text('Show icon'),
title: const Text('Show icon'),
trailing: new Checkbox(
value: _showIcons,
onChanged: (bool value) {
@@ -98,7 +98,7 @@ class _ListDemoState extends State<ListDemo> {
),
new ListTile(
dense: true,
title: new Text('Show dividers'),
title: const Text('Show dividers'),
trailing: new Checkbox(
value: _showDividers,
onChanged: (bool value) {
@@ -111,7 +111,7 @@ class _ListDemoState extends State<ListDemo> {
),
new ListTile(
dense: true,
title: new Text('Dense layout'),
title: const Text('Dense layout'),
trailing: new Checkbox(
value: _dense,
onChanged: (bool value) {
@@ -143,9 +143,9 @@ class _ListDemoState extends State<ListDemo> {
Widget buildListTile(BuildContext context, String item) {
Widget secondary;
if (_itemType == MaterialListType.twoLine) {
secondary = new Text("Additional item information.");
secondary = const Text("Additional item information.");
} else if (_itemType == MaterialListType.threeLine) {
secondary = new Text(
secondary = const Text(
"Even more additional list item information appears on line three.",
);
}
@@ -186,7 +186,7 @@ class _ListDemoState extends State<ListDemo> {
title: new Text('Scrolling list\n$itemTypeText$layoutText'),
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.sort_by_alpha),
icon: const Icon(Icons.sort_by_alpha),
tooltip: 'Sort',
onPressed: () {
setState(() {
@@ -196,7 +196,7 @@ class _ListDemoState extends State<ListDemo> {
},
),
new IconButton(
icon: new Icon(Icons.more_vert),
icon: const Icon(Icons.more_vert),
tooltip: 'Show menu',
onPressed: _bottomSheet == null ? _showConfigurationSheet : null,
),

View File

@@ -62,22 +62,22 @@ class MenuDemoState extends State<MenuDemo> {
return new Scaffold(
key: _scaffoldKey,
appBar: new AppBar(
title: new Text('Menus'),
title: const Text('Menus'),
actions: <Widget>[
new PopupMenuButton<String>(
onSelected: showMenuSelection,
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem<String>(
value: 'Toolbar menu',
child: new Text('Toolbar menu')
child: const Text('Toolbar menu')
),
new PopupMenuItem<String>(
value: 'Right here',
child: new Text('Right here')
child: const Text('Right here')
),
new PopupMenuItem<String>(
value: 'Hooray!',
child: new Text('Hooray!')
child: const Text('Hooray!')
),
]
)
@@ -90,22 +90,22 @@ class MenuDemoState extends State<MenuDemo> {
// a simple menu with one disabled item. Typically the contents
// of this "contextual menu" would reflect the app's state.
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>(
padding: EdgeInsets.zero,
onSelected: showMenuSelection,
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem<String>(
value: _simpleValue1,
child: new Text('Context menu item one')
child: const Text('Context menu item one')
),
new PopupMenuItem<String>(
enabled: false,
child: new Text('A disabled menu item')
child: const Text('A disabled menu item')
),
new PopupMenuItem<String>(
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> {
// a menu whose items have text labels and icons and a divider
// That separates the first three items from the last one.
new ListTile(
title: new Text('An item with a sectioned menu'),
title: const Text('An item with a sectioned menu'),
trailing: new PopupMenuButton<String>(
padding: EdgeInsets.zero,
onSelected: showMenuSelection,
@@ -122,30 +122,30 @@ class MenuDemoState extends State<MenuDemo> {
new PopupMenuItem<String>(
value: 'Preview',
child: new ListTile(
leading: new Icon(Icons.visibility),
title: new Text('Preview')
leading: const Icon(Icons.visibility),
title: const Text('Preview')
)
),
new PopupMenuItem<String>(
value: 'Share',
child: new ListTile(
leading: new Icon(Icons.person_add),
title: new Text('Share')
leading: const Icon(Icons.person_add),
title: const Text('Share')
)
),
new PopupMenuItem<String>(
value: 'Get Link',
child: new ListTile(
leading: new Icon(Icons.link),
title: new Text('Get link')
leading: const Icon(Icons.link),
title: const Text('Get link')
)
),
new PopupMenuDivider(), // ignore: list_element_type_not_assignable, https://github.com/flutter/flutter/issues/5771
new PopupMenuItem<String>(
value: 'Remove',
child: new ListTile(
leading: new Icon(Icons.delete),
title: new Text('Remove')
leading: const Icon(Icons.delete),
title: const Text('Remove')
)
)
]
@@ -159,7 +159,7 @@ class MenuDemoState extends State<MenuDemo> {
initialValue: _simpleValue,
onSelected: showMenuSelection,
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)
),
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
@@ -180,7 +180,7 @@ class MenuDemoState extends State<MenuDemo> {
// Pressing the PopupMenuButton on the right of this item shows a menu
// whose items have checked icons that reflect this app's state.
new ListTile(
title: new Text('An item with a checklist menu'),
title: const Text('An item with a checklist menu'),
trailing: new PopupMenuButton<String>(
padding: EdgeInsets.zero,
onSelected: showCheckedMenuSelections,

View File

@@ -10,10 +10,10 @@ class ModalBottomSheetDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text('Modal bottom sheet')),
appBar: new AppBar(title: const Text('Modal bottom sheet')),
body: new Center(
child: new RaisedButton(
child: new Text('SHOW BOTTOM SHEET'),
child: const Text('SHOW BOTTOM SHEET'),
onPressed: () {
showModalBottomSheet<Null>(context: context, builder: (BuildContext context) {
return new Container(

View File

@@ -29,7 +29,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
new Timer(const Duration(seconds: 3), () { completer.complete(null); });
return completer.future.then((_) {
_scaffoldKey.currentState?.showSnackBar(new SnackBar(
content: new Text("Refresh complete"),
content: const Text("Refresh complete"),
action: new SnackBarAction(
label: 'RETRY',
onPressed: () {
@@ -45,10 +45,10 @@ class OverscrollDemoState extends State<OverscrollDemo> {
return new Scaffold(
key: _scaffoldKey,
appBar: new AppBar(
title: new Text('Pull to refresh'),
title: const Text('Pull to refresh'),
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.refresh),
icon: const Icon(Icons.refresh),
tooltip: 'Refresh',
onPressed: () {
_refreshIndicatorKey.currentState.show();
@@ -68,7 +68,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
isThreeLine: true,
leading: new CircleAvatar(child: new Text(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.'),
);
},
),

View File

@@ -26,14 +26,14 @@ class _PageSelector extends StatelessWidget {
child: new Row(
children: <Widget>[
new IconButton(
icon: new Icon(Icons.chevron_left),
icon: const Icon(Icons.chevron_left),
color: color,
onPressed: () { _handleArrowButtonPress(context, -1); },
tooltip: 'Page back'
),
new TabPageSelector(controller: controller),
new IconButton(
icon: new Icon(Icons.chevron_right),
icon: const Icon(Icons.chevron_right),
color: color,
onPressed: () { _handleArrowButtonPress(context, 1); },
tooltip: 'Page forward'
@@ -76,7 +76,7 @@ class PageSelectorDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text('Page selector')),
appBar: new AppBar(title: const Text('Page selector')),
body: new DefaultTabController(
length: icons.length,
child: new _PageSelector(icons: icons),

View File

@@ -57,11 +57,11 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
showDialog<Null>(
context: context,
child: new AlertDialog(
content: new Text('You tapped the floating action button.'),
content: const Text('You tapped the floating action button.'),
actions: <Widget>[
new FlatButton(
onPressed: () { Navigator.pop(context); },
child: new Text('OK')
child: const Text('OK')
)
]
)
@@ -72,16 +72,16 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
Widget build(BuildContext context) {
return new Scaffold(
key: _scaffoldKey,
appBar: new AppBar(title: new Text('Persistent bottom sheet')),
appBar: new AppBar(title: const Text('Persistent bottom sheet')),
floatingActionButton: new FloatingActionButton(
onPressed: _showMessage,
backgroundColor: Colors.redAccent,
child: new Icon(Icons.add)
child: const Icon(Icons.add)
),
body: new Center(
child: new RaisedButton(
onPressed: _showBottomSheetCallback,
child: new Text('SHOW BOTTOM SHEET')
child: const Text('SHOW BOTTOM SHEET')
)
)
);

View File

@@ -25,7 +25,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
_animation = new CurvedAnimation(
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
)..addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.dismissed)
@@ -99,7 +99,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text('Progress indicators')),
appBar: new AppBar(title: const Text('Progress indicators')),
body: new Center(
child: new SingleChildScrollView(
child: new DefaultTextStyle(

View File

@@ -59,22 +59,22 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
final Color iconColor = Theme.of(context).accentColor;
return new Scaffold(
appBar: new AppBar(
title: new Text('Scrollable tabs'),
title: const Text('Scrollable tabs'),
actions: <Widget>[
new PopupMenuButton<TabsDemoStyle>(
onSelected: changeDemoStyle,
itemBuilder: (BuildContext context) => <PopupMenuItem<TabsDemoStyle>>[
new PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.iconsAndText,
child: new Text('Icons and text')
child: const Text('Icons and text')
),
new PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.iconsOnly,
child: new Text('Icons only')
child: const Text('Icons only')
),
new PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.textOnly,
child: new Text('Text only')
child: const Text('Text only')
),
],
),

View File

@@ -18,7 +18,7 @@ class _SliderDemoState extends State<SliderDemo> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text('Sliders')),
appBar: new AppBar(title: const Text('Sliders')),
body: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
@@ -37,14 +37,14 @@ class _SliderDemoState extends State<SliderDemo> {
});
}
),
new Text('Continuous'),
const Text('Continuous'),
]
),
new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget> [
new Slider(value: 0.25, thumbOpenAtMin: true, onChanged: null),
new Text('Disabled'),
const Text('Disabled'),
]
),
new Column(
@@ -63,7 +63,7 @@ class _SliderDemoState extends State<SliderDemo> {
});
}
),
new Text('Discrete'),
const Text('Discrete'),
],
),
],

View File

@@ -32,11 +32,11 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
return new ListView(
padding: const EdgeInsets.all(24.0),
children: <Widget>[
new Text(_text1),
new Text(_text2),
const Text(_text1),
const Text(_text2),
new Center(
child: new RaisedButton(
child: new Text('SHOW A SNACKBAR'),
child: const Text('SHOW A SNACKBAR'),
onPressed: () {
final int thisSnackBarIndex = _snackBarIndex++;
Scaffold.of(context).showSnackBar(new SnackBar(
@@ -53,7 +53,7 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
}
)
),
new Text(_text3),
const Text(_text3),
]
.map((Widget child) {
return new Container(
@@ -69,7 +69,7 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Snackbar')
title: const Text('Snackbar')
),
body: new Builder(
// Create an inner BuildContext so that the snackBar onPressed methods

View File

@@ -120,7 +120,7 @@ class TabsDemo extends StatelessWidget {
length: _allPages.length,
child: new Scaffold(
appBar: new AppBar(
title: new Text('Tabs and scrolling'),
title: const Text('Tabs and scrolling'),
bottom: new TabBar(
tabs: _allPages.keys.map((_Page page) => new Tab(text: page.label)).toList(),
),

View File

@@ -106,7 +106,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
return new Scaffold(
key: _scaffoldKey,
appBar: new AppBar(
title: new Text('FAB per tab'),
title: const Text('FAB per tab'),
bottom: new TabBar(
controller: _controller,
tabs: _allPages.map((_Page page) => new Tab(text: page.label.toUpperCase())).toList(),

View File

@@ -83,15 +83,15 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
return await showDialog<bool>(
context: context,
child: new AlertDialog(
title: new Text('This form has errors'),
content: new Text('Really leave this form?'),
title: const Text('This form has errors'),
content: const Text('Really leave this form?'),
actions: <Widget> [
new FlatButton(
child: new Text('YES'),
child: const Text('YES'),
onPressed: () { Navigator.of(context).pop(true); },
),
new FlatButton(
child: new Text('NO'),
child: const Text('NO'),
onPressed: () { Navigator.of(context).pop(false); },
),
],
@@ -104,7 +104,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
return new Scaffold(
key: _scaffoldKey,
appBar: new AppBar(
title: new Text('Text fields'),
title: const Text('Text fields'),
),
body: new Form(
key: _formKey,
@@ -170,7 +170,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
padding: const EdgeInsets.all(20.0),
alignment: const FractionalOffset(0.5, 0.5),
child: new RaisedButton(
child: new Text('SUBMIT'),
child: const Text('SUBMIT'),
onPressed: _handleSubmitted,
),
),

View File

@@ -18,7 +18,7 @@ class TooltipDemo extends StatelessWidget {
final ThemeData theme = Theme.of(context);
return new Scaffold(
appBar: new AppBar(
title: new Text('Tooltips')
title: const Text('Tooltips')
),
body: new Builder(
builder: (BuildContext context) {
@@ -42,12 +42,12 @@ class TooltipDemo extends StatelessWidget {
new Center(
child: new IconButton(
iconSize: 48.0,
icon: new Icon(Icons.call),
icon: const Icon(Icons.call),
color: theme.iconTheme.color,
tooltip: 'Place a phone call',
onPressed: () {
Scaffold.of(context).showSnackBar(new SnackBar(
content: new Text('That was an ordinary tap.')
content: const Text('That was an ordinary tap.')
));
}
)

View File

@@ -10,23 +10,23 @@ class TwoLevelListDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
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(
type: MaterialListType.oneLine,
children: <Widget>[
new TwoLevelListItem(title: new Text('Top')),
new TwoLevelListItem(title: const Text('Top')),
new TwoLevelSublist(
title: new Text('Sublist'),
title: const Text('Sublist'),
backgroundColor: Theme.of(context).accentColor.withOpacity(0.025),
children: <Widget>[
new TwoLevelListItem(title: new Text('One')),
new TwoLevelListItem(title: new Text('Two')),
new TwoLevelListItem(title: const Text('One')),
new TwoLevelListItem(title: const Text('Two')),
// https://en.wikipedia.org/wiki/Free_Four
new TwoLevelListItem(title: new Text('Free')),
new TwoLevelListItem(title: new Text('Four'))
new TwoLevelListItem(title: const Text('Free')),
new TwoLevelListItem(title: const Text('Four'))
]
),
new TwoLevelListItem(title: new Text('Bottom'))
new TwoLevelListItem(title: const Text('Bottom'))
]
)
);

View File

@@ -82,10 +82,10 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
child: new Scaffold(
key: scaffoldKey,
floatingActionButton: new FloatingActionButton(
child: new Icon(Icons.edit),
child: const Icon(Icons.edit),
onPressed: () {
scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('Not supported.'),
content: const Text('Not supported.'),
));
},
),
@@ -105,11 +105,11 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
expandedHeight: _kAppBarHeight,
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.search),
icon: const Icon(Icons.search),
tooltip: 'Search',
onPressed: () {
scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('Not supported.'),
content: const Text('Not supported.'),
));
},
),

View File

@@ -181,7 +181,7 @@ class _Heading extends StatelessWidget {
),
new LayoutId(
id: _HeadingLayout.icon,
child: new Icon(
child: const Icon(
Icons.info_outline,
size: 24.0,
color: const Color(0xFFFFE0E0),
@@ -275,7 +275,7 @@ class _OrderPageState extends State<OrderPage> {
);
},
backgroundColor: const Color(0xFF16F0F0),
child: new Icon(
child: const Icon(
Icons.add_shopping_cart,
color: Colors.black,
),

View File

@@ -54,9 +54,9 @@ class ShrinePageState extends State<ShrinePage> {
void _showShoppingCart() {
showModalBottomSheet<Null>(context: context, builder: (BuildContext context) {
if (config.shoppingCart.isEmpty) {
return new Padding(
return const Padding(
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(
@@ -82,7 +82,7 @@ class ShrinePageState extends State<ShrinePage> {
void _emptyCart() {
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
@@ -107,7 +107,7 @@ class ShrinePageState extends State<ShrinePage> {
),
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.shopping_cart),
icon: const Icon(Icons.shopping_cart),
tooltip: 'Shopping cart',
onPressed: _showShoppingCart
),
@@ -115,15 +115,15 @@ class ShrinePageState extends State<ShrinePage> {
itemBuilder: (BuildContext context) => <PopupMenuItem<ShrineAction>>[
new PopupMenuItem<ShrineAction>(
value: ShrineAction.sortByPrice,
child: new Text('Sort by price')
child: const Text('Sort by price')
),
new PopupMenuItem<ShrineAction>(
value: ShrineAction.sortByProduct,
child: new Text('Sort by product')
child: const Text('Sort by product')
),
new PopupMenuItem<ShrineAction>(
value: ShrineAction.emptyCart,
child: new Text('Empty shopping cart')
child: const Text('Empty shopping cart')
)
],
onSelected: (ShrineAction action) {

View File

@@ -71,7 +71,7 @@ class TypographyDemo extends StatelessWidget {
}
return new Scaffold(
appBar: new AppBar(title: new Text('Typography')),
appBar: new AppBar(title: const Text('Typography')),
body: new ListView(children: styleItems)
);
}

View File

@@ -61,7 +61,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
new Builder(
builder: (BuildContext context) {
return new IconButton(
icon: new Icon(Icons.description),
icon: const Icon(Icons.description),
tooltip: 'Show example code',
onPressed: () {
_showExampleCode(context);
@@ -150,10 +150,10 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
return new Scaffold(
appBar: new AppBar(
leading: new IconButton(
icon: new Icon(Icons.clear),
icon: const Icon(Icons.clear),
onPressed: () { Navigator.pop(context); }
),
title: new Text('Example code')
title: const Text('Example code')
),
body: body
);

View File

@@ -127,8 +127,8 @@ class GalleryDrawer extends StatelessWidget {
final TextStyle linkStyle = themeData.textTheme.body2.copyWith(color: themeData.accentColor);
final Widget lightThemeItem = new ListTile(
leading: new Icon(Icons.brightness_5),
title: new Text('Light'),
leading: const Icon(Icons.brightness_5),
title: const Text('Light'),
trailing: new Radio<bool>(
value: true,
groupValue: useLightTheme,
@@ -141,8 +141,8 @@ class GalleryDrawer extends StatelessWidget {
);
final Widget darkThemeItem = new ListTile(
leading: new Icon(Icons.brightness_7),
title: new Text('Dark'),
leading: const Icon(Icons.brightness_7),
title: const Text('Dark'),
trailing: new Radio<bool>(
value: false,
groupValue: useLightTheme,
@@ -157,7 +157,7 @@ class GalleryDrawer extends StatelessWidget {
final Widget mountainViewItem = new ListTile(
// on iOS, we don't want to show an Android phone icon
leading: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star : Icons.phone_android),
title: new Text('Android'),
title: const Text('Android'),
trailing: new Radio<TargetPlatform>(
value: TargetPlatform.android,
groupValue: Theme.of(context).platform,
@@ -172,7 +172,7 @@ class GalleryDrawer extends StatelessWidget {
final Widget cupertinoItem = new ListTile(
// on iOS, we don't want to show the iPhone icon
leading: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star_border : Icons.phone_iphone),
title: new Text('iOS'),
title: const Text('iOS'),
trailing: new Radio<TargetPlatform>(
value: TargetPlatform.iOS,
groupValue: Theme.of(context).platform,
@@ -185,8 +185,8 @@ class GalleryDrawer extends StatelessWidget {
);
final Widget animateSlowlyItem = new ListTile(
leading: new Icon(Icons.hourglass_empty),
title: new Text('Animate Slowly'),
leading: const Icon(Icons.hourglass_empty),
title: const Text('Animate Slowly'),
trailing: new Checkbox(
value: timeDilation != 1.0,
onChanged: (bool value) {
@@ -200,8 +200,8 @@ class GalleryDrawer extends StatelessWidget {
);
final Widget sendFeedbackItem = new ListTile(
leading: new Icon(Icons.report),
title: new Text('Send feedback'),
leading: const Icon(Icons.report),
title: const Text('Send feedback'),
onTap: onSendFeedback ?? () {
UrlLauncher.launch('https://github.com/flutter/flutter/issues/new');
},
@@ -266,8 +266,8 @@ class GalleryDrawer extends StatelessWidget {
if (onShowPerformanceOverlayChanged != null) {
allDrawerItems.insert(8, new ListTile(
leading: new Icon(Icons.assessment),
title: new Text('Performance Overlay'),
leading: const Icon(Icons.assessment),
title: const Text('Performance Overlay'),
trailing: new Checkbox(
value: showPerformanceOverlay,
onChanged: (bool value) {
@@ -283,8 +283,8 @@ class GalleryDrawer extends StatelessWidget {
if (onCheckerboardRasterCacheImagesChanged != null) {
allDrawerItems.insert(8, new ListTile(
leading: new Icon(Icons.assessment),
title: new Text('Checkerboard Raster Cache Images'),
leading: const Icon(Icons.assessment),
title: const Text('Checkerboard Raster Cache Images'),
trailing: new Checkbox(
value: checkerboardRasterCacheImages,
onChanged: (bool value) {

View File

@@ -16,7 +16,7 @@ class ButtonsDemo {
// START buttons_raised
// Create a raised button.
new RaisedButton(
child: new Text('BUTTON TITLE'),
child: const Text('BUTTON TITLE'),
onPressed: () {
// Perform some action
}
@@ -26,7 +26,7 @@ new RaisedButton(
// Buttons are disabled when onPressed isn't
// specified or is null.
new RaisedButton(
child: new Text('BUTTON TITLE'),
child: const Text('BUTTON TITLE'),
onPressed: null
);
// END
@@ -35,7 +35,7 @@ new RaisedButton(
// START buttons_flat
// Create a flat button.
new FlatButton(
child: new Text('BUTTON TITLE'),
child: const Text('BUTTON TITLE'),
onPressed: () {
// Perform some action
}
@@ -45,7 +45,7 @@ new FlatButton(
// Buttons are disabled when onPressed isn't
// specified or is null.
new FlatButton(
child: new Text('BUTTON TITLE'),
child: const Text('BUTTON TITLE'),
onPressed: null
);
// END
@@ -83,7 +83,7 @@ bool value;
// Toggleable icon button.
new IconButton(
icon: new Icon(Icons.thumb_up),
icon: const Icon(Icons.thumb_up),
onPressed: () {
setState(() => value = !value);
},
@@ -96,10 +96,10 @@ new IconButton(
// Floating action button in Scaffold.
new Scaffold(
appBar: new AppBar(
title: new Text('Demo')
title: const Text('Demo')
),
floatingActionButton: new FloatingActionButton(
child: new Icon(Icons.add),
floatingActionButton: const FloatingActionButton(
child: const Icon(Icons.add),
onPressed: null
)
);

View File

@@ -170,7 +170,7 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState
pinned: true,
expandedHeight: _kFlexibleSpaceMaxHeight,
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.
background: new _AppBarBackground(animation: kAlwaysDismissedAnimation),
),
@@ -194,7 +194,7 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState
home,
new FadeTransition(
opacity: new CurvedAnimation(parent: _controller, curve: Curves.easeInOut),
child: new Banner(
child: const Banner(
message: 'PREVIEW',
location: BannerLocation.topRight,
)

View File

@@ -51,16 +51,16 @@ class UpdaterState extends State<Updater> {
final TextStyle dialogTextStyle =
theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
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),
actions: <Widget>[
new FlatButton(
child: new Text('NO THANKS'),
child: const Text('NO THANKS'),
onPressed: () {
Navigator.pop(context, false);
}),
new FlatButton(
child: new Text('UPDATE'),
child: const Text('UPDATE'),
onPressed: () {
Navigator.pop(context, true);
}),

View File

@@ -61,7 +61,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: new Center(
child: new Text(
'Platform button tapped $_counter time${ _counter == 1 ? '' : 's' }.',
style: new TextStyle(fontSize: 17.0))
style: const TextStyle(fontSize: 17.0))
),
),
new Container(
@@ -69,7 +69,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: new Row(
children: <Widget>[
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> {
),
floatingActionButton: new FloatingActionButton(
onPressed: _sendFlutterIncrement,
child: new Icon(Icons.add),
child: const Icon(Icons.add),
),
);
}

View File

@@ -4,4 +4,4 @@
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!')));

View File

@@ -102,8 +102,8 @@ class RenderDots extends RenderBox {
void main() {
// Create some styled text to tell the user to interact with the app.
final RenderParagraph paragraph = new RenderParagraph(
new TextSpan(
style: new TextStyle(color: Colors.black87),
const TextSpan(
style: const TextStyle(color: Colors.black87),
text: "Touch me!"
)
);

View File

@@ -35,7 +35,7 @@ class _LifecycleWatcherState extends State<LifecycleWatcher>
@override
Widget build(BuildContext context) {
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.');
}
}

View File

@@ -46,5 +46,5 @@ class Dots extends SingleChildRenderObjectWidget {
}
void main() {
runApp(new Dots(child: new Center(child: new Text('Touch me!'))));
runApp(new Dots(child: const Center(child: const Text('Touch me!'))));
}

View File

@@ -188,7 +188,7 @@ class _GestureDemoState extends State<GestureDemo> {
value: _scaleEnabled,
onChanged: (bool value) { setState(() { _scaleEnabled = value; }); }
),
new Text('Scale'),
const Text('Scale'),
]
),
new Row(
@@ -197,7 +197,7 @@ class _GestureDemoState extends State<GestureDemo> {
value: _tapEnabled,
onChanged: (bool value) { setState(() { _tapEnabled = value; }); }
),
new Text('Tap'),
const Text('Tap'),
]
),
new Row(
@@ -206,7 +206,7 @@ class _GestureDemoState extends State<GestureDemo> {
value: _doubleTapEnabled,
onChanged: (bool value) { setState(() { _doubleTapEnabled = value; }); }
),
new Text('Double Tap'),
const Text('Double Tap'),
]
),
new Row(
@@ -215,7 +215,7 @@ class _GestureDemoState extends State<GestureDemo> {
value: _longPressEnabled,
onChanged: (bool value) { setState(() { _longPressEnabled = value; }); }
),
new Text('Long Press'),
const Text('Long Press'),
]
),
],
@@ -233,7 +233,7 @@ void main() {
runApp(new MaterialApp(
theme: new ThemeData.dark(),
home: new Scaffold(
appBar: new AppBar(title: new Text('Gestures Demo')),
appBar: new AppBar(title: const Text('Gestures Demo')),
body: new GestureDemo()
)
));

View File

@@ -4,4 +4,4 @@
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!')));

View File

@@ -51,8 +51,8 @@ class AdaptedGridItem extends StatelessWidget {
new Expanded(
child: new Text(name)
),
new IconButton(
icon: new Icon(Icons.more_vert),
const IconButton(
icon: const Icon(Icons.more_vert),
onPressed: null
)
]
@@ -103,7 +103,7 @@ void main() {
title: 'Media Query Example',
home: new Scaffold(
appBar: new AppBar(
title: new Text('Media Query Example')
title: const Text('Media Query Example')
),
body: new Material(child: new AdaptiveContainer(names: _kNames))
)

View File

@@ -106,7 +106,7 @@ class SectorAppState extends State<SectorApp> {
margin: const EdgeInsets.only(right: 10.0),
child: new WidgetToRenderBoxAdapter(renderBox: sectorAddIcon)
),
new Text('ADD SECTOR'),
const Text('ADD SECTOR'),
]
)
)
@@ -121,7 +121,7 @@ class SectorAppState extends State<SectorApp> {
margin: const EdgeInsets.only(right: 10.0),
child: new WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon)
),
new Text('REMOVE SECTOR'),
const Text('REMOVE SECTOR'),
]
)
)
@@ -155,7 +155,7 @@ class SectorAppState extends State<SectorApp> {
title: 'Sector Layout',
home: new Scaffold(
appBar: new AppBar(
title: new Text('Sector Layout in a Widget Tree')
title: const Text('Sector Layout in a Widget Tree')
),
body: buildBody()
)

View File

@@ -52,7 +52,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
child: new Row(
children: <Widget>[
new Image.network('https://flutter.io/images/favicon.png'),
new Text('PRESS ME'),
const Text('PRESS ME'),
]
),
onPressed: () {

View File

@@ -124,7 +124,7 @@ void main() {
theme: new ThemeData.light(),
home: new Scaffold(
appBar: new AppBar(
title: new Text('Hal and Dave')
title: const Text('Hal and Dave')
),
body: new Material(
color: Colors.grey.shade50,

View File

@@ -62,11 +62,11 @@ class _PlatformChannelState extends State<PlatformChannel> {
new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(_batteryLevel, key: new Key('Battery level label')),
new Text(_batteryLevel, key: const Key('Battery level label')),
new Padding(
padding: new EdgeInsets.all(16.0),
padding: const EdgeInsets.all(16.0),
child: new RaisedButton(
child: new Text('Refresh'),
child: const Text('Refresh'),
onPressed: _getBatteryLevel,
),
),

View File

@@ -37,10 +37,10 @@ class _PlatformChannelState extends State<PlatformChannel> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
new RaisedButton(
child: new Text('Get Battery Level'),
child: const Text('Get Battery Level'),
onPressed: _getBatteryLevel,
),
new Text(_batteryLevel, key: new Key('Battery level label')),
new Text(_batteryLevel, key: const Key('Battery level label')),
],
),
),

View File

@@ -20,21 +20,21 @@ class _NotImplementedDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new AlertDialog(
title: new Text('Not Implemented'),
content: new Text('This feature has not yet been implemented.'),
title: const Text('Not Implemented'),
content: const Text('This feature has not yet been implemented.'),
actions: <Widget>[
new FlatButton(
onPressed: debugDumpApp,
child: new Row(
children: <Widget>[
new Icon(
const Icon(
Icons.dvr,
size: 18.0,
),
new Container(
width: 8.0,
),
new Text('DUMP APP TO CONSOLE'),
const Text('DUMP APP TO CONSOLE'),
],
),
),
@@ -42,7 +42,7 @@ class _NotImplementedDialog extends StatelessWidget {
onPressed: () {
Navigator.pop(context, false);
},
child: new Text('OH WELL'),
child: const Text('OH WELL'),
),
],
);
@@ -117,20 +117,20 @@ class StockHomeState extends State<StockHome> {
return new Drawer(
child: new ListView(
children: <Widget>[
new DrawerHeader(child: new Center(child: new Text('Stocks'))),
const DrawerHeader(child: const Center(child: const Text('Stocks'))),
new ListTile(
leading: new Icon(Icons.assessment),
title: new Text('Stock List'),
leading: const Icon(Icons.assessment),
title: const Text('Stock List'),
selected: true,
),
new ListTile(
leading: new Icon(Icons.account_balance),
title: new Text('Account Balance'),
leading: const Icon(Icons.account_balance),
title: const Text('Account Balance'),
enabled: false,
),
new ListTile(
leading: new Icon(Icons.dvr),
title: new Text('Dump App to Console'),
leading: const Icon(Icons.dvr),
title: const Text('Dump App to Console'),
onTap: () {
try {
debugDumpApp();
@@ -144,8 +144,8 @@ class StockHomeState extends State<StockHome> {
),
new Divider(),
new ListTile(
leading: new Icon(Icons.thumb_up),
title: new Text('Optimistic'),
leading: const Icon(Icons.thumb_up),
title: const Text('Optimistic'),
trailing: new Radio<StockMode>(
value: StockMode.optimistic,
groupValue: config.configuration.stockMode,
@@ -156,8 +156,8 @@ class StockHomeState extends State<StockHome> {
},
),
new ListTile(
leading: new Icon(Icons.thumb_down),
title: new Text('Pessimistic'),
leading: const Icon(Icons.thumb_down),
title: const Text('Pessimistic'),
trailing: new Radio<StockMode>(
value: StockMode.pessimistic,
groupValue: config.configuration.stockMode,
@@ -169,13 +169,13 @@ class StockHomeState extends State<StockHome> {
),
new Divider(),
new ListTile(
leading: new Icon(Icons.settings),
title: new Text('Settings'),
leading: const Icon(Icons.settings),
title: const Text('Settings'),
onTap: _handleShowSettings,
),
new ListTile(
leading: new Icon(Icons.help),
title: new Text('About'),
leading: const Icon(Icons.help),
title: const Text('About'),
onTap: _handleShowAbout,
),
],
@@ -197,7 +197,7 @@ class StockHomeState extends State<StockHome> {
title: new Text(StockStrings.of(context).title()),
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.search),
icon: const Icon(Icons.search),
onPressed: _handleSearchBegin,
tooltip: 'Search',
),
@@ -207,19 +207,19 @@ class StockHomeState extends State<StockHome> {
new CheckedPopupMenuItem<_StockMenuItem>(
value: _StockMenuItem.autorefresh,
checked: _autorefresh,
child: new Text('Autorefresh'),
child: const Text('Autorefresh'),
),
new PopupMenuItem<_StockMenuItem>(
value: _StockMenuItem.refresh,
child: new Text('Refresh'),
child: const Text('Refresh'),
),
new PopupMenuItem<_StockMenuItem>(
value: _StockMenuItem.speedUp,
child: new Text('Increase animation speed'),
child: const Text('Increase animation speed'),
),
new PopupMenuItem<_StockMenuItem>(
value: _StockMenuItem.speedDown,
child: new Text('Decrease animation speed'),
child: const Text('Decrease animation speed'),
),
],
),
@@ -287,7 +287,7 @@ class StockHomeState extends State<StockHome> {
Widget buildSearchBar() {
return new AppBar(
leading: new IconButton(
icon: new Icon(Icons.arrow_back),
icon: const Icon(Icons.arrow_back),
color: Theme.of(context).accentColor,
onPressed: _handleSearchEnd,
tooltip: 'Back',
@@ -313,7 +313,7 @@ class StockHomeState extends State<StockHome> {
Widget buildFloatingActionButton() {
return new FloatingActionButton(
tooltip: 'Create company',
child: new Icon(Icons.add),
child: const Icon(Icons.add),
backgroundColor: Colors.redAccent,
onPressed: _handleCreateCompany,
);

View File

@@ -68,17 +68,17 @@ class StockSettingsState extends State<StockSettings> {
showDialog<bool>(
context: context,
child: new AlertDialog(
title: new Text("Change mode?"),
content: new Text("Optimistic mode means everything is awesome. Are you sure you can handle that?"),
title: const Text("Change mode?"),
content: const Text("Optimistic mode means everything is awesome. Are you sure you can handle that?"),
actions: <Widget>[
new FlatButton(
child: new Text('NO THANKS'),
child: const Text('NO THANKS'),
onPressed: () {
Navigator.pop(context, false);
}
),
new FlatButton(
child: new Text('AGREE'),
child: const Text('AGREE'),
onPressed: () {
Navigator.pop(context, true);
}
@@ -97,15 +97,15 @@ class StockSettingsState extends State<StockSettings> {
Widget buildAppBar(BuildContext context) {
return new AppBar(
title: new Text('Settings')
title: const Text('Settings')
);
}
Widget buildSettingsPane(BuildContext context) {
final List<Widget> rows = <Widget>[
new ListTile(
leading: new Icon(Icons.thumb_up),
title: new Text('Everything is awesome'),
leading: const Icon(Icons.thumb_up),
title: const Text('Everything is awesome'),
onTap: _confirmOptimismChange,
trailing: new Checkbox(
value: config.configuration.stockMode == StockMode.optimistic,
@@ -113,8 +113,8 @@ class StockSettingsState extends State<StockSettings> {
),
),
new ListTile(
leading: new Icon(Icons.backup),
title: new Text('Back up stock list to the cloud'),
leading: const Icon(Icons.backup),
title: const Text('Back up stock list to the cloud'),
onTap: () { _handleBackupChanged(!(config.configuration.backupMode == BackupMode.enabled)); },
trailing: new Switch(
value: config.configuration.backupMode == BackupMode.enabled,
@@ -122,8 +122,8 @@ class StockSettingsState extends State<StockSettings> {
),
),
new ListTile(
leading: new Icon(Icons.picture_in_picture),
title: new Text('Show rendering performance overlay'),
leading: const Icon(Icons.picture_in_picture),
title: const Text('Show rendering performance overlay'),
onTap: () { _handleShowPerformanceOverlayChanged(!config.configuration.showPerformanceOverlay); },
trailing: new Switch(
value: config.configuration.showPerformanceOverlay,
@@ -131,8 +131,8 @@ class StockSettingsState extends State<StockSettings> {
),
),
new ListTile(
leading: new Icon(Icons.accessibility),
title: new Text('Show semantics overlay'),
leading: const Icon(Icons.accessibility),
title: const Text('Show semantics overlay'),
onTap: () { _handleShowSemanticsDebuggerChanged(!config.configuration.showSemanticsDebugger); },
trailing: new Switch(
value: config.configuration.showSemanticsDebugger,
@@ -144,8 +144,8 @@ class StockSettingsState extends State<StockSettings> {
// material grid and size construction lines are only available in checked mode
rows.addAll(<Widget>[
new ListTile(
leading: new Icon(Icons.border_clear),
title: new Text('Show material grid (for debugging)'),
leading: const Icon(Icons.border_clear),
title: const Text('Show material grid (for debugging)'),
onTap: () { _handleShowGridChanged(!config.configuration.debugShowGrid); },
trailing: new Switch(
value: config.configuration.debugShowGrid,
@@ -153,8 +153,8 @@ class StockSettingsState extends State<StockSettings> {
),
),
new ListTile(
leading: new Icon(Icons.border_all),
title: new Text('Show construction lines (for debugging)'),
leading: const Icon(Icons.border_all),
title: const Text('Show construction lines (for debugging)'),
onTap: () { _handleShowSizesChanged(!config.configuration.debugShowSizes); },
trailing: new Switch(
value: config.configuration.debugShowSizes,
@@ -162,8 +162,8 @@ class StockSettingsState extends State<StockSettings> {
),
),
new ListTile(
leading: new Icon(Icons.format_color_text),
title: new Text('Show baselines (for debugging)'),
leading: const Icon(Icons.format_color_text),
title: const Text('Show baselines (for debugging)'),
onTap: () { _handleShowBaselinesChanged(!config.configuration.debugShowBaselines); },
trailing: new Switch(
value: config.configuration.debugShowBaselines,
@@ -171,8 +171,8 @@ class StockSettingsState extends State<StockSettings> {
),
),
new ListTile(
leading: new Icon(Icons.filter_none),
title: new Text('Show layer boundaries (for debugging)'),
leading: const Icon(Icons.filter_none),
title: const Text('Show layer boundaries (for debugging)'),
onTap: () { _handleShowLayersChanged(!config.configuration.debugShowLayers); },
trailing: new Switch(
value: config.configuration.debugShowLayers,
@@ -180,8 +180,8 @@ class StockSettingsState extends State<StockSettings> {
),
),
new ListTile(
leading: new Icon(Icons.mouse),
title: new Text('Show pointer hit-testing (for debugging)'),
leading: const Icon(Icons.mouse),
title: const Text('Show pointer hit-testing (for debugging)'),
onTap: () { _handleShowPointersChanged(!config.configuration.debugShowPointers); },
trailing: new Switch(
value: config.configuration.debugShowPointers,
@@ -189,8 +189,8 @@ class StockSettingsState extends State<StockSettings> {
),
),
new ListTile(
leading: new Icon(Icons.gradient),
title: new Text('Show repaint rainbow (for debugging)'),
leading: const Icon(Icons.gradient),
title: const Text('Show repaint rainbow (for debugging)'),
onTap: () { _handleShowRainbowChanged(!config.configuration.debugShowRainbow); },
trailing: new Switch(
value: config.configuration.debugShowRainbow,

View File

@@ -100,8 +100,8 @@ class StockSymbolBottomSheet extends StatelessWidget {
Widget build(BuildContext context) {
return new Container(
padding: const EdgeInsets.all(10.0),
decoration: new BoxDecoration(
border: new Border(top: new BorderSide(color: Colors.black26))
decoration: const BoxDecoration(
border: const Border(top: const BorderSide(color: Colors.black26))
),
child: new _StockSymbolView(
stock: stock,