diff --git a/dev/bots/analyze-sample-code.dart b/dev/bots/analyze-sample-code.dart index a3087b7507..8662d33a0c 100644 --- a/dev/bots/analyze-sample-code.dart +++ b/dev/bots/analyze-sample-code.dart @@ -218,6 +218,7 @@ dependencies: linter: rules: - unnecessary_const + - unnecessary_new '''); print('Found $sampleCodeSections sample code sections.'); final Process process = await Process.start( @@ -314,18 +315,20 @@ linter: exit(exitCode); } +final RegExp _constructorRegExp = new RegExp(r'[A-Z][a-zA-Z0-9<>.]*\('); + int _expressionId = 0; void processBlock(Line line, List block, List
sections) { if (block.isEmpty) throw '$line: Empty ```dart block in sample code.'; - if (block.first.startsWith('new ') || block.first.startsWith('const ')) { + if (block.first.startsWith('new ') || block.first.startsWith('const ') || block.first.startsWith(_constructorRegExp)) { _expressionId += 1; sections.add(new Section(line, 'dynamic expression$_expressionId = ', block.toList(), ';')); } else if (block.first.startsWith('await ')) { _expressionId += 1; sections.add(new Section(line, 'Future expression$_expressionId() async { ', block.toList(), ' }')); - } else if (block.first.startsWith('class ')) { + } else if (block.first.startsWith('class ') || block.first.startsWith('enum ')) { sections.add(new Section(line, null, block.toList(), null)); } else { final List buffer = []; diff --git a/dev/bots/test/analyze-sample-code_test.dart b/dev/bots/test/analyze-sample-code_test.dart index 0774eea6de..8eb1f11b8f 100644 --- a/dev/bots/test/analyze-sample-code_test.dart +++ b/dev/bots/test/analyze-sample-code_test.dart @@ -30,8 +30,10 @@ void main() { "$directory/main.dart:5:8: Unused import: 'dart:ui'", "$directory/main.dart:6:8: Unused import: 'package:flutter_test/flutter_test.dart'", "$directory/main.dart:9:8: Target of URI doesn't exist: 'package:flutter/known_broken_documentation.dart'", + 'test/analyze-sample-code-test-input/known_broken_documentation.dart:27:5: Unnecessary new keyword (unnecessary_new)', "test/analyze-sample-code-test-input/known_broken_documentation.dart:27:9: Undefined class 'Opacity' (undefined_class)", "test/analyze-sample-code-test-input/known_broken_documentation.dart:29:20: Undefined class 'Text' (undefined_class)", + 'test/analyze-sample-code-test-input/known_broken_documentation.dart:39:5: Unnecessary new keyword (unnecessary_new)', "test/analyze-sample-code-test-input/known_broken_documentation.dart:39:9: Undefined class 'Opacity' (undefined_class)", "test/analyze-sample-code-test-input/known_broken_documentation.dart:41:20: Undefined class 'Text' (undefined_class)", 'test/analyze-sample-code-test-input/known_broken_documentation.dart:42:5: unexpected comma at end of sample code', diff --git a/packages/flutter/lib/src/animation/animations.dart b/packages/flutter/lib/src/animation/animations.dart index 203f9af431..78c3c706aa 100644 --- a/packages/flutter/lib/src/animation/animations.dart +++ b/packages/flutter/lib/src/animation/animations.dart @@ -318,11 +318,10 @@ class ReverseAnimation extends Animation /// linear animation produced by an [AnimationController]: /// /// ``` dart -/// final AnimationController controller = -/// new AnimationController(duration: const Duration(milliseconds: 500)); -/// final CurvedAnimation animation = -/// new CurvedAnimation(parent: controller, curve: Curves.ease); +/// final AnimationController controller = AnimationController(duration: const Duration(milliseconds: 500)); +/// final CurvedAnimation animation = CurvedAnimation(parent: controller, curve: Curves.ease); ///``` +/// /// Depending on the given curve, the output of the [CurvedAnimation] could have /// a wider range than its input. For example, elastic curves such as /// [Curves.elasticIn] will significantly overshoot or undershoot the default diff --git a/packages/flutter/lib/src/animation/tween.dart b/packages/flutter/lib/src/animation/tween.dart index 9b5ae1158c..02e74aff5f 100644 --- a/packages/flutter/lib/src/animation/tween.dart +++ b/packages/flutter/lib/src/animation/tween.dart @@ -97,7 +97,7 @@ class _ChainedEvaluation extends Animatable { /// `_animation`: /// /// ```dart -/// Animation _animation = new Tween( +/// Animation _animation = Tween( /// begin: const Offset(100.0, 50.0), /// end: const Offset(200.0, 300.0), /// ).animate(_controller); diff --git a/packages/flutter/lib/src/animation/tween_sequence.dart b/packages/flutter/lib/src/animation/tween_sequence.dart index c1f8fd04a5..ce079b8c1f 100644 --- a/packages/flutter/lib/src/animation/tween_sequence.dart +++ b/packages/flutter/lib/src/animation/tween_sequence.dart @@ -16,21 +16,21 @@ import 'tween.dart'; /// animation, remain at 10.0 for the next 20%, and then return to /// 10.0 for the final 40%: /// -/// ``` -/// final Animation = new TweenSequence( +/// ```dart +/// final Animation = TweenSequence( /// >[ -/// new TweenSequenceItem( -/// tween: new Tween(begin: 5.0, end: 10.0) -/// .chain(new CurveTween(curve: Curves.ease)), +/// TweenSequenceItem( +/// tween: Tween(begin: 5.0, end: 10.0) +/// .chain(CurveTween(curve: Curves.ease)), /// weight: 40.0, /// ), -/// new TweenSequenceItem( -/// tween: new ConstantTween(10.0), +/// TweenSequenceItem( +/// tween: ConstantTween(10.0), /// weight: 20.0, /// ), -/// new TweenSequenceItem( -/// tween: new Tween(begin: 10.0, end: 5.0) -/// .chain(new CurveTween(curve: Curves.ease)), +/// TweenSequenceItem( +/// tween: Tween(begin: 10.0, end: 5.0) +/// .chain(CurveTween(curve: Curves.ease)), /// weight: 40.0, /// ), /// ], @@ -102,9 +102,10 @@ class TweenSequenceItem { /// /// The value of this item can be "curved" by chaining it to a [CurveTween]. /// For example to create a tween that eases from 0.0 to 10.0: - /// ``` - /// new Tween(begin: 0.0, end: 10.0) - /// .chain(new CurveTween(curve: Curves.ease)) + /// + /// ```dart + /// Tween(begin: 0.0, end: 10.0) + /// .chain(CurveTween(curve: Curves.ease)) /// ``` final Animatable tween; diff --git a/packages/flutter/lib/src/cupertino/segmented_control.dart b/packages/flutter/lib/src/cupertino/segmented_control.dart index 551c0b9792..7b9a880d15 100644 --- a/packages/flutter/lib/src/cupertino/segmented_control.dart +++ b/packages/flutter/lib/src/cupertino/segmented_control.dart @@ -130,7 +130,7 @@ class CupertinoSegmentedControl extends StatefulWidget { /// ```dart /// class SegmentedControlExample extends StatefulWidget { /// @override - /// State createState() => new SegmentedControlExampleState(); + /// State createState() => SegmentedControlExampleState(); /// } /// /// class SegmentedControlExampleState extends State { @@ -143,8 +143,8 @@ class CupertinoSegmentedControl extends StatefulWidget { /// /// @override /// Widget build(BuildContext context) { - /// return new Container( - /// child: new CupertinoSegmentedControl( + /// return Container( + /// child: CupertinoSegmentedControl( /// children: children, /// onValueChanged: (int newValue) { /// setState(() { diff --git a/packages/flutter/lib/src/cupertino/slider.dart b/packages/flutter/lib/src/cupertino/slider.dart index 90fd190c72..62b54f88ef 100644 --- a/packages/flutter/lib/src/cupertino/slider.dart +++ b/packages/flutter/lib/src/cupertino/slider.dart @@ -83,7 +83,7 @@ class CupertinoSlider extends StatefulWidget { /// gets rebuilt; for example: /// /// ```dart - /// new CupertinoSlider( + /// CupertinoSlider( /// value: _cupertinoSliderValue.toDouble(), /// min: 1.0, /// max: 10.0, @@ -116,7 +116,7 @@ class CupertinoSlider extends StatefulWidget { /// ## Sample code /// /// ```dart - /// new CupertinoSlider( + /// CupertinoSlider( /// value: _cupertinoSliderValue.toDouble(), /// min: 1.0, /// max: 10.0, @@ -147,7 +147,7 @@ class CupertinoSlider extends StatefulWidget { /// ## Sample code /// /// ```dart - /// new CupertinoSlider( + /// CupertinoSlider( /// value: _cupertinoSliderValue.toDouble(), /// min: 1.0, /// max: 10.0, diff --git a/packages/flutter/lib/src/cupertino/switch.dart b/packages/flutter/lib/src/cupertino/switch.dart index bad32ec6ef..69cc68c96a 100644 --- a/packages/flutter/lib/src/cupertino/switch.dart +++ b/packages/flutter/lib/src/cupertino/switch.dart @@ -29,10 +29,10 @@ import 'thumb_painter.dart'; /// for accessibility tools. /// /// ```dart -/// new MergeSemantics( -/// child: new ListTile( -/// title: new Text('Lights'), -/// trailing: new CupertinoSwitch( +/// MergeSemantics( +/// child: ListTile( +/// title: Text('Lights'), +/// trailing: CupertinoSwitch( /// value: _lights, /// onChanged: (bool value) { setState(() { _lights = value; }); }, /// ), @@ -70,7 +70,7 @@ class CupertinoSwitch extends StatefulWidget { /// gets rebuilt; for example: /// /// ```dart - /// new CupertinoSwitch( + /// CupertinoSwitch( /// value: _giveVerse, /// onChanged: (bool newValue) { /// setState(() { diff --git a/packages/flutter/lib/src/cupertino/tab_scaffold.dart b/packages/flutter/lib/src/cupertino/tab_scaffold.dart index 793d091d79..7f80de0398 100644 --- a/packages/flutter/lib/src/cupertino/tab_scaffold.dart +++ b/packages/flutter/lib/src/cupertino/tab_scaffold.dart @@ -27,32 +27,32 @@ import 'bottom_tab_bar.dart'; /// A sample code implementing a typical iOS information architecture with tabs. /// /// ```dart -/// new CupertinoTabScaffold( -/// tabBar: new CupertinoTabBar( +/// CupertinoTabScaffold( +/// tabBar: CupertinoTabBar( /// items: [ /// // ... /// ], /// ), /// tabBuilder: (BuildContext context, int index) { -/// return new CupertinoTabView( +/// return CupertinoTabView( /// builder: (BuildContext context) { -/// return new CupertinoPageScaffold( -/// navigationBar: new CupertinoNavigationBar( -/// middle: new Text('Page 1 of tab $index'), +/// return CupertinoPageScaffold( +/// navigationBar: CupertinoNavigationBar( +/// middle: Text('Page 1 of tab $index'), /// ), -/// child: new Center( -/// child: new CupertinoButton( +/// child: Center( +/// child: CupertinoButton( /// child: const Text('Next page'), /// onPressed: () { /// Navigator.of(context).push( -/// new CupertinoPageRoute( +/// CupertinoPageRoute( /// builder: (BuildContext context) { -/// return new CupertinoPageScaffold( -/// navigationBar: new CupertinoNavigationBar( -/// middle: new Text('Page 2 of tab $index'), +/// return CupertinoPageScaffold( +/// navigationBar: CupertinoNavigationBar( +/// middle: Text('Page 2 of tab $index'), /// ), -/// child: new Center( -/// child: new CupertinoButton( +/// child: Center( +/// child: CupertinoButton( /// child: const Text('Back'), /// onPressed: () { Navigator.of(context).pop(); }, /// ), diff --git a/packages/flutter/lib/src/foundation/basic_types.dart b/packages/flutter/lib/src/foundation/basic_types.dart index 990586dfef..7c8b16213f 100644 --- a/packages/flutter/lib/src/foundation/basic_types.dart +++ b/packages/flutter/lib/src/foundation/basic_types.dart @@ -183,7 +183,7 @@ class CachingIterable extends IterableBase { /// yield index; /// } /// - /// Iterable i = new CachingIterable(range(1, 5).iterator); + /// Iterable i = CachingIterable(range(1, 5).iterator); /// print(i.length); // walks the list /// print(i.length); // efficient /// ``` diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index 2123c7f02a..d59983310d 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -1015,17 +1015,17 @@ abstract class DiagnosticsNode { /// of an actual property of the object: /// /// ```dart -/// new MessageProperty('table size', '$columns\u00D7$rows') +/// MessageProperty('table size', '$columns\u00D7$rows') /// ``` /// ```dart -/// new MessageProperty('usefulness ratio', 'no metrics collected yet (never painted)') +/// MessageProperty('usefulness ratio', 'no metrics collected yet (never painted)') /// ``` /// /// On the other hand, [StringProperty] is better suited when the property has a /// concrete value that is a string: /// /// ```dart -/// new StringProperty('name', _name) +/// StringProperty('name', _name) /// ``` /// /// See also: @@ -1322,7 +1322,7 @@ class PercentProperty extends DoubleProperty { /// ## Sample code /// /// ```dart -/// new FlagProperty( +/// FlagProperty( /// 'visible', /// value: true, /// ifFalse: 'hidden', @@ -1334,7 +1334,7 @@ class PercentProperty extends DoubleProperty { /// property value. /// /// ```dart -/// new FlagProperty( +/// FlagProperty( /// 'inherit', /// value: inherit, /// ifTrue: '', @@ -2162,12 +2162,12 @@ abstract class Diagnosticable { /// * Specify `showName` and `showSeparator` in rare cases where the string /// output would look clumsy if they were not set. /// ```dart - /// new DiagnosticsProperty('child(3, 4)', null, ifNull: 'is null', showSeparator: false).toString() + /// DiagnosticsProperty('child(3, 4)', null, ifNull: 'is null', showSeparator: false).toString() /// ``` /// Shows using `showSeparator` to get output `child(3, 4) is null` which /// is more polished than `child(3, 4): is null`. /// ```dart - /// new DiagnosticsProperty('icon', icon, ifNull: '', showName: false)).toString() + /// DiagnosticsProperty('icon', icon, ifNull: '', showName: false)).toString() /// ``` /// Shows using `showName` to omit the property name as in this context the /// property name does not add useful information. @@ -2227,25 +2227,25 @@ abstract class Diagnosticable { /// /// // Omit the property name 'message' when displaying this String property /// // as it would just add visual noise. - /// properties.add(new StringProperty('message', message, showName: false)); + /// properties.add(StringProperty('message', message, showName: false)); /// - /// properties.add(new DoubleProperty('stepWidth', stepWidth)); + /// properties.add(DoubleProperty('stepWidth', stepWidth)); /// /// // A scale of 1.0 does nothing so should be hidden. - /// properties.add(new DoubleProperty('scale', scale, defaultValue: 1.0)); + /// properties.add(DoubleProperty('scale', scale, defaultValue: 1.0)); /// /// // If the hitTestExtent matches the paintExtent, it is just set to its /// // default value so is not relevant. - /// properties.add(new DoubleProperty('hitTestExtent', hitTestExtent, defaultValue: paintExtent)); + /// properties.add(DoubleProperty('hitTestExtent', hitTestExtent, defaultValue: paintExtent)); /// /// // maxWidth of double.infinity indicates the width is unconstrained and /// // so maxWidth has no impact., - /// properties.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.infinity)); + /// properties.add(DoubleProperty('maxWidth', maxWidth, defaultValue: double.infinity)); /// /// // Progress is a value between 0 and 1 or null. Showing it as a /// // percentage makes the meaning clear enough that the name can be /// // hidden. - /// properties.add(new PercentProperty( + /// properties.add(PercentProperty( /// 'progress', /// progress, /// showName: false, @@ -2253,16 +2253,16 @@ abstract class Diagnosticable { /// )); /// /// // Most text fields have maxLines set to 1. - /// properties.add(new IntProperty('maxLines', maxLines, defaultValue: 1)); + /// properties.add(IntProperty('maxLines', maxLines, defaultValue: 1)); /// /// // Specify the unit as otherwise it would be unclear that time is in /// // milliseconds. - /// properties.add(new IntProperty('duration', duration.inMilliseconds, unit: 'ms')); + /// properties.add(IntProperty('duration', duration.inMilliseconds, unit: 'ms')); /// /// // Tooltip is used instead of unit for this case as a unit should be a /// // terse description appropriate to display directly after a number /// // without a space. - /// properties.add(new DoubleProperty( + /// properties.add(DoubleProperty( /// 'device pixel ratio', /// ui.window.devicePixelRatio, /// tooltip: 'physical pixels per logical pixel', @@ -2270,12 +2270,12 @@ abstract class Diagnosticable { /// /// // Displaying the depth value would be distracting. Instead only display /// // if the depth value is missing. - /// properties.add(new ObjectFlagProperty('depth', depth, ifNull: 'no depth')); + /// properties.add(ObjectFlagProperty('depth', depth, ifNull: 'no depth')); /// /// // bool flag that is only shown when the value is true. - /// properties.add(new FlagProperty('using primary controller', value: primary)); + /// properties.add(FlagProperty('using primary controller', value: primary)); /// - /// properties.add(new FlagProperty( + /// properties.add(FlagProperty( /// 'isCurrent', /// value: isCurrent, /// ifTrue: 'active', @@ -2283,20 +2283,20 @@ abstract class Diagnosticable { /// showName: false, /// )); /// - /// properties.add(new DiagnosticsProperty('keepAlive', keepAlive)); + /// properties.add(DiagnosticsProperty('keepAlive', keepAlive)); /// /// // FlagProperty could have also been used in this case. /// // This option results in the text "obscureText: true" instead /// // of "obscureText" which is a bit more verbose but a bit clearer. - /// properties.add(new DiagnosticsProperty('obscureText', obscureText, defaultValue: false)); + /// properties.add(DiagnosticsProperty('obscureText', obscureText, defaultValue: false)); /// - /// properties.add(new EnumProperty('textAlign', textAlign, defaultValue: null)); - /// properties.add(new EnumProperty('repeat', repeat, defaultValue: ImageRepeat.noRepeat)); + /// properties.add(EnumProperty('textAlign', textAlign, defaultValue: null)); + /// properties.add(EnumProperty('repeat', repeat, defaultValue: ImageRepeat.noRepeat)); /// /// // Warn users when the widget is missing but do not show the value. - /// properties.add(new ObjectFlagProperty('widget', widget, ifNull: 'no widget')); + /// properties.add(ObjectFlagProperty('widget', widget, ifNull: 'no widget')); /// - /// properties.add(new IterableProperty( + /// properties.add(IterableProperty( /// 'boxShadow', /// boxShadow, /// defaultValue: null, @@ -2304,7 +2304,7 @@ abstract class Diagnosticable { /// )); /// /// // Getting the value of size throws an exception unless hasSize is true. - /// properties.add(new DiagnosticsProperty.lazy( + /// properties.add(DiagnosticsProperty.lazy( /// 'size', /// () => size, /// description: '${ hasSize ? size : "MISSING" }', @@ -2314,7 +2314,7 @@ abstract class Diagnosticable { /// // good terse description, write a DiagnosticsProperty subclass as in /// // the case of TransformProperty which displays a nice debugging view /// // of a Matrix4 that represents a transform. - /// properties.add(new TransformProperty('transform', transform)); + /// properties.add(TransformProperty('transform', transform)); /// /// // If the value class has a good `toString` method, use /// // DiagnosticsProperty. Specifying the value type ensures @@ -2322,11 +2322,11 @@ abstract class Diagnosticable { /// // provide the right UI affordances. For example, in this case even /// // if color is null, a debugging tool still knows the value is a Color /// // and can display relevant color related UI. - /// properties.add(new DiagnosticsProperty('color', color)); + /// properties.add(DiagnosticsProperty('color', color)); /// /// // Use a custom description to generate a more terse summary than the /// // `toString` method on the map class. - /// properties.add(new DiagnosticsProperty>( + /// properties.add(DiagnosticsProperty>( /// 'handles', /// handles, /// description: handles != null ? diff --git a/packages/flutter/lib/src/foundation/licenses.dart b/packages/flutter/lib/src/foundation/licenses.dart index cbacdf48b6..316307c48e 100644 --- a/packages/flutter/lib/src/foundation/licenses.dart +++ b/packages/flutter/lib/src/foundation/licenses.dart @@ -70,7 +70,7 @@ enum _LicenseEntryWithLineBreaksParserState { /// ```dart /// void initMyLibrary() { /// LicenseRegistry.addLicense(() async* { -/// yield new LicenseEntryWithLineBreaks(['my_library'], ''' +/// yield LicenseEntryWithLineBreaks(['my_library'], ''' /// Copyright 2016 The Sample Authors. All rights reserved. /// /// Redistribution and use in source and binary forms, with or without diff --git a/packages/flutter/lib/src/material/animated_icons/animated_icons.dart b/packages/flutter/lib/src/material/animated_icons/animated_icons.dart index 6e3d27cd64..e86bacc79e 100644 --- a/packages/flutter/lib/src/material/animated_icons/animated_icons.dart +++ b/packages/flutter/lib/src/material/animated_icons/animated_icons.dart @@ -19,7 +19,7 @@ part of material_animated_icons; /// ### Sample code /// /// ```dart -/// new AnimatedIcon( +/// AnimatedIcon( /// icon: AnimatedIcons.menu_arrow, /// progress: controller, /// semanticLabel: 'Show menu', diff --git a/packages/flutter/lib/src/material/app.dart b/packages/flutter/lib/src/material/app.dart index b2eb132fdf..cfcdc91715 100644 --- a/packages/flutter/lib/src/material/app.dart +++ b/packages/flutter/lib/src/material/app.dart @@ -336,7 +336,7 @@ class MaterialApp extends StatefulWidget { /// const FooLocalizationsDelegate(); /// @override /// Future load(Locale locale) { - /// return new SynchronousFuture(new FooLocalizations(locale)); + /// return SynchronousFuture(FooLocalizations(locale)); /// } /// @override /// bool shouldReload(FooLocalizationsDelegate old) => false; @@ -350,7 +350,7 @@ class MaterialApp extends StatefulWidget { /// [localizationsDelegates] list. /// /// ```dart - /// new MaterialApp( + /// MaterialApp( /// localizationsDelegates: [ /// const FooLocalizationsDelegate(), /// ], diff --git a/packages/flutter/lib/src/material/app_bar.dart b/packages/flutter/lib/src/material/app_bar.dart index c99af2cc2e..89ef37bb78 100644 --- a/packages/flutter/lib/src/material/app_bar.dart +++ b/packages/flutter/lib/src/material/app_bar.dart @@ -91,21 +91,21 @@ class _ToolbarContainerLayout extends SingleChildLayoutDelegate { /// ## Sample code /// /// ```dart -/// new AppBar( -/// title: new Text('My Fancy Dress'), +/// AppBar( +/// title: Text('My Fancy Dress'), /// actions: [ -/// new IconButton( -/// icon: new Icon(Icons.playlist_play), +/// IconButton( +/// icon: Icon(Icons.playlist_play), /// tooltip: 'Air it', /// onPressed: _airDress, /// ), -/// new IconButton( -/// icon: new Icon(Icons.playlist_add), +/// IconButton( +/// icon: Icon(Icons.playlist_add), /// tooltip: 'Restitch it', /// onPressed: _restitchDress, /// ), -/// new IconButton( -/// icon: new Icon(Icons.playlist_add_check), +/// IconButton( +/// icon: Icon(Icons.playlist_add_check), /// tooltip: 'Repair it', /// onPressed: _repairDress, /// ), @@ -191,12 +191,12 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget { /// ## Sample code /// /// ```dart - /// new Scaffold( - /// appBar: new AppBar( - /// title: new Text('Hello World'), + /// Scaffold( + /// appBar: AppBar( + /// title: Text('Hello World'), /// actions: [ - /// new IconButton( - /// icon: new Icon(Icons.shopping_cart), + /// IconButton( + /// icon: Icon(Icons.shopping_cart), /// tooltip: 'Open shopping cart', /// onPressed: () { /// // ... @@ -693,13 +693,13 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { /// [CustomScrollView.slivers] list: /// /// ```dart -/// new SliverAppBar( +/// SliverAppBar( /// expandedHeight: 150.0, /// flexibleSpace: const FlexibleSpaceBar( /// title: Text('Available seats'), /// ), /// actions: [ -/// new IconButton( +/// IconButton( /// icon: const Icon(Icons.add_circle), /// tooltip: 'Add new entry', /// onPressed: () { /* ... */ }, @@ -788,15 +788,15 @@ class SliverAppBar extends StatefulWidget { /// ## Sample code /// /// ```dart - /// new Scaffold( - /// body: new CustomScrollView( + /// Scaffold( + /// body: CustomScrollView( /// primary: true, /// slivers: [ - /// new SliverAppBar( - /// title: new Text('Hello World'), + /// SliverAppBar( + /// title: Text('Hello World'), /// actions: [ - /// new IconButton( - /// icon: new Icon(Icons.shopping_cart), + /// IconButton( + /// icon: Icon(Icons.shopping_cart), /// tooltip: 'Open shopping cart', /// onPressed: () { /// // handle the press diff --git a/packages/flutter/lib/src/material/bottom_app_bar.dart b/packages/flutter/lib/src/material/bottom_app_bar.dart index f84f8afecf..cb8c91a4f8 100644 --- a/packages/flutter/lib/src/material/bottom_app_bar.dart +++ b/packages/flutter/lib/src/material/bottom_app_bar.dart @@ -22,12 +22,12 @@ import 'theme.dart'; /// ## Sample code /// /// ```dart -/// new Scaffold( -/// bottomNavigationBar: new BottomAppBar( +/// Scaffold( +/// bottomNavigationBar: BottomAppBar( /// color: Colors.white, /// child: bottomAppBarContents, /// ), -/// floatingActionButton: new FloatingActionButton(onPressed: null), +/// floatingActionButton: FloatingActionButton(onPressed: null), /// ) /// ``` /// diff --git a/packages/flutter/lib/src/material/button.dart b/packages/flutter/lib/src/material/button.dart index 9a75ac1e70..712bea27d9 100644 --- a/packages/flutter/lib/src/material/button.dart +++ b/packages/flutter/lib/src/material/button.dart @@ -293,11 +293,11 @@ class MaterialButton extends StatelessWidget { /// Typically, a material design color will be used, as follows: /// /// ```dart - /// new MaterialButton( - /// color: Colors.blue[500], - /// onPressed: _handleTap, - /// child: new Text('DEMO'), - /// ), + /// MaterialButton( + /// color: Colors.blue[500], + /// onPressed: _handleTap, + /// child: Text('DEMO'), + /// ), /// ``` final Color color; diff --git a/packages/flutter/lib/src/material/button_theme.dart b/packages/flutter/lib/src/material/button_theme.dart index 42a9247523..6ae76f213c 100644 --- a/packages/flutter/lib/src/material/button_theme.dart +++ b/packages/flutter/lib/src/material/button_theme.dart @@ -190,9 +190,9 @@ class ButtonThemeData extends Diagnosticable { /// Simply a convenience that returns [minWidth] and [height] as a /// [BoxConstraints] object: /// ```dart - /// return new BoxConstraints( + /// return BoxConstraints( /// minWidth: minWidth, - /// minHeight: height, + /// minHeight: height, /// ); /// ``` BoxConstraints get constraints { diff --git a/packages/flutter/lib/src/material/card.dart b/packages/flutter/lib/src/material/card.dart index 688f6f0178..cce955a449 100644 --- a/packages/flutter/lib/src/material/card.dart +++ b/packages/flutter/lib/src/material/card.dart @@ -17,8 +17,8 @@ import 'theme.dart'; /// Here is an example of using a [Card] widget. /// /// ```dart -/// new Card( -/// child: new Column( +/// Card( +/// child: Column( /// mainAxisSize: MainAxisSize.min, /// children: [ /// const ListTile( @@ -26,14 +26,14 @@ import 'theme.dart'; /// title: Text('The Enchanted Nightingale'), /// subtitle: Text('Music by Julie Gable. Lyrics by Sidney Stein.'), /// ), -/// new ButtonTheme.bar( // make buttons use the appropriate styles for cards -/// child: new ButtonBar( +/// ButtonTheme.bar( // make buttons use the appropriate styles for cards +/// child: ButtonBar( /// children: [ -/// new FlatButton( +/// FlatButton( /// child: const Text('BUY TICKETS'), /// onPressed: () { /* ... */ }, /// ), -/// new FlatButton( +/// FlatButton( /// child: const Text('LISTEN'), /// onPressed: () { /* ... */ }, /// ), diff --git a/packages/flutter/lib/src/material/checkbox.dart b/packages/flutter/lib/src/material/checkbox.dart index 5c3fe5cfee..ca116ad47f 100644 --- a/packages/flutter/lib/src/material/checkbox.dart +++ b/packages/flutter/lib/src/material/checkbox.dart @@ -87,7 +87,7 @@ class Checkbox extends StatefulWidget { /// gets rebuilt; for example: /// /// ```dart - /// new Checkbox( + /// Checkbox( /// value: _throwShotAway, /// onChanged: (bool newValue) { /// setState(() { diff --git a/packages/flutter/lib/src/material/checkbox_list_tile.dart b/packages/flutter/lib/src/material/checkbox_list_tile.dart index 9c1c9fe34f..fdb6ae5131 100644 --- a/packages/flutter/lib/src/material/checkbox_list_tile.dart +++ b/packages/flutter/lib/src/material/checkbox_list_tile.dart @@ -40,7 +40,7 @@ import 'theme_data.dart'; /// (including the animation of the checkbox itself getting checked!). /// /// ```dart -/// new CheckboxListTile( +/// CheckboxListTile( /// title: const Text('Animate Slowly'), /// value: timeDilation != 1.0, /// onChanged: (bool value) { @@ -113,14 +113,14 @@ class CheckboxListTile extends StatelessWidget { /// gets rebuilt; for example: /// /// ```dart - /// new CheckboxListTile( + /// CheckboxListTile( /// value: _throwShotAway, /// onChanged: (bool newValue) { /// setState(() { /// _throwShotAway = newValue; /// }); /// }, - /// title: new Text('Throw away your shot'), + /// title: Text('Throw away your shot'), /// ) /// ``` final ValueChanged onChanged; diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index f23d2f9769..741cca209b 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -156,7 +156,7 @@ abstract class DeletableChipAttributes { /// /// class CastList extends StatefulWidget { /// @override - /// State createState() => new CastListState(); + /// State createState() => CastListState(); /// } /// /// class CastListState extends State { @@ -169,11 +169,11 @@ abstract class DeletableChipAttributes { /// /// Iterable get actorWidgets sync* { /// for (Actor actor in _cast) { - /// yield new Padding( + /// yield Padding( /// padding: const EdgeInsets.all(4.0), - /// child: new Chip( - /// avatar: new CircleAvatar(child: new Text(actor.initials)), - /// label: new Text(actor.name), + /// child: Chip( + /// avatar: CircleAvatar(child: Text(actor.initials)), + /// label: Text(actor.name), /// onDeleted: () { /// setState(() { /// _cast.removeWhere((Actor entry) { @@ -188,7 +188,7 @@ abstract class DeletableChipAttributes { /// /// @override /// Widget build(BuildContext context) { - /// return new Wrap( + /// return Wrap( /// children: actorWidgets.toList(), /// ); /// } @@ -253,7 +253,7 @@ abstract class SelectableChipAttributes { /// ```dart /// class Wood extends StatefulWidget { /// @override - /// State createState() => new WoodState(); + /// State createState() => WoodState(); /// } /// /// class WoodState extends State { @@ -261,7 +261,7 @@ abstract class SelectableChipAttributes { /// /// @override /// Widget build(BuildContext context) { - /// return new InputChip( + /// return InputChip( /// label: const Text('Use Chisel'), /// selected: _useChisel, /// onSelected: (bool newValue) { @@ -369,7 +369,7 @@ abstract class TappableChipAttributes { /// /// @override /// Widget build(BuildContext context) { - /// return new InputChip( + /// return InputChip( /// label: const Text('Apply Hammer'), /// onPressed: startHammering, /// ); @@ -397,12 +397,12 @@ abstract class TappableChipAttributes { /// ## Sample code /// /// ```dart -/// new Chip( -/// avatar: new CircleAvatar( +/// Chip( +/// avatar: CircleAvatar( /// backgroundColor: Colors.grey.shade800, -/// child: new Text('AB'), +/// child: Text('AB'), /// ), -/// label: new Text('Aaron Burr'), +/// label: Text('Aaron Burr'), /// ) /// ``` /// @@ -513,12 +513,12 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri /// ## Sample code /// /// ```dart -/// new InputChip( -/// avatar: new CircleAvatar( +/// InputChip( +/// avatar: CircleAvatar( /// backgroundColor: Colors.grey.shade800, -/// child: new Text('AB'), +/// child: Text('AB'), /// ), -/// label: new Text('Aaron Burr'), +/// label: Text('Aaron Burr'), /// onPressed: () { /// print('I am the one thing in life.'); /// } @@ -661,7 +661,7 @@ class InputChip extends StatelessWidget /// ```dart /// class MyThreeOptions extends StatefulWidget { /// @override -/// _MyThreeOptionsState createState() => new _MyThreeOptionsState(); +/// _MyThreeOptionsState createState() => _MyThreeOptionsState(); /// } /// /// class _MyThreeOptionsState extends State { @@ -669,12 +669,12 @@ class InputChip extends StatelessWidget /// /// @override /// Widget build(BuildContext context) { -/// return new Wrap( -/// children: new List.generate( +/// return Wrap( +/// children: List.generate( /// 3, /// (int index) { -/// return new ChoiceChip( -/// label: new Text('Item $index'), +/// return ChoiceChip( +/// label: Text('Item $index'), /// selected: _value == index, /// onSelected: (bool selected) { /// _value = selected ? index : null; @@ -807,7 +807,7 @@ class ChoiceChip extends StatelessWidget /// /// class CastFilter extends StatefulWidget { /// @override -/// State createState() => new CastFilterState(); +/// State createState() => CastFilterState(); /// } /// /// class CastFilterState extends State { @@ -821,11 +821,11 @@ class ChoiceChip extends StatelessWidget /// /// Iterable get actorWidgets sync* { /// for (ActorFilterEntry actor in _cast) { -/// yield new Padding( +/// yield Padding( /// padding: const EdgeInsets.all(4.0), -/// child: new FilterChip( -/// avatar: new CircleAvatar(child: new Text(actor.initials)), -/// label: new Text(actor.name), +/// child: FilterChip( +/// avatar: CircleAvatar(child: Text(actor.initials)), +/// label: Text(actor.name), /// selected: _filters.contains(actor.name), /// onSelected: (bool value) { /// setState(() { @@ -848,10 +848,10 @@ class ChoiceChip extends StatelessWidget /// return Column( /// mainAxisAlignment: MainAxisAlignment.center, /// children: [ -/// new Wrap( +/// Wrap( /// children: actorWidgets.toList(), /// ), -/// new Text('Look for: ${_filters.join(', ')}'), +/// Text('Look for: ${_filters.join(', ')}'), /// ], /// ); /// } @@ -977,12 +977,12 @@ class FilterChip extends StatelessWidget /// ## Sample code /// /// ```dart -/// new ActionChip( -/// avatar: new CircleAvatar( +/// ActionChip( +/// avatar: CircleAvatar( /// backgroundColor: Colors.grey.shade800, -/// child: new Text('AB'), +/// child: Text('AB'), /// ), -/// label: new Text('Aaron Burr'), +/// label: Text('Aaron Burr'), /// onPressed: () { /// print("If you stand for nothing, Burr, what’ll you fall for?"); /// } diff --git a/packages/flutter/lib/src/material/chip_theme.dart b/packages/flutter/lib/src/material/chip_theme.dart index 445486ae7f..1eb85580ba 100644 --- a/packages/flutter/lib/src/material/chip_theme.dart +++ b/packages/flutter/lib/src/material/chip_theme.dart @@ -66,9 +66,9 @@ class ChipTheme extends InheritedWidget { /// class Spaceship extends StatelessWidget { /// @override /// Widget build(BuildContext context) { - /// return new ChipTheme( + /// return ChipTheme( /// data: ChipTheme.of(context).copyWith(backgroundColor: Colors.red), - /// child: new ActionChip( + /// child: ActionChip( /// label: const Text('Launch'), /// onPressed: () { print('We have liftoff!'); }, /// ), @@ -116,7 +116,7 @@ class ChipTheme extends InheritedWidget { /// ```dart /// class CarColor extends StatefulWidget { /// @override -/// State createState() => new _CarColorState(); +/// State createState() => _CarColorState(); /// } /// /// class _CarColorState extends State { @@ -124,10 +124,10 @@ class ChipTheme extends InheritedWidget { /// /// @override /// Widget build(BuildContext context) { -/// return new ChipTheme( +/// return ChipTheme( /// data: ChipTheme.of(context).copyWith(backgroundColor: Colors.lightBlue), -/// child: new ChoiceChip( -/// label: new Text('Light Blue'), +/// child: ChoiceChip( +/// label: Text('Light Blue'), /// onSelected: (bool value) { /// setState(() { /// _color = value ? Colors.lightBlue : Colors.red; diff --git a/packages/flutter/lib/src/material/circle_avatar.dart b/packages/flutter/lib/src/material/circle_avatar.dart index 7a9ba00599..5d907627e4 100644 --- a/packages/flutter/lib/src/material/circle_avatar.dart +++ b/packages/flutter/lib/src/material/circle_avatar.dart @@ -23,8 +23,8 @@ import 'theme_data.dart'; /// [backgroundImage] property: /// /// ```dart -/// new CircleAvatar( -/// backgroundImage: new NetworkImage(userAvatarUrl), +/// CircleAvatar( +/// backgroundImage: NetworkImage(userAvatarUrl), /// ) /// ``` /// @@ -34,9 +34,9 @@ import 'theme_data.dart'; /// provided using a [Text] widget as the [child] and a [backgroundColor]: /// /// ```dart -/// new CircleAvatar( +/// CircleAvatar( /// backgroundColor: Colors.brown.shade800, -/// child: new Text('AH'), +/// child: Text('AH'), /// ) /// ``` /// diff --git a/packages/flutter/lib/src/material/colors.dart b/packages/flutter/lib/src/material/colors.dart index dcf3909c92..5bd7af124c 100644 --- a/packages/flutter/lib/src/material/colors.dart +++ b/packages/flutter/lib/src/material/colors.dart @@ -116,7 +116,7 @@ class MaterialAccentColor extends ColorSwatch { /// Each [ColorSwatch] constant is a color and can used directly. For example: /// /// ```dart -/// new Container( +/// Container( /// color: Colors.blue, // same as Colors.blue[500] or Colors.blue.shade500 /// ) /// ``` @@ -398,7 +398,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.red[400], /// ) @@ -441,7 +441,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.redAccent[400], /// ) @@ -478,7 +478,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.pink[400], /// ) @@ -521,7 +521,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.pinkAccent[400], /// ) @@ -558,7 +558,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.purple[400], /// ) @@ -601,7 +601,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.purpleAccent[400], /// ) @@ -638,7 +638,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.deepPurple[400], /// ) @@ -681,7 +681,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.deepPurpleAccent[400], /// ) @@ -718,7 +718,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.indigo[400], /// ) @@ -761,7 +761,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.indigoAccent[400], /// ) @@ -800,7 +800,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.blue[400], /// ) @@ -843,7 +843,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.blueAccent[400], /// ) @@ -880,7 +880,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.lightBlue[400], /// ) @@ -923,7 +923,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.lightBlueAccent[400], /// ) @@ -962,7 +962,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.cyan[400], /// ) @@ -1005,7 +1005,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.cyanAccent[400], /// ) @@ -1042,7 +1042,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.teal[400], /// ) @@ -1085,7 +1085,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.tealAccent[400], /// ) @@ -1125,7 +1125,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.green[400], /// ) @@ -1171,7 +1171,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.greenAccent[400], /// ) @@ -1208,7 +1208,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.lightGreen[400], /// ) @@ -1251,7 +1251,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.lightGreenAccent[400], /// ) @@ -1288,7 +1288,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.lime[400], /// ) @@ -1331,7 +1331,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.limeAccent[400], /// ) @@ -1368,7 +1368,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.yellow[400], /// ) @@ -1411,7 +1411,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.yellowAccent[400], /// ) @@ -1448,7 +1448,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.amber[400], /// ) @@ -1491,7 +1491,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.amberAccent[400], /// ) @@ -1530,7 +1530,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.orange[400], /// ) @@ -1573,7 +1573,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.orangeAccent[400], /// ) @@ -1612,7 +1612,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.deepOrange[400], /// ) @@ -1655,7 +1655,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.deepOrangeAccent[400], /// ) @@ -1691,7 +1691,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.brown[400], /// ) @@ -1737,7 +1737,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.grey[400], /// ) @@ -1784,7 +1784,7 @@ class Colors { /// ## Sample code /// /// ```dart - /// new Icon( + /// Icon( /// Icons.widgets, /// color: Colors.blueGrey[400], /// ) diff --git a/packages/flutter/lib/src/material/dialog.dart b/packages/flutter/lib/src/material/dialog.dart index 9c939602ed..de2dc55c23 100644 --- a/packages/flutter/lib/src/material/dialog.dart +++ b/packages/flutter/lib/src/material/dialog.dart @@ -121,19 +121,19 @@ class Dialog extends StatelessWidget { /// context: context, /// barrierDismissible: false, // user must tap button! /// builder: (BuildContext context) { -/// return new AlertDialog( -/// title: new Text('Rewind and remember'), -/// content: new SingleChildScrollView( -/// child: new ListBody( +/// return AlertDialog( +/// title: Text('Rewind and remember'), +/// content: SingleChildScrollView( +/// child: ListBody( /// children: [ -/// new Text('You will never be satisfied.'), -/// new Text('You\’re like me. I’m never satisfied.'), +/// Text('You will never be satisfied.'), +/// Text('You\’re like me. I’m never satisfied.'), /// ], /// ), /// ), /// actions: [ -/// new FlatButton( -/// child: new Text('Regret'), +/// FlatButton( +/// child: Text('Regret'), /// onPressed: () { /// Navigator.of(context).pop(); /// }, @@ -309,7 +309,7 @@ class AlertDialog extends StatelessWidget { /// ## Sample code /// /// ```dart -/// new SimpleDialogOption( +/// SimpleDialogOption( /// onPressed: () { Navigator.pop(context, Department.treasury); }, /// child: const Text('Treasury department'), /// ) @@ -388,14 +388,14 @@ class SimpleDialogOption extends StatelessWidget { /// switch (await showDialog( /// context: context, /// builder: (BuildContext context) { -/// return new SimpleDialog( +/// return SimpleDialog( /// title: const Text('Select assignment'), /// children: [ -/// new SimpleDialogOption( +/// SimpleDialogOption( /// onPressed: () { Navigator.pop(context, Department.treasury); }, /// child: const Text('Treasury department'), /// ), -/// new SimpleDialogOption( +/// SimpleDialogOption( /// onPressed: () { Navigator.pop(context, Department.state); }, /// child: const Text('State department'), /// ), diff --git a/packages/flutter/lib/src/material/divider.dart b/packages/flutter/lib/src/material/divider.dart index f6ddaa6e04..05dda8d89c 100644 --- a/packages/flutter/lib/src/material/divider.dart +++ b/packages/flutter/lib/src/material/divider.dart @@ -55,7 +55,7 @@ class Divider extends StatelessWidget { /// ## Sample code /// /// ```dart - /// new Divider( + /// Divider( /// color: Colors.deepOrange, /// ) /// ``` @@ -75,9 +75,9 @@ class Divider extends StatelessWidget { /// scrollable section from the rest of the interface. /// /// ```dart - /// new DecoratedBox( - /// decoration: new BoxDecoration( - /// border: new Border( + /// DecoratedBox( + /// decoration: BoxDecoration( + /// border: Border( /// top: Divider.createBorderSide(context), /// bottom: Divider.createBorderSide(context), /// ), diff --git a/packages/flutter/lib/src/material/drawer.dart b/packages/flutter/lib/src/material/drawer.dart index 4849cbd495..42637119a3 100644 --- a/packages/flutter/lib/src/material/drawer.dart +++ b/packages/flutter/lib/src/material/drawer.dart @@ -56,9 +56,9 @@ const Duration _kBaseSettleDuration = Duration(milliseconds: 246); /// a drawer item might close the drawer when tapped: /// /// ```dart -/// new ListTile( -/// leading: new Icon(Icons.change_history), -/// title: new Text('Change history'), +/// ListTile( +/// leading: Icon(Icons.change_history), +/// title: Text('Change history'), /// onTap: () { /// // change app state... /// Navigator.pop(context); // close the drawer diff --git a/packages/flutter/lib/src/material/feedback.dart b/packages/flutter/lib/src/material/feedback.dart index d7dc105adc..eeca730022 100644 --- a/packages/flutter/lib/src/material/feedback.dart +++ b/packages/flutter/lib/src/material/feedback.dart @@ -36,7 +36,7 @@ import 'theme.dart'; /// class WidgetWithWrappedHandler extends StatelessWidget { /// @override /// Widget build(BuildContext context) { -/// return new GestureDetector( +/// return GestureDetector( /// onTap: Feedback.wrapForTap(_onTapHandler, context), /// onLongPress: Feedback.wrapForLongPress(_onLongPressHandler, context), /// child: const Text('X'), @@ -60,7 +60,7 @@ import 'theme.dart'; /// class WidgetWithExplicitCall extends StatelessWidget { /// @override /// Widget build(BuildContext context) { -/// return new GestureDetector( +/// return GestureDetector( /// onTap: () { /// // Do some work (e.g. check if the tap is valid) /// Feedback.forTap(context); diff --git a/packages/flutter/lib/src/material/floating_action_button_location.dart b/packages/flutter/lib/src/material/floating_action_button_location.dart index 8dfbc15029..64a32ec69a 100644 --- a/packages/flutter/lib/src/material/floating_action_button_location.dart +++ b/packages/flutter/lib/src/material/floating_action_button_location.dart @@ -270,7 +270,7 @@ abstract class FloatingActionButtonAnimator { /// @override /// Animation getScaleAnimation({@required Animation parent}) { /// // The animations will cross at value 0, and the train will return to 1.0. - /// return new TrainHoppingAnimation( + /// return TrainHoppingAnimation( /// Tween(begin: 1.0, end: -1.0).animate(parent), /// Tween(begin: -1.0, end: 1.0).animate(parent), /// ); @@ -289,10 +289,10 @@ abstract class FloatingActionButtonAnimator { /// [FloatingActionButton] through a full circle: /// /// ```dart - /// @override - /// Animation getRotationAnimation({@required Animation parent}) { - /// return new Tween(begin: 0.0, end: 1.0).animate(parent); - /// } + /// @override + /// Animation getRotationAnimation({@required Animation parent}) { + /// return Tween(begin: 0.0, end: 1.0).animate(parent); + /// } /// ``` Animation getRotationAnimation({@required Animation parent}); diff --git a/packages/flutter/lib/src/material/icon_button.dart b/packages/flutter/lib/src/material/icon_button.dart index 3278256d47..912dc83ff8 100644 --- a/packages/flutter/lib/src/material/icon_button.dart +++ b/packages/flutter/lib/src/material/icon_button.dart @@ -40,8 +40,8 @@ const double _kMinButtonSize = 48.0; /// ## Sample code /// /// ```dart -/// new IconButton( -/// icon: new Icon(Icons.volume_up), +/// IconButton( +/// icon: Icon(Icons.volume_up), /// tooltip: 'Increase volume by 10%', /// onPressed: () { setState(() { _volume *= 1.1; }); }, /// ) @@ -137,11 +137,11 @@ class IconButton extends StatelessWidget { /// See also [disabledColor]. /// /// ```dart - /// new IconButton( - /// color: Colors.blue, - /// onPressed: _handleTap, - /// icon: Icons.widgets, - /// ), + /// IconButton( + /// color: Colors.blue, + /// onPressed: _handleTap, + /// icon: Icons.widgets, + /// ), /// ``` final Color color; diff --git a/packages/flutter/lib/src/material/ink_decoration.dart b/packages/flutter/lib/src/material/ink_decoration.dart index f58b1b9f1f..d204903cf2 100644 --- a/packages/flutter/lib/src/material/ink_decoration.dart +++ b/packages/flutter/lib/src/material/ink_decoration.dart @@ -50,17 +50,17 @@ import 'material.dart'; /// on it using [Ink], while still having ink effects over the yellow rectangle: /// /// ```dart -/// new Material( +/// Material( /// color: Colors.teal[900], -/// child: new Center( -/// child: new Ink( +/// child: Center( +/// child: Ink( /// color: Colors.yellow, /// width: 200.0, /// height: 100.0, -/// child: new InkWell( +/// child: InkWell( /// onTap: () { /* ... */ }, -/// child: new Center( -/// child: new Text('YELLOW'), +/// child: Center( +/// child: Text('YELLOW'), /// ) /// ), /// ), @@ -72,21 +72,21 @@ import 'material.dart'; /// widget with an [InkWell] above it: /// /// ```dart -/// new Material( +/// Material( /// color: Colors.grey[800], -/// child: new Center( -/// child: new Ink.image( -/// image: new AssetImage('cat.jpeg'), +/// child: Center( +/// child: Ink.image( +/// image: AssetImage('cat.jpeg'), /// fit: BoxFit.cover, /// width: 300.0, /// height: 200.0, -/// child: new InkWell( +/// child: InkWell( /// onTap: () { /* ... */ }, -/// child: new Align( +/// child: Align( /// alignment: Alignment.topLeft, -/// child: new Padding( +/// child: Padding( /// padding: const EdgeInsets.all(10.0), -/// child: new Text('KITTEN', style: new TextStyle(fontWeight: FontWeight.w900, color: Colors.white)), +/// child: Text('KITTEN', style: TextStyle(fontWeight: FontWeight.w900, color: Colors.white)), /// ), /// ) /// ), diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index 98d3e30f69..ec1aba31d6 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -2119,7 +2119,7 @@ class InputDecoration { /// To pad the leading edge of the prefix icon: /// /// ```dart - /// prefixIcon: new Padding( + /// prefixIcon: Padding( /// padding: const EdgeInsetsDirectional.only(start: 12.0), /// child: myIcon, // icon is 48px widget. /// ) @@ -2166,7 +2166,7 @@ class InputDecoration { /// To pad the trailing edge of the suffix icon: /// /// ```dart - /// suffixIcon: new Padding( + /// suffixIcon: Padding( /// padding: const EdgeInsetsDirectional.only(end: 12.0), /// child: myIcon, // icon is 48px widget. /// ) diff --git a/packages/flutter/lib/src/material/list_tile.dart b/packages/flutter/lib/src/material/list_tile.dart index 8fa78285f1..9c817c8442 100644 --- a/packages/flutter/lib/src/material/list_tile.dart +++ b/packages/flutter/lib/src/material/list_tile.dart @@ -175,7 +175,7 @@ enum ListTileControlAffinity { /// Here is a simple tile with an icon and some text. /// /// ```dart -/// new ListTile( +/// ListTile( /// leading: const Icon(Icons.event_seat), /// title: const Text('The seat for the narrator'), /// ) @@ -188,7 +188,7 @@ enum ListTileControlAffinity { /// ```dart /// int _act = 1; /// // ... -/// new ListTile( +/// ListTile( /// leading: const Icon(Icons.flight_land), /// title: const Text('Trix\'s airplane'), /// subtitle: _act != 2 ? const Text('The airplane is only in Act II.') : null, diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart index ac542026cb..e58dbe5d71 100644 --- a/packages/flutter/lib/src/material/popup_menu.dart +++ b/packages/flutter/lib/src/material/popup_menu.dart @@ -291,7 +291,7 @@ class PopupMenuItemState> extends State { /// shows a divider placed between the two menu items.) /// /// ```dart -/// new PopupMenuButton( +/// PopupMenuButton( /// onSelected: (Commands result) { /// switch (result) { /// case Commands.heroAndScholar: @@ -304,7 +304,7 @@ class PopupMenuItemState> extends State { /// } /// }, /// itemBuilder: (BuildContext context) => >[ -/// new CheckedPopupMenuItem( +/// CheckedPopupMenuItem( /// checked: _heroAndScholar, /// value: Commands.heroAndScholar, /// child: const Text('Hero and scholar'), @@ -774,7 +774,7 @@ typedef List> PopupMenuItemBuilder(BuildContext context); /// /// // This menu button widget updates a _selection field (of type WhyFarther, /// // not shown here). -/// new PopupMenuButton( +/// PopupMenuButton( /// onSelected: (WhyFarther result) { setState(() { _selection = result; }); }, /// itemBuilder: (BuildContext context) => >[ /// const PopupMenuItem( diff --git a/packages/flutter/lib/src/material/radio.dart b/packages/flutter/lib/src/material/radio.dart index ec13e4be45..a492f8220d 100644 --- a/packages/flutter/lib/src/material/radio.dart +++ b/packages/flutter/lib/src/material/radio.dart @@ -81,7 +81,7 @@ class Radio extends StatefulWidget { /// gets rebuilt; for example: /// /// ```dart - /// new Radio( + /// Radio( /// value: SingingCharacter.lafayette, /// groupValue: _character, /// onChanged: (SingingCharacter newValue) { diff --git a/packages/flutter/lib/src/material/radio_list_tile.dart b/packages/flutter/lib/src/material/radio_list_tile.dart index 698e46f25f..2fee40c68b 100644 --- a/packages/flutter/lib/src/material/radio_list_tile.dart +++ b/packages/flutter/lib/src/material/radio_list_tile.dart @@ -50,15 +50,15 @@ import 'theme_data.dart'; /// SingingCharacter _character = SingingCharacter.lafayette; /// /// // In the build function of that State: -/// new Column( +/// Column( /// children: [ -/// new RadioListTile( +/// RadioListTile( /// title: const Text('Lafayette'), /// value: SingingCharacter.lafayette, /// groupValue: _character, /// onChanged: (SingingCharacter value) { setState(() { _character = value; }); }, /// ), -/// new RadioListTile( +/// RadioListTile( /// title: const Text('Thomas Jefferson'), /// value: SingingCharacter.jefferson, /// groupValue: _character, @@ -130,7 +130,7 @@ class RadioListTile extends StatelessWidget { /// gets rebuilt; for example: /// /// ```dart - /// new RadioListTile( + /// RadioListTile( /// title: const Text('Lafayette'), /// value: SingingCharacter.lafayette, /// groupValue: _character, diff --git a/packages/flutter/lib/src/material/raised_button.dart b/packages/flutter/lib/src/material/raised_button.dart index 7b06c05183..553dcf8feb 100644 --- a/packages/flutter/lib/src/material/raised_button.dart +++ b/packages/flutter/lib/src/material/raised_button.dart @@ -170,10 +170,10 @@ class RaisedButton extends StatelessWidget { /// for example: /// /// ```dart - /// new RaisedButton( + /// RaisedButton( /// color: Colors.blue, /// onPressed: _handleTap, - /// child: new Text('DEMO'), + /// child: Text('DEMO'), /// ), /// ``` /// diff --git a/packages/flutter/lib/src/material/refresh_indicator.dart b/packages/flutter/lib/src/material/refresh_indicator.dart index eb3dbbf20d..2a9608ef8b 100644 --- a/packages/flutter/lib/src/material/refresh_indicator.dart +++ b/packages/flutter/lib/src/material/refresh_indicator.dart @@ -58,7 +58,7 @@ enum _RefreshIndicatorMode { /// settings its `physics` property to [AlwaysScrollableScrollPhysics]: /// /// ```dart -/// new ListView( +/// ListView( /// physics: const AlwaysScrollableScrollPhysics(), /// children: ... // ) diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index 8cffb0b463..c3d16f82e6 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -850,11 +850,11 @@ class Scaffold extends StatefulWidget { /// ```dart /// @override /// Widget build(BuildContext context) { - /// return new RaisedButton( - /// child: new Text('SHOW A SNACKBAR'), + /// return RaisedButton( + /// child: Text('SHOW A SNACKBAR'), /// onPressed: () { - /// Scaffold.of(context).showSnackBar(new SnackBar( - /// content: new Text('Hello!'), + /// Scaffold.of(context).showSnackBar(SnackBar( + /// content: Text('Hello!'), /// )); /// }, /// ); @@ -870,20 +870,20 @@ class Scaffold extends StatefulWidget { /// ```dart /// @override /// Widget build(BuildContext context) { - /// return new Scaffold( - /// appBar: new AppBar( - /// title: new Text('Demo') + /// return Scaffold( + /// appBar: AppBar( + /// title: Text('Demo') /// ), - /// body: new Builder( + /// body: Builder( /// // Create an inner BuildContext so that the onPressed methods /// // can refer to the Scaffold with Scaffold.of(). /// builder: (BuildContext context) { - /// return new Center( - /// child: new RaisedButton( - /// child: new Text('SHOW A SNACKBAR'), + /// return Center( + /// child: RaisedButton( + /// child: Text('SHOW A SNACKBAR'), /// onPressed: () { - /// Scaffold.of(context).showSnackBar(new SnackBar( - /// content: new Text('Hello!'), + /// Scaffold.of(context).showSnackBar(SnackBar( + /// content: Text('Hello!'), /// )); /// }, /// ), diff --git a/packages/flutter/lib/src/material/slider.dart b/packages/flutter/lib/src/material/slider.dart index 4ace398338..a0fecacfcd 100644 --- a/packages/flutter/lib/src/material/slider.dart +++ b/packages/flutter/lib/src/material/slider.dart @@ -148,7 +148,7 @@ class Slider extends StatefulWidget { /// ## Sample code /// /// ```dart - /// new Slider( + /// Slider( /// value: _duelCommandment.toDouble(), /// min: 1.0, /// max: 10.0, @@ -182,7 +182,7 @@ class Slider extends StatefulWidget { /// ## Sample code /// /// ```dart - /// new Slider( + /// Slider( /// value: _duelCommandment.toDouble(), /// min: 1.0, /// max: 10.0, @@ -214,7 +214,7 @@ class Slider extends StatefulWidget { /// ## Sample code /// /// ```dart - /// new Slider( + /// Slider( /// value: _duelCommandment.toDouble(), /// min: 1.0, /// max: 10.0, @@ -310,7 +310,7 @@ class Slider extends StatefulWidget { /// announce a value with a currency label. /// /// ```dart - /// new Slider( + /// Slider( /// value: _dollars.toDouble(), /// min: 20.0, /// max: 330.0, diff --git a/packages/flutter/lib/src/material/slider_theme.dart b/packages/flutter/lib/src/material/slider_theme.dart index 0f0558f95f..eee54fbbb8 100644 --- a/packages/flutter/lib/src/material/slider_theme.dart +++ b/packages/flutter/lib/src/material/slider_theme.dart @@ -53,7 +53,7 @@ class SliderTheme extends InheritedWidget { /// ```dart /// class Launch extends StatefulWidget { /// @override - /// State createState() => new LaunchState(); + /// State createState() => LaunchState(); /// } /// /// class LaunchState extends State { @@ -61,9 +61,9 @@ class SliderTheme extends InheritedWidget { /// /// @override /// Widget build(BuildContext context) { - /// return new SliderTheme( + /// return SliderTheme( /// data: SliderTheme.of(context).copyWith(activeTrackColor: const Color(0xff804040)), - /// child: new Slider( + /// child: Slider( /// onChanged: (double value) { setState(() { _rocketThrust = value; }); }, /// value: _rocketThrust, /// ), @@ -160,7 +160,7 @@ class SliderThemeData extends Diagnosticable { /// ```dart /// class Blissful extends StatefulWidget { /// @override - /// State createState() => new BlissfulState(); + /// State createState() => BlissfulState(); /// } /// /// class BlissfulState extends State { @@ -168,9 +168,9 @@ class SliderThemeData extends Diagnosticable { /// /// @override /// Widget build(BuildContext context) { - /// return new SliderTheme( + /// return SliderTheme( /// data: SliderTheme.of(context).copyWith(activeTrackColor: const Color(0xff404080)), - /// child: new Slider( + /// child: Slider( /// onChanged: (double value) { setState(() { _bliss = value; }); }, /// value: _bliss, /// ), diff --git a/packages/flutter/lib/src/material/snack_bar.dart b/packages/flutter/lib/src/material/snack_bar.dart index 406a883952..2e75a517f1 100644 --- a/packages/flutter/lib/src/material/snack_bar.dart +++ b/packages/flutter/lib/src/material/snack_bar.dart @@ -38,7 +38,7 @@ const Curve _snackBarFadeCurve = Interval(0.72, 1.0, curve: Curves.fastOutSlowIn /// /// ```dart /// Scaffold.of(context).showSnackBar( -/// new SnackBar( ... ) +/// SnackBar( ... ) /// ).closed.then((SnackBarClosedReason reason) { /// ... /// }); diff --git a/packages/flutter/lib/src/material/switch.dart b/packages/flutter/lib/src/material/switch.dart index d89b238aff..12ddb95a04 100644 --- a/packages/flutter/lib/src/material/switch.dart +++ b/packages/flutter/lib/src/material/switch.dart @@ -85,7 +85,7 @@ class Switch extends StatefulWidget { /// gets rebuilt; for example: /// /// ```dart - /// new Switch( + /// Switch( /// value: _giveVerse, /// onChanged: (bool newValue) { /// setState(() { diff --git a/packages/flutter/lib/src/material/switch_list_tile.dart b/packages/flutter/lib/src/material/switch_list_tile.dart index 151234cba5..67866aa9f5 100644 --- a/packages/flutter/lib/src/material/switch_list_tile.dart +++ b/packages/flutter/lib/src/material/switch_list_tile.dart @@ -41,7 +41,7 @@ import 'theme_data.dart'; /// member field called `_lights`. /// /// ```dart -/// new SwitchListTile( +/// SwitchListTile( /// title: const Text('Lights'), /// value: _lights, /// onChanged: (bool value) { setState(() { _lights = value; }); }, @@ -106,14 +106,14 @@ class SwitchListTile extends StatelessWidget { /// gets rebuilt; for example: /// /// ```dart - /// new SwitchListTile( + /// SwitchListTile( /// value: _lights, /// onChanged: (bool newValue) { /// setState(() { /// _lights = newValue; /// }); /// }, - /// title: new Text('Lights'), + /// title: Text('Lights'), /// ) /// ``` final ValueChanged onChanged; diff --git a/packages/flutter/lib/src/material/tab_controller.dart b/packages/flutter/lib/src/material/tab_controller.dart index 5a8647372d..1fed41f3b2 100644 --- a/packages/flutter/lib/src/material/tab_controller.dart +++ b/packages/flutter/lib/src/material/tab_controller.dart @@ -27,13 +27,13 @@ import 'constants.dart'; /// class MyTabbedPage extends StatefulWidget { /// const MyTabbedPage({ Key key }) : super(key: key); /// @override -/// _MyTabbedPageState createState() => new _MyTabbedPageState(); +/// _MyTabbedPageState createState() => _MyTabbedPageState(); /// } /// /// class _MyTabbedPageState extends State with SingleTickerProviderStateMixin { /// final List myTabs = [ -/// new Tab(text: 'LEFT'), -/// new Tab(text: 'RIGHT'), +/// Tab(text: 'LEFT'), +/// Tab(text: 'RIGHT'), /// ]; /// /// TabController _tabController; @@ -41,7 +41,7 @@ import 'constants.dart'; /// @override /// void initState() { /// super.initState(); -/// _tabController = new TabController(vsync: this, length: myTabs.length); +/// _tabController = TabController(vsync: this, length: myTabs.length); /// } /// /// @override @@ -52,17 +52,17 @@ import 'constants.dart'; /// /// @override /// Widget build(BuildContext context) { -/// return new Scaffold( -/// appBar: new AppBar( -/// bottom: new TabBar( +/// return Scaffold( +/// appBar: AppBar( +/// bottom: TabBar( /// controller: _tabController, /// tabs: myTabs, /// ), /// ), -/// body: new TabBarView( +/// body: TabBarView( /// controller: _tabController, /// children: myTabs.map((Tab tab) { -/// return new Center(child: new Text(tab.text)); +/// return Center(child: Text(tab.text)); /// }).toList(), /// ), /// ); @@ -216,23 +216,23 @@ class _TabControllerScope extends InheritedWidget { /// ```dart /// class MyDemo extends StatelessWidget { /// final List myTabs = [ -/// new Tab(text: 'LEFT'), -/// new Tab(text: 'RIGHT'), +/// Tab(text: 'LEFT'), +/// Tab(text: 'RIGHT'), /// ]; /// /// @override /// Widget build(BuildContext context) { -/// return new DefaultTabController( +/// return DefaultTabController( /// length: myTabs.length, -/// child: new Scaffold( -/// appBar: new AppBar( -/// bottom: new TabBar( +/// child: Scaffold( +/// appBar: AppBar( +/// bottom: TabBar( /// tabs: myTabs, /// ), /// ), -/// body: new TabBarView( +/// body: TabBarView( /// children: myTabs.map((Tab tab) { -/// return new Center(child: new Text(tab.text)); +/// return Center(child: Text(tab.text)); /// }).toList(), /// ), /// ), diff --git a/packages/flutter/lib/src/material/theme.dart b/packages/flutter/lib/src/material/theme.dart index cebb86b043..6cbe6149c0 100644 --- a/packages/flutter/lib/src/material/theme.dart +++ b/packages/flutter/lib/src/material/theme.dart @@ -89,7 +89,7 @@ class Theme extends StatelessWidget { /// ```dart /// @override /// Widget build(BuildContext context) { - /// return new Text( + /// return Text( /// 'Example', /// style: Theme.of(context).textTheme.title, /// ); @@ -106,14 +106,14 @@ class Theme extends StatelessWidget { /// ```dart /// @override /// Widget build(BuildContext context) { - /// return new MaterialApp( - /// theme: new ThemeData.light(), - /// body: new Builder( + /// return MaterialApp( + /// theme: ThemeData.light(), + /// body: Builder( /// // Create an inner BuildContext so that we can refer to /// // the Theme with Theme.of(). /// builder: (BuildContext context) { - /// return new Center( - /// child: new Text( + /// return Center( + /// child: Text( /// 'Example', /// style: Theme.of(context).textTheme.title, /// ), diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart index b6336ab275..a21d00188c 100644 --- a/packages/flutter/lib/src/material/time_picker.dart +++ b/packages/flutter/lib/src/material/time_picker.dart @@ -1654,7 +1654,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> { /// /// ```dart /// showTimePicker( -/// initialTime: new TimeOfDay.now(), +/// initialTime: TimeOfDay.now(), /// context: context, /// ); /// ``` diff --git a/packages/flutter/lib/src/material/typography.dart b/packages/flutter/lib/src/material/typography.dart index 7f83412753..1476be91dc 100644 --- a/packages/flutter/lib/src/material/typography.dart +++ b/packages/flutter/lib/src/material/typography.dart @@ -120,7 +120,7 @@ class TextTheme extends Diagnosticable { /// @override /// Widget build(BuildContext context) { /// final ThemeData theme = Theme.of(context); - /// return new Theme( + /// return Theme( /// data: theme.copyWith( /// textTheme: theme.textTheme.copyWith( /// title: theme.textTheme.title.copyWith( @@ -204,9 +204,9 @@ class TextTheme extends Diagnosticable { /// // set the title, but everything else would be null. This isn't very /// // useful, so merge it with the existing theme to keep all of the /// // preexisting definitions for the other styles. - /// TextTheme partialTheme = new TextTheme(title: new TextStyle(color: titleColor)); + /// TextTheme partialTheme = TextTheme(title: TextStyle(color: titleColor)); /// theme = theme.copyWith(textTheme: theme.textTheme.merge(partialTheme)); - /// return new Theme(data: theme, child: child); + /// return Theme(data: theme, child: child); /// } /// } /// ``` diff --git a/packages/flutter/lib/src/painting/borders.dart b/packages/flutter/lib/src/painting/borders.dart index 42162ff236..d1b4311312 100644 --- a/packages/flutter/lib/src/painting/borders.dart +++ b/packages/flutter/lib/src/painting/borders.dart @@ -34,15 +34,15 @@ enum BorderStyle { /// it that is a darker shade of blue. /// /// ```dart -/// new Container( -/// padding: new EdgeInsets.all(8.0), -/// decoration: new BoxDecoration( -/// border: new Border( -/// top: new BorderSide(width: 16.0, color: Colors.lightBlue.shade50), -/// bottom: new BorderSide(width: 16.0, color: Colors.lightBlue.shade900), +/// Container( +/// padding: EdgeInsets.all(8.0), +/// decoration: BoxDecoration( +/// border: Border( +/// top: BorderSide(width: 16.0, color: Colors.lightBlue.shade50), +/// bottom: BorderSide(width: 16.0, color: Colors.lightBlue.shade900), /// ), /// ), -/// child: new Text('Flutter in the sky', textAlign: TextAlign.center), +/// child: Text('Flutter in the sky', textAlign: TextAlign.center), /// ) /// ``` /// diff --git a/packages/flutter/lib/src/painting/box_border.dart b/packages/flutter/lib/src/painting/box_border.dart index 04356038e2..6814b9da62 100644 --- a/packages/flutter/lib/src/painting/box_border.dart +++ b/packages/flutter/lib/src/painting/box_border.dart @@ -251,19 +251,19 @@ abstract class BoxBorder extends ShapeBorder { /// All four borders the same, two-pixel wide solid white: /// /// ```dart -/// new Border.all(width: 2.0, color: const Color(0xFFFFFFFF)) +/// Border.all(width: 2.0, color: const Color(0xFFFFFFFF)) /// ``` /// /// The border for a material design divider: /// /// ```dart -/// new Border(bottom: new BorderSide(color: Theme.of(context).dividerColor)) +/// Border(bottom: BorderSide(color: Theme.of(context).dividerColor)) /// ``` /// /// A 1990s-era "OK" button: /// /// ```dart -/// new Container( +/// Container( /// decoration: const BoxDecoration( /// border: Border( /// top: BorderSide(width: 1.0, color: Color(0xFFFFFFFFFF)), @@ -272,7 +272,7 @@ abstract class BoxBorder extends ShapeBorder { /// bottom: BorderSide(width: 1.0, color: Color(0xFFFF000000)), /// ), /// ), -/// child: new Container( +/// child: Container( /// padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 2.0), /// decoration: const BoxDecoration( /// border: Border( diff --git a/packages/flutter/lib/src/painting/box_decoration.dart b/packages/flutter/lib/src/painting/box_decoration.dart index dc1d58664e..f4f7e61ed5 100644 --- a/packages/flutter/lib/src/painting/box_decoration.dart +++ b/packages/flutter/lib/src/painting/box_decoration.dart @@ -38,14 +38,14 @@ import 'image_provider.dart'; /// draw an image with a border: /// /// ```dart -/// new Container( -/// decoration: new BoxDecoration( +/// Container( +/// decoration: BoxDecoration( /// color: const Color(0xff7c94b6), -/// image: new DecorationImage( -/// image: new ExactAssetImage('images/flowers.jpeg'), +/// image: DecorationImage( +/// image: ExactAssetImage('images/flowers.jpeg'), /// fit: BoxFit.cover, /// ), -/// border: new Border.all( +/// border: Border.all( /// color: Colors.black, /// width: 8.0, /// ), diff --git a/packages/flutter/lib/src/painting/box_fit.dart b/packages/flutter/lib/src/painting/box_fit.dart index fd74821b13..a0638c02c4 100644 --- a/packages/flutter/lib/src/painting/box_fit.dart +++ b/packages/flutter/lib/src/painting/box_fit.dart @@ -110,7 +110,7 @@ class FittedSizes { /// /// ```dart /// void paintImage(ui.Image image, Rect outputRect, Canvas canvas, Paint paint, BoxFit fit) { -/// final Size imageSize = new Size(image.width.toDouble(), image.height.toDouble()); +/// final Size imageSize = Size(image.width.toDouble(), image.height.toDouble()); /// final FittedSizes sizes = applyBoxFit(fit, imageSize, outputRect.size); /// final Rect inputSubrect = Alignment.center.inscribe(sizes.source, Offset.zero & imageSize); /// final Rect outputSubrect = Alignment.center.inscribe(sizes.destination, outputRect); diff --git a/packages/flutter/lib/src/painting/gradient.dart b/packages/flutter/lib/src/painting/gradient.dart index b6b1a69b9e..b8b6c5b865 100644 --- a/packages/flutter/lib/src/painting/gradient.dart +++ b/packages/flutter/lib/src/painting/gradient.dart @@ -242,11 +242,11 @@ abstract class Gradient { /// a [Container] display a [BoxDecoration] with a [LinearGradient]. /// /// ```dart -/// new Container( -/// decoration: new BoxDecoration( -/// gradient: new LinearGradient( +/// Container( +/// decoration: BoxDecoration( +/// gradient: LinearGradient( /// begin: Alignment.topLeft, -/// end: new Alignment(0.8, 0.0), // 10% of the width, so there are ten blinds. +/// end: Alignment(0.8, 0.0), // 10% of the width, so there are ten blinds. /// colors: [const Color(0xFFFFFFEE), const Color(0xFF999999)], // whitish to gray /// tileMode: TileMode.repeated, // repeats the gradient over the canvas /// ), @@ -476,7 +476,7 @@ class LinearGradient extends Gradient { /// /// ```dart /// void paintSky(Canvas canvas, Rect rect) { -/// var gradient = new RadialGradient( +/// var gradient = RadialGradient( /// center: const Alignment(0.7, -0.6), // near the top right /// radius: 0.2, /// colors: [ @@ -486,7 +486,7 @@ class LinearGradient extends Gradient { /// stops: [0.4, 1.0], /// ); /// // rect is the area we are painting over -/// var paint = new Paint() +/// var paint = Paint() /// ..shader = gradient.createShader(rect); /// canvas.drawRect(rect, paint); /// } @@ -733,9 +733,9 @@ class RadialGradient extends Gradient { /// This sample draws a different color in each quadrant. /// /// ```dart -/// new Container( -/// decoration: new BoxDecoration( -/// gradient: new SweepGradient( +/// Container( +/// decoration: BoxDecoration( +/// gradient: SweepGradient( /// center: FractionalOffset.center, /// startAngle: 0.0, /// endAngle: math.pi * 2, diff --git a/packages/flutter/lib/src/painting/image_provider.dart b/packages/flutter/lib/src/painting/image_provider.dart index 66a7f91bf1..88b7508a47 100644 --- a/packages/flutter/lib/src/painting/image_provider.dart +++ b/packages/flutter/lib/src/painting/image_provider.dart @@ -187,7 +187,7 @@ class ImageConfiguration { /// final ImageProvider imageProvider; /// /// @override -/// _MyImageState createState() => new _MyImageState(); +/// _MyImageState createState() => _MyImageState(); /// } /// /// class _MyImageState extends State { @@ -237,7 +237,7 @@ class ImageConfiguration { /// /// @override /// Widget build(BuildContext context) { -/// return new RawImage( +/// return RawImage( /// image: _imageInfo?.image, // this is a dart:ui Image object /// scale: _imageInfo?.scale ?? 1.0, /// ); @@ -310,11 +310,11 @@ abstract class ImageProvider { /// /// @override /// Widget build(BuildContext context) { - /// return new Image.network(url); + /// return Image.network(url); /// } /// /// void evictImage() { - /// final NetworkImage provider = new NetworkImage(url); + /// final NetworkImage provider = NetworkImage(url); /// provider.evict().then((bool success) { /// if (success) /// debugPrint('removed image!'); @@ -659,7 +659,7 @@ class MemoryImage extends ImageProvider { /// Then, to fetch the image and associate it with scale `1.5`, use /// /// ```dart -/// new AssetImage('icons/heart.png', scale: 1.5) +/// AssetImage('icons/heart.png', scale: 1.5) /// ``` /// ///## Assets in packages @@ -669,7 +669,7 @@ class MemoryImage extends ImageProvider { /// `my_icons`. Then to fetch the image, use: /// /// ```dart -/// new AssetImage('icons/heart.png', scale: 1.5, package: 'my_icons') +/// AssetImage('icons/heart.png', scale: 1.5, package: 'my_icons') /// ``` /// /// Assets used by the package itself should also be fetched using the [package] diff --git a/packages/flutter/lib/src/painting/image_resolution.dart b/packages/flutter/lib/src/painting/image_resolution.dart index 48b3e5b59d..4691c779cd 100644 --- a/packages/flutter/lib/src/painting/image_resolution.dart +++ b/packages/flutter/lib/src/painting/image_resolution.dart @@ -76,7 +76,7 @@ const String _kAssetManifestFileName = 'AssetManifest.json'; /// /// Then, to fetch the image, use /// ```dart -/// new AssetImage('icons/heart.png') +/// AssetImage('icons/heart.png') /// ``` /// /// ## Assets in packages @@ -86,7 +86,7 @@ const String _kAssetManifestFileName = 'AssetManifest.json'; /// `my_icons`. Then to fetch the image, use: /// /// ```dart -/// new AssetImage('icons/heart.png', package: 'my_icons') +/// AssetImage('icons/heart.png', package: 'my_icons') /// ``` /// /// Assets used by the package itself should also be fetched using the [package] diff --git a/packages/flutter/lib/src/painting/shape_decoration.dart b/packages/flutter/lib/src/painting/shape_decoration.dart index 433a88f8c2..7211d348bc 100644 --- a/packages/flutter/lib/src/painting/shape_decoration.dart +++ b/packages/flutter/lib/src/painting/shape_decoration.dart @@ -30,16 +30,16 @@ import 'rounded_rectangle_border.dart'; /// "RGB" inside it: /// /// ```dart -/// new Container( -/// decoration: new ShapeDecoration( +/// Container( +/// decoration: ShapeDecoration( /// color: Colors.white, -/// shape: new Border.all( +/// shape: Border.all( /// color: Colors.red, /// width: 8.0, -/// ) + new Border.all( +/// ) + Border.all( /// color: Colors.green, /// width: 8.0, -/// ) + new Border.all( +/// ) + Border.all( /// color: Colors.blue, /// width: 8.0, /// ), diff --git a/packages/flutter/lib/src/painting/text_span.dart b/packages/flutter/lib/src/painting/text_span.dart index 6b8c79fc14..c5a5b75b08 100644 --- a/packages/flutter/lib/src/painting/text_span.dart +++ b/packages/flutter/lib/src/painting/text_span.dart @@ -32,9 +32,9 @@ import 'text_style.dart'; /// The text "Hello world!", in black: /// /// ```dart -/// new TextSpan( +/// TextSpan( /// text: 'Hello world!', -/// style: new TextStyle(color: Colors.black), +/// style: TextStyle(color: Colors.black), /// ) /// ``` /// @@ -104,7 +104,7 @@ class TextSpan extends DiagnosticableTree { /// ```dart /// class BuzzingText extends StatefulWidget { /// @override - /// _BuzzingTextState createState() => new _BuzzingTextState(); + /// _BuzzingTextState createState() => _BuzzingTextState(); /// } /// /// class _BuzzingTextState extends State { @@ -113,7 +113,7 @@ class TextSpan extends DiagnosticableTree { /// @override /// void initState() { /// super.initState(); - /// _longPressRecognizer = new LongPressGestureRecognizer() + /// _longPressRecognizer = LongPressGestureRecognizer() /// ..onLongPress = _handlePress; /// } /// @@ -129,21 +129,21 @@ class TextSpan extends DiagnosticableTree { /// /// @override /// Widget build(BuildContext context) { - /// return new RichText( - /// text: new TextSpan( + /// return RichText( + /// text: TextSpan( /// text: 'Can you ', - /// style: new TextStyle(color: Colors.black), + /// style: TextStyle(color: Colors.black), /// children: [ - /// new TextSpan( + /// TextSpan( /// text: 'find the', - /// style: new TextStyle( + /// style: TextStyle( /// color: Colors.green, /// decoration: TextDecoration.underline, /// decorationStyle: TextDecorationStyle.wavy, /// ), /// recognizer: _longPressRecognizer, /// ), - /// new TextSpan( + /// TextSpan( /// text: ' secret?', /// ), /// ], diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index 6134c1bc20..4af9eb9845 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -24,9 +24,9 @@ const String _kColorForegroundWarning = 'Cannot provide both a color and a foreg /// [Text] widget. /// /// ```dart -/// new Text( +/// Text( /// 'No, we need bold strokes. We need this plan.', -/// style: new TextStyle(fontWeight: FontWeight.bold), +/// style: TextStyle(fontWeight: FontWeight.bold), /// ) /// ``` /// @@ -36,9 +36,9 @@ const String _kColorForegroundWarning = 'Cannot provide both a color and a foreg /// override which is implicitly mixed with the ambient [DefaultTextStyle]. /// /// ```dart -/// new Text( +/// Text( /// 'Welcome to the present, we\'re running a real nation.', -/// style: new TextStyle(fontStyle: FontStyle.italic), +/// style: TextStyle(fontStyle: FontStyle.italic), /// ) /// ``` /// @@ -52,24 +52,24 @@ const String _kColorForegroundWarning = 'Cannot provide both a color and a foreg /// implicitly mixed with the parent [TextSpan]'s [TextSpan.style]. /// /// If [color] is specified, [foreground] must be null and vice versa. [color] is -/// treated as a shorthand for `new Paint()..color = color`. +/// treated as a shorthand for `Paint()..color = color`. /// /// ```dart -/// new RichText( -/// text: new TextSpan( +/// RichText( +/// text: TextSpan( /// style: DefaultTextStyle.of(context).style, /// children: [ -/// new TextSpan( +/// TextSpan( /// text: 'You don\'t have the votes.\n', -/// style: new TextStyle(color: Colors.black.withOpacity(0.6)), +/// style: TextStyle(color: Colors.black.withOpacity(0.6)), /// ), -/// new TextSpan( +/// TextSpan( /// text: 'You don\'t have the votes!\n', -/// style: new TextStyle(color: Colors.black.withOpacity(0.8)), +/// style: TextStyle(color: Colors.black.withOpacity(0.8)), /// ), -/// new TextSpan( +/// TextSpan( /// text: 'You\'re gonna need congressional approval and you don\'t have the votes!\n', -/// style: new TextStyle(color: Colors.black.withOpacity(1.0)), +/// style: TextStyle(color: Colors.black.withOpacity(1.0)), /// ), /// ], /// ), @@ -82,7 +82,7 @@ const String _kColorForegroundWarning = 'Cannot provide both a color and a foreg /// obtain a [TextStyle] that doubles the default font size. /// /// ```dart -/// new Text( +/// Text( /// 'These are wise words, enterprising men quote \'em.', /// style: DefaultTextStyle.of(context).style.apply(fontSizeFactor: 2.0), /// ) @@ -94,9 +94,9 @@ const String _kColorForegroundWarning = 'Cannot provide both a color and a foreg /// height is set to 100 logical pixels, so that the text is very spaced out. /// /// ```dart -/// new Text( +/// Text( /// 'Don\'t act surprised, you guys, cuz I wrote \'em!', -/// style: new TextStyle(height: 100.0), +/// style: TextStyle(height: 100.0), /// ) /// ``` /// @@ -109,20 +109,20 @@ const String _kColorForegroundWarning = 'Cannot provide both a color and a foreg /// does not automatically use the ambient [DefaultTextStyle].) /// /// ```dart -/// new RichText( -/// text: new TextSpan( +/// RichText( +/// text: TextSpan( /// text: 'Don\'t tax the South ', /// children: [ -/// new TextSpan( +/// TextSpan( /// text: 'cuz', -/// style: new TextStyle( +/// style: TextStyle( /// color: Colors.black, /// decoration: TextDecoration.underline, /// decorationColor: Colors.red, /// decorationStyle: TextDecorationStyle.wavy, /// ), /// ), -/// new TextSpan( +/// TextSpan( /// text: ' we got it made in the shade', /// ), /// ], @@ -262,7 +262,7 @@ class TextStyle extends Diagnosticable { /// The color to use when painting the text. /// /// If [foreground] is specified, this value must be null. The [color] property - /// is shorthand for `new Paint()..color = color`. + /// is shorthand for `Paint()..color = color`. /// /// In [merge], [apply], and [lerp], conflicts between [color] and [foreground] /// specification are resolved in [foreground]'s favor - i.e. if [foreground] is @@ -333,7 +333,7 @@ class TextStyle extends Diagnosticable { /// updates all the way through the framework. /// /// If [color] is specified, this value must be null. The [color] property - /// is shorthand for `new Paint()..color = color`. + /// is shorthand for `Paint()..color = color`. /// /// In [merge], [apply], and [lerp], conflicts between [color] and [foreground] /// specification are resolved in [foreground]'s favor - i.e. if [foreground] is diff --git a/packages/flutter/lib/src/physics/gravity_simulation.dart b/packages/flutter/lib/src/physics/gravity_simulation.dart index 2873d65d62..e67c00da53 100644 --- a/packages/flutter/lib/src/physics/gravity_simulation.dart +++ b/packages/flutter/lib/src/physics/gravity_simulation.dart @@ -16,7 +16,7 @@ import 'simulation.dart'; /// /// ```dart /// void _startFall() { -/// _controller.animateWith(new GravitySimulation( +/// _controller.animateWith(GravitySimulation( /// 10.0, // acceleration, pixels per second per second /// 0.0, // starting position, pixels /// 300.0, // ending position, pixels diff --git a/packages/flutter/lib/src/rendering/custom_layout.dart b/packages/flutter/lib/src/rendering/custom_layout.dart index 201af4cedb..6d02ddac3e 100644 --- a/packages/flutter/lib/src/rendering/custom_layout.dart +++ b/packages/flutter/lib/src/rendering/custom_layout.dart @@ -65,13 +65,13 @@ class MultiChildLayoutParentData extends ContainerBoxParentData { /// Size leaderSize = Size.zero; /// /// if (hasChild(_Slot.leader)) { -/// leaderSize = layoutChild(_Slot.leader, new BoxConstraints.loose(size)); +/// leaderSize = layoutChild(_Slot.leader, BoxConstraints.loose(size)); /// positionChild(_Slot.leader, Offset.zero); /// } /// /// if (hasChild(_Slot.follower)) { -/// layoutChild(_Slot.follower, new BoxConstraints.tight(leaderSize)); -/// positionChild(_Slot.follower, new Offset(size.width - leaderSize.width, +/// layoutChild(_Slot.follower, BoxConstraints.tight(leaderSize)); +/// positionChild(_Slot.follower, Offset(size.width - leaderSize.width, /// size.height - leaderSize.height)); /// } /// } diff --git a/packages/flutter/lib/src/rendering/custom_paint.dart b/packages/flutter/lib/src/rendering/custom_paint.dart index bf8ef59a41..55a3a6c4da 100644 --- a/packages/flutter/lib/src/rendering/custom_paint.dart +++ b/packages/flutter/lib/src/rendering/custom_paint.dart @@ -72,7 +72,7 @@ typedef List SemanticsBuilderCallback(Size size); /// @override /// void paint(Canvas canvas, Size size) { /// var rect = Offset.zero & size; -/// var gradient = new RadialGradient( +/// var gradient = RadialGradient( /// center: const Alignment(0.7, -0.6), /// radius: 0.2, /// colors: [const Color(0xFFFFFF00), const Color(0xFF0099FF)], @@ -80,7 +80,7 @@ typedef List SemanticsBuilderCallback(Size size); /// ); /// canvas.drawRect( /// rect, -/// new Paint()..shader = gradient.createShader(rect), +/// Paint()..shader = gradient.createShader(rect), /// ); /// } /// @@ -93,11 +93,11 @@ typedef List SemanticsBuilderCallback(Size size); /// // touch. /// var rect = Offset.zero & size; /// var width = size.shortestSide * 0.4; -/// rect = const Alignment(0.8, -0.9).inscribe(new Size(width, width), rect); +/// rect = const Alignment(0.8, -0.9).inscribe(Size(width, width), rect); /// return [ -/// new CustomPainterSemantics( +/// CustomPainterSemantics( /// rect: rect, -/// properties: new SemanticsProperties( +/// properties: SemanticsProperties( /// label: 'Sun', /// textDirection: TextDirection.ltr, /// ), diff --git a/packages/flutter/lib/src/rendering/proxy_box.dart b/packages/flutter/lib/src/rendering/proxy_box.dart index 086f2a37f4..148f960c2a 100644 --- a/packages/flutter/lib/src/rendering/proxy_box.dart +++ b/packages/flutter/lib/src/rendering/proxy_box.dart @@ -2586,11 +2586,11 @@ class RenderRepaintBoundary extends RenderProxyBox { /// PngHome({Key key}) : super(key: key); /// /// @override - /// _PngHomeState createState() => new _PngHomeState(); + /// _PngHomeState createState() => _PngHomeState(); /// } /// /// class _PngHomeState extends State { - /// GlobalKey globalKey = new GlobalKey(); + /// GlobalKey globalKey = GlobalKey(); /// /// Future _capturePng() async { /// RenderRepaintBoundary boundary = globalKey.currentContext.findRenderObject(); diff --git a/packages/flutter/lib/src/services/platform_channel.dart b/packages/flutter/lib/src/services/platform_channel.dart index 98c89fbc75..6c4484a815 100644 --- a/packages/flutter/lib/src/services/platform_channel.dart +++ b/packages/flutter/lib/src/services/platform_channel.dart @@ -184,7 +184,7 @@ class MethodChannel { /// final String artist; /// /// static Song fromJson(dynamic json) { - /// return new Song(json['id'], json['title'], json['artist']); + /// return Song(json['id'], json['title'], json['artist']); /// } /// } /// ``` @@ -200,7 +200,7 @@ class MethodChannel { /// break; /// case "getSongs": /// final List tracks = MusicApi.getTracks(); - /// final List json = new ArrayList<>(tracks.size()); + /// final List json = ArrayList<>(tracks.size()); /// for (MusicApi.Track track : tracks) { /// json.add(track.toJson()); // Map entries /// } diff --git a/packages/flutter/lib/src/widgets/animated_cross_fade.dart b/packages/flutter/lib/src/widgets/animated_cross_fade.dart index d89bfbf983..507350bdc3 100644 --- a/packages/flutter/lib/src/widgets/animated_cross_fade.dart +++ b/packages/flutter/lib/src/widgets/animated_cross_fade.dart @@ -39,17 +39,17 @@ enum CrossFadeState { /// /// ```dart /// Widget defaultLayoutBuilder(Widget topChild, Key topChildKey, Widget bottomChild, Key bottomChildKey) { -/// return new Stack( +/// return Stack( /// fit: StackFit.loose, /// children: [ -/// new Positioned( +/// Positioned( /// key: bottomChildKey, /// left: 0.0, /// top: 0.0, /// right: 0.0, /// child: bottomChild, /// ), -/// new Positioned( +/// Positioned( /// key: topChildKey, /// child: topChild, /// ) @@ -87,7 +87,7 @@ typedef Widget AnimatedCrossFadeBuilder(Widget topChild, Key topChildKey, Widget /// over three seconds. /// /// ```dart -/// new AnimatedCrossFade( +/// AnimatedCrossFade( /// duration: const Duration(seconds: 3), /// firstChild: const FlutterLogo(style: FlutterLogoStyle.horizontal, size: 100.0), /// secondChild: const FlutterLogo(style: FlutterLogoStyle.stacked, size: 100.0), diff --git a/packages/flutter/lib/src/widgets/animated_list.dart b/packages/flutter/lib/src/widgets/animated_list.dart index a5e5e9e892..efeeb69327 100644 --- a/packages/flutter/lib/src/widgets/animated_list.dart +++ b/packages/flutter/lib/src/widgets/animated_list.dart @@ -196,9 +196,9 @@ class AnimatedList extends StatefulWidget { /// can refer to the [AnimatedList]'s state with a global key: /// /// ```dart -/// GlobalKey listKey = new GlobalKey(); +/// GlobalKey listKey = GlobalKey(); /// ... -/// new AnimatedList(key: listKey, ...); +/// AnimatedList(key: listKey, ...); /// ... /// listKey.currentState.insert(123); /// ``` diff --git a/packages/flutter/lib/src/widgets/animated_switcher.dart b/packages/flutter/lib/src/widgets/animated_switcher.dart index 4d96c48f0d..136fad5c44 100644 --- a/packages/flutter/lib/src/widgets/animated_switcher.dart +++ b/packages/flutter/lib/src/widgets/animated_switcher.dart @@ -79,7 +79,7 @@ typedef Widget AnimatedSwitcherLayoutBuilder(Widget currentChild, List p /// const ClickCounter({Key key}) : super(key: key); /// /// @override -/// _ClickCounterState createState() => new _ClickCounterState(); +/// _ClickCounterState createState() => _ClickCounterState(); /// } /// /// class _ClickCounterState extends State { @@ -87,26 +87,26 @@ typedef Widget AnimatedSwitcherLayoutBuilder(Widget currentChild, List p /// /// @override /// Widget build(BuildContext context) { -/// return new MaterialApp( -/// home: new Material( +/// return MaterialApp( +/// home: Material( /// child: Column( /// mainAxisAlignment: MainAxisAlignment.center, /// children: [ -/// new AnimatedSwitcher( +/// AnimatedSwitcher( /// duration: const Duration(milliseconds: 500), /// transitionBuilder: (Widget child, Animation animation) { -/// return new ScaleTransition(child: child, scale: animation); +/// return ScaleTransition(child: child, scale: animation); /// }, -/// child: new Text( +/// child: Text( /// '$_count', /// // This key causes the AnimatedSwitcher to interpret this as a "new" /// // child each time the count changes, so that it will begin its animation /// // when the count changes. -/// key: new ValueKey(_count), +/// key: ValueKey(_count), /// style: Theme.of(context).textTheme.display1, /// ), /// ), -/// new RaisedButton( +/// RaisedButton( /// child: const Text('Increment'), /// onPressed: () { /// setState(() { diff --git a/packages/flutter/lib/src/widgets/async.dart b/packages/flutter/lib/src/widgets/async.dart index 455241b693..b73111c7bd 100644 --- a/packages/flutter/lib/src/widgets/async.dart +++ b/packages/flutter/lib/src/widgets/async.dart @@ -348,16 +348,16 @@ typedef Widget AsyncWidgetBuilder(BuildContext context, AsyncSnapshot snap /// set by a selector elsewhere in the UI. /// /// ```dart -/// new StreamBuilder( +/// StreamBuilder( /// stream: _lot?.bids, // a Stream or null /// builder: (BuildContext context, AsyncSnapshot snapshot) { /// if (snapshot.hasError) -/// return new Text('Error: ${snapshot.error}'); +/// return Text('Error: ${snapshot.error}'); /// switch (snapshot.connectionState) { -/// case ConnectionState.none: return new Text('Select lot'); -/// case ConnectionState.waiting: return new Text('Awaiting bids...'); -/// case ConnectionState.active: return new Text('\$${snapshot.data}'); -/// case ConnectionState.done: return new Text('\$${snapshot.data} (closed)'); +/// case ConnectionState.none: return Text('Select lot'); +/// case ConnectionState.waiting: return Text('Awaiting bids...'); +/// case ConnectionState.active: return Text('\$${snapshot.data}'); +/// case ConnectionState.done: return Text('\$${snapshot.data} (closed)'); /// } /// return null; // unreachable /// }, @@ -479,19 +479,19 @@ class StreamBuilder extends StreamBuilderBase> { /// `_calculation` field is set by pressing a button elsewhere in the UI. /// /// ```dart -/// new FutureBuilder( +/// FutureBuilder( /// future: _calculation, // a previously-obtained Future or null /// builder: (BuildContext context, AsyncSnapshot snapshot) { /// switch (snapshot.connectionState) { /// case ConnectionState.none: -/// return new Text('Press button to start.'); +/// return Text('Press button to start.'); /// case ConnectionState.active: /// case ConnectionState.waiting: -/// return new Text('Awaiting result...'); +/// return Text('Awaiting result...'); /// case ConnectionState.done: /// if (snapshot.hasError) -/// return new Text('Error: ${snapshot.error}'); -/// return new Text('Result: ${snapshot.data}'); +/// return Text('Error: ${snapshot.error}'); +/// return Text('Result: ${snapshot.data}'); /// } /// return null; // unreachable /// }, diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index 0f9f224c34..bb6fbf7906 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -134,7 +134,7 @@ class Directionality extends InheritedWidget { /// hides it when it is false: /// /// ```dart -/// new Opacity( +/// Opacity( /// opacity: _visible ? 1.0 : 0.0, /// child: const Text('Now you see me, now you don\'t!'), /// ) @@ -230,9 +230,9 @@ class Opacity extends SingleChildRenderObjectWidget { /// This example makes the text look like it is on fire: /// /// ```dart -/// new ShaderMask( +/// ShaderMask( /// shaderCallback: (Rect bounds) { -/// return new RadialGradient( +/// return RadialGradient( /// center: Alignment.topLeft, /// radius: 1.0, /// colors: [Colors.yellow, Colors.deepOrange.shade900], @@ -362,10 +362,10 @@ class BackdropFilter extends SingleChildRenderObjectWidget { /// text. /// /// ```dart -/// new CustomPaint( -/// painter: new Sky(), -/// child: new Center( -/// child: new Text( +/// CustomPaint( +/// painter: Sky(), +/// child: Center( +/// child: Text( /// 'Once upon a time...', /// style: const TextStyle( /// fontSize: 40.0, @@ -476,11 +476,11 @@ class CustomPaint extends SingleChildRenderObjectWidget { /// the top half of an [Image]: /// /// ```dart -/// new ClipRect( -/// child: new Align( +/// ClipRect( +/// child: Align( /// alignment: Alignment.topCenter, /// heightFactor: 0.5, -/// child: new Image.network(userAvatarUrl), +/// child: Image.network(userAvatarUrl), /// ), /// ) /// ``` @@ -870,12 +870,12 @@ class PhysicalShape extends SingleChildRenderObjectWidget { /// top right corner pinned to its original position. /// /// ```dart -/// new Container( +/// Container( /// color: Colors.black, -/// child: new Transform( +/// child: Transform( /// alignment: Alignment.topRight, -/// transform: new Matrix4.skewY(0.3)..rotateZ(-math.pi / 12.0), -/// child: new Container( +/// transform: Matrix4.skewY(0.3)..rotateZ(-math.pi / 12.0), +/// child: Container( /// padding: const EdgeInsets.all(8.0), /// color: const Color(0xFFE8581C), /// child: const Text('Apartment for rent!'), @@ -918,9 +918,9 @@ class Transform extends SingleChildRenderObjectWidget { /// fifteen degrees. /// /// ```dart - /// new Transform.rotate( + /// Transform.rotate( /// angle: -math.pi / 12.0, - /// child: new Container( + /// child: Container( /// padding: const EdgeInsets.all(8.0), /// color: const Color(0xFFE8581C), /// child: const Text('Apartment for rent!'), @@ -946,9 +946,9 @@ class Transform extends SingleChildRenderObjectWidget { /// This example shifts the silver-colored child down by fifteen pixels. /// /// ```dart - /// new Transform.translate( + /// Transform.translate( /// offset: const Offset(0.0, 15.0), - /// child: new Container( + /// child: Container( /// padding: const EdgeInsets.all(8.0), /// color: const Color(0xFF7F7F7F), /// child: const Text('Quarter'), @@ -979,9 +979,9 @@ class Transform extends SingleChildRenderObjectWidget { /// is half the size it would otherwise be. /// /// ```dart - /// new Transform.scale( + /// Transform.scale( /// scale: 0.5, - /// child: new Container( + /// child: Container( /// padding: const EdgeInsets.all(8.0), /// color: const Color(0xFFE8581C), /// child: const Text('Bad Ideas'), @@ -1310,7 +1310,7 @@ class FractionalTranslation extends SingleChildRenderObjectWidget { /// to top, like an axis label on a graph: /// /// ```dart -/// new RotatedBox( +/// RotatedBox( /// quarterTurns: 3, /// child: const Text('Hello World!'), /// ) @@ -1358,8 +1358,8 @@ class RotatedBox extends SingleChildRenderObjectWidget { /// in each direction: /// /// ```dart -/// new Padding( -/// padding: new EdgeInsets.all(8.0), +/// Padding( +/// padding: EdgeInsets.all(8.0), /// child: const Card(child: Text('Hello World!')), /// ) /// ``` @@ -1697,7 +1697,7 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget { /// exact size 200x300, parental constraints permitting: /// /// ```dart -/// new SizedBox( +/// SizedBox( /// width: 200.0, /// height: 300.0, /// child: const Card(child: Text('Hello World!')), @@ -1804,7 +1804,7 @@ class SizedBox extends SingleChildRenderObjectWidget { /// parent, by applying [BoxConstraints.expand] constraints: /// /// ```dart -/// new ConstrainedBox( +/// ConstrainedBox( /// constraints: const BoxConstraints.expand(), /// child: const Card(child: Text('Hello World!')), /// ) @@ -3529,16 +3529,16 @@ class Flex extends MultiChildRenderObjectWidget { /// the third: /// /// ```dart -/// new Row( +/// Row( /// children: [ -/// new Expanded( -/// child: new Text('Deliver features faster', textAlign: TextAlign.center), +/// Expanded( +/// child: Text('Deliver features faster', textAlign: TextAlign.center), /// ), -/// new Expanded( -/// child: new Text('Craft beautiful UIs', textAlign: TextAlign.center), +/// Expanded( +/// child: Text('Craft beautiful UIs', textAlign: TextAlign.center), /// ), -/// new Expanded( -/// child: new FittedBox( +/// Expanded( +/// child: FittedBox( /// fit: BoxFit.contain, // otherwise the logo will be tiny /// child: const FlutterLogo(), /// ), @@ -3564,7 +3564,7 @@ class Flex extends MultiChildRenderObjectWidget { /// Suppose, for instance, that you had this code: /// /// ```dart -/// new Row( +/// Row( /// children: [ /// const FlutterLogo(), /// const Text('Flutter\'s hot reload helps you quickly and easily experiment, build UIs, add features, and fix bug faster. Experience sub-second reload times, without losing state, on emulators, simulators, and hardware for iOS and Android.'), @@ -3589,7 +3589,7 @@ class Flex extends MultiChildRenderObjectWidget { /// row that the child should be given the remaining room: /// /// ```dart -/// new Row( +/// Row( /// children: [ /// const FlutterLogo(), /// const Expanded( @@ -3711,12 +3711,12 @@ class Row extends Flex { /// being made to fill all the remaining space. /// /// ```dart -/// new Column( +/// Column( /// children: [ -/// new Text('Deliver features faster'), -/// new Text('Craft beautiful UIs'), -/// new Expanded( -/// child: new FittedBox( +/// Text('Deliver features faster'), +/// Text('Craft beautiful UIs'), +/// Expanded( +/// child: FittedBox( /// fit: BoxFit.contain, // otherwise the logo will be tiny /// child: const FlutterLogo(), /// ), @@ -3732,17 +3732,17 @@ class Row extends Flex { /// fit the children. /// /// ```dart -/// new Column( +/// Column( /// crossAxisAlignment: CrossAxisAlignment.start, /// mainAxisSize: MainAxisSize.min, /// children: [ -/// new Text('We move under cover and we move as one'), -/// new Text('Through the night, we have one shot to live another day'), -/// new Text('We cannot let a stray gunshot give us away'), -/// new Text('We will fight up close, seize the moment and stay in it'), -/// new Text('It’s either that or meet the business end of a bayonet'), -/// new Text('The code word is ‘Rochambeau,’ dig me?'), -/// new Text('Rochambeau!', style: DefaultTextStyle.of(context).style.apply(fontSizeFactor: 2.0)), +/// Text('We move under cover and we move as one'), +/// Text('Through the night, we have one shot to live another day'), +/// Text('We cannot let a stray gunshot give us away'), +/// Text('We will fight up close, seize the moment and stay in it'), +/// Text('It’s either that or meet the business end of a bayonet'), +/// Text('The code word is ‘Rochambeau,’ dig me?'), +/// Text('Rochambeau!', style: DefaultTextStyle.of(context).style.apply(fontSizeFactor: 2.0)), /// ], /// ) /// ``` @@ -4005,25 +4005,25 @@ class Expanded extends Flexible { /// that they flow across lines as necessary. /// /// ```dart -/// new Wrap( +/// Wrap( /// spacing: 8.0, // gap between adjacent chips /// runSpacing: 4.0, // gap between lines /// children: [ -/// new Chip( -/// avatar: new CircleAvatar(backgroundColor: Colors.blue.shade900, child: new Text('AH')), -/// label: new Text('Hamilton'), +/// Chip( +/// avatar: CircleAvatar(backgroundColor: Colors.blue.shade900, child: Text('AH')), +/// label: Text('Hamilton'), /// ), -/// new Chip( -/// avatar: new CircleAvatar(backgroundColor: Colors.blue.shade900, child: new Text('ML')), -/// label: new Text('Lafayette'), +/// Chip( +/// avatar: CircleAvatar(backgroundColor: Colors.blue.shade900, child: Text('ML')), +/// label: Text('Lafayette'), /// ), -/// new Chip( -/// avatar: new CircleAvatar(backgroundColor: Colors.blue.shade900, child: new Text('HM')), -/// label: new Text('Mulligan'), +/// Chip( +/// avatar: CircleAvatar(backgroundColor: Colors.blue.shade900, child: Text('HM')), +/// label: Text('Mulligan'), /// ), -/// new Chip( -/// avatar: new CircleAvatar(backgroundColor: Colors.blue.shade900, child: new Text('JL')), -/// label: new Text('Laurens'), +/// Chip( +/// avatar: CircleAvatar(backgroundColor: Colors.blue.shade900, child: Text('JL')), +/// label: Text('Laurens'), /// ), /// ], /// ) @@ -4329,13 +4329,13 @@ class Flow extends MultiChildRenderObjectWidget { /// ## Sample code /// /// ```dart -/// new RichText( -/// text: new TextSpan( +/// RichText( +/// text: TextSpan( /// text: 'Hello ', /// style: DefaultTextStyle.of(context).style, /// children: [ -/// new TextSpan(text: 'bold', style: new TextStyle(fontWeight: FontWeight.bold)), -/// new TextSpan(text: ' world!'), +/// TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold)), +/// TextSpan(text: ' world!'), /// ], /// ), /// ) @@ -4665,7 +4665,7 @@ class RawImage extends LeafRenderObjectWidget { /// @override /// Future load(String key) async { /// if (key == 'resources/test') -/// return new ByteData.view(new Uint8List.fromList(utf8.encode('Hello World!')).buffer); +/// return ByteData.view(Uint8List.fromList(utf8.encode('Hello World!')).buffer); /// return null; /// } /// } @@ -4676,10 +4676,10 @@ class RawImage extends LeafRenderObjectWidget { /// /// ```dart /// await tester.pumpWidget( -/// new MaterialApp( -/// home: new DefaultAssetBundle( -/// bundle: new TestAssetBundle(), -/// child: new TestWidget(), +/// MaterialApp( +/// home: DefaultAssetBundle( +/// bundle: TestAssetBundle(), +/// child: TestWidget(), /// ), /// ), /// ); diff --git a/packages/flutter/lib/src/widgets/binding.dart b/packages/flutter/lib/src/widgets/binding.dart index 5140bfd030..5b4d4b2e22 100644 --- a/packages/flutter/lib/src/widgets/binding.dart +++ b/packages/flutter/lib/src/widgets/binding.dart @@ -40,7 +40,7 @@ export 'dart:ui' show AppLifecycleState, Locale; /// const AppLifecycleReactor({ Key key }) : super(key: key); /// /// @override -/// _AppLifecycleReactorState createState() => new _AppLifecycleReactorState(); +/// _AppLifecycleReactorState createState() => _AppLifecycleReactorState(); /// } /// /// class _AppLifecycleReactorState extends State with WidgetsBindingObserver { @@ -65,7 +65,7 @@ export 'dart:ui' show AppLifecycleState, Locale; /// /// @override /// Widget build(BuildContext context) { -/// return new Text('Last notification: $_notification'); +/// return Text('Last notification: $_notification'); /// } /// } /// ``` @@ -117,7 +117,7 @@ abstract class WidgetsBindingObserver { /// const MetricsReactor({ Key key }) : super(key: key); /// /// @override - /// _MetricsReactorState createState() => new _MetricsReactorState(); + /// _MetricsReactorState createState() => _MetricsReactorState(); /// } /// /// class _MetricsReactorState extends State with WidgetsBindingObserver { @@ -142,7 +142,7 @@ abstract class WidgetsBindingObserver { /// /// @override /// Widget build(BuildContext context) { - /// return new Text('Current size: $_lastSize'); + /// return Text('Current size: $_lastSize'); /// } /// } /// ``` @@ -172,7 +172,7 @@ abstract class WidgetsBindingObserver { /// const TextScaleFactorReactor({ Key key }) : super(key: key); /// /// @override - /// _TextScaleFactorReactorState createState() => new _TextScaleFactorReactorState(); + /// _TextScaleFactorReactorState createState() => _TextScaleFactorReactorState(); /// } /// /// class _TextScaleFactorReactorState extends State with WidgetsBindingObserver { @@ -197,7 +197,7 @@ abstract class WidgetsBindingObserver { /// /// @override /// Widget build(BuildContext context) { - /// return new Text('Current scale factor: $_lastTextScaleFactor'); + /// return Text('Current scale factor: $_lastTextScaleFactor'); /// } /// } /// ``` diff --git a/packages/flutter/lib/src/widgets/container.dart b/packages/flutter/lib/src/widgets/container.dart index e9b5572910..83f71a4fc6 100644 --- a/packages/flutter/lib/src/widgets/container.dart +++ b/packages/flutter/lib/src/widgets/container.dart @@ -22,9 +22,9 @@ import 'image.dart'; /// This sample shows a radial gradient that draws a moon on a night sky: /// /// ```dart -/// new DecoratedBox( -/// decoration: new BoxDecoration( -/// gradient: new RadialGradient( +/// DecoratedBox( +/// decoration: BoxDecoration( +/// gradient: RadialGradient( /// center: const Alignment(-0.5, -0.6), /// radius: 0.15, /// colors: [ @@ -183,8 +183,8 @@ class DecoratedBox extends SingleChildRenderObjectWidget { /// neighboring widgets: /// /// ```dart -/// new Center( -/// child: new Container( +/// Center( +/// child: Container( /// margin: const EdgeInsets.all(10.0), /// color: const Color(0xFF00FF00), /// width: 48.0, @@ -203,21 +203,21 @@ class DecoratedBox extends SingleChildRenderObjectWidget { /// entire contraption to complete the effect. /// /// ```dart -/// new Container( -/// constraints: new BoxConstraints.expand( +/// Container( +/// constraints: BoxConstraints.expand( /// height: Theme.of(context).textTheme.display1.fontSize * 1.1 + 200.0, /// ), /// padding: const EdgeInsets.all(8.0), /// color: Colors.teal.shade700, /// alignment: Alignment.center, -/// child: new Text('Hello World', style: Theme.of(context).textTheme.display1.copyWith(color: Colors.white)), -/// foregroundDecoration: new BoxDecoration( -/// image: new DecorationImage( -/// image: new NetworkImage('https://www.example.com/images/frame.png'), -/// centerSlice: new Rect.fromLTRB(270.0, 180.0, 1360.0, 730.0), +/// child: Text('Hello World', style: Theme.of(context).textTheme.display1.copyWith(color: Colors.white)), +/// foregroundDecoration: BoxDecoration( +/// image: DecorationImage( +/// image: NetworkImage('https://www.example.com/images/frame.png'), +/// centerSlice: Rect.fromLTRB(270.0, 180.0, 1360.0, 730.0), /// ), /// ), -/// transform: new Matrix4.rotationZ(0.1), +/// transform: Matrix4.rotationZ(0.1), /// ) /// ``` /// diff --git a/packages/flutter/lib/src/widgets/fade_in_image.dart b/packages/flutter/lib/src/widgets/fade_in_image.dart index d6683abcc3..19cf709bcb 100644 --- a/packages/flutter/lib/src/widgets/fade_in_image.dart +++ b/packages/flutter/lib/src/widgets/fade_in_image.dart @@ -52,10 +52,10 @@ import 'ticker_provider.dart'; /// ## Sample code /// /// ```dart -/// new FadeInImage( +/// FadeInImage( /// // here `bytes` is a Uint8List containing the bytes for the in-memory image -/// placeholder: new MemoryImage(bytes), -/// image: new NetworkImage('https://backend.example.com/image.png'), +/// placeholder: MemoryImage(bytes), +/// image: NetworkImage('https://backend.example.com/image.png'), /// ) /// ``` class FadeInImage extends StatefulWidget { diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 12e2802a4b..eabee876c8 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -508,7 +508,7 @@ abstract class Widget extends DiagnosticableTree { /// /// @override /// Widget build(BuildContext context) { -/// return new Container(color: const Color(0xFF2DBD3A)); +/// return Container(color: const Color(0xFF2DBD3A)); /// } /// } /// ``` @@ -531,7 +531,7 @@ abstract class Widget extends DiagnosticableTree { /// /// @override /// Widget build(BuildContext context) { -/// return new Container(color: color, child: child); +/// return Container(color: color, child: child); /// } /// } /// ``` @@ -714,13 +714,13 @@ abstract class StatelessWidget extends Widget { /// const YellowBird({ Key key }) : super(key: key); /// /// @override -/// _YellowBirdState createState() => new _YellowBirdState(); +/// _YellowBirdState createState() => _YellowBirdState(); /// } /// /// class _YellowBirdState extends State { /// @override /// Widget build(BuildContext context) { -/// return new Container(color: const Color(0xFFFFE306)); +/// return Container(color: const Color(0xFFFFE306)); /// } /// } /// ``` @@ -745,7 +745,7 @@ abstract class StatelessWidget extends Widget { /// /// final Widget child; /// -/// _BirdState createState() => new _BirdState(); +/// _BirdState createState() => _BirdState(); /// } /// /// class _BirdState extends State { @@ -757,9 +757,9 @@ abstract class StatelessWidget extends Widget { /// /// @override /// Widget build(BuildContext context) { -/// return new Container( +/// return Container( /// color: widget.color, -/// transform: new Matrix4.diagonal3Values(_size, _size, 1.0), +/// transform: Matrix4.diagonal3Values(_size, _size, 1.0), /// child: widget.child, /// ); /// } @@ -795,7 +795,7 @@ abstract class StatefulWidget extends Widget { /// /// ```dart /// @override - /// _MyState createState() => new _MyState(); + /// _MyState createState() => _MyState(); /// ``` /// /// The framework can call this method multiple times over the lifetime of @@ -1082,7 +1082,7 @@ abstract class State extends Diagnosticable { /// }); /// Directory directory = await getApplicationDocumentsDirectory(); /// final String dirName = directory.path; - /// await new File('$dir/counter.txt').writeAsString('$_counter'); + /// await File('$dir/counter.txt').writeAsString('$_counter'); /// return null; /// } /// ``` @@ -1790,16 +1790,16 @@ typedef void ElementVisitor(Element element); /// @override /// Widget build(BuildContext context) { /// // here, Scaffold.of(context) returns null -/// return new Scaffold( -/// appBar: new AppBar(title: new Text('Demo')), -/// body: new Builder( +/// return Scaffold( +/// appBar: AppBar(title: Text('Demo')), +/// body: Builder( /// builder: (BuildContext context) { -/// return new FlatButton( -/// child: new Text('BUTTON'), +/// return FlatButton( +/// child: Text('BUTTON'), /// onPressed: () { /// // here, Scaffold.of(context) returns the locally created Scaffold -/// Scaffold.of(context).showSnackBar(new SnackBar( -/// content: new Text('Hello.') +/// Scaffold.of(context).showSnackBar(SnackBar( +/// content: Text('Hello.') /// )); /// } /// ); diff --git a/packages/flutter/lib/src/widgets/gesture_detector.dart b/packages/flutter/lib/src/widgets/gesture_detector.dart index 189e1fa928..2e8268ffdf 100644 --- a/packages/flutter/lib/src/widgets/gesture_detector.dart +++ b/packages/flutter/lib/src/widgets/gesture_detector.dart @@ -114,13 +114,13 @@ class GestureRecognizerFactoryWithHandlers extends /// `_lights` field: /// /// ```dart -/// new GestureDetector( +/// GestureDetector( /// onTap: () { /// setState(() { _lights = true; }); /// }, -/// child: new Container( +/// child: Container( /// color: Colors.yellow, -/// child: new Text('TURN LIGHTS ON'), +/// child: Text('TURN LIGHTS ON'), /// ), /// ) /// ``` @@ -450,10 +450,10 @@ class GestureDetector extends StatelessWidget { /// then displayed as the child of the gesture detector. /// /// ```dart -/// new RawGestureDetector( +/// RawGestureDetector( /// gestures: { -/// TapGestureRecognizer: new GestureRecognizerFactoryWithHandlers( -/// () => new TapGestureRecognizer(), +/// TapGestureRecognizer: GestureRecognizerFactoryWithHandlers( +/// () => TapGestureRecognizer(), /// (TapGestureRecognizer instance) { /// instance /// ..onTapDown = (TapDownDetails details) { setState(() { _last = 'down'; }); } @@ -463,7 +463,7 @@ class GestureDetector extends StatelessWidget { /// }, /// ), /// }, -/// child: new Container(width: 300.0, height: 300.0, color: Colors.yellow, child: new Text(_last)), +/// child: Container(width: 300.0, height: 300.0, color: Colors.yellow, child: Text(_last)), /// ) /// ``` /// diff --git a/packages/flutter/lib/src/widgets/icon.dart b/packages/flutter/lib/src/widgets/icon.dart index 03eed58c25..d876dba08e 100644 --- a/packages/flutter/lib/src/widgets/icon.dart +++ b/packages/flutter/lib/src/widgets/icon.dart @@ -79,7 +79,7 @@ class Icon extends StatelessWidget { /// Typically, a material design color will be used, as follows: /// /// ```dart - /// new Icon( + /// Icon( /// icon: Icons.widgets, /// color: Colors.blue.shade400, /// ), diff --git a/packages/flutter/lib/src/widgets/image.dart b/packages/flutter/lib/src/widgets/image.dart index f645b3e781..dc9d74af93 100644 --- a/packages/flutter/lib/src/widgets/image.dart +++ b/packages/flutter/lib/src/widgets/image.dart @@ -286,7 +286,7 @@ class Image extends StatefulWidget { /// render the `images/2x/cat.png` file: /// /// ```dart - /// new Image.asset('images/cat.png') + /// Image.asset('images/cat.png') /// ``` /// /// This corresponds to the file that is in the project's `images/2x/` @@ -311,7 +311,7 @@ class Image extends StatefulWidget { /// Then to display the image, use: /// /// ```dart - /// new Image.asset('icons/heart.png', package: 'my_icons') + /// Image.asset('icons/heart.png', package: 'my_icons') /// ``` /// /// Assets used by the package itself should also be displayed using the diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart index 7c86e4ae30..e1bbeeca5f 100644 --- a/packages/flutter/lib/src/widgets/implicit_animations.dart +++ b/packages/flutter/lib/src/widgets/implicit_animations.dart @@ -1023,7 +1023,7 @@ class _AnimatedPositionedDirectionalState extends AnimatedWidgetBaseState new LogoFadeState(); +/// createState() => LogoFadeState(); /// } /// /// class LogoFadeState extends State { @@ -1035,16 +1035,16 @@ class _AnimatedPositionedDirectionalState extends AnimatedWidgetBaseState load(Locale locale) { /// return initializeMessages(locale.toString()) /// .then((Null _) { -/// return new MyLocalizations(locale); +/// return MyLocalizations(locale); /// }); /// } /// @@ -354,7 +354,7 @@ class Localizations extends StatefulWidget { /// /// ```dart /// Widget build(BuildContext context) { - /// return new Localizations.override( + /// return Localizations.override( /// context: context, /// locale: const Locale('en', 'US'), /// child: myWidget, diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart index 65798a461b..b720bee431 100644 --- a/packages/flutter/lib/src/widgets/navigator.dart +++ b/packages/flutter/lib/src/widgets/navigator.dart @@ -388,7 +388,7 @@ class NavigatorObserver { /// /// ```dart /// void main() { -/// runApp(new MaterialApp(home: new MyAppHome())); +/// runApp(MaterialApp(home: MyAppHome())); /// } /// ``` /// @@ -397,13 +397,13 @@ class NavigatorObserver { /// want to appear on the screen. For example: /// /// ```dart -/// Navigator.push(context, new MaterialPageRoute( +/// Navigator.push(context, MaterialPageRoute( /// builder: (BuildContext context) { -/// return new Scaffold( -/// appBar: new AppBar(title: new Text('My Page')), -/// body: new Center( -/// child: new FlatButton( -/// child: new Text('POP'), +/// return Scaffold( +/// appBar: AppBar(title: Text('My Page')), +/// body: Center( +/// child: FlatButton( +/// child: Text('POP'), /// onPressed: () { /// Navigator.pop(context); /// }, @@ -445,12 +445,12 @@ class NavigatorObserver { /// /// ```dart /// void main() { -/// runApp(new MaterialApp( -/// home: new MyAppHome(), // becomes the route named '/' +/// runApp(MaterialApp( +/// home: MyAppHome(), // becomes the route named '/' /// routes: { -/// '/a': (BuildContext context) => new MyPage(title: 'page A'), -/// '/b': (BuildContext context) => new MyPage(title: 'page B'), -/// '/c': (BuildContext context) => new MyPage(title: 'page C'), +/// '/a': (BuildContext context) => MyPage(title: 'page A'), +/// '/b': (BuildContext context) => MyPage(title: 'page B'), +/// '/c': (BuildContext context) => MyPage(title: 'page C'), /// }, /// )); /// } @@ -475,11 +475,11 @@ class NavigatorObserver { /// operation we could `await` the result of [Navigator.push]: /// /// ```dart -/// bool value = await Navigator.push(context, new MaterialPageRoute( +/// bool value = await Navigator.push(context, MaterialPageRoute( /// builder: (BuildContext context) { -/// return new Center( -/// child: new GestureDetector( -/// child: new Text('OK'), +/// return Center( +/// child: GestureDetector( +/// child: Text('OK'), /// onTap: () { Navigator.pop(context, true); } /// ), /// ); @@ -527,16 +527,16 @@ class NavigatorObserver { /// screen because it specifies `opaque: false`, just as a popup route does. /// /// ```dart -/// Navigator.push(context, new PageRouteBuilder( +/// Navigator.push(context, PageRouteBuilder( /// opaque: false, /// pageBuilder: (BuildContext context, _, __) { -/// return new Center(child: new Text('My PageRoute')); +/// return Center(child: Text('My PageRoute')); /// }, /// transitionsBuilder: (___, Animation animation, ____, Widget child) { -/// return new FadeTransition( +/// return FadeTransition( /// opacity: animation, -/// child: new RotationTransition( -/// turns: new Tween(begin: 0.5, end: 1.0).animate(animation), +/// child: RotationTransition( +/// turns: Tween(begin: 0.5, end: 1.0).animate(animation), /// child: child, /// ), /// ); @@ -588,13 +588,13 @@ class NavigatorObserver { /// class MyApp extends StatelessWidget { /// @override /// Widget build(BuildContext context) { -/// return new MaterialApp( +/// return MaterialApp( /// // ...some parameters omitted... /// // MaterialApp contains our top-level Navigator /// initialRoute: '/', /// routes: { -/// '/': (BuildContext context) => new HomePage(), -/// '/signup': (BuildContext context) => new SignUpPage(), +/// '/': (BuildContext context) => HomePage(), +/// '/signup': (BuildContext context) => SignUpPage(), /// }, /// ); /// } @@ -605,7 +605,7 @@ class NavigatorObserver { /// Widget build(BuildContext context) { /// // SignUpPage builds its own Navigator which ends up being a nested /// // Navigator in our app. -/// return new Navigator( +/// return Navigator( /// initialRoute: 'signup/personal_info', /// onGenerateRoute: (RouteSettings settings) { /// WidgetBuilder builder; @@ -613,12 +613,12 @@ class NavigatorObserver { /// case 'signup/personal_info': /// // Assume CollectPersonalInfoPage collects personal info and then /// // navigates to 'signup/choose_credentials'. -/// builder = (BuildContext _) => new CollectPersonalInfoPage(); +/// builder = (BuildContext _) => CollectPersonalInfoPage(); /// break; /// case 'signup/choose_credentials': /// // Assume ChooseCredentialsPage collects new credentials and then /// // invokes 'onSignupComplete()'. -/// builder = (BuildContext _) => new ChooseCredentialsPage( +/// builder = (BuildContext _) => ChooseCredentialsPage( /// onSignupComplete: () { /// // Referencing Navigator.of(context) from here refers to the /// // top level Navigator because SignUpPage is above the @@ -630,9 +630,9 @@ class NavigatorObserver { /// ); /// break; /// default: -/// throw new Exception('Invalid route: ${settings.name}'); +/// throw Exception('Invalid route: ${settings.name}'); /// } -/// return new MaterialPageRoute(builder: builder, settings: settings); +/// return MaterialPageRoute(builder: builder, settings: settings); /// }, /// ); /// } @@ -901,7 +901,7 @@ class Navigator extends StatefulWidget { /// /// ```dart /// void _openMyPage() { - /// Navigator.push(context, new MaterialPageRoute(builder: (BuildContext context) => new MyPage())); + /// Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) => MyPage())); /// } /// ``` @optionalTypeArgs @@ -944,7 +944,7 @@ class Navigator extends StatefulWidget { /// ```dart /// void _completeLogin() { /// Navigator.pushReplacement( - /// context, new MaterialPageRoute(builder: (BuildContext context) => new MyHomePage())); + /// context, MaterialPageRoute(builder: (BuildContext context) => MyHomePage())); /// } /// ``` @optionalTypeArgs @@ -995,7 +995,7 @@ class Navigator extends StatefulWidget { /// void _finishAccountCreation() { /// Navigator.pushAndRemoveUntil( /// context, - /// new MaterialPageRoute(builder: (BuildContext context) => new MyHomePage()), + /// MaterialPageRoute(builder: (BuildContext context) => MyHomePage()), /// ModalRoute.withName('/'), /// ); /// } @@ -1523,7 +1523,7 @@ class NavigatorState extends State with TickerProviderStateMixin { /// /// ```dart /// void _openPage() { - /// navigator.push(new MaterialPageRoute(builder: (BuildContext context) => new MyPage())); + /// navigator.push(MaterialPageRoute(builder: (BuildContext context) => MyPage())); /// } /// ``` @optionalTypeArgs @@ -1562,7 +1562,7 @@ class NavigatorState extends State with TickerProviderStateMixin { /// ```dart /// void _doOpenPage() { /// navigator.pushReplacement( - /// new MaterialPageRoute(builder: (BuildContext context) => new MyHomePage())); + /// MaterialPageRoute(builder: (BuildContext context) => MyHomePage())); /// } /// ``` @optionalTypeArgs @@ -1613,7 +1613,7 @@ class NavigatorState extends State with TickerProviderStateMixin { /// ```dart /// void _resetAndOpenPage() { /// navigator.pushAndRemoveUntil( - /// new MaterialPageRoute(builder: (BuildContext context) => new MyHomePage()), + /// MaterialPageRoute(builder: (BuildContext context) => MyHomePage()), /// ModalRoute.withName('/'), /// ); /// } diff --git a/packages/flutter/lib/src/widgets/nested_scroll_view.dart b/packages/flutter/lib/src/widgets/nested_scroll_view.dart index 3d93c16cbe..3f373bbd97 100644 --- a/packages/flutter/lib/src/widgets/nested_scroll_view.dart +++ b/packages/flutter/lib/src/widgets/nested_scroll_view.dart @@ -75,13 +75,13 @@ typedef List NestedScrollViewHeaderSliversBuilder(BuildContext context, /// data model being represented. /// /// ```dart -/// new DefaultTabController( +/// DefaultTabController( /// length: _tabs.length, // This is the number of tabs. -/// child: new NestedScrollView( +/// child: NestedScrollView( /// headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { /// // These are the slivers that show up in the "outer" scroll view. /// return [ -/// new SliverOverlapAbsorber( +/// SliverOverlapAbsorber( /// // This widget takes the overlapping behavior of the SliverAppBar, /// // and redirects it to the SliverOverlapInjector below. If it is /// // missing, then it is possible for the nested "inner" scroll view @@ -90,7 +90,7 @@ typedef List NestedScrollViewHeaderSliversBuilder(BuildContext context, /// // This is not necessary if the "headerSliverBuilder" only builds /// // widgets that do not overlap the next sliver. /// handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), -/// child: new SliverAppBar( +/// child: SliverAppBar( /// title: const Text('Books'), // This is the title in the app bar. /// pinned: true, /// expandedHeight: 150.0, @@ -103,26 +103,26 @@ typedef List NestedScrollViewHeaderSliversBuilder(BuildContext context, /// // not actually aware of the precise position of the inner /// // scroll views. /// forceElevated: innerBoxIsScrolled, -/// bottom: new TabBar( +/// bottom: TabBar( /// // These are the widgets to put in each tab in the tab bar. -/// tabs: _tabs.map((String name) => new Tab(text: name)).toList(), +/// tabs: _tabs.map((String name) => Tab(text: name)).toList(), /// ), /// ), /// ), /// ]; /// }, -/// body: new TabBarView( +/// body: TabBarView( /// // These are the contents of the tab views, below the tabs. /// children: _tabs.map((String name) { -/// return new SafeArea( +/// return SafeArea( /// top: false, /// bottom: false, -/// child: new Builder( +/// child: Builder( /// // This Builder is needed to provide a BuildContext that is "inside" /// // the NestedScrollView, so that sliverOverlapAbsorberHandleFor() can /// // find the NestedScrollView. /// builder: (BuildContext context) { -/// return new CustomScrollView( +/// return CustomScrollView( /// // The "controller" and "primary" members should be left /// // unset, so that the NestedScrollView can control this /// // inner scroll view. @@ -131,29 +131,29 @@ typedef List NestedScrollViewHeaderSliversBuilder(BuildContext context, /// // The PageStorageKey should be unique to this ScrollView; /// // it allows the list to remember its scroll position when /// // the tab view is not on the screen. -/// key: new PageStorageKey(name), +/// key: PageStorageKey(name), /// slivers: [ -/// new SliverOverlapInjector( +/// SliverOverlapInjector( /// // This is the flip side of the SliverOverlapAbsorber above. /// handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), /// ), -/// new SliverPadding( +/// SliverPadding( /// padding: const EdgeInsets.all(8.0), /// // In this example, the inner scroll view has /// // fixed-height list items, hence the use of /// // SliverFixedExtentList. However, one could use any /// // sliver widget here, e.g. SliverList or SliverGrid. -/// sliver: new SliverFixedExtentList( +/// sliver: SliverFixedExtentList( /// // The items in this example are fixed to 48 pixels /// // high. This matches the Material Design spec for /// // ListTile widgets. /// itemExtent: 48.0, -/// delegate: new SliverChildBuilderDelegate( +/// delegate: SliverChildBuilderDelegate( /// (BuildContext context, int index) { /// // This builder is called for each child. /// // In this example, we just number each list item. -/// return new ListTile( -/// title: new Text('Item $index'), +/// return ListTile( +/// title: Text('Item $index'), /// ); /// }, /// // The childCount of the SliverChildBuilderDelegate diff --git a/packages/flutter/lib/src/widgets/page_storage.dart b/packages/flutter/lib/src/widgets/page_storage.dart index 66058a6da8..ca5f331231 100644 --- a/packages/flutter/lib/src/widgets/page_storage.dart +++ b/packages/flutter/lib/src/widgets/page_storage.dart @@ -22,10 +22,10 @@ import 'framework.dart'; /// tabs' string labels. /// /// ```dart -/// new TabBarView( +/// TabBarView( /// children: myTabs.map((Tab tab) { -/// new MyScrollableTabView( -/// key: new PageStorageKey(tab.text), // like 'Tab 1' +/// MyScrollableTabView( +/// key: PageStorageKey(tab.text), // like 'Tab 1' /// tab: tab, /// ), /// }), diff --git a/packages/flutter/lib/src/widgets/platform_view.dart b/packages/flutter/lib/src/widgets/platform_view.dart index d52e53949b..800e880105 100644 --- a/packages/flutter/lib/src/widgets/platform_view.dart +++ b/packages/flutter/lib/src/widgets/platform_view.dart @@ -37,7 +37,7 @@ import 'framework.dart'; /// /// ```java /// public static void registerWith(Registrar registrar) { -/// registrar.platformViewRegistry().registerViewFactory("webview", new WebViewFactory(registrar.messenger())); +/// registrar.platformViewRegistry().registerViewFactory("webview", WebViewFactory(registrar.messenger())); /// } /// ``` /// diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart index ced0c30dab..cbfb8154ff 100644 --- a/packages/flutter/lib/src/widgets/routes.dart +++ b/packages/flutter/lib/src/widgets/routes.dart @@ -341,11 +341,11 @@ abstract class LocalHistoryRoute extends Route { /// class App extends StatelessWidget { /// @override /// Widget build(BuildContext context) { - /// return new MaterialApp( + /// return MaterialApp( /// initialRoute: '/', /// routes: { - /// '/': (BuildContext context) => new HomePage(), - /// '/second_page': (BuildContext context) => new SecondPage(), + /// '/': (BuildContext context) => HomePage(), + /// '/second_page': (BuildContext context) => SecondPage(), /// }, /// ); /// } @@ -355,21 +355,21 @@ abstract class LocalHistoryRoute extends Route { /// HomePage(); /// /// @override - /// _HomePageState createState() => new _HomePageState(); + /// _HomePageState createState() => _HomePageState(); /// } /// /// class _HomePageState extends State { /// @override /// Widget build(BuildContext context) { - /// return new Scaffold( - /// body: new Center( + /// return Scaffold( + /// body: Center( /// child: Column( /// mainAxisSize: MainAxisSize.min, /// children: [ - /// new Text('HomePage'), + /// Text('HomePage'), /// // Press this button to open the SecondPage. - /// new RaisedButton( - /// child: new Text('Second Page >'), + /// RaisedButton( + /// child: Text('Second Page >'), /// onPressed: () { /// Navigator.pushNamed(context, '/second_page'); /// }, @@ -383,7 +383,7 @@ abstract class LocalHistoryRoute extends Route { /// /// class SecondPage extends StatefulWidget { /// @override - /// _SecondPageState createState() => new _SecondPageState(); + /// _SecondPageState createState() => _SecondPageState(); /// } /// /// class _SecondPageState extends State { @@ -396,7 +396,7 @@ abstract class LocalHistoryRoute extends Route { /// // rectangle. /// setState(() => _showRectangle = true); /// ModalRoute.of(context).addLocalHistoryEntry( - /// new LocalHistoryEntry( + /// LocalHistoryEntry( /// onRemove: () { /// // Hide the red rectangle. /// setState(() => _showRectangle = false); @@ -408,24 +408,24 @@ abstract class LocalHistoryRoute extends Route { /// @override /// Widget build(BuildContext context) { /// final localNavContent = _showRectangle - /// ? new Container( + /// ? Container( /// width: 100.0, /// height: 100.0, /// color: Colors.red, /// ) - /// : new RaisedButton( - /// child: new Text('Show Rectangle'), + /// : RaisedButton( + /// child: Text('Show Rectangle'), /// onPressed: _navigateLocallyToShowRectangle, /// ); /// - /// return new Scaffold( + /// return Scaffold( /// body: Center( - /// child: new Column( + /// child: Column( /// mainAxisAlignment: MainAxisAlignment.center, /// children: [ /// localNavContent, - /// new RaisedButton( - /// child: new Text('< Back'), + /// RaisedButton( + /// child: Text('< Back'), /// onPressed: () { /// // Pop a route. If this is pressed while the red rectangle is /// // visible then it will will pop our local history entry, which @@ -751,16 +751,16 @@ abstract class ModalRoute extends TransitionRoute with LocalHistoryRoute animation, /// Animation secondaryAnimation, /// Widget child, /// ) { - /// return new Scaffold( - /// appBar: new AppBar(title: new Text('Hello')), - /// body: new Center( - /// child: new Text('Hello World'), + /// return Scaffold( + /// appBar: AppBar(title: Text('Hello')), + /// body: Center( + /// child: Text('Hello World'), /// ), /// ); /// }, @@ -770,8 +770,8 @@ abstract class ModalRoute extends TransitionRoute with LocalHistoryRoute secondaryAnimation, /// Widget child, /// ) { - /// return new SlideTransition( - /// position: new Tween( + /// return SlideTransition( + /// position: Tween( /// begin: const Offset(0.0, 1.0), /// end: Offset.zero, /// ).animate(animation), @@ -807,13 +807,13 @@ abstract class ModalRoute extends TransitionRoute with LocalHistoryRoute secondaryAnimation, /// Widget child, /// ) { - /// return new SlideTransition( - /// position: new AlignmentTween( + /// return SlideTransition( + /// position: AlignmentTween( /// begin: const Offset(0.0, 1.0), /// end: Offset.zero, /// ).animate(animation), - /// child: new SlideTransition( - /// position: new TweenOffset( + /// child: SlideTransition( + /// position: TweenOffset( /// begin: Offset.zero, /// end: const Offset(0.0, 1.0), /// ).animate(secondaryAnimation), @@ -1049,7 +1049,7 @@ abstract class ModalRoute extends TransitionRoute with LocalHistoryRoute extends ModalRoute { /// /// ```dart /// // Register the RouteObserver as a navigation observer. -/// final RouteObserver routeObserver = new RouteObserver(); +/// final RouteObserver routeObserver = RouteObserver(); /// void main() { -/// runApp(new MaterialApp( -/// home: new Container(), +/// runApp(MaterialApp( +/// home: Container(), /// navigatorObservers: [routeObserver], /// )); /// } /// /// class RouteAwareWidget extends StatefulWidget { -/// State createState() => new RouteAwareWidgetState(); +/// State createState() => RouteAwareWidgetState(); /// } /// /// // Implement RouteAware in a widget's state and subscribe it to the RouteObserver. @@ -1309,7 +1309,7 @@ abstract class PopupRoute extends ModalRoute { /// } /// /// @override -/// Widget build(BuildContext context) => new Container(); +/// Widget build(BuildContext context) => Container(); /// /// } /// ``` diff --git a/packages/flutter/lib/src/widgets/scroll_controller.dart b/packages/flutter/lib/src/widgets/scroll_controller.dart index d87ab68f0e..a20aa600d7 100644 --- a/packages/flutter/lib/src/widgets/scroll_controller.dart +++ b/packages/flutter/lib/src/widgets/scroll_controller.dart @@ -291,19 +291,19 @@ class ScrollController extends ChangeNotifier { /// the different list lengths. /// /// ```dart -/// new PageView( +/// PageView( /// children: [ -/// new ListView( +/// ListView( /// controller: _trackingScrollController, -/// children: new List.generate(100, (int i) => new Text('page 0 item $i')).toList(), +/// children: List.generate(100, (int i) => Text('page 0 item $i')).toList(), /// ), -/// new ListView( +/// ListView( /// controller: _trackingScrollController, -/// children: new List.generate(200, (int i) => new Text('page 1 item $i')).toList(), +/// children: List.generate(200, (int i) => Text('page 1 item $i')).toList(), /// ), -/// new ListView( +/// ListView( /// controller: _trackingScrollController, -/// children: new List.generate(300, (int i) => new Text('page 2 item $i')).toList(), +/// children: List.generate(300, (int i) => Text('page 2 item $i')).toList(), /// ), /// ], /// ) diff --git a/packages/flutter/lib/src/widgets/scroll_physics.dart b/packages/flutter/lib/src/widgets/scroll_physics.dart index d009205f50..8ba89fc012 100644 --- a/packages/flutter/lib/src/widgets/scroll_physics.dart +++ b/packages/flutter/lib/src/widgets/scroll_physics.dart @@ -43,7 +43,7 @@ class ScrollPhysics { /// This method is typically used to define [applyTo] methods like: /// ```dart /// FooScrollPhysics applyTo(ScrollPhysics ancestor) { - /// return new FooScrollPhysics(parent: buildParent(ancestor)); + /// return FooScrollPhysics(parent: buildParent(ancestor)); /// } /// ``` @protected diff --git a/packages/flutter/lib/src/widgets/scroll_view.dart b/packages/flutter/lib/src/widgets/scroll_view.dart index 3d6075850b..f73af56dec 100644 --- a/packages/flutter/lib/src/widgets/scroll_view.dart +++ b/packages/flutter/lib/src/widgets/scroll_view.dart @@ -274,7 +274,7 @@ abstract class ScrollView extends StatelessWidget { /// bar, a grid, and an infinite list. /// /// ```dart -/// new CustomScrollView( +/// CustomScrollView( /// slivers: [ /// const SliverAppBar( /// pinned: true, @@ -283,32 +283,32 @@ abstract class ScrollView extends StatelessWidget { /// title: Text('Demo'), /// ), /// ), -/// new SliverGrid( -/// gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent( +/// SliverGrid( +/// gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( /// maxCrossAxisExtent: 200.0, /// mainAxisSpacing: 10.0, /// crossAxisSpacing: 10.0, /// childAspectRatio: 4.0, /// ), -/// delegate: new SliverChildBuilderDelegate( +/// delegate: SliverChildBuilderDelegate( /// (BuildContext context, int index) { -/// return new Container( +/// return Container( /// alignment: Alignment.center, /// color: Colors.teal[100 * (index % 9)], -/// child: new Text('grid item $index'), +/// child: Text('grid item $index'), /// ); /// }, /// childCount: 20, /// ), /// ), -/// new SliverFixedExtentList( +/// SliverFixedExtentList( /// itemExtent: 50.0, -/// delegate: new SliverChildBuilderDelegate( +/// delegate: SliverChildBuilderDelegate( /// (BuildContext context, int index) { -/// return new Container( +/// return Container( /// alignment: Alignment.center, /// color: Colors.lightBlue[100 * (index % 9)], -/// child: new Text('list item $index'), +/// child: Text('list item $index'), /// ); /// }, /// ), @@ -488,11 +488,11 @@ abstract class BoxScrollView extends ScrollView { /// An infinite list of children: /// /// ```dart -/// new ListView.builder( -/// padding: new EdgeInsets.all(8.0), +/// ListView.builder( +/// padding: EdgeInsets.all(8.0), /// itemExtent: 20.0, /// itemBuilder: (BuildContext context, int index) { -/// return new Text('entry $index'); +/// return Text('entry $index'); /// }, /// ) /// ``` @@ -598,7 +598,7 @@ abstract class BoxScrollView extends ScrollView { /// [CustomScrollView]: /// /// ```dart -/// new ListView( +/// ListView( /// shrinkWrap: true, /// padding: const EdgeInsets.all(20.0), /// children: [ @@ -611,13 +611,13 @@ abstract class BoxScrollView extends ScrollView { /// ``` /// /// ```dart -/// new CustomScrollView( +/// CustomScrollView( /// shrinkWrap: true, /// slivers: [ -/// new SliverPadding( +/// SliverPadding( /// padding: const EdgeInsets.all(20.0), -/// sliver: new SliverList( -/// delegate: new SliverChildListDelegate( +/// sliver: SliverList( +/// delegate: SliverChildListDelegate( /// [ /// const Text('I\'m dedicating every day to you'), /// const Text('Domestic life was never quite my style'), @@ -774,12 +774,12 @@ class ListView extends BoxScrollView { /// are separated by [Divider]s. /// /// ```dart - /// new ListView.separated( + /// ListView.separated( /// itemCount: 25, - /// separatorBuilder: (BuildContext context, int index) => new Divider(), + /// separatorBuilder: (BuildContext context, int index) => Divider(), /// itemBuilder: (BuildContext context, int index) { - /// return new ListTile( - /// title: new Text('item $index'), + /// return ListTile( + /// title: Text('item $index'), /// ); /// }, /// ) @@ -970,7 +970,7 @@ class ListView extends BoxScrollView { /// [CustomScrollView]: /// /// ```dart -/// new GridView.count( +/// GridView.count( /// primary: false, /// padding: const EdgeInsets.all(20.0), /// crossAxisSpacing: 10.0, @@ -987,12 +987,12 @@ class ListView extends BoxScrollView { /// ``` /// /// ```dart -/// new CustomScrollView( +/// CustomScrollView( /// primary: false, /// slivers: [ -/// new SliverPadding( +/// SliverPadding( /// padding: const EdgeInsets.all(20.0), -/// sliver: new SliverGrid.count( +/// sliver: SliverGrid.count( /// crossAxisSpacing: 10.0, /// crossAxisCount: 2, /// children: [ diff --git a/packages/flutter/lib/src/widgets/single_child_scroll_view.dart b/packages/flutter/lib/src/widgets/single_child_scroll_view.dart index 4e64d34a81..f7f614a96c 100644 --- a/packages/flutter/lib/src/widgets/single_child_scroll_view.dart +++ b/packages/flutter/lib/src/widgets/single_child_scroll_view.dart @@ -83,23 +83,23 @@ import 'scrollable.dart'; /// more room, in which case they stack vertically and scroll. /// /// ```dart -/// new LayoutBuilder( +/// LayoutBuilder( /// builder: (BuildContext context, BoxConstraints viewportConstraints) { /// return SingleChildScrollView( -/// child: new ConstrainedBox( -/// constraints: new BoxConstraints( +/// child: ConstrainedBox( +/// constraints: BoxConstraints( /// minHeight: viewportConstraints.maxHeight, /// ), -/// child: new Column( +/// child: Column( /// mainAxisSize: MainAxisSize.min, /// mainAxisAlignment: MainAxisAlignment.spaceAround, /// children: [ -/// new Container( +/// Container( /// // A fixed-height child. /// color: Colors.yellow, /// height: 120.0, /// ), -/// new Container( +/// Container( /// // Another fixed-height child. /// color: Colors.green, /// height: 120.0, @@ -135,25 +135,25 @@ import 'scrollable.dart'; /// in an [Expanded] widget. /// /// ```dart -/// new LayoutBuilder( +/// LayoutBuilder( /// builder: (BuildContext context, BoxConstraints viewportConstraints) { /// return SingleChildScrollView( -/// child: new ConstrainedBox( -/// constraints: new BoxConstraints( +/// child: ConstrainedBox( +/// constraints: BoxConstraints( /// minHeight: viewportConstraints.maxHeight, /// ), -/// child: new IntrinsicHeight( -/// child: new Column( +/// child: IntrinsicHeight( +/// child: Column( /// children: [ -/// new Container( +/// Container( /// // A fixed-height child. /// color: Colors.yellow, /// height: 120.0, /// ), -/// new Expanded( +/// Expanded( /// // A flexible child that will grow to fit the viewport but /// // still be at least as big as necessary to fit its contents. -/// child: new Container( +/// child: Container( /// color: Colors.blue, /// height: 120.0, /// ), diff --git a/packages/flutter/lib/src/widgets/sliver.dart b/packages/flutter/lib/src/widgets/sliver.dart index 95bc33fad4..ae5a61be65 100644 --- a/packages/flutter/lib/src/widgets/sliver.dart +++ b/packages/flutter/lib/src/widgets/sliver.dart @@ -486,14 +486,14 @@ class SliverList extends SliverMultiBoxAdaptorWidget { /// list, shows an infinite number of items in varying shades of blue: /// /// ```dart -/// new SliverFixedExtentList( +/// SliverFixedExtentList( /// itemExtent: 50.0, -/// delegate: new SliverChildBuilderDelegate( +/// delegate: SliverChildBuilderDelegate( /// (BuildContext context, int index) { -/// return new Container( +/// return Container( /// alignment: Alignment.center, /// color: Colors.lightBlue[100 * (index % 9)], -/// child: new Text('list item $index'), +/// child: Text('list item $index'), /// ); /// }, /// ), @@ -550,19 +550,19 @@ class SliverFixedExtentList extends SliverMultiBoxAdaptorWidget { /// list, shows twenty boxes in a pretty teal grid: /// /// ```dart -/// new SliverGrid( -/// gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent( +/// SliverGrid( +/// gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( /// maxCrossAxisExtent: 200.0, /// mainAxisSpacing: 10.0, /// crossAxisSpacing: 10.0, /// childAspectRatio: 4.0, /// ), -/// delegate: new SliverChildBuilderDelegate( +/// delegate: SliverChildBuilderDelegate( /// (BuildContext context, int index) { -/// return new Container( +/// return Container( /// alignment: Alignment.center, /// color: Colors.teal[100 * (index % 9)], -/// child: new Text('grid item $index'), +/// child: Text('grid item $index'), /// ); /// }, /// childCount: 20, diff --git a/packages/flutter/lib/src/widgets/spacer.dart b/packages/flutter/lib/src/widgets/spacer.dart index 7a4de128af..6c64009bd0 100644 --- a/packages/flutter/lib/src/widgets/spacer.dart +++ b/packages/flutter/lib/src/widgets/spacer.dart @@ -20,14 +20,14 @@ import 'framework.dart'; /// ## Sample code /// /// ```dart -/// new Row( +/// Row( /// children: [ -/// new Text('Begin'), -/// new Spacer(), // Defaults to a flex of one. -/// new Text('Middle'), +/// Text('Begin'), +/// Spacer(), // Defaults to a flex of one. +/// Text('Middle'), /// // Gives twice the space between Middle and End than Begin and Middle. -/// new Spacer(flex: 2), -/// new Text('End'), +/// Spacer(flex: 2), +/// Text('End'), /// ], /// ) /// ``` diff --git a/packages/flutter/lib/src/widgets/text.dart b/packages/flutter/lib/src/widgets/text.dart index 0a225904f0..77632fb20d 100644 --- a/packages/flutter/lib/src/widgets/text.dart +++ b/packages/flutter/lib/src/widgets/text.dart @@ -167,11 +167,11 @@ class DefaultTextStyle extends InheritedWidget { /// ## Sample code /// /// ```dart -/// new Text( +/// Text( /// 'Hello, $_name! How are you?', /// textAlign: TextAlign.center, /// overflow: TextOverflow.ellipsis, -/// style: new TextStyle(fontWeight: FontWeight.bold), +/// style: TextStyle(fontWeight: FontWeight.bold), /// ) /// ``` /// @@ -331,7 +331,7 @@ class Text extends StatelessWidget { /// text value: /// /// ```dart - /// new Text(r'$$', semanticsLabel: 'Double dollars') + /// Text(r'$$', semanticsLabel: 'Double dollars') /// /// ``` final String semanticsLabel; diff --git a/packages/flutter/lib/src/widgets/transitions.dart b/packages/flutter/lib/src/widgets/transitions.dart index 66f5947040..8b0bd7e3ae 100644 --- a/packages/flutter/lib/src/widgets/transitions.dart +++ b/packages/flutter/lib/src/widgets/transitions.dart @@ -761,7 +761,7 @@ class DefaultTextStyleTransition extends AnimatedWidget { /// ```dart /// class Spinner extends StatefulWidget { /// @override -/// _SpinnerState createState() => new _SpinnerState(); +/// _SpinnerState createState() => _SpinnerState(); /// } /// /// class _SpinnerState extends State with SingleTickerProviderStateMixin { @@ -770,7 +770,7 @@ class DefaultTextStyleTransition extends AnimatedWidget { /// @override /// void initState() { /// super.initState(); -/// _controller = new AnimationController( +/// _controller = AnimationController( /// duration: const Duration(seconds: 10), /// vsync: this, /// )..repeat(); @@ -784,11 +784,11 @@ class DefaultTextStyleTransition extends AnimatedWidget { /// /// @override /// Widget build(BuildContext context) { -/// return new AnimatedBuilder( +/// return AnimatedBuilder( /// animation: _controller, -/// child: new Container(width: 200.0, height: 200.0, color: Colors.green), +/// child: Container(width: 200.0, height: 200.0, color: Colors.green), /// builder: (BuildContext context, Widget child) { -/// return new Transform.rotate( +/// return Transform.rotate( /// angle: _controller.value * 2.0 * math.pi, /// child: child, /// ); diff --git a/packages/flutter/test/rendering/recording_canvas.dart b/packages/flutter/test/rendering/recording_canvas.dart index edc0eee5bf..0e04296ad7 100644 --- a/packages/flutter/test/rendering/recording_canvas.dart +++ b/packages/flutter/test/rendering/recording_canvas.dart @@ -43,8 +43,8 @@ class RecordedInvocation { /// /// ```dart /// RenderBox box = tester.renderObject(find.text('ABC')); -/// TestRecordingCanvas canvas = new TestRecordingCanvas(); -/// TestRecordingPaintingContext context = new TestRecordingPaintingContext(canvas); +/// TestRecordingCanvas canvas = TestRecordingCanvas(); +/// TestRecordingPaintingContext context = TestRecordingPaintingContext(canvas); /// box.paint(context, Offset.zero); /// // Now test the expected canvas.invocations. /// ``` diff --git a/packages/flutter/test/widgets/semantics_tester.dart b/packages/flutter/test/widgets/semantics_tester.dart index 84af7eb2d3..1fa0fb8c09 100644 --- a/packages/flutter/test/widgets/semantics_tester.dart +++ b/packages/flutter/test/widgets/semantics_tester.dart @@ -451,8 +451,8 @@ class SemanticsTester { /// /// ```dart /// testWidgets('generate code for MyWidget', (WidgetTester tester) async { - /// var semantics = new SemanticsTester(tester); - /// await tester.pumpWidget(new MyWidget()); + /// var semantics = SemanticsTester(tester); + /// await tester.pumpWidget(MyWidget()); /// print(semantics.generateTestSemanticsExpressionForCurrentSemanticsTree()); /// semantics.dispose(); /// }); @@ -462,11 +462,11 @@ class SemanticsTester { /// /// ```dart /// testWidgets('generate code for MyWidget', (WidgetTester tester) async { - /// var semantics = new SemanticsTester(tester); - /// await tester.pumpWidget(new MyWidget()); + /// var semantics = SemanticsTester(tester); + /// await tester.pumpWidget(MyWidget()); /// expect(semantics, hasSemantics( /// // Generated code: - /// new TestSemantics( + /// TestSemantics( /// ... properties and child nodes ... /// ), /// ignoreRect: true,