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 9999c70eb0..c24a2555f3 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 @@ -14,15 +14,15 @@ void main() { appBar: AppBar( title: const Text('RenderFlex OverFlow'), ), - body: SizedBox( + body: const SizedBox( width: 400.0, child: Row( children: [ - const Icon(Icons.message), + Icon(Icons.message), Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, - children: const [ + children: [ Text('Title'), Text( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ' diff --git a/dev/benchmarks/complex_layout/lib/src/app.dart b/dev/benchmarks/complex_layout/lib/src/app.dart index df6bccfcc5..7337d78067 100644 --- a/dev/benchmarks/complex_layout/lib/src/app.dart +++ b/dev/benchmarks/complex_layout/lib/src/app.dart @@ -279,11 +279,11 @@ class IconBar extends StatelessWidget { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.only(left: 16.0, right: 16.0), + return const Padding( + padding: EdgeInsets.only(left: 16.0, right: 16.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: const [ + children: [ IconWithText(Icons.thumb_up, 'Like'), IconWithText(Icons.comment, 'Comment'), IconWithText(Icons.share, 'Share'), @@ -578,9 +578,9 @@ class BottomBar extends StatelessWidget { ), ), ), - child: Row( + child: const Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: const [ + children: [ BottomBarButton(Icons.new_releases, 'News'), BottomBarButton(Icons.people, 'Requests'), BottomBarButton(Icons.chat, 'Messenger'), diff --git a/dev/benchmarks/macrobenchmarks/lib/src/cubic_bezier.dart b/dev/benchmarks/macrobenchmarks/lib/src/cubic_bezier.dart index 2f33c86d0e..bf903f2c1e 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/cubic_bezier.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/cubic_bezier.dart @@ -12,10 +12,10 @@ class CubicBezierPage extends StatelessWidget { @override Widget build(BuildContext context) { - return Center( + return const Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ Bezier(Colors.amber, 1.0), ], ), diff --git a/dev/benchmarks/macrobenchmarks/lib/src/stack_size.dart b/dev/benchmarks/macrobenchmarks/lib/src/stack_size.dart index 7a24cffbaa..fcbbe5c18d 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/stack_size.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/stack_size.dart @@ -88,9 +88,9 @@ class StackSizePage extends StatelessWidget { @override Widget build(BuildContext context) { - return Material( + return const Material( child: Column( - children: const [ + children: [ SizedBox( width: 200, height: 100, diff --git a/dev/benchmarks/macrobenchmarks/lib/src/text.dart b/dev/benchmarks/macrobenchmarks/lib/src/text.dart index eefde7f7df..ecbd04a97b 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/text.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/text.dart @@ -9,10 +9,10 @@ class TextPage extends StatelessWidget { @override Widget build(BuildContext context) { - return Material( + return const Material( child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ SizedBox( width: 200, height: 100, diff --git a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_simple_lazy_text_scroll.dart b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_simple_lazy_text_scroll.dart index 6ea32b1e76..1df4ae080d 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_simple_lazy_text_scroll.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_simple_lazy_text_scroll.dart @@ -20,10 +20,10 @@ class BenchSimpleLazyTextScroll extends WidgetRecorder { @override Widget createWidget() { - return Directionality( + return const Directionality( textDirection: TextDirection.ltr, child: Row( - children: const [ + children: [ Flexible( child: _TestScrollingWidget( initialScrollOffset: 0, diff --git a/dev/benchmarks/microbenchmarks/lib/foundation/all_elements_bench.dart b/dev/benchmarks/microbenchmarks/lib/foundation/all_elements_bench.dart index fc9988e0ad..22f386946f 100644 --- a/dev/benchmarks/microbenchmarks/lib/foundation/all_elements_bench.dart +++ b/dev/benchmarks/microbenchmarks/lib/foundation/all_elements_bench.dart @@ -28,8 +28,8 @@ Future main() async { Icon(Icons.ac_unit), ], ), - body: Column( - children: const [ + body: const Column( + children: [ Text('Item 1'), Text('Item 2'), Text('Item 3'), diff --git a/dev/benchmarks/test_apps/stocks/lib/stock_home.dart b/dev/benchmarks/test_apps/stocks/lib/stock_home.dart index b426635547..0b9f785902 100644 --- a/dev/benchmarks/test_apps/stocks/lib/stock_home.dart +++ b/dev/benchmarks/test_apps/stocks/lib/stock_home.dart @@ -345,8 +345,8 @@ class _CreateCompanySheet extends StatelessWidget { @override Widget build(BuildContext context) { - return Column( - children: const [ + return const Column( + children: [ TextField( autofocus: true, decoration: InputDecoration( diff --git a/dev/integration_tests/abstract_method_smoke_test/lib/main.dart b/dev/integration_tests/abstract_method_smoke_test/lib/main.dart index 0b67152b17..ef26951039 100644 --- a/dev/integration_tests/abstract_method_smoke_test/lib/main.dart +++ b/dev/integration_tests/abstract_method_smoke_test/lib/main.dart @@ -59,9 +59,9 @@ class SecondPage extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( + return const Scaffold( body: Column( - children: const [ + children: [ Expanded( child: AndroidView(viewType: 'simple') ), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart index 642678aea5..a83019e0db 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart @@ -57,8 +57,8 @@ class _CupertinoSwitchDemoState extends State { ), Semantics( container: true, - child: Column( - children: const [ + child: const Column( + children: [ CupertinoSwitch( value: true, onChanged: null, @@ -71,8 +71,8 @@ class _CupertinoSwitchDemoState extends State { ), Semantics( container: true, - child: Column( - children: const [ + child: const Column( + children: [ CupertinoSwitch( value: false, onChanged: null, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart index bc36265ada..bdc86751b5 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart @@ -402,9 +402,9 @@ class _DemoDrawer extends StatelessWidget { @override Widget build(BuildContext context) { - return Drawer( + return const Drawer( child: Column( - children: const [ + children: [ ListTile( leading: Icon(Icons.search), title: Text('Search'), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/search_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/search_demo.dart index bb50d425ab..648e7ea6ed 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/search_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/search_demo.dart @@ -70,13 +70,13 @@ class _SearchDemoState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - MergeSemantics( + const MergeSemantics( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ Text('Press the '), Tooltip( message: 'search', @@ -88,7 +88,7 @@ class _SearchDemoState extends State { Text(' icon in the AppBar'), ], ), - const Text('and search for an integer between 0 and 100,000.'), + Text('and search for an integer between 0 and 100,000.'), ], ), ), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/selection_controls_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/selection_controls_demo.dart index 10f3de9462..0451ce5798 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/selection_controls_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/selection_controls_demo.dart @@ -126,9 +126,9 @@ class _SelectionControlsDemoState extends State { ), ], ), - Row( + const Row( mainAxisSize: MainAxisSize.min, - children: const [ + children: [ // Disabled checkboxes Checkbox(value: true, onChanged: null), Checkbox(value: false, onChanged: null), @@ -167,9 +167,9 @@ class _SelectionControlsDemoState extends State { ], ), // Disabled radio buttons - Row( + const Row( mainAxisSize: MainAxisSize.min, - children: const [ + children: [ Radio( value: 0, groupValue: 0, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart index 03215720f7..2afd51f48d 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart @@ -296,9 +296,9 @@ class _SlidersState extends State<_Sliders> { const Text('Continuous with Editable Numerical Value'), ], ), - Column( + const Column( mainAxisSize: MainAxisSize.min, - children: const [ + children: [ Slider.adaptive(value: 0.25, onChanged: null), Text('Disabled'), ], diff --git a/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo.dart index c311b39978..f6680c208e 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo.dart @@ -93,10 +93,10 @@ class _TransformationsDemoState extends State { Widget get instructionDialog { return AlertDialog( title: const Text('2D Transformations'), - content: Column( + content: const Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, - children: const [ + children: [ Text('Tap to edit hex tiles, and use gestures to move around the scene:\n'), Text('- Drag to pan.'), Text('- Pinch to zoom.'), diff --git a/dev/integration_tests/ui/lib/overflow.dart b/dev/integration_tests/ui/lib/overflow.dart index 882f9525e3..4d084d9eaf 100644 --- a/dev/integration_tests/ui/lib/overflow.dart +++ b/dev/integration_tests/ui/lib/overflow.dart @@ -29,7 +29,7 @@ class _TestState extends State { if (!_triggered) { return const SizedBox.shrink(); } - return Row(children: const [ + return const Row(children: [ SizedBox(width: 10000.0), SizedBox(width: 10000.0), SizedBox(width: 10000.0), diff --git a/dev/integration_tests/web/lib/service_worker_test_cached_resources.dart b/dev/integration_tests/web/lib/service_worker_test_cached_resources.dart index 9c8fb686d9..f4664478df 100644 --- a/dev/integration_tests/web/lib/service_worker_test_cached_resources.dart +++ b/dev/integration_tests/web/lib/service_worker_test_cached_resources.dart @@ -5,10 +5,10 @@ import 'package:flutter/material.dart'; Future main() async { - runApp(Scaffold( + runApp(const Scaffold( body: Center( child: Column( - children: const [ + children: [ Icon(Icons.ac_unit), Text('Hello, World', textDirection: TextDirection.ltr), ], diff --git a/dev/manual_tests/lib/actions.dart b/dev/manual_tests/lib/actions.dart index ddf5911e76..ced46243e8 100644 --- a/dev/manual_tests/lib/actions.dart +++ b/dev/manual_tests/lib/actions.dart @@ -432,25 +432,25 @@ class _FocusDemoState extends State { return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Row( + const Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ DemoButton(name: 'One'), DemoButton(name: 'Two'), DemoButton(name: 'Three'), ], ), - Row( + const Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ DemoButton(name: 'Four'), DemoButton(name: 'Five'), DemoButton(name: 'Six'), ], ), - Row( + const Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ DemoButton(name: 'Seven'), DemoButton(name: 'Eight'), DemoButton(name: 'Nine'), diff --git a/dev/manual_tests/lib/drag_and_drop.dart b/dev/manual_tests/lib/drag_and_drop.dart index f897cdf838..db0080aa0a 100644 --- a/dev/manual_tests/lib/drag_and_drop.dart +++ b/dev/manual_tests/lib/drag_and_drop.dart @@ -270,9 +270,9 @@ class DragAndDropAppState extends State { ], ), ), - Expanded( + const Expanded( child: Row( - children: const [ + children: [ Expanded(child: ExampleDragTarget()), Expanded(child: ExampleDragTarget()), Expanded(child: ExampleDragTarget()), diff --git a/dev/manual_tests/lib/focus.dart b/dev/manual_tests/lib/focus.dart index 3b7d23e8b1..4c93af35d7 100644 --- a/dev/manual_tests/lib/focus.dart +++ b/dev/manual_tests/lib/focus.dart @@ -152,18 +152,18 @@ class _FocusDemoState extends State { return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Row( + const Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ DemoButton( name: 'One', autofocus: true, ), ], ), - Row( + const Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ DemoButton(name: 'Two'), DemoButton( name: 'Three', @@ -171,9 +171,9 @@ class _FocusDemoState extends State { ), ], ), - Row( + const Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ DemoButton(name: 'Four'), DemoButton(name: 'Five'), DemoButton(name: 'Six'), diff --git a/dev/tracing_tests/test/inflate_widget_tracing_test.dart b/dev/tracing_tests/test/inflate_widget_tracing_test.dart index 61273b442d..700be3d469 100644 --- a/dev/tracing_tests/test/inflate_widget_tracing_test.dart +++ b/dev/tracing_tests/test/inflate_widget_tracing_test.dart @@ -65,8 +65,8 @@ class TestRootState extends State { @override Widget build(BuildContext context) { return _showRow - ? Row( - children: const [ + ? const Row( + children: [ TestChildWidget(), TestChildWidget(), ], diff --git a/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart b/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart index 11fa045987..50148793bf 100644 --- a/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart +++ b/examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart @@ -25,8 +25,8 @@ class CupertinoIndicatorExample extends StatelessWidget { @override Widget build(BuildContext context) { - return CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar( + return const CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( middle: Text('CupertinoActivityIndicator Sample'), ), child: Center( @@ -35,7 +35,7 @@ class CupertinoIndicatorExample extends StatelessWidget { children: [ Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ // Cupertino activity indicator with default properties. CupertinoActivityIndicator(), SizedBox(height: 10), @@ -44,7 +44,7 @@ class CupertinoIndicatorExample extends StatelessWidget { ), Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ // Cupertino activity indicator with custom radius and color. CupertinoActivityIndicator(radius: 20.0, color: CupertinoColors.activeBlue), SizedBox(height: 10), @@ -56,7 +56,7 @@ class CupertinoIndicatorExample extends StatelessWidget { ), Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ // Cupertino activity indicator with custom radius and disabled // animation. CupertinoActivityIndicator(radius: 20.0, animating: false), diff --git a/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart b/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart index 79798f83df..bbc4197b6b 100644 --- a/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart +++ b/examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart @@ -56,33 +56,33 @@ class _CupertinoFormRowExampleState extends State { }, ), ), - CupertinoFormRow( - prefix: const PrefixWidget( + const CupertinoFormRow( + prefix: PrefixWidget( icon: CupertinoIcons.wifi, title: 'Wi-Fi', color: CupertinoColors.systemBlue, ), - error: const Text('Home network unavailable'), + error: Text('Home network unavailable'), child: Row( mainAxisAlignment: MainAxisAlignment.end, - children: const [ + children: [ Text('Not connected'), SizedBox(width: 5), Icon(CupertinoIcons.forward) ], ), ), - CupertinoFormRow( - prefix: const PrefixWidget( + const CupertinoFormRow( + prefix: PrefixWidget( icon: CupertinoIcons.bluetooth, title: 'Bluetooth', color: CupertinoColors.activeBlue, ), helper: Padding( - padding: const EdgeInsets.symmetric(vertical: 4.0), + padding: EdgeInsets.symmetric(vertical: 4.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: const [ + children: [ Text('Headphone'), Text('Connected'), ], @@ -90,7 +90,7 @@ class _CupertinoFormRowExampleState extends State { ), child: Row( mainAxisAlignment: MainAxisAlignment.end, - children: const [ + children: [ Text('On'), SizedBox(width: 5), Icon(CupertinoIcons.forward) diff --git a/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart b/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart index 8f37cc7e7d..281368337f 100644 --- a/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart +++ b/examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart @@ -86,10 +86,10 @@ class NextPage extends StatelessWidget { // when the CupertinoSliverNavigationBar is fully expanded. largeTitle: const Text('Family'), ), - SliverFillRemaining( + const SliverFillRemaining( child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: const [ + children: [ Text('Drag me up', textAlign: TextAlign.center), // When the "leading" parameter is omitted on a route that has a previous page, // the back button is automatically added to the leading position. diff --git a/examples/api/lib/material/button_style/button_style.0.dart b/examples/api/lib/material/button_style/button_style.0.dart index 4cf9111346..0cec279c17 100644 --- a/examples/api/lib/material/button_style/button_style.0.dart +++ b/examples/api/lib/material/button_style/button_style.0.dart @@ -30,10 +30,10 @@ class ButtonTypesExample extends StatelessWidget { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(4.0), + return const Padding( + padding: EdgeInsets.all(4.0), child: Row( - children: const [ + children: [ Spacer(), ButtonTypesGroup(enabled: true), ButtonTypesGroup(enabled: false), diff --git a/examples/api/lib/material/card/card.2.dart b/examples/api/lib/material/card/card.2.dart index b123bc486a..215398c73f 100644 --- a/examples/api/lib/material/card/card.2.dart +++ b/examples/api/lib/material/card/card.2.dart @@ -17,8 +17,8 @@ class CardExamplesApp extends StatelessWidget { theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true), home: Scaffold( appBar: AppBar(title: const Text('Card Examples')), - body: Column( - children: const [ + body: const Column( + children: [ Spacer(), ElevatedCardExample(), FilledCardExample(), diff --git a/examples/api/lib/material/divider/divider.1.dart b/examples/api/lib/material/divider/divider.1.dart index 97c7499520..bf4da00505 100644 --- a/examples/api/lib/material/divider/divider.1.dart +++ b/examples/api/lib/material/divider/divider.1.dart @@ -28,11 +28,11 @@ class DividerExample extends StatelessWidget { @override Widget build(BuildContext context) { - return Center( + return const Center( child: Padding( - padding: const EdgeInsets.all(16.0), + padding: EdgeInsets.all(16.0), child: Column( - children: const [ + children: [ Expanded( child: Card( child: SizedBox.expand(), diff --git a/examples/api/lib/material/divider/vertical_divider.1.dart b/examples/api/lib/material/divider/vertical_divider.1.dart index 558f30be2b..563649cf0c 100644 --- a/examples/api/lib/material/divider/vertical_divider.1.dart +++ b/examples/api/lib/material/divider/vertical_divider.1.dart @@ -28,11 +28,11 @@ class DividerExample extends StatelessWidget { @override Widget build(BuildContext context) { - return Center( + return const Center( child: Padding( - padding: const EdgeInsets.all(16.0), + padding: EdgeInsets.all(16.0), child: Row( - children: const [ + children: [ Expanded( child: Card( child: SizedBox.expand(), diff --git a/examples/api/lib/material/icon_button/icon_button.2.dart b/examples/api/lib/material/icon_button/icon_button.2.dart index e3a516d4f3..84cbd1b402 100644 --- a/examples/api/lib/material/icon_button/icon_button.2.dart +++ b/examples/api/lib/material/icon_button/icon_button.2.dart @@ -30,10 +30,10 @@ class ButtonTypesExample extends StatelessWidget { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(4.0), + return const Padding( + padding: EdgeInsets.all(4.0), child: Row( - children: const [ + children: [ Spacer(), ButtonTypesGroup(enabled: true), ButtonTypesGroup(enabled: false), diff --git a/examples/api/lib/material/icon_button/icon_button.3.dart b/examples/api/lib/material/icon_button/icon_button.3.dart index 5b250f01ee..bbfe47efcb 100644 --- a/examples/api/lib/material/icon_button/icon_button.3.dart +++ b/examples/api/lib/material/icon_button/icon_button.3.dart @@ -38,15 +38,15 @@ class DemoIconToggleButtons extends StatefulWidget { class _DemoIconToggleButtonsState extends State { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(8.0), + return const Padding( + padding: EdgeInsets.all(8.0), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, // Standard IconButton - children: const [ + children: [ DemoIconToggleButton(isEnabled: true), SizedBox(width: 10), DemoIconToggleButton(isEnabled: false), @@ -54,7 +54,7 @@ class _DemoIconToggleButtonsState extends State { ), Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ // Filled IconButton DemoIconToggleButton(isEnabled: true, getDefaultStyle: enabledFilledButtonStyle,), SizedBox(width: 10), @@ -63,7 +63,7 @@ class _DemoIconToggleButtonsState extends State { ), Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ // Filled Tonal IconButton DemoIconToggleButton(isEnabled: true, getDefaultStyle: enabledFilledTonalButtonStyle,), SizedBox(width: 10), @@ -72,7 +72,7 @@ class _DemoIconToggleButtonsState extends State { ), Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ // Outlined IconButton DemoIconToggleButton(isEnabled: true, getDefaultStyle: enabledOutlinedButtonStyle,), SizedBox(width: 10), diff --git a/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart b/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart index a89612ee6d..99ee08bab2 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.prefix_icon_constraints.0.dart @@ -30,11 +30,11 @@ class MyStatelessWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), + return const Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ TextField( decoration: InputDecoration( hintText: 'Normal Icon Constraints', diff --git a/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart b/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart index 885c69487b..1103c6d6cf 100644 --- a/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart +++ b/examples/api/lib/material/input_decorator/input_decoration.suffix_icon_constraints.0.dart @@ -30,11 +30,11 @@ class MyStatelessWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), + return const Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ TextField( decoration: InputDecoration( hintText: 'Normal Icon Constraints', diff --git a/examples/api/lib/material/segmented_button/segmented_button.0.dart b/examples/api/lib/material/segmented_button/segmented_button.0.dart index ff0b26a26f..97770ddf03 100644 --- a/examples/api/lib/material/segmented_button/segmented_button.0.dart +++ b/examples/api/lib/material/segmented_button/segmented_button.0.dart @@ -17,11 +17,11 @@ class SegmentedButtonApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( theme: ThemeData(useMaterial3: true), - home: Scaffold( + home: const Scaffold( body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ Spacer(), Text('Single choice'), SingleChoice(), diff --git a/examples/api/lib/material/selectable_region/selectable_region.0.dart b/examples/api/lib/material/selectable_region/selectable_region.0.dart index 553a41177d..c427def9ba 100644 --- a/examples/api/lib/material/selectable_region/selectable_region.0.dart +++ b/examples/api/lib/material/selectable_region/selectable_region.0.dart @@ -21,10 +21,10 @@ class MyApp extends StatelessWidget { home: SelectionArea( child: Scaffold( appBar: AppBar(title: const Text(_title)), - body: Center( + body: const Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ Text('Select this icon', style: TextStyle(fontSize: 30)), SizedBox(height: 10), MySelectableAdapter(child: Icon(Icons.key, size: 30)), diff --git a/examples/api/lib/material/selection_area/selection_area.0.dart b/examples/api/lib/material/selection_area/selection_area.0.dart index b460a3da95..3f538d7b69 100644 --- a/examples/api/lib/material/selection_area/selection_area.0.dart +++ b/examples/api/lib/material/selection_area/selection_area.0.dart @@ -20,10 +20,10 @@ class MyApp extends StatelessWidget { home: SelectionArea( child: Scaffold( appBar: AppBar(title: const Text(_title)), - body: Center( + body: const Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ Text('Row 1'), Text('Row 2'), Text('Row 3'), diff --git a/examples/api/lib/material/selection_container/selection_container.0.dart b/examples/api/lib/material/selection_container/selection_container.0.dart index fa0716ad5e..cd8a5034ce 100644 --- a/examples/api/lib/material/selection_container/selection_container.0.dart +++ b/examples/api/lib/material/selection_container/selection_container.0.dart @@ -21,11 +21,11 @@ class MyApp extends StatelessWidget { home: SelectionArea( child: Scaffold( appBar: AppBar(title: const Text(_title)), - body: Center( + body: const Center( child: SelectionAllOrNoneContainer( child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ Text('Row 1'), Text('Row 2'), Text('Row 3'), diff --git a/examples/api/lib/material/selection_container/selection_container_disabled.0.dart b/examples/api/lib/material/selection_container/selection_container_disabled.0.dart index 2296b92496..8dd160ded5 100644 --- a/examples/api/lib/material/selection_container/selection_container_disabled.0.dart +++ b/examples/api/lib/material/selection_container/selection_container_disabled.0.dart @@ -19,11 +19,11 @@ class MyApp extends StatelessWidget { title: _title, home: Scaffold( appBar: AppBar(title: const Text(_title)), - body: Center( + body: const Center( child: SelectionArea( child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ Text('Selectable text'), SelectionContainer.disabled(child: Text('Non-selectable text')), Text('Selectable text'), diff --git a/examples/api/lib/material/text_field/text_field.2.dart b/examples/api/lib/material/text_field/text_field.2.dart index aa835237f1..f94f8a7895 100644 --- a/examples/api/lib/material/text_field/text_field.2.dart +++ b/examples/api/lib/material/text_field/text_field.2.dart @@ -17,8 +17,8 @@ class TextFieldExamplesApp extends StatelessWidget { theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true), home: Scaffold( appBar: AppBar(title: const Text('TextField Examples')), - body: Column( - children: const [ + body: const Column( + children: [ Spacer(), FilledTextFieldExample(), OutlinedTextFieldExample(), diff --git a/examples/api/lib/widgets/actions/action.action_overridable.0.dart b/examples/api/lib/widgets/actions/action.action_overridable.0.dart index f54952a235..ec7a0b43e4 100644 --- a/examples/api/lib/widgets/actions/action.action_overridable.0.dart +++ b/examples/api/lib/widgets/actions/action.action_overridable.0.dart @@ -64,14 +64,14 @@ class VerificationCodeGenerator extends StatelessWidget { Widget build(BuildContext context) { return Actions( actions: > { CopyTextIntent: CallbackAction(onInvoke: _copy) }, - child: Column( + child: const Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text('Press Ctrl-C to Copy'), - const SizedBox(height: 10), + Text('Press Ctrl-C to Copy'), + SizedBox(height: 10), Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ CopyableText(text: '111'), SizedBox(width: 5,), CopyableText(text: '222'), diff --git a/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart b/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart index 780592b30d..b9e0c0290c 100644 --- a/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart +++ b/examples/api/lib/widgets/focus_traversal/ordered_traversal_policy.0.dart @@ -64,25 +64,25 @@ class MyStatelessWidget extends StatelessWidget { Widget build(BuildContext context) { return FocusTraversalGroup( policy: OrderedTraversalPolicy(), - child: Column( + child: const Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ DemoButton(name: 'Six', order: 6), ], ), Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ DemoButton(name: 'Five', order: 5), DemoButton(name: 'Four', order: 4), ], ), Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ DemoButton(name: 'Three', order: 3), DemoButton(name: 'Two', order: 2), DemoButton(name: 'One', order: 1, autofocus: true), diff --git a/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart b/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart index 76ba709224..08736bb0b5 100644 --- a/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart +++ b/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart @@ -90,9 +90,9 @@ class _MyStatefulWidgetState extends State Widget build(BuildContext context) { return SpinModel( notifier: _controller, - child: Row( + child: const Row( mainAxisAlignment: MainAxisAlignment.spaceAround, - children: const [ + children: [ Spinner(), Spinner(), Spinner(), diff --git a/examples/api/lib/widgets/overlay/overlay.0.dart b/examples/api/lib/widgets/overlay/overlay.0.dart index 78c20b929f..fa2bab7b21 100644 --- a/examples/api/lib/widgets/overlay/overlay.0.dart +++ b/examples/api/lib/widgets/overlay/overlay.0.dart @@ -61,8 +61,8 @@ class _OverlayExampleState extends State { Builder(builder: (BuildContext context) { switch (currentPageIndex) { case 0: - return Column( - children: const [ + return const Column( + children: [ Text( 'Explore page', style: TextStyle( @@ -76,8 +76,8 @@ class _OverlayExampleState extends State { ], ); case 1: - return Column( - children: const [ + return const Column( + children: [ Text( 'Commute page', style: TextStyle( @@ -91,8 +91,8 @@ class _OverlayExampleState extends State { ], ); case 2: - return Column( - children: const [ + return const Column( + children: [ Text( 'Saved page', style: TextStyle( diff --git a/examples/api/lib/widgets/shortcuts/character_activator.0.dart b/examples/api/lib/widgets/shortcuts/character_activator.0.dart index d7982c6d31..56ed8a4c66 100644 --- a/examples/api/lib/widgets/shortcuts/character_activator.0.dart +++ b/examples/api/lib/widgets/shortcuts/character_activator.0.dart @@ -56,10 +56,10 @@ class _MyStatefulWidgetState extends State { }, ), }, - child: Focus( + child: const Focus( autofocus: true, child: Column( - children: const [ + children: [ Text('Press question mark for help'), ], ), diff --git a/examples/api/lib/widgets/transitions/listenable_builder.0.dart b/examples/api/lib/widgets/transitions/listenable_builder.0.dart index 22ec43ce49..26e9eed0fb 100644 --- a/examples/api/lib/widgets/transitions/listenable_builder.0.dart +++ b/examples/api/lib/widgets/transitions/listenable_builder.0.dart @@ -152,9 +152,9 @@ class ListenableBuilderExample extends StatelessWidget { // The container background will change color to this when // the subtree has focus. focusedColor: Colors.blue.shade50, - child: Column( + child: const Column( crossAxisAlignment: CrossAxisAlignment.start, - children: const [ + children: [ Text('Owner:'), MyField(label: 'First Name'), MyField(label: 'Last Name'), diff --git a/examples/splash/lib/main.dart b/examples/splash/lib/main.dart index 57ec1dee88..6062b6cb4d 100644 --- a/examples/splash/lib/main.dart +++ b/examples/splash/lib/main.dart @@ -6,13 +6,13 @@ import 'package:flutter/material.dart'; void main() { runApp( - DecoratedBox( - decoration: const BoxDecoration(color: Colors.white), + const DecoratedBox( + decoration: BoxDecoration(color: Colors.white), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, textDirection: TextDirection.ltr, - children: const [ + children: [ FlutterLogo(size: 48), Padding( padding: EdgeInsets.all(32), diff --git a/packages/flutter/lib/src/cupertino/icons.dart b/packages/flutter/lib/src/cupertino/icons.dart index 0294646f3b..3eff9a4d20 100644 --- a/packages/flutter/lib/src/cupertino/icons.dart +++ b/packages/flutter/lib/src/cupertino/icons.dart @@ -30,9 +30,9 @@ import 'package:flutter/widgets.dart'; /// ![The following code snippet would generate a row of icons consisting of a pink heart, a green bell, and a blue umbrella, each progressively bigger than the last.](https://flutter.github.io/assets-for-api-docs/assets/cupertino/cupertino_icon.png) /// /// ```dart -/// Row( +/// const Row( /// mainAxisAlignment: MainAxisAlignment.spaceAround, -/// children: const [ +/// children: [ /// Icon( /// CupertinoIcons.heart_fill, /// color: Colors.pink, diff --git a/packages/flutter/lib/src/material/button_bar.dart b/packages/flutter/lib/src/material/button_bar.dart index 8652cb14f4..7cdd64ac69 100644 --- a/packages/flutter/lib/src/material/button_bar.dart +++ b/packages/flutter/lib/src/material/button_bar.dart @@ -233,7 +233,7 @@ class ButtonBar extends StatelessWidget { class _ButtonBarRow extends Flex { /// Creates a button bar that attempts to display in a row, but displays in /// a column if there is insufficient horizontal space. - _ButtonBarRow({ + const _ButtonBarRow({ required super.children, super.mainAxisSize, super.mainAxisAlignment, diff --git a/packages/flutter/lib/src/material/icons.dart b/packages/flutter/lib/src/material/icons.dart index 2d09b0a428..e7aa77a55c 100644 --- a/packages/flutter/lib/src/material/icons.dart +++ b/packages/flutter/lib/src/material/icons.dart @@ -119,9 +119,9 @@ class PlatformAdaptiveIcons implements Icons { /// ![The following code snippet would generate a row of icons consisting of a pink heart, a green musical note, and a blue umbrella, each progressively bigger than the last.](https://flutter.github.io/assets-for-api-docs/assets/widgets/icon.png) /// /// ```dart -/// Row( +/// const Row( /// mainAxisAlignment: MainAxisAlignment.spaceAround, -/// children: const [ +/// children: [ /// Icon( /// Icons.favorite, /// color: Colors.pink, diff --git a/packages/flutter/lib/src/material/list_tile.dart b/packages/flutter/lib/src/material/list_tile.dart index ce3bf51ced..1f50648400 100644 --- a/packages/flutter/lib/src/material/list_tile.dart +++ b/packages/flutter/lib/src/material/list_tile.dart @@ -160,8 +160,8 @@ enum ListTileControlAffinity { /// whereas a [Row] does not constrain its children. /// /// ```dart -/// Row( -/// children: const [ +/// const Row( +/// children: [ /// Expanded( /// child: ListTile( /// leading: FlutterLogo(), diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 8d98ffe632..d32d884fe5 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -275,7 +275,7 @@ class _TabLabelBarRenderer extends RenderFlex { // upon layout. The tab widths are only used at paint time (see _IndicatorPainter) // or in response to input. class _TabLabelBar extends Flex { - _TabLabelBar({ + const _TabLabelBar({ super.children, required this.onPerformLayout, }) : super( diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index a295c95126..120487b84f 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -4445,9 +4445,7 @@ class Flex extends MultiChildRenderObjectWidget { /// to be necessary to decide which direction to lay the children in or to /// disambiguate `start` or `end` values for the main or cross axis /// directions, the [textDirection] must not be null. - // TODO(goderbauer): Figure out whether this can be const. - // ignore: prefer_const_constructors_in_immutables - Flex({ + const Flex({ super.key, required this.direction, this.mainAxisAlignment = MainAxisAlignment.start, @@ -4458,7 +4456,8 @@ class Flex extends MultiChildRenderObjectWidget { this.textBaseline, // NO DEFAULT: we don't know what the text's baseline should be this.clipBehavior = Clip.none, super.children, - }) : assert(crossAxisAlignment != CrossAxisAlignment.baseline || textBaseline != null, 'textBaseline is required if you specify the crossAxisAlignment with CrossAxisAlignment.baseline'); + }) : assert(!identical(crossAxisAlignment, CrossAxisAlignment.baseline) || textBaseline != null, 'textBaseline is required if you specify the crossAxisAlignment with CrossAxisAlignment.baseline'); + // Cannot use == in the assert above instead of identical because of https://github.com/dart-lang/language/issues/1811. /// The direction to use as the main axis. /// @@ -4649,8 +4648,8 @@ class Flex extends MultiChildRenderObjectWidget { /// ![](https://flutter.github.io/assets-for-api-docs/assets/widgets/row.png) /// /// ```dart -/// Row( -/// children: const [ +/// const Row( +/// children: [ /// Expanded( /// child: Text('Deliver features faster', textAlign: TextAlign.center), /// ), @@ -4684,8 +4683,8 @@ class Flex extends MultiChildRenderObjectWidget { /// Suppose, for instance, that you had this code: /// /// ```dart -/// Row( -/// children: const [ +/// const Row( +/// children: [ /// FlutterLogo(), /// Text("Flutter's hot reload helps you quickly and easily experiment, build UIs, add features, and fix bug faster. Experience sub-second reload times, without losing state, on emulators, simulators, and hardware for iOS and Android."), /// Icon(Icons.sentiment_very_satisfied), @@ -4711,8 +4710,8 @@ class Flex extends MultiChildRenderObjectWidget { /// row that the child should be given the remaining room: /// /// ```dart -/// Row( -/// children: const [ +/// const Row( +/// children: [ /// FlutterLogo(), /// Expanded( /// child: Text("Flutter's hot reload helps you quickly and easily experiment, build UIs, add features, and fix bug faster. Experience sub-second reload times, without losing state, on emulators, simulators, and hardware for iOS and Android."), @@ -4740,9 +4739,9 @@ class Flex extends MultiChildRenderObjectWidget { /// [TextDirection.rtl]. This is shown in the example below /// /// ```dart -/// Row( +/// const Row( /// textDirection: TextDirection.rtl, -/// children: const [ +/// children: [ /// FlutterLogo(), /// Expanded( /// child: Text("Flutter's hot reload helps you quickly and easily experiment, build UIs, add features, and fix bug faster. Experience sub-second reload times, without losing state, on emulators, simulators, and hardware for iOS and Android."), @@ -4814,7 +4813,7 @@ class Row extends Flex { /// unless the row has no children or only one child) or to disambiguate /// `start` or `end` values for the [mainAxisAlignment], the [textDirection] /// must not be null. - Row({ + const Row({ super.key, super.mainAxisAlignment, super.mainAxisSize, @@ -4851,8 +4850,8 @@ class Row extends Flex { /// ![Using the Column in this way creates two short lines of text with a large Flutter underneath.](https://flutter.github.io/assets-for-api-docs/assets/widgets/column.png) /// /// ```dart -/// Column( -/// children: const [ +/// const Column( +/// children: [ /// Text('Deliver features faster'), /// Text('Craft beautiful UIs'), /// Expanded( @@ -5007,7 +5006,7 @@ class Column extends Flex { /// any. If there is no ambient directionality, and a text direction is going /// to be necessary to disambiguate `start` or `end` values for the /// [crossAxisAlignment], the [textDirection] must not be null. - Column({ + const Column({ super.key, super.mainAxisAlignment, super.mainAxisSize, diff --git a/packages/flutter/lib/src/widgets/default_text_editing_shortcuts.dart b/packages/flutter/lib/src/widgets/default_text_editing_shortcuts.dart index 51f9569df1..7ccbe9fc77 100644 --- a/packages/flutter/lib/src/widgets/default_text_editing_shortcuts.dart +++ b/packages/flutter/lib/src/widgets/default_text_editing_shortcuts.dart @@ -37,15 +37,15 @@ import 'text_editing_intents.dart'; /// // If using WidgetsApp or its descendents MaterialApp or CupertinoApp, /// // then DefaultTextEditingShortcuts is already being inserted into the /// // widget tree. -/// return DefaultTextEditingShortcuts( +/// return const DefaultTextEditingShortcuts( /// child: Center( /// child: Shortcuts( -/// shortcuts: const { +/// shortcuts: { /// SingleActivator(LogicalKeyboardKey.arrowDown, alt: true): NextFocusIntent(), /// SingleActivator(LogicalKeyboardKey.arrowUp, alt: true): PreviousFocusIntent(), /// }, /// child: Column( -/// children: const [ +/// children: [ /// TextField( /// decoration: InputDecoration( /// hintText: 'alt + down moves to the next field.', diff --git a/packages/flutter/lib/src/widgets/icon.dart b/packages/flutter/lib/src/widgets/icon.dart index 3868c6e18b..9dd561e471 100644 --- a/packages/flutter/lib/src/widgets/icon.dart +++ b/packages/flutter/lib/src/widgets/icon.dart @@ -36,9 +36,9 @@ import 'icon_theme_data.dart'; /// ![The following code snippet would generate a row of icons consisting of a pink heart, a green musical note, and a blue umbrella, each progressively bigger than the last.](https://flutter.github.io/assets-for-api-docs/assets/widgets/icon.png) /// /// ```dart -/// Row( +/// const Row( /// mainAxisAlignment: MainAxisAlignment.spaceAround, -/// children: const [ +/// children: [ /// Icon( /// Icons.favorite, /// color: Colors.pink, diff --git a/packages/flutter/lib/src/widgets/spacer.dart b/packages/flutter/lib/src/widgets/spacer.dart index 92ca7c6771..b84aac8e8e 100644 --- a/packages/flutter/lib/src/widgets/spacer.dart +++ b/packages/flutter/lib/src/widgets/spacer.dart @@ -18,8 +18,8 @@ import 'framework.dart'; /// {@tool snippet} /// /// ```dart -/// Row( -/// children: const [ +/// const Row( +/// children: [ /// Text('Begin'), /// Spacer(), // Defaults to a flex of one. /// Text('Middle'), diff --git a/packages/flutter/test/cupertino/text_field_test.dart b/packages/flutter/test/cupertino/text_field_test.dart index 879fc694da..7b0d52081c 100644 --- a/packages/flutter/test/cupertino/text_field_test.dart +++ b/packages/flutter/test/cupertino/text_field_test.dart @@ -1702,9 +1702,9 @@ void main() { testWidgets('copy paste', (WidgetTester tester) async { await tester.pumpWidget( - CupertinoApp( + const CupertinoApp( home: Column( - children: const [ + children: [ CupertinoTextField( placeholder: 'field 1', ), diff --git a/packages/flutter/test/material/app_bar_test.dart b/packages/flutter/test/material/app_bar_test.dart index a48f06b84b..c4f60a606b 100644 --- a/packages/flutter/test/material/app_bar_test.dart +++ b/packages/flutter/test/material/app_bar_test.dart @@ -701,7 +701,7 @@ void main() { appBar: AppBar( title: const Text('X'), ), - drawer: Column(), // Doesn't really matter. Triggers a hamburger regardless. + drawer: const Column(), // Doesn't really matter. Triggers a hamburger regardless. ), ), ); diff --git a/packages/flutter/test/material/bottom_app_bar_theme_test.dart b/packages/flutter/test/material/bottom_app_bar_theme_test.dart index 2926a8b3c9..437d76ff00 100644 --- a/packages/flutter/test/material/bottom_app_bar_theme_test.dart +++ b/packages/flutter/test/material/bottom_app_bar_theme_test.dart @@ -253,9 +253,9 @@ Widget _withTheme(BottomAppBarTheme theme, [bool useMaterial3 = false]) { floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, bottomNavigationBar: RepaintBoundary( key: _painterKey, - child: BottomAppBar( + child: const BottomAppBar( child: Row( - children: const [ + children: [ Icon(Icons.add), Expanded(child: SizedBox()), Icon(Icons.add), diff --git a/packages/flutter/test/material/card_test.dart b/packages/flutter/test/material/card_test.dart index aec9a5a99c..ae549b39d4 100644 --- a/packages/flutter/test/material/card_test.dart +++ b/packages/flutter/test/material/card_test.dart @@ -82,13 +82,13 @@ void main() { debugResetSemanticsIdCounter(); await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Material( child: Center( child: Card( child: Column( - children: const [ + children: [ Text('First child'), Text('Second child'), ], diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart index 13e27b6f2c..ad3b8d98ae 100644 --- a/packages/flutter/test/material/chip_test.dart +++ b/packages/flutter/test/material/chip_test.dart @@ -579,8 +579,8 @@ void main() { const TextStyle style = TextStyle(fontFamily: 'Ahem', fontSize: 10.0); await tester.pumpWidget( wrapForChip( - child: Row( - children: const [ + child: const Row( + children: [ Chip(label: Text('Test'), labelStyle: style), ], ), @@ -590,8 +590,8 @@ void main() { expect(tester.getSize(find.byType(Chip)), const Size(64.0, 48.0)); await tester.pumpWidget( wrapForChip( - child: Row( - children: const [ + child: const Row( + children: [ Flexible(child: Chip(label: Text('Test'), labelStyle: style)), ], ), @@ -601,8 +601,8 @@ void main() { expect(tester.getSize(find.byType(Chip)), const Size(64.0, 48.0)); await tester.pumpWidget( wrapForChip( - child: Row( - children: const [ + child: const Row( + children: [ Expanded(child: Chip(label: Text('Test'), labelStyle: style)), ], ), @@ -615,8 +615,8 @@ void main() { testWidgets('Chip responds to materialTapTargetSize', (WidgetTester tester) async { await tester.pumpWidget( wrapForChip( - child: Column( - children: const [ + child: const Column( + children: [ Chip( label: Text('X'), materialTapTargetSize: MaterialTapTargetSize.padded, @@ -731,8 +731,8 @@ void main() { testWidgets('Chip responds to textScaleFactor', (WidgetTester tester) async { await tester.pumpWidget( wrapForChip( - child: Column( - children: const [ + child: const Column( + children: [ Chip( avatar: CircleAvatar(child: Text('A')), label: Text('Chip A'), @@ -762,8 +762,8 @@ void main() { await tester.pumpWidget( wrapForChip( textScaleFactor: 3.0, - child: Column( - children: const [ + child: const Column( + children: [ Chip( avatar: CircleAvatar(child: Text('A')), label: Text('Chip A'), @@ -789,8 +789,8 @@ void main() { // Check that individual text scales are taken into account. await tester.pumpWidget( wrapForChip( - child: Column( - children: const [ + child: const Column( + children: [ Chip( avatar: CircleAvatar(child: Text('A')), label: Text('Chip A', textScaleFactor: 3.0), diff --git a/packages/flutter/test/material/divider_test.dart b/packages/flutter/test/material/divider_test.dart index f6dfd5b05d..10681474cc 100644 --- a/packages/flutter/test/material/divider_test.dart +++ b/packages/flutter/test/material/divider_test.dart @@ -128,12 +128,12 @@ void main() { testWidgets('Vertical Divider Test 2', (WidgetTester tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Material( child: SizedBox( height: 24.0, child: Row( - children: const [ + children: [ Text('Hey.'), VerticalDivider(), ], diff --git a/packages/flutter/test/material/expansion_tile_test.dart b/packages/flutter/test/material/expansion_tile_test.dart index f99b00f0ed..7c4d54826f 100644 --- a/packages/flutter/test/material/expansion_tile_test.dart +++ b/packages/flutter/test/material/expansion_tile_test.dart @@ -238,10 +238,10 @@ void main() { platform: TargetPlatform.iOS, dividerColor: dividerColor, ), - home: Material( + home: const Material( child: SingleChildScrollView( child: Column( - children: const [ + children: [ ExpansionTile( title: Text('Tile 1'), maintainState: true, diff --git a/packages/flutter/test/material/floating_action_button_location_test.dart b/packages/flutter/test/material/floating_action_button_location_test.dart index 8e29970ee9..161cadd50e 100644 --- a/packages/flutter/test/material/floating_action_button_location_test.dart +++ b/packages/flutter/test/material/floating_action_button_location_test.dart @@ -317,8 +317,8 @@ void main() { appBar: AppBar(), floatingActionButton: FloatingActionButton(onPressed: () { }, mini: true), floatingActionButtonLocation: FloatingActionButtonLocation.miniStartTop, - body: Column( - children: const [ + body: const Column( + children: [ ListTile( leading: CircleAvatar(), ), diff --git a/packages/flutter/test/material/input_decorator_test.dart b/packages/flutter/test/material/input_decorator_test.dart index a96089bc89..1484fe41bc 100644 --- a/packages/flutter/test/material/input_decorator_test.dart +++ b/packages/flutter/test/material/input_decorator_test.dart @@ -5935,12 +5935,12 @@ void main() { testWidgets('min intrinsic height for TextField with no content padding', (WidgetTester tester) async { // Regression test for: https://github.com/flutter/flutter/issues/75509 - await tester.pumpWidget(MaterialApp( + await tester.pumpWidget(const MaterialApp( home: Material( child: Center( child: IntrinsicHeight( child: Column( - children: const [ + children: [ TextField( decoration: InputDecoration( labelText: 'Label Text', diff --git a/packages/flutter/test/material/raw_material_button_test.dart b/packages/flutter/test/material/raw_material_button_test.dart index 9dd881adcd..9cf12c8592 100644 --- a/packages/flutter/test/material/raw_material_button_test.dart +++ b/packages/flutter/test/material/raw_material_button_test.dart @@ -240,12 +240,12 @@ void main() { RawMaterialButton( materialTapTargetSize: MaterialTapTargetSize.padded, onPressed: () { }, - child: SizedBox( + child: const SizedBox( width: 400.0, height: 400.0, child: Column( mainAxisAlignment: MainAxisAlignment.end, - children: const [ + children: [ SizedBox( height: 50.0, width: 400.0, diff --git a/packages/flutter/test/material/tabs_test.dart b/packages/flutter/test/material/tabs_test.dart index a8b683ad54..28373d70c6 100644 --- a/packages/flutter/test/material/tabs_test.dart +++ b/packages/flutter/test/material/tabs_test.dart @@ -4515,10 +4515,10 @@ void main() { testWidgets('Tab preferredSize gives correct value', (WidgetTester tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Material( child: Row( - children: const [ + children: [ Tab(icon: Icon(Icons.message)), Tab(text: 'Two'), Tab(text: 'Three', icon: Icon(Icons.chat)), diff --git a/packages/flutter/test/material/toggle_buttons_test.dart b/packages/flutter/test/material/toggle_buttons_test.dart index 4223502625..92930963c9 100644 --- a/packages/flutter/test/material/toggle_buttons_test.dart +++ b/packages/flutter/test/material/toggle_buttons_test.dart @@ -389,8 +389,8 @@ void main() { child: ToggleButtons( isSelected: const [false], onPressed: (int index) {}, - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), Icon(Icons.check), ]), @@ -416,8 +416,8 @@ void main() { child: ToggleButtons( isSelected: const [true], onPressed: (int index) {}, - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), Icon(Icons.check), ]), @@ -442,8 +442,8 @@ void main() { child: boilerplate( child: ToggleButtons( isSelected: const [true], - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), Icon(Icons.check), ]), @@ -497,8 +497,8 @@ void main() { color: enabledColor, isSelected: const [false], onPressed: (int index) {}, - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), Icon(Icons.check), ]), @@ -519,8 +519,8 @@ void main() { selectedColor: selectedColor, isSelected: const [true], onPressed: (int index) {}, - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), Icon(Icons.check), ]), @@ -540,8 +540,8 @@ void main() { child: ToggleButtons( disabledColor: disabledColor, isSelected: const [true], - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), Icon(Icons.check), ]), @@ -565,8 +565,8 @@ void main() { child: ToggleButtons( isSelected: const [false], onPressed: (int index) {}, - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), ]), ], @@ -594,8 +594,8 @@ void main() { child: ToggleButtons( isSelected: const [true], onPressed: (int index) {}, - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), ]), ], @@ -622,8 +622,8 @@ void main() { child: boilerplate( child: ToggleButtons( isSelected: const [true], - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), ]), ], @@ -652,8 +652,8 @@ void main() { fillColor: customFillColor, isSelected: const [true], onPressed: (int index) {}, - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), ]), ], diff --git a/packages/flutter/test/material/toggle_buttons_theme_test.dart b/packages/flutter/test/material/toggle_buttons_theme_test.dart index 725f3cc0f2..f0416b91bf 100644 --- a/packages/flutter/test/material/toggle_buttons_theme_test.dart +++ b/packages/flutter/test/material/toggle_buttons_theme_test.dart @@ -261,10 +261,10 @@ void main() { color: enabledColor, isSelected: const [false], onPressed: (int index) {}, - children: [ + children: const [ // This Row is used like this to test for both TextStyle // and IconTheme for Text and Icon widgets respectively. - Row(children: const [ + Row(children: [ Text('First child'), Icon(Icons.check), ]), @@ -290,8 +290,8 @@ void main() { color: enabledColor, isSelected: const [true], onPressed: (int index) {}, - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), Icon(Icons.check), ]), @@ -317,8 +317,8 @@ void main() { child: ToggleButtons( color: enabledColor, isSelected: const [false], - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), Icon(Icons.check), ]), @@ -346,8 +346,8 @@ void main() { child: ToggleButtons( isSelected: const [true], onPressed: (int index) {}, - children: [ - Row(children: const [ + children: const [ + Row(children: [ Text('First child'), ]), ], diff --git a/packages/flutter/test/material/tooltip_test.dart b/packages/flutter/test/material/tooltip_test.dart index 0cef50d5f5..0af5899df8 100644 --- a/packages/flutter/test/material/tooltip_test.dart +++ b/packages/flutter/test/material/tooltip_test.dart @@ -1280,10 +1280,10 @@ void main() { await gesture.moveTo(Offset.zero); await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Center( child: Column( - children: const [ + children: [ Tooltip( message: 'message1', waitDuration: waitDuration, diff --git a/packages/flutter/test/rendering/flex_overflow_test.dart b/packages/flutter/test/rendering/flex_overflow_test.dart index 2c0740211e..7774400da1 100644 --- a/packages/flutter/test/rendering/flex_overflow_test.dart +++ b/packages/flutter/test/rendering/flex_overflow_test.dart @@ -10,9 +10,9 @@ import 'mock_canvas.dart'; void main() { testWidgets('Flex overflow indicator', (WidgetTester tester) async { await tester.pumpWidget( - Center( + const Center( child: Column( - children: const [ + children: [ SizedBox(width: 200.0, height: 200.0), ], ), @@ -22,11 +22,11 @@ void main() { expect(find.byType(Column), isNot(paints..rect())); await tester.pumpWidget( - Center( + const Center( child: SizedBox( height: 100.0, child: Column( - children: const [ + children: [ SizedBox(width: 200.0, height: 200.0), ], ), @@ -39,11 +39,11 @@ void main() { expect(find.byType(Column), paints..rect()); await tester.pumpWidget( - Center( + const Center( child: SizedBox( height: 0.0, child: Column( - children: const [ + children: [ SizedBox(width: 200.0, height: 200.0), ], ), diff --git a/packages/flutter/test/rendering/view_chrome_style_test.dart b/packages/flutter/test/rendering/view_chrome_style_test.dart index bb54ebc6b4..14fd248dc4 100644 --- a/packages/flutter/test/rendering/view_chrome_style_test.dart +++ b/packages/flutter/test/rendering/view_chrome_style_test.dart @@ -232,7 +232,7 @@ void main() { testWidgets('Top AnnotatedRegion provides status bar overlay style and bottom AnnotatedRegion provides navigation bar overlay style', (WidgetTester tester) async { setupTestDevice(); await tester.pumpWidget( - Column(children: const [ + const Column(children: [ Expanded(child: AnnotatedRegion( value: SystemUiOverlayStyle( systemNavigationBarColor: Colors.blue, @@ -258,7 +258,7 @@ void main() { testWidgets('Top only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async { setupTestDevice(); await tester.pumpWidget( - Column(children: const [ + const Column(children: [ Expanded(child: AnnotatedRegion( value: SystemUiOverlayStyle( systemNavigationBarColor: Colors.blue, @@ -278,7 +278,7 @@ void main() { testWidgets('Bottom only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async { setupTestDevice(); await tester.pumpWidget( - Column(children: const [ + const Column(children: [ Expanded(child: SizedBox.expand()), Expanded(child: AnnotatedRegion( value: SystemUiOverlayStyle( diff --git a/packages/flutter/test/semantics/semantics_elevation_test.dart b/packages/flutter/test/semantics/semantics_elevation_test.dart index 6c530e785f..24c6918af2 100644 --- a/packages/flutter/test/semantics/semantics_elevation_test.dart +++ b/packages/flutter/test/semantics/semantics_elevation_test.dart @@ -26,25 +26,25 @@ void main() { // | // --------------------------------------- 'ground' final SemanticsTester semantics = SemanticsTester(tester); - await tester.pumpWidget(MaterialApp( + await tester.pumpWidget(const MaterialApp( home: Column( children: [ - const Text('ground'), + Text('ground'), Card( elevation: 10.0, child: Column( children: [ - const Text('absolute elevation: 10'), + Text('absolute elevation: 10'), PhysicalModel( elevation: 5.0, color: Colors.black, child: Column( children: [ - const Text('absolute elevation: 15'), + Text('absolute elevation: 15'), Card( elevation: 7.0, child: Column( - children: const [ + children: [ Text('absolute elevation: 22'), Card( elevation: 8.0, @@ -56,7 +56,7 @@ void main() { ], ), ), - const Card( + Card( elevation: 15.0, child: Text('absolute elevation: 25'), ), @@ -102,15 +102,15 @@ void main() { // is reversed final SemanticsTester semantics = SemanticsTester(tester); - await tester.pumpWidget(MaterialApp( + await tester.pumpWidget(const MaterialApp( home: Column( children: [ - const Text('ground'), + Text('ground'), Card( elevation: 10.0, child: Column( children: [ - const Card( + Card( elevation: 15.0, child: Text('absolute elevation: 25'), ), @@ -119,11 +119,11 @@ void main() { color: Colors.black, child: Column( children: [ - const Text('absolute elevation: 15'), + Text('absolute elevation: 15'), Card( elevation: 7.0, child: Column( - children: const [ + children: [ Text('absolute elevation: 22'), Card( elevation: 8.0, @@ -135,7 +135,7 @@ void main() { ], ), ), - const Text('absolute elevation: 10'), + Text('absolute elevation: 10'), ], ), ), @@ -205,8 +205,8 @@ void main() { MergeSemantics( child: Semantics( explicitChildNodes: true, // just to be sure that it's going to be an explicit merge - child: Column( - children: const [ + child: const Column( + children: [ Card( elevation: 15.0, child: Text('abs. elevation 25.0'), @@ -259,8 +259,8 @@ void main() { MergeSemantics( child: Semantics( explicitChildNodes: true, // just to be sure that it's going to be an explicit merge - child: Column( - children: const [ + child: const Column( + children: [ Card( elevation: 5.0, child: Text('abs. elevation 15.0'), diff --git a/packages/flutter/test/widgets/align_test.dart b/packages/flutter/test/widgets/align_test.dart index d89ec77b2b..aa44e27bce 100644 --- a/packages/flutter/test/widgets/align_test.dart +++ b/packages/flutter/test/widgets/align_test.dart @@ -107,12 +107,12 @@ void main() { testWidgets('Align widthFactor', (WidgetTester tester) async { await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ Align( widthFactor: 0.5, child: SizedBox( @@ -130,12 +130,12 @@ void main() { testWidgets('Align heightFactor', (WidgetTester tester) async { await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, - children: const [ + children: [ Align( heightFactor: 0.5, child: SizedBox( diff --git a/packages/flutter/test/widgets/animated_align_test.dart b/packages/flutter/test/widgets/animated_align_test.dart index bf2101b697..032f267865 100644 --- a/packages/flutter/test/widgets/animated_align_test.dart +++ b/packages/flutter/test/widgets/animated_align_test.dart @@ -59,11 +59,11 @@ void main() { testWidgets('AnimatedAlign widthFactor', (WidgetTester tester) async { await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Row( mainAxisSize: MainAxisSize.min, - children: const [ + children: [ AnimatedAlign( alignment: Alignment.center, curve: Curves.ease, @@ -84,10 +84,10 @@ void main() { testWidgets('AnimatedAlign heightFactor', (WidgetTester tester) async { await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Column( - children: const [ + children: [ AnimatedAlign( alignment: Alignment.center, curve: Curves.ease, @@ -108,11 +108,11 @@ void main() { testWidgets('AnimatedAlign null height factor', (WidgetTester tester) async { await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ AnimatedAlign( alignment: Alignment.center, curve: Curves.ease, @@ -132,13 +132,13 @@ void main() { testWidgets('AnimatedAlign null widthFactor', (WidgetTester tester) async { await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: SizedBox.shrink( child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ AnimatedAlign( alignment: Alignment.center, curve: Curves.ease, diff --git a/packages/flutter/test/widgets/autofill_group_test.dart b/packages/flutter/test/widgets/autofill_group_test.dart index 8c42981807..9721fca8a5 100644 --- a/packages/flutter/test/widgets/autofill_group_test.dart +++ b/packages/flutter/test/widgets/autofill_group_test.dart @@ -17,7 +17,7 @@ void main() { const TextField client2 = TextField(autofillHints: ['2']); await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Scaffold( body: AutofillGroup( key: outerKey, @@ -25,7 +25,7 @@ void main() { client1, AutofillGroup( key: innerKey, - child: Column(children: const [client2, TextField(autofillHints: null)]), + child: Column(children: [client2, TextField(autofillHints: null)]), ), ]), ), @@ -135,9 +135,9 @@ void main() { child: Column(children: [ client1, TextField(key: keyClient3, autofillHints: const ['3']), - AutofillGroup( + const AutofillGroup( key: innerKey, - child: Column(children: const [client2]), + child: Column(children: [client2]), ), ]), ), diff --git a/packages/flutter/test/widgets/basic_test.dart b/packages/flutter/test/widgets/basic_test.dart index c7db528aa3..8c885eb1ec 100644 --- a/packages/flutter/test/widgets/basic_test.dart +++ b/packages/flutter/test/widgets/basic_test.dart @@ -658,10 +658,10 @@ void main() { }); testWidgets('ColoredBox - no size, no child', (WidgetTester tester) async { - await tester.pumpWidget(Flex( + await tester.pumpWidget(const Flex( direction: Axis.horizontal, textDirection: TextDirection.ltr, - children: const [ + children: [ SizedBox.shrink( child: ColoredBox(color: colorToPaint), ), @@ -681,10 +681,10 @@ void main() { testWidgets('ColoredBox - no size, child', (WidgetTester tester) async { const ValueKey key = ValueKey(0); const Widget child = SizedBox.expand(key: key); - await tester.pumpWidget(Flex( + await tester.pumpWidget(const Flex( direction: Axis.horizontal, textDirection: TextDirection.ltr, - children: const [ + children: [ SizedBox.shrink( child: ColoredBox(color: colorToPaint, child: child), ), diff --git a/packages/flutter/test/widgets/column_test.dart b/packages/flutter/test/widgets/column_test.dart index 2a4828e551..7f86f285e9 100644 --- a/packages/flutter/test/widgets/column_test.dart +++ b/packages/flutter/test/widgets/column_test.dart @@ -18,10 +18,10 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // Default is MainAxisAlignment.start so children so the children's // top edges should be at 0, 100, 500, child2's height should be 400. - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), Expanded(child: SizedBox(key: child1Key, width: 100.0, height: 100.0)), SizedBox(key: child2Key, width: 100.0, height: 100.0), @@ -64,10 +64,10 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // Default is MainAxisAlignment.start so children so the children's // top edges should be at 0, 100, 200 - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), SizedBox(key: child1Key, width: 100.0, height: 100.0), SizedBox(key: child2Key, width: 100.0, height: 100.0), @@ -108,11 +108,11 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // The 100x100 children's top edges should be at 200, 300 - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), SizedBox(key: child1Key, width: 100.0, height: 100.0), ], @@ -147,11 +147,11 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // The 100x100 children's top edges should be at 300, 400, 500. - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, mainAxisAlignment: MainAxisAlignment.end, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), SizedBox(key: child1Key, width: 100.0, height: 100.0), SizedBox(key: child2Key, width: 100.0, height: 100.0), @@ -193,11 +193,11 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // The 100x100 children's top edges should be at 0, 250, 500 - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), SizedBox(key: child1Key, width: 100.0, height: 100.0), SizedBox(key: child2Key, width: 100.0, height: 100.0), @@ -240,11 +240,11 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // The 100x100 children's top edges should be at 25, 175, 325, 475 - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, mainAxisAlignment: MainAxisAlignment.spaceAround, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), SizedBox(key: child1Key, width: 100.0, height: 100.0), SizedBox(key: child2Key, width: 100.0, height: 100.0), @@ -293,11 +293,11 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // The 100x20 children's top edges should be at 135, 290, 445 - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 20.0), SizedBox(key: child1Key, width: 100.0, height: 20.0), SizedBox(key: child2Key, width: 100.0, height: 20.0), @@ -335,10 +335,10 @@ void main() { const Key flexKey = Key('flexKey'); // Default is MainAxisSize.max so the Column should be as high as the test: 600. - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: flexKey, - children: const [ + children: [ SizedBox(width: 100.0, height: 100.0), SizedBox(width: 100.0, height: 150.0), ], @@ -349,11 +349,11 @@ void main() { expect(renderBox.size.height, equals(600.0)); // Column with MainAxisSize.min without flexible children shrink wraps. - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: flexKey, mainAxisSize: MainAxisSize.min, - children: const [ + children: [ SizedBox(width: 100.0, height: 100.0), SizedBox(width: 100.0, height: 150.0), ], @@ -367,11 +367,11 @@ void main() { testWidgets('Column MainAxisSize.min layout at zero size', (WidgetTester tester) async { const Key childKey = Key('childKey'); - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: SizedBox.shrink( child: Column( mainAxisSize: MainAxisSize.min, - children: const [ + children: [ SizedBox( key: childKey, width: 100.0, @@ -399,11 +399,11 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // Default is MainAxisAlignment.start so children so the children's // bottom edges should be at 0, 100, 500 from bottom, child2's height should be 400. - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, verticalDirection: VerticalDirection.up, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), Expanded(child: SizedBox(key: child1Key, width: 100.0, height: 100.0)), SizedBox(key: child2Key, width: 100.0, height: 100.0), @@ -446,11 +446,11 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // Default is MainAxisAlignment.start so children so the children's // bottom edges should be at 0, 100, 200 from bottom - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, verticalDirection: VerticalDirection.up, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), SizedBox(key: child1Key, width: 100.0, height: 100.0), SizedBox(key: child2Key, width: 100.0, height: 100.0), @@ -491,12 +491,12 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // The 100x100 children's bottom edges should be at 200, 300 from bottom - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, mainAxisAlignment: MainAxisAlignment.center, verticalDirection: VerticalDirection.up, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), SizedBox(key: child1Key, width: 100.0, height: 100.0), ], @@ -531,12 +531,12 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // The 100x100 children's bottom edges should be at 300, 400, 500 from bottom. - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, mainAxisAlignment: MainAxisAlignment.end, verticalDirection: VerticalDirection.up, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), SizedBox(key: child1Key, width: 100.0, height: 100.0), SizedBox(key: child2Key, width: 100.0, height: 100.0), @@ -578,12 +578,12 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // The 100x100 children's bottom edges should be at 0, 250, 500 from bottom - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, mainAxisAlignment: MainAxisAlignment.spaceBetween, verticalDirection: VerticalDirection.up, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), SizedBox(key: child1Key, width: 100.0, height: 100.0), SizedBox(key: child2Key, width: 100.0, height: 100.0), @@ -626,12 +626,12 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // The 100x100 children's bottom edges should be at 25, 175, 325, 475 from bottom - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, mainAxisAlignment: MainAxisAlignment.spaceAround, verticalDirection: VerticalDirection.up, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 100.0), SizedBox(key: child1Key, width: 100.0, height: 100.0), SizedBox(key: child2Key, width: 100.0, height: 100.0), @@ -680,12 +680,12 @@ void main() { // Default is MainAxisSize.max so the Column should be as high as the test: 600. // The 100x20 children's bottom edges should be at 135, 290, 445 from bottom - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: columnKey, mainAxisAlignment: MainAxisAlignment.spaceEvenly, verticalDirection: VerticalDirection.up, - children: const [ + children: [ SizedBox(key: child0Key, width: 100.0, height: 20.0), SizedBox(key: child1Key, width: 100.0, height: 20.0), SizedBox(key: child2Key, width: 100.0, height: 20.0), @@ -723,11 +723,11 @@ void main() { const Key flexKey = Key('flexKey'); // Default is MainAxisSize.max so the Column should be as high as the test: 600. - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: flexKey, verticalDirection: VerticalDirection.up, - children: const [ + children: [ SizedBox(width: 100.0, height: 100.0), SizedBox(width: 100.0, height: 150.0), ], @@ -738,12 +738,12 @@ void main() { expect(renderBox.size.height, equals(600.0)); // Column with MainAxisSize.min without flexible children shrink wraps. - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: Column( key: flexKey, mainAxisSize: MainAxisSize.min, verticalDirection: VerticalDirection.up, - children: const [ + children: [ SizedBox(width: 100.0, height: 100.0), SizedBox(width: 100.0, height: 150.0), ], @@ -757,12 +757,12 @@ void main() { testWidgets('Column MainAxisSize.min layout at zero size', (WidgetTester tester) async { const Key childKey = Key('childKey'); - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: SizedBox.shrink( child: Column( mainAxisSize: MainAxisSize.min, verticalDirection: VerticalDirection.up, - children: const [ + children: [ SizedBox( key: childKey, width: 100.0, diff --git a/packages/flutter/test/widgets/dismissible_test.dart b/packages/flutter/test/widgets/dismissible_test.dart index 7760ae9483..f9766ff0ca 100644 --- a/packages/flutter/test/widgets/dismissible_test.dart +++ b/packages/flutter/test/widgets/dismissible_test.dart @@ -640,14 +640,14 @@ void main() { // Dismissible contract. This is not an example of good practice. testWidgets('dismissing bottom then top (smoketest)', (WidgetTester tester) async { await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Center( child: SizedBox( width: 100.0, height: 1000.0, child: Column( - children: const [ + children: [ Test1215DismissibleWidget('1'), Test1215DismissibleWidget('2'), ], diff --git a/packages/flutter/test/widgets/draggable_test.dart b/packages/flutter/test/widgets/draggable_test.dart index 8548daf593..3336a6feb6 100644 --- a/packages/flutter/test/widgets/draggable_test.dart +++ b/packages/flutter/test/widgets/draggable_test.dart @@ -1752,9 +1752,9 @@ void main() { await gesture.moveTo(secondLocation); await tester.pump(); - await tester.pumpWidget(MaterialApp( + await tester.pumpWidget(const MaterialApp( home: Column( - children: const [ + children: [ Draggable( data: 1, feedback: Text('Dragging'), @@ -2284,9 +2284,9 @@ void main() { await gesture.moveTo(secondLocation); await tester.pump(); - await tester.pumpWidget(MaterialApp( + await tester.pumpWidget(const MaterialApp( home: Column( - children: const [ + children: [ Draggable( data: 1, feedback: Text('Dragging'), @@ -3061,9 +3061,9 @@ void main() { const HitTestBehavior hitTestBehavior = HitTestBehavior.deferToChild; await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Column( - children: const [ + children: [ Draggable( feedback: SizedBox(height: 50.0, child: Text('Draggable')), child: SizedBox(height: 50.0, child: Text('Target')), @@ -3079,9 +3079,9 @@ void main() { // Regression test for https://github.com/flutter/flutter/issues/92083 testWidgets('feedback respect the MouseRegion cursor configure', (WidgetTester tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Column( - children: const [ + children: [ Draggable( ignoringFeedbackPointer: false, feedback: MouseRegion( diff --git a/packages/flutter/test/widgets/flex_test.dart b/packages/flutter/test/widgets/flex_test.dart index 0e112b7154..1a29b997e2 100644 --- a/packages/flutter/test/widgets/flex_test.dart +++ b/packages/flutter/test/widgets/flex_test.dart @@ -49,9 +49,9 @@ void main() { testWidgets('Flexible defaults to loose', (WidgetTester tester) async { await tester.pumpWidget( - Row( + const Row( textDirection: TextDirection.ltr, - children: const [ + children: [ Flexible(child: SizedBox(width: 100.0, height: 200.0)), ], ), @@ -64,11 +64,11 @@ void main() { testWidgets("Doesn't overflow because of floating point accumulated error", (WidgetTester tester) async { // both of these cases have failed in the past due to floating point issues await tester.pumpWidget( - Center( + const Center( child: SizedBox( height: 400.0, child: Column( - children: const [ + children: [ Expanded(child: SizedBox()), Expanded(child: SizedBox()), Expanded(child: SizedBox()), @@ -81,11 +81,11 @@ void main() { ), ); await tester.pumpWidget( - Center( + const Center( child: SizedBox( height: 199.0, child: Column( - children: const [ + children: [ Expanded(child: SizedBox()), Expanded(child: SizedBox()), Expanded(child: SizedBox()), @@ -104,7 +104,7 @@ void main() { // we only get a single exception. Otherwise we'd get two, the one we want and // an extra one when we discover we never computed a size. await tester.pumpWidget( - Column( + const Column( children: [ Column(), ], @@ -134,11 +134,17 @@ void main() { }); testWidgets('Can set and update clipBehavior', (WidgetTester tester) async { - await tester.pumpWidget(Flex(direction: Axis.vertical)); + await tester.pumpWidget(const Flex(direction: Axis.vertical)); final RenderFlex renderObject = tester.allRenderObjects.whereType().first; expect(renderObject.clipBehavior, equals(Clip.none)); - await tester.pumpWidget(Flex(direction: Axis.vertical, clipBehavior: Clip.antiAlias)); + await tester.pumpWidget(const Flex(direction: Axis.vertical, clipBehavior: Clip.antiAlias)); expect(renderObject.clipBehavior, equals(Clip.antiAlias)); }); + + test('Flex/Column/Row can be const-constructed', () { + const Flex(direction: Axis.vertical); + const Column(); + const Row(); + }); } diff --git a/packages/flutter/test/widgets/implicit_semantics_test.dart b/packages/flutter/test/widgets/implicit_semantics_test.dart index 18455bede7..42ef792235 100644 --- a/packages/flutter/test/widgets/implicit_semantics_test.dart +++ b/packages/flutter/test/widgets/implicit_semantics_test.dart @@ -17,8 +17,8 @@ void main() { textDirection: TextDirection.ltr, child: Semantics( container: true, - child: Column( - children: const [ + child: const Column( + children: [ Text('Michael Goderbauer'), Text('goderbauer@google.com'), ], @@ -51,8 +51,8 @@ void main() { child: Semantics( container: true, explicitChildNodes: true, - child: Column( - children: const [ + child: const Column( + children: [ Text('Michael Goderbauer'), Text('goderbauer@google.com'), ], @@ -98,8 +98,8 @@ void main() { explicitChildNodes: true, child: Semantics( label: 'Signed in as', - child: Column( - children: const [ + child: const Column( + children: [ Text('Michael Goderbauer'), Text('goderbauer@google.com'), ], @@ -140,8 +140,8 @@ void main() { container: true, child: Semantics( label: 'Signed in as', - child: Column( - children: const [ + child: const Column( + children: [ Text('Michael Goderbauer'), Text('goderbauer@google.com'), ], diff --git a/packages/flutter/test/widgets/list_body_test.dart b/packages/flutter/test/widgets/list_body_test.dart index 986af0c400..6fcc17e1b2 100644 --- a/packages/flutter/test/widgets/list_body_test.dart +++ b/packages/flutter/test/widgets/list_body_test.dart @@ -29,9 +29,9 @@ void expectRects(WidgetTester tester, List expected) { void main() { testWidgets('ListBody down', (WidgetTester tester) async { - await tester.pumpWidget(Flex( + await tester.pumpWidget(const Flex( direction: Axis.vertical, - children: const [ ListBody(children: children) ], + children: [ ListBody(children: children) ], )); expectRects( @@ -46,9 +46,9 @@ void main() { }); testWidgets('ListBody up', (WidgetTester tester) async { - await tester.pumpWidget(Flex( + await tester.pumpWidget(const Flex( direction: Axis.vertical, - children: const [ ListBody(reverse: true, children: children) ], + children: [ ListBody(reverse: true, children: children) ], )); expectRects( @@ -63,10 +63,10 @@ void main() { }); testWidgets('ListBody right', (WidgetTester tester) async { - await tester.pumpWidget(Flex( + await tester.pumpWidget(const Flex( textDirection: TextDirection.ltr, direction: Axis.horizontal, - children: const [ + children: [ Directionality( textDirection: TextDirection.ltr, child: ListBody(mainAxis: Axis.horizontal, children: children), @@ -86,10 +86,10 @@ void main() { }); testWidgets('ListBody left', (WidgetTester tester) async { - await tester.pumpWidget(Flex( + await tester.pumpWidget(const Flex( textDirection: TextDirection.ltr, direction: Axis.horizontal, - children: const [ + children: [ Directionality( textDirection: TextDirection.rtl, child: ListBody(mainAxis: Axis.horizontal, children: children), @@ -147,7 +147,7 @@ void main() { FlutterError.onError = (FlutterErrorDetails error) => errors.add(error); try { await tester.pumpWidget( - Flex( + const Flex( textDirection: TextDirection.ltr, direction: Axis.horizontal, children: [ @@ -159,7 +159,7 @@ void main() { Flex( textDirection: TextDirection.ltr, direction: Axis.vertical, - children: const [ + children: [ Directionality( textDirection: TextDirection.ltr, child: ListBody( diff --git a/packages/flutter/test/widgets/multichildobject_with_keys_test.dart b/packages/flutter/test/widgets/multichildobject_with_keys_test.dart index 7fa2045877..d00260a774 100644 --- a/packages/flutter/test/widgets/multichildobject_with_keys_test.dart +++ b/packages/flutter/test/widgets/multichildobject_with_keys_test.dart @@ -11,10 +11,10 @@ void main() { // Regression test for https://github.com/flutter/flutter/issues/48855. await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Column( - children: const [ + children: [ Text('0', key: ValueKey(0)), Text('1', key: ValueKey(1)), Text('2', key: ValueKey(2)), @@ -35,10 +35,10 @@ void main() { ); await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Column( - children: const [ + children: [ Text('0', key: ValueKey(0)), Text('6', key: ValueKey(6)), Text('7', key: ValueKey(7)), @@ -62,8 +62,8 @@ void main() { testWidgets('Building a new MultiChildRenderObjectElement with children having duplicated keys throws', (WidgetTester tester) async { const ValueKey duplicatedKey = ValueKey(1); - await tester.pumpWidget(Column( - children: const [ + await tester.pumpWidget(const Column( + children: [ Text('Text 1', textDirection: TextDirection.ltr, key: duplicatedKey), Text('Text 2', textDirection: TextDirection.ltr, key: duplicatedKey), ], diff --git a/packages/flutter/test/widgets/parent_data_test.dart b/packages/flutter/test/widgets/parent_data_test.dart index 837fd35b88..d546947c81 100644 --- a/packages/flutter/test/widgets/parent_data_test.dart +++ b/packages/flutter/test/widgets/parent_data_test.dart @@ -292,11 +292,11 @@ void main() { checkTree(tester, []); await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: DummyWidget( child: Row( - children: const [ + children: [ Positioned( top: 6.0, left: 7.0, diff --git a/packages/flutter/test/widgets/physical_model_test.dart b/packages/flutter/test/widgets/physical_model_test.dart index c884ecc1c3..c5ac33cbe6 100644 --- a/packages/flutter/test/widgets/physical_model_test.dart +++ b/packages/flutter/test/widgets/physical_model_test.dart @@ -47,15 +47,15 @@ void main() { testWidgets('PhysicalModel - clips when overflows and elevation is 0', (WidgetTester tester) async { const Key key = Key('test'); await tester.pumpWidget( - MediaQuery( + const MediaQuery( key: key, - data: const MediaQueryData(), + data: MediaQueryData(), child: Directionality( textDirection: TextDirection.ltr, child: Padding( - padding: const EdgeInsets.all(50), + padding: EdgeInsets.all(50), child: Row( - children: const [ + children: [ Material(child: Text('A long long long long long long long string')), Material(child: Text('A long long long long long long long string')), Material(child: Text('A long long long long long long long string')), diff --git a/packages/flutter/test/widgets/rich_text_test.dart b/packages/flutter/test/widgets/rich_text_test.dart index 79dc0c537e..e8c83eea5b 100644 --- a/packages/flutter/test/widgets/rich_text_test.dart +++ b/packages/flutter/test/widgets/rich_text_test.dart @@ -147,17 +147,17 @@ void main() { color: Colors.green, child: IntrinsicHeight( child: RichText( - text: TextSpan( + text: const TextSpan( children: [ - const TextSpan(text: 'Start\n', style: TextStyle(height: 1.0, fontSize: 16)), + TextSpan(text: 'Start\n', style: TextStyle(height: 1.0, fontSize: 16)), WidgetSpan( child: Row( - children: const [ + children: [ SizedBox(height: 16, width: 16), ], ), ), - const TextSpan(text: 'End', style: TextStyle(height: 1.0, fontSize: 16)), + TextSpan(text: 'End', style: TextStyle(height: 1.0, fontSize: 16)), ], ), ), diff --git a/packages/flutter/test/widgets/row_test.dart b/packages/flutter/test/widgets/row_test.dart index b189ed4c29..884dfbf288 100644 --- a/packages/flutter/test/widgets/row_test.dart +++ b/packages/flutter/test/widgets/row_test.dart @@ -284,12 +284,12 @@ void main() { OrderPainter.log.clear(); const Key childKey = Key('childKey'); - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: SizedBox.shrink( child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ SizedBox( key: childKey, width: 100.0, @@ -704,13 +704,13 @@ void main() { OrderPainter.log.clear(); const Key childKey = Key('childKey'); - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: SizedBox.shrink( child: Row( textDirection: TextDirection.ltr, mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ SizedBox( key: childKey, width: 100.0, @@ -1125,13 +1125,13 @@ void main() { OrderPainter.log.clear(); const Key childKey = Key('childKey'); - await tester.pumpWidget(Center( + await tester.pumpWidget(const Center( child: SizedBox.shrink( child: Row( textDirection: TextDirection.rtl, mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ SizedBox( key: childKey, width: 100.0, diff --git a/packages/flutter/test/widgets/safe_area_test.dart b/packages/flutter/test/widgets/safe_area_test.dart index 92c5fb6803..2960351456 100644 --- a/packages/flutter/test/widgets/safe_area_test.dart +++ b/packages/flutter/test/widgets/safe_area_test.dart @@ -113,10 +113,10 @@ void main() { } testWidgets('SafeArea alone.', (WidgetTester tester) async { - final Widget child = boilerplate(SafeArea( + final Widget child = boilerplate(const SafeArea( maintainBottomViewPadding: true, child: Column( - children: const [ + children: [ Expanded(child: Placeholder()), ], ), @@ -148,10 +148,10 @@ void main() { }); testWidgets('SafeArea alone - partial ViewInsets consume Padding', (WidgetTester tester) async { - final Widget child = boilerplate(SafeArea( + final Widget child = boilerplate(const SafeArea( maintainBottomViewPadding: true, child: Column( - children: const [ + children: [ Expanded(child: Placeholder()), ], ), @@ -181,12 +181,12 @@ void main() { }); testWidgets('SafeArea with nested Scaffold', (WidgetTester tester) async { - final Widget child = boilerplate(SafeArea( + final Widget child = boilerplate(const SafeArea( maintainBottomViewPadding: true, child: Scaffold( resizeToAvoidBottomInset: false, body: Column( - children: const [ + children: [ Expanded(child: Placeholder()), ], ), @@ -219,12 +219,12 @@ void main() { }); testWidgets('SafeArea with nested Scaffold - partial ViewInsets consume Padding', (WidgetTester tester) async { - final Widget child = boilerplate(SafeArea( + final Widget child = boilerplate(const SafeArea( maintainBottomViewPadding: true, child: Scaffold( resizeToAvoidBottomInset: false, body: Column( - children: const [ + children: [ Expanded(child: Placeholder()), ], ), diff --git a/packages/flutter/test/widgets/selectable_region_test.dart b/packages/flutter/test/widgets/selectable_region_test.dart index 4af40c4af5..76f3f77128 100644 --- a/packages/flutter/test/widgets/selectable_region_test.dart +++ b/packages/flutter/test/widgets/selectable_region_test.dart @@ -409,8 +409,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -449,8 +449,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), SelectionContainer.disabled(child: Text('Good, and you?')), Text('Fine, thank you.'), @@ -490,8 +490,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -529,8 +529,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -665,8 +665,8 @@ void main() { home: SelectableRegion( focusNode: focusNode, selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -813,8 +813,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('جيد وانت؟', textDirection: TextDirection.rtl), Text('Fine, thank you.'), @@ -854,8 +854,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -954,8 +954,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -995,8 +995,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -1031,8 +1031,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -1067,8 +1067,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -1102,8 +1102,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -1141,8 +1141,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -1201,8 +1201,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -1311,8 +1311,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -1402,8 +1402,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), @@ -1480,8 +1480,8 @@ void main() { home: SelectableRegion( focusNode: FocusNode(), selectionControls: materialTextSelectionControls, - child: Column( - children: const [ + child: const Column( + children: [ Text('How are you?'), Text('Good, and you?'), Text('Fine, thank you.'), diff --git a/packages/flutter/test/widgets/selectable_text_test.dart b/packages/flutter/test/widgets/selectable_text_test.dart index a1fdd05de2..65beeda28e 100644 --- a/packages/flutter/test/widgets/selectable_text_test.dart +++ b/packages/flutter/test/widgets/selectable_text_test.dart @@ -5079,11 +5079,11 @@ void main() { testWidgets('text selection style 1', (WidgetTester tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Material( child: Center( child: Column( - children: const [ + children: [ SelectableText.rich( TextSpan( children: [ @@ -5131,11 +5131,11 @@ void main() { testWidgets('text selection style 2', (WidgetTester tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Material( child: Center( child: Column( - children: const [ + children: [ SelectableText.rich( TextSpan( children: [ diff --git a/packages/flutter/test/widgets/selection_container_test.dart b/packages/flutter/test/widgets/selection_container_test.dart index c4992bfc63..22db563b81 100644 --- a/packages/flutter/test/widgets/selection_container_test.dart +++ b/packages/flutter/test/widgets/selection_container_test.dart @@ -25,8 +25,8 @@ void main() { SelectionContainer( registrar: registrar, delegate: delegate, - child: Column( - children: const [ + child: const Column( + children: [ Text('column1', textDirection: TextDirection.ltr), Text('column2', textDirection: TextDirection.ltr), Text('column3', textDirection: TextDirection.ltr), @@ -46,9 +46,9 @@ void main() { SelectionContainer( registrar: registrar, delegate: delegate, - child: SelectionContainer.disabled( + child: const SelectionContainer.disabled( child: Column( - children: const [ + children: [ Text('column1', textDirection: TextDirection.ltr), Text('column2', textDirection: TextDirection.ltr), Text('column3', textDirection: TextDirection.ltr), @@ -69,7 +69,7 @@ void main() { SelectionContainer( registrar: registrar, delegate: delegate, - child: Column( + child: const Column( ), ), ); @@ -80,8 +80,8 @@ void main() { SelectionContainer( registrar: registrar, delegate: delegate, - child: Column( - children: const [ + child: const Column( + children: [ Text('column1', textDirection: TextDirection.ltr), ], ), @@ -94,7 +94,7 @@ void main() { SelectionContainer( registrar: registrar, delegate: delegate, - child: Column( + child: const Column( ), ), ); @@ -111,8 +111,8 @@ void main() { registrar: registrar, child: SelectionContainer( delegate: delegate, - child: Column( - children: const [ + child: const Column( + children: [ Text('column1', textDirection: TextDirection.ltr), ], ), diff --git a/packages/flutter/test/widgets/semantics_clipping_test.dart b/packages/flutter/test/widgets/semantics_clipping_test.dart index 0ad7f74238..73554422dc 100644 --- a/packages/flutter/test/widgets/semantics_clipping_test.dart +++ b/packages/flutter/test/widgets/semantics_clipping_test.dart @@ -12,7 +12,7 @@ void main() { testWidgets('SemanticNode.rect is clipped', (WidgetTester tester) async { final SemanticsTester semantics = SemanticsTester(tester); - await tester.pumpWidget(Directionality( + await tester.pumpWidget(const Directionality( textDirection: TextDirection.ltr, child: Center( child: SizedBox( @@ -20,7 +20,7 @@ void main() { child: Flex( clipBehavior: Clip.hardEdge, direction: Axis.horizontal, - children: const [ + children: [ SizedBox( width: 75.0, child: Text('1'), @@ -70,7 +70,7 @@ void main() { testWidgets('SemanticsNode is not removed if out of bounds and merged into something within bounds', (WidgetTester tester) async { final SemanticsTester semantics = SemanticsTester(tester); - await tester.pumpWidget(Directionality( + await tester.pumpWidget(const Directionality( textDirection: TextDirection.ltr, child: Center( child: SizedBox( @@ -79,14 +79,14 @@ void main() { clipBehavior: Clip.hardEdge, direction: Axis.horizontal, children: [ - const SizedBox( + SizedBox( width: 75.0, child: Text('1'), ), MergeSemantics( child: Flex( direction: Axis.horizontal, - children: const [ + children: [ SizedBox( width: 75.0, child: Text('2'), diff --git a/packages/flutter/test/widgets/semantics_test.dart b/packages/flutter/test/widgets/semantics_test.dart index fa84dce684..20b08aedf1 100644 --- a/packages/flutter/test/widgets/semantics_test.dart +++ b/packages/flutter/test/widgets/semantics_test.dart @@ -1001,14 +1001,14 @@ void main() { }, ); await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Column( children: [ - const Text('Label 1'), - const Text('Label 2'), + Text('Label 1'), + Text('Label 2'), Row( - children: const [ + children: [ Text('Label 3'), Text('Label 4'), Text('Label 5'), @@ -1070,8 +1070,8 @@ void main() { const Text('Label 2'), Transform.rotate( angle: pi / 2.0, - child: Row( - children: const [ + child: const Row( + children: [ Text('Label 3'), Text('Label 4'), Text('Label 5'), @@ -1638,7 +1638,7 @@ void main() { // Construct a widget tree that will end up with a fitted box that applies // a zero transform because it does not actually draw its children. // Assert that this subtree gets dropped (the root node has no children). - await tester.pumpWidget(Column( + await tester.pumpWidget(const Column( children: [ SizedBox( height: 0, diff --git a/packages/flutter/test/widgets/spacer_test.dart b/packages/flutter/test/widgets/spacer_test.dart index 93810d5ff7..06fbda26d2 100644 --- a/packages/flutter/test/widgets/spacer_test.dart +++ b/packages/flutter/test/widgets/spacer_test.dart @@ -7,8 +7,8 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Spacer takes up space.', (WidgetTester tester) async { - await tester.pumpWidget(Column( - children: const [ + await tester.pumpWidget(const Column( + children: [ SizedBox(width: 10.0, height: 10.0), Spacer(), SizedBox(width: 10.0, height: 10.0), @@ -24,9 +24,9 @@ void main() { const Spacer spacer2 = Spacer(); const Spacer spacer3 = Spacer(flex: 2); const Spacer spacer4 = Spacer(flex: 4); - await tester.pumpWidget(Row( + await tester.pumpWidget(const Row( textDirection: TextDirection.rtl, - children: const [ + children: [ SizedBox(width: 10.0, height: 10.0), spacer1, SizedBox(width: 10.0, height: 10.0), @@ -54,10 +54,10 @@ void main() { }); testWidgets('Spacer takes up space.', (WidgetTester tester) async { - await tester.pumpWidget(UnconstrainedBox( + await tester.pumpWidget(const UnconstrainedBox( constrainedAxis: Axis.vertical, child: Column( - children: const [ + children: [ SizedBox(width: 20.0, height: 10.0), Spacer(), SizedBox(width: 10.0, height: 10.0), diff --git a/packages/flutter/test/widgets/syncing_test.dart b/packages/flutter/test/widgets/syncing_test.dart index 5c7f0fcd4b..84745ca07c 100644 --- a/packages/flutter/test/widgets/syncing_test.dart +++ b/packages/flutter/test/widgets/syncing_test.dart @@ -130,7 +130,7 @@ void main() { testWidgets('swap instances around', (WidgetTester tester) async { const Widget a = TestWidget(persistentState: 0x61, syncedState: 0x41, child: Text('apple', textDirection: TextDirection.ltr)); const Widget b = TestWidget(persistentState: 0x62, syncedState: 0x42, child: Text('banana', textDirection: TextDirection.ltr)); - await tester.pumpWidget(Column()); + await tester.pumpWidget(const Column()); final GlobalKey keyA = GlobalKey(); final GlobalKey keyB = GlobalKey(); diff --git a/packages/flutter/test/widgets/text_golden_test.dart b/packages/flutter/test/widgets/text_golden_test.dart index 497beb637c..fe8661d0cd 100644 --- a/packages/flutter/test/widgets/text_golden_test.dart +++ b/packages/flutter/test/widgets/text_golden_test.dart @@ -1331,8 +1331,8 @@ void main() { decoration: const BoxDecoration( color: Color(0xff00ff00), ), - child: Column( - children: const [ + child: const Column( + children: [ Text('Hello\nLine 2\nLine 3', textDirection: TextDirection.ltr, style: TextStyle(height: 5), diff --git a/packages/flutter/test/widgets/text_test.dart b/packages/flutter/test/widgets/text_test.dart index 81aca6aa76..39ca2ac0ac 100644 --- a/packages/flutter/test/widgets/text_test.dart +++ b/packages/flutter/test/widgets/text_test.dart @@ -1012,13 +1012,13 @@ void main() { testWidgets('textWidthBasis with textAlign still obeys parent alignment', (WidgetTester tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Scaffold( body: Center( child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, - children: const [ + children: [ Text( 'LEFT ALIGNED, PARENT', textAlign: TextAlign.left, diff --git a/packages/flutter/test/widgets/ticker_mode_test.dart b/packages/flutter/test/widgets/ticker_mode_test.dart index ab36ed5416..aa09b8c9c2 100644 --- a/packages/flutter/test/widgets/ticker_mode_test.dart +++ b/packages/flutter/test/widgets/ticker_mode_test.dart @@ -190,8 +190,8 @@ void main() { routes: { '/foo' : (BuildContext context) => const Text('New route'), }, - home: Row( - children: const [ + home: const Row( + children: [ _TickingWidget(), _MultiTickingWidget(), Text('Old route'), diff --git a/packages/flutter/test/widgets/transform_test.dart b/packages/flutter/test/widgets/transform_test.dart index 5d90169ef9..2165e0a8e1 100644 --- a/packages/flutter/test/widgets/transform_test.dart +++ b/packages/flutter/test/widgets/transform_test.dart @@ -808,7 +808,7 @@ void main() { ), const ColoredBox(color: Color(0xff00ff00), child: square), ]), - Row(mainAxisSize: MainAxisSize.min, children: const [ + const Row(mainAxisSize: MainAxisSize.min, children: [ ColoredBox(color: Color(0xff0000ff), child: square), ColoredBox(color: Color(0xffeeff00), child: square), ]), diff --git a/packages/flutter/test/widgets/widget_inspector_test.dart b/packages/flutter/test/widgets/widget_inspector_test.dart index 136abf2ede..6afc88cc0f 100644 --- a/packages/flutter/test/widgets/widget_inspector_test.dart +++ b/packages/flutter/test/widgets/widget_inspector_test.dart @@ -4303,11 +4303,11 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { }); Future pumpWidgetForLayoutExplorer(WidgetTester tester) async { - final Widget widget = Directionality( + const Widget widget = Directionality( textDirection: TextDirection.ltr, child: Center( child: Row( - children: const [ + children: [ Flexible( child: ColoredBox( color: Colors.green, @@ -4959,9 +4959,9 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { appBar: AppBar( title: const Text('Hello World!'), ), - body: Center( + body: const Center( child: Column( - children: const [ + children: [ Text('Hello World!'), ], ), diff --git a/packages/flutter/test/widgets/wrap_test.dart b/packages/flutter/test/widgets/wrap_test.dart index c034ac2075..c6e56a5876 100644 --- a/packages/flutter/test/widgets/wrap_test.dart +++ b/packages/flutter/test/widgets/wrap_test.dart @@ -841,8 +841,8 @@ void main() { testWidgets('Object exactly matches container width', (WidgetTester tester) async { await tester.pumpWidget( - Column( - children: const [ + const Column( + children: [ Wrap( textDirection: TextDirection.ltr, spacing: 10.0, @@ -859,8 +859,8 @@ void main() { verify(tester, [Offset.zero]); await tester.pumpWidget( - Column( - children: const [ + const Column( + children: [ Wrap( textDirection: TextDirection.ltr, spacing: 10.0, @@ -893,7 +893,7 @@ void main() { testWidgets('Horizontal wrap - IntrinsicsHeight', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/48679. await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Center( child: IntrinsicHeight( @@ -901,13 +901,13 @@ void main() { color: Colors.green, child: Wrap( children: [ - const Text('Start', style: TextStyle(height: 1.0, fontSize: 16)), + Text('Start', style: TextStyle(height: 1.0, fontSize: 16)), Row( - children: const [ + children: [ SizedBox(height: 40, width: 60), ], ), - const Text('End', style: TextStyle(height: 1.0, fontSize: 16)), + Text('End', style: TextStyle(height: 1.0, fontSize: 16)), ], ), ), @@ -925,7 +925,7 @@ void main() { testWidgets('Vertical wrap - IntrinsicsWidth', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/48679. await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Center( child: IntrinsicWidth( @@ -934,13 +934,13 @@ void main() { child: Wrap( direction: Axis.vertical, children: [ - const Text('Start', style: TextStyle(height: 1.0, fontSize: 16)), + Text('Start', style: TextStyle(height: 1.0, fontSize: 16)), Column( - children: const [ + children: [ SizedBox(height: 40, width: 60), ], ), - const Text('End', style: TextStyle(height: 1.0, fontSize: 16)), + Text('End', style: TextStyle(height: 1.0, fontSize: 16)), ], ), ), diff --git a/packages/flutter_driver/test/src/real_tests/extension_test.dart b/packages/flutter_driver/test/src/real_tests/extension_test.dart index 3ad19666a9..1756738f1c 100644 --- a/packages/flutter_driver/test/src/real_tests/extension_test.dart +++ b/packages/flutter_driver/test/src/real_tests/extension_test.dart @@ -649,10 +649,10 @@ void main() { } await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Column( - key: const ValueKey('column'), - children: const [ + key: ValueKey('column'), + children: [ Text('Hello1', key: ValueKey('text1')), Text('Hello2', key: ValueKey('text2')), Text('Hello3', key: ValueKey('text3')), @@ -694,10 +694,10 @@ void main() { } await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Column( - key: const ValueKey('column'), - children: const [ + key: ValueKey('column'), + children: [ Text('Hello1', key: ValueKey('text1')), Text('Hello2', key: ValueKey('text2')), Text('Hello3', key: ValueKey('text3')), @@ -729,15 +729,15 @@ void main() { } await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Center( child: SizedBox( - key: const ValueKey('parent'), + key: ValueKey('parent'), height: 100, width: 100, child: Center( child: Row( - children: const [ + children: [ SizedBox( key: ValueKey('leftchild'), width: 25, @@ -1147,9 +1147,9 @@ void main() { return result; } - final Widget testWidget = MaterialApp( + const Widget testWidget = MaterialApp( home: Material( - child: Column(children: const [ + child: Column(children: [ Text('Hello ', key: Key('widgetOne')), SizedBox.shrink( child: Text('World!', key: Key('widgetTwo')), diff --git a/packages/flutter_test/test/accessibility_test.dart b/packages/flutter_test/test/accessibility_test.dart index 22fc3f307f..29e405105c 100644 --- a/packages/flutter_test/test/accessibility_test.dart +++ b/packages/flutter_test/test/accessibility_test.dart @@ -27,8 +27,8 @@ void main() { final SemanticsHandle handle = tester.ensureSemantics(); await tester.pumpWidget( _boilerplate( - Column( - children: const [ + const Column( + children: [ Text( 'this is a test', style: TextStyle(fontSize: 14.0, color: Colors.black), @@ -52,8 +52,8 @@ void main() { final SemanticsHandle handle = tester.ensureSemantics(); await tester.pumpWidget( _boilerplate( - Column( - children: const [ + const Column( + children: [ Text( 'this is a test', style: TextStyle(fontSize: 14.0, color: Colors.black), @@ -107,8 +107,8 @@ void main() { width: 200.0, height: 300.0, color: Colors.white, - child: Column( - children: const [ + child: const Column( + children: [ Text( 'this is a white text', style: TextStyle(fontSize: 14.0, color: Colors.white), diff --git a/packages/flutter_test/test/controller_test.dart b/packages/flutter_test/test/controller_test.dart index d4b532b14d..35d4761932 100644 --- a/packages/flutter_test/test/controller_test.dart +++ b/packages/flutter_test/test/controller_test.dart @@ -727,10 +727,10 @@ void main() { testWidgets('throws when there are multiple results from the finder', (WidgetTester tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Scaffold( body: Row( - children: const [ + children: [ Text('hello'), Text('hello'), ], diff --git a/packages/flutter_test/test/finders_test.dart b/packages/flutter_test/test/finders_test.dart index 7ffaf62d06..82b1141e24 100644 --- a/packages/flutter_test/test/finders_test.dart +++ b/packages/flutter_test/test/finders_test.dart @@ -275,7 +275,7 @@ void main() { await tester.pumpWidget(_boilerplate( Semantics( container: true, - child: Row(children: const [ + child: const Row(children: [ Text('Hello'), Text('World'), ]), @@ -359,14 +359,14 @@ void main() { testWidgets('finds multiple subtypes', (WidgetTester tester) async { await tester.pumpWidget(_boilerplate( Row(children: [ - Column(children: const [ + const Column(children: [ Text('Hello'), Text('World'), ]), Column(children: [ Image(image: FileImage(File('test'))), ]), - Column(children: const [ + const Column(children: [ SimpleGenericWidget(child: Text('one')), SimpleGenericWidget(child: Text('pi')), SimpleGenericWidget(child: Text('two')), diff --git a/packages/flutter_test/test/matchers_test.dart b/packages/flutter_test/test/matchers_test.dart index 6d79967dd8..7086a8a479 100644 --- a/packages/flutter_test/test/matchers_test.dart +++ b/packages/flutter_test/test/matchers_test.dart @@ -485,8 +485,8 @@ void main() { }); testWidgets('if finder finds multiple widgets', (WidgetTester tester) async { - await tester.pumpWidget(boilerplate(Column( - children: const [Text('hello'), Text('world')], + await tester.pumpWidget(boilerplate(const Column( + children: [Text('hello'), Text('world')], ))); final Finder finder = find.byType(Text); await expectLater( @@ -1296,8 +1296,8 @@ void main() { testWidgets('succeeds when finds more then the specified count', (WidgetTester tester) async { - await tester.pumpWidget(boilerplate(Column( - children: const [Text('1'), Text('2'), Text('3')], + await tester.pumpWidget(boilerplate(const Column( + children: [Text('1'), Text('2'), Text('3')], ))); expect(find.byType(Text), findsAtLeastNWidgets(2)); @@ -1305,8 +1305,8 @@ void main() { testWidgets('succeeds when finds the exact specified count', (WidgetTester tester) async { - await tester.pumpWidget(boilerplate(Column( - children: const [Text('1'), Text('2')], + await tester.pumpWidget(boilerplate(const Column( + children: [Text('1'), Text('2')], ))); expect(find.byType(Text), findsAtLeastNWidgets(2)); @@ -1314,8 +1314,8 @@ void main() { testWidgets('fails when finds less then specified count', (WidgetTester tester) async { - await tester.pumpWidget(boilerplate(Column( - children: const [Text('1'), Text('2')], + await tester.pumpWidget(boilerplate(const Column( + children: [Text('1'), Text('2')], ))); expect(find.byType(Text), isNot(findsAtLeastNWidgets(3))); diff --git a/packages/flutter_test/test/widget_tester_test.dart b/packages/flutter_test/test/widget_tester_test.dart index 713406e5cf..a572da7055 100644 --- a/packages/flutter_test/test/widget_tester_test.dart +++ b/packages/flutter_test/test/widget_tester_test.dart @@ -216,7 +216,7 @@ void main() { group('find.descendant', () { testWidgets('finds one descendant', (WidgetTester tester) async { - await tester.pumpWidget(Row( + await tester.pumpWidget(const Row( textDirection: TextDirection.ltr, children: [ Column(children: fooBarTexts), @@ -230,7 +230,7 @@ void main() { }); testWidgets('finds two descendants with different ancestors', (WidgetTester tester) async { - await tester.pumpWidget(Row( + await tester.pumpWidget(const Row( textDirection: TextDirection.ltr, children: [ Column(children: fooBarTexts), @@ -245,11 +245,11 @@ void main() { }); testWidgets('fails with a descriptive message', (WidgetTester tester) async { - await tester.pumpWidget(Row( + await tester.pumpWidget(const Row( textDirection: TextDirection.ltr, children: [ - Column(children: const [Text('foo', textDirection: TextDirection.ltr)]), - const Text('bar', textDirection: TextDirection.ltr), + Column(children: [Text('foo', textDirection: TextDirection.ltr)]), + Text('bar', textDirection: TextDirection.ltr), ], )); @@ -275,7 +275,7 @@ void main() { group('find.ancestor', () { testWidgets('finds one ancestor', (WidgetTester tester) async { - await tester.pumpWidget(Row( + await tester.pumpWidget(const Row( textDirection: TextDirection.ltr, children: [ Column(children: fooBarTexts), @@ -290,7 +290,7 @@ void main() { testWidgets('finds two matching ancestors, one descendant', (WidgetTester tester) async { await tester.pumpWidget( - Directionality( + const Directionality( textDirection: TextDirection.ltr, child: Row( children: [ @@ -307,11 +307,11 @@ void main() { }); testWidgets('fails with a descriptive message', (WidgetTester tester) async { - await tester.pumpWidget(Row( + await tester.pumpWidget(const Row( textDirection: TextDirection.ltr, children: [ - Column(children: const [Text('foo', textDirection: TextDirection.ltr)]), - const Text('bar', textDirection: TextDirection.ltr), + Column(children: [Text('foo', textDirection: TextDirection.ltr)]), + Text('bar', textDirection: TextDirection.ltr), ], )); @@ -335,7 +335,7 @@ void main() { }); testWidgets('Root not matched by default', (WidgetTester tester) async { - await tester.pumpWidget(Row( + await tester.pumpWidget(const Row( textDirection: TextDirection.ltr, children: [ Column(children: fooBarTexts), @@ -349,7 +349,7 @@ void main() { }); testWidgets('Match the root', (WidgetTester tester) async { - await tester.pumpWidget(Row( + await tester.pumpWidget(const Row( textDirection: TextDirection.ltr, children: [ Column(children: fooBarTexts), @@ -373,7 +373,7 @@ void main() { children: [ _deepWidgetTree( depth: 1000, - child: Column(children: fooBarTexts), + child: const Column(children: fooBarTexts), ), ], ), diff --git a/packages/flutter_tools/test/integration.shard/overall_experience_test.dart b/packages/flutter_tools/test/integration.shard/overall_experience_test.dart index 6a4d8ed62a..ce8433d48b 100644 --- a/packages/flutter_tools/test/integration.shard/overall_experience_test.dart +++ b/packages/flutter_tools/test/integration.shard/overall_experience_test.dart @@ -519,7 +519,7 @@ void main() { 'A RenderFlex overflowed by 69200 pixels on the right.', '', 'The relevant error-causing widget was:', - matches(RegExp(r'^ Row .+flutter/dev/integration_tests/ui/lib/overflow\.dart:32:12$')), + matches(RegExp(r'^ Row .+flutter/dev/integration_tests/ui/lib/overflow\.dart:32:18$')), '', 'To inspect this widget in Flutter DevTools, visit:', startsWith('http'),