From 3eb87830e91379c4c0b3d3b88eeae45dee7243e0 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Fri, 7 Apr 2017 12:24:32 -0700 Subject: [PATCH] Constants! Constants everywhere! (#9286) Aggressively apply the const lint. --- .../test_async_utils_guarded_test.dart | 2 +- dev/benchmarks/complex_layout/lib/main.dart | 12 +- dev/devicelab/lib/framework/utils.dart | 2 +- dev/devicelab/test/run_test.dart | 2 +- dev/manual_tests/card_collection.dart | 4 +- dev/manual_tests/drag_and_drop.dart | 14 +- dev/manual_tests/material_arc.dart | 2 +- dev/manual_tests/overlay_geometry.dart | 2 +- dev/manual_tests/page_view.dart | 10 +- dev/manual_tests/raw_keyboard.dart | 2 +- .../flutter_gallery/lib/demo/colors_demo.dart | 2 +- .../lib/demo/contacts_demo.dart | 30 +-- .../cupertino_activity_indicator_demo.dart | 2 +- .../cupertino/cupertino_buttons_demo.dart | 20 +- .../demo/cupertino/cupertino_dialog_demo.dart | 22 +-- .../demo/cupertino/cupertino_slider_demo.dart | 6 +- .../demo/cupertino/cupertino_switch_demo.dart | 2 +- .../demo/material/bottom_navigation_demo.dart | 26 +-- .../lib/demo/material/buttons_demo.dart | 24 +-- .../lib/demo/material/cards_demo.dart | 6 +- .../lib/demo/material/chip_demo.dart | 12 +- .../lib/demo/material/data_table_demo.dart | 20 +- .../material/date_and_time_picker_demo.dart | 2 +- .../lib/demo/material/dialog_demo.dart | 24 +-- .../lib/demo/material/drawer_demo.dart | 16 +- .../demo/material/expansion_panels_demo.dart | 16 +- .../material/full_screen_dialog_demo.dart | 14 +- .../lib/demo/material/grid_list_demo.dart | 8 +- .../lib/demo/material/icons_demo.dart | 2 +- .../lib/demo/material/leave_behind_demo.dart | 14 +- .../lib/demo/material/list_demo.dart | 26 +-- .../lib/demo/material/menu_demo.dart | 38 ++-- .../material/modal_bottom_sheet_demo.dart | 4 +- .../lib/demo/material/overscroll_demo.dart | 8 +- .../lib/demo/material/page_selector_demo.dart | 6 +- .../persistent_bottom_sheet_demo.dart | 10 +- .../material/progress_indicator_demo.dart | 4 +- .../demo/material/scrollable_tabs_demo.dart | 8 +- .../lib/demo/material/slider_demo.dart | 8 +- .../lib/demo/material/snack_bar_demo.dart | 10 +- .../lib/demo/material/tabs_demo.dart | 2 +- .../lib/demo/material/tabs_fab_demo.dart | 2 +- .../demo/material/text_form_field_demo.dart | 12 +- .../lib/demo/material/tooltip_demo.dart | 6 +- .../demo/material/two_level_list_demo.dart | 16 +- .../flutter_gallery/lib/demo/pesto_demo.dart | 8 +- .../lib/demo/shrine/shrine_order.dart | 4 +- .../lib/demo/shrine/shrine_page.dart | 14 +- .../lib/demo/typography_demo.dart | 2 +- .../flutter_gallery/lib/gallery/demo.dart | 6 +- .../flutter_gallery/lib/gallery/drawer.dart | 28 +-- .../lib/gallery/example_code.dart | 16 +- .../flutter_gallery/lib/gallery/home.dart | 4 +- .../flutter_gallery/lib/gallery/updates.dart | 6 +- examples/flutter_view/lib/main.dart | 6 +- examples/hello_world/lib/main.dart | 2 +- examples/layers/rendering/touch_input.dart | 4 +- examples/layers/services/lifecycle.dart | 2 +- .../layers/widgets/custom_render_box.dart | 2 +- examples/layers/widgets/gestures.dart | 10 +- examples/layers/widgets/hello_world.dart | 2 +- examples/layers/widgets/media_query.dart | 6 +- examples/layers/widgets/sectors.dart | 6 +- examples/layers/widgets/spinning_mixed.dart | 2 +- examples/layers/widgets/styled_text.dart | 2 +- examples/platform_channel/lib/main.dart | 6 +- examples/platform_channel_swift/lib/main.dart | 4 +- examples/stocks/lib/stock_home.dart | 54 ++--- examples/stocks/lib/stock_settings.dart | 50 ++--- examples/stocks/lib/stock_symbol_viewer.dart | 4 +- packages/flutter/lib/src/material/about.dart | 10 +- .../flutter/lib/src/material/data_table.dart | 4 +- .../flutter/lib/src/material/date_picker.dart | 4 +- .../flutter/lib/src/material/expand_icon.dart | 2 +- .../lib/src/material/input_decorator.dart | 2 +- .../flutter/lib/src/material/list_tile.dart | 2 +- .../src/material/paginated_data_table.dart | 8 +- .../flutter/lib/src/material/popup_menu.dart | 2 +- .../flutter/lib/src/material/stepper.dart | 6 +- .../lib/src/material/text_selection.dart | 8 +- .../flutter/lib/src/material/time_picker.dart | 4 +- .../lib/src/material/two_level_list.dart | 2 +- .../flutter/lib/src/widgets/container.dart | 9 +- packages/flutter/lib/src/widgets/text.dart | 20 +- .../flutter/test/cupertino/button_test.dart | 18 +- .../flutter/test/cupertino/dialog_test.dart | 12 +- .../test/foundation/error_reporting_test.dart | 4 +- .../flutter/test/material/about_test.dart | 6 +- .../flutter/test/material/app_bar_test.dart | 32 +-- packages/flutter/test/material/app_test.dart | 8 +- .../test/material/back_button_test.dart | 4 +- .../material/bottom_navigation_bar_test.dart | 86 ++++---- .../flutter/test/material/buttons_test.dart | 16 +- packages/flutter/test/material/chip_test.dart | 4 +- .../test/material/circle_avatar_test.dart | 6 +- .../flutter/test/material/colors_test.dart | 2 +- .../test/material/data_table_test.dart | 6 +- .../test/material/date_picker_test.dart | 2 +- .../flutter/test/material/debug_test.dart | 2 +- .../flutter/test/material/dialog_test.dart | 24 +-- .../flutter/test/material/drawer_test.dart | 6 +- .../flutter/test/material/dropdown_test.dart | 2 +- .../material/flexible_space_bar_test.dart | 4 +- .../material/floating_action_button_test.dart | 6 +- .../test/material/grid_title_test.dart | 12 +- .../test/material/icon_button_test.dart | 18 +- packages/flutter/test/material/icon_test.dart | 6 +- .../test/material/image_icon_test.dart | 4 +- .../flutter/test/material/ink_paint_test.dart | 10 +- .../flutter/test/material/list_tile_test.dart | 10 +- .../material/modal_bottom_sheet_test.dart | 12 +- packages/flutter/test/material/page_test.dart | 24 +-- .../material/paginated_data_table_test.dart | 22 +-- .../persistent_bottom_sheet_test.dart | 10 +- .../test/material/popup_menu_test.dart | 4 +- .../test/material/refresh_indicator_test.dart | 32 +-- .../flutter/test/material/scaffold_test.dart | 40 ++-- .../flutter/test/material/scrollbar_test.dart | 16 +- .../flutter/test/material/snack_bar_test.dart | 12 +- .../flutter/test/material/stepper_test.dart | 56 +++--- packages/flutter/test/material/tabs_test.dart | 30 +-- .../test/material/text_field_test.dart | 30 +-- .../flutter/test/material/theme_test.dart | 16 +- .../test/material/time_picker_test.dart | 2 +- .../test/material/two_level_list_test.dart | 18 +- .../user_accounts_drawer_header_test.dart | 30 +-- .../flutter/test/material/will_pop_test.dart | 24 +-- .../test/painting/text_painter_test.dart | 4 +- .../test/widgets/animated_container_test.dart | 6 +- .../flutter/test/widgets/baseline_test.dart | 14 +- .../flutter/test/widgets/center_test.dart | 2 +- .../test/widgets/clamp_overscrolls_test.dart | 4 +- .../flutter/test/widgets/container_test.dart | 4 +- .../test/widgets/dismissible_test.dart | 2 +- .../flutter/test/widgets/draggable_test.dart | 124 ++++++------ .../flutter/test/widgets/drawer_test.dart | 12 +- packages/flutter/test/widgets/flex_test.dart | 10 +- .../flutter/test/widgets/framework_test.dart | 72 +++---- .../widgets/global_keys_duplicated_test.dart | 16 +- .../test/widgets/global_keys_moving_test.dart | 2 +- .../test/widgets/grid_view_layout_test.dart | 20 +- .../flutter/test/widgets/heroes_test.dart | 64 +++--- .../test/widgets/hit_testing_test.dart | 2 +- packages/flutter/test/widgets/icon_test.dart | 2 +- .../flutter/test/widgets/inherited_test.dart | 12 +- .../test/widgets/list_view_builder_test.dart | 6 +- .../widgets/list_view_correction_test.dart | 24 +-- .../test/widgets/list_view_misc_test.dart | 6 +- .../test/widgets/list_view_relayout_test.dart | 48 ++--- .../widgets/list_view_viewporting_test.dart | 6 +- .../flutter/test/widgets/listener_test.dart | 2 +- .../test/widgets/modal_barrier_test.dart | 6 +- .../flutter/test/widgets/navigator_test.dart | 8 +- .../test/widgets/overflow_box_test.dart | 2 +- .../widgets/overscroll_indicator_test.dart | 18 +- .../page_forward_transitions_test.dart | 14 +- .../test/widgets/page_transitions_test.dart | 26 +-- .../test/widgets/placeholder_test.dart | 2 +- .../flutter/test/widgets/reassemble_test.dart | 2 +- .../widgets/reparent_state_harder_test.dart | 2 +- .../flutter/test/widgets/run_app_test.dart | 4 +- ...crollable_custom_scroll_behavior_test.dart | 4 +- .../flutter/test/widgets/scrollable_test.dart | 2 +- .../test/widgets/semantics_1_test.dart | 24 +-- .../test/widgets/semantics_2_test.dart | 18 +- .../test/widgets/semantics_3_test.dart | 10 +- .../test/widgets/semantics_4_test.dart | 18 +- .../test/widgets/semantics_5_test.dart | 6 +- .../test/widgets/semantics_7_test.dart | 4 +- .../test/widgets/semantics_8_test.dart | 8 +- .../test/widgets/semantics_debugger_test.dart | 36 ++-- .../test/widgets/set_state_1_test.dart | 2 +- .../test/widgets/set_state_2_test.dart | 2 +- .../test/widgets/set_state_3_test.dart | 2 +- .../test/widgets/set_state_4_test.dart | 2 +- .../widgets/sliver_fill_remaining_test.dart | 2 +- .../widgets/slivers_appbar_floating_test.dart | 4 +- .../widgets/slivers_appbar_pinned_test.dart | 4 +- .../slivers_appbar_scrolling_test.dart | 4 +- .../test/widgets/slivers_block_test.dart | 62 +++--- .../test/widgets/slivers_padding_test.dart | 28 +-- .../flutter/test/widgets/slivers_test.dart | 10 +- .../state_setting_in_scrollables_test.dart | 12 +- .../flutter/test/widgets/syncing_test.dart | 4 +- packages/flutter/test/widgets/table_test.dart | 66 +++---- packages/flutter/test/widgets/text_test.dart | 12 +- .../test/widgets/ticker_provider_test.dart | 2 +- .../test/widgets/transitions_test.dart | 2 +- packages/flutter/test/widgets/wrap_test.dart | 184 +++++++++--------- packages/flutter_markdown/example/demo.dart | 2 +- .../flutter_markdown/lib/src/builder.dart | 2 +- .../flutter_markdown/lib/src/style_sheet.dart | 4 +- packages/flutter_test/lib/src/binding.dart | 8 +- .../flutter_test/test/widget_tester_test.dart | 22 +-- .../lib/src/android/android_device.dart | 2 +- packages/flutter_tools/lib/src/base/io.dart | 2 +- .../lib/src/fuchsia/fuchsia_device.dart | 2 +- 197 files changed, 1312 insertions(+), 1315 deletions(-) diff --git a/dev/automated_tests/flutter_test/test_async_utils_guarded_test.dart b/dev/automated_tests/flutter_test/test_async_utils_guarded_test.dart index dad80530a78..f04a1399545 100644 --- a/dev/automated_tests/flutter_test/test_async_utils_guarded_test.dart +++ b/dev/automated_tests/flutter_test/test_async_utils_guarded_test.dart @@ -14,7 +14,7 @@ class TestTestBinding extends AutomatedTestWidgetsFlutterBinding { Future guardedHelper(WidgetTester tester) { return TestAsyncUtils.guard(() async { - await tester.pumpWidget(new Text('Hello')); + await tester.pumpWidget(const Text('Hello')); }); } diff --git a/dev/benchmarks/complex_layout/lib/main.dart b/dev/benchmarks/complex_layout/lib/main.dart index 9ce2923c4d7..10dd53fab7c 100644 --- a/dev/benchmarks/complex_layout/lib/main.dart +++ b/dev/benchmarks/complex_layout/lib/main.dart @@ -57,7 +57,7 @@ class ComplexLayoutState extends State { Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( - title: new Text('Advanced Layout'), + title: const Text('Advanced Layout'), actions: [ new IconButton( icon: new Icon(Icons.create), @@ -356,9 +356,9 @@ class UserHeader extends StatelessWidget { class ItemDescription extends StatelessWidget { @override Widget build(BuildContext context) { - return new Padding( + return const Padding( padding: const EdgeInsets.all(8.0), - child: new Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.') + child: const Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.') ); } } @@ -579,7 +579,7 @@ class GalleryDrawer extends StatelessWidget { new FancyDrawerHeader(), new ListTile( leading: new Icon(Icons.brightness_5), - title: new Text('Light'), + title: const Text('Light'), onTap: () { _changeTheme(context, true); }, selected: ComplexLayoutApp.of(context).lightTheme, trailing: new Radio( @@ -590,7 +590,7 @@ class GalleryDrawer extends StatelessWidget { ), new ListTile( leading: new Icon(Icons.brightness_7), - title: new Text('Dark'), + title: const Text('Dark'), onTap: () { _changeTheme(context, false); }, selected: !ComplexLayoutApp.of(context).lightTheme, trailing: new Radio( @@ -602,7 +602,7 @@ class GalleryDrawer extends StatelessWidget { new Divider(), new ListTile( leading: new Icon(Icons.hourglass_empty), - title: new Text('Animate Slowly'), + title: const Text('Animate Slowly'), selected: timeDilation != 1.0, onTap: () { ComplexLayoutApp.of(context).toggleAnimationSpeed(); }, trailing: new Checkbox( diff --git a/dev/devicelab/lib/framework/utils.dart b/dev/devicelab/lib/framework/utils.dart index 509ea9ce41c..06de108b5f9 100644 --- a/dev/devicelab/lib/framework/utils.dart +++ b/dev/devicelab/lib/framework/utils.dart @@ -15,7 +15,7 @@ import 'package:stack_trace/stack_trace.dart'; String cwd = Directory.current.path; List _runningProcesses = []; -ProcessManager _processManager = new LocalProcessManager(); +ProcessManager _processManager = const LocalProcessManager(); class ProcessInfo { ProcessInfo(this.command, this.process); diff --git a/dev/devicelab/test/run_test.dart b/dev/devicelab/test/run_test.dart index a2b03149b49..db11eb7a351 100644 --- a/dev/devicelab/test/run_test.dart +++ b/dev/devicelab/test/run_test.dart @@ -10,7 +10,7 @@ import 'package:process/process.dart'; import 'package:test/test.dart'; void main() { - final ProcessManager processManager = new LocalProcessManager(); + final ProcessManager processManager = const LocalProcessManager(); group('run.dart script', () { Future runScript(List testNames) async { diff --git a/dev/manual_tests/card_collection.dart b/dev/manual_tests/card_collection.dart index d0c303d9cce..49310fa496f 100644 --- a/dev/manual_tests/card_collection.dart +++ b/dev/manual_tests/card_collection.dart @@ -88,7 +88,7 @@ class CardCollectionState extends State { data: const IconThemeData(color: Colors.black), child: new ListView( children: [ - new DrawerHeader(child: new Center(child: new Text('Options'))), + const DrawerHeader(child: const Center(child: const Text('Options'))), buildDrawerCheckbox("Make card labels editable", _editable, _toggleEditable), buildDrawerCheckbox("Fixed size cards", _fixedSizeCards, _toggleFixedSizeCards), buildDrawerCheckbox("Let the sun shine", _sunshine, _toggleSunshine), @@ -110,7 +110,7 @@ class CardCollectionState extends State { new ListTile( leading: new Icon(Icons.dvr), onTap: () { debugDumpApp(); debugDumpRenderTree(); }, - title: new Text('Dump App to Console'), + title: const Text('Dump App to Console'), ), ], ), diff --git a/dev/manual_tests/drag_and_drop.dart b/dev/manual_tests/drag_and_drop.dart index 94203c406af..6a28a9dd39a 100644 --- a/dev/manual_tests/drag_and_drop.dart +++ b/dev/manual_tests/drag_and_drop.dart @@ -42,7 +42,7 @@ class ExampleDragTargetState extends State { } class Dot extends StatefulWidget { - Dot({ Key key, this.color, this.size, this.child, this.tappable: false }) : super(key: key); + const Dot({ Key key, this.color, this.size, this.child, this.tappable: false }) : super(key: key); final Color color; final double size; @@ -193,13 +193,13 @@ class MovableBall extends StatelessWidget { color: Colors.blue.shade700, size: kBallSize, tappable: true, - child: new Center(child: new Text('BALL')) + child: const Center(child: const Text('BALL')) ) ); final Widget dashedBall = new Container( width: kBallSize, height: kBallSize, - child: new CustomPaint( + child: const CustomPaint( painter: const DashOutlineCirclePainter() ) ); @@ -238,7 +238,7 @@ class DragAndDropAppState extends State { Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( - title: new Text('Drag and Drop Flutter Demo') + title: const Text('Drag and Drop Flutter Demo') ), body: new Column( children: [ @@ -251,19 +251,19 @@ class DragAndDropAppState extends State { color: Colors.yellow.shade300, under: true, heavy: false, - child: new Text('under') + child: const Text('under') ), new ExampleDragSource( color: Colors.green.shade300, under: false, heavy: true, - child: new Text('long-press above') + child: const Text('long-press above') ), new ExampleDragSource( color: Colors.indigo.shade300, under: false, heavy: false, - child: new Text('above') + child: const Text('above') ), ], ) diff --git a/dev/manual_tests/material_arc.dart b/dev/manual_tests/material_arc.dart index ed4e596186f..bdc23c38b55 100644 --- a/dev/manual_tests/material_arc.dart +++ b/dev/manual_tests/material_arc.dart @@ -444,7 +444,7 @@ class _AnimationDemoState extends State with TickerProviderStateM length: _allDemos.length, child: new Scaffold( appBar: new AppBar( - title: new Text('Animation'), + title: const Text('Animation'), bottom: new TabBar( tabs: _allDemos.map((_ArcDemo demo) => new Tab(text: demo.title)).toList(), ), diff --git a/dev/manual_tests/overlay_geometry.dart b/dev/manual_tests/overlay_geometry.dart index e5dd37b4f36..2b9b194870f 100644 --- a/dev/manual_tests/overlay_geometry.dart +++ b/dev/manual_tests/overlay_geometry.dart @@ -181,7 +181,7 @@ class OverlayGeometryAppState extends State { Widget build(BuildContext context) { final List layers = [ new Scaffold( - appBar: new AppBar(title: new Text('Tap a Card')), + appBar: new AppBar(title: const Text('Tap a Card')), body: new Container( padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0), child: new NotificationListener( diff --git a/dev/manual_tests/page_view.dart b/dev/manual_tests/page_view.dart index f7cc6b8f485..0c9152cced7 100644 --- a/dev/manual_tests/page_view.dart +++ b/dev/manual_tests/page_view.dart @@ -84,22 +84,22 @@ class PageViewAppState extends State { return new Drawer( child: new ListView( children: [ - new DrawerHeader(child: new Center(child: new Text('Options'))), + const DrawerHeader(child: const Center(child: const Text('Options'))), new ListTile( leading: new Icon(Icons.more_horiz), selected: scrollDirection == Axis.horizontal, - trailing: new Text('Horizontal Layout'), + trailing: const Text('Horizontal Layout'), onTap: switchScrollDirection, ), new ListTile( leading: new Icon(Icons.more_vert), selected: scrollDirection == Axis.vertical, - trailing: new Text('Vertical Layout'), + trailing: const Text('Vertical Layout'), onTap: switchScrollDirection, ), new ListTile( onTap: toggleItemsWrap, - title: new Text('Scrolling wraps around'), + title: const Text('Scrolling wraps around'), // TODO(abarth): Actually make this checkbox change this value. trailing: new Checkbox(value: itemsWrap, onChanged: null), ), @@ -110,7 +110,7 @@ class PageViewAppState extends State { Widget _buildAppBar() { return new AppBar( - title: new Text('PageView'), + title: const Text('PageView'), actions: [ new Text(scrollDirection == Axis.horizontal ? "horizontal" : "vertical"), ], diff --git a/dev/manual_tests/raw_keyboard.dart b/dev/manual_tests/raw_keyboard.dart index 392c856bed3..62420c2ab59 100644 --- a/dev/manual_tests/raw_keyboard.dart +++ b/dev/manual_tests/raw_keyboard.dart @@ -10,7 +10,7 @@ void main() { title: 'Hardware Key Demo', home: new Scaffold( appBar: new AppBar( - title: new Text('Hardware Key Demo'), + title: const Text('Hardware Key Demo'), ), body: new Center( child: new RawKeyboardDemo(), diff --git a/examples/flutter_gallery/lib/demo/colors_demo.dart b/examples/flutter_gallery/lib/demo/colors_demo.dart index 0aa49eea616..0709296b594 100644 --- a/examples/flutter_gallery/lib/demo/colors_demo.dart +++ b/examples/flutter_gallery/lib/demo/colors_demo.dart @@ -125,7 +125,7 @@ class ColorsDemo extends StatelessWidget { child: new Scaffold( appBar: new AppBar( elevation: 0, - title: new Text('Colors'), + title: const Text('Colors'), bottom: new TabBar( isScrollable: true, tabs: allPalettes.map((Palette swatch) => new Tab(text: swatch.name)).toList(), diff --git a/examples/flutter_gallery/lib/demo/contacts_demo.dart b/examples/flutter_gallery/lib/demo/contacts_demo.dart index b6d9c9e1530..0e9a9b1b6e8 100644 --- a/examples/flutter_gallery/lib/demo/contacts_demo.dart +++ b/examples/flutter_gallery/lib/demo/contacts_demo.dart @@ -113,11 +113,11 @@ class ContactsDemoState extends State { floating: _appBarBehavior == AppBarBehavior.floating, actions: [ new IconButton( - icon: new Icon(Icons.create), + icon: const Icon(Icons.create), tooltip: 'Edit', onPressed: () { _scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text('This is actually just a demo. Editing isn\'t supported.') + content: const Text('This is actually just a demo. Editing isn\'t supported.') )); }, ), @@ -130,21 +130,21 @@ class ContactsDemoState extends State { itemBuilder: (BuildContext context) => >[ new PopupMenuItem( value: AppBarBehavior.normal, - child: new Text('App bar scrolls away') + child: const Text('App bar scrolls away') ), new PopupMenuItem( value: AppBarBehavior.pinned, - child: new Text('App bar stays put') + child: const Text('App bar stays put') ), new PopupMenuItem( value: AppBarBehavior.floating, - child: new Text('App bar floats') + child: const Text('App bar floats') ), ], ), ], flexibleSpace: new FlexibleSpaceBar( - title: new Text('Ali Connors'), + title: const Text('Ali Connors'), background: new Stack( children: [ new Image.asset( @@ -154,7 +154,7 @@ class ContactsDemoState extends State { ), // This gradient ensures that the toolbar icons are distinct // against the background image. - new DecoratedBox( + const DecoratedBox( decoration: const BoxDecoration( gradient: const LinearGradient( begin: const FractionalOffset(0.5, 0.0), @@ -177,7 +177,7 @@ class ContactsDemoState extends State { tooltip: 'Send message', onPressed: () { _scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text('Pretend that this opened your SMS application.') + content: const Text('Pretend that this opened your SMS application.') )); }, lines: [ @@ -190,7 +190,7 @@ class ContactsDemoState extends State { tooltip: 'Send message', onPressed: () { _scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text('In this demo, this button doesn\'t do anything.') + content: const Text('In this demo, this button doesn\'t do anything.') )); }, lines: [ @@ -203,7 +203,7 @@ class ContactsDemoState extends State { tooltip: 'Send message', onPressed: () { _scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text('Imagine if you will, a messaging application.') + content: const Text('Imagine if you will, a messaging application.') )); }, lines: [ @@ -221,7 +221,7 @@ class ContactsDemoState extends State { tooltip: 'Send personal e-mail', onPressed: () { _scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text('Here, your e-mail application would open.') + content: const Text('Here, your e-mail application would open.') )); }, lines: [ @@ -234,7 +234,7 @@ class ContactsDemoState extends State { tooltip: 'Send work e-mail', onPressed: () { _scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text('This is a demo, so this button does not actually work.') + content: const Text('This is a demo, so this button does not actually work.') )); }, lines: [ @@ -252,7 +252,7 @@ class ContactsDemoState extends State { tooltip: 'Open map', onPressed: () { _scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text('This would show a map of San Francisco.') + content: const Text('This would show a map of San Francisco.') )); }, lines: [ @@ -266,7 +266,7 @@ class ContactsDemoState extends State { tooltip: 'Open map', onPressed: () { _scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text('This would show a map of Mountain View.') + content: const Text('This would show a map of Mountain View.') )); }, lines: [ @@ -280,7 +280,7 @@ class ContactsDemoState extends State { tooltip: 'Open map', onPressed: () { _scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text('This would also show a map, if this was not a demo.') + content: const Text('This would also show a map, if this was not a demo.') )); }, lines: [ diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart index 28d0b930ad5..bcd717ff7e3 100644 --- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart +++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart @@ -12,7 +12,7 @@ class CupertinoProgressIndicatorDemo extends StatelessWidget { Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( - title: new Text('Cupertino Activity Indicator'), + title: const Text('Cupertino Activity Indicator'), ), body: new Center( child: new CupertinoActivityIndicator(), diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart index aeee81583fc..b45a203cda9 100644 --- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart +++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart @@ -21,13 +21,13 @@ class _CupertinoButtonDemoState extends State { Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( - title: new Text('Cupertino Buttons'), + title: const Text('Cupertino Buttons'), ), body: new Column( children: [ - new Padding( + const Padding( padding: const EdgeInsets.all(16.0), - child: new Text('iOS themed buttons are flat. They can have borders or backgrounds but ' + child: const Text('iOS themed buttons are flat. They can have borders or backgrounds but ' 'only when necessary.'), ), new Expanded( @@ -35,36 +35,36 @@ class _CupertinoButtonDemoState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ new Text(_pressedCount > 0 ? "Button pressed $_pressedCount times" : " "), - new Padding(padding: const EdgeInsets.all(12.0)), + const Padding(padding: const EdgeInsets.all(12.0)), new Align( alignment: const FractionalOffset(0.5, 0.4), child: new Row( mainAxisSize: MainAxisSize.min, children: [ new CupertinoButton( - child: new Text('Cupertino Button'), + child: const Text('Cupertino Button'), onPressed: () { setState(() {_pressedCount++;}); } ), new CupertinoButton( - child: new Text('Disabled'), + child: const Text('Disabled'), onPressed: null, ), ], ), ), - new Padding(padding: const EdgeInsets.all(12.0)), + const Padding(padding: const EdgeInsets.all(12.0)), new CupertinoButton( - child: new Text('With Background'), + child: const Text('With Background'), color: _kBlue, onPressed: () { setState(() {_pressedCount++;}); } ), - new Padding(padding: const EdgeInsets.all(12.0)), + const Padding(padding: const EdgeInsets.all(12.0)), new CupertinoButton( - child: new Text('Disabled'), + child: const Text('Disabled'), color: _kBlue, onPressed: null, ), diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart index e8085576a57..50130326f40 100644 --- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart +++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart @@ -37,27 +37,27 @@ class _CupertinoDialogDemoState extends State { return new Scaffold( key: _scaffoldKey, appBar: new AppBar( - title: new Text('Cupertino Dialogs'), + title: const Text('Cupertino Dialogs'), ), body: new ListView( padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0), children: [ new CupertinoButton( - child: new Text('Alert'), + child: const Text('Alert'), color: _kBlue, onPressed: () { showDemoDialog( context: context, child: new CupertinoAlertDialog( - content: new Text('Discard draft?'), + content: const Text('Discard draft?'), actions: [ new CupertinoDialogAction( - child: new Text('Discard'), + child: const Text('Discard'), isDestructive: true, onPressed: () { Navigator.pop(context, 'OK'); } ), new CupertinoDialogAction( - child: new Text('Cancel', style: const TextStyle(fontWeight: FontWeight.w600)), + child: const Text('Cancel', style: const TextStyle(fontWeight: FontWeight.w600)), onPressed: () { Navigator.pop(context, 'Cancel'); } ), ] @@ -65,27 +65,27 @@ class _CupertinoDialogDemoState extends State { ); }, ), - new Padding(padding: const EdgeInsets.all(8.0)), + const Padding(padding: const EdgeInsets.all(8.0)), new CupertinoButton( - child: new Text('Alert with Title'), + child: const Text('Alert with Title'), color: _kBlue, padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), onPressed: () { showDemoDialog( context: context, child: new CupertinoAlertDialog( - title: new Text('Allow "Maps" to access your location while you use the app?'), - content: new Text( + title: const Text('Allow "Maps" to access your location while you use the app?'), + content: const Text( 'Your current location will be displayed on the map and used for directions, ' 'nearby search results, and estimated travel times.' ), actions: [ new CupertinoDialogAction( - child: new Text('Don\'t Allow'), + child: const Text('Don\'t Allow'), onPressed: () { Navigator.pop(context, 'Disallow'); } ), new CupertinoDialogAction( - child: new Text('Allow'), + child: const Text('Allow'), onPressed: () { Navigator.pop(context, 'Allow'); } ), ] diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_slider_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_slider_demo.dart index 13971cdcef5..79cb7d0343a 100644 --- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_slider_demo.dart +++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_slider_demo.dart @@ -20,7 +20,7 @@ class _CupertinoSliderDemoState extends State { Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( - title: new Text('Cupertino Sliders'), + title: const Text('Cupertino Sliders'), ), body: new Center( child: new Column( @@ -39,7 +39,7 @@ class _CupertinoSliderDemoState extends State { }); } ), - new Text('Cupertino Continuous'), + const Text('Cupertino Continuous'), ] ), new Column( @@ -56,7 +56,7 @@ class _CupertinoSliderDemoState extends State { }); } ), - new Text('Cupertino Discrete'), + const Text('Cupertino Discrete'), ] ), ], diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart index dd2df03e00c..c6661563a2c 100644 --- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart +++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart @@ -20,7 +20,7 @@ class _CupertinoSwitchDemoState extends State { Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( - title: new Text('Cupertino Switch'), + title: const Text('Cupertino Switch'), ), body: new Center( child: new CupertinoSwitch( diff --git a/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart b/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart index 4cbe54f0ace..7acc30ef0d9 100644 --- a/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart @@ -23,7 +23,7 @@ class NavigationIconView { ) { _animation = new CurvedAnimation( parent: controller, - curve: new Interval(0.5, 1.0, curve: Curves.fastOutSlowIn), + curve: const Interval(0.5, 1.0, curve: Curves.fastOutSlowIn), ); } @@ -96,32 +96,32 @@ class _BottomNavigationDemoState extends State super.initState(); _navigationViews = [ new NavigationIconView( - icon: new Icon(Icons.access_alarm), - title: new Text('Alarm'), + icon: const Icon(Icons.access_alarm), + title: const Text('Alarm'), color: Colors.deepPurple, vsync: this, ), new NavigationIconView( icon: new CustomIcon(), - title: new Text('Box'), + title: const Text('Box'), color: Colors.deepOrange, vsync: this, ), new NavigationIconView( - icon: new Icon(Icons.cloud), - title: new Text('Cloud'), + icon: const Icon(Icons.cloud), + title: const Text('Cloud'), color: Colors.teal, vsync: this, ), new NavigationIconView( - icon: new Icon(Icons.favorite), - title: new Text('Favorites'), + icon: const Icon(Icons.favorite), + title: const Text('Favorites'), color: Colors.indigo, vsync: this, ), new NavigationIconView( - icon: new Icon(Icons.event_available), - title: new Text('Event'), + icon: const Icon(Icons.event_available), + title: const Text('Event'), color: Colors.pink, vsync: this, ) @@ -183,7 +183,7 @@ class _BottomNavigationDemoState extends State return new Scaffold( appBar: new AppBar( - title: new Text('Bottom navigation'), + title: const Text('Bottom navigation'), actions: [ new PopupMenuButton( onSelected: (BottomNavigationBarType value) { @@ -194,11 +194,11 @@ class _BottomNavigationDemoState extends State itemBuilder: (BuildContext context) => >[ new PopupMenuItem( value: BottomNavigationBarType.fixed, - child: new Text('Fixed'), + child: const Text('Fixed'), ), new PopupMenuItem( value: BottomNavigationBarType.shifting, - child: new Text('Shifting'), + child: const Text('Shifting'), ) ], ) diff --git a/examples/flutter_gallery/lib/demo/material/buttons_demo.dart b/examples/flutter_gallery/lib/demo/material/buttons_demo.dart index f191300e5fa..c3aafd6d8f0 100644 --- a/examples/flutter_gallery/lib/demo/material/buttons_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/buttons_demo.dart @@ -95,13 +95,13 @@ class _ButtonsDemoState extends State { mainAxisSize: MainAxisSize.min, children: [ new RaisedButton( - child: new Text('RAISED BUTTON'), + child: const Text('RAISED BUTTON'), onPressed: () { // Perform some action }, ), new RaisedButton( - child: new Text('DISABLED'), + child: const Text('DISABLED'), onPressed: null, ) ], @@ -116,13 +116,13 @@ class _ButtonsDemoState extends State { mainAxisSize: MainAxisSize.min, children: [ new FlatButton( - child: new Text('FLAT BUTTON'), + child: const Text('FLAT BUTTON'), onPressed: () { // Perform some action }, ), new FlatButton( - child: new Text('DISABLED'), + child: const Text('DISABLED'), onPressed: null, ) ], @@ -142,7 +142,7 @@ class _ButtonsDemoState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ new ListTile( - title: new Text('Simple dropdown:'), + title: const Text('Simple dropdown:'), trailing: new DropdownButton( value: dropdown1Value, onChanged: (String newValue) { @@ -162,10 +162,10 @@ class _ButtonsDemoState extends State { height: 24.0, ), new ListTile( - title: new Text('Dropdown with a hint:'), + title: const Text('Dropdown with a hint:'), trailing: new DropdownButton( value: dropdown2Value, - hint: new Text('Choose'), + hint: const Text('Choose'), onChanged: (String newValue) { setState(() { dropdown2Value = newValue; @@ -183,7 +183,7 @@ class _ButtonsDemoState extends State { height: 24.0, ), new ListTile( - title: new Text('Scrollable dropdown:'), + title: const Text('Scrollable dropdown:'), trailing: new DropdownButton( value: dropdown3Value, onChanged: (String newValue) { @@ -218,14 +218,14 @@ class _ButtonsDemoState extends State { mainAxisSize: MainAxisSize.min, children: [ new IconButton( - icon: new Icon(Icons.thumb_up), + icon: const Icon(Icons.thumb_up), onPressed: () { setState(() => iconButtonToggle = !iconButtonToggle); }, color: iconButtonToggle ? Theme.of(context).primaryColor : null, ), - new IconButton( - icon: new Icon(Icons.thumb_up), + const IconButton( + icon: const Icon(Icons.thumb_up), onPressed: null, ) ] @@ -239,7 +239,7 @@ class _ButtonsDemoState extends State { return new Align( alignment: const FractionalOffset(0.5, 0.4), child: new FloatingActionButton( - child: new Icon(Icons.add), + child: const Icon(Icons.add), onPressed: () { // Perform some action }, diff --git a/examples/flutter_gallery/lib/demo/material/cards_demo.dart b/examples/flutter_gallery/lib/demo/material/cards_demo.dart index fdc637f8b79..a34d33788ef 100644 --- a/examples/flutter_gallery/lib/demo/material/cards_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/cards_demo.dart @@ -116,12 +116,12 @@ class TravelDestinationItem extends StatelessWidget { alignment: MainAxisAlignment.start, children: [ new FlatButton( - child: new Text('SHARE'), + child: const Text('SHARE'), textColor: Colors.amber.shade500, onPressed: () { /* do nothing */ }, ), new FlatButton( - child: new Text('EXPLORE'), + child: const Text('EXPLORE'), textColor: Colors.amber.shade500, onPressed: () { /* do nothing */ }, ), @@ -142,7 +142,7 @@ class CardsDemo extends StatelessWidget { Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( - title: new Text('Travel stream') + title: const Text('Travel stream') ), body: new ListView( itemExtent: TravelDestinationItem.height, diff --git a/examples/flutter_gallery/lib/demo/material/chip_demo.dart b/examples/flutter_gallery/lib/demo/material/chip_demo.dart index 838d30b6cfb..86be8a34495 100644 --- a/examples/flutter_gallery/lib/demo/material/chip_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/chip_demo.dart @@ -23,24 +23,24 @@ class _ChipDemoState extends State { @override Widget build(BuildContext context) { final List chips = [ - new Chip( - label: new Text('Apple') + const Chip( + label: const Text('Apple') ), new Chip( - avatar: new CircleAvatar(child: new Text('B')), - label: new Text('Blueberry') + avatar: new CircleAvatar(child: const Text('B')), + label: const Text('Blueberry') ), ]; if (_showBananas) { chips.add(new Chip( - label: new Text('Bananas'), + label: const Text('Bananas'), onDeleted: _deleteBananas )); } return new Scaffold( - appBar: new AppBar(title: new Text('Chips')), + appBar: new AppBar(title: const Text('Chips')), body: new ListView( children: chips.map((Widget widget) { return new Container( diff --git a/examples/flutter_gallery/lib/demo/material/data_table_demo.dart b/examples/flutter_gallery/lib/demo/material/data_table_demo.dart index c2eacdf3a99..7bfd0f75275 100644 --- a/examples/flutter_gallery/lib/demo/material/data_table_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/data_table_demo.dart @@ -164,12 +164,12 @@ class _DataTableDemoState extends State { @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: new Text('Data tables')), + appBar: new AppBar(title: const Text('Data tables')), body: new ListView( padding: const EdgeInsets.all(20.0), children: [ new PaginatedDataTable( - header: new Text('Nutrition'), + header: const Text('Nutrition'), rowsPerPage: _rowsPerPage, onRowsPerPageChanged: (int value) { setState(() { _rowsPerPage = value; }); }, sortColumnIndex: _sortColumnIndex, @@ -177,43 +177,43 @@ class _DataTableDemoState extends State { onSelectAll: _dessertsDataSource._selectAll, columns: [ new DataColumn( - label: new Text('Dessert (100g serving)'), + label: const Text('Dessert (100g serving)'), onSort: (int columnIndex, bool ascending) => _sort((Dessert d) => d.name, columnIndex, ascending) ), new DataColumn( - label: new Text('Calories'), + label: const Text('Calories'), tooltip: 'The total amount of food energy in the given serving size.', numeric: true, onSort: (int columnIndex, bool ascending) => _sort((Dessert d) => d.calories, columnIndex, ascending) ), new DataColumn( - label: new Text('Fat (g)'), + label: const Text('Fat (g)'), numeric: true, onSort: (int columnIndex, bool ascending) => _sort((Dessert d) => d.fat, columnIndex, ascending) ), new DataColumn( - label: new Text('Carbs (g)'), + label: const Text('Carbs (g)'), numeric: true, onSort: (int columnIndex, bool ascending) => _sort((Dessert d) => d.carbs, columnIndex, ascending) ), new DataColumn( - label: new Text('Protein (g)'), + label: const Text('Protein (g)'), numeric: true, onSort: (int columnIndex, bool ascending) => _sort((Dessert d) => d.protein, columnIndex, ascending) ), new DataColumn( - label: new Text('Sodium (mg)'), + label: const Text('Sodium (mg)'), numeric: true, onSort: (int columnIndex, bool ascending) => _sort((Dessert d) => d.sodium, columnIndex, ascending) ), new DataColumn( - label: new Text('Calcium (%)'), + label: const Text('Calcium (%)'), tooltip: 'The amount of calcium as a percentage of the recommended daily amount.', numeric: true, onSort: (int columnIndex, bool ascending) => _sort((Dessert d) => d.calcium, columnIndex, ascending) ), new DataColumn( - label: new Text('Iron (%)'), + label: const Text('Iron (%)'), numeric: true, onSort: (int columnIndex, bool ascending) => _sort((Dessert d) => d.iron, columnIndex, ascending) ), diff --git a/examples/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart b/examples/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart index 02590f892f0..de847c85b35 100644 --- a/examples/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart @@ -129,7 +129,7 @@ class _DateAndTimePickerDemoState extends State { @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: new Text('Date and time pickers')), + appBar: new AppBar(title: const Text('Date and time pickers')), body: new DropdownButtonHideUnderline( child: new ListView( padding: const EdgeInsets.all(16.0), diff --git a/examples/flutter_gallery/lib/demo/material/dialog_demo.dart b/examples/flutter_gallery/lib/demo/material/dialog_demo.dart index 7210568f5bb..a2b17e560b7 100644 --- a/examples/flutter_gallery/lib/demo/material/dialog_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/dialog_demo.dart @@ -87,13 +87,13 @@ class DialogDemoState extends State { return new Scaffold( key: _scaffoldKey, appBar: new AppBar( - title: new Text('Dialogs') + title: const Text('Dialogs') ), body: new ListView( padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0), children: [ new RaisedButton( - child: new Text('ALERT'), + child: const Text('ALERT'), onPressed: () { showDemoDialog( context: context, @@ -104,11 +104,11 @@ class DialogDemoState extends State { ), actions: [ new FlatButton( - child: new Text('CANCEL'), + child: const Text('CANCEL'), onPressed: () { Navigator.pop(context, DialogDemoAction.cancel); } ), new FlatButton( - child: new Text('DISCARD'), + child: const Text('DISCARD'), onPressed: () { Navigator.pop(context, DialogDemoAction.discard); } ) ] @@ -117,23 +117,23 @@ class DialogDemoState extends State { } ), new RaisedButton( - child: new Text('ALERT WITH TITLE'), + child: const Text('ALERT WITH TITLE'), onPressed: () { showDemoDialog( context: context, child: new AlertDialog( - title: new Text('Use Google\'s location service?'), + title: const Text('Use Google\'s location service?'), content: new Text( _alertWithTitleText, style: dialogTextStyle ), actions: [ new FlatButton( - child: new Text('DISAGREE'), + child: const Text('DISAGREE'), onPressed: () { Navigator.pop(context, DialogDemoAction.disagree); } ), new FlatButton( - child: new Text('AGREE'), + child: const Text('AGREE'), onPressed: () { Navigator.pop(context, DialogDemoAction.agree); } ) ] @@ -142,12 +142,12 @@ class DialogDemoState extends State { } ), new RaisedButton( - child: new Text('SIMPLE'), + child: const Text('SIMPLE'), onPressed: () { showDemoDialog( context: context, child: new SimpleDialog( - title: new Text('Set backup account'), + title: const Text('Set backup account'), children: [ new DialogDemoItem( icon: Icons.account_circle, @@ -172,7 +172,7 @@ class DialogDemoState extends State { } ), new RaisedButton( - child: new Text('CONFIRMATION'), + child: const Text('CONFIRMATION'), onPressed: () { showTimePicker( context: context, @@ -189,7 +189,7 @@ class DialogDemoState extends State { } ), new RaisedButton( - child: new Text('FULLSCREEN'), + child: const Text('FULLSCREEN'), onPressed: () { Navigator.push(context, new MaterialPageRoute( builder: (BuildContext context) => new FullScreenDialogDemo(), diff --git a/examples/flutter_gallery/lib/demo/material/drawer_demo.dart b/examples/flutter_gallery/lib/demo/material/drawer_demo.dart index 0ed5761d45f..b92235593df 100644 --- a/examples/flutter_gallery/lib/demo/material/drawer_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/drawer_demo.dart @@ -68,7 +68,7 @@ class _DrawerDemoState extends State with TickerProviderStateMixin { void _showNotImplementedMessage() { Navigator.of(context).pop(); // Dismiss the drawer. _scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text("The drawer's items don't do anything") + content: const Text("The drawer's items don't do anything") )); } @@ -85,14 +85,14 @@ class _DrawerDemoState extends State with TickerProviderStateMixin { Navigator.pop(context); }, ), - title: new Text('Navigation drawer'), + title: const Text('Navigation drawer'), ), drawer: new Drawer( child: new ListView( children: [ new UserAccountsDrawerHeader( - accountName: new Text('Zach Widget'), - accountEmail: new Text('zach.widget@example.com'), + accountName: const Text('Zach Widget'), + accountEmail: const Text('zach.widget@example.com'), currentAccountPicture: new CircleAvatar(backgroundImage: new AssetImage(_kAsset0)), otherAccountsPictures: [ new CircleAvatar(backgroundImage: new AssetImage(_kAsset1)), @@ -134,13 +134,13 @@ class _DrawerDemoState extends State with TickerProviderStateMixin { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ new ListTile( - leading: new Icon(Icons.add), - title: new Text('Add account'), + leading: const Icon(Icons.add), + title: const Text('Add account'), onTap: _showNotImplementedMessage, ), new ListTile( - leading: new Icon(Icons.settings), - title: new Text('Manage accounts'), + leading: const Icon(Icons.settings), + title: const Text('Manage accounts'), onTap: _showNotImplementedMessage, ), ], diff --git a/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart b/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart index c2b21f7f2b2..197c3194aca 100644 --- a/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart @@ -30,8 +30,8 @@ class DualHeaderWithHint extends StatelessWidget { return new AnimatedCrossFade( firstChild: first, secondChild: second, - firstCurve: new Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), - secondCurve: new Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), + firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), + secondCurve: const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), sizeCurve: Curves.fastOutSlowIn, crossFadeState: isExpanded ? CrossFadeState.showSecond : CrossFadeState.showFirst, duration: const Duration(milliseconds: 200), @@ -118,7 +118,7 @@ class CollapsibleBody extends StatelessWidget { margin: const EdgeInsets.only(right: 8.0), child: new FlatButton( onPressed: onCancel, - child: new Text('CANCEL', style: new TextStyle( + child: const Text('CANCEL', style: const TextStyle( color: Colors.black54, fontSize: 15.0, fontWeight: FontWeight.w500 @@ -130,7 +130,7 @@ class CollapsibleBody extends StatelessWidget { child: new FlatButton( onPressed: onSave, textTheme: ButtonTextTheme.accent, - child: new Text('SAVE') + child: const Text('SAVE') ) ) ] @@ -254,7 +254,7 @@ class _ExpansionPanelsDemoState extends State { groupValue: field.value, onChanged: field.onChanged, ), - new Text('Bahamas') + const Text('Bahamas') ] ), new Row( @@ -265,7 +265,7 @@ class _ExpansionPanelsDemoState extends State { groupValue: field.value, onChanged: field.onChanged, ), - new Text('Barbados') + const Text('Barbados') ] ), new Row( @@ -276,7 +276,7 @@ class _ExpansionPanelsDemoState extends State { groupValue: field.value, onChanged: field.onChanged, ), - new Text('Bermuda') + const Text('Bermuda') ] ) ] @@ -334,7 +334,7 @@ class _ExpansionPanelsDemoState extends State { @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: new Text('Expansion panels')), + appBar: new AppBar(title: const Text('Expansion panels')), body: new SingleChildScrollView( child: new Container( margin: const EdgeInsets.all(24.0), diff --git a/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart b/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart index a1d0f8828e7..d4061eb2ab4 100644 --- a/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart @@ -57,7 +57,7 @@ class DateTimeItem extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text(new DateFormat('EEE, MMM d yyyy').format(date)), - new Icon(Icons.arrow_drop_down, color: Colors.black54), + const Icon(Icons.arrow_drop_down, color: Colors.black54), ] ) ) @@ -82,7 +82,7 @@ class DateTimeItem extends StatelessWidget { child: new Row( children: [ new Text('$time'), - new Icon(Icons.arrow_drop_down, color: Colors.black54), + const Icon(Icons.arrow_drop_down, color: Colors.black54), ] ) ) @@ -122,11 +122,11 @@ class FullScreenDialogDemoState extends State { ), actions: [ new FlatButton( - child: new Text('CANCEL'), + child: const Text('CANCEL'), onPressed: () { Navigator.pop(context, DismissDialogAction.cancel); } ), new FlatButton( - child: new Text('DISCARD'), + child: const Text('DISCARD'), onPressed: () { Navigator.of(context) ..pop(DismissDialogAction.discard) // pop the cancel/discard dialog @@ -145,10 +145,10 @@ class FullScreenDialogDemoState extends State { return new Scaffold( appBar: new AppBar( leading: new IconButton( - icon: new Icon(Icons.clear), + icon: const Icon(Icons.clear), onPressed: () { handleDismissButton(context); } ), - title: new Text('New event'), + title: const Text('New event'), actions: [ new FlatButton( child: new Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)), @@ -222,7 +222,7 @@ class FullScreenDialogDemoState extends State { }); } ), - new Text('All-day') + const Text('All-day') ] ) ) diff --git a/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart b/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart index fd095960326..a6a37badbca 100644 --- a/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart @@ -316,22 +316,22 @@ class GridListDemoState extends State { final Orientation orientation = MediaQuery.of(context).orientation; return new Scaffold( appBar: new AppBar( - title: new Text('Grid list'), + title: const Text('Grid list'), actions: [ new PopupMenuButton( onSelected: changeTileStyle, itemBuilder: (BuildContext context) => >[ new PopupMenuItem( value: GridDemoTileStyle.imageOnly, - child: new Text('Image only'), + child: const Text('Image only'), ), new PopupMenuItem( value: GridDemoTileStyle.oneLine, - child: new Text('One line'), + child: const Text('One line'), ), new PopupMenuItem( value: GridDemoTileStyle.twoLine, - child: new Text('Two line'), + child: const Text('Two line'), ), ], ), diff --git a/examples/flutter_gallery/lib/demo/material/icons_demo.dart b/examples/flutter_gallery/lib/demo/material/icons_demo.dart index 57f2cabdc98..4ec2d9c3ea6 100644 --- a/examples/flutter_gallery/lib/demo/material/icons_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/icons_demo.dart @@ -71,7 +71,7 @@ class IconsDemoState extends State { return new Scaffold( appBar: new AppBar( - title: new Text('Icons') + title: const Text('Icons') ), body: new IconTheme( data: new IconThemeData(opacity: iconOpacity), diff --git a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart index 26d39733941..72ccbc14a89 100644 --- a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart @@ -104,13 +104,13 @@ class LeaveBehindDemoState extends State { background: new Container( color: theme.primaryColor, child: new ListTile( - leading: new Icon(Icons.delete, color: Colors.white, size: 36.0) + leading: const Icon(Icons.delete, color: Colors.white, size: 36.0) ) ), secondaryBackground: new Container( color: theme.primaryColor, child: new ListTile( - trailing: new Icon(Icons.archive, color: Colors.white, size: 36.0) + trailing: const Icon(Icons.archive, color: Colors.white, size: 36.0) ) ), child: new Container( @@ -132,30 +132,30 @@ class LeaveBehindDemoState extends State { return new Scaffold( key: _scaffoldKey, appBar: new AppBar( - title: new Text('Swipe to dismiss'), + title: const Text('Swipe to dismiss'), actions: [ new PopupMenuButton( onSelected: handleDemoAction, itemBuilder: (BuildContext context) => >[ new PopupMenuItem( value: LeaveBehindDemoAction.reset, - child: new Text('Reset the list') + child: const Text('Reset the list') ), new PopupMenuDivider(), // ignore: list_element_type_not_assignable, https://github.com/flutter/flutter/issues/5771 new CheckedPopupMenuItem( value: LeaveBehindDemoAction.horizontalSwipe, checked: _dismissDirection == DismissDirection.horizontal, - child: new Text('Hoizontal swipe') + child: const Text('Hoizontal swipe') ), new CheckedPopupMenuItem( value: LeaveBehindDemoAction.leftSwipe, checked: _dismissDirection == DismissDirection.endToStart, - child: new Text('Only swipe left') + child: const Text('Only swipe left') ), new CheckedPopupMenuItem( value: LeaveBehindDemoAction.rightSwipe, checked: _dismissDirection == DismissDirection.startToEnd, - child: new Text('Only swipe right') + child: const Text('Only swipe right') ) ] ) diff --git a/examples/flutter_gallery/lib/demo/material/list_demo.dart b/examples/flutter_gallery/lib/demo/material/list_demo.dart index 1fa98fc9b8c..17ed02f9cb9 100644 --- a/examples/flutter_gallery/lib/demo/material/list_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/list_demo.dart @@ -37,15 +37,15 @@ class _ListDemoState extends State { void _showConfigurationSheet() { final PersistentBottomSheetController bottomSheet = scaffoldKey.currentState.showBottomSheet((BuildContext bottomSheetContext) { return new Container( - decoration: new BoxDecoration( - border: new Border(top: new BorderSide(color: Colors.black26)), + decoration: const BoxDecoration( + border: const Border(top: const BorderSide(color: Colors.black26)), ), child: new ListView( shrinkWrap: true, children: [ new ListTile( dense: true, - title: new Text('One-line'), + title: const Text('One-line'), trailing: new Radio( value: _showAvatars ? MaterialListType.oneLineWithAvatar : MaterialListType.oneLine, groupValue: _itemType, @@ -54,7 +54,7 @@ class _ListDemoState extends State { ), new ListTile( dense: true, - title: new Text('Two-line'), + title: const Text('Two-line'), trailing: new Radio( value: MaterialListType.twoLine, groupValue: _itemType, @@ -63,7 +63,7 @@ class _ListDemoState extends State { ), new ListTile( dense: true, - title: new Text('Three-line'), + title: const Text('Three-line'), trailing: new Radio( value: MaterialListType.threeLine, groupValue: _itemType, @@ -72,7 +72,7 @@ class _ListDemoState extends State { ), new ListTile( dense: true, - title: new Text('Show avatar'), + title: const Text('Show avatar'), trailing: new Checkbox( value: _showAvatars, onChanged: (bool value) { @@ -85,7 +85,7 @@ class _ListDemoState extends State { ), new ListTile( dense: true, - title: new Text('Show icon'), + title: const Text('Show icon'), trailing: new Checkbox( value: _showIcons, onChanged: (bool value) { @@ -98,7 +98,7 @@ class _ListDemoState extends State { ), new ListTile( dense: true, - title: new Text('Show dividers'), + title: const Text('Show dividers'), trailing: new Checkbox( value: _showDividers, onChanged: (bool value) { @@ -111,7 +111,7 @@ class _ListDemoState extends State { ), new ListTile( dense: true, - title: new Text('Dense layout'), + title: const Text('Dense layout'), trailing: new Checkbox( value: _dense, onChanged: (bool value) { @@ -143,9 +143,9 @@ class _ListDemoState extends State { Widget buildListTile(BuildContext context, String item) { Widget secondary; if (_itemType == MaterialListType.twoLine) { - secondary = new Text("Additional item information."); + secondary = const Text("Additional item information."); } else if (_itemType == MaterialListType.threeLine) { - secondary = new Text( + secondary = const Text( "Even more additional list item information appears on line three.", ); } @@ -186,7 +186,7 @@ class _ListDemoState extends State { title: new Text('Scrolling list\n$itemTypeText$layoutText'), actions: [ new IconButton( - icon: new Icon(Icons.sort_by_alpha), + icon: const Icon(Icons.sort_by_alpha), tooltip: 'Sort', onPressed: () { setState(() { @@ -196,7 +196,7 @@ class _ListDemoState extends State { }, ), new IconButton( - icon: new Icon(Icons.more_vert), + icon: const Icon(Icons.more_vert), tooltip: 'Show menu', onPressed: _bottomSheet == null ? _showConfigurationSheet : null, ), diff --git a/examples/flutter_gallery/lib/demo/material/menu_demo.dart b/examples/flutter_gallery/lib/demo/material/menu_demo.dart index edc04da35a1..9a5ffadf8ec 100644 --- a/examples/flutter_gallery/lib/demo/material/menu_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/menu_demo.dart @@ -62,22 +62,22 @@ class MenuDemoState extends State { return new Scaffold( key: _scaffoldKey, appBar: new AppBar( - title: new Text('Menus'), + title: const Text('Menus'), actions: [ new PopupMenuButton( onSelected: showMenuSelection, itemBuilder: (BuildContext context) => >[ new PopupMenuItem( value: 'Toolbar menu', - child: new Text('Toolbar menu') + child: const Text('Toolbar menu') ), new PopupMenuItem( value: 'Right here', - child: new Text('Right here') + child: const Text('Right here') ), new PopupMenuItem( value: 'Hooray!', - child: new Text('Hooray!') + child: const Text('Hooray!') ), ] ) @@ -90,22 +90,22 @@ class MenuDemoState extends State { // a simple menu with one disabled item. Typically the contents // of this "contextual menu" would reflect the app's state. new ListTile( - title: new Text('An item with a context menu button'), + title: const Text('An item with a context menu button'), trailing: new PopupMenuButton( padding: EdgeInsets.zero, onSelected: showMenuSelection, itemBuilder: (BuildContext context) => >[ new PopupMenuItem( value: _simpleValue1, - child: new Text('Context menu item one') + child: const Text('Context menu item one') ), new PopupMenuItem( enabled: false, - child: new Text('A disabled menu item') + child: const Text('A disabled menu item') ), new PopupMenuItem( value: _simpleValue3, - child: new Text('Context menu item three') + child: const Text('Context menu item three') ), ] ) @@ -114,7 +114,7 @@ class MenuDemoState extends State { // a menu whose items have text labels and icons and a divider // That separates the first three items from the last one. new ListTile( - title: new Text('An item with a sectioned menu'), + title: const Text('An item with a sectioned menu'), trailing: new PopupMenuButton( padding: EdgeInsets.zero, onSelected: showMenuSelection, @@ -122,30 +122,30 @@ class MenuDemoState extends State { new PopupMenuItem( value: 'Preview', child: new ListTile( - leading: new Icon(Icons.visibility), - title: new Text('Preview') + leading: const Icon(Icons.visibility), + title: const Text('Preview') ) ), new PopupMenuItem( value: 'Share', child: new ListTile( - leading: new Icon(Icons.person_add), - title: new Text('Share') + leading: const Icon(Icons.person_add), + title: const Text('Share') ) ), new PopupMenuItem( value: 'Get Link', child: new ListTile( - leading: new Icon(Icons.link), - title: new Text('Get link') + leading: const Icon(Icons.link), + title: const Text('Get link') ) ), new PopupMenuDivider(), // ignore: list_element_type_not_assignable, https://github.com/flutter/flutter/issues/5771 new PopupMenuItem( value: 'Remove', child: new ListTile( - leading: new Icon(Icons.delete), - title: new Text('Remove') + leading: const Icon(Icons.delete), + title: const Text('Remove') ) ) ] @@ -159,7 +159,7 @@ class MenuDemoState extends State { initialValue: _simpleValue, onSelected: showMenuSelection, child: new ListTile( - title: new Text('An item with a simple menu'), + title: const Text('An item with a simple menu'), subtitle: new Text(_simpleValue) ), itemBuilder: (BuildContext context) => >[ @@ -180,7 +180,7 @@ class MenuDemoState extends State { // Pressing the PopupMenuButton on the right of this item shows a menu // whose items have checked icons that reflect this app's state. new ListTile( - title: new Text('An item with a checklist menu'), + title: const Text('An item with a checklist menu'), trailing: new PopupMenuButton( padding: EdgeInsets.zero, onSelected: showCheckedMenuSelections, diff --git a/examples/flutter_gallery/lib/demo/material/modal_bottom_sheet_demo.dart b/examples/flutter_gallery/lib/demo/material/modal_bottom_sheet_demo.dart index c0eee715dc2..ec1540a4e4b 100644 --- a/examples/flutter_gallery/lib/demo/material/modal_bottom_sheet_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/modal_bottom_sheet_demo.dart @@ -10,10 +10,10 @@ class ModalBottomSheetDemo extends StatelessWidget { @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: new Text('Modal bottom sheet')), + appBar: new AppBar(title: const Text('Modal bottom sheet')), body: new Center( child: new RaisedButton( - child: new Text('SHOW BOTTOM SHEET'), + child: const Text('SHOW BOTTOM SHEET'), onPressed: () { showModalBottomSheet(context: context, builder: (BuildContext context) { return new Container( diff --git a/examples/flutter_gallery/lib/demo/material/overscroll_demo.dart b/examples/flutter_gallery/lib/demo/material/overscroll_demo.dart index 21ff0a75cf1..d1cde79a143 100644 --- a/examples/flutter_gallery/lib/demo/material/overscroll_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/overscroll_demo.dart @@ -29,7 +29,7 @@ class OverscrollDemoState extends State { new Timer(const Duration(seconds: 3), () { completer.complete(null); }); return completer.future.then((_) { _scaffoldKey.currentState?.showSnackBar(new SnackBar( - content: new Text("Refresh complete"), + content: const Text("Refresh complete"), action: new SnackBarAction( label: 'RETRY', onPressed: () { @@ -45,10 +45,10 @@ class OverscrollDemoState extends State { return new Scaffold( key: _scaffoldKey, appBar: new AppBar( - title: new Text('Pull to refresh'), + title: const Text('Pull to refresh'), actions: [ new IconButton( - icon: new Icon(Icons.refresh), + icon: const Icon(Icons.refresh), tooltip: 'Refresh', onPressed: () { _refreshIndicatorKey.currentState.show(); @@ -68,7 +68,7 @@ class OverscrollDemoState extends State { isThreeLine: true, leading: new CircleAvatar(child: new Text(item)), title: new Text('This item represents $item.'), - subtitle: new Text('Even more additional list item information appears on line three.'), + subtitle: const Text('Even more additional list item information appears on line three.'), ); }, ), diff --git a/examples/flutter_gallery/lib/demo/material/page_selector_demo.dart b/examples/flutter_gallery/lib/demo/material/page_selector_demo.dart index daf23ece373..a6fd74c099e 100644 --- a/examples/flutter_gallery/lib/demo/material/page_selector_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/page_selector_demo.dart @@ -26,14 +26,14 @@ class _PageSelector extends StatelessWidget { child: new Row( children: [ new IconButton( - icon: new Icon(Icons.chevron_left), + icon: const Icon(Icons.chevron_left), color: color, onPressed: () { _handleArrowButtonPress(context, -1); }, tooltip: 'Page back' ), new TabPageSelector(controller: controller), new IconButton( - icon: new Icon(Icons.chevron_right), + icon: const Icon(Icons.chevron_right), color: color, onPressed: () { _handleArrowButtonPress(context, 1); }, tooltip: 'Page forward' @@ -76,7 +76,7 @@ class PageSelectorDemo extends StatelessWidget { @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: new Text('Page selector')), + appBar: new AppBar(title: const Text('Page selector')), body: new DefaultTabController( length: icons.length, child: new _PageSelector(icons: icons), diff --git a/examples/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart b/examples/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart index 53bca99d5cd..1f2d55302b2 100644 --- a/examples/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart @@ -57,11 +57,11 @@ class _PersistentBottomSheetDemoState extends State { showDialog( context: context, child: new AlertDialog( - content: new Text('You tapped the floating action button.'), + content: const Text('You tapped the floating action button.'), actions: [ new FlatButton( onPressed: () { Navigator.pop(context); }, - child: new Text('OK') + child: const Text('OK') ) ] ) @@ -72,16 +72,16 @@ class _PersistentBottomSheetDemoState extends State { Widget build(BuildContext context) { return new Scaffold( key: _scaffoldKey, - appBar: new AppBar(title: new Text('Persistent bottom sheet')), + appBar: new AppBar(title: const Text('Persistent bottom sheet')), floatingActionButton: new FloatingActionButton( onPressed: _showMessage, backgroundColor: Colors.redAccent, - child: new Icon(Icons.add) + child: const Icon(Icons.add) ), body: new Center( child: new RaisedButton( onPressed: _showBottomSheetCallback, - child: new Text('SHOW BOTTOM SHEET') + child: const Text('SHOW BOTTOM SHEET') ) ) ); diff --git a/examples/flutter_gallery/lib/demo/material/progress_indicator_demo.dart b/examples/flutter_gallery/lib/demo/material/progress_indicator_demo.dart index d514d6dbcd1..4b55eedebc4 100644 --- a/examples/flutter_gallery/lib/demo/material/progress_indicator_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/progress_indicator_demo.dart @@ -25,7 +25,7 @@ class _ProgressIndicatorDemoState extends State with Sing _animation = new CurvedAnimation( parent: _controller, - curve: new Interval(0.0, 0.9, curve: Curves.fastOutSlowIn), + curve: const Interval(0.0, 0.9, curve: Curves.fastOutSlowIn), reverseCurve: Curves.fastOutSlowIn )..addStatusListener((AnimationStatus status) { if (status == AnimationStatus.dismissed) @@ -99,7 +99,7 @@ class _ProgressIndicatorDemoState extends State with Sing @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: new Text('Progress indicators')), + appBar: new AppBar(title: const Text('Progress indicators')), body: new Center( child: new SingleChildScrollView( child: new DefaultTextStyle( diff --git a/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart b/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart index 2e4901c6727..54213d62a03 100644 --- a/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart @@ -59,22 +59,22 @@ class ScrollableTabsDemoState extends State with SingleTicke final Color iconColor = Theme.of(context).accentColor; return new Scaffold( appBar: new AppBar( - title: new Text('Scrollable tabs'), + title: const Text('Scrollable tabs'), actions: [ new PopupMenuButton( onSelected: changeDemoStyle, itemBuilder: (BuildContext context) => >[ new PopupMenuItem( value: TabsDemoStyle.iconsAndText, - child: new Text('Icons and text') + child: const Text('Icons and text') ), new PopupMenuItem( value: TabsDemoStyle.iconsOnly, - child: new Text('Icons only') + child: const Text('Icons only') ), new PopupMenuItem( value: TabsDemoStyle.textOnly, - child: new Text('Text only') + child: const Text('Text only') ), ], ), diff --git a/examples/flutter_gallery/lib/demo/material/slider_demo.dart b/examples/flutter_gallery/lib/demo/material/slider_demo.dart index 41d142ad469..acd8d00fb58 100644 --- a/examples/flutter_gallery/lib/demo/material/slider_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/slider_demo.dart @@ -18,7 +18,7 @@ class _SliderDemoState extends State { @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: new Text('Sliders')), + appBar: new AppBar(title: const Text('Sliders')), body: new Center( child: new Column( mainAxisAlignment: MainAxisAlignment.spaceAround, @@ -37,14 +37,14 @@ class _SliderDemoState extends State { }); } ), - new Text('Continuous'), + const Text('Continuous'), ] ), new Column( mainAxisSize: MainAxisSize.min, children: [ new Slider(value: 0.25, thumbOpenAtMin: true, onChanged: null), - new Text('Disabled'), + const Text('Disabled'), ] ), new Column( @@ -63,7 +63,7 @@ class _SliderDemoState extends State { }); } ), - new Text('Discrete'), + const Text('Discrete'), ], ), ], diff --git a/examples/flutter_gallery/lib/demo/material/snack_bar_demo.dart b/examples/flutter_gallery/lib/demo/material/snack_bar_demo.dart index e78d2559b85..b843b800cc8 100644 --- a/examples/flutter_gallery/lib/demo/material/snack_bar_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/snack_bar_demo.dart @@ -32,11 +32,11 @@ class _SnackBarDemoState extends State { return new ListView( padding: const EdgeInsets.all(24.0), children: [ - new Text(_text1), - new Text(_text2), + const Text(_text1), + const Text(_text2), new Center( child: new RaisedButton( - child: new Text('SHOW A SNACKBAR'), + child: const Text('SHOW A SNACKBAR'), onPressed: () { final int thisSnackBarIndex = _snackBarIndex++; Scaffold.of(context).showSnackBar(new SnackBar( @@ -53,7 +53,7 @@ class _SnackBarDemoState extends State { } ) ), - new Text(_text3), + const Text(_text3), ] .map((Widget child) { return new Container( @@ -69,7 +69,7 @@ class _SnackBarDemoState extends State { Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( - title: new Text('Snackbar') + title: const Text('Snackbar') ), body: new Builder( // Create an inner BuildContext so that the snackBar onPressed methods diff --git a/examples/flutter_gallery/lib/demo/material/tabs_demo.dart b/examples/flutter_gallery/lib/demo/material/tabs_demo.dart index f2299533300..d93c7cae462 100644 --- a/examples/flutter_gallery/lib/demo/material/tabs_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/tabs_demo.dart @@ -120,7 +120,7 @@ class TabsDemo extends StatelessWidget { length: _allPages.length, child: new Scaffold( appBar: new AppBar( - title: new Text('Tabs and scrolling'), + title: const Text('Tabs and scrolling'), bottom: new TabBar( tabs: _allPages.keys.map((_Page page) => new Tab(text: page.label)).toList(), ), diff --git a/examples/flutter_gallery/lib/demo/material/tabs_fab_demo.dart b/examples/flutter_gallery/lib/demo/material/tabs_fab_demo.dart index e9575e9bbc9..018be7932da 100644 --- a/examples/flutter_gallery/lib/demo/material/tabs_fab_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/tabs_fab_demo.dart @@ -106,7 +106,7 @@ class _TabsFabDemoState extends State with SingleTickerProviderStat return new Scaffold( key: _scaffoldKey, appBar: new AppBar( - title: new Text('FAB per tab'), + title: const Text('FAB per tab'), bottom: new TabBar( controller: _controller, tabs: _allPages.map((_Page page) => new Tab(text: page.label.toUpperCase())).toList(), diff --git a/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart b/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart index 2b0e5cd8422..bac851a6c62 100644 --- a/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart @@ -83,15 +83,15 @@ class TextFormFieldDemoState extends State { return await showDialog( context: context, child: new AlertDialog( - title: new Text('This form has errors'), - content: new Text('Really leave this form?'), + title: const Text('This form has errors'), + content: const Text('Really leave this form?'), actions: [ new FlatButton( - child: new Text('YES'), + child: const Text('YES'), onPressed: () { Navigator.of(context).pop(true); }, ), new FlatButton( - child: new Text('NO'), + child: const Text('NO'), onPressed: () { Navigator.of(context).pop(false); }, ), ], @@ -104,7 +104,7 @@ class TextFormFieldDemoState extends State { return new Scaffold( key: _scaffoldKey, appBar: new AppBar( - title: new Text('Text fields'), + title: const Text('Text fields'), ), body: new Form( key: _formKey, @@ -170,7 +170,7 @@ class TextFormFieldDemoState extends State { padding: const EdgeInsets.all(20.0), alignment: const FractionalOffset(0.5, 0.5), child: new RaisedButton( - child: new Text('SUBMIT'), + child: const Text('SUBMIT'), onPressed: _handleSubmitted, ), ), diff --git a/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart b/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart index 84c3c0d8e58..a6d025d9105 100644 --- a/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart @@ -18,7 +18,7 @@ class TooltipDemo extends StatelessWidget { final ThemeData theme = Theme.of(context); return new Scaffold( appBar: new AppBar( - title: new Text('Tooltips') + title: const Text('Tooltips') ), body: new Builder( builder: (BuildContext context) { @@ -42,12 +42,12 @@ class TooltipDemo extends StatelessWidget { new Center( child: new IconButton( iconSize: 48.0, - icon: new Icon(Icons.call), + icon: const Icon(Icons.call), color: theme.iconTheme.color, tooltip: 'Place a phone call', onPressed: () { Scaffold.of(context).showSnackBar(new SnackBar( - content: new Text('That was an ordinary tap.') + content: const Text('That was an ordinary tap.') )); } ) diff --git a/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart b/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart index 230792675cb..d15217327da 100644 --- a/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart @@ -10,23 +10,23 @@ class TwoLevelListDemo extends StatelessWidget { @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: new Text('Expand/collapse list control')), + appBar: new AppBar(title: const Text('Expand/collapse list control')), body: new TwoLevelList( type: MaterialListType.oneLine, children: [ - new TwoLevelListItem(title: new Text('Top')), + new TwoLevelListItem(title: const Text('Top')), new TwoLevelSublist( - title: new Text('Sublist'), + title: const Text('Sublist'), backgroundColor: Theme.of(context).accentColor.withOpacity(0.025), children: [ - new TwoLevelListItem(title: new Text('One')), - new TwoLevelListItem(title: new Text('Two')), + new TwoLevelListItem(title: const Text('One')), + new TwoLevelListItem(title: const Text('Two')), // https://en.wikipedia.org/wiki/Free_Four - new TwoLevelListItem(title: new Text('Free')), - new TwoLevelListItem(title: new Text('Four')) + new TwoLevelListItem(title: const Text('Free')), + new TwoLevelListItem(title: const Text('Four')) ] ), - new TwoLevelListItem(title: new Text('Bottom')) + new TwoLevelListItem(title: const Text('Bottom')) ] ) ); diff --git a/examples/flutter_gallery/lib/demo/pesto_demo.dart b/examples/flutter_gallery/lib/demo/pesto_demo.dart index b0cb6f41811..f6ce4db8cf9 100644 --- a/examples/flutter_gallery/lib/demo/pesto_demo.dart +++ b/examples/flutter_gallery/lib/demo/pesto_demo.dart @@ -82,10 +82,10 @@ class _RecipeGridPageState extends State { child: new Scaffold( key: scaffoldKey, floatingActionButton: new FloatingActionButton( - child: new Icon(Icons.edit), + child: const Icon(Icons.edit), onPressed: () { scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text('Not supported.'), + content: const Text('Not supported.'), )); }, ), @@ -105,11 +105,11 @@ class _RecipeGridPageState extends State { expandedHeight: _kAppBarHeight, actions: [ new IconButton( - icon: new Icon(Icons.search), + icon: const Icon(Icons.search), tooltip: 'Search', onPressed: () { scaffoldKey.currentState.showSnackBar(new SnackBar( - content: new Text('Not supported.'), + content: const Text('Not supported.'), )); }, ), diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart index c7f5a1f9a84..a53d702c5e3 100644 --- a/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart +++ b/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart @@ -181,7 +181,7 @@ class _Heading extends StatelessWidget { ), new LayoutId( id: _HeadingLayout.icon, - child: new Icon( + child: const Icon( Icons.info_outline, size: 24.0, color: const Color(0xFFFFE0E0), @@ -275,7 +275,7 @@ class _OrderPageState extends State { ); }, backgroundColor: const Color(0xFF16F0F0), - child: new Icon( + child: const Icon( Icons.add_shopping_cart, color: Colors.black, ), diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart index be90c774d9f..467bf1f08ec 100644 --- a/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart +++ b/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart @@ -54,9 +54,9 @@ class ShrinePageState extends State { void _showShoppingCart() { showModalBottomSheet(context: context, builder: (BuildContext context) { if (config.shoppingCart.isEmpty) { - return new Padding( + return const Padding( padding: const EdgeInsets.all(24.0), - child: new Text('The shopping cart is empty') + child: const Text('The shopping cart is empty') ); } return new ListView( @@ -82,7 +82,7 @@ class ShrinePageState extends State { void _emptyCart() { config.shoppingCart.clear(); - config.scaffoldKey.currentState.showSnackBar(new SnackBar(content: new Text('Shopping cart is empty'))); + config.scaffoldKey.currentState.showSnackBar(new SnackBar(content: const Text('Shopping cart is empty'))); } @override @@ -107,7 +107,7 @@ class ShrinePageState extends State { ), actions: [ new IconButton( - icon: new Icon(Icons.shopping_cart), + icon: const Icon(Icons.shopping_cart), tooltip: 'Shopping cart', onPressed: _showShoppingCart ), @@ -115,15 +115,15 @@ class ShrinePageState extends State { itemBuilder: (BuildContext context) => >[ new PopupMenuItem( value: ShrineAction.sortByPrice, - child: new Text('Sort by price') + child: const Text('Sort by price') ), new PopupMenuItem( value: ShrineAction.sortByProduct, - child: new Text('Sort by product') + child: const Text('Sort by product') ), new PopupMenuItem( value: ShrineAction.emptyCart, - child: new Text('Empty shopping cart') + child: const Text('Empty shopping cart') ) ], onSelected: (ShrineAction action) { diff --git a/examples/flutter_gallery/lib/demo/typography_demo.dart b/examples/flutter_gallery/lib/demo/typography_demo.dart index 33b947c721e..da6e34f5d6e 100644 --- a/examples/flutter_gallery/lib/demo/typography_demo.dart +++ b/examples/flutter_gallery/lib/demo/typography_demo.dart @@ -71,7 +71,7 @@ class TypographyDemo extends StatelessWidget { } return new Scaffold( - appBar: new AppBar(title: new Text('Typography')), + appBar: new AppBar(title: const Text('Typography')), body: new ListView(children: styleItems) ); } diff --git a/examples/flutter_gallery/lib/gallery/demo.dart b/examples/flutter_gallery/lib/gallery/demo.dart index 047b4c7e928..9099c14ce08 100644 --- a/examples/flutter_gallery/lib/gallery/demo.dart +++ b/examples/flutter_gallery/lib/gallery/demo.dart @@ -61,7 +61,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget { new Builder( builder: (BuildContext context) { return new IconButton( - icon: new Icon(Icons.description), + icon: const Icon(Icons.description), tooltip: 'Show example code', onPressed: () { _showExampleCode(context); @@ -150,10 +150,10 @@ class FullScreenCodeDialogState extends State { return new Scaffold( appBar: new AppBar( leading: new IconButton( - icon: new Icon(Icons.clear), + icon: const Icon(Icons.clear), onPressed: () { Navigator.pop(context); } ), - title: new Text('Example code') + title: const Text('Example code') ), body: body ); diff --git a/examples/flutter_gallery/lib/gallery/drawer.dart b/examples/flutter_gallery/lib/gallery/drawer.dart index 098b8405a31..0e2d1389866 100644 --- a/examples/flutter_gallery/lib/gallery/drawer.dart +++ b/examples/flutter_gallery/lib/gallery/drawer.dart @@ -127,8 +127,8 @@ class GalleryDrawer extends StatelessWidget { final TextStyle linkStyle = themeData.textTheme.body2.copyWith(color: themeData.accentColor); final Widget lightThemeItem = new ListTile( - leading: new Icon(Icons.brightness_5), - title: new Text('Light'), + leading: const Icon(Icons.brightness_5), + title: const Text('Light'), trailing: new Radio( value: true, groupValue: useLightTheme, @@ -141,8 +141,8 @@ class GalleryDrawer extends StatelessWidget { ); final Widget darkThemeItem = new ListTile( - leading: new Icon(Icons.brightness_7), - title: new Text('Dark'), + leading: const Icon(Icons.brightness_7), + title: const Text('Dark'), trailing: new Radio( value: false, groupValue: useLightTheme, @@ -157,7 +157,7 @@ class GalleryDrawer extends StatelessWidget { final Widget mountainViewItem = new ListTile( // on iOS, we don't want to show an Android phone icon leading: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star : Icons.phone_android), - title: new Text('Android'), + title: const Text('Android'), trailing: new Radio( value: TargetPlatform.android, groupValue: Theme.of(context).platform, @@ -172,7 +172,7 @@ class GalleryDrawer extends StatelessWidget { final Widget cupertinoItem = new ListTile( // on iOS, we don't want to show the iPhone icon leading: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star_border : Icons.phone_iphone), - title: new Text('iOS'), + title: const Text('iOS'), trailing: new Radio( value: TargetPlatform.iOS, groupValue: Theme.of(context).platform, @@ -185,8 +185,8 @@ class GalleryDrawer extends StatelessWidget { ); final Widget animateSlowlyItem = new ListTile( - leading: new Icon(Icons.hourglass_empty), - title: new Text('Animate Slowly'), + leading: const Icon(Icons.hourglass_empty), + title: const Text('Animate Slowly'), trailing: new Checkbox( value: timeDilation != 1.0, onChanged: (bool value) { @@ -200,8 +200,8 @@ class GalleryDrawer extends StatelessWidget { ); final Widget sendFeedbackItem = new ListTile( - leading: new Icon(Icons.report), - title: new Text('Send feedback'), + leading: const Icon(Icons.report), + title: const Text('Send feedback'), onTap: onSendFeedback ?? () { UrlLauncher.launch('https://github.com/flutter/flutter/issues/new'); }, @@ -266,8 +266,8 @@ class GalleryDrawer extends StatelessWidget { if (onShowPerformanceOverlayChanged != null) { allDrawerItems.insert(8, new ListTile( - leading: new Icon(Icons.assessment), - title: new Text('Performance Overlay'), + leading: const Icon(Icons.assessment), + title: const Text('Performance Overlay'), trailing: new Checkbox( value: showPerformanceOverlay, onChanged: (bool value) { @@ -283,8 +283,8 @@ class GalleryDrawer extends StatelessWidget { if (onCheckerboardRasterCacheImagesChanged != null) { allDrawerItems.insert(8, new ListTile( - leading: new Icon(Icons.assessment), - title: new Text('Checkerboard Raster Cache Images'), + leading: const Icon(Icons.assessment), + title: const Text('Checkerboard Raster Cache Images'), trailing: new Checkbox( value: checkerboardRasterCacheImages, onChanged: (bool value) { diff --git a/examples/flutter_gallery/lib/gallery/example_code.dart b/examples/flutter_gallery/lib/gallery/example_code.dart index 42ec4f397a1..f594f618010 100644 --- a/examples/flutter_gallery/lib/gallery/example_code.dart +++ b/examples/flutter_gallery/lib/gallery/example_code.dart @@ -16,7 +16,7 @@ class ButtonsDemo { // START buttons_raised // Create a raised button. new RaisedButton( - child: new Text('BUTTON TITLE'), + child: const Text('BUTTON TITLE'), onPressed: () { // Perform some action } @@ -26,7 +26,7 @@ new RaisedButton( // Buttons are disabled when onPressed isn't // specified or is null. new RaisedButton( - child: new Text('BUTTON TITLE'), + child: const Text('BUTTON TITLE'), onPressed: null ); // END @@ -35,7 +35,7 @@ new RaisedButton( // START buttons_flat // Create a flat button. new FlatButton( - child: new Text('BUTTON TITLE'), + child: const Text('BUTTON TITLE'), onPressed: () { // Perform some action } @@ -45,7 +45,7 @@ new FlatButton( // Buttons are disabled when onPressed isn't // specified or is null. new FlatButton( - child: new Text('BUTTON TITLE'), + child: const Text('BUTTON TITLE'), onPressed: null ); // END @@ -83,7 +83,7 @@ bool value; // Toggleable icon button. new IconButton( - icon: new Icon(Icons.thumb_up), + icon: const Icon(Icons.thumb_up), onPressed: () { setState(() => value = !value); }, @@ -96,10 +96,10 @@ new IconButton( // Floating action button in Scaffold. new Scaffold( appBar: new AppBar( - title: new Text('Demo') + title: const Text('Demo') ), - floatingActionButton: new FloatingActionButton( - child: new Icon(Icons.add), + floatingActionButton: const FloatingActionButton( + child: const Icon(Icons.add), onPressed: null ) ); diff --git a/examples/flutter_gallery/lib/gallery/home.dart b/examples/flutter_gallery/lib/gallery/home.dart index 6177529ea42..adeace820cd 100644 --- a/examples/flutter_gallery/lib/gallery/home.dart +++ b/examples/flutter_gallery/lib/gallery/home.dart @@ -170,7 +170,7 @@ class GalleryHomeState extends State with SingleTickerProviderState pinned: true, expandedHeight: _kFlexibleSpaceMaxHeight, flexibleSpace: new FlexibleSpaceBar( - title: new Text('Flutter Gallery'), + 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), ), @@ -194,7 +194,7 @@ class GalleryHomeState extends State with SingleTickerProviderState home, new FadeTransition( opacity: new CurvedAnimation(parent: _controller, curve: Curves.easeInOut), - child: new Banner( + child: const Banner( message: 'PREVIEW', location: BannerLocation.topRight, ) diff --git a/examples/flutter_gallery/lib/gallery/updates.dart b/examples/flutter_gallery/lib/gallery/updates.dart index e46c5b995f3..fcc110db537 100644 --- a/examples/flutter_gallery/lib/gallery/updates.dart +++ b/examples/flutter_gallery/lib/gallery/updates.dart @@ -51,16 +51,16 @@ class UpdaterState extends State { final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color); return new AlertDialog( - title: new Text('Update Flutter Gallery?'), + title: const Text('Update Flutter Gallery?'), content: new Text('A newer version is available.', style: dialogTextStyle), actions: [ new FlatButton( - child: new Text('NO THANKS'), + child: const Text('NO THANKS'), onPressed: () { Navigator.pop(context, false); }), new FlatButton( - child: new Text('UPDATE'), + child: const Text('UPDATE'), onPressed: () { Navigator.pop(context, true); }), diff --git a/examples/flutter_view/lib/main.dart b/examples/flutter_view/lib/main.dart index 0b34730866c..9cd4da84e9d 100644 --- a/examples/flutter_view/lib/main.dart +++ b/examples/flutter_view/lib/main.dart @@ -61,7 +61,7 @@ class _MyHomePageState extends State { child: new Center( child: new Text( 'Platform button tapped $_counter time${ _counter == 1 ? '' : 's' }.', - style: new TextStyle(fontSize: 17.0)) + style: const TextStyle(fontSize: 17.0)) ), ), new Container( @@ -69,7 +69,7 @@ class _MyHomePageState extends State { child: new Row( children: [ new Image.asset('assets/flutter-mark-square-64.png', scale: 1.5), - new Text('Flutter', style: new TextStyle(fontSize: 30.0)), + const Text('Flutter', style: const TextStyle(fontSize: 30.0)), ], ), ), @@ -77,7 +77,7 @@ class _MyHomePageState extends State { ), floatingActionButton: new FloatingActionButton( onPressed: _sendFlutterIncrement, - child: new Icon(Icons.add), + child: const Icon(Icons.add), ), ); } diff --git a/examples/hello_world/lib/main.dart b/examples/hello_world/lib/main.dart index fc373381182..1ad8675054e 100644 --- a/examples/hello_world/lib/main.dart +++ b/examples/hello_world/lib/main.dart @@ -4,4 +4,4 @@ import 'package:flutter/widgets.dart'; -void main() => runApp(new Center(child: new Text('Hello, world!'))); +void main() => runApp(const Center(child: const Text('Hello, world!'))); diff --git a/examples/layers/rendering/touch_input.dart b/examples/layers/rendering/touch_input.dart index 8c3f3a63095..6fd568526b1 100644 --- a/examples/layers/rendering/touch_input.dart +++ b/examples/layers/rendering/touch_input.dart @@ -102,8 +102,8 @@ class RenderDots extends RenderBox { void main() { // Create some styled text to tell the user to interact with the app. final RenderParagraph paragraph = new RenderParagraph( - new TextSpan( - style: new TextStyle(color: Colors.black87), + const TextSpan( + style: const TextStyle(color: Colors.black87), text: "Touch me!" ) ); diff --git a/examples/layers/services/lifecycle.dart b/examples/layers/services/lifecycle.dart index 7f979c3474f..5196c83a882 100644 --- a/examples/layers/services/lifecycle.dart +++ b/examples/layers/services/lifecycle.dart @@ -35,7 +35,7 @@ class _LifecycleWatcherState extends State @override Widget build(BuildContext context) { if (_lastLifecyleState == null) - return new Text('This widget has not observed any lifecycle changes.'); + return const Text('This widget has not observed any lifecycle changes.'); return new Text('The most recent lifecycle state this widget observed was: $_lastLifecyleState.'); } } diff --git a/examples/layers/widgets/custom_render_box.dart b/examples/layers/widgets/custom_render_box.dart index b93d8bcf1b8..f5fa0f58554 100644 --- a/examples/layers/widgets/custom_render_box.dart +++ b/examples/layers/widgets/custom_render_box.dart @@ -46,5 +46,5 @@ class Dots extends SingleChildRenderObjectWidget { } void main() { - runApp(new Dots(child: new Center(child: new Text('Touch me!')))); + runApp(new Dots(child: const Center(child: const Text('Touch me!')))); } diff --git a/examples/layers/widgets/gestures.dart b/examples/layers/widgets/gestures.dart index 2bc701575f9..deee29e99ad 100644 --- a/examples/layers/widgets/gestures.dart +++ b/examples/layers/widgets/gestures.dart @@ -188,7 +188,7 @@ class _GestureDemoState extends State { value: _scaleEnabled, onChanged: (bool value) { setState(() { _scaleEnabled = value; }); } ), - new Text('Scale'), + const Text('Scale'), ] ), new Row( @@ -197,7 +197,7 @@ class _GestureDemoState extends State { value: _tapEnabled, onChanged: (bool value) { setState(() { _tapEnabled = value; }); } ), - new Text('Tap'), + const Text('Tap'), ] ), new Row( @@ -206,7 +206,7 @@ class _GestureDemoState extends State { value: _doubleTapEnabled, onChanged: (bool value) { setState(() { _doubleTapEnabled = value; }); } ), - new Text('Double Tap'), + const Text('Double Tap'), ] ), new Row( @@ -215,7 +215,7 @@ class _GestureDemoState extends State { value: _longPressEnabled, onChanged: (bool value) { setState(() { _longPressEnabled = value; }); } ), - new Text('Long Press'), + const Text('Long Press'), ] ), ], @@ -233,7 +233,7 @@ void main() { runApp(new MaterialApp( theme: new ThemeData.dark(), home: new Scaffold( - appBar: new AppBar(title: new Text('Gestures Demo')), + appBar: new AppBar(title: const Text('Gestures Demo')), body: new GestureDemo() ) )); diff --git a/examples/layers/widgets/hello_world.dart b/examples/layers/widgets/hello_world.dart index fc373381182..1ad8675054e 100644 --- a/examples/layers/widgets/hello_world.dart +++ b/examples/layers/widgets/hello_world.dart @@ -4,4 +4,4 @@ import 'package:flutter/widgets.dart'; -void main() => runApp(new Center(child: new Text('Hello, world!'))); +void main() => runApp(const Center(child: const Text('Hello, world!'))); diff --git a/examples/layers/widgets/media_query.dart b/examples/layers/widgets/media_query.dart index 1158376033a..5a638dde7f5 100644 --- a/examples/layers/widgets/media_query.dart +++ b/examples/layers/widgets/media_query.dart @@ -51,8 +51,8 @@ class AdaptedGridItem extends StatelessWidget { new Expanded( child: new Text(name) ), - new IconButton( - icon: new Icon(Icons.more_vert), + const IconButton( + icon: const Icon(Icons.more_vert), onPressed: null ) ] @@ -103,7 +103,7 @@ void main() { title: 'Media Query Example', home: new Scaffold( appBar: new AppBar( - title: new Text('Media Query Example') + title: const Text('Media Query Example') ), body: new Material(child: new AdaptiveContainer(names: _kNames)) ) diff --git a/examples/layers/widgets/sectors.dart b/examples/layers/widgets/sectors.dart index 060b087be3b..c978218edf9 100644 --- a/examples/layers/widgets/sectors.dart +++ b/examples/layers/widgets/sectors.dart @@ -106,7 +106,7 @@ class SectorAppState extends State { margin: const EdgeInsets.only(right: 10.0), child: new WidgetToRenderBoxAdapter(renderBox: sectorAddIcon) ), - new Text('ADD SECTOR'), + const Text('ADD SECTOR'), ] ) ) @@ -121,7 +121,7 @@ class SectorAppState extends State { margin: const EdgeInsets.only(right: 10.0), child: new WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon) ), - new Text('REMOVE SECTOR'), + const Text('REMOVE SECTOR'), ] ) ) @@ -155,7 +155,7 @@ class SectorAppState extends State { title: 'Sector Layout', home: new Scaffold( appBar: new AppBar( - title: new Text('Sector Layout in a Widget Tree') + title: const Text('Sector Layout in a Widget Tree') ), body: buildBody() ) diff --git a/examples/layers/widgets/spinning_mixed.dart b/examples/layers/widgets/spinning_mixed.dart index eb0aae31ab3..0ffefafaa5b 100644 --- a/examples/layers/widgets/spinning_mixed.dart +++ b/examples/layers/widgets/spinning_mixed.dart @@ -52,7 +52,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) { child: new Row( children: [ new Image.network('https://flutter.io/images/favicon.png'), - new Text('PRESS ME'), + const Text('PRESS ME'), ] ), onPressed: () { diff --git a/examples/layers/widgets/styled_text.dart b/examples/layers/widgets/styled_text.dart index e151da3372c..917bc0e5bf7 100644 --- a/examples/layers/widgets/styled_text.dart +++ b/examples/layers/widgets/styled_text.dart @@ -124,7 +124,7 @@ void main() { theme: new ThemeData.light(), home: new Scaffold( appBar: new AppBar( - title: new Text('Hal and Dave') + title: const Text('Hal and Dave') ), body: new Material( color: Colors.grey.shade50, diff --git a/examples/platform_channel/lib/main.dart b/examples/platform_channel/lib/main.dart index 19f6738f7ad..eea88f1f741 100644 --- a/examples/platform_channel/lib/main.dart +++ b/examples/platform_channel/lib/main.dart @@ -62,11 +62,11 @@ class _PlatformChannelState extends State { new Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - new Text(_batteryLevel, key: new Key('Battery level label')), + new Text(_batteryLevel, key: const Key('Battery level label')), new Padding( - padding: new EdgeInsets.all(16.0), + padding: const EdgeInsets.all(16.0), child: new RaisedButton( - child: new Text('Refresh'), + child: const Text('Refresh'), onPressed: _getBatteryLevel, ), ), diff --git a/examples/platform_channel_swift/lib/main.dart b/examples/platform_channel_swift/lib/main.dart index 9d9f6393ee2..abe44129426 100644 --- a/examples/platform_channel_swift/lib/main.dart +++ b/examples/platform_channel_swift/lib/main.dart @@ -37,10 +37,10 @@ class _PlatformChannelState extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ new RaisedButton( - child: new Text('Get Battery Level'), + child: const Text('Get Battery Level'), onPressed: _getBatteryLevel, ), - new Text(_batteryLevel, key: new Key('Battery level label')), + new Text(_batteryLevel, key: const Key('Battery level label')), ], ), ), diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart index 0ac3446cb77..75a3a47c411 100644 --- a/examples/stocks/lib/stock_home.dart +++ b/examples/stocks/lib/stock_home.dart @@ -20,21 +20,21 @@ class _NotImplementedDialog extends StatelessWidget { @override Widget build(BuildContext context) { return new AlertDialog( - title: new Text('Not Implemented'), - content: new Text('This feature has not yet been implemented.'), + title: const Text('Not Implemented'), + content: const Text('This feature has not yet been implemented.'), actions: [ new FlatButton( onPressed: debugDumpApp, child: new Row( children: [ - new Icon( + const Icon( Icons.dvr, size: 18.0, ), new Container( width: 8.0, ), - new Text('DUMP APP TO CONSOLE'), + const Text('DUMP APP TO CONSOLE'), ], ), ), @@ -42,7 +42,7 @@ class _NotImplementedDialog extends StatelessWidget { onPressed: () { Navigator.pop(context, false); }, - child: new Text('OH WELL'), + child: const Text('OH WELL'), ), ], ); @@ -117,20 +117,20 @@ class StockHomeState extends State { return new Drawer( child: new ListView( children: [ - new DrawerHeader(child: new Center(child: new Text('Stocks'))), + const DrawerHeader(child: const Center(child: const Text('Stocks'))), new ListTile( - leading: new Icon(Icons.assessment), - title: new Text('Stock List'), + leading: const Icon(Icons.assessment), + title: const Text('Stock List'), selected: true, ), new ListTile( - leading: new Icon(Icons.account_balance), - title: new Text('Account Balance'), + leading: const Icon(Icons.account_balance), + title: const Text('Account Balance'), enabled: false, ), new ListTile( - leading: new Icon(Icons.dvr), - title: new Text('Dump App to Console'), + leading: const Icon(Icons.dvr), + title: const Text('Dump App to Console'), onTap: () { try { debugDumpApp(); @@ -144,8 +144,8 @@ class StockHomeState extends State { ), new Divider(), new ListTile( - leading: new Icon(Icons.thumb_up), - title: new Text('Optimistic'), + leading: const Icon(Icons.thumb_up), + title: const Text('Optimistic'), trailing: new Radio( value: StockMode.optimistic, groupValue: config.configuration.stockMode, @@ -156,8 +156,8 @@ class StockHomeState extends State { }, ), new ListTile( - leading: new Icon(Icons.thumb_down), - title: new Text('Pessimistic'), + leading: const Icon(Icons.thumb_down), + title: const Text('Pessimistic'), trailing: new Radio( value: StockMode.pessimistic, groupValue: config.configuration.stockMode, @@ -169,13 +169,13 @@ class StockHomeState extends State { ), new Divider(), new ListTile( - leading: new Icon(Icons.settings), - title: new Text('Settings'), + leading: const Icon(Icons.settings), + title: const Text('Settings'), onTap: _handleShowSettings, ), new ListTile( - leading: new Icon(Icons.help), - title: new Text('About'), + leading: const Icon(Icons.help), + title: const Text('About'), onTap: _handleShowAbout, ), ], @@ -197,7 +197,7 @@ class StockHomeState extends State { title: new Text(StockStrings.of(context).title()), actions: [ new IconButton( - icon: new Icon(Icons.search), + icon: const Icon(Icons.search), onPressed: _handleSearchBegin, tooltip: 'Search', ), @@ -207,19 +207,19 @@ class StockHomeState extends State { new CheckedPopupMenuItem<_StockMenuItem>( value: _StockMenuItem.autorefresh, checked: _autorefresh, - child: new Text('Autorefresh'), + child: const Text('Autorefresh'), ), new PopupMenuItem<_StockMenuItem>( value: _StockMenuItem.refresh, - child: new Text('Refresh'), + child: const Text('Refresh'), ), new PopupMenuItem<_StockMenuItem>( value: _StockMenuItem.speedUp, - child: new Text('Increase animation speed'), + child: const Text('Increase animation speed'), ), new PopupMenuItem<_StockMenuItem>( value: _StockMenuItem.speedDown, - child: new Text('Decrease animation speed'), + child: const Text('Decrease animation speed'), ), ], ), @@ -287,7 +287,7 @@ class StockHomeState extends State { Widget buildSearchBar() { return new AppBar( leading: new IconButton( - icon: new Icon(Icons.arrow_back), + icon: const Icon(Icons.arrow_back), color: Theme.of(context).accentColor, onPressed: _handleSearchEnd, tooltip: 'Back', @@ -313,7 +313,7 @@ class StockHomeState extends State { Widget buildFloatingActionButton() { return new FloatingActionButton( tooltip: 'Create company', - child: new Icon(Icons.add), + child: const Icon(Icons.add), backgroundColor: Colors.redAccent, onPressed: _handleCreateCompany, ); diff --git a/examples/stocks/lib/stock_settings.dart b/examples/stocks/lib/stock_settings.dart index 1d93aa0829f..4865053ea5a 100644 --- a/examples/stocks/lib/stock_settings.dart +++ b/examples/stocks/lib/stock_settings.dart @@ -68,17 +68,17 @@ class StockSettingsState extends State { showDialog( context: context, child: new AlertDialog( - title: new Text("Change mode?"), - content: new Text("Optimistic mode means everything is awesome. Are you sure you can handle that?"), + title: const Text("Change mode?"), + content: const Text("Optimistic mode means everything is awesome. Are you sure you can handle that?"), actions: [ new FlatButton( - child: new Text('NO THANKS'), + child: const Text('NO THANKS'), onPressed: () { Navigator.pop(context, false); } ), new FlatButton( - child: new Text('AGREE'), + child: const Text('AGREE'), onPressed: () { Navigator.pop(context, true); } @@ -97,15 +97,15 @@ class StockSettingsState extends State { Widget buildAppBar(BuildContext context) { return new AppBar( - title: new Text('Settings') + title: const Text('Settings') ); } Widget buildSettingsPane(BuildContext context) { final List rows = [ new ListTile( - leading: new Icon(Icons.thumb_up), - title: new Text('Everything is awesome'), + leading: const Icon(Icons.thumb_up), + title: const Text('Everything is awesome'), onTap: _confirmOptimismChange, trailing: new Checkbox( value: config.configuration.stockMode == StockMode.optimistic, @@ -113,8 +113,8 @@ class StockSettingsState extends State { ), ), new ListTile( - leading: new Icon(Icons.backup), - title: new Text('Back up stock list to the cloud'), + leading: const Icon(Icons.backup), + title: const Text('Back up stock list to the cloud'), onTap: () { _handleBackupChanged(!(config.configuration.backupMode == BackupMode.enabled)); }, trailing: new Switch( value: config.configuration.backupMode == BackupMode.enabled, @@ -122,8 +122,8 @@ class StockSettingsState extends State { ), ), new ListTile( - leading: new Icon(Icons.picture_in_picture), - title: new Text('Show rendering performance overlay'), + leading: const Icon(Icons.picture_in_picture), + title: const Text('Show rendering performance overlay'), onTap: () { _handleShowPerformanceOverlayChanged(!config.configuration.showPerformanceOverlay); }, trailing: new Switch( value: config.configuration.showPerformanceOverlay, @@ -131,8 +131,8 @@ class StockSettingsState extends State { ), ), new ListTile( - leading: new Icon(Icons.accessibility), - title: new Text('Show semantics overlay'), + leading: const Icon(Icons.accessibility), + title: const Text('Show semantics overlay'), onTap: () { _handleShowSemanticsDebuggerChanged(!config.configuration.showSemanticsDebugger); }, trailing: new Switch( value: config.configuration.showSemanticsDebugger, @@ -144,8 +144,8 @@ class StockSettingsState extends State { // material grid and size construction lines are only available in checked mode rows.addAll([ new ListTile( - leading: new Icon(Icons.border_clear), - title: new Text('Show material grid (for debugging)'), + leading: const Icon(Icons.border_clear), + title: const Text('Show material grid (for debugging)'), onTap: () { _handleShowGridChanged(!config.configuration.debugShowGrid); }, trailing: new Switch( value: config.configuration.debugShowGrid, @@ -153,8 +153,8 @@ class StockSettingsState extends State { ), ), new ListTile( - leading: new Icon(Icons.border_all), - title: new Text('Show construction lines (for debugging)'), + leading: const Icon(Icons.border_all), + title: const Text('Show construction lines (for debugging)'), onTap: () { _handleShowSizesChanged(!config.configuration.debugShowSizes); }, trailing: new Switch( value: config.configuration.debugShowSizes, @@ -162,8 +162,8 @@ class StockSettingsState extends State { ), ), new ListTile( - leading: new Icon(Icons.format_color_text), - title: new Text('Show baselines (for debugging)'), + leading: const Icon(Icons.format_color_text), + title: const Text('Show baselines (for debugging)'), onTap: () { _handleShowBaselinesChanged(!config.configuration.debugShowBaselines); }, trailing: new Switch( value: config.configuration.debugShowBaselines, @@ -171,8 +171,8 @@ class StockSettingsState extends State { ), ), new ListTile( - leading: new Icon(Icons.filter_none), - title: new Text('Show layer boundaries (for debugging)'), + leading: const Icon(Icons.filter_none), + title: const Text('Show layer boundaries (for debugging)'), onTap: () { _handleShowLayersChanged(!config.configuration.debugShowLayers); }, trailing: new Switch( value: config.configuration.debugShowLayers, @@ -180,8 +180,8 @@ class StockSettingsState extends State { ), ), new ListTile( - leading: new Icon(Icons.mouse), - title: new Text('Show pointer hit-testing (for debugging)'), + leading: const Icon(Icons.mouse), + title: const Text('Show pointer hit-testing (for debugging)'), onTap: () { _handleShowPointersChanged(!config.configuration.debugShowPointers); }, trailing: new Switch( value: config.configuration.debugShowPointers, @@ -189,8 +189,8 @@ class StockSettingsState extends State { ), ), new ListTile( - leading: new Icon(Icons.gradient), - title: new Text('Show repaint rainbow (for debugging)'), + leading: const Icon(Icons.gradient), + title: const Text('Show repaint rainbow (for debugging)'), onTap: () { _handleShowRainbowChanged(!config.configuration.debugShowRainbow); }, trailing: new Switch( value: config.configuration.debugShowRainbow, diff --git a/examples/stocks/lib/stock_symbol_viewer.dart b/examples/stocks/lib/stock_symbol_viewer.dart index 6601d8193b8..153e9fbf10c 100644 --- a/examples/stocks/lib/stock_symbol_viewer.dart +++ b/examples/stocks/lib/stock_symbol_viewer.dart @@ -100,8 +100,8 @@ class StockSymbolBottomSheet extends StatelessWidget { Widget build(BuildContext context) { return new Container( padding: const EdgeInsets.all(10.0), - decoration: new BoxDecoration( - border: new Border(top: new BorderSide(color: Colors.black26)) + decoration: const BoxDecoration( + border: const Border(top: const BorderSide(color: Colors.black26)) ), child: new _StockSymbolView( stock: stock, diff --git a/packages/flutter/lib/src/material/about.dart b/packages/flutter/lib/src/material/about.dart index 3e6cd255e31..5d1f13adae4 100644 --- a/packages/flutter/lib/src/material/about.dart +++ b/packages/flutter/lib/src/material/about.dart @@ -290,7 +290,7 @@ class AboutDialog extends StatelessWidget { ), actions: [ new FlatButton( - child: new Text('VIEW LICENSES'), + child: const Text('VIEW LICENSES'), onPressed: () { showLicensePage( context: context, @@ -302,7 +302,7 @@ class AboutDialog extends StatelessWidget { } ), new FlatButton( - child: new Text('CLOSE'), + child: const Text('CLOSE'), onPressed: () { Navigator.pop(context); } @@ -377,9 +377,9 @@ class _LicensePageState extends State { if (!mounted) return; setState(() { - _licenses.add(new Padding( + _licenses.add(const Padding( padding: const EdgeInsets.symmetric(vertical: 18.0), - child: new Text( + child: const Text( '🍀‬', // That's U+1F340. Could also use U+2766 (❦) if U+1F340 doesn't work everywhere. textAlign: TextAlign.center ) @@ -443,7 +443,7 @@ class _LicensePageState extends State { } return new Scaffold( appBar: new AppBar( - title: new Text('Licenses') + title: const Text('Licenses') ), body: new DefaultTextStyle( style: Theme.of(context).textTheme.caption, diff --git a/packages/flutter/lib/src/material/data_table.dart b/packages/flutter/lib/src/material/data_table.dart index ff8b500a51c..039597bade2 100644 --- a/packages/flutter/lib/src/material/data_table.dart +++ b/packages/flutter/lib/src/material/data_table.dart @@ -450,7 +450,7 @@ class DataTable extends StatelessWidget { }) { final bool isLightTheme = Theme.of(context).brightness == Brightness.light; if (showEditIcon) { - final Widget icon = new Icon(Icons.edit, size: 18.0); + final Widget icon = const Icon(Icons.edit, size: 18.0); label = new Expanded(child: label); label = new Row(children: numeric ? [ icon, label ] : [ label, icon ]); } @@ -523,7 +523,7 @@ class DataTable extends StatelessWidget { int displayColumnIndex = 0; if (showCheckboxColumn) { - tableColumns[0] = new FixedColumnWidth(_kTablePadding + Checkbox.width + _kTablePadding / 2.0); + tableColumns[0] = const FixedColumnWidth(_kTablePadding + Checkbox.width + _kTablePadding / 2.0); tableRows[0].children[0] = _buildCheckbox( color: theme.accentColor, checked: allChecked, diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart index 8fe015696ca..f95b7695c50 100644 --- a/packages/flutter/lib/src/material/date_picker.dart +++ b/packages/flutter/lib/src/material/date_picker.dart @@ -677,11 +677,11 @@ class _DatePickerDialogState extends State<_DatePickerDialog> { child: new ButtonBar( children: [ new FlatButton( - child: new Text('CANCEL'), + child: const Text('CANCEL'), onPressed: _handleCancel, ), new FlatButton( - child: new Text('OK'), + child: const Text('OK'), onPressed: _handleOk, ), ], diff --git a/packages/flutter/lib/src/material/expand_icon.dart b/packages/flutter/lib/src/material/expand_icon.dart index d00c781ba52..3bb261d2d83 100644 --- a/packages/flutter/lib/src/material/expand_icon.dart +++ b/packages/flutter/lib/src/material/expand_icon.dart @@ -107,7 +107,7 @@ class _ExpandIconState extends State with SingleTickerProviderStateM onPressed: config.onPressed == null ? null : _handlePressed, icon: new RotationTransition( turns: _iconTurns, - child: new Icon(Icons.expand_more) + child: const Icon(Icons.expand_more) ) ); } diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index ef430cdc7b5..1b543e71b39 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -305,7 +305,7 @@ class InputDecorator extends StatelessWidget { if (decoration.hideDivider) { return new Container( - margin: margin + new EdgeInsets.only(bottom: bottomBorder), + margin: margin + const EdgeInsets.only(bottom: bottomBorder), padding: padding, child: child, ); diff --git a/packages/flutter/lib/src/material/list_tile.dart b/packages/flutter/lib/src/material/list_tile.dart index 6713e88e049..a0d856add79 100644 --- a/packages/flutter/lib/src/material/list_tile.dart +++ b/packages/flutter/lib/src/material/list_tile.dart @@ -106,7 +106,7 @@ class ListTileTheme extends InheritedWidget { /// ``` static ListTileTheme of(BuildContext context) { final ListTileTheme result = context.inheritFromWidgetOfExactType(ListTileTheme); - return result ?? new ListTileTheme(); + return result ?? const ListTileTheme(); } @override diff --git a/packages/flutter/lib/src/material/paginated_data_table.dart b/packages/flutter/lib/src/material/paginated_data_table.dart index ba2423a6613..f2d40c7eabf 100644 --- a/packages/flutter/lib/src/material/paginated_data_table.dart +++ b/packages/flutter/lib/src/material/paginated_data_table.dart @@ -298,7 +298,7 @@ class PaginatedDataTableState extends State { } } else if (_selectedRowCount == 1) { // TODO(ianh): Real l10n. - headerWidgets.add(new Expanded(child: new Text('1 item selected'))); + headerWidgets.add(const Expanded(child: const Text('1 item selected'))); } else { headerWidgets.add(new Expanded(child: new Text('$_selectedRowCount items selected'))); } @@ -328,7 +328,7 @@ class PaginatedDataTableState extends State { }) .toList(); footerWidgets.addAll([ - new Text('Rows per page:'), + const Text('Rows per page:'), new DropdownButtonHideUnderline( child: new DropdownButton( items: availableRowsPerPage, @@ -347,7 +347,7 @@ class PaginatedDataTableState extends State { ), new Container(width: 32.0), new IconButton( - icon: new Icon(Icons.chevron_left), + icon: const Icon(Icons.chevron_left), padding: EdgeInsets.zero, tooltip: 'Previous page', onPressed: _firstRowIndex <= 0 ? null : () { @@ -356,7 +356,7 @@ class PaginatedDataTableState extends State { ), new Container(width: 24.0), new IconButton( - icon: new Icon(Icons.chevron_right), + icon: const Icon(Icons.chevron_right), padding: EdgeInsets.zero, tooltip: 'Next page', onPressed: (!_rowCountApproximate && (_firstRowIndex + config.rowsPerPage >= _rowCount)) ? null : () { diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart index fea0e7b6c20..06bb4a93ec9 100644 --- a/packages/flutter/lib/src/material/popup_menu.dart +++ b/packages/flutter/lib/src/material/popup_menu.dart @@ -547,7 +547,7 @@ class _PopupMenuButtonState extends State> { Widget build(BuildContext context) { if (config.child == null) { return new IconButton( - icon: new Icon(Icons.more_vert), + icon: const Icon(Icons.more_vert), padding: config.padding, tooltip: config.tooltip, onPressed: showButtonMenu, diff --git a/packages/flutter/lib/src/material/stepper.dart b/packages/flutter/lib/src/material/stepper.dart index b7771a9008b..48add10658d 100644 --- a/packages/flutter/lib/src/material/stepper.dart +++ b/packages/flutter/lib/src/material/stepper.dart @@ -249,7 +249,7 @@ class _StepperState extends State with TickerProviderStateMixin { color: isDarkActive ? _kCircleActiveDark : _kCircleActiveLight, ); case StepState.error: - return new Text('!', style: _kStepStyle); + return const Text('!', style: _kStepStyle); } return null; } @@ -351,7 +351,7 @@ class _StepperState extends State with TickerProviderStateMixin { color: _isDark() ? themeData.backgroundColor : themeData.primaryColor, textColor: Colors.white, textTheme: ButtonTextTheme.normal, - child: new Text('CONTINUE'), + child: const Text('CONTINUE'), ), new Container( margin: const EdgeInsets.only(left: 8.0), @@ -359,7 +359,7 @@ class _StepperState extends State with TickerProviderStateMixin { onPressed: config.onStepCancel, textColor: cancelColor, textTheme: ButtonTextTheme.normal, - child: new Text('CANCEL'), + child: const Text('CANCEL'), ), ), ], diff --git a/packages/flutter/lib/src/material/text_selection.dart b/packages/flutter/lib/src/material/text_selection.dart index f56d6c32030..e3e268d07e4 100644 --- a/packages/flutter/lib/src/material/text_selection.dart +++ b/packages/flutter/lib/src/material/text_selection.dart @@ -27,17 +27,17 @@ class _TextSelectionToolbar extends StatelessWidget { final List items = []; if (!value.selection.isCollapsed) { - items.add(new FlatButton(child: new Text('CUT'), onPressed: _handleCut)); - items.add(new FlatButton(child: new Text('COPY'), onPressed: _handleCopy)); + items.add(new FlatButton(child: const Text('CUT'), onPressed: _handleCut)); + items.add(new FlatButton(child: const Text('COPY'), onPressed: _handleCopy)); } items.add(new FlatButton( - child: new Text('PASTE'), + child: const Text('PASTE'), // TODO(mpcomplete): This should probably be grayed-out if there is nothing to paste. onPressed: _handlePaste )); if (value.text.isNotEmpty) { if (value.selection.isCollapsed) - items.add(new FlatButton(child: new Text('SELECT ALL'), onPressed: _handleSelectAll)); + items.add(new FlatButton(child: const Text('SELECT ALL'), onPressed: _handleSelectAll)); } return new Material( diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart index 50b47f75585..57d65e48e88 100644 --- a/packages/flutter/lib/src/material/time_picker.dart +++ b/packages/flutter/lib/src/material/time_picker.dart @@ -702,11 +702,11 @@ class _TimePickerDialogState extends State<_TimePickerDialog> { child: new ButtonBar( children: [ new FlatButton( - child: new Text('CANCEL'), + child: const Text('CANCEL'), onPressed: _handleCancel ), new FlatButton( - child: new Text('OK'), + child: const Text('OK'), onPressed: _handleOk ), ] diff --git a/packages/flutter/lib/src/material/two_level_list.dart b/packages/flutter/lib/src/material/two_level_list.dart index 7be3b571098..4203e30ecad 100644 --- a/packages/flutter/lib/src/material/two_level_list.dart +++ b/packages/flutter/lib/src/material/two_level_list.dart @@ -213,7 +213,7 @@ class _TwoLevelSublistState extends State with SingleTickerProv ), trailing: new RotationTransition( turns: _iconTurns, - child: new Icon(Icons.expand_more) + child: const Icon(Icons.expand_more) ) ) ), diff --git a/packages/flutter/lib/src/widgets/container.dart b/packages/flutter/lib/src/widgets/container.dart index 80b757387ed..09f64b336cb 100644 --- a/packages/flutter/lib/src/widgets/container.dart +++ b/packages/flutter/lib/src/widgets/container.dart @@ -21,15 +21,14 @@ class DecoratedBox extends SingleChildRenderObjectWidget { /// /// The [decoration] and [position] arguments must not be null. By default the /// decoration paints behind the child. - DecoratedBox({ + const DecoratedBox({ Key key, @required this.decoration, this.position: DecorationPosition.background, Widget child - }) : super(key: key, child: child) { - assert(decoration != null); - assert(position != null); - } + }) : assert(decoration != null), + assert(position != null), + super(key: key, child: child); /// What decoration to paint. /// diff --git a/packages/flutter/lib/src/widgets/text.dart b/packages/flutter/lib/src/widgets/text.dart index 8a35833a7c5..98abbcc4fd7 100644 --- a/packages/flutter/lib/src/widgets/text.dart +++ b/packages/flutter/lib/src/widgets/text.dart @@ -14,7 +14,7 @@ class DefaultTextStyle extends InheritedWidget { /// /// Consider using [DefaultTextStyle.merge] to inherit styling information /// from the current default text style for a given [BuildContext]. - DefaultTextStyle({ + const DefaultTextStyle({ Key key, @required this.style, this.textAlign, @@ -22,12 +22,11 @@ class DefaultTextStyle extends InheritedWidget { this.overflow: TextOverflow.clip, this.maxLines, @required Widget child, - }) : super(key: key, child: child) { - assert(style != null); - assert(softWrap != null); - assert(overflow != null); - assert(child != null); - } + }) : assert(style != null), + assert(softWrap != null), + assert(overflow != null), + assert(child != null), + super(key: key, child: child); /// A const-constructible default text style that provides fallback values. /// @@ -140,7 +139,7 @@ class Text extends StatelessWidget { /// /// If the [style] argument is null, the text will use the style from the /// closest enclosing [DefaultTextStyle]. - Text(this.data, { + const Text(this.data, { Key key, this.style, this.textAlign, @@ -148,9 +147,8 @@ class Text extends StatelessWidget { this.overflow, this.textScaleFactor, this.maxLines, - }) : super(key: key) { - assert(data != null); - } + }) : assert(data != null), + super(key: key); /// The text to display. final String data; diff --git a/packages/flutter/test/cupertino/button_test.dart b/packages/flutter/test/cupertino/button_test.dart index ba8e73176c2..b769827c47e 100644 --- a/packages/flutter/test/cupertino/button_test.dart +++ b/packages/flutter/test/cupertino/button_test.dart @@ -16,7 +16,7 @@ void main() { testWidgets('Default layout minimum size', (WidgetTester tester) async { await tester.pumpWidget( new Center(child: new CupertinoButton( - child: new Text('X', style: testStyle), + child: const Text('X', style: testStyle), onPressed: null, )) ); @@ -32,7 +32,7 @@ void main() { final double minSize = 60.0; await tester.pumpWidget( new Center(child: new CupertinoButton( - child: new Text('X', style: testStyle), + child: const Text('X', style: testStyle), onPressed: null, minSize: minSize, )) @@ -48,7 +48,7 @@ void main() { testWidgets('Size grows with text', (WidgetTester tester) async { await tester.pumpWidget( new Center(child: new CupertinoButton( - child: new Text('XXXX', style: testStyle), + child: const Text('XXXX', style: testStyle), onPressed: null, )) ); @@ -62,7 +62,7 @@ void main() { testWidgets('Button with background is wider', (WidgetTester tester) async { await tester.pumpWidget(new Center(child: new CupertinoButton( - child: new Text('X', style: testStyle), + child: const Text('X', style: testStyle), onPressed: null, color: const Color(0xFFFFFFFF), ))); @@ -76,7 +76,7 @@ void main() { testWidgets('Custom padding', (WidgetTester tester) async { await tester.pumpWidget(new Center(child: new CupertinoButton( - child: new Text(' ', style: testStyle), + child: const Text(' ', style: testStyle), onPressed: null, padding: const EdgeInsets.all(100.0), ))); @@ -94,7 +94,7 @@ void main() { builder: (BuildContext context, StateSetter setState) { return new Center( child: new CupertinoButton( - child: new Text('Tap me'), + child: const Text('Tap me'), onPressed: () { setState(() { value = true; @@ -117,7 +117,7 @@ void main() { testWidgets('Disabled button doesn\'t animate', (WidgetTester tester) async { await tester.pumpWidget(new Center(child: new CupertinoButton( - child: new Text('Tap me'), + child: const Text('Tap me'), onPressed: null, ))); expect(SchedulerBinding.instance.transientCallbackCount, equals(0)); @@ -128,7 +128,7 @@ void main() { testWidgets('pressedOpacity defaults to 0.1', (WidgetTester tester) async { await tester.pumpWidget(new Center(child: new CupertinoButton( - child: new Text('Tap me'), + child: const Text('Tap me'), onPressed: () { }, ))); @@ -149,7 +149,7 @@ void main() { final double pressedOpacity = 0.5; await tester.pumpWidget(new Center(child: new CupertinoButton( pressedOpacity: pressedOpacity, - child: new Text('Tap me'), + child: const Text('Tap me'), onPressed: () { }, ))); diff --git a/packages/flutter/test/cupertino/dialog_test.dart b/packages/flutter/test/cupertino/dialog_test.dart index 91f00fcad2d..82266c3f2d6 100644 --- a/packages/flutter/test/cupertino/dialog_test.dart +++ b/packages/flutter/test/cupertino/dialog_test.dart @@ -20,11 +20,11 @@ void main() { showDialog( context: context, child: new CupertinoAlertDialog( - title: new Text('The title'), - content: new Text('The content'), + title: const Text('The title'), + content: const Text('The content'), actions: [ new CupertinoDialogAction( - child: new Text('Cancel'), + child: const Text('Cancel'), ), new CupertinoDialogAction( isDestructive: true, @@ -32,13 +32,13 @@ void main() { didDelete = true; Navigator.pop(context); }, - child: new Text('Delete'), + child: const Text('Delete'), ), ], ), ); }, - child: new Text('Go'), + child: const Text('Go'), ); }, ), @@ -66,7 +66,7 @@ void main() { testWidgets('Dialog action styles', (WidgetTester tester) async { await tester.pumpWidget(new CupertinoDialogAction( isDestructive: true, - child: new Text('Ok'), + child: const Text('Ok'), )); final DefaultTextStyle widget = tester.widget(find.byType(DefaultTextStyle)); diff --git a/packages/flutter/test/foundation/error_reporting_test.dart b/packages/flutter/test/foundation/error_reporting_test.dart index 028619ba454..6bf6f8e4b6e 100644 --- a/packages/flutter/test/foundation/error_reporting_test.dart +++ b/packages/flutter/test/foundation/error_reporting_test.dart @@ -199,7 +199,7 @@ Future main() async { test('Error reporting - NoSuchMethodError', () async { expect(console, isEmpty); - FlutterError.dumpErrorToConsole(new FlutterErrorDetails( + FlutterError.dumpErrorToConsole(const FlutterErrorDetails( exception: 'hello', )); expect(console.join('\n'), matches(new RegExp( @@ -209,7 +209,7 @@ Future main() async { '════════════════════════════════════════════════════════════════════════════════════════════════════\$', ))); console.clear(); - FlutterError.dumpErrorToConsole(new FlutterErrorDetails( + FlutterError.dumpErrorToConsole(const FlutterErrorDetails( exception: 'hello again', )); expect(console.join('\n'), 'Another exception was thrown: hello again'); diff --git a/packages/flutter/test/material/about_test.dart b/packages/flutter/test/material/about_test.dart index 921c0aa09bc..233353f7bbf 100644 --- a/packages/flutter/test/material/about_test.dart +++ b/packages/flutter/test/material/about_test.dart @@ -15,7 +15,7 @@ void main() { title: 'Pirate app', home: new Scaffold( appBar: new AppBar( - title: new Text('Home'), + title: const Text('Home'), ), drawer: new Drawer( child: new ListView( @@ -25,7 +25,7 @@ void main() { applicationIcon: const FlutterLogo(), applicationLegalese: 'I am the very model of a modern major general.', aboutBoxChildren: [ - new Text('About box'), + const Text('About box'), ] ), ], @@ -89,7 +89,7 @@ void main() { ]); }); - await tester.pumpWidget(new Center( + await tester.pumpWidget(const Center( child: const LicensePage() )); diff --git a/packages/flutter/test/material/app_bar_test.dart b/packages/flutter/test/material/app_bar_test.dart index 82d2d75675f..e1e17d0ca44 100644 --- a/packages/flutter/test/material/app_bar_test.dart +++ b/packages/flutter/test/material/app_bar_test.dart @@ -15,7 +15,7 @@ Widget buildSliverAppBarApp({ bool floating, bool pinned, double expandedHeight primary: true, slivers: [ new SliverAppBar( - title: new Text('AppBar Title'), + title: const Text('AppBar Title'), floating: floating, pinned: pinned, expandedHeight: expandedHeight, @@ -63,7 +63,7 @@ void main() { theme: new ThemeData(platform: TargetPlatform.android), home: new Scaffold( appBar: new AppBar( - title: new Text('X'), + title: const Text('X'), ), ), ), @@ -82,7 +82,7 @@ void main() { theme: new ThemeData(platform: TargetPlatform.iOS), home: new Scaffold( appBar: new AppBar( - title: new Text('X'), + title: const Text('X'), ), ), ), @@ -101,7 +101,7 @@ void main() { home: new Scaffold( appBar: new AppBar( centerTitle: true, - title: new Text('X'), + title: const Text('X'), ) ) ) @@ -121,7 +121,7 @@ void main() { home: new Scaffold( appBar: new AppBar( centerTitle: false, - title: new Text('X'), + title: const Text('X'), ), ), ), @@ -138,7 +138,7 @@ void main() { home: new Scaffold( appBar: new AppBar( centerTitle: false, - title: new Text('X'), + title: const Text('X'), ), // A drawer causes a leading hamburger. drawer: new Drawer(), @@ -254,9 +254,9 @@ void main() { new SizedBox( height: kToolbarHeight, child: new AppBar( - leading: new Text('L'), - title: new Text('No Scaffold'), - actions: [new Text('A1'), new Text('A2')], + leading: const Text('L'), + title: const Text('No Scaffold'), + actions: [const Text('A1'), const Text('A2')], ), ), ); @@ -276,7 +276,7 @@ void main() { width: 0.0, child: new Scaffold( appBar: new AppBar( - title: new Text('X'), + title: const Text('X'), ), ), ), @@ -325,7 +325,7 @@ void main() { theme: new ThemeData(platform: TargetPlatform.android), home: new Scaffold( appBar: new AppBar( - title: new Text('X'), + title: const Text('X'), ), drawer: new Column(), // Doesn't really matter. Triggers a hamburger regardless. ), @@ -343,16 +343,16 @@ void main() { theme: new ThemeData(platform: TargetPlatform.android), home: new Scaffold( appBar: new AppBar( - title: new Text('X'), + title: const Text('X'), actions: [ - new IconButton( - icon: new Icon(Icons.share), + const IconButton( + icon: const Icon(Icons.share), onPressed: null, tooltip: 'Share', iconSize: 20.0, ), - new IconButton( - icon: new Icon(Icons.add), + const IconButton( + icon: const Icon(Icons.add), onPressed: null, tooltip: 'Add', iconSize: 60.0, diff --git a/packages/flutter/test/material/app_test.dart b/packages/flutter/test/material/app_test.dart index 96d96104495..f9a7a8aa2a1 100644 --- a/packages/flutter/test/material/app_test.dart +++ b/packages/flutter/test/material/app_test.dart @@ -30,7 +30,7 @@ void main() { await tester.pumpWidget( new MaterialApp( home: new MaterialApp( - home: new Text('Home sweet home'), + home: const Text('Home sweet home'), ), ), ); @@ -58,7 +58,7 @@ void main() { autofocus: true, node: focusScopeNode, child: new MaterialApp( - home: new Text('Home'), + home: const Text('Home'), ), )); @@ -95,7 +95,7 @@ void main() { builder: (BuildContext context) { return new Material( child: new RaisedButton( - child: new Text('X'), + child: const Text('X'), onPressed: () { Navigator.of(context).pushNamed('/next'); }, ), ); @@ -132,7 +132,7 @@ void main() { }); testWidgets('Cannot pop the initial route', (WidgetTester tester) async { - await tester.pumpWidget(new MaterialApp(home: new Text('Home'))); + await tester.pumpWidget(new MaterialApp(home: const Text('Home'))); expect(find.text('Home'), findsOneWidget); diff --git a/packages/flutter/test/material/back_button_test.dart b/packages/flutter/test/material/back_button_test.dart index 526b8615863..489fbadc8f2 100644 --- a/packages/flutter/test/material/back_button_test.dart +++ b/packages/flutter/test/material/back_button_test.dart @@ -9,11 +9,11 @@ void main() { testWidgets('BackButton control test', (WidgetTester tester) async { await tester.pumpWidget( new MaterialApp( - home: new Material(child: new Text('Home')), + home: new Material(child: const Text('Home')), routes: { '/next': (BuildContext context) { return new Material( - child: new Center( + child: const Center( child: const BackButton(), ) ); diff --git a/packages/flutter/test/material/bottom_navigation_bar_test.dart b/packages/flutter/test/material/bottom_navigation_bar_test.dart index 1642cbc2b8e..c8de2b44c00 100644 --- a/packages/flutter/test/material/bottom_navigation_bar_test.dart +++ b/packages/flutter/test/material/bottom_navigation_bar_test.dart @@ -14,12 +14,12 @@ void main() { bottomNavigationBar: new BottomNavigationBar( items: [ new BottomNavigationBarItem( - icon: new Icon(Icons.ac_unit), - title: new Text('AC') + icon: const Icon(Icons.ac_unit), + title: const Text('AC') ), new BottomNavigationBarItem( - icon: new Icon(Icons.access_alarm), - title: new Text('Alarm') + icon: const Icon(Icons.access_alarm), + title: const Text('Alarm') ) ], onTap: (int index) { @@ -40,12 +40,12 @@ void main() { bottomNavigationBar: new BottomNavigationBar( items: [ new BottomNavigationBarItem( - icon: new Icon(Icons.ac_unit), - title: new Text('AC') + icon: const Icon(Icons.ac_unit), + title: const Text('AC') ), new BottomNavigationBarItem( - icon: new Icon(Icons.access_alarm), - title: new Text('Alarm') + icon: const Icon(Icons.access_alarm), + title: const Text('Alarm') ) ] ) @@ -65,12 +65,12 @@ void main() { type: BottomNavigationBarType.shifting, items: [ new BottomNavigationBarItem( - icon: new Icon(Icons.ac_unit), - title: new Text('AC') + icon: const Icon(Icons.ac_unit), + title: const Text('AC') ), new BottomNavigationBarItem( - icon: new Icon(Icons.access_alarm), - title: new Text('Alarm') + icon: const Icon(Icons.access_alarm), + title: const Text('Alarm') ) ] ) @@ -89,12 +89,12 @@ void main() { type: BottomNavigationBarType.shifting, items: [ new BottomNavigationBarItem( - icon: new Icon(Icons.ac_unit), - title: new Text('AC') + icon: const Icon(Icons.ac_unit), + title: const Text('AC') ), new BottomNavigationBarItem( - icon: new Icon(Icons.access_alarm), - title: new Text('Alarm') + icon: const Icon(Icons.access_alarm), + title: const Text('Alarm') ) ] ) @@ -116,20 +116,20 @@ void main() { type: BottomNavigationBarType.shifting, items: [ new BottomNavigationBarItem( - icon: new Icon(Icons.ac_unit), - title: new Text('AC') + icon: const Icon(Icons.ac_unit), + title: const Text('AC') ), new BottomNavigationBarItem( - icon: new Icon(Icons.access_alarm), - title: new Text('Alarm') + icon: const Icon(Icons.access_alarm), + title: const Text('Alarm') ), new BottomNavigationBarItem( - icon: new Icon(Icons.access_time), - title: new Text('Time') + icon: const Icon(Icons.access_time), + title: const Text('Time') ), new BottomNavigationBarItem( - icon: new Icon(Icons.add), - title: new Text('Add') + icon: const Icon(Icons.add), + title: const Text('Add') ) ] ) @@ -176,20 +176,20 @@ void main() { type: BottomNavigationBarType.shifting, items: [ new BottomNavigationBarItem( - icon: new Icon(Icons.ac_unit), - title: new Text('AC') + icon: const Icon(Icons.ac_unit), + title: const Text('AC') ), new BottomNavigationBarItem( - icon: new Icon(Icons.access_alarm), - title: new Text('Alarm') + icon: const Icon(Icons.access_alarm), + title: const Text('Alarm') ), new BottomNavigationBarItem( - icon: new Icon(Icons.access_time), - title: new Text('Time') + icon: const Icon(Icons.access_time), + title: const Text('Time') ), new BottomNavigationBarItem( - icon: new Icon(Icons.add), - title: new Text('Add') + icon: const Icon(Icons.add), + title: const Text('Add') ) ] ) @@ -214,20 +214,20 @@ void main() { type: BottomNavigationBarType.fixed, items: [ new BottomNavigationBarItem( - icon: new Icon(Icons.ac_unit), - title: new Text('AC') + icon: const Icon(Icons.ac_unit), + title: const Text('AC') ), new BottomNavigationBarItem( - icon: new Icon(Icons.access_alarm), - title: new Text('Alarm') + icon: const Icon(Icons.access_alarm), + title: const Text('Alarm') ), new BottomNavigationBarItem( - icon: new Icon(Icons.access_time), - title: new Text('Time') + icon: const Icon(Icons.access_time), + title: const Text('Time') ), new BottomNavigationBarItem( - icon: new Icon(Icons.add), - title: new Text('Add') + icon: const Icon(Icons.add), + title: const Text('Add') ) ] ) @@ -249,11 +249,11 @@ void main() { iconSize: 12.0, items: [ new BottomNavigationBarItem( - title: new Text('A'), - icon: new Icon(Icons.ac_unit), + title: const Text('A'), + icon: const Icon(Icons.ac_unit), ), new BottomNavigationBarItem( - title: new Text('B'), + title: const Text('B'), icon: new Builder( builder: (BuildContext context) { builderIconSize = IconTheme.of(context).size; diff --git a/packages/flutter/test/material/buttons_test.dart b/packages/flutter/test/material/buttons_test.dart index 4fe8fc9985c..558a4bcbc8b 100644 --- a/packages/flutter/test/material/buttons_test.dart +++ b/packages/flutter/test/material/buttons_test.dart @@ -18,7 +18,7 @@ void main() { child: new Center( child: new FlatButton( onPressed: () { }, - child: new Text('ABC') + child: const Text('ABC') ) ) ) @@ -43,8 +43,8 @@ void main() { }); testWidgets('Does button highlight + splash colors work if set directly', (WidgetTester tester) async { - final Color directSplashColor = new Color(0xFF000011); - final Color directHighlightColor = new Color(0xFF000011); + final Color directSplashColor = const Color(0xFF000011); + final Color directHighlightColor = const Color(0xFF000011); Widget buttonWidget = new Material( child: new Center( @@ -66,7 +66,7 @@ void main() { final Point center = tester.getCenter(find.byType(MaterialButton)); final TestGesture gesture = await tester.startGesture(center); await tester.pump(); // start gesture - await tester.pump(new Duration(milliseconds: 200)); // wait for splash to be well under way + await tester.pump(const Duration(milliseconds: 200)); // wait for splash to be well under way expect( Material.of(tester.element(find.byType(MaterialButton))), @@ -75,8 +75,8 @@ void main() { ..rrect(color: directHighlightColor) ); - final Color themeSplashColor1 = new Color(0xFF001100); - final Color themeHighlightColor1 = new Color(0xFF001100); + final Color themeSplashColor1 = const Color(0xFF001100); + final Color themeHighlightColor1 = const Color(0xFF001100); buttonWidget = new Material( child: new Center( @@ -103,8 +103,8 @@ void main() { ..rrect(color: themeHighlightColor1) ); - final Color themeSplashColor2 = new Color(0xFF002200); - final Color themeHighlightColor2 = new Color(0xFF002200); + final Color themeSplashColor2 = const Color(0xFF002200); + final Color themeHighlightColor2 = const Color(0xFF002200); await tester.pumpWidget( new Theme( diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart index f9fea61bcc5..1461f73842c 100644 --- a/packages/flutter/test/material/chip_test.dart +++ b/packages/flutter/test/material/chip_test.dart @@ -14,9 +14,9 @@ void main() { child: new Center( child: new Chip( avatar: new CircleAvatar( - child: new Text('C') + child: const Text('C') ), - label: new Text('Chip'), + label: const Text('Chip'), onDeleted: () { didDeleteChip = true; } diff --git a/packages/flutter/test/material/circle_avatar_test.dart b/packages/flutter/test/material/circle_avatar_test.dart index b73caff5cd6..6ff3bd6e570 100644 --- a/packages/flutter/test/material/circle_avatar_test.dart +++ b/packages/flutter/test/material/circle_avatar_test.dart @@ -14,7 +14,7 @@ void main() { child: new CircleAvatar( backgroundColor: backgroundColor, radius: 50.0, - child: new Text('Z'), + child: const Text('Z'), ), ), ); @@ -36,7 +36,7 @@ void main() { new Center( child: new CircleAvatar( foregroundColor: foregroundColor, - child: new Text('Z'), + child: const Text('Z'), ), ), ); @@ -64,7 +64,7 @@ void main() { data: theme, child: new Center( child: new CircleAvatar( - child: new Text('Z'), + child: const Text('Z'), ), ), ), diff --git a/packages/flutter/test/material/colors_test.dart b/packages/flutter/test/material/colors_test.dart index cfab64edf61..0d26b1c7488 100644 --- a/packages/flutter/test/material/colors_test.dart +++ b/packages/flutter/test/material/colors_test.dart @@ -11,7 +11,7 @@ const List accentKeys = const [100, 200, 400, 700]; void main() { test('MaterialColor basic functionality', () { - final MaterialColor color = new MaterialColor( + final MaterialColor color = const MaterialColor( 500, const { 50: const Color(50), diff --git a/packages/flutter/test/material/data_table_test.dart b/packages/flutter/test/material/data_table_test.dart index ff3efee4f89..08cdfd70f22 100644 --- a/packages/flutter/test/material/data_table_test.dart +++ b/packages/flutter/test/material/data_table_test.dart @@ -19,12 +19,12 @@ void main() { log.add('select-all: $value'); }, columns: [ - new DataColumn( - label: new Text('Name'), + const DataColumn( + label: const Text('Name'), tooltip: 'Name', ), new DataColumn( - label: new Text('Calories'), + label: const Text('Calories'), tooltip: 'Calories', numeric: true, onSort: (int columnIndex, bool ascending) { diff --git a/packages/flutter/test/material/date_picker_test.dart b/packages/flutter/test/material/date_picker_test.dart index dc08b0207d8..de33bec9afe 100644 --- a/packages/flutter/test/material/date_picker_test.dart +++ b/packages/flutter/test/material/date_picker_test.dart @@ -127,7 +127,7 @@ void main() { onPressed: () { buttonContext = context; }, - child: new Text('Go'), + child: const Text('Go'), ); }, ), diff --git a/packages/flutter/test/material/debug_test.dart b/packages/flutter/test/material/debug_test.dart index 06a7fc4f518..76f14fa591b 100644 --- a/packages/flutter/test/material/debug_test.dart +++ b/packages/flutter/test/material/debug_test.dart @@ -9,7 +9,7 @@ void main() { testWidgets('debugCheckHasMaterial control test', (WidgetTester tester) async { await tester.pumpWidget(new FlatButton( onPressed: null, - child: new Text('Go'), + child: const Text('Go'), )); expect(tester.takeException(), isFlutterError); }); diff --git a/packages/flutter/test/material/dialog_test.dart b/packages/flutter/test/material/dialog_test.dart index b1fbb4ce46e..f947cea2d60 100644 --- a/packages/flutter/test/material/dialog_test.dart +++ b/packages/flutter/test/material/dialog_test.dart @@ -16,7 +16,7 @@ void main() { builder: (BuildContext context) { return new Center( child: new RaisedButton( - child: new Text('X'), + child: const Text('X'), onPressed: () { showDialog( context: context, @@ -33,7 +33,7 @@ void main() { onPressed: () { didPressOk = true; }, - child: new Text('OK') + child: const Text('OK') ) ] ) @@ -66,13 +66,13 @@ void main() { builder: (BuildContext context) { return new Center( child: new RaisedButton( - child: new Text('X'), + child: const Text('X'), onPressed: () { showDialog( context: context, child: new AlertDialog( - title: new Text('Title'), - content: new Text('Y'), + title: const Text('Title'), + content: const Text('Y'), actions: [ ], ), ); @@ -104,7 +104,7 @@ void main() { child: new Center( child: new RaisedButton( onPressed: null, - child: new Text('Go'), + child: const Text('Go'), ), ), ), @@ -116,16 +116,16 @@ void main() { final Future result = showDialog( context: context, child: new SimpleDialog( - title: new Text('Title'), + title: const Text('Title'), children: [ new SimpleDialogOption( onPressed: () { Navigator.pop(context, 42); }, - child: new Text('First option'), + child: const Text('First option'), ), new SimpleDialogOption( - child: new Text('Second option'), + child: const Text('Second option'), ), ], ), @@ -145,7 +145,7 @@ void main() { child: new Center( child: new RaisedButton( onPressed: null, - child: new Text('Go'), + child: const Text('Go'), ), ), ), @@ -160,7 +160,7 @@ void main() { width: 100.0, height: 100.0, alignment: FractionalOffset.center, - child: new Text('Dialog1'), + child: const Text('Dialog1'), ), ); @@ -180,7 +180,7 @@ void main() { width: 100.0, height: 100.0, alignment: FractionalOffset.center, - child: new Text('Dialog2'), + child: const Text('Dialog2'), ), ); diff --git a/packages/flutter/test/material/drawer_test.dart b/packages/flutter/test/material/drawer_test.dart index 980bb04f33f..d73593b4cc8 100644 --- a/packages/flutter/test/material/drawer_test.dart +++ b/packages/flutter/test/material/drawer_test.dart @@ -17,12 +17,12 @@ void main() { new DrawerHeader( child: new Container( key: containerKey, - child: new Text('header') + child: const Text('header') ) ), new ListTile( - leading: new Icon(Icons.archive), - title: new Text('Archive') + leading: const Icon(Icons.archive), + title: const Text('Archive') ) ] ) diff --git a/packages/flutter/test/material/dropdown_test.dart b/packages/flutter/test/material/dropdown_test.dart index d5a2da0bd91..cb0417bb57f 100644 --- a/packages/flutter/test/material/dropdown_test.dart +++ b/packages/flutter/test/material/dropdown_test.dart @@ -329,7 +329,7 @@ void main() { String value; // The hint will define the dropdown's width - Widget build() => buildFrame(buttonKey: buttonKey, value: value, hint: new Text('onetwothree')); + Widget build() => buildFrame(buttonKey: buttonKey, value: value, hint: const Text('onetwothree')); await tester.pumpWidget(build()); expect(find.text('onetwothree'), findsOneWidget); diff --git a/packages/flutter/test/material/flexible_space_bar_test.dart b/packages/flutter/test/material/flexible_space_bar_test.dart index 43b264ef21d..b705d13ac60 100644 --- a/packages/flutter/test/material/flexible_space_bar_test.dart +++ b/packages/flutter/test/material/flexible_space_bar_test.dart @@ -13,7 +13,7 @@ void main() { home: new Scaffold( appBar: new AppBar( flexibleSpace: new FlexibleSpaceBar( - title: new Text('X') + title: const Text('X') ) ) ) @@ -34,7 +34,7 @@ void main() { home: new Scaffold( appBar: new AppBar( flexibleSpace: new FlexibleSpaceBar( - title: new Text('X') + title: const Text('X') ) ) ) diff --git a/packages/flutter/test/material/floating_action_button_test.dart b/packages/flutter/test/material/floating_action_button_test.dart index cf8ba7d8bf5..50172710618 100644 --- a/packages/flutter/test/material/floating_action_button_test.dart +++ b/packages/flutter/test/material/floating_action_button_test.dart @@ -15,7 +15,7 @@ void main() { onPressed: () { didPressButton = true; }, - child: new Icon(Icons.add), + child: const Icon(Icons.add), ), ), ); @@ -29,10 +29,10 @@ void main() { await tester.pumpWidget( new MaterialApp( home: new Scaffold( - floatingActionButton: new FloatingActionButton( + floatingActionButton: const FloatingActionButton( onPressed: null, tooltip: 'Add', - child: new Icon(Icons.add), + child: const Icon(Icons.add), ), ), ), diff --git a/packages/flutter/test/material/grid_title_test.dart b/packages/flutter/test/material/grid_title_test.dart index eb6c58c9d0a..b64b7e4a323 100644 --- a/packages/flutter/test/material/grid_title_test.dart +++ b/packages/flutter/test/material/grid_title_test.dart @@ -13,10 +13,10 @@ void main() { await tester.pumpWidget(new GridTile( header: new GridTileBar( key: headerKey, - leading: new Icon(Icons.thumb_up), - title: new Text('Header'), - subtitle: new Text('Subtitle'), - trailing: new Icon(Icons.thumb_up), + leading: const Icon(Icons.thumb_up), + title: const Text('Header'), + subtitle: const Text('Subtitle'), + trailing: const Icon(Icons.thumb_up), ), child: new DecoratedBox( decoration: new BoxDecoration( @@ -25,7 +25,7 @@ void main() { ), footer: new GridTileBar( key: footerKey, - title: new Text('Footer'), + title: const Text('Footer'), backgroundColor: Colors.black38, ), )); @@ -36,7 +36,7 @@ void main() { expect(tester.getBottomLeft(find.byKey(headerKey)).y, lessThan(tester.getTopLeft(find.byKey(footerKey)).y)); - await tester.pumpWidget(new GridTile(child: new Text('Simple'))); + await tester.pumpWidget(new GridTile(child: const Text('Simple'))); expect(find.text('Simple'), findsOneWidget); }); diff --git a/packages/flutter/test/material/icon_button_test.dart b/packages/flutter/test/material/icon_button_test.dart index 84e99332ef1..e4819e66b70 100644 --- a/packages/flutter/test/material/icon_button_test.dart +++ b/packages/flutter/test/material/icon_button_test.dart @@ -26,7 +26,7 @@ void main() { child: new Center( child: new IconButton( onPressed: mockOnPressedFunction, - icon: new Icon(Icons.link), + icon: const Icon(Icons.link), ), ), ), @@ -46,7 +46,7 @@ void main() { child: new IconButton( iconSize: 10.0, onPressed: mockOnPressedFunction, - icon: new Icon(Icons.link), + icon: const Icon(Icons.link), ), ), ), @@ -64,7 +64,7 @@ void main() { iconSize: 10.0, padding: const EdgeInsets.all(30.0), onPressed: mockOnPressedFunction, - icon: new Icon(Icons.link), + icon: const Icon(Icons.link), ), ), ), @@ -81,7 +81,7 @@ void main() { child: new IconButton( padding: EdgeInsets.zero, onPressed: mockOnPressedFunction, - icon: new Icon(Icons.ac_unit), + icon: const Icon(Icons.ac_unit), iconSize: 80.0, ), ), @@ -102,7 +102,7 @@ void main() { children: [ new IconButton( onPressed: mockOnPressedFunction, - icon: new Icon(Icons.ac_unit), + icon: const Icon(Icons.ac_unit), ), ], ), @@ -119,7 +119,7 @@ void main() { child: new Center( child: new IconButton( onPressed: mockOnPressedFunction, - icon: new Icon(Icons.ac_unit), + icon: const Icon(Icons.ac_unit), iconSize: 80.0, ), ), @@ -137,7 +137,7 @@ void main() { child: new Center( child: new IconButton( onPressed: mockOnPressedFunction, - icon: new Icon(Icons.ac_unit), + icon: const Icon(Icons.ac_unit), ), ), ), @@ -155,7 +155,7 @@ void main() { child: new Center( child: new IconButton( onPressed: mockOnPressedFunction, - icon: new Icon(Icons.ac_unit), + icon: const Icon(Icons.ac_unit), tooltip: 'Test tooltip', ), ), @@ -178,7 +178,7 @@ void main() { new IconButton( padding: EdgeInsets.zero, onPressed: mockOnPressedFunction, - icon: new Icon(Icons.ac_unit), + icon: const Icon(Icons.ac_unit), ), ], ), diff --git a/packages/flutter/test/material/icon_test.dart b/packages/flutter/test/material/icon_test.dart index 9af85bd75a5..687c60d9eb9 100644 --- a/packages/flutter/test/material/icon_test.dart +++ b/packages/flutter/test/material/icon_test.dart @@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Icon sizing - no theme, default size', (WidgetTester tester) async { await tester.pumpWidget( - new Center( + const Center( child: const Icon(null), ), ); @@ -21,7 +21,7 @@ void main() { testWidgets('Icon sizing - no theme, explicit size', (WidgetTester tester) async { await tester.pumpWidget( - new Center( + const Center( child: const Icon( null, size: 96.0, @@ -81,7 +81,7 @@ void main() { testWidgets('Icon with custom font', (WidgetTester tester) async { await tester.pumpWidget( - new Center( + const Center( child: const Icon(const IconData(0x41, fontFamily: 'Roboto')), ), ); diff --git a/packages/flutter/test/material/image_icon_test.dart b/packages/flutter/test/material/image_icon_test.dart index bac85ca000e..bf14f054ffe 100644 --- a/packages/flutter/test/material/image_icon_test.dart +++ b/packages/flutter/test/material/image_icon_test.dart @@ -15,7 +15,7 @@ const ImageProvider _kImage = const TestImageProvider(21, 42); void main() { testWidgets('ImageIcon sizing - no theme, default size', (WidgetTester tester) async { await tester.pumpWidget( - new Center( + const Center( child: const ImageIcon(_kImage) ) ); @@ -42,7 +42,7 @@ void main() { testWidgets('ImageIcon sizing - no theme, explicit size', (WidgetTester tester) async { await tester.pumpWidget( - new Center( + const Center( child: const ImageIcon( null, size: 96.0 diff --git a/packages/flutter/test/material/ink_paint_test.dart b/packages/flutter/test/material/ink_paint_test.dart index 115cfae826d..9b7f4e231b9 100644 --- a/packages/flutter/test/material/ink_paint_test.dart +++ b/packages/flutter/test/material/ink_paint_test.dart @@ -10,8 +10,8 @@ import '../rendering/mock_canvas.dart'; void main() { testWidgets('Does the ink widget render a border radius', (WidgetTester tester) async { - final Color highlightColor = new Color(0xAAFF0000); - final Color splashColor = new Color(0xAA0000FF); + final Color highlightColor = const Color(0xAAFF0000); + final Color splashColor = const Color(0xAA0000FF); final BorderRadius borderRadius = new BorderRadius.circular(6.0); await tester.pumpWidget( @@ -34,16 +34,16 @@ void main() { final Point center = tester.getCenter(find.byType(InkWell)); final TestGesture gesture = await tester.startGesture(center); await tester.pump(); // start gesture - await tester.pump(new Duration(milliseconds: 200)); // wait for splash to be well under way + await tester.pump(const Duration(milliseconds: 200)); // wait for splash to be well under way final RenderBox box = Material.of(tester.element(find.byType(InkWell))) as dynamic; expect( box, paints - ..clipRRect(rrect: new RRect.fromLTRBR(300.0, 270.0, 500.0, 330.0, new Radius.circular(6.0))) + ..clipRRect(rrect: new RRect.fromLTRBR(300.0, 270.0, 500.0, 330.0, const Radius.circular(6.0))) ..circle(x: 400.0, y: 300.0, radius: 21.0, color: splashColor) ..rrect( - rrect: new RRect.fromLTRBR(300.0, 270.0, 500.0, 330.0, new Radius.circular(6.0)), + rrect: new RRect.fromLTRBR(300.0, 270.0, 500.0, 330.0, const Radius.circular(6.0)), color: highlightColor, ) ); diff --git a/packages/flutter/test/material/list_tile_test.dart b/packages/flutter/test/material/list_tile_test.dart index cb16959da8d..068f6a00655 100644 --- a/packages/flutter/test/material/list_tile_test.dart +++ b/packages/flutter/test/material/list_tile_test.dart @@ -18,7 +18,7 @@ class TestIconState extends State { @override Widget build(BuildContext context) { iconTheme = IconTheme.of(context); - return new Icon(Icons.add); + return const Icon(Icons.add); } } @@ -53,10 +53,10 @@ void main() { home: new Material( child: new Center( child: new ListTile( - leading: new Text('leading'), - title: new Text('title'), - subtitle: hasSubtitle ? new Text('subtitle') : null, - trailing: new Text('trailing'), + leading: const Text('leading'), + title: const Text('title'), + subtitle: hasSubtitle ? const Text('subtitle') : null, + trailing: const Text('trailing'), dense: dense, isThreeLine: isThreeLine, ), diff --git a/packages/flutter/test/material/modal_bottom_sheet_test.dart b/packages/flutter/test/material/modal_bottom_sheet_test.dart index 2582b259e4e..7f12d2edcec 100644 --- a/packages/flutter/test/material/modal_bottom_sheet_test.dart +++ b/packages/flutter/test/material/modal_bottom_sheet_test.dart @@ -25,7 +25,7 @@ void main() { bool showBottomSheetThenCalled = false; showModalBottomSheet( context: savedContext, - builder: (BuildContext context) => new Text('BottomSheet') + builder: (BuildContext context) => const Text('BottomSheet') ).then((Null result) { expectSync(result, isNull); showBottomSheetThenCalled = true; @@ -47,7 +47,7 @@ void main() { showBottomSheetThenCalled = false; showModalBottomSheet( context: savedContext, - builder: (BuildContext context) => new Text('BottomSheet'), + builder: (BuildContext context) => const Text('BottomSheet'), ).then((Null result) { expectSync(result, isNull); showBottomSheetThenCalled = true; @@ -73,7 +73,7 @@ void main() { await tester.pumpWidget(new MaterialApp( home: new Scaffold( key: scaffoldKey, - body: new Center(child: new Text('body')) + body: const Center(child: const Text('body')) ) )); @@ -83,7 +83,7 @@ void main() { scaffoldKey.currentState.showBottomSheet((BuildContext context) { return new Container( margin: const EdgeInsets.all(40.0), - child: new Text('BottomSheet') + child: const Text('BottomSheet') ); }).closed.whenComplete(() { showBottomSheetThenCalled = true; @@ -126,14 +126,14 @@ void main() { await tester.pumpWidget(new MaterialApp( home: new Scaffold( key: scaffoldKey, - body: new Center(child: new Text('body')) + body: const Center(child: const Text('body')) ) )); scaffoldKey.currentState.showBottomSheet((BuildContext context) { return new Container( margin: const EdgeInsets.all(40.0), - child: new Text('BottomSheet') + child: const Text('BottomSheet') ); }); diff --git a/packages/flutter/test/material/page_test.dart b/packages/flutter/test/material/page_test.dart index b0e9454132b..26ad665a762 100644 --- a/packages/flutter/test/material/page_test.dart +++ b/packages/flutter/test/material/page_test.dart @@ -10,10 +10,10 @@ void main() { await tester.pumpWidget( new MaterialApp( theme: new ThemeData(platform: TargetPlatform.android), - home: new Material(child: new Text('Page 1')), + home: new Material(child: const Text('Page 1')), routes: { '/next': (BuildContext context) { - return new Material(child: new Text('Page 2')); + return new Material(child: const Text('Page 2')); }, }, ) @@ -66,10 +66,10 @@ void main() { await tester.pumpWidget( new MaterialApp( theme: new ThemeData(platform: TargetPlatform.iOS), - home: new Material(child: new Text('Page 1')), + home: new Material(child: const Text('Page 1')), routes: { '/next': (BuildContext context) { - return new Material(child: new Text('Page 2')); + return new Material(child: const Text('Page 2')); }, }, ) @@ -130,7 +130,7 @@ void main() { await tester.pumpWidget( new MaterialApp( theme: new ThemeData(platform: TargetPlatform.iOS), - home: new Material(child: new Text('Page 1')), + home: new Material(child: const Text('Page 1')), ) ); @@ -138,7 +138,7 @@ void main() { tester.state(find.byType(Navigator)).push(new MaterialPageRoute( builder: (BuildContext context) { - return new Material(child: new Text('Page 2')); + return new Material(child: const Text('Page 2')); }, fullscreenDialog: true, )); @@ -191,10 +191,10 @@ void main() { await tester.pumpWidget( new MaterialApp( theme: new ThemeData(platform: TargetPlatform.android), - home: new Scaffold(body: new Text('Page 1')), + home: new Scaffold(body: const Text('Page 1')), routes: { '/next': (BuildContext context) { - return new Scaffold(body: new Text('Page 2')); + return new Scaffold(body: const Text('Page 2')); }, }, ) @@ -222,10 +222,10 @@ void main() { await tester.pumpWidget( new MaterialApp( theme: new ThemeData(platform: TargetPlatform.iOS), - home: new Scaffold(body: new Text('Page 1')), + home: new Scaffold(body: const Text('Page 1')), routes: { '/next': (BuildContext context) { - return new Scaffold(body: new Text('Page 2')); + return new Scaffold(body: const Text('Page 2')); }, }, ) @@ -264,13 +264,13 @@ void main() { await tester.pumpWidget( new MaterialApp( theme: new ThemeData(platform: TargetPlatform.iOS), - home: new Scaffold(body: new Text('Page 1')), + home: new Scaffold(body: const Text('Page 1')), ) ); tester.state(find.byType(Navigator)).push(new MaterialPageRoute( builder: (BuildContext context) { - return new Scaffold(body: new Text('Page 2')); + return new Scaffold(body: const Text('Page 2')); }, fullscreenDialog: true, )); diff --git a/packages/flutter/test/material/paginated_data_table_test.dart b/packages/flutter/test/material/paginated_data_table_test.dart index 4398d6b0079..b8c403bbafa 100644 --- a/packages/flutter/test/material/paginated_data_table_test.dart +++ b/packages/flutter/test/material/paginated_data_table_test.dart @@ -49,7 +49,7 @@ void main() { await tester.pumpWidget(new MaterialApp( home: new PaginatedDataTable( - header: new Text('Test table'), + header: const Text('Test table'), source: source, rowsPerPage: 2, availableRowsPerPage: [ @@ -62,9 +62,9 @@ void main() { log.add('page-changed: $rowIndex'); }, columns: [ - new DataColumn(label: new Text('Name')), - new DataColumn(label: new Text('Calories'), numeric: true), - new DataColumn(label: new Text('Generation')), + const DataColumn(label: const Text('Name')), + const DataColumn(label: const Text('Calories'), numeric: true), + const DataColumn(label: const Text('Generation')), ], ) )); @@ -113,32 +113,32 @@ void main() { Widget buildTable(TestDataSource source) { return new PaginatedDataTable( - header: new Text('Test table'), + header: const Text('Test table'), source: source, onPageChanged: (int rowIndex) { log.add('page-changed: $rowIndex'); }, columns: [ - new DataColumn( - label: new Text('Name'), + const DataColumn( + label: const Text('Name'), tooltip: 'Name', ), new DataColumn( - label: new Text('Calories'), + label: const Text('Calories'), tooltip: 'Calories', numeric: true, onSort: (int columnIndex, bool ascending) { log.add('column-sort: $columnIndex $ascending'); } ), - new DataColumn( - label: new Text('Generation'), + const DataColumn( + label: const Text('Generation'), tooltip: 'Generation', ), ], actions: [ new IconButton( - icon: new Icon(Icons.adjust), + icon: const Icon(Icons.adjust), onPressed: () { log.add('action: adjust'); }, diff --git a/packages/flutter/test/material/persistent_bottom_sheet_test.dart b/packages/flutter/test/material/persistent_bottom_sheet_test.dart index 329eb4416e5..b53159cec74 100644 --- a/packages/flutter/test/material/persistent_bottom_sheet_test.dart +++ b/packages/flutter/test/material/persistent_bottom_sheet_test.dart @@ -14,7 +14,7 @@ void main() { await tester.pumpWidget(new MaterialApp( home: new Scaffold( key: scaffoldKey, - body: new Center(child: new Text('body')) + body: const Center(child: const Text('body')) ) )); @@ -41,7 +41,7 @@ void main() { await tester.pumpWidget(new MaterialApp( home: new Scaffold( key: scaffoldKey, - body: new Center(child: new Text('body')) + body: const Center(child: const Text('body')) ) )); @@ -49,9 +49,9 @@ void main() { return new ListView( shrinkWrap: true, children: [ - new Container(height: 100.0, child: new Text('One')), - new Container(height: 100.0, child: new Text('Two')), - new Container(height: 100.0, child: new Text('Three')), + new Container(height: 100.0, child: const Text('One')), + new Container(height: 100.0, child: const Text('Two')), + new Container(height: 100.0, child: const Text('Three')), ], ); }); diff --git a/packages/flutter/test/material/popup_menu_test.dart b/packages/flutter/test/material/popup_menu_test.dart index 844b84b9464..f0e484fd63e 100644 --- a/packages/flutter/test/material/popup_menu_test.dart +++ b/packages/flutter/test/material/popup_menu_test.dart @@ -11,7 +11,7 @@ void main() { new MaterialApp( routes: { '/next': (BuildContext context) { - return new Text('Next'); + return const Text('Next'); } }, home: new Material( @@ -26,7 +26,7 @@ void main() { return >[ new PopupMenuItem( value: 1, - child: new Text('One') + child: const Text('One') ) ]; } diff --git a/packages/flutter/test/material/refresh_indicator_test.dart b/packages/flutter/test/material/refresh_indicator_test.dart index eb2c2482e68..819ad016729 100644 --- a/packages/flutter/test/material/refresh_indicator_test.dart +++ b/packages/flutter/test/material/refresh_indicator_test.dart @@ -54,9 +54,9 @@ void main() { reverse: true, physics: const AlwaysScrollableScrollPhysics(), children: [ - new SizedBox( + const SizedBox( height: 200.0, - child: new Text('X'), + child: const Text('X'), ), ], ), @@ -79,9 +79,9 @@ void main() { child: new ListView( physics: const AlwaysScrollableScrollPhysics(), children: [ - new SizedBox( + const SizedBox( height: 200.0, - child: new Text('X'), + child: const Text('X'), ), ], ), @@ -104,9 +104,9 @@ void main() { reverse: true, physics: const AlwaysScrollableScrollPhysics(), children: [ - new SizedBox( + const SizedBox( height: 200.0, - child: new Text('X'), + child: const Text('X'), ), ], ), @@ -128,9 +128,9 @@ void main() { child: new ListView( physics: const AlwaysScrollableScrollPhysics(), children: [ - new SizedBox( + const SizedBox( height: 200.0, - child: new Text('X'), + child: const Text('X'), ), ], ), @@ -154,9 +154,9 @@ void main() { child: new ListView( physics: const AlwaysScrollableScrollPhysics(), children: [ - new SizedBox( + const SizedBox( height: 200.0, - child: new Text('X'), + child: const Text('X'), ), ], ), @@ -179,9 +179,9 @@ void main() { child: new ListView( physics: const AlwaysScrollableScrollPhysics(), children: [ - new SizedBox( + const SizedBox( height: 200.0, - child: new Text('X'), + child: const Text('X'), ), ], ), @@ -220,9 +220,9 @@ void main() { child: new ListView( physics: const AlwaysScrollableScrollPhysics(), children: [ - new SizedBox( + const SizedBox( height: 200.0, - child: new Text('X'), + child: const Text('X'), ), ], ), @@ -262,9 +262,9 @@ void main() { child: new ListView( physics: const AlwaysScrollableScrollPhysics(), children: [ - new SizedBox( + const SizedBox( height: 200.0, - child: new Text('X'), + child: const Text('X'), ), ], ), diff --git a/packages/flutter/test/material/scaffold_test.dart b/packages/flutter/test/material/scaffold_test.dart index 8d555727402..ea4133370ae 100644 --- a/packages/flutter/test/material/scaffold_test.dart +++ b/packages/flutter/test/material/scaffold_test.dart @@ -10,7 +10,7 @@ void main() { testWidgets('Scaffold control test', (WidgetTester tester) async { final Key bodyKey = new UniqueKey(); await tester.pumpWidget(new Scaffold( - appBar: new AppBar(title: new Text('Title')), + appBar: new AppBar(title: const Text('Title')), body: new Container(key: bodyKey) )); @@ -20,7 +20,7 @@ void main() { await tester.pumpWidget(new MediaQuery( data: const MediaQueryData(padding: const EdgeInsets.only(bottom: 100.0)), child: new Scaffold( - appBar: new AppBar(title: new Text('Title')), + appBar: new AppBar(title: const Text('Title')), body: new Container(key: bodyKey) ) )); @@ -31,7 +31,7 @@ void main() { await tester.pumpWidget(new MediaQuery( data: const MediaQueryData(padding: const EdgeInsets.only(bottom: 100.0)), child: new Scaffold( - appBar: new AppBar(title: new Text('Title')), + appBar: new AppBar(title: const Text('Title')), body: new Container(key: bodyKey), resizeToAvoidBottomPadding: false ) @@ -72,7 +72,7 @@ void main() { ), child: new Scaffold( appBar: new AppBar( - title: new Text('Title'), + title: const Text('Title'), ), body: new Container(key: bodyKey), ), @@ -83,20 +83,20 @@ void main() { testWidgets('Floating action animation', (WidgetTester tester) async { await tester.pumpWidget(new Scaffold( - floatingActionButton: new FloatingActionButton( + floatingActionButton: const FloatingActionButton( key: const Key('one'), onPressed: null, - child: new Text("1") + child: const Text("1") ) )); expect(tester.binding.transientCallbackCount, 0); await tester.pumpWidget(new Scaffold( - floatingActionButton: new FloatingActionButton( + floatingActionButton: const FloatingActionButton( key: const Key('two'), onPressed: null, - child: new Text("2") + child: const Text("2") ) )); @@ -107,10 +107,10 @@ void main() { expect(tester.binding.transientCallbackCount, 0); await tester.pumpWidget(new Scaffold( - floatingActionButton: new FloatingActionButton( + floatingActionButton: const FloatingActionButton( key: const Key('one'), onPressed: null, - child: new Text("1") + child: const Text("1") ) )); @@ -140,8 +140,8 @@ void main() { new SliverAppBar( pinned: true, expandedHeight: appBarHeight, - title: new Text('Title'), - flexibleSpace: new FlexibleSpaceBar(title: new Text('Title')), + title: const Text('Title'), + flexibleSpace: new FlexibleSpaceBar(title: const Text('Title')), ), new SliverPadding( padding: const EdgeInsets.only(top: appBarHeight), @@ -185,7 +185,7 @@ void main() { primary: true, slivers: [ new SliverAppBar( - title: new Text('Title') + title: const Text('Title') ), new SliverList( delegate: new SliverChildListDelegate(new List.generate( @@ -228,7 +228,7 @@ void main() { theme: new ThemeData(platform: TargetPlatform.android), home: new Scaffold( appBar: new AppBar( - title: new Text('Title'), + title: const Text('Title'), ), body: new Builder( builder: (BuildContext context) { @@ -241,7 +241,7 @@ void main() { ); }); }, - child: new Text('X'), + child: const Text('X'), ); }, ), @@ -273,7 +273,7 @@ void main() { backgroundColor: Colors.amber[500], ), height: 5000.0, - child: new Text('body'), + child: const Text('body'), ), ), persistentFooterButtons: [ @@ -281,7 +281,7 @@ void main() { onPressed: () { didPressButton = true; }, - child: new Text('X'), + child: const Text('X'), ) ], ), @@ -298,10 +298,10 @@ void main() { Future expectBackIcon(WidgetTester tester, TargetPlatform platform, IconData expectedIcon) async { final GlobalKey rootKey = new GlobalKey(); final Map routes = { - '/': (_) => new Container(key: rootKey, child: new Text('Home')), + '/': (_) => new Container(key: rootKey, child: const Text('Home')), '/scaffold': (_) => new Scaffold( appBar: new AppBar(), - body: new Text('Scaffold'), + body: const Text('Scaffold'), ) }; await tester.pumpWidget( @@ -360,7 +360,7 @@ void main() { testWidgets('body size with button', (WidgetTester tester) async { final Key testKey = new UniqueKey(); await tester.pumpWidget( - new Scaffold(body: new FlatButton(key: testKey, onPressed: () { }, child: new Text(''))) + new Scaffold(body: new FlatButton(key: testKey, onPressed: () { }, child: const Text(''))) ); expect(tester.element(find.byKey(testKey)).size, const Size(88.0, 36.0)); expect(tester.renderObject(find.byKey(testKey)).localToGlobal(Point.origin), const Point(0.0, 0.0)); diff --git a/packages/flutter/test/material/scrollbar_test.dart b/packages/flutter/test/material/scrollbar_test.dart index 8b1484b9341..da2dc088a5b 100644 --- a/packages/flutter/test/material/scrollbar_test.dart +++ b/packages/flutter/test/material/scrollbar_test.dart @@ -19,14 +19,14 @@ void main() { child: new Scrollbar( child: new ListView( children: [ - new Container(height: 40.0, child: new Text('0')), - new Container(height: 40.0, child: new Text('1')), - new Container(height: 40.0, child: new Text('2')), - new Container(height: 40.0, child: new Text('3')), - new Container(height: 40.0, child: new Text('4')), - new Container(height: 40.0, child: new Text('5')), - new Container(height: 40.0, child: new Text('6')), - new Container(height: 40.0, child: new Text('7')), + new Container(height: 40.0, child: const Text('0')), + new Container(height: 40.0, child: const Text('1')), + new Container(height: 40.0, child: const Text('2')), + new Container(height: 40.0, child: const Text('3')), + new Container(height: 40.0, child: const Text('4')), + new Container(height: 40.0, child: const Text('5')), + new Container(height: 40.0, child: const Text('6')), + new Container(height: 40.0, child: const Text('7')), ] ) ) diff --git a/packages/flutter/test/material/snack_bar_test.dart b/packages/flutter/test/material/snack_bar_test.dart index 21641d89206..195997a8eb0 100644 --- a/packages/flutter/test/material/snack_bar_test.dart +++ b/packages/flutter/test/material/snack_bar_test.dart @@ -266,7 +266,7 @@ void main() { return new GestureDetector( onTap: () { Scaffold.of(context).showSnackBar(new SnackBar( - content: new Text('I am a snack bar.'), + content: const Text('I am a snack bar.'), duration: const Duration(seconds: 2), action: new SnackBarAction( label: 'ACTION', @@ -276,7 +276,7 @@ void main() { ) )); }, - child: new Text('X') + child: const Text('X') ); } ) @@ -304,12 +304,12 @@ void main() { return new GestureDetector( onTap: () { Scaffold.of(context).showSnackBar(new SnackBar( - content: new Text('I am a snack bar.'), + content: const Text('I am a snack bar.'), duration: const Duration(seconds: 2), action: new SnackBarAction(label: 'ACTION', onPressed: () {}) )); }, - child: new Text('X') + child: const Text('X') ); } ) @@ -348,7 +348,7 @@ void main() { return new GestureDetector( onTap: () { Scaffold.of(context).showSnackBar(new SnackBar( - content: new Text('snack'), + content: const Text('snack'), duration: const Duration(seconds: 2), action: new SnackBarAction( label: 'ACTION', @@ -360,7 +360,7 @@ void main() { closedReason = reason; }); }, - child: new Text('X') + child: const Text('X') ); }, ) diff --git a/packages/flutter/test/material/stepper_test.dart b/packages/flutter/test/material/stepper_test.dart index 1ddafd2736e..3b977d772b6 100644 --- a/packages/flutter/test/material/stepper_test.dart +++ b/packages/flutter/test/material/stepper_test.dart @@ -17,14 +17,14 @@ void main() { }, steps: [ new Step( - title: new Text('Step 1'), + title: const Text('Step 1'), content: const SizedBox( width: 100.0, height: 100.0 ) ), new Step( - title: new Text('Step 2'), + title: const Text('Step 2'), content: const SizedBox( width: 100.0, height: 100.0 @@ -45,14 +45,14 @@ void main() { child: new Stepper( steps: [ new Step( - title: new Text('Step 1'), + title: const Text('Step 1'), content: const SizedBox( width: 100.0, height: 100.0 ) ), new Step( - title: new Text('Step 2'), + title: const Text('Step 2'), content: const SizedBox( width: 200.0, height: 200.0 @@ -74,14 +74,14 @@ void main() { currentStep: 1, steps: [ new Step( - title: new Text('Step 1'), + title: const Text('Step 1'), content: const SizedBox( width: 100.0, height: 100.0 ) ), new Step( - title: new Text('Step 2'), + title: const Text('Step 2'), content: const SizedBox( width: 200.0, height: 200.0 @@ -109,7 +109,7 @@ void main() { type: StepperType.horizontal, steps: [ new Step( - title: new Text('Step 1'), + title: const Text('Step 1'), content: const SizedBox( width: 100.0, height: 100.0 @@ -132,12 +132,12 @@ void main() { type: StepperType.horizontal, steps: [ new Step( - title: new Text('Step 1'), - content: new Text('A') + title: const Text('Step 1'), + content: const Text('A') ), new Step( - title: new Text('Step 2'), - content: new Text('B') + title: const Text('Step 2'), + content: const Text('B') ) ] ) @@ -154,12 +154,12 @@ void main() { type: StepperType.horizontal, steps: [ new Step( - title: new Text('Step 1'), - content: new Text('A') + title: const Text('Step 1'), + content: const Text('A') ), new Step( - title: new Text('Step 2'), - content: new Text('B') + title: const Text('Step 2'), + content: const Text('B') ) ] ) @@ -186,14 +186,14 @@ void main() { }, steps: [ new Step( - title: new Text('Step 1'), + title: const Text('Step 1'), content: const SizedBox( width: 100.0, height: 100.0 ) ), new Step( - title: new Text('Step 2'), + title: const Text('Step 2'), content: const SizedBox( width: 200.0, height: 200.0 @@ -222,14 +222,14 @@ void main() { }, steps: [ new Step( - title: new Text('Step 1'), + title: const Text('Step 1'), content: const SizedBox( width: 100.0, height: 100.0 ) ), new Step( - title: new Text('Step 2'), + title: const Text('Step 2'), state: StepState.disabled, content: const SizedBox( width: 100.0, @@ -251,21 +251,21 @@ void main() { child: new Stepper( steps: [ new Step( - title: new Text('Step 1'), + title: const Text('Step 1'), content: const SizedBox( width: 100.0, height: 300.0 ) ), new Step( - title: new Text('Step 2'), + title: const Text('Step 2'), content: const SizedBox( width: 100.0, height: 300.0 ) ), new Step( - title: new Text('Step 3'), + title: const Text('Step 3'), content: const SizedBox( width: 100.0, height: 100.0 @@ -286,21 +286,21 @@ void main() { currentStep: 2, steps: [ new Step( - title: new Text('Step 1'), + title: const Text('Step 1'), content: const SizedBox( width: 100.0, height: 300.0 ) ), new Step( - title: new Text('Step 2'), + title: const Text('Step 2'), content: const SizedBox( width: 100.0, height: 300.0 ) ), new Step( - title: new Text('Step 3'), + title: const Text('Step 3'), content: const SizedBox( width: 100.0, height: 100.0 @@ -322,7 +322,7 @@ void main() { child: new Stepper( steps: [ new Step( - title: new Text('A'), + title: const Text('A'), state: StepState.complete, content: const SizedBox( width: 100.0, @@ -330,7 +330,7 @@ void main() { ) ), new Step( - title: new Text('B'), + title: const Text('B'), content: const SizedBox( width: 100.0, height: 100.0 @@ -353,7 +353,7 @@ void main() { child: new Stepper( steps: [ new Step( - title: new Text('A'), + title: const Text('A'), state: StepState.error, content: const SizedBox( width: 100.0, diff --git a/packages/flutter/test/material/tabs_test.dart b/packages/flutter/test/material/tabs_test.dart index 09ee174ec08..932373ffb85 100644 --- a/packages/flutter/test/material/tabs_test.dart +++ b/packages/flutter/test/material/tabs_test.dart @@ -95,15 +95,15 @@ Widget buildLeftRightApp({ List tabs, String value }) { length: tabs.length, child: new Scaffold( appBar: new AppBar( - title: new Text('tabs'), + title: const Text('tabs'), bottom: new TabBar( tabs: tabs.map((String tab) => new Tab(text: tab)).toList(), ), ), body: new TabBarView( children: [ - new Center(child: new Text('LEFT CHILD')), - new Center(child: new Text('RIGHT CHILD')) + const Center(child: const Text('LEFT CHILD')), + const Center(child: const Text('RIGHT CHILD')) ] ) ) @@ -419,7 +419,7 @@ void main() { length: tabs.length, child: new Scaffold( appBar: new AppBar( - title: new Text('tabs'), + title: const Text('tabs'), bottom: new TabBar( isScrollable: true, tabs: tabs.map((String tab) => new Tab(text: tab)).toList(), @@ -486,7 +486,7 @@ void main() { theme: new ThemeData(platform: TargetPlatform.android), home: new Scaffold( appBar: new AppBar( - title: new Text('tabs'), + title: const Text('tabs'), bottom: new TabBar( controller: controller, tabs: tabs.map((String tab) => new Tab(text: tab)).toList(), @@ -495,8 +495,8 @@ void main() { body: new TabBarView( controller: controller, children: [ - new Center(child: new Text('LEFT CHILD')), - new Center(child: new Text('RIGHT CHILD')) + const Center(child: const Text('LEFT CHILD')), + const Center(child: const Text('RIGHT CHILD')) ] ), ), @@ -545,7 +545,7 @@ void main() { theme: new ThemeData(platform: TargetPlatform.android), home: new Scaffold( appBar: new AppBar( - title: new Text('tabs'), + title: const Text('tabs'), bottom: new TabBar( controller: controller, tabs: tabs.map((String tab) => new Tab(text: tab)).toList(), @@ -554,9 +554,9 @@ void main() { body: new TabBarView( controller: controller, children: [ - new Center(child: new Text('CHILD A')), - new Center(child: new Text('CHILD B')), - new Center(child: new Text('CHILD C')), + const Center(child: const Text('CHILD A')), + const Center(child: const Text('CHILD B')), + const Center(child: const Text('CHILD C')), ] ), ), @@ -618,13 +618,13 @@ void main() { new Builder( builder: (BuildContext context) { firstColor = IconTheme.of(context).color; - return new Text('First'); + return const Text('First'); } ), new Builder( builder: (BuildContext context) { secondColor = IconTheme.of(context).color; - return new Text('Second'); + return const Text('Second'); } ), ], @@ -646,7 +646,7 @@ void main() { new Material( child: new TabBarView( controller: controller, - children: [ new Text('First'), new Text('Second') ], + children: [ const Text('First'), const Text('Second') ], ), ), ); @@ -745,7 +745,7 @@ void main() { child: new TabBar( key: new UniqueKey(), controller: controller, - tabs: [ new Text('A'), new Text('B') ], + tabs: [ const Text('A'), const Text('B') ], ), ); } diff --git a/packages/flutter/test/material/text_field_test.dart b/packages/flutter/test/material/text_field_test.dart index 4d10e7bc568..412aafcda4e 100644 --- a/packages/flutter/test/material/text_field_test.dart +++ b/packages/flutter/test/material/text_field_test.dart @@ -83,7 +83,7 @@ void main() { child: new Material( child: new TextField( key: textFieldKey, - decoration: new InputDecoration( + decoration: const InputDecoration( hintText: 'Placeholder', ), onChanged: (String value) { @@ -125,7 +125,7 @@ void main() { return new Center( child: new Material( child: new TextField( - decoration: new InputDecoration( + decoration: const InputDecoration( hintText: 'Placeholder', ), ), @@ -170,7 +170,7 @@ void main() { child: new Material( child: new TextField( obscureText: true, - decoration: new InputDecoration( + decoration: const InputDecoration( hintText: 'Placeholder', ), ), @@ -434,7 +434,7 @@ void main() { key: textFieldKey, style: const TextStyle(color: Colors.black, fontSize: 34.0), maxLines: maxLines, - decoration: new InputDecoration( + decoration: const InputDecoration( hintText: 'Placeholder', ), ), @@ -679,7 +679,7 @@ void main() { child: new Material( child: new TextField( key: textFieldKey, - decoration: new InputDecoration( + decoration: const InputDecoration( hintText: 'Placeholder', ), onChanged: (String value) { textFieldValue = value; }, @@ -717,7 +717,7 @@ void main() { data: themeData, child: new Material( child: new TextField( - decoration: new InputDecoration( + decoration: const InputDecoration( hintText: 'Placeholder', ), style: style, @@ -768,13 +768,13 @@ void main() { child: new Column( children: [ new TextField( - decoration: new InputDecoration( + decoration: const InputDecoration( labelText: 'First', ), ), new TextField( key: secondKey, - decoration: new InputDecoration( + decoration: const InputDecoration( labelText: 'Second', ), ), @@ -810,8 +810,8 @@ void main() { new Center( child: new Material( child: new TextField( - decoration: new InputDecoration( - icon: new Icon(Icons.phone), + decoration: const InputDecoration( + icon: const Icon(Icons.phone), labelText: 'label', ), ), @@ -829,7 +829,7 @@ void main() { overlay(new Center( child: new Material( child: new TextField( - decoration: new InputDecoration.collapsed( + decoration: const InputDecoration.collapsed( hintText: 'hint', ), ), @@ -857,7 +857,7 @@ void main() { final RenderEditable editable = findRenderEditable(tester); Point topLeft = editable.localToGlobal( - editable.getLocalRectForCaret(new TextPosition(offset: 0)).topLeft + editable.getLocalRectForCaret(const TextPosition(offset: 0)).topLeft ); expect(topLeft.x, equals(399.0)); @@ -866,7 +866,7 @@ void main() { await tester.pump(); topLeft = editable.localToGlobal( - editable.getLocalRectForCaret(new TextPosition(offset: 2)).topLeft + editable.getLocalRectForCaret(const TextPosition(offset: 2)).topLeft ); expect(topLeft.x, equals(399.0)); @@ -891,7 +891,7 @@ void main() { final RenderEditable editable = findRenderEditable(tester); Point topLeft = editable.localToGlobal( - editable.getLocalRectForCaret(new TextPosition(offset: 0)).topLeft + editable.getLocalRectForCaret(const TextPosition(offset: 0)).topLeft ); expect(topLeft.x, equals(399.0)); @@ -900,7 +900,7 @@ void main() { await tester.pump(); topLeft = editable.localToGlobal( - editable.getLocalRectForCaret(new TextPosition(offset: 2)).topLeft + editable.getLocalRectForCaret(const TextPosition(offset: 2)).topLeft ); expect(topLeft.x, equals(399.0)); diff --git a/packages/flutter/test/material/theme_test.dart b/packages/flutter/test/material/theme_test.dart index 9566d68814a..5d9d5e088d4 100644 --- a/packages/flutter/test/material/theme_test.dart +++ b/packages/flutter/test/material/theme_test.dart @@ -25,7 +25,7 @@ void main() { key: popupMenuButtonKey, itemBuilder: (BuildContext context) { return >[ - new PopupMenuItem(child: new Text('menuItem')) + new PopupMenuItem(child: const Text('menuItem')) ]; } ), @@ -71,7 +71,7 @@ void main() { key: popupMenuButtonKey, itemBuilder: (BuildContext context) { return >[ - new PopupMenuItem(child: new Text('menuItem')) + new PopupMenuItem(child: const Text('menuItem')) ]; } ), @@ -105,7 +105,7 @@ void main() { items: >[ new DropdownMenuItem( value: 'menuItem', - child: new Text('menuItem'), + child: const Text('menuItem'), ), ], ) @@ -137,10 +137,10 @@ void main() { onPressed: () { showModalBottomSheet( context: context, - builder: (BuildContext context) => new Text('bottomSheet'), + builder: (BuildContext context) => const Text('bottomSheet'), ); }, - child: new Text('SHOW'), + child: const Text('SHOW'), ); } ) @@ -174,10 +174,10 @@ void main() { onPressed: () { showDialog( context: context, - child: new Text('dialog'), + child: const Text('dialog'), ); }, - child: new Text('SHOW'), + child: const Text('SHOW'), ); } ) @@ -214,7 +214,7 @@ void main() { ) ); }, - child: new Text('SHOW'), + child: const Text('SHOW'), ); }, ), diff --git a/packages/flutter/test/material/time_picker_test.dart b/packages/flutter/test/material/time_picker_test.dart index 6f210fdf5af..d1dd701f33b 100644 --- a/packages/flutter/test/material/time_picker_test.dart +++ b/packages/flutter/test/material/time_picker_test.dart @@ -19,7 +19,7 @@ class _TimePickerLauncher extends StatelessWidget { child: new Builder( builder: (BuildContext context) { return new RaisedButton( - child: new Text('X'), + child: const Text('X'), onPressed: () async { onChanged(await showTimePicker( context: context, diff --git a/packages/flutter/test/material/two_level_list_test.dart b/packages/flutter/test/material/two_level_list_test.dart index 232b7c1d654..0cad9581b15 100644 --- a/packages/flutter/test/material/two_level_list_test.dart +++ b/packages/flutter/test/material/two_level_list_test.dart @@ -16,7 +16,7 @@ void main() { child: new TwoLevelList( children: [ new TwoLevelSublist( - title: new Text('Title'), + title: const Text('Title'), ) ] ) @@ -36,16 +36,16 @@ void main() { child: new SingleChildScrollView( child: new TwoLevelList( children: [ - new TwoLevelListItem(title: new Text('Top'), key: topKey), + new TwoLevelListItem(title: const Text('Top'), key: topKey), new TwoLevelSublist( key: sublistKey, - title: new Text('Sublist'), + title: const Text('Sublist'), children: [ - new TwoLevelListItem(title: new Text('0')), - new TwoLevelListItem(title: new Text('1')) + new TwoLevelListItem(title: const Text('0')), + new TwoLevelListItem(title: const Text('1')) ] ), - new TwoLevelListItem(title: new Text('Bottom'), key: bottomKey) + new TwoLevelListItem(title: const Text('Bottom'), key: bottomKey) ] ) ) @@ -95,13 +95,13 @@ void main() { child: new TwoLevelList( children: [ new TwoLevelSublist( - title: new Text('Sublist'), + title: const Text('Sublist'), onOpenChanged: (bool opened) { didChangeOpen = opened; }, children: [ - new TwoLevelListItem(title: new Text('0')), - new TwoLevelListItem(title: new Text('1')) + new TwoLevelListItem(title: const Text('0')), + new TwoLevelListItem(title: const Text('1')) ] ), ] diff --git a/packages/flutter/test/material/user_accounts_drawer_header_test.dart b/packages/flutter/test/material/user_accounts_drawer_header_test.dart index 83c8faef7b1..79008f22f1e 100644 --- a/packages/flutter/test/material/user_accounts_drawer_header_test.dart +++ b/packages/flutter/test/material/user_accounts_drawer_header_test.dart @@ -18,26 +18,26 @@ void main() { child: new UserAccountsDrawerHeader( currentAccountPicture: new CircleAvatar( key: avatarA, - child: new Text('A'), + child: const Text('A'), ), otherAccountsPictures: [ new CircleAvatar( - child: new Text('B'), + child: const Text('B'), ), new CircleAvatar( key: avatarC, - child: new Text('C'), + child: const Text('C'), ), new CircleAvatar( key: avatarD, - child: new Text('D'), + child: const Text('D'), ), new CircleAvatar( - child: new Text('E'), + child: const Text('E'), ) ], - accountName: new Text("name"), - accountEmail: new Text("email"), + accountName: const Text("name"), + accountEmail: const Text("email"), ), ), ), @@ -112,7 +112,7 @@ void main() { expect(find.byType(Icon), findsOneWidget); await tester.pumpWidget(buildFrame( - accountName: new Text('accountName'), + accountName: const Text('accountName'), onDetailsPressed: () { }, )); expect( @@ -121,7 +121,7 @@ void main() { ); await tester.pumpWidget(buildFrame( - accountEmail: new Text('accountEmail'), + accountEmail: const Text('accountEmail'), onDetailsPressed: () { }, )); expect( @@ -130,8 +130,8 @@ void main() { ); await tester.pumpWidget(buildFrame( - accountName: new Text('accountName'), - accountEmail: new Text('accountEmail'), + accountName: const Text('accountName'), + accountEmail: const Text('accountEmail'), onDetailsPressed: () { }, )); expect( @@ -148,19 +148,19 @@ void main() { ); await tester.pumpWidget(buildFrame( - currentAccountPicture: new CircleAvatar(child: new Text('A')), + currentAccountPicture: new CircleAvatar(child: const Text('A')), )); expect(find.text('A'), findsOneWidget); await tester.pumpWidget(buildFrame( - otherAccountsPictures: [new CircleAvatar(child: new Text('A'))], + otherAccountsPictures: [new CircleAvatar(child: const Text('A'))], )); expect(find.text('A'), findsOneWidget); final Key avatarA = const Key('A'); await tester.pumpWidget(buildFrame( - currentAccountPicture: new CircleAvatar(key: avatarA, child: new Text('A')), - accountName: new Text('accountName'), + currentAccountPicture: new CircleAvatar(key: avatarA, child: const Text('A')), + accountName: const Text('accountName'), )); expect( tester.getBottomLeft(find.byKey(avatarA)).x, diff --git a/packages/flutter/test/material/will_pop_test.dart b/packages/flutter/test/material/will_pop_test.dart index f63e1996cdb..27dd45b03d1 100644 --- a/packages/flutter/test/material/will_pop_test.dart +++ b/packages/flutter/test/material/will_pop_test.dart @@ -34,7 +34,7 @@ class SamplePageState extends State { @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: new Text('Sample Page')), + appBar: new AppBar(title: const Text('Sample Page')), ); } } @@ -49,7 +49,7 @@ class SampleForm extends StatelessWidget { @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: new Text('Sample Form')), + appBar: new AppBar(title: const Text('Sample Form')), body: new SizedBox.expand( child: new Form( onWillPop: () { @@ -77,12 +77,12 @@ void main() { await tester.pumpWidget( new MaterialApp( home: new Scaffold( - appBar: new AppBar(title: new Text('Home')), + appBar: new AppBar(title: const Text('Home')), body: new Builder( builder: (BuildContext context) { return new Center( child: new FlatButton( - child: new Text('X'), + child: const Text('X'), onPressed: () { showDialog( context: context, @@ -131,12 +131,12 @@ void main() { Widget buildFrame() { return new MaterialApp( home: new Scaffold( - appBar: new AppBar(title: new Text('Home')), + appBar: new AppBar(title: const Text('Home')), body: new Builder( builder: (BuildContext context) { return new Center( child: new FlatButton( - child: new Text('X'), + child: const Text('X'), onPressed: () { Navigator.of(context).push(new MaterialPageRoute( builder: (BuildContext context) { @@ -188,11 +188,11 @@ void main() { child: new AlertDialog( actions: [ new FlatButton( - child: new Text('YES'), + child: const Text('YES'), onPressed: () { Navigator.of(context).pop(true); }, ), new FlatButton( - child: new Text('NO'), + child: const Text('NO'), onPressed: () { Navigator.of(context).pop(false); }, ), ], @@ -203,12 +203,12 @@ void main() { Widget buildFrame() { return new MaterialApp( home: new Scaffold( - appBar: new AppBar(title: new Text('Home')), + appBar: new AppBar(title: const Text('Home')), body: new Builder( builder: (BuildContext context) { return new Center( child: new FlatButton( - child: new Text('X'), + child: const Text('X'), onPressed: () { Navigator.of(context).push(new MaterialPageRoute( builder: (BuildContext context) { @@ -289,12 +289,12 @@ void main() { Widget buildFrame() { return new MaterialApp( home: new Scaffold( - appBar: new AppBar(title: new Text('Home')), + appBar: new AppBar(title: const Text('Home')), body: new Builder( builder: (BuildContext context) { return new Center( child: new FlatButton( - child: new Text('X'), + child: const Text('X'), onPressed: () { Navigator.of(context).push(route); }, diff --git a/packages/flutter/test/painting/text_painter_test.dart b/packages/flutter/test/painting/text_painter_test.dart index a15760a31fd..ef018547a1a 100644 --- a/packages/flutter/test/painting/text_painter_test.dart +++ b/packages/flutter/test/painting/text_painter_test.dart @@ -36,9 +36,9 @@ void main() { test('TextPainter size test', () { final TextPainter painter = new TextPainter( - text: new TextSpan( + text: const TextSpan( text: 'X', - style: new TextStyle( + style: const TextStyle( inherit: false, fontFamily: 'Ahem', fontSize: 123.0, diff --git a/packages/flutter/test/widgets/animated_container_test.dart b/packages/flutter/test/widgets/animated_container_test.dart index 8af02401b5c..6f159eabee2 100644 --- a/packages/flutter/test/widgets/animated_container_test.dart +++ b/packages/flutter/test/widgets/animated_container_test.dart @@ -119,7 +119,7 @@ void main() { duration: const Duration(milliseconds: 200), width: 100.0, height: 100.0, - child: new Text('X') + child: const Text('X') ) ) ); @@ -139,7 +139,7 @@ void main() { duration: const Duration(milliseconds: 200), width: 200.0, height: 200.0, - child: new Text('X') + child: const Text('X') ) ) ); @@ -163,7 +163,7 @@ void main() { duration: const Duration(milliseconds: 200), width: 200.0, height: 100.0, - child: new Text('X') + child: const Text('X') ) ) ); diff --git a/packages/flutter/test/widgets/baseline_test.dart b/packages/flutter/test/widgets/baseline_test.dart index 1744941ffa1..23216b06cfc 100644 --- a/packages/flutter/test/widgets/baseline_test.dart +++ b/packages/flutter/test/widgets/baseline_test.dart @@ -8,13 +8,13 @@ import 'package:flutter/widgets.dart'; void main() { testWidgets('Baseline - control test', (WidgetTester tester) async { await tester.pumpWidget( - new Center( - child: new DefaultTextStyle( + const Center( + child: const DefaultTextStyle( style: const TextStyle( fontFamily: 'Ahem', fontSize: 100.0, ), - child: new Text('X'), + child: const Text('X'), ), ), ); @@ -23,16 +23,16 @@ void main() { testWidgets('Baseline - position test', (WidgetTester tester) async { await tester.pumpWidget( - new Center( - child: new Baseline( + const Center( + child: const Baseline( baseline: 180.0, baselineType: TextBaseline.alphabetic, - child: new DefaultTextStyle( + child: const DefaultTextStyle( style: const TextStyle( fontFamily: 'Ahem', fontSize: 100.0, ), - child: new Text('X'), + child: const Text('X'), ), ), ), diff --git a/packages/flutter/test/widgets/center_test.dart b/packages/flutter/test/widgets/center_test.dart index 7cdac37f62f..4364f28a3b9 100644 --- a/packages/flutter/test/widgets/center_test.dart +++ b/packages/flutter/test/widgets/center_test.dart @@ -7,6 +7,6 @@ import 'package:flutter/widgets.dart'; void main() { testWidgets('Can be placed in an infinite box', (WidgetTester tester) async { - await tester.pumpWidget(new ListView(children: [new Center()])); + await tester.pumpWidget(new ListView(children: [const Center()])); }); } diff --git a/packages/flutter/test/widgets/clamp_overscrolls_test.dart b/packages/flutter/test/widgets/clamp_overscrolls_test.dart index 264b15743bc..df9da333bce 100644 --- a/packages/flutter/test/widgets/clamp_overscrolls_test.dart +++ b/packages/flutter/test/widgets/clamp_overscrolls_test.dart @@ -20,9 +20,9 @@ Widget buildFrame(ScrollPhysics physics) { child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - new SizedBox(height: 100.0, child: new Text('top')), + const SizedBox(height: 100.0, child: const Text('top')), new Expanded(child: new Container()), - new SizedBox(height: 100.0, child: new Text('bottom')), + const SizedBox(height: 100.0, child: const Text('bottom')), ], ), ), diff --git a/packages/flutter/test/widgets/container_test.dart b/packages/flutter/test/widgets/container_test.dart index 9d98899bb6b..96ec7da23a8 100644 --- a/packages/flutter/test/widgets/container_test.dart +++ b/packages/flutter/test/widgets/container_test.dart @@ -23,10 +23,10 @@ void main() { maxHeight: 82.0, ), margin: const EdgeInsets.all(5.0), - child: new SizedBox( + child: const SizedBox( width: 25.0, height: 33.0, - child: new DecoratedBox( + child: const DecoratedBox( decoration: const BoxDecoration(backgroundColor: const Color(0xFFFFFF00)), ), ), diff --git a/packages/flutter/test/widgets/dismissible_test.dart b/packages/flutter/test/widgets/dismissible_test.dart index 2dd7d8e3c27..d788cdc6322 100644 --- a/packages/flutter/test/widgets/dismissible_test.dart +++ b/packages/flutter/test/widgets/dismissible_test.dart @@ -313,7 +313,7 @@ void main() { testWidgets('Dismissible starts from the full size when collapsing', (WidgetTester tester) async { scrollDirection = Axis.vertical; dismissDirection = DismissDirection.horizontal; - background = new Text('background'); + background = const Text('background'); await tester.pumpWidget(buildTest()); expect(dismissedItems, isEmpty); diff --git a/packages/flutter/test/widgets/draggable_test.dart b/packages/flutter/test/widgets/draggable_test.dart index 21787ef8d3e..8bb2d15eaeb 100644 --- a/packages/flutter/test/widgets/draggable_test.dart +++ b/packages/flutter/test/widgets/draggable_test.dart @@ -15,15 +15,15 @@ void main() { children: [ new Draggable( data: 1, - child: new Text('Source'), - feedback: new Text('Dragging'), + child: const Text('Source'), + feedback: const Text('Dragging'), onDragStarted: () { ++dragStartedCount; }, ), new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Container(height: 100.0, child: new Text('Target')); + return new Container(height: 100.0, child: const Text('Target')); }, onAccept: accepted.add ), @@ -76,8 +76,8 @@ void main() { children: [ new Draggable( data: 1, - child: new Text('Source'), - feedback: new Text('Dragging') + child: const Text('Source'), + feedback: const Text('Dragging') ), new Stack( children: [ @@ -86,13 +86,13 @@ void main() { onTap: () { events.add('tap'); }, - child: new Container(child: new Text('Button') + child: new Container(child: const Text('Button') ) ), new DragTarget( builder: (BuildContext context, List data, List rejects) { return new IgnorePointer( - child: new Container(child: new Text('Target')) + child: new Container(child: const Text('Target')) ); }, onAccept: (int data) { @@ -171,13 +171,13 @@ void main() { onTap: () { events.add('tap'); }, - child: new Container(child: new Text('Button')) + child: new Container(child: const Text('Button')) ), - feedback: new Text('Dragging') + feedback: const Text('Dragging') ), new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Text('Target'); + return const Text('Target'); }, onAccept: (int data) { events.add('drop'); @@ -220,12 +220,12 @@ void main() { children: [ new LongPressDraggable( data: 1, - child: new Text('Source'), - feedback: new Text('Dragging') + child: const Text('Source'), + feedback: const Text('Dragging') ), new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Text('Target'); + return const Text('Target'); }, onAccept: (int data) { events.add('drop'); @@ -266,12 +266,12 @@ void main() { children: [ new Draggable( data: 1, - child: new Text('Source'), - feedback: new Text('Dragging') + child: const Text('Source'), + feedback: const Text('Dragging') ), new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Text('Target'); + return const Text('Target'); }, onAccept: (int data) { events.add('drop'); @@ -314,7 +314,7 @@ void main() { children: [ new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Text('Target'); + return const Text('Target'); }, onAccept: (int data) { events.add('drop $data'); @@ -323,14 +323,14 @@ void main() { new Container(height: 400.0), new Draggable( data: 1, - child: new Text('H'), - feedback: new Text('Dragging'), + child: const Text('H'), + feedback: const Text('Dragging'), affinity: Axis.horizontal, ), new Draggable( data: 2, - child: new Text('V'), - feedback: new Text('Dragging'), + child: const Text('V'), + feedback: const Text('Dragging'), affinity: Axis.vertical, ), new Container(height: 500.0), @@ -421,7 +421,7 @@ void main() { children: [ new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Text('Target'); + return const Text('Target'); }, onAccept: (int data) { events.add('drop $data'); @@ -430,14 +430,14 @@ void main() { new Container(width: 400.0), new Draggable( data: 1, - child: new Text('H'), - feedback: new Text('Dragging'), + child: const Text('H'), + feedback: const Text('Dragging'), affinity: Axis.horizontal, ), new Draggable( data: 2, - child: new Text('V'), - feedback: new Text('Dragging'), + child: const Text('V'), + feedback: const Text('Dragging'), affinity: Axis.vertical, ), new Container(width: 500.0), @@ -527,15 +527,15 @@ void main() { children: [ new Draggable( data: 1, - child: new Text('Source'), - feedback: new Text('Dragging'), + child: const Text('Source'), + feedback: const Text('Dragging'), onDraggableCanceled: (Velocity velocity, Offset offset) { onDraggableCanceledCalled = true; } ), new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Container(height: 100.0, child: new Text('Target')); + return new Container(height: 100.0, child: const Text('Target')); }, onAccept: accepted.add ), @@ -590,8 +590,8 @@ void main() { children: [ new Draggable( data: 1, - child: new Text('Source'), - feedback: new Text('Dragging'), + child: const Text('Source'), + feedback: const Text('Dragging'), onDraggableCanceled: (Velocity velocity, Offset offset) { onDraggableCanceledCalled = true; onDraggableCanceledVelocity = velocity; @@ -602,7 +602,7 @@ void main() { builder: (BuildContext context, List data, List rejects) { return new Container( height: 100.0, - child: new Text('Target') + child: const Text('Target') ); }, onWillAccept: (int data) => false @@ -659,8 +659,8 @@ void main() { home: new Column(children: [ new Draggable( data: 1, - child: new Text('Source'), - feedback: new Text('Source'), + child: const Text('Source'), + feedback: const Text('Source'), onDraggableCanceled: (Velocity velocity, Offset offset) { onDraggableCanceledCalled = true; onDraggableCanceledVelocity = velocity; @@ -671,7 +671,7 @@ void main() { builder: (BuildContext context, List data, List rejects) { return new Container( height: 100.0, - child: new Text('Target') + child: const Text('Target') ); }, onWillAccept: (int data) => false), @@ -708,13 +708,13 @@ void main() { children: [ new Draggable( data: 1, - child: new Text('IntSource'), - feedback: new Text('IntDragging') + child: const Text('IntSource'), + feedback: const Text('IntDragging') ), new Draggable( data: 1.0, - child: new Text('DoubleSource'), - feedback: new Text('DoubleDragging') + child: const Text('DoubleSource'), + feedback: const Text('DoubleDragging') ), new Stack( children: [ @@ -723,7 +723,7 @@ void main() { return new IgnorePointer( child: new Container( height: 100.0, - child: new Text('Target1') + child: const Text('Target1') ) ); }, @@ -734,7 +734,7 @@ void main() { return new IgnorePointer( child: new Container( height: 100.0, - child: new Text('Target2') + child: const Text('Target2') ) ); }, @@ -821,8 +821,8 @@ void main() { children: [ new Draggable( data: dragTargetData, - child: new Text('Source'), - feedback: new Text('Dragging') + child: const Text('Source'), + feedback: const Text('Dragging') ), new Stack( children: [ @@ -831,7 +831,7 @@ void main() { return new IgnorePointer( child: new Container( height: 100.0, - child: new Text('Target1') + child: const Text('Target1') ) ); }, onAccept: acceptedDragTargetDatas.add @@ -841,7 +841,7 @@ void main() { return new IgnorePointer( child: new Container( height: 100.0, - child: new Text('Target2') + child: const Text('Target2') ) ); }, @@ -882,12 +882,12 @@ void main() { new Draggable( data: 1, maxSimultaneousDrags: maxSimultaneousDrags, - child: new Text('Source'), - feedback: new Text('Dragging') + child: const Text('Source'), + feedback: const Text('Dragging') ), new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Container(height: 100.0, child: new Text('Target')); + return new Container(height: 100.0, child: const Text('Target')); }, onAccept: accepted.add ), @@ -1061,12 +1061,12 @@ void main() { children: [ new Draggable( data: 1, - child: new Text('Source'), - feedback: new Text('Dragging') + child: const Text('Source'), + feedback: const Text('Dragging') ), new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Text('Target'); + return const Text('Target'); }, onAccept: (int data) { events.add('drop'); @@ -1099,8 +1099,8 @@ void main() { children: [ new Draggable( data: 1, - child: new Text('Source'), - feedback: new Text('Dragging') + child: const Text('Source'), + feedback: const Text('Dragging') ), ] ) @@ -1119,12 +1119,12 @@ void main() { children: [ new Draggable( data: 1, - child: new Text('Source'), - feedback: new Text('Dragging') + child: const Text('Source'), + feedback: const Text('Dragging') ), new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Container(height: 100.0, child: new Text('Target')); + return new Container(height: 100.0, child: const Text('Target')); }, onAccept: accepted.add ), @@ -1151,7 +1151,7 @@ void main() { children: [ new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Container(height: 100.0, child: new Text('Target')); + return new Container(height: 100.0, child: const Text('Target')); }, onAccept: accepted.add ), @@ -1193,8 +1193,8 @@ void main() { events.add('tap'); }, child: new LongPressDraggable( - feedback: new Text('Feedback'), - child: new Text('X'), + feedback: const Text('Feedback'), + child: const Text('X'), ), ), ), @@ -1230,15 +1230,15 @@ Future _testChildAnchorFeedbackPosition({WidgetTester tester, double top: children: [ new Draggable( data: 1, - child: new Text('Source'), - feedback: new Text('Dragging'), + child: const Text('Source'), + feedback: const Text('Dragging'), onDragStarted: () { ++dragStartedCount; }, ), new DragTarget( builder: (BuildContext context, List data, List rejects) { - return new Container(height: 100.0, child: new Text('Target')); + return new Container(height: 100.0, child: const Text('Target')); }, onAccept: accepted.add ), diff --git a/packages/flutter/test/widgets/drawer_test.dart b/packages/flutter/test/widgets/drawer_test.dart index f03240814b8..587c63d6d85 100644 --- a/packages/flutter/test/widgets/drawer_test.dart +++ b/packages/flutter/test/widgets/drawer_test.dart @@ -18,7 +18,7 @@ void main() { savedContext = context; return new Scaffold( key: scaffoldKey, - drawer: new Text('drawer'), + drawer: const Text('drawer'), body: new Container() ); } @@ -45,7 +45,7 @@ void main() { new MaterialApp( home: new Scaffold( key: scaffoldKey, - drawer: new Text('drawer'), + drawer: const Text('drawer'), body: new Container() ) ) @@ -80,7 +80,7 @@ void main() { drawer: new Drawer( child: new ListView( children: [ - new Text('drawer'), + const Text('drawer'), new Container( height: 1000.0, decoration: new BoxDecoration( @@ -137,9 +137,9 @@ void main() { drawer: new Drawer( child: new ListView( children: [ - new Text('drawer'), + const Text('drawer'), new FlatButton( - child: new Text('close'), + child: const Text('close'), onPressed: () => Navigator.pop(context) ), ] @@ -147,7 +147,7 @@ void main() { ), body: new Container( child: new FlatButton( - child: new Text('button'), + child: const Text('button'), onPressed: () { buttonPressed = true; } ) ) diff --git a/packages/flutter/test/widgets/flex_test.dart b/packages/flutter/test/widgets/flex_test.dart index 47f991de907..123cc91e583 100644 --- a/packages/flutter/test/widgets/flex_test.dart +++ b/packages/flutter/test/widgets/flex_test.dart @@ -31,8 +31,8 @@ void main() { backgroundColor: const Color(0xFF0000FF)), width: 100.0, height: 100.0, - child: new Center( - child: new Text('X'), + child: const Center( + child: const Text('X'), ), ), ), @@ -52,7 +52,7 @@ void main() { await tester.pumpWidget( new Row( children: [ - new Flexible(child: const SizedBox(width: 100.0, height: 200.0)), + const Flexible(child: const SizedBox(width: 100.0, height: 200.0)), ], ), ); @@ -65,8 +65,8 @@ void main() { await tester.pumpWidget( new Row( children: [ - new Expanded(flex: null, child: new Text('one')), - new Flexible(flex: null, child: new Text('two')), + const Expanded(flex: null, child: const Text('one')), + const Flexible(flex: null, child: const Text('two')), ], ), ); diff --git a/packages/flutter/test/widgets/framework_test.dart b/packages/flutter/test/widgets/framework_test.dart index c851c6ecfbb..c16ec5b1ce7 100644 --- a/packages/flutter/test/widgets/framework_test.dart +++ b/packages/flutter/test/widgets/framework_test.dart @@ -162,14 +162,14 @@ void main() { final Key key = new GlobalKey(debugLabel: 'problematic'); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(1), child: new Container(key: key)), - new Container(key: new ValueKey(2)), + new Container(key: const ValueKey(1), child: new Container(key: key)), + new Container(key: const ValueKey(2)), ], )); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(1), child: new Container(key: key)), - new Container(key: new ValueKey(2), child: new Container(key: key)), + new Container(key: const ValueKey(1), child: new Container(key: key)), + new Container(key: const ValueKey(2), child: new Container(key: key)), ], )); expect(tester.takeException(), isFlutterError); @@ -179,14 +179,14 @@ void main() { final Key key = new GlobalKey(debugLabel: 'problematic'); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(1)), - new Container(key: new ValueKey(2), child: new Container(key: key)), + new Container(key: const ValueKey(1)), + new Container(key: const ValueKey(2), child: new Container(key: key)), ], )); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(1), child: new Container(key: key)), - new Container(key: new ValueKey(2), child: new Container(key: key)), + new Container(key: const ValueKey(1), child: new Container(key: key)), + new Container(key: const ValueKey(2), child: new Container(key: key)), ], )); expect(tester.takeException(), isFlutterError); @@ -196,16 +196,16 @@ void main() { final Key key = new GlobalKey(debugLabel: 'problematic'); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(0), child: new Container(key: key)), - new Container(key: new ValueKey(1)), - new Container(key: new ValueKey(2)), + new Container(key: const ValueKey(0), child: new Container(key: key)), + new Container(key: const ValueKey(1)), + new Container(key: const ValueKey(2)), ], )); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(0)), - new Container(key: new ValueKey(1), child: new Container(key: key)), - new Container(key: new ValueKey(2), child: new Container(key: key)), + new Container(key: const ValueKey(0)), + new Container(key: const ValueKey(1), child: new Container(key: key)), + new Container(key: const ValueKey(2), child: new Container(key: key)), ], )); expect(tester.takeException(), isFlutterError); @@ -215,16 +215,16 @@ void main() { final Key key = new GlobalKey(debugLabel: 'problematic'); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(1)), - new Container(key: new ValueKey(2)), - new Container(key: new ValueKey(3), child: new Container(key: key)), + new Container(key: const ValueKey(1)), + new Container(key: const ValueKey(2)), + new Container(key: const ValueKey(3), child: new Container(key: key)), ], )); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(1), child: new Container(key: key)), - new Container(key: new ValueKey(2), child: new Container(key: key)), - new Container(key: new ValueKey(3)), + new Container(key: const ValueKey(1), child: new Container(key: key)), + new Container(key: const ValueKey(2), child: new Container(key: key)), + new Container(key: const ValueKey(3)), ], )); expect(tester.takeException(), isFlutterError); @@ -329,14 +329,14 @@ void main() { await tester.pumpWidget(new Stack( children: [ new Container(key: key), - new Container(key: new ValueKey(0)), - new Container(key: new ValueKey(1)), + new Container(key: const ValueKey(0)), + new Container(key: const ValueKey(1)), ], )); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(0)), - new Container(key: new ValueKey(1), child: new Container(key: key)), + new Container(key: const ValueKey(0)), + new Container(key: const ValueKey(1), child: new Container(key: key)), ], )); }); @@ -346,15 +346,15 @@ void main() { await tester.pumpWidget(new Stack( children: [ new Container(key: key), - new Container(key: new ValueKey(0)), - new Container(key: new ValueKey(1)), + new Container(key: const ValueKey(0)), + new Container(key: const ValueKey(1)), ], )); await tester.pumpWidget(new Stack( children: [ new Container(key: key), - new Container(key: new ValueKey(0)), - new Container(key: new ValueKey(1), child: new Container(key: key)), + new Container(key: const ValueKey(0)), + new Container(key: const ValueKey(1), child: new Container(key: key)), ], )); expect(tester.takeException(), isFlutterError); @@ -364,15 +364,15 @@ void main() { final Key key = new GlobalKey(debugLabel: 'problematic'); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(0)), - new Container(key: new ValueKey(1)), + new Container(key: const ValueKey(0)), + new Container(key: const ValueKey(1)), new Container(key: key), ], )); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(0)), - new Container(key: new ValueKey(1), child: new Container(key: key)), + new Container(key: const ValueKey(0)), + new Container(key: const ValueKey(1), child: new Container(key: key)), ], )); }); @@ -381,8 +381,8 @@ void main() { final Key key = new GlobalKey(debugLabel: 'problematic'); await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(0)), - new Container(key: new ValueKey(1)), + new Container(key: const ValueKey(0)), + new Container(key: const ValueKey(1)), new Container(key: key), ], )); @@ -394,8 +394,8 @@ void main() { }; await tester.pumpWidget(new Stack( children: [ - new Container(key: new ValueKey(0)), - new Container(key: new ValueKey(1), child: new Container(key: key)), + new Container(key: const ValueKey(0)), + new Container(key: const ValueKey(1), child: new Container(key: key)), new Container(key: key), ], )); diff --git a/packages/flutter/test/widgets/global_keys_duplicated_test.dart b/packages/flutter/test/widgets/global_keys_duplicated_test.dart index 1c121bbef44..7d774a0ee1b 100644 --- a/packages/flutter/test/widgets/global_keys_duplicated_test.dart +++ b/packages/flutter/test/widgets/global_keys_duplicated_test.dart @@ -12,8 +12,8 @@ void main() { // This is actually a test of the regular duplicate key logic, which // happens before the duplicate GlobalKey logic. await tester.pumpWidget(new Row(children: [ - new Container(key: new GlobalObjectKey(0)), - new Container(key: new GlobalObjectKey(0)), + new Container(key: const GlobalObjectKey(0)), + new Container(key: const GlobalObjectKey(0)), ])); final dynamic error = tester.takeException(); expect(error, isFlutterError); @@ -24,8 +24,8 @@ void main() { testWidgets('GlobalKey children of two nodes', (WidgetTester tester) async { await tester.pumpWidget(new Row(children: [ - new Container(child: new Container(key: new GlobalObjectKey(0))), - new Container(child: new Container(key: new GlobalObjectKey(0))), + new Container(child: new Container(key: const GlobalObjectKey(0))), + new Container(child: new Container(key: const GlobalObjectKey(0))), ])); final dynamic error = tester.takeException(); expect(error, isFlutterError); @@ -38,8 +38,8 @@ void main() { testWidgets('GlobalKey children of two different nodes', (WidgetTester tester) async { await tester.pumpWidget(new Row(children: [ - new Container(child: new Container(key: new GlobalObjectKey(0))), - new Container(key: new Key('x'), child: new Container(key: new GlobalObjectKey(0))), + new Container(child: new Container(key: const GlobalObjectKey(0))), + new Container(key: const Key('x'), child: new Container(key: const GlobalObjectKey(0))), ])); final dynamic error = tester.takeException(); expect(error, isFlutterError); @@ -55,12 +55,12 @@ void main() { StateSetter nestedSetState; bool flag = false; await tester.pumpWidget(new Row(children: [ - new Container(child: new Container(key: new GlobalObjectKey(0))), + new Container(child: new Container(key: const GlobalObjectKey(0))), new Container(child: new StatefulBuilder( builder: (BuildContext context, StateSetter setState) { nestedSetState = setState; if (flag) - return new Container(key: new GlobalObjectKey(0)); + return new Container(key: const GlobalObjectKey(0)); return new Container(); }, )), diff --git a/packages/flutter/test/widgets/global_keys_moving_test.dart b/packages/flutter/test/widgets/global_keys_moving_test.dart index a807fcadba5..393344ba326 100644 --- a/packages/flutter/test/widgets/global_keys_moving_test.dart +++ b/packages/flutter/test/widgets/global_keys_moving_test.dart @@ -25,7 +25,7 @@ class StatefulLeafState extends State { void markNeedsBuild() { setState(() { }); } @override - Widget build(BuildContext context) => new Text('leaf'); + Widget build(BuildContext context) => const Text('leaf'); } class KeyedWrapper extends StatelessWidget { diff --git a/packages/flutter/test/widgets/grid_view_layout_test.dart b/packages/flutter/test/widgets/grid_view_layout_test.dart index 49ccb0e5eb6..4645ed1996b 100644 --- a/packages/flutter/test/widgets/grid_view_layout_test.dart +++ b/packages/flutter/test/widgets/grid_view_layout_test.dart @@ -8,10 +8,10 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Empty GridView', (WidgetTester tester) async { final List children = [ - new DecoratedBox(decoration: const BoxDecoration()), - new DecoratedBox(decoration: const BoxDecoration()), - new DecoratedBox(decoration: const BoxDecoration()), - new DecoratedBox(decoration: const BoxDecoration()) + const DecoratedBox(decoration: const BoxDecoration()), + const DecoratedBox(decoration: const BoxDecoration()), + const DecoratedBox(decoration: const BoxDecoration()), + const DecoratedBox(decoration: const BoxDecoration()), ]; await tester.pumpWidget(new Center( @@ -25,11 +25,12 @@ void main() { ), )); - children.forEach((Widget child) { - final RenderBox box = tester.renderObject(find.byConfig(child)); + expect(tester.renderObjectList(find.byType(DecoratedBox)), hasLength(4)); + + for (RenderBox box in tester.renderObjectList(find.byType(DecoratedBox))) { expect(box.size.width, equals(100.0), reason: "child width"); expect(box.size.height, equals(100.0), reason: "child height"); - }); + } final RenderBox grid = tester.renderObject(find.byType(GridView)); expect(grid.size.width, equals(200.0), reason: "grid width"); @@ -48,11 +49,10 @@ void main() { ), )); - children.forEach((Widget child) { - final RenderBox box = tester.renderObject(find.byConfig(child)); + for (RenderBox box in tester.renderObjectList(find.byType(DecoratedBox))) { expect(box.size.width, equals(50.0), reason: "child width"); expect(box.size.height, equals(50.0), reason: "child height"); - }); + } expect(grid.size.width, equals(200.0), reason: "grid width"); expect(grid.size.height, equals(50.0), reason: "grid height"); diff --git a/packages/flutter/test/widgets/heroes_test.dart b/packages/flutter/test/widgets/heroes_test.dart index d6928e6f0ec..c6312513e49 100644 --- a/packages/flutter/test/widgets/heroes_test.dart +++ b/packages/flutter/test/widgets/heroes_test.dart @@ -23,7 +23,7 @@ final Map routes = { new Card(child: new Hero(tag: 'a', child: new Container(height: 100.0, width: 100.0, key: firstKey))), new Container(height: 100.0, width: 100.0), new FlatButton( - child: new Text('two'), + child: const Text('two'), onPressed: () { Navigator.pushNamed(context, '/two'); } ), ] @@ -34,14 +34,14 @@ final Map routes = { key: routeTwoKey, children: [ new FlatButton( - child: new Text('pop'), + child: const Text('pop'), onPressed: () { Navigator.pop(context); } ), new Container(height: 150.0, width: 150.0), new Card(child: new Hero(tag: 'a', child: new Container(height: 150.0, width: 150.0, key: secondKey))), new Container(height: 150.0, width: 150.0), new FlatButton( - child: new Text('three'), + child: const Text('three'), onPressed: () { Navigator.push(context, new ThreeRoute()); }, ), ] @@ -66,7 +66,7 @@ class ThreeRoute extends MaterialPageRoute { class MutatingRoute extends MaterialPageRoute { MutatingRoute() : super(builder: (BuildContext context) { - return new Hero(tag: 'a', child: new Text('MutatingRoute'), key: new UniqueKey()); + return new Hero(tag: 'a', child: const Text('MutatingRoute'), key: new UniqueKey()); }); void markNeedsBuild() { @@ -200,9 +200,9 @@ void main() { home: new Material( child: new ListView( children: [ - new Hero(tag: 'a', child: new Text('foo')), + new Hero(tag: 'a', child: const Text('foo')), new Builder(builder: (BuildContext context) { - return new FlatButton(child: new Text('two'), onPressed: () => Navigator.push(context, route)); + return new FlatButton(child: const Text('two'), onPressed: () => Navigator.push(context, route)); }) ] ) @@ -272,7 +272,7 @@ void main() { child: new Container( width: 100.0, height: 100.0, - child: new Text('foo') + child: const Text('foo') ) ) ) @@ -290,7 +290,7 @@ void main() { child: new Container( width: 100.0, height: 150.0, - child: new Text('bar') + child: const Text('bar') ) ) ) @@ -393,16 +393,16 @@ void main() { home: new Material( child: new ListView( children: [ - new Hero(tag: 'a', child: new Text('a')), - new Hero(tag: 'a', child: new Text('a too')), + new Hero(tag: 'a', child: const Text('a')), + new Hero(tag: 'a', child: const Text('a too')), new Builder( builder: (BuildContext context) { return new FlatButton( - child: new Text('push'), + child: const Text('push'), onPressed: () { Navigator.push(context, new PageRouteBuilder( pageBuilder: (BuildContext context, Animation _, Animation __) { - return new Text('fail'); + return const Text('fail'); }, )); }, @@ -577,7 +577,7 @@ void main() { }, ), new FlatButton( - child: new Text('POP'), + child: const Text('POP'), onPressed: () { Navigator.pop(context); } ), ], @@ -598,7 +598,7 @@ void main() { child: new Hero(tag: 'H', child: new Container(key: homeHeroKey, height: 100.0, width: 100.0)), ), new FlatButton( - child: new Text('PUSH'), + child: const Text('PUSH'), onPressed: () { Navigator.push(context, route); } ), ], @@ -668,17 +668,17 @@ void main() { return new Material( child: new ListView( children: [ - new SizedBox(height: 100.0), + const SizedBox(height: 100.0), // This container will appear at Y=100 new Container( key: routeContainerKey, child: new Hero(tag: 'H', child: new Container(key: routeHeroKey, height: 200.0, width: 200.0)) ), new FlatButton( - child: new Text('POP'), + child: const Text('POP'), onPressed: () { Navigator.pop(context); } ), - new SizedBox(height: 600.0), + const SizedBox(height: 600.0), ], ) ); @@ -693,16 +693,16 @@ void main() { builder: (BuildContext context) { // Navigator.push() needs context return new ListView( children: [ - new SizedBox(height: 200.0), + const SizedBox(height: 200.0), // This container will appear at Y=200 new Container( child: new Hero(tag: 'H', child: new Container(key: homeHeroKey, height: 100.0, width: 100.0)), ), new FlatButton( - child: new Text('PUSH'), + child: const Text('PUSH'), onPressed: () { Navigator.push(context, route); } ), - new SizedBox(height: 600.0), + const SizedBox(height: 600.0), ], ); }, @@ -750,13 +750,13 @@ void main() { return new Material( child: new ListView( children: [ - new SizedBox(height: 100.0), + const SizedBox(height: 100.0), // This container will appear at Y=100 new Container( key: routeContainerKey, child: new Hero(tag: 'H', child: new Container(key: routeHeroKey, height: 200.0, width: 200.0)) ), - new SizedBox(height: 800.0), + const SizedBox(height: 800.0), ], ) ); @@ -771,13 +771,13 @@ void main() { builder: (BuildContext context) { // Navigator.push() needs context return new ListView( children: [ - new SizedBox(height: 200.0), + const SizedBox(height: 200.0), // This container will appear at Y=200 new Container( child: new Hero(tag: 'H', child: new Container(key: homeHeroKey, height: 100.0, width: 100.0)), ), new FlatButton( - child: new Text('PUSH'), + child: const Text('PUSH'), onPressed: () { Navigator.push(context, route); } ), ], @@ -832,7 +832,7 @@ void main() { new Container( child: new Hero(tag: 'BC', child: new Container(key: heroBCKey, height: 150.0)) ), - new SizedBox(height: 800.0), + const SizedBox(height: 800.0), ], ) ); @@ -845,19 +845,19 @@ void main() { return new Material( child: new ListView( children: [ - new SizedBox(height: 100.0), + const SizedBox(height: 100.0), // This container will appear at Y=100 new Container( child: new Hero(tag: 'AB', child: new Container(key: heroABKey, height: 200.0)) ), new FlatButton( - child: new Text('PUSH C'), + child: const Text('PUSH C'), onPressed: () { Navigator.push(context, routeC); } ), new Container( child: new Hero(tag: 'BC', child: new Container(height: 150.0)) ), - new SizedBox(height: 800.0), + const SizedBox(height: 800.0), ], ) ); @@ -872,13 +872,13 @@ void main() { builder: (BuildContext context) { // Navigator.push() needs context return new ListView( children: [ - new SizedBox(height: 200.0), + const SizedBox(height: 200.0), // This container will appear at Y=200 new Container( child: new Hero(tag: 'AB', child: new Container(height: 100.0, width: 100.0)), ), new FlatButton( - child: new Text('PUSH B'), + child: const Text('PUSH B'), onPressed: () { Navigator.push(context, routeB); } ), ], @@ -939,7 +939,7 @@ void main() { ), ), new FlatButton( - child: new Text('POP'), + child: const Text('POP'), onPressed: () { Navigator.pop(context); } ), ], @@ -965,7 +965,7 @@ void main() { ), ), new FlatButton( - child: new Text('PUSH'), + child: const Text('PUSH'), onPressed: () { Navigator.push(context, route); } ), ], diff --git a/packages/flutter/test/widgets/hit_testing_test.dart b/packages/flutter/test/widgets/hit_testing_test.dart index 73899f80dd9..aea00138b67 100644 --- a/packages/flutter/test/widgets/hit_testing_test.dart +++ b/packages/flutter/test/widgets/hit_testing_test.dart @@ -8,7 +8,7 @@ import 'package:flutter/widgets.dart'; void main() { testWidgets('toString control test', (WidgetTester tester) async { - await tester.pumpWidget(new Center(child: new Text('Hello'))); + await tester.pumpWidget(const Center(child: const Text('Hello'))); final HitTestResult result = tester.hitTestOnBinding(Point.origin); expect(result, hasOneLineDescription); expect(result.path.first, hasOneLineDescription); diff --git a/packages/flutter/test/widgets/icon_test.dart b/packages/flutter/test/widgets/icon_test.dart index 5b6d5cc6e2b..0a4a6ab5fca 100644 --- a/packages/flutter/test/widgets/icon_test.dart +++ b/packages/flutter/test/widgets/icon_test.dart @@ -13,7 +13,7 @@ void main() { color: Colors.green[500], opacity: 0.5 ), - child: new Icon(Icons.add) + child: const Icon(Icons.add) ) ); final RichText text = tester.widget(find.byType(RichText)); diff --git a/packages/flutter/test/widgets/inherited_test.dart b/packages/flutter/test/widgets/inherited_test.dart index d83a0c0c79a..813bde213e4 100644 --- a/packages/flutter/test/widgets/inherited_test.dart +++ b/packages/flutter/test/widgets/inherited_test.dart @@ -129,7 +129,7 @@ void main() { builder: (BuildContext context) { final ValueInherited v = context.inheritFromWidgetOfExactType(ValueInherited); log.add('a: ${v.value}'); - return new Text(''); + return const Text(''); } ) ) @@ -146,7 +146,7 @@ void main() { builder: (BuildContext context) { final ValueInherited v = context.inheritFromWidgetOfExactType(ValueInherited); log.add('b: ${v.value}'); - return new Text(''); + return const Text(''); } ) ) @@ -204,7 +204,7 @@ void main() { builder: (BuildContext context) { final ValueInherited v = context.inheritFromWidgetOfExactType(ValueInherited); log.add('a: ${v.value}'); - return new Text(''); + return const Text(''); } ) ) @@ -222,7 +222,7 @@ void main() { builder: (BuildContext context) { final ValueInherited v = context.inheritFromWidgetOfExactType(ValueInherited); log.add('b: ${v.value}'); - return new Text(''); + return const Text(''); } ) ) @@ -265,7 +265,7 @@ void main() { builder: (BuildContext context) { final ValueInherited v = context.inheritFromWidgetOfExactType(ValueInherited); log.add(v.value); - return new Text(''); + return const Text(''); } ); @@ -336,7 +336,7 @@ void main() { builder: (BuildContext context) { final ValueInherited v = context.inheritFromWidgetOfExactType(ValueInherited); log.add(v.value); - return new Text(''); + return const Text(''); } ); diff --git a/packages/flutter/test/widgets/list_view_builder_test.dart b/packages/flutter/test/widgets/list_view_builder_test.dart index bcd5eb21e3d..bebebace2bc 100644 --- a/packages/flutter/test/widgets/list_view_builder_test.dart +++ b/packages/flutter/test/widgets/list_view_builder_test.dart @@ -27,7 +27,7 @@ void main() { ); }, ), - right: new Text('Not Today'), + right: const Text('Not Today'), ); } @@ -74,7 +74,7 @@ void main() { itemExtent: 200.0, itemBuilder: itemBuilder, ), - right: new Text('Not Today') + right: const Text('Not Today') ); } @@ -135,7 +135,7 @@ void main() { itemExtent: 200.0, scrollDirection: Axis.horizontal ), - right: new Text('Not Today') + right: const Text('Not Today') ); } diff --git a/packages/flutter/test/widgets/list_view_correction_test.dart b/packages/flutter/test/widgets/list_view_correction_test.dart index 243dc6f2dee..7dc8a2f49fc 100644 --- a/packages/flutter/test/widgets/list_view_correction_test.dart +++ b/packages/flutter/test/widgets/list_view_correction_test.dart @@ -11,12 +11,12 @@ void main() { await tester.pumpWidget(new ListView( controller: controller, children: [ - new Container(height: 400.0, child: new Text('1')), - new Container(height: 400.0, child: new Text('2')), - new Container(height: 400.0, child: new Text('3')), - new Container(height: 400.0, child: new Text('4')), - new Container(height: 400.0, child: new Text('5')), - new Container(height: 400.0, child: new Text('6')), + new Container(height: 400.0, child: const Text('1')), + new Container(height: 400.0, child: const Text('2')), + new Container(height: 400.0, child: const Text('3')), + new Container(height: 400.0, child: const Text('4')), + new Container(height: 400.0, child: const Text('5')), + new Container(height: 400.0, child: const Text('6')), ], )); @@ -28,12 +28,12 @@ void main() { await tester.pumpWidget(new ListView( controller: controller, children: [ - new Container(height: 200.0, child: new Text('1')), - new Container(height: 400.0, child: new Text('2')), - new Container(height: 400.0, child: new Text('3')), - new Container(height: 400.0, child: new Text('4')), - new Container(height: 400.0, child: new Text('5')), - new Container(height: 400.0, child: new Text('6')), + new Container(height: 200.0, child: const Text('1')), + new Container(height: 400.0, child: const Text('2')), + new Container(height: 400.0, child: const Text('3')), + new Container(height: 400.0, child: const Text('4')), + new Container(height: 400.0, child: const Text('5')), + new Container(height: 400.0, child: const Text('6')), ], )); diff --git a/packages/flutter/test/widgets/list_view_misc_test.dart b/packages/flutter/test/widgets/list_view_misc_test.dart index 5fd5226571e..95cd389231e 100644 --- a/packages/flutter/test/widgets/list_view_misc_test.dart +++ b/packages/flutter/test/widgets/list_view_misc_test.dart @@ -16,7 +16,7 @@ void main() { children: [ new Container( height: 200.0, // less than 600, the height of the test area - child: new Text('Hello') + child: const Text('Hello') ) ] ) @@ -41,7 +41,7 @@ void main() { children: [ new Container( height: 2000.0, // more than 600, the height of the test area - child: new Text('Hello') + child: const Text('Hello') ) ] ) @@ -113,7 +113,7 @@ void main() { Widget buildBlock() { return new ListView( controller: controller, - children: [new Text("A"), new Text("B"), new Text("C")] + children: [const Text("A"), const Text("B"), const Text("C")] ); } await tester.pumpWidget(buildBlock()); diff --git a/packages/flutter/test/widgets/list_view_relayout_test.dart b/packages/flutter/test/widgets/list_view_relayout_test.dart index add6232ba82..a9b949f274a 100644 --- a/packages/flutter/test/widgets/list_view_relayout_test.dart +++ b/packages/flutter/test/widgets/list_view_relayout_test.dart @@ -14,17 +14,17 @@ void main() { new ListView( shrinkWrap: true, children: [ - new Text('1'), - new Text('2'), - new Text('3'), + const Text('1'), + const Text('2'), + const Text('3'), ], ), new ListView( shrinkWrap: true, children: [ - new Text('4'), - new Text('5'), - new Text('6'), + const Text('4'), + const Text('5'), + const Text('6'), ], ), ], @@ -36,14 +36,14 @@ void main() { await tester.pumpWidget(new ListView( children: [ - new SizedBox(height: 100.0, child: new Text('100')), + const SizedBox(height: 100.0, child: const Text('100')), ], )); await tester.pumpWidget(new ListView( children: [ - new SizedBox(height: 100.0, child: new Text('100')), - new SizedBox(height: 200.0, child: new Text('200')), + const SizedBox(height: 100.0, child: const Text('100')), + const SizedBox(height: 200.0, child: const Text('200')), ], )); @@ -53,7 +53,7 @@ void main() { testWidgets('Underflowing ListView contentExtent should track additional children', (WidgetTester tester) async { await tester.pumpWidget(new ListView( children: [ - new SizedBox(height: 100.0, child: new Text('100')), + const SizedBox(height: 100.0, child: const Text('100')), ], )); @@ -62,8 +62,8 @@ void main() { await tester.pumpWidget(new ListView( children: [ - new SizedBox(height: 100.0, child: new Text('100')), - new SizedBox(height: 200.0, child: new Text('200')), + const SizedBox(height: 100.0, child: const Text('100')), + const SizedBox(height: 200.0, child: const Text('200')), ], )); expect(list.geometry.scrollExtent, equals(300.0)); @@ -77,8 +77,8 @@ void main() { testWidgets('Overflowing ListView should relayout for missing children', (WidgetTester tester) async { await tester.pumpWidget(new ListView( children: [ - new SizedBox(height: 300.0, child: new Text('300')), - new SizedBox(height: 400.0, child: new Text('400')), + const SizedBox(height: 300.0, child: const Text('300')), + const SizedBox(height: 400.0, child: const Text('400')), ], )); @@ -87,7 +87,7 @@ void main() { await tester.pumpWidget(new ListView( children: [ - new SizedBox(height: 300.0, child: new Text('300')), + const SizedBox(height: 300.0, child: const Text('300')), ], )); @@ -105,8 +105,8 @@ void main() { testWidgets('Overflowing ListView should not relayout for additional children', (WidgetTester tester) async { await tester.pumpWidget(new ListView( children: [ - new SizedBox(height: 300.0, child: new Text('300')), - new SizedBox(height: 400.0, child: new Text('400')), + const SizedBox(height: 300.0, child: const Text('300')), + const SizedBox(height: 400.0, child: const Text('400')), ], )); @@ -115,9 +115,9 @@ void main() { await tester.pumpWidget(new ListView( children: [ - new SizedBox(height: 300.0, child: new Text('300')), - new SizedBox(height: 400.0, child: new Text('400')), - new SizedBox(height: 100.0, child: new Text('100')), + const SizedBox(height: 300.0, child: const Text('300')), + const SizedBox(height: 400.0, child: const Text('400')), + const SizedBox(height: 100.0, child: const Text('100')), ], )); @@ -137,7 +137,7 @@ void main() { await tester.pumpWidget(new ListView( children: [ - new SizedBox(height: 100.0, child: new Text('100')), + const SizedBox(height: 100.0, child: const Text('100')), ], )); @@ -146,9 +146,9 @@ void main() { await tester.pumpWidget(new ListView( children: [ - new SizedBox(height: 100.0, child: new Text('100')), - new SizedBox(height: 200.0, child: new Text('200')), - new SizedBox(height: 400.0, child: new Text('400')), + const SizedBox(height: 100.0, child: const Text('100')), + const SizedBox(height: 200.0, child: const Text('200')), + const SizedBox(height: 400.0, child: const Text('400')), ], )); diff --git a/packages/flutter/test/widgets/list_view_viewporting_test.dart b/packages/flutter/test/widgets/list_view_viewporting_test.dart index 41afdc91e59..983f0301258 100644 --- a/packages/flutter/test/widgets/list_view_viewporting_test.dart +++ b/packages/flutter/test/widgets/list_view_viewporting_test.dart @@ -27,7 +27,7 @@ void main() { ); }, ), - right: new Text('Not Today'), + right: const Text('Not Today'), ); } @@ -73,7 +73,7 @@ void main() { controller: new ScrollController(initialScrollOffset: 300.0), itemBuilder: itemBuilder, ), - right: new Text('Not Today'), + right: const Text('Not Today'), ); } @@ -123,7 +123,7 @@ void main() { controller: new ScrollController(initialScrollOffset: 300.0), itemBuilder: itemBuilder, ), - right: new Text('Not Today'), + right: const Text('Not Today'), ); } diff --git a/packages/flutter/test/widgets/listener_test.dart b/packages/flutter/test/widgets/listener_test.dart index 316db5dce8f..11c7b60897e 100644 --- a/packages/flutter/test/widgets/listener_test.dart +++ b/packages/flutter/test/widgets/listener_test.dart @@ -24,7 +24,7 @@ void main() { onPointerDown: (_) { log.add('bottom'); }, - child: new Text('X') + child: const Text('X') ) ) ) diff --git a/packages/flutter/test/widgets/modal_barrier_test.dart b/packages/flutter/test/widgets/modal_barrier_test.dart index fa55ee1904b..e4be1c4f0fd 100644 --- a/packages/flutter/test/widgets/modal_barrier_test.dart +++ b/packages/flutter/test/widgets/modal_barrier_test.dart @@ -16,10 +16,10 @@ void main() { onTap: () { tapped = true; }, - child: new SizedBox( + child: const SizedBox( width: 10.0, height: 10.0, - child: new Text('target') + child: const Text('target') ) ); }); @@ -88,7 +88,7 @@ class FirstWidget extends StatelessWidget { Navigator.pushNamed(context, '/modal'); }, child: new Container( - child: new Text('X') + child: const Text('X') ) ); } diff --git a/packages/flutter/test/widgets/navigator_test.dart b/packages/flutter/test/widgets/navigator_test.dart index b03804ebcc3..48cab05b92f 100644 --- a/packages/flutter/test/widgets/navigator_test.dart +++ b/packages/flutter/test/widgets/navigator_test.dart @@ -16,7 +16,7 @@ class FirstWidget extends StatelessWidget { decoration: const BoxDecoration( backgroundColor: const Color(0xFFFFFF00) ), - child: new Text('X') + child: const Text('X') ) ); } @@ -36,7 +36,7 @@ class SecondWidgetState extends State { decoration: const BoxDecoration( backgroundColor: const Color(0xFFFF00FF) ), - child: new Text('Y') + child: const Text('Y') ) ); } @@ -188,11 +188,11 @@ void main() { log.add('left'); Navigator.pushNamed(context, '/second'); }, - child: new Text('left') + child: const Text('left') ), new GestureDetector( onTap: () { log.add('right'); }, - child: new Text('right') + child: const Text('right') ), ] ); diff --git a/packages/flutter/test/widgets/overflow_box_test.dart b/packages/flutter/test/widgets/overflow_box_test.dart index 06b1da6f943..745f08b4a62 100644 --- a/packages/flutter/test/widgets/overflow_box_test.dart +++ b/packages/flutter/test/widgets/overflow_box_test.dart @@ -32,7 +32,7 @@ void main() { testWidgets('OverflowBox implements debugFillDescription', (WidgetTester tester) async { final List description = []; - new OverflowBox( + const OverflowBox( minWidth: 1.0, maxWidth: 2.0, minHeight: 3.0, diff --git a/packages/flutter/test/widgets/overscroll_indicator_test.dart b/packages/flutter/test/widgets/overscroll_indicator_test.dart index 279f58feaa5..c7b87491f44 100644 --- a/packages/flutter/test/widgets/overscroll_indicator_test.dart +++ b/packages/flutter/test/widgets/overscroll_indicator_test.dart @@ -26,7 +26,7 @@ void main() { await tester.pumpWidget( new CustomScrollView( slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), ], ), ); @@ -59,7 +59,7 @@ void main() { await tester.pumpWidget( new CustomScrollView( slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), ], ), ); @@ -94,7 +94,7 @@ void main() { await tester.pumpWidget( new CustomScrollView( slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), ], ), ); @@ -128,7 +128,7 @@ void main() { new CustomScrollView( physics: const AlwaysScrollableScrollPhysics(), slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 20.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 20.0)), ], ), ); @@ -146,7 +146,7 @@ void main() { reverse: true, physics: const AlwaysScrollableScrollPhysics(), slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 20.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 20.0)), ], ), ); @@ -164,7 +164,7 @@ void main() { new CustomScrollView( physics: const AlwaysScrollableScrollPhysics(), slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 20.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 20.0)), ], ), ); @@ -185,7 +185,7 @@ void main() { scrollDirection: Axis.horizontal, physics: const AlwaysScrollableScrollPhysics(), slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 20.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 20.0)), ], ), ); @@ -235,7 +235,7 @@ void main() { physics: const AlwaysScrollableScrollPhysics(), reverse: true, slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 20.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 20.0)), ], ), ), @@ -253,7 +253,7 @@ void main() { scrollDirection: Axis.horizontal, physics: const AlwaysScrollableScrollPhysics(), slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 20.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 20.0)), ], ), ), diff --git a/packages/flutter/test/widgets/page_forward_transitions_test.dart b/packages/flutter/test/widgets/page_forward_transitions_test.dart index 7423a02739e..95e171bef7b 100644 --- a/packages/flutter/test/widgets/page_forward_transitions_test.dart +++ b/packages/flutter/test/widgets/page_forward_transitions_test.dart @@ -87,13 +87,13 @@ void main() { return new Column( children: [ new TestTransition( - childFirstHalf: new Text('A'), - childSecondHalf: new Text('B'), + childFirstHalf: const Text('A'), + childSecondHalf: const Text('B'), animation: route.animation ), new TestTransition( - childFirstHalf: new Text('C'), - childSecondHalf: new Text('D'), + childFirstHalf: const Text('C'), + childSecondHalf: const Text('D'), animation: route.secondaryAnimation ), ] @@ -101,9 +101,9 @@ void main() { } ) ); - case '/2': return new TestRoute(settings: settings, child: new Text('E')); - case '/3': return new TestRoute(settings: settings, child: new Text('F')); - case '/4': return new TestRoute(settings: settings, child: new Text('G')); + case '/2': return new TestRoute(settings: settings, child: const Text('E')); + case '/3': return new TestRoute(settings: settings, child: const Text('F')); + case '/4': return new TestRoute(settings: settings, child: const Text('G')); } } ) diff --git a/packages/flutter/test/widgets/page_transitions_test.dart b/packages/flutter/test/widgets/page_transitions_test.dart index 13979f59cea..0f734416f1a 100644 --- a/packages/flutter/test/widgets/page_transitions_test.dart +++ b/packages/flutter/test/widgets/page_transitions_test.dart @@ -10,7 +10,7 @@ class TestOverlayRoute extends OverlayRoute { Iterable createOverlayEntries() sync* { yield new OverlayEntry(builder: _build); } - Widget _build(BuildContext context) => new Text('Overlay'); + Widget _build(BuildContext context) => const Text('Overlay'); } class PersistentBottomSheetTest extends StatefulWidget { @@ -27,7 +27,7 @@ class PersistentBottomSheetTestState extends State { void showBottomSheet() { _scaffoldKey.currentState.showBottomSheet((BuildContext context) { - return new Text('bottomSheet'); + return const Text('bottomSheet'); }) .closed.whenComplete(() { setState(() { @@ -40,7 +40,7 @@ class PersistentBottomSheetTestState extends State { Widget build(BuildContext context) { return new Scaffold( key: _scaffoldKey, - body: new Text('Sheet') + body: const Text('Sheet') ); } } @@ -50,8 +50,8 @@ void main() { final GlobalKey containerKey1 = new GlobalKey(); final GlobalKey containerKey2 = new GlobalKey(); final Map routes = { - '/': (_) => new Container(key: containerKey1, child: new Text('Home')), - '/settings': (_) => new Container(key: containerKey2, child: new Text('Settings')), + '/': (_) => new Container(key: containerKey1, child: const Text('Home')), + '/settings': (_) => new Container(key: containerKey2, child: const Text('Settings')), }; await tester.pumpWidget(new MaterialApp(routes: routes)); @@ -139,7 +139,7 @@ void main() { decoration: const BoxDecoration(backgroundColor: const Color(0xff00ffff)), child: new Hero( tag: kHeroTag, - child: new Text('Home') + child: const Text('Home') ) ) ), @@ -150,7 +150,7 @@ void main() { decoration: const BoxDecoration(backgroundColor: const Color(0xffff00ff)), child: new Hero( tag: kHeroTag, - child: new Text('Settings') + child: const Text('Settings') ) ) ), @@ -204,8 +204,8 @@ void main() { final GlobalKey containerKey1 = new GlobalKey(); final GlobalKey containerKey2 = new GlobalKey(); final Map routes = { - '/': (_) => new Scaffold(key: containerKey1, body: new Text('Home')), - '/settings': (_) => new Scaffold(key: containerKey2, body: new Text('Settings')), + '/': (_) => new Scaffold(key: containerKey1, body: const Text('Home')), + '/settings': (_) => new Scaffold(key: containerKey2, body: const Text('Settings')), }; await tester.pumpWidget(new MaterialApp( @@ -251,7 +251,7 @@ void main() { final GlobalKey containerKey1 = new GlobalKey(); final GlobalKey containerKey2 = new GlobalKey(); final Map routes = { - '/': (_) => new Scaffold(key: containerKey1, body: new Text('Home')), + '/': (_) => new Scaffold(key: containerKey1, body: const Text('Home')), '/sheet': (_) => new PersistentBottomSheetTest(key: containerKey2), }; @@ -290,15 +290,15 @@ void main() { testWidgets('Test completed future', (WidgetTester tester) async { final Map routes = { - '/': (_) => new Center(child: new Text('home')), - '/next': (_) => new Center(child: new Text('next')), + '/': (_) => const Center(child: const Text('home')), + '/next': (_) => const Center(child: const Text('next')), }; await tester.pumpWidget(new MaterialApp(routes: routes)); final PageRoute route = new MaterialPageRoute( settings: const RouteSettings(name: '/page'), - builder: (BuildContext context) => new Center(child: new Text('page')), + builder: (BuildContext context) => const Center(child: const Text('page')), ); int popCount = 0; diff --git a/packages/flutter/test/widgets/placeholder_test.dart b/packages/flutter/test/widgets/placeholder_test.dart index 68e2d6bf827..03a232aca29 100644 --- a/packages/flutter/test/widgets/placeholder_test.dart +++ b/packages/flutter/test/widgets/placeholder_test.dart @@ -11,7 +11,7 @@ void main() { await tester.pumpWidget(new Placeholder(key: key)); - key.currentState.child = new Text('target'); + key.currentState.child = const Text('target'); expect(find.text('target'), findsNothing); diff --git a/packages/flutter/test/widgets/reassemble_test.dart b/packages/flutter/test/widgets/reassemble_test.dart index afbc6f7cc35..21d683cbfaf 100644 --- a/packages/flutter/test/widgets/reassemble_test.dart +++ b/packages/flutter/test/widgets/reassemble_test.dart @@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('reassemble does not crash', (WidgetTester tester) async { await tester.pumpWidget(new MaterialApp( - home: new Text('Hello World') + home: const Text('Hello World') )); await tester.pump(); tester.binding.reassembleApplication(); diff --git a/packages/flutter/test/widgets/reparent_state_harder_test.dart b/packages/flutter/test/widgets/reparent_state_harder_test.dart index c9c45d46f60..d52f1bf2924 100644 --- a/packages/flutter/test/widgets/reparent_state_harder_test.dart +++ b/packages/flutter/test/widgets/reparent_state_harder_test.dart @@ -52,7 +52,7 @@ class DummyStatefulWidget extends StatefulWidget { class DummyStatefulWidgetState extends State { @override - Widget build(BuildContext context) => new Text('LEAF'); + Widget build(BuildContext context) => const Text('LEAF'); } class RekeyableDummyStatefulWidgetWrapper extends StatefulWidget { diff --git a/packages/flutter/test/widgets/run_app_test.dart b/packages/flutter/test/widgets/run_app_test.dart index 0152f001d83..901cfa1bb70 100644 --- a/packages/flutter/test/widgets/run_app_test.dart +++ b/packages/flutter/test/widgets/run_app_test.dart @@ -11,9 +11,9 @@ void main() { new Material( child: new RaisedButton( onPressed: () { - runApp(new Center(child: new Text('Done'))); + runApp(const Center(child: const Text('Done'))); }, - child: new Text('GO') + child: const Text('GO') ) ) ); diff --git a/packages/flutter/test/widgets/scrollable_custom_scroll_behavior_test.dart b/packages/flutter/test/widgets/scrollable_custom_scroll_behavior_test.dart index 5fd8bfe2c87..be0e2049eda 100644 --- a/packages/flutter/test/widgets/scrollable_custom_scroll_behavior_test.dart +++ b/packages/flutter/test/widgets/scrollable_custom_scroll_behavior_test.dart @@ -121,7 +121,7 @@ void main() { child: new CustomScrollView( controller: new TestScrollController(), slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), ], ), )); @@ -133,7 +133,7 @@ void main() { child: new CustomScrollView( controller: new TestScrollController(), slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), ], ), )); diff --git a/packages/flutter/test/widgets/scrollable_test.dart b/packages/flutter/test/widgets/scrollable_test.dart index 660866f5200..b37f3f34e20 100644 --- a/packages/flutter/test/widgets/scrollable_test.dart +++ b/packages/flutter/test/widgets/scrollable_test.dart @@ -13,7 +13,7 @@ Future pumpTest(WidgetTester tester, TargetPlatform platform) async { ), home: new CustomScrollView( slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 2000.0)), ], ), )); diff --git a/packages/flutter/test/widgets/semantics_1_test.dart b/packages/flutter/test/widgets/semantics_1_test.dart index 5f29050f35f..c700d03050d 100644 --- a/packages/flutter/test/widgets/semantics_1_test.dart +++ b/packages/flutter/test/widgets/semantics_1_test.dart @@ -32,13 +32,13 @@ void main() { children: [ new Container( height: 10.0, - child: new Semantics(label: 'child1') + child: const Semantics(label: 'child1') ), new Container( height: 10.0, - child: new IgnorePointer( + child: const IgnorePointer( ignoring: true, - child: new Semantics(label: 'child2') + child: const Semantics(label: 'child2') ) ), ], @@ -54,13 +54,13 @@ void main() { children: [ new Container( height: 10.0, - child: new Semantics(label: 'child1') + child: const Semantics(label: 'child1') ), new Container( height: 10.0, - child: new IgnorePointer( + child: const IgnorePointer( ignoring: false, - child: new Semantics(label: 'child2') + child: const Semantics(label: 'child2') ) ), ], @@ -93,13 +93,13 @@ void main() { children: [ new Container( height: 10.0, - child: new Semantics(label: 'child1') + child: const Semantics(label: 'child1') ), new Container( height: 10.0, - child: new IgnorePointer( + child: const IgnorePointer( ignoring: true, - child: new Semantics(label: 'child2') + child: const Semantics(label: 'child2') ) ), ], @@ -114,13 +114,13 @@ void main() { children: [ new Container( height: 10.0, - child: new Semantics(label: 'child1') + child: const Semantics(label: 'child1') ), new Container( height: 10.0, - child: new IgnorePointer( + child: const IgnorePointer( ignoring: false, - child: new Semantics(label: 'child2') + child: const Semantics(label: 'child2') ) ), ], diff --git a/packages/flutter/test/widgets/semantics_2_test.dart b/packages/flutter/test/widgets/semantics_2_test.dart index 2a4a32d0660..f6c65f011f2 100644 --- a/packages/flutter/test/widgets/semantics_2_test.dart +++ b/packages/flutter/test/widgets/semantics_2_test.dart @@ -23,13 +23,13 @@ void main() { children: [ new Container( height: 10.0, - child: new Semantics(label: 'child1') + child: const Semantics(label: 'child1') ), new Container( height: 10.0, - child: new IgnorePointer( + child: const IgnorePointer( ignoring: false, - child: new Semantics(label: 'child2') + child: const Semantics(label: 'child2') ) ), ], @@ -62,13 +62,13 @@ void main() { children: [ new Container( height: 10.0, - child: new Semantics(label: 'child1') + child: const Semantics(label: 'child1') ), new Container( height: 10.0, - child: new IgnorePointer( + child: const IgnorePointer( ignoring: true, - child: new Semantics(label: 'child2') + child: const Semantics(label: 'child2') ) ), ], @@ -84,13 +84,13 @@ void main() { children: [ new Container( height: 10.0, - child: new Semantics(label: 'child1') + child: const Semantics(label: 'child1') ), new Container( height: 10.0, - child: new IgnorePointer( + child: const IgnorePointer( ignoring: false, - child: new Semantics(label: 'child2') + child: const Semantics(label: 'child2') ) ), ], diff --git a/packages/flutter/test/widgets/semantics_3_test.dart b/packages/flutter/test/widgets/semantics_3_test.dart index e0bbfc9475e..3203a1da2a8 100644 --- a/packages/flutter/test/widgets/semantics_3_test.dart +++ b/packages/flutter/test/widgets/semantics_3_test.dart @@ -20,7 +20,7 @@ void main() { child: new Semantics( label: 'test', child: new Container( - child: new Semantics( + child: const Semantics( checked: true ) ) @@ -40,7 +40,7 @@ void main() { await tester.pumpWidget( new Container( child: new Container( - child: new Semantics( + child: const Semantics( checked: true ) ) @@ -58,7 +58,7 @@ void main() { await tester.pumpWidget( new Container( child: new Container( - child: new Semantics( + child: const Semantics( label: 'test' ) ) @@ -78,7 +78,7 @@ void main() { child: new Semantics( checked: true, child: new Container( - child: new Semantics( + child: const Semantics( label: 'test' ) ) @@ -105,7 +105,7 @@ void main() { child: new Semantics( checked: true, child: new Container( - child: new Semantics( + child: const Semantics( label: 'test' ) ) diff --git a/packages/flutter/test/widgets/semantics_4_test.dart b/packages/flutter/test/widgets/semantics_4_test.dart index 61d56e3a68a..014aa069ba7 100644 --- a/packages/flutter/test/widgets/semantics_4_test.dart +++ b/packages/flutter/test/widgets/semantics_4_test.dart @@ -23,17 +23,17 @@ void main() { await tester.pumpWidget( new Stack( children: [ - new Semantics( + const Semantics( label: 'L1' ), new Semantics( label: 'L2', child: new Stack( children: [ - new Semantics( + const Semantics( checked: true ), - new Semantics( + const Semantics( checked: false ) ] @@ -77,17 +77,17 @@ void main() { await tester.pumpWidget( new Stack( children: [ - new Semantics( + const Semantics( label: 'L1' ), new Semantics( label: 'L2', child: new Stack( children: [ - new Semantics( + const Semantics( checked: true ), - new Semantics() + const Semantics() ] ) ) @@ -119,15 +119,15 @@ void main() { await tester.pumpWidget( new Stack( children: [ - new Semantics(), + const Semantics(), new Semantics( label: 'L2', child: new Stack( children: [ - new Semantics( + const Semantics( checked: true ), - new Semantics() + const Semantics() ] ) ) diff --git a/packages/flutter/test/widgets/semantics_5_test.dart b/packages/flutter/test/widgets/semantics_5_test.dart index 48e81f32d08..47fec0358ed 100644 --- a/packages/flutter/test/widgets/semantics_5_test.dart +++ b/packages/flutter/test/widgets/semantics_5_test.dart @@ -15,14 +15,14 @@ void main() { await tester.pumpWidget( new Stack( children: [ - new Semantics( + const Semantics( // this tests that empty nodes disappear ), - new Semantics( + const Semantics( // this tests whether you can have a container with no other semantics container: true ), - new Semantics( + const Semantics( label: 'label' // (force a fork) ), ] diff --git a/packages/flutter/test/widgets/semantics_7_test.dart b/packages/flutter/test/widgets/semantics_7_test.dart index 55706267bb1..0d93968cc1c 100644 --- a/packages/flutter/test/widgets/semantics_7_test.dart +++ b/packages/flutter/test/widgets/semantics_7_test.dart @@ -33,7 +33,7 @@ void main() { new MergeSemantics( child: new Stack( children: [ - new Semantics( + const Semantics( checked: true ), new Semantics( @@ -83,7 +83,7 @@ void main() { new MergeSemantics( child: new Stack( children: [ - new Semantics( + const Semantics( checked: true ), new Semantics( diff --git a/packages/flutter/test/widgets/semantics_8_test.dart b/packages/flutter/test/widgets/semantics_8_test.dart index 0383c4023e1..feb31d8d8d3 100644 --- a/packages/flutter/test/widgets/semantics_8_test.dart +++ b/packages/flutter/test/widgets/semantics_8_test.dart @@ -22,10 +22,10 @@ void main() { container: true, child: new Stack( children: [ - new Semantics( + const Semantics( checked: true ), - new Semantics( + const Semantics( label: 'label' ) ] @@ -52,10 +52,10 @@ void main() { container: true, child: new Stack( children: [ - new Semantics( + const Semantics( label: 'label' ), - new Semantics( + const Semantics( checked: true ) ] diff --git a/packages/flutter/test/widgets/semantics_debugger_test.dart b/packages/flutter/test/widgets/semantics_debugger_test.dart index b0bddcc8c1c..d4b5550f7f4 100644 --- a/packages/flutter/test/widgets/semantics_debugger_test.dart +++ b/packages/flutter/test/widgets/semantics_debugger_test.dart @@ -12,11 +12,11 @@ void main() { await tester.pumpWidget( new Stack( children: [ - new Semantics(), - new Semantics( + const Semantics(), + const Semantics( container: true, ), - new Semantics( + const Semantics( label: 'label', ), ], @@ -27,11 +27,11 @@ void main() { new SemanticsDebugger( child: new Stack( children: [ - new Semantics(), - new Semantics( + const Semantics(), + const Semantics( container: true, ), - new Semantics( + const Semantics( label: 'label', ), ], @@ -50,14 +50,14 @@ void main() { new SemanticsDebugger( child: new Stack( children: [ - new Semantics(label: 'label1'), + const Semantics(label: 'label1'), new Positioned( key: key, left: 0.0, top: 0.0, width: 100.0, height: 100.0, - child: new Semantics(label: 'label2'), + child: const Semantics(label: 'label2'), ), ], ), @@ -68,7 +68,7 @@ void main() { new SemanticsDebugger( child: new Stack( children: [ - new Semantics(label: 'label1'), + const Semantics(label: 'label1'), new Semantics( container: true, child: new Stack( @@ -79,9 +79,9 @@ void main() { top: 0.0, width: 100.0, height: 100.0, - child: new Semantics(label: 'label2'), + child: const Semantics(label: 'label2'), ), - new Semantics(label: 'label3'), + const Semantics(label: 'label3'), ], ), ), @@ -94,7 +94,7 @@ void main() { new SemanticsDebugger( child: new Stack( children: [ - new Semantics(label: 'label1'), + const Semantics(label: 'label1'), new Semantics( container: true, child: new Stack( @@ -105,9 +105,9 @@ void main() { top: 0.0, width: 100.0, height: 100.0, - child: new Semantics(label: 'label2')), - new Semantics(label: 'label3'), - new Semantics(label: 'label4'), + child: const Semantics(label: 'label2')), + const Semantics(label: 'label3'), + const Semantics(label: 'label4'), ], ), ), @@ -132,13 +132,13 @@ void main() { onPressed: () { log.add('top'); }, - child: new Text('TOP'), + child: const Text('TOP'), ), new RaisedButton( onPressed: () { log.add('bottom'); }, - child: new Text('BOTTOM'), + child: const Text('BOTTOM'), ), ], ), @@ -205,7 +205,7 @@ void main() { expect(didLongPress, isFalse); didLongPress = true; }, - child: new Text('target'), + child: const Text('target'), ), ), ); diff --git a/packages/flutter/test/widgets/set_state_1_test.dart b/packages/flutter/test/widgets/set_state_1_test.dart index 64e10b15a99..2ce0f1f51e0 100644 --- a/packages/flutter/test/widgets/set_state_1_test.dart +++ b/packages/flutter/test/widgets/set_state_1_test.dart @@ -15,7 +15,7 @@ class InsideState extends State { Widget build(BuildContext context) { return new Listener( onPointerDown: _handlePointerDown, - child: new Text('INSIDE') + child: const Text('INSIDE') ); } diff --git a/packages/flutter/test/widgets/set_state_2_test.dart b/packages/flutter/test/widgets/set_state_2_test.dart index f5783ade132..608858e3d51 100644 --- a/packages/flutter/test/widgets/set_state_2_test.dart +++ b/packages/flutter/test/widgets/set_state_2_test.dart @@ -11,7 +11,7 @@ void main() { final Builder inner = new Builder( builder: (BuildContext context) { log.add('inner'); - return new Text('inner'); + return const Text('inner'); } ); int value = 0; diff --git a/packages/flutter/test/widgets/set_state_3_test.dart b/packages/flutter/test/widgets/set_state_3_test.dart index 4a51346e929..0db63bd925b 100644 --- a/packages/flutter/test/widgets/set_state_3_test.dart +++ b/packages/flutter/test/widgets/set_state_3_test.dart @@ -47,7 +47,7 @@ class Leaf extends StatefulWidget { class LeafState extends State { @override - Widget build(BuildContext context) => new Text("leaf"); + Widget build(BuildContext context) => const Text("leaf"); } void main() { diff --git a/packages/flutter/test/widgets/set_state_4_test.dart b/packages/flutter/test/widgets/set_state_4_test.dart index 554986002da..c74afb43d9d 100644 --- a/packages/flutter/test/widgets/set_state_4_test.dart +++ b/packages/flutter/test/widgets/set_state_4_test.dart @@ -16,7 +16,7 @@ class ChangerState extends State { void test2() { setState(() async { }); } @override - Widget build(BuildContext context) => new Text('test'); + Widget build(BuildContext context) => const Text('test'); } void main() { diff --git a/packages/flutter/test/widgets/sliver_fill_remaining_test.dart b/packages/flutter/test/widgets/sliver_fill_remaining_test.dart index 2bb2a2f604a..214efd266cf 100644 --- a/packages/flutter/test/widgets/sliver_fill_remaining_test.dart +++ b/packages/flutter/test/widgets/sliver_fill_remaining_test.dart @@ -37,7 +37,7 @@ void main() { new CustomScrollView( controller: controller, slivers: [ - new SliverToBoxAdapter(child: new SizedBox(height: 100.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 100.0)), new SliverFillRemaining(child: new Container()), ], ), diff --git a/packages/flutter/test/widgets/slivers_appbar_floating_test.dart b/packages/flutter/test/widgets/slivers_appbar_floating_test.dart index c7ded30a291..668063d2963 100644 --- a/packages/flutter/test/widgets/slivers_appbar_floating_test.dart +++ b/packages/flutter/test/widgets/slivers_appbar_floating_test.dart @@ -191,9 +191,9 @@ void main() { new SliverPersistentHeader(delegate: new TestDelegate(), floating: true), new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox( + const SizedBox( height: 300.0, - child: new Text('X'), + child: const Text('X'), ), ]), ), diff --git a/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart b/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart index 34eac49e2b8..d8ad36f8488 100644 --- a/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart +++ b/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart @@ -186,9 +186,9 @@ void main() { new SliverPersistentHeader(delegate: new TestDelegate(), pinned: true), new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox( + const SizedBox( height: 300.0, - child: new Text('X'), + child: const Text('X'), ), ]), ), diff --git a/packages/flutter/test/widgets/slivers_appbar_scrolling_test.dart b/packages/flutter/test/widgets/slivers_appbar_scrolling_test.dart index aea4c402f39..4a45ddc289c 100644 --- a/packages/flutter/test/widgets/slivers_appbar_scrolling_test.dart +++ b/packages/flutter/test/widgets/slivers_appbar_scrolling_test.dart @@ -76,9 +76,9 @@ void main() { new SliverPersistentHeader(delegate: new TestDelegate()), new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox( + const SizedBox( height: 300.0, - child: new Text('X'), + child: const Text('X'), ), ]), ), diff --git a/packages/flutter/test/widgets/slivers_block_test.dart b/packages/flutter/test/widgets/slivers_block_test.dart index 4505693e202..b8ab56f3cff 100644 --- a/packages/flutter/test/widgets/slivers_block_test.dart +++ b/packages/flutter/test/widgets/slivers_block_test.dart @@ -14,11 +14,11 @@ Future test(WidgetTester tester, double offset) { slivers: [ new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox(height: 400.0, child: new Text('a')), - new SizedBox(height: 400.0, child: new Text('b')), - new SizedBox(height: 400.0, child: new Text('c')), - new SizedBox(height: 400.0, child: new Text('d')), - new SizedBox(height: 400.0, child: new Text('e')), + const SizedBox(height: 400.0, child: const Text('a')), + const SizedBox(height: 400.0, child: const Text('b')), + const SizedBox(height: 400.0, child: const Text('c')), + const SizedBox(height: 400.0, child: const Text('d')), + const SizedBox(height: 400.0, child: const Text('e')), ]), ), ], @@ -79,9 +79,9 @@ void main() { slivers: [ new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox(height: 251.0, child: new Text('a')), - new SizedBox(height: 252.0, child: new Text('b')), - new SizedBox(key: key1, height: 253.0, child: new Text('c')), + const SizedBox(height: 251.0, child: const Text('a')), + const SizedBox(height: 252.0, child: const Text('b')), + new SizedBox(key: key1, height: 253.0, child: const Text('c')), ]), ), ], @@ -96,9 +96,9 @@ void main() { slivers: [ new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox(key: key1, height: 253.0, child: new Text('c')), - new SizedBox(height: 251.0, child: new Text('a')), - new SizedBox(height: 252.0, child: new Text('b')), + new SizedBox(key: key1, height: 253.0, child: const Text('c')), + const SizedBox(height: 251.0, child: const Text('a')), + const SizedBox(height: 252.0, child: const Text('b')), ]), ), ], @@ -113,9 +113,9 @@ void main() { slivers: [ new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox(height: 251.0, child: new Text('a')), - new SizedBox(key: key1, height: 253.0, child: new Text('c')), - new SizedBox(height: 252.0, child: new Text('b')), + const SizedBox(height: 251.0, child: const Text('a')), + new SizedBox(key: key1, height: 253.0, child: const Text('c')), + const SizedBox(height: 252.0, child: const Text('b')), ]), ), ], @@ -130,8 +130,8 @@ void main() { slivers: [ new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox(height: 251.0, child: new Text('a')), - new SizedBox(height: 252.0, child: new Text('b')), + const SizedBox(height: 251.0, child: const Text('a')), + const SizedBox(height: 252.0, child: const Text('b')), ]), ), ], @@ -145,9 +145,9 @@ void main() { slivers: [ new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox(height: 251.0, child: new Text('a')), - new SizedBox(key: key1, height: 253.0, child: new Text('c')), - new SizedBox(height: 252.0, child: new Text('b')), + const SizedBox(height: 251.0, child: const Text('a')), + new SizedBox(key: key1, height: 253.0, child: const Text('c')), + const SizedBox(height: 252.0, child: const Text('b')), ]), ), ], @@ -163,8 +163,8 @@ void main() { await tester.pumpWidget(new Viewport( offset: new ViewportOffset.zero(), slivers: [ - new SliverToBoxAdapter( - child: new SizedBox(height: 400.0, child: new Text('a')), + const SliverToBoxAdapter( + child: const SizedBox(height: 400.0, child: const Text('a')), ), ], )); @@ -174,8 +174,8 @@ void main() { await tester.pumpWidget(new Viewport( offset: new ViewportOffset.fixed(100.0), slivers: [ - new SliverToBoxAdapter( - child: new SizedBox(height: 400.0, child: new Text('a')), + const SliverToBoxAdapter( + child: const SizedBox(height: 400.0, child: const Text('a')), ), ], )); @@ -185,8 +185,8 @@ void main() { await tester.pumpWidget(new Viewport( offset: new ViewportOffset.fixed(100.0), slivers: [ - new SliverToBoxAdapter( - child: new SizedBox(height: 4000.0, child: new Text('a')), + const SliverToBoxAdapter( + child: const SizedBox(height: 4000.0, child: const Text('a')), ), ], )); @@ -196,8 +196,8 @@ void main() { await tester.pumpWidget(new Viewport( offset: new ViewportOffset.zero(), slivers: [ - new SliverToBoxAdapter( - child: new SizedBox(height: 4000.0, child: new Text('a')), + const SliverToBoxAdapter( + child: const SizedBox(height: 4000.0, child: const Text('a')), ), ], )); @@ -211,7 +211,7 @@ void main() { slivers: [ new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox(height: 400.0, child: new Text('a')), + const SizedBox(height: 400.0, child: const Text('a')), ]), ), ], @@ -224,7 +224,7 @@ void main() { slivers: [ new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox(height: 400.0, child: new Text('a')), + const SizedBox(height: 400.0, child: const Text('a')), ]), ), ], @@ -237,7 +237,7 @@ void main() { slivers: [ new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox(height: 4000.0, child: new Text('a')), + const SizedBox(height: 4000.0, child: const Text('a')), ]), ), ], @@ -250,7 +250,7 @@ void main() { slivers: [ new SliverList( delegate: new SliverChildListDelegate([ - new SizedBox(height: 4000.0, child: new Text('a')), + const SizedBox(height: 4000.0, child: const Text('a')), ]), ), ], diff --git a/packages/flutter/test/widgets/slivers_padding_test.dart b/packages/flutter/test/widgets/slivers_padding_test.dart index 0a88339b7a2..4d7fbb0a7a4 100644 --- a/packages/flutter/test/widgets/slivers_padding_test.dart +++ b/packages/flutter/test/widgets/slivers_padding_test.dart @@ -11,12 +11,12 @@ Future test(WidgetTester tester, double offset, EdgeInsets padding, AxisDi offset: new ViewportOffset.fixed(offset), axisDirection: axisDirection, slivers: [ - new SliverToBoxAdapter(child: new SizedBox(width: 400.0, height: 400.0, child: new Text('before'))), + const SliverToBoxAdapter(child: const SizedBox(width: 400.0, height: 400.0, child: const Text('before'))), new SliverPadding( padding: padding, - sliver: new SliverToBoxAdapter(child: new SizedBox(width: 400.0, height: 400.0, child: new Text('padded'))), + sliver: const SliverToBoxAdapter(child: const SizedBox(width: 400.0, height: 400.0, child: const Text('padded'))), ), - new SliverToBoxAdapter(child: new SizedBox(width: 400.0, height: 400.0, child: new Text('after'))), + const SliverToBoxAdapter(child: const SizedBox(width: 400.0, height: 400.0, child: const Text('after'))), ], )); } @@ -164,8 +164,8 @@ void main() { await tester.pumpWidget(new Viewport( offset: new ViewportOffset.fixed(0.0), slivers: [ - new SliverPadding(padding: const EdgeInsets.all(100.0)), - new SliverToBoxAdapter(child: new SizedBox(width: 400.0, height: 400.0, child: new Text('x'))), + const SliverPadding(padding: const EdgeInsets.all(100.0)), + const SliverToBoxAdapter(child: const SizedBox(width: 400.0, height: 400.0, child: const Text('x'))), ], )); expect(tester.renderObject(find.text('x')).localToGlobal(Point.origin), const Point(0.0, 200.0)); @@ -176,8 +176,8 @@ void main() { axisDirection: AxisDirection.left, offset: new ViewportOffset.fixed(0.0), slivers: [ - new SliverPadding(padding: const EdgeInsets.fromLTRB(90.0, 1.0, 110.0, 2.0)), - new SliverToBoxAdapter(child: new SizedBox(width: 201.0, child: new Text('x'))), + const SliverPadding(padding: const EdgeInsets.fromLTRB(90.0, 1.0, 110.0, 2.0)), + const SliverToBoxAdapter(child: const SizedBox(width: 201.0, child: const Text('x'))), ], )); expect(tester.renderObject(find.text('x')).localToGlobal(Point.origin), const Point(399.0, 0.0)); @@ -185,8 +185,8 @@ void main() { axisDirection: AxisDirection.left, offset: new ViewportOffset.fixed(0.0), slivers: [ - new SliverPadding(padding: const EdgeInsets.fromLTRB(110.0, 1.0, 80.0, 2.0)), - new SliverToBoxAdapter(child: new SizedBox(width: 201.0, child: new Text('x'))), + const SliverPadding(padding: const EdgeInsets.fromLTRB(110.0, 1.0, 80.0, 2.0)), + const SliverToBoxAdapter(child: const SizedBox(width: 201.0, child: const Text('x'))), ], )); expect(tester.renderObject(find.text('x')).localToGlobal(Point.origin), const Point(409.0, 0.0)); @@ -197,7 +197,7 @@ void main() { axisDirection: AxisDirection.up, offset: new ViewportOffset.fixed(0.0), slivers: [ - new SliverPadding(padding: const EdgeInsets.fromLTRB(1.0, 2.0, 4.0, 8.0)), + const SliverPadding(padding: const EdgeInsets.fromLTRB(1.0, 2.0, 4.0, 8.0)), ], )); expect(tester.renderObject(find.byType(SliverPadding)).afterPadding, 2.0); @@ -205,7 +205,7 @@ void main() { axisDirection: AxisDirection.down, offset: new ViewportOffset.fixed(0.0), slivers: [ - new SliverPadding(padding: const EdgeInsets.fromLTRB(1.0, 2.0, 4.0, 8.0)), + const SliverPadding(padding: const EdgeInsets.fromLTRB(1.0, 2.0, 4.0, 8.0)), ], )); expect(tester.renderObject(find.byType(SliverPadding)).afterPadding, 8.0); @@ -213,7 +213,7 @@ void main() { axisDirection: AxisDirection.right, offset: new ViewportOffset.fixed(0.0), slivers: [ - new SliverPadding(padding: const EdgeInsets.fromLTRB(1.0, 2.0, 4.0, 8.0)), + const SliverPadding(padding: const EdgeInsets.fromLTRB(1.0, 2.0, 4.0, 8.0)), ], )); expect(tester.renderObject(find.byType(SliverPadding)).afterPadding, 4.0); @@ -221,7 +221,7 @@ void main() { axisDirection: AxisDirection.left, offset: new ViewportOffset.fixed(0.0), slivers: [ - new SliverPadding(padding: const EdgeInsets.fromLTRB(1.0, 2.0, 4.0, 8.0)), + const SliverPadding(padding: const EdgeInsets.fromLTRB(1.0, 2.0, 4.0, 8.0)), ], )); expect(tester.renderObject(find.byType(SliverPadding)).afterPadding, 1.0); @@ -229,7 +229,7 @@ void main() { axisDirection: AxisDirection.left, offset: new ViewportOffset.fixed(99999.9), slivers: [ - new SliverPadding(padding: const EdgeInsets.fromLTRB(1.0, 2.0, 4.0, 8.0)), + const SliverPadding(padding: const EdgeInsets.fromLTRB(1.0, 2.0, 4.0, 8.0)), ], )); expect(tester.renderObject(find.byType(SliverPadding)).afterPadding, 1.0); diff --git a/packages/flutter/test/widgets/slivers_test.dart b/packages/flutter/test/widgets/slivers_test.dart index 0a28148f15e..9b46be9fbaf 100644 --- a/packages/flutter/test/widgets/slivers_test.dart +++ b/packages/flutter/test/widgets/slivers_test.dart @@ -11,11 +11,11 @@ Future test(WidgetTester tester, double offset, { double anchor: 0.0 }) { anchor: anchor / 600.0, offset: new ViewportOffset.fixed(offset), slivers: [ - new SliverToBoxAdapter(child: const SizedBox(height: 400.0)), - new SliverToBoxAdapter(child: const SizedBox(height: 400.0)), - new SliverToBoxAdapter(child: const SizedBox(height: 400.0)), - new SliverToBoxAdapter(child: const SizedBox(height: 400.0)), - new SliverToBoxAdapter(child: const SizedBox(height: 400.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 400.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 400.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 400.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 400.0)), + const SliverToBoxAdapter(child: const SizedBox(height: 400.0)), ], )); } diff --git a/packages/flutter/test/widgets/state_setting_in_scrollables_test.dart b/packages/flutter/test/widgets/state_setting_in_scrollables_test.dart index 63971895b1b..0be4eb5130d 100644 --- a/packages/flutter/test/widgets/state_setting_in_scrollables_test.dart +++ b/packages/flutter/test/widgets/state_setting_in_scrollables_test.dart @@ -27,38 +27,38 @@ class FooState extends State { setState(() { /* this is needed to trigger the original bug this is regression-testing */ }); scrollController.animateTo(200.0, duration: const Duration(milliseconds: 500), curve: Curves.linear); }, - child: new DecoratedBox( + child: const DecoratedBox( decoration: const BoxDecoration(backgroundColor: const Color(0)), child: const SizedBox( height: 200.0, ), ) ), - new DecoratedBox( + const DecoratedBox( decoration: const BoxDecoration(backgroundColor: const Color(0)), child: const SizedBox( height: 200.0, ), ), - new DecoratedBox( + const DecoratedBox( decoration: const BoxDecoration(backgroundColor: const Color(0)), child: const SizedBox( height: 200.0, ), ), - new DecoratedBox( + const DecoratedBox( decoration: const BoxDecoration(backgroundColor: const Color(0)), child: const SizedBox( height: 200.0, ), ), - new DecoratedBox( + const DecoratedBox( decoration: const BoxDecoration(backgroundColor: const Color(0)), child: const SizedBox( height: 200.0, ), ), - new DecoratedBox( + const DecoratedBox( decoration: const BoxDecoration(backgroundColor: const Color(0)), child: const SizedBox( height: 200.0, diff --git a/packages/flutter/test/widgets/syncing_test.dart b/packages/flutter/test/widgets/syncing_test.dart index d5ba7b38707..b5cc9ff2c33 100644 --- a/packages/flutter/test/widgets/syncing_test.dart +++ b/packages/flutter/test/widgets/syncing_test.dart @@ -111,8 +111,8 @@ void main() { }); testWidgets('swap instances around', (WidgetTester tester) async { - final Widget a = new TestWidget(persistentState: 0x61, syncedState: 0x41, child: new Text('apple')); - final Widget b = new TestWidget(persistentState: 0x62, syncedState: 0x42, child: new Text('banana')); + final Widget a = new TestWidget(persistentState: 0x61, syncedState: 0x41, child: const Text('apple')); + final Widget b = new TestWidget(persistentState: 0x62, syncedState: 0x42, child: const Text('banana')); await tester.pumpWidget(new Column()); final GlobalKey keyA = new GlobalKey(); diff --git a/packages/flutter/test/widgets/table_test.dart b/packages/flutter/test/widgets/table_test.dart index cbeacde22f5..39c4c1350c9 100644 --- a/packages/flutter/test/widgets/table_test.dart +++ b/packages/flutter/test/widgets/table_test.dart @@ -25,17 +25,17 @@ void main() { children: [ new TableRow( children: [ - new Text('AAAAAA'), new Text('B'), new Text('C') + const Text('AAAAAA'), const Text('B'), const Text('C') ] ), new TableRow( children: [ - new Text('D'), new Text('EEE'), new Text('F') + const Text('D'), const Text('EEE'), const Text('F') ] ), new TableRow( children: [ - new Text('G'), new Text('H'), new Text('III') + const Text('G'), const Text('H'), const Text('III') ] ), ] @@ -56,17 +56,17 @@ void main() { children: [ new TableRow( children: [ - new Text('A'), new Text('B'), new Text('C') + const Text('A'), const Text('B'), const Text('C') ] ), new TableRow( children: [ - new Text('D'), new Text('E'), new Text('F') + const Text('D'), const Text('E'), const Text('F') ] ), new TableRow( children: [ - new Text('G'), new Text('H'), new Text('I') + const Text('G'), const Text('H'), const Text('I') ] ), ] @@ -81,12 +81,12 @@ void main() { children: [ new TableRow( children: [ - new Text('a'), new Text('b'), new Text('c'), new Text('d') + const Text('a'), const Text('b'), const Text('c'), const Text('d') ] ), new TableRow( children: [ - new Text('e'), new Text('f'), new Text('g'), new Text('h') + const Text('e'), const Text('f'), const Text('g'), const Text('h') ] ), ] @@ -106,17 +106,17 @@ void main() { children: [ new TableRow( children: [ - new Text('AAAAAA'), new Text('B'), new Text('C') + const Text('AAAAAA'), const Text('B'), const Text('C') ] ), new TableRow( children: [ - new Text('D'), new Text('EEE'), new Text('F') + const Text('D'), const Text('EEE'), const Text('F') ] ), new TableRow( children: [ - new Text('G'), new Text('H'), new Text('III') + const Text('G'), const Text('H'), const Text('III') ] ), ] @@ -127,17 +127,17 @@ void main() { children: [ new TableRow( children: [ - new Text('AAA'), new Text('B'), new Text('C') + const Text('AAA'), const Text('B'), const Text('C') ] ), new TableRow( children: [ - new Text('D'), new Text('E'), new Text('FFFFFF') + const Text('D'), const Text('E'), const Text('FFFFFF') ] ), new TableRow( children: [ - new Text('G'), new Text('H'), new Text('III') + const Text('G'), const Text('H'), const Text('III') ] ), ] @@ -159,17 +159,17 @@ void main() { children: [ new TableRow( children: [ - new Text('AAA'), new Text('B'), new Text('C') + const Text('AAA'), const Text('B'), const Text('C') ] ), new TableRow( children: [ - new Text('D'), new Text('E'), new Text('FFFFFF') + const Text('D'), const Text('E'), const Text('FFFFFF') ] ), new TableRow( children: [ - new Text('G'), new Text('H'), new Text('III') + const Text('G'), const Text('H'), const Text('III') ] ), ] @@ -192,17 +192,17 @@ void main() { children: [ new TableRow( children: [ - new Text('AAAAAA'), new Text('B'), new Text('C') + const Text('AAAAAA'), const Text('B'), const Text('C') ] ), new TableRow( children: [ - new Text('D'), new Text('EEE'), new Text('F') + const Text('D'), const Text('EEE'), const Text('F') ] ), new TableRow( children: [ - new Text('G'), new Text('H'), new Text('III') + const Text('G'), const Text('H'), const Text('III') ] ), ] @@ -214,17 +214,17 @@ void main() { children: [ new TableRow( children: [ - new Text('A'), new Text('B'), new Text('C') + const Text('A'), const Text('B'), const Text('C') ] ), new TableRow( children: [ - new Text('D'), new Text('EEE'), new Text('F') + const Text('D'), const Text('EEE'), const Text('F') ] ), new TableRow( children: [ - new Text('G'), new Text('H'), new Text('III') + const Text('G'), const Text('H'), const Text('III') ] ), ] @@ -246,17 +246,17 @@ void main() { children: [ new TableRow( children: [ - new Text('AAA'), new Text('B'), new Text('C') + const Text('AAA'), const Text('B'), const Text('C') ] ), new TableRow( children: [ - new Text('D'), new Text('E'), new Text('FFFFFF') + const Text('D'), const Text('E'), const Text('FFFFFF') ] ), new TableRow( children: [ - new Text('G'), new Text('H'), new Text('III') + const Text('G'), const Text('H'), const Text('III') ] ), ] @@ -268,17 +268,17 @@ void main() { children: [ new TableRow( children: [ - new Text('AAA'), new Text('B'), new Text('C') + const Text('AAA'), const Text('B'), const Text('C') ] ), new TableRow( children: [ - new Text('D'), new Text('E'), new Text('FFFFFF') + const Text('D'), const Text('E'), const Text('FFFFFF') ] ), new TableRow( children: [ - new Text('G'), new Text('H'), new Text('III') + const Text('G'), const Text('H'), const Text('III') ] ), ] @@ -305,14 +305,14 @@ void main() { new StatefulBuilder( builder: (BuildContext context, StateSetter setState) { contexts.add(context); - return new Text('A'); + return const Text('A'); } ) ] ), new TableRow( children: [ - new Text('b') + const Text('b') ] ), ] @@ -323,7 +323,7 @@ void main() { children: [ new TableRow( children: [ - new Text('b') + const Text('b') ] ), new TableRow( @@ -332,7 +332,7 @@ void main() { new StatefulBuilder( builder: (BuildContext context, StateSetter setState) { contexts.add(context); - return new Text('A'); + return const Text('A'); } ) ] diff --git a/packages/flutter/test/widgets/text_test.dart b/packages/flutter/test/widgets/text_test.dart index cce76557ad2..282cbedaec5 100644 --- a/packages/flutter/test/widgets/text_test.dart +++ b/packages/flutter/test/widgets/text_test.dart @@ -9,8 +9,8 @@ void main() { testWidgets('Text respects media query', (WidgetTester tester) async { await tester.pumpWidget(new MediaQuery( data: const MediaQueryData(textScaleFactor: 1.5), - child: new Center( - child: new Text('Hello') + child: const Center( + child: const Text('Hello') ) )); @@ -18,16 +18,16 @@ void main() { expect(text, isNotNull); expect(text.textScaleFactor, 1.5); - await tester.pumpWidget(new Center( - child: new Text('Hello') + await tester.pumpWidget(const Center( + child: const Text('Hello') )); text = tester.firstWidget(find.byType(RichText)); expect(text, isNotNull); expect(text.textScaleFactor, 1.0); - await tester.pumpWidget(new Center( - child: new Text('Hello', textScaleFactor: 3.0) + await tester.pumpWidget(const Center( + child: const Text('Hello', textScaleFactor: 3.0) )); text = tester.firstWidget(find.byType(RichText)); diff --git a/packages/flutter/test/widgets/ticker_provider_test.dart b/packages/flutter/test/widgets/ticker_provider_test.dart index 1b350e1f848..177a1aff28d 100644 --- a/packages/flutter/test/widgets/ticker_provider_test.dart +++ b/packages/flutter/test/widgets/ticker_provider_test.dart @@ -36,7 +36,7 @@ void main() { await tester.pumpWidget(new MaterialApp( home: new LinearProgressIndicator(), routes: { - '/test': (BuildContext context) => new Text('hello'), + '/test': (BuildContext context) => const Text('hello'), }, )); expect(tester.binding.transientCallbackCount, 1); diff --git a/packages/flutter/test/widgets/transitions_test.dart b/packages/flutter/test/widgets/transitions_test.dart index 0359570fc11..c92c0a6dac7 100644 --- a/packages/flutter/test/widgets/transitions_test.dart +++ b/packages/flutter/test/widgets/transitions_test.dart @@ -9,7 +9,7 @@ void main() { testWidgets('toString control test', (WidgetTester tester) async { final Widget widget = new FadeTransition( opacity: kAlwaysCompleteAnimation, - child: new Text('Ready'), + child: const Text('Ready'), ); expect(widget.toString, isNot(throwsException)); }); diff --git a/packages/flutter/test/widgets/wrap_test.dart b/packages/flutter/test/widgets/wrap_test.dart index efc4416b555..32e52815fa6 100644 --- a/packages/flutter/test/widgets/wrap_test.dart +++ b/packages/flutter/test/widgets/wrap_test.dart @@ -21,10 +21,10 @@ void main() { new Wrap( alignment: WrapAlignment.start, children: [ - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), ], ), ); @@ -39,10 +39,10 @@ void main() { new Wrap( alignment: WrapAlignment.center, children: [ - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), ], ), ); @@ -57,10 +57,10 @@ void main() { new Wrap( alignment: WrapAlignment.end, children: [ - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), ], ), ); @@ -76,10 +76,10 @@ void main() { alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.start, children: [ - new SizedBox(width: 300.0, height: 50.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 50.0), + const SizedBox(width: 300.0, height: 50.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 50.0), ], ), ); @@ -95,10 +95,10 @@ void main() { alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.center, children: [ - new SizedBox(width: 300.0, height: 50.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 50.0), + const SizedBox(width: 300.0, height: 50.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 50.0), ], ), ); @@ -114,10 +114,10 @@ void main() { alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.end, children: [ - new SizedBox(width: 300.0, height: 50.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 100.0), - new SizedBox(width: 300.0, height: 50.0), + const SizedBox(width: 300.0, height: 50.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 100.0), + const SizedBox(width: 300.0, height: 50.0), ], ), ); @@ -140,9 +140,9 @@ void main() { alignment: WrapAlignment.center, spacing: 5.0, children: [ - new SizedBox(width: 100.0, height: 10.0), - new SizedBox(width: 200.0, height: 20.0), - new SizedBox(width: 300.0, height: 30.0), + const SizedBox(width: 100.0, height: 10.0), + const SizedBox(width: 200.0, height: 20.0), + const SizedBox(width: 300.0, height: 30.0), ], )); expect(tester.renderObject(find.byType(Wrap)).size, equals(const Size(800.0, 600.0))); @@ -156,9 +156,9 @@ void main() { alignment: WrapAlignment.spaceBetween, spacing: 5.0, children: [ - new SizedBox(width: 100.0, height: 10.0), - new SizedBox(width: 200.0, height: 20.0), - new SizedBox(width: 300.0, height: 30.0), + const SizedBox(width: 100.0, height: 10.0), + const SizedBox(width: 200.0, height: 20.0), + const SizedBox(width: 300.0, height: 30.0), ], )); expect(tester.renderObject(find.byType(Wrap)).size, equals(const Size(800.0, 600.0))); @@ -172,9 +172,9 @@ void main() { alignment: WrapAlignment.spaceAround, spacing: 5.0, children: [ - new SizedBox(width: 100.0, height: 10.0), - new SizedBox(width: 200.0, height: 20.0), - new SizedBox(width: 310.0, height: 30.0), + const SizedBox(width: 100.0, height: 10.0), + const SizedBox(width: 200.0, height: 20.0), + const SizedBox(width: 310.0, height: 30.0), ], )); expect(tester.renderObject(find.byType(Wrap)).size, equals(const Size(800.0, 600.0))); @@ -188,9 +188,9 @@ void main() { alignment: WrapAlignment.spaceEvenly, spacing: 5.0, children: [ - new SizedBox(width: 100.0, height: 10.0), - new SizedBox(width: 200.0, height: 20.0), - new SizedBox(width: 310.0, height: 30.0), + const SizedBox(width: 100.0, height: 10.0), + const SizedBox(width: 200.0, height: 20.0), + const SizedBox(width: 310.0, height: 30.0), ], )); expect(tester.renderObject(find.byType(Wrap)).size, equals(const Size(800.0, 600.0))); @@ -206,11 +206,11 @@ void main() { runAlignment: WrapAlignment.center, runSpacing: 5.0, children: [ - new SizedBox(width: 100.0, height: 10.0), - new SizedBox(width: 200.0, height: 20.0), - new SizedBox(width: 300.0, height: 30.0), - new SizedBox(width: 400.0, height: 40.0), - new SizedBox(width: 500.0, height: 60.0), + const SizedBox(width: 100.0, height: 10.0), + const SizedBox(width: 200.0, height: 20.0), + const SizedBox(width: 300.0, height: 30.0), + const SizedBox(width: 400.0, height: 40.0), + const SizedBox(width: 500.0, height: 60.0), ], )); expect(tester.renderObject(find.byType(Wrap)).size, equals(const Size(800.0, 600.0))); @@ -226,11 +226,11 @@ void main() { runAlignment: WrapAlignment.spaceBetween, runSpacing: 5.0, children: [ - new SizedBox(width: 100.0, height: 10.0), - new SizedBox(width: 200.0, height: 20.0), - new SizedBox(width: 300.0, height: 30.0), - new SizedBox(width: 400.0, height: 40.0), - new SizedBox(width: 500.0, height: 60.0), + const SizedBox(width: 100.0, height: 10.0), + const SizedBox(width: 200.0, height: 20.0), + const SizedBox(width: 300.0, height: 30.0), + const SizedBox(width: 400.0, height: 40.0), + const SizedBox(width: 500.0, height: 60.0), ], )); expect(tester.renderObject(find.byType(Wrap)).size, equals(const Size(800.0, 600.0))); @@ -246,11 +246,11 @@ void main() { runAlignment: WrapAlignment.spaceAround, runSpacing: 5.0, children: [ - new SizedBox(width: 100.0, height: 10.0), - new SizedBox(width: 200.0, height: 20.0), - new SizedBox(width: 300.0, height: 30.0), - new SizedBox(width: 400.0, height: 40.0), - new SizedBox(width: 500.0, height: 70.0), + const SizedBox(width: 100.0, height: 10.0), + const SizedBox(width: 200.0, height: 20.0), + const SizedBox(width: 300.0, height: 30.0), + const SizedBox(width: 400.0, height: 40.0), + const SizedBox(width: 500.0, height: 70.0), ], )); expect(tester.renderObject(find.byType(Wrap)).size, equals(const Size(800.0, 600.0))); @@ -266,11 +266,11 @@ void main() { runAlignment: WrapAlignment.spaceEvenly, runSpacing: 5.0, children: [ - new SizedBox(width: 100.0, height: 10.0), - new SizedBox(width: 200.0, height: 20.0), - new SizedBox(width: 300.0, height: 30.0), - new SizedBox(width: 400.0, height: 40.0), - new SizedBox(width: 500.0, height: 60.0), + const SizedBox(width: 100.0, height: 10.0), + const SizedBox(width: 200.0, height: 20.0), + const SizedBox(width: 300.0, height: 30.0), + const SizedBox(width: 400.0, height: 40.0), + const SizedBox(width: 500.0, height: 60.0), ], )); expect(tester.renderObject(find.byType(Wrap)).size, equals(const Size(800.0, 600.0))); @@ -292,10 +292,10 @@ void main() { alignment: WrapAlignment.end, crossAxisAlignment: WrapCrossAlignment.end, children: [ - new SizedBox(width: 100.0, height: 10.0), - new SizedBox(width: 200.0, height: 20.0), - new SizedBox(width: 300.0, height: 30.0), - new SizedBox(width: 400.0, height: 40.0), + const SizedBox(width: 100.0, height: 10.0), + const SizedBox(width: 200.0, height: 20.0), + const SizedBox(width: 300.0, height: 30.0), + const SizedBox(width: 400.0, height: 40.0), ], ), ), @@ -315,10 +315,10 @@ void main() { alignment: WrapAlignment.end, crossAxisAlignment: WrapCrossAlignment.end, children: [ - new SizedBox(width: 400.0, height: 40.0), - new SizedBox(width: 300.0, height: 30.0), - new SizedBox(width: 200.0, height: 20.0), - new SizedBox(width: 100.0, height: 10.0), + const SizedBox(width: 400.0, height: 40.0), + const SizedBox(width: 300.0, height: 30.0), + const SizedBox(width: 200.0, height: 20.0), + const SizedBox(width: 100.0, height: 10.0), ], ), ), @@ -341,10 +341,10 @@ void main() { alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.start, children: [ - new SizedBox(width: 500.0, height: 10.0), - new SizedBox(width: 500.0, height: 20.0), - new SizedBox(width: 500.0, height: 30.0), - new SizedBox(width: 500.0, height: 40.0), + const SizedBox(width: 500.0, height: 10.0), + const SizedBox(width: 500.0, height: 20.0), + const SizedBox(width: 500.0, height: 30.0), + const SizedBox(width: 500.0, height: 40.0), ], ), ), @@ -369,12 +369,12 @@ void main() { alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.start, children: [ - new SizedBox(width: 10.0, height: 250.0), - new SizedBox(width: 20.0, height: 250.0), - new SizedBox(width: 30.0, height: 250.0), - new SizedBox(width: 40.0, height: 250.0), - new SizedBox(width: 50.0, height: 250.0), - new SizedBox(width: 60.0, height: 250.0), + const SizedBox(width: 10.0, height: 250.0), + const SizedBox(width: 20.0, height: 250.0), + const SizedBox(width: 30.0, height: 250.0), + const SizedBox(width: 40.0, height: 250.0), + const SizedBox(width: 50.0, height: 250.0), + const SizedBox(width: 60.0, height: 250.0), ], ), ), @@ -397,12 +397,12 @@ void main() { spacing: 12.0, runSpacing: 8.0, children: [ - new SizedBox(width: 10.0, height: 250.0), - new SizedBox(width: 20.0, height: 250.0), - new SizedBox(width: 30.0, height: 250.0), - new SizedBox(width: 40.0, height: 250.0), - new SizedBox(width: 50.0, height: 250.0), - new SizedBox(width: 60.0, height: 250.0), + const SizedBox(width: 10.0, height: 250.0), + const SizedBox(width: 20.0, height: 250.0), + const SizedBox(width: 30.0, height: 250.0), + const SizedBox(width: 40.0, height: 250.0), + const SizedBox(width: 50.0, height: 250.0), + const SizedBox(width: 60.0, height: 250.0), ], ), ), @@ -421,7 +421,7 @@ void main() { testWidgets('Visual overflow generates a clip', (WidgetTester tester) async { await tester.pumpWidget(new Wrap( children: [ - new SizedBox(width: 500.0, height: 500.0), + const SizedBox(width: 500.0, height: 500.0), ], )); @@ -429,8 +429,8 @@ void main() { await tester.pumpWidget(new Wrap( children: [ - new SizedBox(width: 500.0, height: 500.0), - new SizedBox(width: 500.0, height: 500.0), + const SizedBox(width: 500.0, height: 500.0), + const SizedBox(width: 500.0, height: 500.0), ], )); @@ -444,10 +444,10 @@ void main() { spacing: 10.0, runSpacing: 15.0, children: [ - new SizedBox(width: 200.0, height: 300.0), - new SizedBox(width: 200.0, height: 300.0), - new SizedBox(width: 200.0, height: 300.0), - new SizedBox(width: 200.0, height: 300.0), + const SizedBox(width: 200.0, height: 300.0), + const SizedBox(width: 200.0, height: 300.0), + const SizedBox(width: 200.0, height: 300.0), + const SizedBox(width: 200.0, height: 300.0), new SizedBox( width: 200.0, height: 300.0, @@ -484,10 +484,10 @@ void main() { direction: Axis.vertical, runSpacing: 7.0, children: [ - new SizedBox(width: 500.0, height: 400.0), - new SizedBox(width: 500.0, height: 400.0), - new SizedBox(width: 500.0, height: 400.0), - new SizedBox(width: 500.0, height: 400.0), + const SizedBox(width: 500.0, height: 400.0), + const SizedBox(width: 500.0, height: 400.0), + const SizedBox(width: 500.0, height: 400.0), + const SizedBox(width: 500.0, height: 400.0), ], )); @@ -509,7 +509,7 @@ void main() { ), child: new Wrap( children: [ - new Text('X'), + const Text('X'), ], ), ), diff --git a/packages/flutter_markdown/example/demo.dart b/packages/flutter_markdown/example/demo.dart index ceb9e482a60..3a99dd6ce52 100644 --- a/packages/flutter_markdown/example/demo.dart +++ b/packages/flutter_markdown/example/demo.dart @@ -30,7 +30,7 @@ void main() { runApp(new MaterialApp( title: "Markdown Demo", home: new Scaffold( - appBar: new AppBar(title: new Text('Markdown Demo')), + appBar: new AppBar(title: const Text('Markdown Demo')), body: new Markdown(data: _kMarkdownData) ) )); diff --git a/packages/flutter_markdown/lib/src/builder.dart b/packages/flutter_markdown/lib/src/builder.dart index 16219639613..7b91ba0bf40 100644 --- a/packages/flutter_markdown/lib/src/builder.dart +++ b/packages/flutter_markdown/lib/src/builder.dart @@ -214,7 +214,7 @@ class MarkdownBuilder implements md.NodeVisitor { Widget _buildBullet(String listTag) { if (listTag == 'ul') - return new Text('•', textAlign: TextAlign.center); + return const Text('•', textAlign: TextAlign.center); final int index = _blocks.last.nextListIndex; return new Padding( diff --git a/packages/flutter_markdown/lib/src/style_sheet.dart b/packages/flutter_markdown/lib/src/style_sheet.dart index ed6eecd941d..f8c0f387333 100644 --- a/packages/flutter_markdown/lib/src/style_sheet.dart +++ b/packages/flutter_markdown/lib/src/style_sheet.dart @@ -46,7 +46,7 @@ class MarkdownStyleSheet { /// Creates a [MarkdownStyleSheet] from the [TextStyle]s in the provided [ThemeData]. factory MarkdownStyleSheet.fromTheme(ThemeData theme) { return new MarkdownStyleSheet( - a: new TextStyle(color: Colors.blue), + a: const TextStyle(color: Colors.blue), p: theme.textTheme.body1, code: new TextStyle( color: Colors.grey.shade700, @@ -83,7 +83,7 @@ class MarkdownStyleSheet { /// [MarkdownStyle.fromTheme]. factory MarkdownStyleSheet.largeFromTheme(ThemeData theme) { return new MarkdownStyleSheet( - a: new TextStyle(color: Colors.blue), + a: const TextStyle(color: Colors.blue), p: theme.textTheme.body1, code: new TextStyle( color: Colors.grey.shade700, diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart index 0de01e07202..7bb8ae78e9c 100644 --- a/packages/flutter_test/lib/src/binding.dart +++ b/packages/flutter_test/lib/src/binding.dart @@ -244,15 +244,15 @@ abstract class TestWidgetsFlutterBinding extends BindingBase fontSize: 40.0 ); - static final Widget _kPreTestMessage = new Center( - child: new Text( + static final Widget _kPreTestMessage = const Center( + child: const Text( 'Test starting...', style: _kMessageStyle ) ); - static final Widget _kPostTestMessage = new Center( - child: new Text( + static final Widget _kPostTestMessage = const Center( + child: const Text( 'Test finished.', style: _kMessageStyle ) diff --git a/packages/flutter_test/test/widget_tester_test.dart b/packages/flutter_test/test/widget_tester_test.dart index f1c9ded4c14..e3c061bf239 100644 --- a/packages/flutter_test/test/widget_tester_test.dart +++ b/packages/flutter_test/test/widget_tester_test.dart @@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { group('findsOneWidget', () { testWidgets('finds exactly one widget', (WidgetTester tester) async { - await tester.pumpWidget(new Text('foo')); + await tester.pumpWidget(const Text('foo')); expect(find.text('foo'), findsOneWidget); }); @@ -34,7 +34,7 @@ void main() { }); testWidgets('fails with a descriptive message', (WidgetTester tester) async { - await tester.pumpWidget(new Text('foo')); + await tester.pumpWidget(const Text('foo')); TestFailure failure; try { @@ -52,7 +52,7 @@ void main() { }); testWidgets('fails with a descriptive message when skipping', (WidgetTester tester) async { - await tester.pumpWidget(new Text('foo')); + await tester.pumpWidget(const Text('foo')); TestFailure failure; try { @@ -70,7 +70,7 @@ void main() { }); testWidgets('pumping', (WidgetTester tester) async { - await tester.pumpWidget(new Text('foo')); + await tester.pumpWidget(const Text('foo')); int count; final AnimationController test = new AnimationController( @@ -106,7 +106,7 @@ void main() { group('find.byElementPredicate', () { testWidgets('fails with a custom description in the message', (WidgetTester tester) async { - await tester.pumpWidget(new Text('foo')); + await tester.pumpWidget(const Text('foo')); final String customDescription = 'custom description'; TestFailure failure; @@ -123,7 +123,7 @@ void main() { group('find.byWidgetPredicate', () { testWidgets('fails with a custom description in the message', (WidgetTester tester) async { - await tester.pumpWidget(new Text('foo')); + await tester.pumpWidget(const Text('foo')); final String customDescription = 'custom description'; TestFailure failure; @@ -141,7 +141,7 @@ void main() { group('find.descendant', () { testWidgets('finds one descendant', (WidgetTester tester) async { await tester.pumpWidget(new Row(children: [ - new Column(children: [new Text('foo'), new Text('bar')]) + new Column(children: [const Text('foo'), const Text('bar')]) ])); expect(find.descendant( @@ -152,8 +152,8 @@ void main() { testWidgets('finds two descendants with different ancestors', (WidgetTester tester) async { await tester.pumpWidget(new Row(children: [ - new Column(children: [new Text('foo'), new Text('bar')]), - new Column(children: [new Text('foo'), new Text('bar')]), + new Column(children: [const Text('foo'), const Text('bar')]), + new Column(children: [const Text('foo'), const Text('bar')]), ])); expect(find.descendant( @@ -164,8 +164,8 @@ void main() { testWidgets('fails with a descriptive message', (WidgetTester tester) async { await tester.pumpWidget(new Row(children: [ - new Column(children: [new Text('foo')]), - new Text('bar') + new Column(children: [const Text('foo')]), + const Text('bar') ])); TestFailure failure; diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart index 8eb52e5e604..0a08b1b3523 100644 --- a/packages/flutter_tools/lib/src/android/android_device.dart +++ b/packages/flutter_tools/lib/src/android/android_device.dart @@ -616,7 +616,7 @@ class _AdbLogReader extends DeviceLogReader { _timeOrigin = null; runCommand(device.adbCommandForDevice(args)).then((Process process) { _process = process; - final Utf8Decoder decoder = new Utf8Decoder(allowMalformed: true); + final Utf8Decoder decoder = const Utf8Decoder(allowMalformed: true); _process.stdout.transform(decoder).transform(const LineSplitter()).listen(_onLine); _process.stderr.transform(decoder).transform(const LineSplitter()).listen(_onLine); _process.exitCode.whenComplete(() { diff --git a/packages/flutter_tools/lib/src/base/io.dart b/packages/flutter_tools/lib/src/base/io.dart index be1b46af61a..d28fc67303d 100644 --- a/packages/flutter_tools/lib/src/base/io.dart +++ b/packages/flutter_tools/lib/src/base/io.dart @@ -138,7 +138,7 @@ class _PosixProcessSignal extends ProcessSignal { @override Stream watch() { if (platform.isWindows) - return new Stream.empty(); + return const Stream.empty(); return super.watch(); } } diff --git a/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart b/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart index 711eba0dc8e..39845670a0d 100644 --- a/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart +++ b/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart @@ -19,7 +19,7 @@ class _FuchsiaLogReader extends DeviceLogReader { Stream _logLines; @override Stream get logLines { - _logLines ??= new Stream.empty(); + _logLines ??= const Stream.empty(); return _logLines; }