From 0d0861b3eea4c9c9f93c253853f92d749495791e Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Fri, 21 Apr 2017 14:59:24 -0700 Subject: [PATCH] The const will continue until morale improves (#9536) --- dev/benchmarks/complex_layout/lib/main.dart | 48 +++++++++---------- .../flutter_gallery/lib/gallery/home.dart | 4 +- .../widgets/box_sliver_mismatch_test.dart | 6 +-- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/dev/benchmarks/complex_layout/lib/main.dart b/dev/benchmarks/complex_layout/lib/main.dart index 00dd1e5a9b..3162c8c837 100644 --- a/dev/benchmarks/complex_layout/lib/main.dart +++ b/dev/benchmarks/complex_layout/lib/main.dart @@ -96,45 +96,45 @@ class TopBarMenu extends StatelessWidget { return new PopupMenuButton( onSelected: (String value) { print('Selected: $value'); }, itemBuilder: (BuildContext context) => >[ - new PopupMenuItem( + const PopupMenuItem( value: 'Friends', - child: new MenuItemWithIcon(Icons.people, 'Friends', '5 new') + child: const MenuItemWithIcon(Icons.people, 'Friends', '5 new') ), const PopupMenuItem( value: 'Events', child: const MenuItemWithIcon(Icons.event, 'Events', '12 upcoming') ), - new PopupMenuItem( + const PopupMenuItem( value: 'Events', - child: new MenuItemWithIcon(Icons.group, 'Groups', '14') + child: const MenuItemWithIcon(Icons.group, 'Groups', '14') ), - new PopupMenuItem( + const PopupMenuItem( value: 'Events', - child: new MenuItemWithIcon(Icons.image, 'Pictures', '12') + child: const MenuItemWithIcon(Icons.image, 'Pictures', '12') ), - new PopupMenuItem( + const PopupMenuItem( value: 'Events', - child: new MenuItemWithIcon(Icons.near_me, 'Nearby', '33') + child: const MenuItemWithIcon(Icons.near_me, 'Nearby', '33') ), - new PopupMenuItem( + const PopupMenuItem( value: 'Friends', - child: new MenuItemWithIcon(Icons.people, 'Friends', '5') + child: const MenuItemWithIcon(Icons.people, 'Friends', '5') ), const PopupMenuItem( value: 'Events', child: const MenuItemWithIcon(Icons.event, 'Events', '12') ), - new PopupMenuItem( + const PopupMenuItem( value: 'Events', - child: new MenuItemWithIcon(Icons.group, 'Groups', '14') + child: const MenuItemWithIcon(Icons.group, 'Groups', '14') ), - new PopupMenuItem( + const PopupMenuItem( value: 'Events', - child: new MenuItemWithIcon(Icons.image, 'Pictures', '12') + child: const MenuItemWithIcon(Icons.image, 'Pictures', '12') ), - new PopupMenuItem( + const PopupMenuItem( value: 'Events', - child: new MenuItemWithIcon(Icons.near_me, 'Nearby', '33') + child: const MenuItemWithIcon(Icons.near_me, 'Nearby', '33') ) ] ); @@ -234,7 +234,7 @@ class IconBar extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const IconWithText(Icons.thumb_up, 'Like'), - new IconWithText(Icons.comment, 'Comment'), + const IconWithText(Icons.comment, 'Comment'), const IconWithText(Icons.share, 'Share'), ] ) @@ -530,13 +530,13 @@ class BottomBar extends StatelessWidget { child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - new BottomBarButton(Icons.new_releases, 'News'), - new BottomBarButton(Icons.people, 'Requests'), - new BottomBarButton(Icons.chat, 'Messenger'), - new BottomBarButton(Icons.bookmark, 'Bookmark'), - new BottomBarButton(Icons.alarm, 'Alarm') - ] - ) + const BottomBarButton(Icons.new_releases, 'News'), + const BottomBarButton(Icons.people, 'Requests'), + const BottomBarButton(Icons.chat, 'Messenger'), + const BottomBarButton(Icons.bookmark, 'Bookmark'), + const BottomBarButton(Icons.alarm, 'Alarm'), + ], + ), ); } } diff --git a/examples/flutter_gallery/lib/gallery/home.dart b/examples/flutter_gallery/lib/gallery/home.dart index d3590c6aa5..5dd6d5c458 100644 --- a/examples/flutter_gallery/lib/gallery/home.dart +++ b/examples/flutter_gallery/lib/gallery/home.dart @@ -169,10 +169,10 @@ class GalleryHomeState extends State with SingleTickerProviderState new SliverAppBar( pinned: true, expandedHeight: _kFlexibleSpaceMaxHeight, - flexibleSpace: new FlexibleSpaceBar( + flexibleSpace: const FlexibleSpaceBar( title: const Text('Flutter Gallery'), // TODO(abarth): Wire up to the parallax in a way that doesn't pop during hero transition. - background: new _AppBarBackground(animation: kAlwaysDismissedAnimation), + background: const _AppBarBackground(animation: kAlwaysDismissedAnimation), ), ), new SliverList(delegate: new SliverChildListDelegate(_galleryListItems())), diff --git a/packages/flutter/test/widgets/box_sliver_mismatch_test.dart b/packages/flutter/test/widgets/box_sliver_mismatch_test.dart index 139e30e557..7fdd57b2cf 100644 --- a/packages/flutter/test/widgets/box_sliver_mismatch_test.dart +++ b/packages/flutter/test/widgets/box_sliver_mismatch_test.dart @@ -8,9 +8,9 @@ import 'package:flutter/widgets.dart'; void main() { testWidgets('Sliver in a box', (WidgetTester tester) async { await tester.pumpWidget( - new DecoratedBox( + const DecoratedBox( decoration: const BoxDecoration(), - child: new SliverList( + child: const SliverList( delegate: const SliverChildListDelegate(const []), ), ), @@ -21,7 +21,7 @@ void main() { await tester.pumpWidget( new Row( children: [ - new SliverList( + const SliverList( delegate: const SliverChildListDelegate(const []), ), ],