From b0492cc976e8f51e4832e0f88a57efc77433471d Mon Sep 17 00:00:00 2001 From: Konstantin Scheglov Date: Tue, 7 Apr 2020 08:59:01 -0700 Subject: [PATCH] Fix newly reported prefer_const_constructors lints. (#54176) --- .../flutter_test/print_correct_local_widget_test.dart | 2 +- .../macrobenchmarks/lib/src/animated_placeholder.dart | 2 +- .../macrobenchmarks/lib/src/backdrop_filter.dart | 2 +- .../macrobenchmarks/lib/src/color_filter_and_fade.dart | 4 ++-- dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart | 2 +- .../macrobenchmarks/lib/src/post_backdrop_filter.dart | 2 +- .../splash_screen_kitchen_sink/lib/main.dart | 2 +- examples/image_list/lib/main.dart | 2 +- examples/splash/lib/main.dart | 2 +- packages/flutter_localizations/test/text_test.dart | 8 ++++---- packages/flutter_tools/lib/src/ios/ios_emulators.dart | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) 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 520ced82d3..c57726de0e 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 @@ void main() { width: 400.0, child: Row( children: [ - 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 39b2dbce64..6b50419f5a 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/animated_placeholder.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/animated_placeholder.dart @@ -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), ); }, diff --git a/dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart b/dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart index ed3f1ea46b..4e7ae5b332 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart @@ -66,7 +66,7 @@ class _BackdropFilterPageState extends State with TickerProv backgroundColor: Colors.grey, body: Stack( children: [ - Text('0' * 10000, style: TextStyle(color: Colors.yellow)), + Text('0' * 10000, style: const TextStyle(color: Colors.yellow)), Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ 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 b5e421d618..e7bc88d9ec 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 @@ class _ColorFilterAndFadePageState extends State 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, ), ); diff --git a/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart b/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart index 1672f729a4..f3b9c203e7 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart @@ -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, diff --git a/dev/benchmarks/macrobenchmarks/lib/src/post_backdrop_filter.dart b/dev/benchmarks/macrobenchmarks/lib/src/post_backdrop_filter.dart index 4f348e6fee..e482528373 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 @@ class _PostBackdropFilterPageState extends State with Ti backgroundColor: Colors.grey, body: Stack( children: [ - Text('0' * 10000, style: TextStyle(color: Colors.yellow)), + Text('0' * 10000, style: const TextStyle(color: Colors.yellow)), Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ 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 cc21f20752..c1d992349a 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 @@ class _MyHomePageState extends State { 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 c2530addad..f5d0431c74 100644 --- a/examples/image_list/lib/main.dart +++ b/examples/image_list/lib/main.dart @@ -210,7 +210,7 @@ class _MyHomePageState extends State with TickerProviderStateMixin { 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 d6dc8a4315..57ec1dee88 100644 --- a/examples/splash/lib/main.dart +++ b/examples/splash/lib/main.dart @@ -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, diff --git a/packages/flutter_localizations/test/text_test.dart b/packages/flutter_localizations/test/text_test.dart index 64bd84c880..5835c8ff8e 100644 --- a/packages/flutter_localizations/test/text_test.dart +++ b/packages/flutter_localizations/test/text_test.dart @@ -43,14 +43,14 @@ void main() { }, itemBuilder: (BuildContext context) { return >[ - PopupMenuItem( + const PopupMenuItem( value: 1, child: Text( 'hello, world', style: TextStyle(color: Colors.blue), ), ), - PopupMenuItem( + const PopupMenuItem( value: 2, child: Text( '你好,世界', @@ -129,14 +129,14 @@ void main() { }, itemBuilder: (BuildContext context) { return >[ - PopupMenuItem( + const PopupMenuItem( value: 1, child: Text( 'hello, world', style: TextStyle(color: Colors.blue), ), ), - PopupMenuItem( + const PopupMenuItem( 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 ca21a40933..fd03d1b01c 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 @@ List getEmulators() { return []; } - return [IOSEmulator(iosSimulatorId)]; + return [const IOSEmulator(iosSimulatorId)]; }