enable lint prefer_equal_for_default_values (#18156)

This commit is contained in:
Alexandre Ardhuin
2018-06-05 08:50:40 +02:00
committed by GitHub
parent 6be81ebf9b
commit 09276bea25
390 changed files with 1920 additions and 1920 deletions

View File

@@ -157,7 +157,7 @@ class CardItem extends StatelessWidget {
@required this.animation,
this.onTap,
@required this.item,
this.selected: false
this.selected = false
}) : assert(animation != null),
assert(item != null && item >= 0),
assert(selected != null),

View File

@@ -213,7 +213,7 @@ class CustomTraversalExampleState extends State<CustomTraversalExample> {
);
}
Widget _makeSpinnerButton(int rowOrder, int columnOrder, Field field, {bool increment: true}) {
Widget _makeSpinnerButton(int rowOrder, int columnOrder, Field field, {bool increment = true}) {
return new SpinnerButton(
rowOrder: rowOrder,
columnOrder: columnOrder,

View File

@@ -92,12 +92,12 @@ void main() {
}
void expectAdjustable(SemanticsNode node, {
bool hasIncreaseAction: true,
bool hasDecreaseAction: true,
String label: '',
String decreasedValue: '',
String value: '',
String increasedValue: '',
bool hasIncreaseAction = true,
bool hasDecreaseAction = true,
String label = '',
String decreasedValue = '',
String value = '',
String increasedValue = '',
}) {
final SemanticsData semanticsData = node.getSemanticsData();

View File

@@ -77,7 +77,7 @@ class _StatusBarPaddingSliver extends SingleChildRenderObjectWidget {
const _StatusBarPaddingSliver({
Key key,
@required this.maxHeight,
this.scrollFactor: 5.0,
this.scrollFactor = 5.0,
}) : assert(maxHeight != null && maxHeight >= 0.0),
assert(scrollFactor != null && scrollFactor >= 1.0),
super(key: key);
@@ -265,7 +265,7 @@ class _AllSectionsView extends AnimatedWidget {
this.minHeight,
this.midHeight,
this.maxHeight,
this.sectionCards: const <Widget>[],
this.sectionCards = const <Widget>[],
}) : assert(sections != null),
assert(sectionCards != null),
assert(sectionCards.length == sections.length),

View File

@@ -99,7 +99,7 @@ class SectionTitle extends StatelessWidget {
// Small horizontal bar that indicates the selected section.
class SectionIndicator extends StatelessWidget {
const SectionIndicator({ Key key, this.opacity: 1.0 }) : super(key: key);
const SectionIndicator({ Key key, this.opacity = 1.0 }) : super(key: key);
final double opacity;

View File

@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
const double kColorItemHeight = 48.0;
class Palette {
Palette({ this.name, this.primary, this.accent, this.threshold: 900});
Palette({ this.name, this.primary, this.accent, this.threshold = 900});
final String name;
final MaterialColor primary;
@@ -45,7 +45,7 @@ class ColorItem extends StatelessWidget {
Key key,
@required this.index,
@required this.color,
this.prefix: '',
this.prefix = '',
}) : assert(index != null),
assert(color != null),
assert(prefix != null),

View File

@@ -402,7 +402,7 @@ class _DemoDrawer extends StatelessWidget {
class _DiamondFab extends StatefulWidget {
const _DiamondFab({
this.child,
this.notchMargin: 6.0,
this.notchMargin = 6.0,
this.onPressed,
});

View File

@@ -77,7 +77,7 @@ class DualHeaderWithHint extends StatelessWidget {
class CollapsibleBody extends StatelessWidget {
const CollapsibleBody({
this.margin: EdgeInsets.zero,
this.margin = EdgeInsets.zero,
this.child,
this.onSave,
this.onCancel

View File

@@ -21,7 +21,7 @@ class Photo {
this.assetPackage,
this.title,
this.caption,
this.isFavorite: false,
this.isFavorite = false,
});
final String assetName;

View File

@@ -13,7 +13,7 @@ class SliderDemo extends StatefulWidget {
_SliderDemoState createState() => new _SliderDemoState();
}
Path _triangle(double size, Offset thumbCenter, {bool invert: false}) {
Path _triangle(double size, Offset thumbCenter, {bool invert = false}) {
final Path thumbPath = new Path();
final double height = math.sqrt(3.0) / 2.0;
final double halfSide = size / 2.0;

View File

@@ -45,9 +45,9 @@ class PestoFavorites extends StatelessWidget {
class PestoStyle extends TextStyle {
const PestoStyle({
double fontSize: 12.0,
double fontSize = 12.0,
FontWeight fontWeight,
Color color: Colors.black87,
Color color = Colors.black87,
double letterSpacing,
double height,
}) : super(

View File

@@ -70,7 +70,7 @@ class Product {
}
class Order {
Order({ @required this.product, this.quantity: 1, this.inCart: false })
Order({ @required this.product, this.quantity = 1, this.inCart = false })
: assert(product != null),
assert(quantity != null && quantity >= 0),
assert(inCart != null);

View File

@@ -206,7 +206,7 @@ class FadeAnimation extends StatefulWidget {
const FadeAnimation({
this.child,
this.duration: const Duration(milliseconds: 500),
this.duration = const Duration(milliseconds: 500),
});
@override

View File

@@ -21,11 +21,11 @@ class GalleryApp extends StatefulWidget {
const GalleryApp({
Key key,
this.updateUrlFetcher,
this.enablePerformanceOverlay: true,
this.enableRasterCacheImagesCheckerboard: true,
this.enableOffscreenLayersCheckerboard: true,
this.enablePerformanceOverlay = true,
this.enableRasterCacheImagesCheckerboard = true,
this.enableOffscreenLayersCheckerboard = true,
this.onSendFeedback,
this.testMode: false,
this.testMode = false,
}) : super(key: key);
final UpdateUrlFetcher updateUrlFetcher;

View File

@@ -79,7 +79,7 @@ class _TappableWhileStatusIsState extends State<_TappableWhileStatusIs> {
class _CrossFadeTransition extends AnimatedWidget {
const _CrossFadeTransition({
Key key,
this.alignment: Alignment.center,
this.alignment = Alignment.center,
Animation<double> progress,
this.child0,
this.child1,
@@ -130,7 +130,7 @@ class _CrossFadeTransition extends AnimatedWidget {
class _BackAppBar extends StatelessWidget {
const _BackAppBar({
Key key,
this.leading: const SizedBox(width: 56.0),
this.leading = const SizedBox(width: 56.0),
@required this.title,
this.trailing,
}) : assert(leading != null), assert(title != null), super(key: key);

View File

@@ -270,7 +270,7 @@ class GalleryHome extends StatefulWidget {
const GalleryHome({
Key key,
this.testMode: false,
this.testMode = false,
this.optionsPage,
}) : super(key: key);

View File

@@ -12,12 +12,12 @@ class GalleryOptions {
GalleryOptions({
this.theme,
this.textScaleFactor,
this.textDirection: TextDirection.ltr,
this.timeDilation: 1.0,
this.textDirection = TextDirection.ltr,
this.timeDilation = 1.0,
this.platform,
this.showOffscreenLayersCheckerboard: false,
this.showRasterCacheImagesCheckerboard: false,
this.showPerformanceOverlay: false,
this.showOffscreenLayersCheckerboard = false,
this.showRasterCacheImagesCheckerboard = false,
this.showPerformanceOverlay = false,
});
final GalleryTheme theme;

View File

@@ -44,7 +44,7 @@ class TestAssetBundle extends AssetBundle {
Future<ByteData> load(String key) => null;
@override
Future<String> loadString(String key, { bool cache: true }) {
Future<String> loadString(String key, { bool cache = true }) {
if (key == 'lib/gallery/example_code.dart')
return new Future<String>.value(testCodeFile);
return null;

View File

@@ -11,14 +11,14 @@ const double kTwoPi = 2 * math.pi;
class SectorConstraints extends Constraints {
const SectorConstraints({
this.minDeltaRadius: 0.0,
this.maxDeltaRadius: double.infinity,
this.minDeltaTheta: 0.0,
this.maxDeltaTheta: kTwoPi
this.minDeltaRadius = 0.0,
this.maxDeltaRadius = double.infinity,
this.minDeltaTheta = 0.0,
this.maxDeltaTheta = kTwoPi
}) : assert(maxDeltaRadius >= minDeltaRadius),
assert(maxDeltaTheta >= minDeltaTheta);
const SectorConstraints.tight({ double deltaRadius: 0.0, double deltaTheta: 0.0 })
const SectorConstraints.tight({ double deltaRadius = 0.0, double deltaTheta = 0.0 })
: minDeltaRadius = deltaRadius,
maxDeltaRadius = deltaRadius,
minDeltaTheta = deltaTheta,
@@ -45,7 +45,7 @@ class SectorConstraints extends Constraints {
@override
bool debugAssertIsValid({
bool isAppliedConstraint: false,
bool isAppliedConstraint = false,
InformationCollector informationCollector
}) {
assert(isNormalized);
@@ -54,11 +54,11 @@ class SectorConstraints extends Constraints {
}
class SectorDimensions {
const SectorDimensions({ this.deltaRadius: 0.0, this.deltaTheta: 0.0 });
const SectorDimensions({ this.deltaRadius = 0.0, this.deltaTheta = 0.0 });
factory SectorDimensions.withConstraints(
SectorConstraints constraints,
{ double deltaRadius: 0.0, double deltaTheta: 0.0 }
{ double deltaRadius = 0.0, double deltaTheta = 0.0 }
) {
return new SectorDimensions(
deltaRadius: constraints.constrainDeltaRadius(deltaRadius),
@@ -215,8 +215,8 @@ class RenderSectorRing extends RenderSectorWithChildren {
RenderSectorRing({
BoxDecoration decoration,
double deltaRadius: double.infinity,
double padding: 0.0
double deltaRadius = double.infinity,
double padding = 0.0
}) : _padding = padding,
assert(deltaRadius >= 0.0),
_desiredDeltaRadius = deltaRadius,
@@ -333,8 +333,8 @@ class RenderSectorSlice extends RenderSectorWithChildren {
RenderSectorSlice({
BoxDecoration decoration,
double deltaTheta: kTwoPi,
double padding: 0.0
double deltaTheta = kTwoPi,
double padding = 0.0
}) : _padding = padding, _desiredDeltaTheta = deltaTheta, super(decoration);
double _desiredDeltaTheta;
@@ -440,7 +440,7 @@ class RenderSectorSlice extends RenderSectorWithChildren {
class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChildMixin<RenderSector> {
RenderBoxToRenderSectorAdapter({ double innerRadius: 0.0, RenderSector child }) :
RenderBoxToRenderSectorAdapter({ double innerRadius = 0.0, RenderSector child }) :
_innerRadius = innerRadius {
this.child = child;
}
@@ -487,8 +487,8 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
}
Size getIntrinsicDimensions({
double width: double.infinity,
double height: double.infinity
double width = double.infinity,
double height = double.infinity
}) {
assert(child is RenderSector);
assert(child.parentData is SectorParentData);
@@ -555,8 +555,8 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
class RenderSolidColor extends RenderDecoratedSector {
RenderSolidColor(this.backgroundColor, {
this.desiredDeltaRadius: double.infinity,
this.desiredDeltaTheta: kTwoPi
this.desiredDeltaRadius = double.infinity,
this.desiredDeltaTheta = kTwoPi
}) : super(new BoxDecoration(color: backgroundColor));
double desiredDeltaRadius;

View File

@@ -9,7 +9,7 @@ class RenderSolidColorBox extends RenderDecoratedBox {
final Size desiredSize;
final Color backgroundColor;
RenderSolidColorBox(this.backgroundColor, { this.desiredSize: Size.infinite })
RenderSolidColorBox(this.backgroundColor, { this.desiredSize = Size.infinite })
: super(decoration: new BoxDecoration(color: backgroundColor));
@override

View File

@@ -8,7 +8,7 @@ import 'package:flutter/rendering.dart';
import '../rendering/src/solid_color_box.dart';
// Solid colour, RenderObject version
void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex: 0 }) {
void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex = 0 }) {
final RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
parent.add(child);
final FlexParentData childParentData = child.parentData;