apply upcomming prefer_const_declarations (#15498)
This commit is contained in:
parent
7b8c79634d
commit
7667db6362
@ -480,7 +480,7 @@ class ArchivePublisher {
|
||||
jsonData['releases'][revision][branchName] = metadata;
|
||||
|
||||
final File tempFile = new File(path.join(tempDir.absolute.path, 'releases_$platformName.json'));
|
||||
final JsonEncoder encoder = const JsonEncoder.withIndent(' ');
|
||||
const JsonEncoder encoder = const JsonEncoder.withIndent(' ');
|
||||
tempFile.writeAsStringSync(encoder.convert(jsonData));
|
||||
await _cloudCopy(tempFile.absolute.path, metadataGsPath);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import '../prepare_package.dart';
|
||||
import 'fake_process_manager.dart';
|
||||
|
||||
void main() {
|
||||
final String testRef = 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef';
|
||||
const String testRef = 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef';
|
||||
test('Throws on missing executable', () async {
|
||||
// Uses a *real* process manager, since we want to know what happens if
|
||||
// it can't find an executable.
|
||||
@ -295,7 +295,7 @@ void main() {
|
||||
expect(contents, contains('"beta": "6da8ec6bd0c4801b80d666869e4069698561c043"'));
|
||||
// Make sure it's valid JSON, and in the right format.
|
||||
final Map<String, dynamic> jsonData = json.decode(contents);
|
||||
final JsonEncoder encoder = const JsonEncoder.withIndent(' ');
|
||||
const JsonEncoder encoder = const JsonEncoder.withIndent(' ');
|
||||
expect(contents, equals(encoder.convert(jsonData)));
|
||||
});
|
||||
});
|
||||
|
@ -99,7 +99,7 @@ class _ShrineGridDelegate extends SliverGridDelegate {
|
||||
@override
|
||||
SliverGridLayout getLayout(SliverConstraints constraints) {
|
||||
final double tileWidth = (constraints.crossAxisExtent - _kSpacing) / 2.0;
|
||||
final double tileHeight = 40.0 + 144.0 + 40.0;
|
||||
const double tileHeight = 40.0 + 144.0 + 40.0;
|
||||
return new _ShrineGridLayout(
|
||||
tileWidth: tileWidth,
|
||||
tileHeight: tileHeight,
|
||||
@ -211,7 +211,7 @@ class _HeadingLayout extends MultiChildLayoutDelegate {
|
||||
|
||||
final double halfWidth = size.width / 2.0;
|
||||
final double halfHeight = size.height / 2.0;
|
||||
final double halfUnit = unitSize / 2.0;
|
||||
const double halfUnit = unitSize / 2.0;
|
||||
const double margin = 16.0;
|
||||
|
||||
final Size imageSize = layoutChild(image, new BoxConstraints.loose(size));
|
||||
|
@ -276,7 +276,7 @@ class ButtonThemeData extends Diagnosticable {
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder description) {
|
||||
super.debugFillProperties(description);
|
||||
final ButtonThemeData defaultTheme = const ButtonThemeData();
|
||||
const ButtonThemeData defaultTheme = const ButtonThemeData();
|
||||
description.add(new EnumProperty<ButtonTextTheme>('textTheme', textTheme, defaultValue: defaultTheme.textTheme));
|
||||
description.add(new DoubleProperty('minWidth', minWidth, defaultValue: defaultTheme.minWidth));
|
||||
description.add(new DoubleProperty('height', height, defaultValue: defaultTheme.height));
|
||||
|
@ -328,7 +328,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
|
||||
final double buttonTop = buttonRect.top;
|
||||
final double selectedItemOffset = selectedIndex * _kMenuItemHeight + kMaterialListPadding.top;
|
||||
double menuTop = (buttonTop - selectedItemOffset) - (_kMenuItemHeight - buttonRect.height) / 2.0;
|
||||
final double topPreferredLimit = _kMenuItemHeight;
|
||||
const double topPreferredLimit = _kMenuItemHeight;
|
||||
if (menuTop < topPreferredLimit)
|
||||
menuTop = math.min(buttonTop, topPreferredLimit);
|
||||
double bottom = menuTop + menuHeight;
|
||||
|
@ -365,7 +365,7 @@ class OutlineInputBorder extends InputBorder {
|
||||
center.blRadiusY * 2.0,
|
||||
);
|
||||
|
||||
final double cornerArcSweep = math.pi / 2.0;
|
||||
const double cornerArcSweep = math.pi / 2.0;
|
||||
final double tlCornerArcSweep = start < center.tlRadiusX
|
||||
? math.asin(start / center.tlRadiusX)
|
||||
: math.pi / 2.0;
|
||||
@ -377,8 +377,8 @@ class OutlineInputBorder extends InputBorder {
|
||||
if (start > center.tlRadiusX)
|
||||
path.lineTo(center.left + start, center.top);
|
||||
|
||||
final double trCornerArcStart = (3 * math.pi) / 2.0;
|
||||
final double trCornerArcSweep = cornerArcSweep;
|
||||
const double trCornerArcStart = (3 * math.pi) / 2.0;
|
||||
const double trCornerArcSweep = cornerArcSweep;
|
||||
if (start + extent < center.width - center.trRadiusX) {
|
||||
path
|
||||
..relativeMoveTo(extent, 0.0)
|
||||
|
@ -2304,7 +2304,7 @@ class InputDecorationTheme extends Diagnosticable {
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder description) {
|
||||
super.debugFillProperties(description);
|
||||
final InputDecorationTheme defaultTheme = const InputDecorationTheme();
|
||||
const InputDecorationTheme defaultTheme = const InputDecorationTheme();
|
||||
description.add(new DiagnosticsProperty<TextStyle>('labelStyle', labelStyle,
|
||||
defaultValue: defaultTheme.labelStyle));
|
||||
description.add(new DiagnosticsProperty<TextStyle>('helperStyle', helperStyle,
|
||||
|
@ -58,7 +58,7 @@ const TextStyle _kStepStyle = const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.white,
|
||||
);
|
||||
final Color _kErrorLight = Colors.red;
|
||||
const Color _kErrorLight = Colors.red;
|
||||
final Color _kErrorDark = Colors.red.shade400;
|
||||
const Color _kCircleActiveLight = Colors.white;
|
||||
const Color _kCircleActiveDark = Colors.black87;
|
||||
|
@ -413,7 +413,7 @@ class _RenderSwitch extends RenderToggleable {
|
||||
// Paint the track
|
||||
final Paint paint = new Paint()
|
||||
..color = trackColor;
|
||||
final double trackHorizontalPadding = kRadialReactionRadius - _kTrackRadius;
|
||||
const double trackHorizontalPadding = kRadialReactionRadius - _kTrackRadius;
|
||||
final Rect trackRect = new Rect.fromLTWH(
|
||||
offset.dx + trackHorizontalPadding,
|
||||
offset.dy + (size.height - _kTrackHeight) / 2.0,
|
||||
|
@ -877,7 +877,7 @@ class _DialPainter extends CustomPainter {
|
||||
final Paint selectorPaint = new Paint()
|
||||
..color = accentColor;
|
||||
final Offset focusedPoint = getOffsetForTheta(theta, activeRing);
|
||||
final double focusedRadius = labelPadding - 4.0;
|
||||
const double focusedRadius = labelPadding - 4.0;
|
||||
canvas.drawCircle(centerPoint, 4.0, selectorPaint);
|
||||
canvas.drawCircle(focusedPoint, focusedRadius, selectorPaint);
|
||||
selectorPaint.strokeWidth = 2.0;
|
||||
|
@ -644,7 +644,7 @@ class RenderEditable extends RenderBox {
|
||||
assert(constraintWidth != null);
|
||||
if (_textLayoutLastWidth == constraintWidth)
|
||||
return;
|
||||
final double caretMargin = _kCaretGap + _kCaretWidth;
|
||||
const double caretMargin = _kCaretGap + _kCaretWidth;
|
||||
final double availableWidth = math.max(0.0, constraintWidth - caretMargin);
|
||||
final double maxWidth = _isMultiline ? availableWidth : double.infinity;
|
||||
_textPainter.layout(minWidth: availableWidth, maxWidth: maxWidth);
|
||||
|
@ -135,7 +135,7 @@ class BannerPainter extends CustomPainter {
|
||||
..rotate(_rotation)
|
||||
..drawRect(_kRect, _paintShadow)
|
||||
..drawRect(_kRect, _paintBanner);
|
||||
final double width = _kOffset * 2.0;
|
||||
const double width = _kOffset * 2.0;
|
||||
_textPainter.layout(minWidth: width, maxWidth: width);
|
||||
_textPainter.paint(canvas, _kRect.topLeft + new Offset(0.0, (_kRect.height - _textPainter.height) / 2.0));
|
||||
}
|
||||
|
@ -1058,7 +1058,7 @@ class _InspectorOverlayLayer extends Layer {
|
||||
if (!tooltipBelow)
|
||||
wedgeY += tooltipSize.height;
|
||||
|
||||
final double wedgeSize = _kTooltipPadding * 2;
|
||||
const double wedgeSize = _kTooltipPadding * 2;
|
||||
double wedgeX = math.max(tipOffset.dx, target.dx) + wedgeSize * 2;
|
||||
wedgeX = math.min(wedgeX, tipOffset.dx + tooltipSize.width - wedgeSize * 2);
|
||||
final List<Offset> wedge = <Offset>[
|
||||
|
@ -17,7 +17,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('Curve flipped control test', () {
|
||||
final Curve ease = Curves.ease;
|
||||
const Curve ease = Curves.ease;
|
||||
final Curve flippedEase = ease.flipped;
|
||||
expect(flippedEase.transform(0.0), lessThan(0.001));
|
||||
expect(flippedEase.transform(0.5), lessThan(ease.transform(0.5)));
|
||||
|
@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
test('ButtonThemeData defaults', () {
|
||||
final ButtonThemeData theme = const ButtonThemeData();
|
||||
const ButtonThemeData theme = const ButtonThemeData();
|
||||
expect(theme.textTheme, ButtonTextTheme.normal);
|
||||
expect(theme.constraints, const BoxConstraints(minWidth: 88.0, minHeight: 36.0));
|
||||
expect(theme.padding, const EdgeInsets.symmetric(horizontal: 16.0));
|
||||
@ -18,7 +18,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('ButtonThemeData default overrides', () {
|
||||
final ButtonThemeData theme = const ButtonThemeData(
|
||||
const ButtonThemeData theme = const ButtonThemeData(
|
||||
textTheme: ButtonTextTheme.primary,
|
||||
minWidth: 100.0,
|
||||
height: 200.0,
|
||||
|
@ -209,8 +209,8 @@ void main() {
|
||||
final ComputeNotch computeNotch = await fetchComputeNotch(tester, const FloatingActionButton(onPressed: null));
|
||||
final Rect host = new Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
|
||||
final Rect guest = new Rect.fromLTWH(50.0, 50.0, 10.0, 10.0);
|
||||
final Offset start = const Offset(10.0, 100.0);
|
||||
final Offset end = const Offset(60.0, 100.0);
|
||||
const Offset start = const Offset(10.0, 100.0);
|
||||
const Offset end = const Offset(60.0, 100.0);
|
||||
expect(() {computeNotch(host, guest, start, end);}, throwsFlutterError);
|
||||
});
|
||||
|
||||
@ -233,8 +233,8 @@ void main() {
|
||||
final Rect host = new Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
|
||||
final Rect guest = new Rect.fromLTRB(190.0, 90.0, 210.0, 110.0);
|
||||
|
||||
final Offset start = const Offset(191.0, 100.0);
|
||||
final Offset end = const Offset(220.0, 100.0);
|
||||
const Offset start = const Offset(191.0, 100.0);
|
||||
const Offset end = const Offset(220.0, 100.0);
|
||||
expect(() {computeNotch(host, guest, start, end);}, throwsFlutterError);
|
||||
});
|
||||
|
||||
@ -243,8 +243,8 @@ void main() {
|
||||
final Rect host = new Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
|
||||
final Rect guest = new Rect.fromLTRB(190.0, 90.0, 210.0, 110.0);
|
||||
|
||||
final Offset start = const Offset(180.0, 100.0);
|
||||
final Offset end = const Offset(209.0, 100.0);
|
||||
const Offset start = const Offset(180.0, 100.0);
|
||||
const Offset end = const Offset(209.0, 100.0);
|
||||
expect(() {computeNotch(host, guest, start, end);}, throwsFlutterError);
|
||||
});
|
||||
|
||||
@ -252,8 +252,8 @@ void main() {
|
||||
final ComputeNotch computeNotch = await fetchComputeNotch(tester, const FloatingActionButton(onPressed: null, notchMargin: 0.0));
|
||||
final Rect host = new Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
|
||||
final Rect guest = new Rect.fromLTRB(190.0, 90.0, 210.0, 110.0);
|
||||
final Offset start = const Offset(180.0, 100.0);
|
||||
final Offset end = const Offset(220.0, 100.0);
|
||||
const Offset start = const Offset(180.0, 100.0);
|
||||
const Offset end = const Offset(220.0, 100.0);
|
||||
|
||||
final Path actualNotch = computeNotch(host, guest, start, end);
|
||||
final Path notchedRectangle =
|
||||
@ -268,8 +268,8 @@ void main() {
|
||||
);
|
||||
final Rect host = new Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
|
||||
final Rect guest = new Rect.fromLTRB(190.0, 90.0, 210.0, 110.0);
|
||||
final Offset start = const Offset(180.0, 100.0);
|
||||
final Offset end = const Offset(220.0, 100.0);
|
||||
const Offset start = const Offset(180.0, 100.0);
|
||||
const Offset end = const Offset(220.0, 100.0);
|
||||
|
||||
final Path actualNotch = computeNotch(host, guest, start, end);
|
||||
final Path notchedRectangle =
|
||||
@ -283,8 +283,8 @@ void main() {
|
||||
);
|
||||
final Rect host = new Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
|
||||
final Rect guest = new Rect.fromLTRB(190.0, 85.0, 210.0, 105.0);
|
||||
final Offset start = const Offset(180.0, 100.0);
|
||||
final Offset end = const Offset(220.0, 100.0);
|
||||
const Offset start = const Offset(180.0, 100.0);
|
||||
const Offset end = const Offset(220.0, 100.0);
|
||||
|
||||
final Path actualNotch = computeNotch(host, guest, start, end);
|
||||
final Path notchedRectangle =
|
||||
@ -298,8 +298,8 @@ void main() {
|
||||
);
|
||||
final Rect host = new Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
|
||||
final Rect guest = new Rect.fromLTRB(190.0, 95.0, 210.0, 115.0);
|
||||
final Offset start = const Offset(180.0, 100.0);
|
||||
final Offset end = const Offset(220.0, 100.0);
|
||||
const Offset start = const Offset(180.0, 100.0);
|
||||
const Offset end = const Offset(220.0, 100.0);
|
||||
|
||||
final Path actualNotch = computeNotch(host, guest, start, end);
|
||||
final Path notchedRectangle =
|
||||
@ -313,8 +313,8 @@ void main() {
|
||||
);
|
||||
final Rect host = new Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
|
||||
final Rect guest = new Rect.fromLTRB(190.0, 40.0, 210.0, 60.0);
|
||||
final Offset start = const Offset(180.0, 100.0);
|
||||
final Offset end = const Offset(220.0, 100.0);
|
||||
const Offset start = const Offset(180.0, 100.0);
|
||||
const Offset end = const Offset(220.0, 100.0);
|
||||
|
||||
final Path actualNotch = computeNotch(host, guest, start, end);
|
||||
final Path notchedRectangle =
|
||||
|
@ -969,7 +969,7 @@ void main() {
|
||||
final RenderBox tabBarBox = tester.firstRenderObject<RenderBox>(find.byType(TabBar));
|
||||
expect(tabBarBox.size.height, 54.0); // 54 = _kTabHeight(46) + indicatorWeight(8.0)
|
||||
|
||||
final double indicatorY = 54.0 - indicatorWeight / 2.0;
|
||||
const double indicatorY = 54.0 - indicatorWeight / 2.0;
|
||||
double indicatorLeft = padLeft + indicatorWeight / 2.0;
|
||||
double indicatorRight = 200.0 - (padRight + indicatorWeight / 2.0);
|
||||
|
||||
@ -1030,7 +1030,7 @@ void main() {
|
||||
expect(tabBarBox.size.height, 54.0); // 54 = _kTabHeight(46) + indicatorWeight(8.0)
|
||||
expect(tabBarBox.size.width, 800.0);
|
||||
|
||||
final double indicatorY = 54.0 - indicatorWeight / 2.0;
|
||||
const double indicatorY = 54.0 - indicatorWeight / 2.0;
|
||||
double indicatorLeft = 600.0 + padLeft + indicatorWeight / 2.0;
|
||||
double indicatorRight = 800.0 - padRight - indicatorWeight / 2.0;
|
||||
|
||||
@ -1182,7 +1182,7 @@ void main() {
|
||||
expect(tester.getRect(find.byKey(tabs[2].key)), tabRect);
|
||||
|
||||
// Tab 0 selected, indicator padding resolves to left: 100.0
|
||||
final double indicatorLeft = 100.0 + indicatorWeight / 2.0;
|
||||
const double indicatorLeft = 100.0 + indicatorWeight / 2.0;
|
||||
final double indicatorRight = 130.0 + kTabLabelPadding.horizontal - indicatorWeight / 2.0;
|
||||
final double indicatorY = tabBottom + indicatorWeight / 2.0;
|
||||
expect(tabBarBox, paints..line(
|
||||
@ -1252,7 +1252,7 @@ void main() {
|
||||
// Tab 0 selected, indicator padding resolves to right: 100.0
|
||||
final double indicatorLeft = tabLeft - kTabLabelPadding.left + indicatorWeight / 2.0;
|
||||
final double indicatorRight = tabRight + kTabLabelPadding.left - indicatorWeight / 2.0 - 100.0;
|
||||
final double indicatorY = 50.0 + indicatorWeight / 2.0;
|
||||
const double indicatorY = 50.0 + indicatorWeight / 2.0;
|
||||
expect(tabBarBox, paints..line(
|
||||
strokeWidth: indicatorWeight,
|
||||
p1: new Offset(indicatorLeft, indicatorY),
|
||||
@ -1295,7 +1295,7 @@ void main() {
|
||||
// Tab 0 out of 100 selected
|
||||
double indicatorLeft = 99.0 * 100.0 + indicatorWeight / 2.0;
|
||||
double indicatorRight = 100.0 * 100.0 - indicatorWeight / 2.0;
|
||||
final double indicatorY = 40.0 + indicatorWeight / 2.0;
|
||||
const double indicatorY = 40.0 + indicatorWeight / 2.0;
|
||||
expect(tabBarBox, paints..line(
|
||||
strokeWidth: indicatorWeight,
|
||||
p1: new Offset(indicatorLeft, indicatorY),
|
||||
@ -1309,8 +1309,8 @@ void main() {
|
||||
// The x coordinates of p1 and p2 were derived empirically, not analytically.
|
||||
expect(tabBarBox, paints..line(
|
||||
strokeWidth: indicatorWeight,
|
||||
p1: new Offset(2476.0, indicatorY),
|
||||
p2: new Offset(2574.0, indicatorY),
|
||||
p1: const Offset(2476.0, indicatorY),
|
||||
p2: const Offset(2574.0, indicatorY),
|
||||
));
|
||||
|
||||
await tester.pump(const Duration(milliseconds: 501));
|
||||
@ -1691,7 +1691,7 @@ void main() {
|
||||
final RenderBox tabBarBox = tester.firstRenderObject<RenderBox>(find.byType(TabBar));
|
||||
expect(tabBarBox.size.height, 48.0); // 48 = _kTabHeight(46) + indicatorWeight(2.0)
|
||||
|
||||
final double indicatorY = 48.0 - indicatorWeight / 2.0;
|
||||
const double indicatorY = 48.0 - indicatorWeight / 2.0;
|
||||
double indicatorLeft = indicatorWeight / 2.0;
|
||||
double indicatorRight = 400.0 - indicatorWeight / 2.0; // 400 = screen_width / 2
|
||||
expect(tabBarBox, paints..line(
|
||||
|
@ -587,7 +587,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
final String testValue = kThreeLines;
|
||||
const String testValue = kThreeLines;
|
||||
const String cutValue = 'First line of stuff ';
|
||||
await tester.enterText(find.byType(TextField), testValue);
|
||||
await skipPastScrollingAnimation(tester);
|
||||
|
@ -37,7 +37,7 @@ void main() {
|
||||
test('AlignmentGeometry invariants', () {
|
||||
final AlignmentDirectional topStart = AlignmentDirectional.topStart;
|
||||
final AlignmentDirectional topEnd = AlignmentDirectional.topEnd;
|
||||
final Alignment center = Alignment.center;
|
||||
const Alignment center = Alignment.center;
|
||||
final Alignment topLeft = Alignment.topLeft;
|
||||
final Alignment topRight = Alignment.topRight;
|
||||
final List<double> numbers = <double>[0.0, 1.0, -1.0, 2.0, 0.25, 0.5, 100.0, -999.75];
|
||||
|
@ -17,10 +17,10 @@ void main() {
|
||||
test('ShapeDecoration constructor', () {
|
||||
const Color colorR = const Color(0xffff0000);
|
||||
const Color colorG = const Color(0xff00ff00);
|
||||
final Gradient gradient = const LinearGradient(colors: const <Color>[colorR, colorG]);
|
||||
const Gradient gradient = const LinearGradient(colors: const <Color>[colorR, colorG]);
|
||||
expect(const ShapeDecoration(shape: const Border()), const ShapeDecoration(shape: const Border()));
|
||||
expect(() => new ShapeDecoration(color: colorR, gradient: gradient, shape: const Border()), throwsAssertionError);
|
||||
expect(() => new ShapeDecoration(gradient: gradient, shape: null), throwsAssertionError);
|
||||
expect(() => new ShapeDecoration(color: colorR, gradient: nonconst(gradient), shape: const Border()), throwsAssertionError);
|
||||
expect(() => new ShapeDecoration(gradient: nonconst(gradient), shape: null), throwsAssertionError);
|
||||
expect(
|
||||
new ShapeDecoration.fromBoxDecoration(const BoxDecoration(shape: BoxShape.circle)),
|
||||
const ShapeDecoration(shape: const CircleBorder(side: BorderSide.none)),
|
||||
|
@ -37,10 +37,10 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('GlobalObjectKey toString test', (WidgetTester tester) async {
|
||||
final GlobalObjectKey one = const GlobalObjectKey(1);
|
||||
final GlobalObjectKey<TestState> two = const GlobalObjectKey<TestState>(2);
|
||||
final GlobalObjectKey three = const _MyGlobalObjectKey(3);
|
||||
final GlobalObjectKey<TestState> four = const _MyGlobalObjectKey<TestState>(4);
|
||||
const GlobalObjectKey one = const GlobalObjectKey(1);
|
||||
const GlobalObjectKey<TestState> two = const GlobalObjectKey<TestState>(2);
|
||||
const GlobalObjectKey three = const _MyGlobalObjectKey(3);
|
||||
const GlobalObjectKey<TestState> four = const _MyGlobalObjectKey<TestState>(4);
|
||||
|
||||
expect(one.toString(), equals('[GlobalObjectKey ${describeIdentity(1)}]'));
|
||||
expect(two.toString(), equals('[GlobalObjectKey<TestState> ${describeIdentity(2)}]'));
|
||||
|
@ -259,7 +259,7 @@ void main() {
|
||||
// over duration and according to curve.
|
||||
|
||||
const Duration duration = const Duration(milliseconds: 300);
|
||||
final Curve curve = Curves.fastOutSlowIn;
|
||||
const Curve curve = Curves.fastOutSlowIn;
|
||||
final double initialHeight = tester.getSize(find.byKey(firstKey, skipOffstage: false)).height;
|
||||
final double finalHeight = tester.getSize(find.byKey(secondKey, skipOffstage: false)).height;
|
||||
final double deltaHeight = finalHeight - initialHeight;
|
||||
@ -1086,7 +1086,7 @@ void main() {
|
||||
|
||||
const double epsilon = 0.001;
|
||||
const Duration duration = const Duration(milliseconds: 300);
|
||||
final Curve curve = Curves.fastOutSlowIn;
|
||||
const Curve curve = Curves.fastOutSlowIn;
|
||||
final MaterialPointArcTween pushCenterTween = new MaterialPointArcTween(
|
||||
begin: const Offset(50.0, 50.0),
|
||||
end: const Offset(400.0, 300.0),
|
||||
|
@ -151,7 +151,7 @@ TestImage getTestImage(WidgetTester tester, Key key) {
|
||||
|
||||
Future<Null> pumpTreeToLayout(WidgetTester tester, Widget widget) {
|
||||
const Duration pumpDuration = const Duration(milliseconds: 0);
|
||||
final EnginePhase pumpPhase = EnginePhase.layout;
|
||||
const EnginePhase pumpPhase = EnginePhase.layout;
|
||||
return tester.pumpWidget(widget, pumpDuration, pumpPhase);
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ void main() {
|
||||
final Key keyBottom = new UniqueKey();
|
||||
|
||||
bool valueTop = false;
|
||||
final bool valueBottom = true;
|
||||
const bool valueBottom = true;
|
||||
|
||||
await tester.pumpWidget(
|
||||
new Directionality(
|
||||
|
@ -34,7 +34,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
final ScrollPosition position = tester.state<ScrollableState>(find.byType(Scrollable)).position;
|
||||
final double max = RenderBigSliver.height * 3.0 + (RenderOverlappingSliver.totalHeight) * 2.0 - 600.0; // 600 is the height of the test viewport
|
||||
const double max = RenderBigSliver.height * 3.0 + (RenderOverlappingSliver.totalHeight) * 2.0 - 600.0; // 600 is the height of the test viewport
|
||||
assert(max < 10000.0);
|
||||
expect(max, 1450.0);
|
||||
expect(position.pixels, 0.0);
|
||||
|
@ -122,7 +122,7 @@ void handleKnownGradleExceptions(String exceptionString) {
|
||||
// Handle Gradle error thrown when Gradle needs to download additional
|
||||
// Android SDK components (e.g. Platform Tools), and the license
|
||||
// for that component has not been accepted.
|
||||
final String matcher =
|
||||
const String matcher =
|
||||
r'You have not accepted the license agreements of the following SDK components:'
|
||||
r'\s*\[(.+)\]';
|
||||
final RegExp licenseFailure = new RegExp(matcher, multiLine: true);
|
||||
|
@ -78,7 +78,7 @@ export 'dart:io'
|
||||
/// Exits the process with the given [exitCode].
|
||||
typedef void ExitFunction(int exitCode);
|
||||
|
||||
final ExitFunction _defaultExitFunction = io.exit;
|
||||
const ExitFunction _defaultExitFunction = io.exit;
|
||||
|
||||
ExitFunction _exitFunction = _defaultExitFunction;
|
||||
|
||||
|
@ -507,7 +507,7 @@ class XcodeBuildExecution {
|
||||
final Map<String, String> buildSettings;
|
||||
}
|
||||
|
||||
final String _xcodeRequirement = 'Xcode $kXcodeRequiredVersionMajor.$kXcodeRequiredVersionMinor or greater is required to develop for iOS.';
|
||||
const String _xcodeRequirement = 'Xcode $kXcodeRequiredVersionMajor.$kXcodeRequiredVersionMinor or greater is required to develop for iOS.';
|
||||
|
||||
bool _checkXcodeVersion() {
|
||||
if (!platform.isMacOS)
|
||||
|
@ -241,7 +241,7 @@ void injectPlugins({String directory}) {
|
||||
_writeAndroidPluginRegistrant(directory, plugins);
|
||||
if (fs.isDirectorySync(fs.path.join(directory, 'ios'))) {
|
||||
_writeIOSPluginRegistrant(directory, plugins);
|
||||
final CocoaPods cocoaPods = const CocoaPods();
|
||||
const CocoaPods cocoaPods = const CocoaPods();
|
||||
if (plugins.isNotEmpty)
|
||||
cocoaPods.setupPodfile(directory);
|
||||
if (changed)
|
||||
|
@ -170,7 +170,7 @@ $fontsSection
|
||||
const String localFont = 'a/bar';
|
||||
writeFontAsset('', localFont);
|
||||
|
||||
final String expectedFontManifest =
|
||||
const String expectedFontManifest =
|
||||
'[{"fonts":[{"asset":"packages/test_package/bar"},{"asset":"a/bar"}],'
|
||||
'"family":"foo"}]';
|
||||
await buildAndVerifyFonts(
|
||||
@ -200,7 +200,7 @@ $fontsSection
|
||||
const String font = 'a/bar';
|
||||
writeFontAsset('p/p/', font);
|
||||
|
||||
final String expectedFontManifest =
|
||||
const String expectedFontManifest =
|
||||
'[{"family":"packages/test_package/foo",'
|
||||
'"fonts":[{"asset":"packages/test_package/a/bar"}]}]';
|
||||
await buildAndVerifyFonts(
|
||||
@ -231,7 +231,7 @@ $fontsSection
|
||||
const String font = 'bar';
|
||||
writeFontAsset('p2/p/lib/', font);
|
||||
|
||||
final String expectedFontManifest =
|
||||
const String expectedFontManifest =
|
||||
'[{"family":"packages/test_package/foo",'
|
||||
'"fonts":[{"asset":"packages/test_package2/bar"}]}]';
|
||||
await buildAndVerifyFonts(
|
||||
@ -263,7 +263,7 @@ $fontsSection
|
||||
const String font = 'a/bar';
|
||||
writeFontAsset('p/p/', font);
|
||||
|
||||
final String expectedFontManifest =
|
||||
const String expectedFontManifest =
|
||||
'[{"family":"packages/test_package/foo",'
|
||||
'"fonts":[{"weight":400,"style":"italic","asset":"packages/test_package/a/bar"}]}]';
|
||||
await buildAndVerifyFonts(
|
||||
@ -298,7 +298,7 @@ $fontsSection
|
||||
writeFontAsset('', font);
|
||||
writeFontAsset('p/p/', font);
|
||||
|
||||
final String expectedFontManifest =
|
||||
const String expectedFontManifest =
|
||||
'[{"fonts":[{"asset":"a/bar"}],"family":"foo"},'
|
||||
'{"family":"packages/test_package/foo",'
|
||||
'"fonts":[{"asset":"packages/test_package/a/bar"}]}]';
|
||||
|
@ -168,7 +168,7 @@ $assetsSection
|
||||
|
||||
writeAssets('p/p/', assets);
|
||||
|
||||
final String expectedAssetManifest = '{"packages/test_package/a/foo":'
|
||||
const String expectedAssetManifest = '{"packages/test_package/a/foo":'
|
||||
'["packages/test_package/a/foo"]}';
|
||||
await buildAndVerifyAssets(
|
||||
assets,
|
||||
@ -192,7 +192,7 @@ $assetsSection
|
||||
final List<String> assets = <String>['a/foo'];
|
||||
writeAssets('p/p/lib/', assets);
|
||||
|
||||
final String expectedAssetManifest = '{"packages/test_package/a/foo":'
|
||||
const String expectedAssetManifest = '{"packages/test_package/a/foo":'
|
||||
'["packages/test_package/a/foo"]}';
|
||||
await buildAndVerifyAssets(
|
||||
assets,
|
||||
@ -215,7 +215,7 @@ $assetsSection
|
||||
final List<String> assets = <String>['a/foo', 'a/v/foo'];
|
||||
writeAssets('p/p/', assets);
|
||||
|
||||
final String expectedManifest = '{"packages/test_package/a/foo":'
|
||||
const String expectedManifest = '{"packages/test_package/a/foo":'
|
||||
'["packages/test_package/a/foo","packages/test_package/a/v/foo"]}';
|
||||
|
||||
await buildAndVerifyAssets(
|
||||
@ -242,7 +242,7 @@ $assetsSection
|
||||
final List<String> assets = <String>['a/foo', 'a/v/foo'];
|
||||
writeAssets('p/p/lib/', assets);
|
||||
|
||||
final String expectedManifest = '{"packages/test_package/a/foo":'
|
||||
const String expectedManifest = '{"packages/test_package/a/foo":'
|
||||
'["packages/test_package/a/foo","packages/test_package/a/v/foo"]}';
|
||||
|
||||
await buildAndVerifyAssets(
|
||||
@ -266,7 +266,7 @@ $assetsSection
|
||||
);
|
||||
|
||||
writeAssets('p/p/', assets);
|
||||
final String expectedAssetManifest =
|
||||
const String expectedAssetManifest =
|
||||
'{"packages/test_package/a/foo":["packages/test_package/a/foo"],'
|
||||
'"packages/test_package/a/bar":["packages/test_package/a/bar"]}';
|
||||
|
||||
@ -298,7 +298,7 @@ $assetsSection
|
||||
);
|
||||
|
||||
writeAssets('p/p/lib/', assets);
|
||||
final String expectedAssetManifest =
|
||||
const String expectedAssetManifest =
|
||||
'{"packages/test_package/a/foo":["packages/test_package/a/foo"],'
|
||||
'"packages/test_package/a/bar":["packages/test_package/a/bar"]}';
|
||||
|
||||
@ -332,7 +332,7 @@ $assetsSection
|
||||
writeAssets('p/p/', assets);
|
||||
writeAssets('p2/p/', assets);
|
||||
|
||||
final String expectedAssetManifest =
|
||||
const String expectedAssetManifest =
|
||||
'{"packages/test_package/a/foo":'
|
||||
'["packages/test_package/a/foo","packages/test_package/a/v/foo"],'
|
||||
'"packages/test_package2/a/foo":'
|
||||
@ -371,7 +371,7 @@ $assetsSection
|
||||
writeAssets('p/p/lib/', assets);
|
||||
writeAssets('p2/p/lib/', assets);
|
||||
|
||||
final String expectedAssetManifest =
|
||||
const String expectedAssetManifest =
|
||||
'{"packages/test_package/a/foo":'
|
||||
'["packages/test_package/a/foo","packages/test_package/a/v/foo"],'
|
||||
'"packages/test_package2/a/foo":'
|
||||
@ -404,7 +404,7 @@ $assetsSection
|
||||
final List<String> assets = <String>['a/foo', 'a/v/foo'];
|
||||
writeAssets('p2/p/lib/', assets);
|
||||
|
||||
final String expectedAssetManifest =
|
||||
const String expectedAssetManifest =
|
||||
'{"packages/test_package2/a/foo":'
|
||||
'["packages/test_package2/a/foo","packages/test_package2/a/v/foo"]}';
|
||||
|
||||
|
@ -71,7 +71,7 @@ void main() {
|
||||
});
|
||||
|
||||
testUsingContext('--preview-dart-2', () async {
|
||||
final String contents = "StringBuffer bar = StringBuffer('baz');";
|
||||
const String contents = "StringBuffer bar = StringBuffer('baz');";
|
||||
tempDir.childFile('main.dart').writeAsStringSync(contents);
|
||||
server = new AnalysisServer(dartSdkPath, <String>[tempDir.path], previewDart2: true);
|
||||
|
||||
@ -90,7 +90,7 @@ void main() {
|
||||
});
|
||||
|
||||
testUsingContext('no --preview-dart-2 shows errors', () async {
|
||||
final String contents = "StringBuffer bar = StringBuffer('baz');";
|
||||
const String contents = "StringBuffer bar = StringBuffer('baz');";
|
||||
tempDir.childFile('main.dart').writeAsStringSync(contents);
|
||||
server = new AnalysisServer(dartSdkPath, <String>[tempDir.path], previewDart2: false);
|
||||
|
||||
|
@ -194,7 +194,7 @@ void bar() {
|
||||
});
|
||||
|
||||
testUsingContext('--preview-dart-2', () async {
|
||||
final String contents = '''
|
||||
const String contents = '''
|
||||
StringBuffer bar = StringBuffer('baz');
|
||||
''';
|
||||
|
||||
@ -213,7 +213,7 @@ StringBuffer bar = StringBuffer('baz');
|
||||
});
|
||||
|
||||
testUsingContext('no --preview-dart-2 shows errors', () async {
|
||||
final String contents = '''
|
||||
const String contents = '''
|
||||
StringBuffer bar = StringBuffer('baz');
|
||||
''';
|
||||
|
||||
|
@ -15,7 +15,7 @@ import '../src/context.dart';
|
||||
void main() {
|
||||
group('doctor', () {
|
||||
testUsingContext('intellij validator', () async {
|
||||
final String installPath = '/path/to/intelliJ';
|
||||
const String installPath = '/path/to/intelliJ';
|
||||
final ValidationResult result = await new IntelliJValidatorTestTarget('Test', installPath).validate();
|
||||
expect(result.type, ValidationType.partial);
|
||||
expect(result.statusInfo, 'version test.test.test');
|
||||
|
@ -203,7 +203,7 @@ flutter:
|
||||
''';
|
||||
final FlutterManifest flutterManifest = await FlutterManifest.createFromString(manifest);
|
||||
|
||||
final String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {style: italic, weight: 400, asset: a/bar}], family: foo},'
|
||||
const String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {style: italic, weight: 400, asset: a/bar}], family: foo},'
|
||||
' {fonts: [{asset: a/baz}, {style: italic, weight: 400, asset: a/baz}], family: bar}]';
|
||||
expect(flutterManifest.fontsDescriptor.toString(), expectedFontsDescriptor);
|
||||
final List<Font> fonts = flutterManifest.fonts;
|
||||
@ -264,7 +264,7 @@ flutter:
|
||||
final FlutterManifest flutterManifest = await FlutterManifest.createFromString(manifest);
|
||||
|
||||
|
||||
final String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {style: italic, weight: 400, asset: a/bar}], family: foo},'
|
||||
const String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {style: italic, weight: 400, asset: a/bar}], family: foo},'
|
||||
' {fonts: [{asset: a/baz}, {style: italic, weight: 400, asset: a/baz}]}]';
|
||||
expect(flutterManifest.fontsDescriptor.toString(), expectedFontsDescriptor);
|
||||
final List<Font> fonts = flutterManifest.fonts;
|
||||
@ -304,7 +304,7 @@ flutter:
|
||||
''';
|
||||
final FlutterManifest flutterManifest = await FlutterManifest.createFromString(manifest);
|
||||
|
||||
final String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {style: italic, weight: 400, asset: a/bar}], family: foo},'
|
||||
const String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {style: italic, weight: 400, asset: a/bar}], family: foo},'
|
||||
' {family: bar}]';
|
||||
expect(flutterManifest.fontsDescriptor.toString(), expectedFontsDescriptor);
|
||||
final List<Font> fonts = flutterManifest.fonts;
|
||||
|
Loading…
x
Reference in New Issue
Block a user