Constants! Constants everywhere! (#9286)
Aggressively apply the const lint.
This commit is contained in:
@@ -14,7 +14,7 @@ class TestTestBinding extends AutomatedTestWidgetsFlutterBinding {
|
||||
|
||||
Future<Null> guardedHelper(WidgetTester tester) {
|
||||
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> {
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
appBar: new AppBar(
|
||||
title: new Text('Advanced Layout'),
|
||||
title: const Text('Advanced Layout'),
|
||||
actions: <Widget>[
|
||||
new IconButton(
|
||||
icon: new Icon(Icons.create),
|
||||
@@ -356,9 +356,9 @@ class UserHeader extends StatelessWidget {
|
||||
class ItemDescription extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Padding(
|
||||
return const Padding(
|
||||
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 {
|
||||
new FancyDrawerHeader(),
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.brightness_5),
|
||||
title: new Text('Light'),
|
||||
title: const Text('Light'),
|
||||
onTap: () { _changeTheme(context, true); },
|
||||
selected: ComplexLayoutApp.of(context).lightTheme,
|
||||
trailing: new Radio<bool>(
|
||||
@@ -590,7 +590,7 @@ class GalleryDrawer extends StatelessWidget {
|
||||
),
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.brightness_7),
|
||||
title: new Text('Dark'),
|
||||
title: const Text('Dark'),
|
||||
onTap: () { _changeTheme(context, false); },
|
||||
selected: !ComplexLayoutApp.of(context).lightTheme,
|
||||
trailing: new Radio<bool>(
|
||||
@@ -602,7 +602,7 @@ class GalleryDrawer extends StatelessWidget {
|
||||
new Divider(),
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.hourglass_empty),
|
||||
title: new Text('Animate Slowly'),
|
||||
title: const Text('Animate Slowly'),
|
||||
selected: timeDilation != 1.0,
|
||||
onTap: () { ComplexLayoutApp.of(context).toggleAnimationSpeed(); },
|
||||
trailing: new Checkbox(
|
||||
|
||||
@@ -15,7 +15,7 @@ import 'package:stack_trace/stack_trace.dart';
|
||||
String cwd = Directory.current.path;
|
||||
|
||||
List<ProcessInfo> _runningProcesses = <ProcessInfo>[];
|
||||
ProcessManager _processManager = new LocalProcessManager();
|
||||
ProcessManager _processManager = const LocalProcessManager();
|
||||
|
||||
class ProcessInfo {
|
||||
ProcessInfo(this.command, this.process);
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:process/process.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
final ProcessManager processManager = new LocalProcessManager();
|
||||
final ProcessManager processManager = const LocalProcessManager();
|
||||
|
||||
group('run.dart script', () {
|
||||
Future<int> runScript(List<String> testNames) async {
|
||||
|
||||
@@ -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