diff --git a/packages/flutter/lib/src/material/about.dart b/packages/flutter/lib/src/material/about.dart index e64b1a9986..86f1212131 100644 --- a/packages/flutter/lib/src/material/about.dart +++ b/packages/flutter/lib/src/material/about.dart @@ -265,10 +265,10 @@ class AboutDialog extends StatelessWidget { final Widget icon = applicationIcon ?? _defaultApplicationIcon(context); List body = []; if (icon != null) - body.add(new IconTheme(data: new IconThemeData(size: 48.0), child: icon)); + body.add(new IconTheme(data: const IconThemeData(size: 48.0), child: icon)); body.add(new Expanded( child: new Padding( - padding: new EdgeInsets.symmetric(horizontal: 24.0), + padding: const EdgeInsets.symmetric(horizontal: 24.0), child: new BlockBody( children: [ new Text(name, style: Theme.of(context).textTheme.headline), @@ -381,15 +381,15 @@ class _LicensePageState extends State { await for (LicenseEntry license in LicenseRegistry.licenses) { setState(() { _licenses.add(new Padding( - padding: new EdgeInsets.symmetric(vertical: 18.0), + padding: const EdgeInsets.symmetric(vertical: 18.0), child: new Text( '🍀‬', // That's U+1F340. Could also use U+2766 (❦) if U+1F340 doesn't work everywhere. textAlign: TextAlign.center ) )); _licenses.add(new Container( - decoration: new BoxDecoration( - border: new Border(bottom: new BorderSide(width: 0.0)) + decoration: const BoxDecoration( + border: const Border(bottom: const BorderSide(width: 0.0)) ), child: new Text( license.packages.join(', '), @@ -400,7 +400,7 @@ class _LicensePageState extends State { for (LicenseParagraph paragraph in license.paragraphs) { if (paragraph.indent == LicenseParagraph.centeredIndent) { _licenses.add(new Padding( - padding: new EdgeInsets.only(top: 16.0), + padding: const EdgeInsets.only(top: 16.0), child: new Text( paragraph.text, style: new TextStyle(fontWeight: FontWeight.bold), @@ -438,7 +438,7 @@ class _LicensePageState extends State { contents.addAll(_licenses); if (!_loaded) { contents.add(new Padding( - padding: new EdgeInsets.symmetric(vertical: 24.0), + padding: const EdgeInsets.symmetric(vertical: 24.0), child: new Center( child: new CircularProgressIndicator() ) @@ -452,7 +452,7 @@ class _LicensePageState extends State { style: Theme.of(context).textTheme.caption, child: new Scrollbar( child: new LazyBlock( - padding: new EdgeInsets.symmetric(horizontal: 8.0, vertical: 12.0), + padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 12.0), delegate: new LazyBlockChildren( children: contents ) diff --git a/packages/flutter/lib/src/material/data_table.dart b/packages/flutter/lib/src/material/data_table.dart index cfb87139d1..bdd5b87160 100644 --- a/packages/flutter/lib/src/material/data_table.dart +++ b/packages/flutter/lib/src/material/data_table.dart @@ -397,7 +397,7 @@ class DataTable extends StatelessWidget { down: sorted ? ascending : null, duration: _kSortArrowAnimationDuration ); - final Widget arrowPadding = new SizedBox(width: _kSortArrowPadding); + final Widget arrowPadding = const SizedBox(width: _kSortArrowPadding); label = new Row( children: numeric ? [ arrow, arrowPadding, label ] : [ label, arrowPadding, arrow ] diff --git a/packages/flutter/lib/src/material/dialog.dart b/packages/flutter/lib/src/material/dialog.dart index 4b176589c7..b71453006d 100644 --- a/packages/flutter/lib/src/material/dialog.dart +++ b/packages/flutter/lib/src/material/dialog.dart @@ -52,9 +52,9 @@ class Dialog extends StatelessWidget { Widget build(BuildContext context) { return new Center( child: new Container( - margin: new EdgeInsets.symmetric(horizontal: 40.0, vertical: 24.0), + margin: const EdgeInsets.symmetric(horizontal: 40.0, vertical: 24.0), child: new ConstrainedBox( - constraints: new BoxConstraints(minWidth: 280.0), + constraints: const BoxConstraints(minWidth: 280.0), child: new Material( elevation: 24, color: _getColor(context), diff --git a/packages/flutter/lib/src/material/expansion_panel.dart b/packages/flutter/lib/src/material/expansion_panel.dart index 48dd0ec917..8970aa514b 100644 --- a/packages/flutter/lib/src/material/expansion_panel.dart +++ b/packages/flutter/lib/src/material/expansion_panel.dart @@ -154,8 +154,8 @@ class ExpansionPanelList extends StatelessWidget { new AnimatedCrossFade( firstChild: new Container(height: 0.0), secondChild: children[i].body, - firstCurve: new Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), - secondCurve: new Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), + firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), + secondCurve: const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), sizeCurve: Curves.fastOutSlowIn, crossFadeState: _isChildExpanded(i) ? CrossFadeState.showSecond : CrossFadeState.showFirst, duration: animationDuration, diff --git a/packages/flutter/lib/src/material/paginated_data_table.dart b/packages/flutter/lib/src/material/paginated_data_table.dart index 81baf0e931..b86573fd4b 100644 --- a/packages/flutter/lib/src/material/paginated_data_table.dart +++ b/packages/flutter/lib/src/material/paginated_data_table.dart @@ -294,7 +294,7 @@ class PaginatedDataTableState extends State { config.actions.map/**/((Widget widget) { return new Padding( // 8.0 is the default padding of an icon button - padding: new EdgeInsets.only(left: 24.0 - 8.0 * 2.0), + padding: const EdgeInsets.only(left: 24.0 - 8.0 * 2.0), child: widget ); }).toList() @@ -363,7 +363,7 @@ class PaginatedDataTableState extends State { : themeData.textTheme.title.copyWith(fontWeight: FontWeight.w400), child: new IconTheme.merge( context: context, - data: new IconThemeData( + data: const IconThemeData( opacity: 0.54 ), child: new ButtonTheme.bar( @@ -399,7 +399,7 @@ class PaginatedDataTableState extends State { style: footerTextStyle, child: new IconTheme.merge( context: context, - data: new IconThemeData( + data: const IconThemeData( opacity: 0.54 ), child: new Container( diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart index 2354f08f45..efefd4b718 100644 --- a/packages/flutter/lib/src/material/popup_menu.dart +++ b/packages/flutter/lib/src/material/popup_menu.dart @@ -285,12 +285,12 @@ class _PopupMenu extends StatelessWidget { )); } - final CurveTween opacity = new CurveTween(curve: new Interval(0.0, 1.0 / 3.0)); + final CurveTween opacity = new CurveTween(curve: const Interval(0.0, 1.0 / 3.0)); final CurveTween width = new CurveTween(curve: new Interval(0.0, unit)); final CurveTween height = new CurveTween(curve: new Interval(0.0, unit * route.items.length)); Widget child = new ConstrainedBox( - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: _kMenuMinWidth, maxWidth: _kMenuMaxWidth ), @@ -388,7 +388,7 @@ class _PopupMenuRoute extends PopupRoute { return new CurvedAnimation( parent: super.createAnimation(), curve: Curves.linear, - reverseCurve: new Interval(0.0, _kMenuCloseIntervalEnd) + reverseCurve: const Interval(0.0, _kMenuCloseIntervalEnd) ); } diff --git a/packages/flutter/lib/src/material/progress_indicator.dart b/packages/flutter/lib/src/material/progress_indicator.dart index c63e0eb946..ae0fb22570 100644 --- a/packages/flutter/lib/src/material/progress_indicator.dart +++ b/packages/flutter/lib/src/material/progress_indicator.dart @@ -168,7 +168,7 @@ class _LinearProgressIndicatorState extends State with Widget _buildIndicator(BuildContext context, double animationValue) { return new Container( - constraints: new BoxConstraints.tightFor( + constraints: const BoxConstraints.tightFor( width: double.INFINITY, height: _kLinearProgressIndicatorHeight ), @@ -296,20 +296,20 @@ class CircularProgressIndicator extends ProgressIndicator { // Tweens used by circular progress indicator final Animatable _kStrokeHeadTween = new CurveTween( - curve: new Interval(0.0, 0.5, curve: Curves.fastOutSlowIn) + curve: const Interval(0.0, 0.5, curve: Curves.fastOutSlowIn) ).chain(new CurveTween( - curve: new SawTooth(5) + curve: const SawTooth(5) )); final Animatable _kStrokeTailTween = new CurveTween( - curve: new Interval(0.5, 1.0, curve: Curves.fastOutSlowIn) + curve: const Interval(0.5, 1.0, curve: Curves.fastOutSlowIn) ).chain(new CurveTween( - curve: new SawTooth(5) + curve: const SawTooth(5) )); final Animatable _kStepTween = new StepTween(begin: 0, end: 5); -final Animatable _kRotationTween = new CurveTween(curve: new SawTooth(5)); +final Animatable _kRotationTween = new CurveTween(curve: const SawTooth(5)); class _CircularProgressIndicatorState extends State with SingleTickerProviderStateMixin { AnimationController _controller; @@ -331,7 +331,7 @@ class _CircularProgressIndicatorState extends State w Widget _buildIndicator(BuildContext context, double headValue, double tailValue, int stepValue, double rotationValue) { return new Container( - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: _kMinCircularProgressIndicatorSize, minHeight: _kMinCircularProgressIndicatorSize, ), diff --git a/packages/flutter/lib/src/material/refresh_indicator.dart b/packages/flutter/lib/src/material/refresh_indicator.dart index ad84d71a82..03ddd2417f 100644 --- a/packages/flutter/lib/src/material/refresh_indicator.dart +++ b/packages/flutter/lib/src/material/refresh_indicator.dart @@ -357,7 +357,7 @@ class RefreshIndicatorState extends State with TickerProviderS ) .animate(new CurvedAnimation( parent: _sizeController, - curve: new Interval(0.0, 1.0 / _kDragSizeFactorLimit) + curve: const Interval(0.0, 1.0 / _kDragSizeFactorLimit) )); return new Listener( diff --git a/packages/flutter/lib/src/material/stepper.dart b/packages/flutter/lib/src/material/stepper.dart index f968b7dafd..3bd0911a9e 100644 --- a/packages/flutter/lib/src/material/stepper.dart +++ b/packages/flutter/lib/src/material/stepper.dart @@ -310,8 +310,8 @@ class _StepperState extends State with TickerProviderStateMixin { return new AnimatedCrossFade( firstChild: _buildCircle(index, true), secondChild: _buildTriangle(index, true), - firstCurve: new Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), - secondCurve: new Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), + firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), + secondCurve: const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), sizeCurve: Curves.fastOutSlowIn, crossFadeState: config.steps[index].state == StepState.error ? CrossFadeState.showSecond : CrossFadeState.showFirst, duration: kThemeAnimationDuration, @@ -503,8 +503,8 @@ class _StepperState extends State with TickerProviderStateMixin { ] ) ), - firstCurve: new Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), - secondCurve: new Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), + firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn), + secondCurve: const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn), sizeCurve: Curves.fastOutSlowIn, crossFadeState: _isCurrent(index) ? CrossFadeState.showSecond : CrossFadeState.showFirst, duration: kThemeAnimationDuration, diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index f1b077d8cb..1a894c1715 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -402,7 +402,7 @@ class _Tab extends StatelessWidget { Container centeredLabel = new Container( child: new Center(child: labelContent, widthFactor: 1.0, heightFactor: 1.0), - constraints: new BoxConstraints(minWidth: _kMinTabWidth), + constraints: const BoxConstraints(minWidth: _kMinTabWidth), padding: _kTabLabelPadding ); @@ -512,7 +512,7 @@ class TabBarSelection extends StatefulWidget { /// TabBarSelectionState tabState = TabBarSelection.of/**/(context); /// ``` static TabBarSelectionState of/**/(BuildContext context) { - return context.ancestorStateOfType(new TypeMatcher>()); + return context.ancestorStateOfType(const TypeMatcher>()); } @override @@ -1302,7 +1302,7 @@ class TabPageSelector extends StatelessWidget { return new Container( width: 12.0, height: 12.0, - margin: new EdgeInsets.all(4.0), + margin: const EdgeInsets.all(4.0), decoration: new BoxDecoration( backgroundColor: background, border: new Border.all(color: selectedColor.end), diff --git a/packages/flutter/lib/src/painting/flutter_logo.dart b/packages/flutter/lib/src/painting/flutter_logo.dart index 25330457a7..2d5c3e1155 100644 --- a/packages/flutter/lib/src/painting/flutter_logo.dart +++ b/packages/flutter/lib/src/painting/flutter_logo.dart @@ -258,7 +258,7 @@ class _FlutterLogoPainter extends BoxPainter { ) ); _textPainter.layout(); - final ui.TextBox textSize = _textPainter.getBoxesForSelection(new TextSelection(baseOffset: 0, extentOffset: kLabel.length)).single; + final ui.TextBox textSize = _textPainter.getBoxesForSelection(const TextSelection(baseOffset: 0, extentOffset: kLabel.length)).single; _textBoundingRect = new Rect.fromLTRB(textSize.left, textSize.top, textSize.right, textSize.bottom); } diff --git a/packages/flutter/lib/src/rendering/stack.dart b/packages/flutter/lib/src/rendering/stack.dart index ed6c1357f3..df5f5f6c5c 100644 --- a/packages/flutter/lib/src/rendering/stack.dart +++ b/packages/flutter/lib/src/rendering/stack.dart @@ -52,7 +52,7 @@ class RelativeRect { } /// A rect that covers the entire container. - static final RelativeRect fill = new RelativeRect.fromLTRB(0.0, 0.0, 0.0, 0.0); + static final RelativeRect fill = const RelativeRect.fromLTRB(0.0, 0.0, 0.0, 0.0); /// Distance from the left side of the container to the left side of this rectangle. final double left; diff --git a/packages/flutter/lib/src/widgets/placeholder.dart b/packages/flutter/lib/src/widgets/placeholder.dart index 27f511abb6..c75c20d7ad 100644 --- a/packages/flutter/lib/src/widgets/placeholder.dart +++ b/packages/flutter/lib/src/widgets/placeholder.dart @@ -35,6 +35,6 @@ class PlaceholderState extends State { Widget build(BuildContext context) { if (_child != null) return child; - return new SizedBox(width: 0.0, height: 0.0); + return const SizedBox(width: 0.0, height: 0.0); } }