Fix newly reported prefer_const_constructors lints. (#54176)
This commit is contained in:
parent
ba18e99d1b
commit
b0492cc976
@ -19,7 +19,7 @@ void main() {
|
||||
width: 400.0,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(Icons.message),
|
||||
const Icon(Icons.message),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
@ -32,7 +32,7 @@ class AnimatedPlaceholderPage extends StatelessWidget {
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 10),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return FadeInImage(
|
||||
placeholder: DelayedBase64Image(Duration.zero, kAnimatedGif),
|
||||
placeholder: const DelayedBase64Image(Duration.zero, kAnimatedGif),
|
||||
image: DelayedBase64Image(Duration(milliseconds: 100 * index), kBlueSquare),
|
||||
);
|
||||
},
|
||||
|
@ -66,7 +66,7 @@ class _BackdropFilterPageState extends State<BackdropFilterPage> with TickerProv
|
||||
backgroundColor: Colors.grey,
|
||||
body: Stack(
|
||||
children: <Widget>[
|
||||
Text('0' * 10000, style: TextStyle(color: Colors.yellow)),
|
||||
Text('0' * 10000, style: const TextStyle(color: Colors.yellow)),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
|
@ -24,9 +24,9 @@ class _ColorFilterAndFadePageState extends State<ColorFilterAndFadePage> with Ti
|
||||
width: 24,
|
||||
height: 24,
|
||||
useColorFilter: _useColorFilter,
|
||||
shadow: ui.Shadow(
|
||||
shadow: const ui.Shadow(
|
||||
color: Colors.black45,
|
||||
offset: const Offset(0.0, 2.0),
|
||||
offset: Offset(0.0, 2.0),
|
||||
blurRadius: 4.0,
|
||||
),
|
||||
);
|
||||
|
@ -263,7 +263,7 @@ class ListItem extends StatelessWidget {
|
||||
),
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 250),
|
||||
child: Text(
|
||||
child: const Text(
|
||||
kMockName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
@ -52,7 +52,7 @@ class _PostBackdropFilterPageState extends State<PostBackdropFilterPage> with Ti
|
||||
backgroundColor: Colors.grey,
|
||||
body: Stack(
|
||||
children: <Widget>[
|
||||
Text('0' * 10000, style: TextStyle(color: Colors.yellow)),
|
||||
Text('0' * 10000, style: const TextStyle(color: Colors.yellow)),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
|
@ -108,7 +108,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _incrementCounter,
|
||||
tooltip: 'Increment',
|
||||
child: Icon(Icons.add),
|
||||
child: const Icon(Icons.add),
|
||||
), // This trailing comma makes auto-formatting nicer for build methods.
|
||||
);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _incrementCounter,
|
||||
tooltip: 'Increment',
|
||||
child: Icon(Icons.add),
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
|
||||
void main() {
|
||||
runApp(
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(color: Colors.white),
|
||||
decoration: const BoxDecoration(color: Colors.white),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
@ -43,14 +43,14 @@ void main() {
|
||||
},
|
||||
itemBuilder: (BuildContext context) {
|
||||
return <PopupMenuItem<int>>[
|
||||
PopupMenuItem<int>(
|
||||
const PopupMenuItem<int>(
|
||||
value: 1,
|
||||
child: Text(
|
||||
'hello, world',
|
||||
style: TextStyle(color: Colors.blue),
|
||||
),
|
||||
),
|
||||
PopupMenuItem<int>(
|
||||
const PopupMenuItem<int>(
|
||||
value: 2,
|
||||
child: Text(
|
||||
'你好,世界',
|
||||
@ -129,14 +129,14 @@ void main() {
|
||||
},
|
||||
itemBuilder: (BuildContext context) {
|
||||
return <PopupMenuItem<int>>[
|
||||
PopupMenuItem<int>(
|
||||
const PopupMenuItem<int>(
|
||||
value: 1,
|
||||
child: Text(
|
||||
'hello, world',
|
||||
style: TextStyle(color: Colors.blue),
|
||||
),
|
||||
),
|
||||
PopupMenuItem<int>(
|
||||
const PopupMenuItem<int>(
|
||||
value: 2,
|
||||
child: Text(
|
||||
'你好,世界',
|
||||
|
@ -72,5 +72,5 @@ List<IOSEmulator> getEmulators() {
|
||||
return <IOSEmulator>[];
|
||||
}
|
||||
|
||||
return <IOSEmulator>[IOSEmulator(iosSimulatorId)];
|
||||
return <IOSEmulator>[const IOSEmulator(iosSimulatorId)];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user