Fix newly reported prefer_const_constructors lints. (#54176)
diff --git a/dev/automated_tests/flutter_test/print_correct_local_widget_test.dart b/dev/automated_tests/flutter_test/print_correct_local_widget_test.dart index 520ced8..c57726d 100644 --- a/dev/automated_tests/flutter_test/print_correct_local_widget_test.dart +++ b/dev/automated_tests/flutter_test/print_correct_local_widget_test.dart
@@ -19,7 +19,7 @@ width: 400.0, child: Row( children: <Widget>[ - Icon(Icons.message), + const Icon(Icons.message), Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start,
diff --git a/dev/benchmarks/macrobenchmarks/lib/src/animated_placeholder.dart b/dev/benchmarks/macrobenchmarks/lib/src/animated_placeholder.dart index 39b2dbc..6b50419 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/animated_placeholder.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/animated_placeholder.dart
@@ -32,7 +32,7 @@ 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), ); },
diff --git a/dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart b/dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart index ed3f1ea..4e7ae5b 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart
@@ -66,7 +66,7 @@ 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>[
diff --git a/dev/benchmarks/macrobenchmarks/lib/src/color_filter_and_fade.dart b/dev/benchmarks/macrobenchmarks/lib/src/color_filter_and_fade.dart index b5e421d..e7bc88d 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/color_filter_and_fade.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/color_filter_and_fade.dart
@@ -24,9 +24,9 @@ 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, ), );
diff --git a/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart b/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart index 1672f72..f3b9c20 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart
@@ -263,7 +263,7 @@ ), ConstrainedBox( constraints: const BoxConstraints(maxWidth: 250), - child: Text( + child: const Text( kMockName, maxLines: 1, overflow: TextOverflow.ellipsis,
diff --git a/dev/benchmarks/macrobenchmarks/lib/src/post_backdrop_filter.dart b/dev/benchmarks/macrobenchmarks/lib/src/post_backdrop_filter.dart index 4f348e6..e482528 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/post_backdrop_filter.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/post_backdrop_filter.dart
@@ -52,7 +52,7 @@ 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>[
diff --git a/dev/integration_tests/android_splash_screens/splash_screen_kitchen_sink/lib/main.dart b/dev/integration_tests/android_splash_screens/splash_screen_kitchen_sink/lib/main.dart index cc21f20..c1d9923 100644 --- a/dev/integration_tests/android_splash_screens/splash_screen_kitchen_sink/lib/main.dart +++ b/dev/integration_tests/android_splash_screens/splash_screen_kitchen_sink/lib/main.dart
@@ -108,7 +108,7 @@ 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. ); }
diff --git a/examples/image_list/lib/main.dart b/examples/image_list/lib/main.dart index c2530ad..f5d0431 100644 --- a/examples/image_list/lib/main.dart +++ b/examples/image_list/lib/main.dart
@@ -210,7 +210,7 @@ floatingActionButton: FloatingActionButton( onPressed: _incrementCounter, tooltip: 'Increment', - child: Icon(Icons.add), + child: const Icon(Icons.add), ), ); }
diff --git a/examples/splash/lib/main.dart b/examples/splash/lib/main.dart index d6dc8a4..57ec1de 100644 --- a/examples/splash/lib/main.dart +++ b/examples/splash/lib/main.dart
@@ -7,7 +7,7 @@ void main() { runApp( DecoratedBox( - decoration: BoxDecoration(color: Colors.white), + decoration: const BoxDecoration(color: Colors.white), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center,
diff --git a/packages/flutter_localizations/test/text_test.dart b/packages/flutter_localizations/test/text_test.dart index 64bd84c..5835c8f 100644 --- a/packages/flutter_localizations/test/text_test.dart +++ b/packages/flutter_localizations/test/text_test.dart
@@ -43,14 +43,14 @@ }, 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 @@ }, 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( '你好,世界',
diff --git a/packages/flutter_tools/lib/src/ios/ios_emulators.dart b/packages/flutter_tools/lib/src/ios/ios_emulators.dart index ca21a40..fd03d1b 100644 --- a/packages/flutter_tools/lib/src/ios/ios_emulators.dart +++ b/packages/flutter_tools/lib/src/ios/ios_emulators.dart
@@ -72,5 +72,5 @@ return <IOSEmulator>[]; } - return <IOSEmulator>[IOSEmulator(iosSimulatorId)]; + return <IOSEmulator>[const IOSEmulator(iosSimulatorId)]; }