Constants! Constants everywhere! (#9286)
Aggressively apply the const lint.
This commit is contained in:
@@ -88,7 +88,7 @@ class CardCollectionState extends State<CardCollection> {
|
||||
data: const IconThemeData(color: Colors.black),
|
||||
child: new ListView(
|
||||
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("Fixed size cards", _fixedSizeCards, _toggleFixedSizeCards),
|
||||
buildDrawerCheckbox("Let the sun shine", _sunshine, _toggleSunshine),
|
||||
@@ -110,7 +110,7 @@ class CardCollectionState extends State<CardCollection> {
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.dvr),
|
||||
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> {
|
||||
}
|
||||
|
||||
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 double size;
|
||||
@@ -193,13 +193,13 @@ class MovableBall extends StatelessWidget {
|
||||
color: Colors.blue.shade700,
|
||||
size: kBallSize,
|
||||
tappable: true,
|
||||
child: new Center(child: new Text('BALL'))
|
||||
child: const Center(child: const Text('BALL'))
|
||||
)
|
||||
);
|
||||
final Widget dashedBall = new Container(
|
||||
width: kBallSize,
|
||||
height: kBallSize,
|
||||
child: new CustomPaint(
|
||||
child: const CustomPaint(
|
||||
painter: const DashOutlineCirclePainter()
|
||||
)
|
||||
);
|
||||
@@ -238,7 +238,7 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
appBar: new AppBar(
|
||||
title: new Text('Drag and Drop Flutter Demo')
|
||||
title: const Text('Drag and Drop Flutter Demo')
|
||||
),
|
||||
body: new Column(
|
||||
children: <Widget>[
|
||||
@@ -251,19 +251,19 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
||||
color: Colors.yellow.shade300,
|
||||
under: true,
|
||||
heavy: false,
|
||||
child: new Text('under')
|
||||
child: const Text('under')
|
||||
),
|
||||
new ExampleDragSource(
|
||||
color: Colors.green.shade300,
|
||||
under: false,
|
||||
heavy: true,
|
||||
child: new Text('long-press above')
|
||||
child: const Text('long-press above')
|
||||
),
|
||||
new ExampleDragSource(
|
||||
color: Colors.indigo.shade300,
|
||||
under: false,
|
||||
heavy: false,
|
||||
child: new Text('above')
|
||||
child: const Text('above')
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -444,7 +444,7 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
|
||||
length: _allDemos.length,
|
||||
child: new Scaffold(
|
||||
appBar: new AppBar(
|
||||
title: new Text('Animation'),
|
||||
title: const Text('Animation'),
|
||||
bottom: new TabBar(
|
||||
tabs: _allDemos.map((_ArcDemo demo) => new Tab(text: demo.title)).toList(),
|
||||
),
|
||||
|
||||
@@ -181,7 +181,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
|
||||
Widget build(BuildContext context) {
|
||||
final List<Widget> layers = <Widget>[
|
||||
new Scaffold(
|
||||
appBar: new AppBar(title: new Text('Tap a Card')),
|
||||
appBar: new AppBar(title: const Text('Tap a Card')),
|
||||
body: new Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
|
||||
child: new NotificationListener<ScrollNotification>(
|
||||
|
||||
@@ -84,22 +84,22 @@ class PageViewAppState extends State<PageViewApp> {
|
||||
return new Drawer(
|
||||
child: new ListView(
|
||||
children: <Widget>[
|
||||
new DrawerHeader(child: new Center(child: new Text('Options'))),
|
||||
const DrawerHeader(child: const Center(child: const Text('Options'))),
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.more_horiz),
|
||||
selected: scrollDirection == Axis.horizontal,
|
||||
trailing: new Text('Horizontal Layout'),
|
||||
trailing: const Text('Horizontal Layout'),
|
||||
onTap: switchScrollDirection,
|
||||
),
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.more_vert),
|
||||
selected: scrollDirection == Axis.vertical,
|
||||
trailing: new Text('Vertical Layout'),
|
||||
trailing: const Text('Vertical Layout'),
|
||||
onTap: switchScrollDirection,
|
||||
),
|
||||
new ListTile(
|
||||
onTap: toggleItemsWrap,
|
||||
title: new Text('Scrolling wraps around'),
|
||||
title: const Text('Scrolling wraps around'),
|
||||
// TODO(abarth): Actually make this checkbox change this value.
|
||||
trailing: new Checkbox(value: itemsWrap, onChanged: null),
|
||||
),
|
||||
@@ -110,7 +110,7 @@ class PageViewAppState extends State<PageViewApp> {
|
||||
|
||||
Widget _buildAppBar() {
|
||||
return new AppBar(
|
||||
title: new Text('PageView'),
|
||||
title: const Text('PageView'),
|
||||
actions: <Widget>[
|
||||
new Text(scrollDirection == Axis.horizontal ? "horizontal" : "vertical"),
|
||||
],
|
||||
|
||||
@@ -10,7 +10,7 @@ void main() {
|
||||
title: 'Hardware Key Demo',
|
||||
home: new Scaffold(
|
||||
appBar: new AppBar(
|
||||
title: new Text('Hardware Key Demo'),
|
||||
title: const Text('Hardware Key Demo'),
|
||||
),
|
||||
body: new Center(
|
||||
child: new RawKeyboardDemo(),
|
||||
|
||||
Reference in New Issue
Block a user