Unverified Commit 841d5d7b authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

prefer_const_declarations on local variables (#14358)

parent b0e17949
......@@ -10,7 +10,7 @@ import 'package:process/process.dart';
import 'package:test/test.dart';
void main() {
final ProcessManager processManager = const LocalProcessManager();
const ProcessManager processManager = const LocalProcessManager();
group('run.dart script', () {
Future<int> runScript(List<String> testNames) async {
......
......@@ -256,7 +256,7 @@ void addHtmlBaseToIndex() {
}
void putRedirectInOldIndexLocation() {
final String metaTag = '<meta http-equiv="refresh" content="0;URL=../index.html">';
const String metaTag = '<meta http-equiv="refresh" content="0;URL=../index.html">';
new File('$kDocRoot/flutter/index.html').writeAsStringSync(metaTag);
}
......
......@@ -271,7 +271,7 @@ void main(List<String> rawArgs) {
validateLocalizations(localeToResources, localeToResourceAttributes)
);
final String regenerate = 'dart dev/tools/gen_localizations.dart --overwrite';
const String regenerate = 'dart dev/tools/gen_localizations.dart --overwrite';
final StringBuffer buffer = new StringBuffer();
buffer.writeln(outputHeader.replaceFirst('@(regenerate)', regenerate));
buffer.write(generateTranslationBundles());
......
......@@ -210,7 +210,7 @@ void main() {
group('create PathAnimation', () {
test('single path', () {
final List<FrameData> frameData = const <FrameData>[
const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
......@@ -240,7 +240,7 @@ void main() {
});
test('multiple paths', () {
final List<FrameData> frameData = const <FrameData>[
const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
......@@ -283,7 +283,7 @@ void main() {
});
test('multiple frames', () {
final List<FrameData> frameData = const <FrameData>[
const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
......@@ -326,7 +326,7 @@ void main() {
group('create Animation', () {
test('multiple paths', () {
final List<FrameData> frameData = const <FrameData>[
const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
......@@ -374,7 +374,7 @@ void main() {
group('toDart', () {
test('_PathMoveTo', () {
final PathCommandAnimation command = const PathCommandAnimation(
const PathCommandAnimation command = const PathCommandAnimation(
'M',
const <List<Point<double>>>[
const <Point<double>>[
......@@ -396,7 +396,7 @@ void main() {
});
test('_PathLineTo', () {
final PathCommandAnimation command = const PathCommandAnimation(
const PathCommandAnimation command = const PathCommandAnimation(
'L',
const <List<Point<double>>>[
const <Point<double>>[
......@@ -418,7 +418,7 @@ void main() {
});
test('_PathCubicTo', () {
final PathCommandAnimation command = const PathCommandAnimation(
const PathCommandAnimation command = const PathCommandAnimation(
'C',
const <List<Point<double>>>[
const <Point<double>>[
......@@ -456,7 +456,7 @@ void main() {
});
test('_PathClose', () {
final PathCommandAnimation command = const PathCommandAnimation(
const PathCommandAnimation command = const PathCommandAnimation(
'Z',
const <List<Point<double>>>[],
);
......@@ -469,7 +469,7 @@ void main() {
});
test('Unsupported path command', () {
final PathCommandAnimation command = const PathCommandAnimation(
const PathCommandAnimation command = const PathCommandAnimation(
'h',
const <List<Point<double>>>[],
);
......@@ -481,7 +481,7 @@ void main() {
});
test('_PathFrames', () {
final PathAnimation pathAnimation = const PathAnimation(
const PathAnimation pathAnimation = const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[
......@@ -524,7 +524,7 @@ void main() {
});
test('Animation', () {
final Animation animation = const Animation(
const Animation animation = const Animation(
const Point<double>(48.0, 48.0),
const <PathAnimation>[
const PathAnimation(
......
......@@ -113,8 +113,8 @@ class _HeadingLayout extends MultiChildLayoutDelegate {
final double imageWidth = (landscape ? size.width / 2.0 : size.width) - margin * 2.0;
final BoxConstraints imageConstraints = new BoxConstraints(maxHeight: 224.0, maxWidth: imageWidth);
final Size imageSize = layoutChild(image, imageConstraints);
final double imageY = 0.0;
positionChild(image, new Offset(margin, imageY));
const double imageY = 0.0;
positionChild(image, const Offset(margin, imageY));
final double productWidth = landscape ? size.width / 2.0 : size.width - margin;
final BoxConstraints productConstraints = new BoxConstraints(maxWidth: productWidth);
......
......@@ -32,7 +32,7 @@ void reportToStringError(String name, String route, int lineNumber, List<String>
// If you're on line 12, then it has index 11.
// If you want 1 line before and 1 line after, then you want lines with index 10, 11, and 12.
// That's (lineNumber-1)-margin .. (lineNumber-1)+margin, or lineNumber-(margin+1) .. lineNumber+(margin-1)
final int margin = 5;
const int margin = 5;
final int firstLine = math.max(0, lineNumber - margin);
final int lastLine = math.min(lines.length, lineNumber + margin);
print('$name : $route : line $lineNumber of ${lines.length} : $message; nearby lines were:\n ${lines.sublist(firstLine, lastLine).join("\n ")}');
......
......@@ -23,7 +23,7 @@ class StockArrowPainter extends CustomPainter {
final double centerY = padding + r;
// Draw the arrow.
final double w = 8.0;
const double w = 8.0;
double h = 5.0;
double arrowY;
if (percentChange < 0.0) {
......@@ -58,7 +58,7 @@ class StockArrow extends StatelessWidget {
final double percentChange;
int _colorIndexForPercentChange(double percentChange) {
final double maxPercent = 10.0;
const double maxPercent = 10.0;
final double normalizedPercentChange = math.min(percentChange.abs(), maxPercent) / maxPercent;
return 100 + (normalizedPercentChange * 8.0).floor() * 100;
}
......
......@@ -85,7 +85,7 @@ class StockData extends ChangeNotifier {
_end();
return;
}
final JsonDecoder decoder = const JsonDecoder();
const JsonDecoder decoder = const JsonDecoder();
add(decoder.convert(json));
if (_nextChunk < _kChunkCount) {
_fetchNextChunk();
......
......@@ -918,7 +918,7 @@ abstract class DiagnosticsNode {
if (i > 0)
builder.write(config.propertySeparator);
final int kWrapWidth = 65;
const int kWrapWidth = 65;
if (property.style != DiagnosticsTreeStyle.singleLine) {
final TextTreeConfiguration propertyStyle = property.textTreeConfiguration;
builder.writeRaw(property.toStringDeep(
......
......@@ -210,9 +210,9 @@ class _RenderCheckbox extends RenderToggleable {
..style = PaintingStyle.stroke
..strokeWidth = _kStrokeWidth;
final Path path = new Path();
final Offset start = const Offset(_kEdgeSize * 0.15, _kEdgeSize * 0.45);
final Offset mid = const Offset(_kEdgeSize * 0.4, _kEdgeSize * 0.7);
final Offset end = const Offset(_kEdgeSize * 0.85, _kEdgeSize * 0.25);
const Offset start = const Offset(_kEdgeSize * 0.15, _kEdgeSize * 0.45);
const Offset mid = const Offset(_kEdgeSize * 0.4, _kEdgeSize * 0.7);
const Offset end = const Offset(_kEdgeSize * 0.85, _kEdgeSize * 0.25);
final Offset drawStart = Offset.lerp(start, mid, 1.0 - value);
final Offset drawEnd = Offset.lerp(mid, end, value);
path.moveTo(offsetX + drawStart.dx, offsetY + drawStart.dy);
......
......@@ -401,7 +401,7 @@ class DataTable extends StatelessWidget {
down: sorted ? ascending : null,
duration: _kSortArrowAnimationDuration,
);
final Widget arrowPadding = const SizedBox(width: _kSortArrowPadding);
const Widget arrowPadding = const SizedBox(width: _kSortArrowPadding);
label = new Row(
textDirection: numeric ? TextDirection.rtl : null,
children: <Widget>[ label, arrowPadding, arrow ],
......@@ -453,7 +453,7 @@ class DataTable extends StatelessWidget {
}) {
final bool isLightTheme = Theme.of(context).brightness == Brightness.light;
if (showEditIcon) {
final Widget icon = const Icon(Icons.edit, size: 18.0);
const Widget icon = const Icon(Icons.edit, size: 18.0);
label = new Expanded(child: label);
label = new Row(
textDirection: numeric ? TextDirection.rtl : null,
......
......@@ -122,7 +122,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
// background image
if (widget.background != null) {
final double fadeStart = math.max(0.0, 1.0 - kToolbarHeight / deltaExtent);
final double fadeEnd = 1.0;
const double fadeEnd = 1.0;
assert(fadeStart <= fadeEnd);
final double opacity = 1.0 - new Interval(fadeStart, fadeEnd).transform(t);
final double parallax = new Tween<double>(begin: 0.0, end: deltaExtent / 4.0).lerp(t);
......
......@@ -453,7 +453,7 @@ class FocusManager {
@override
String toString() {
final String status = _haveScheduledUpdate ? ' UPDATE SCHEDULED' : '';
final String indent = ' ';
const String indent = ' ';
return '${describeIdentity(this)}$status\n'
'${indent}currentFocus: $_currentFocus\n'
'${rootScope.toStringDeep(prefixLineOne: indent, prefixOtherLines: indent)}';
......
......@@ -954,7 +954,7 @@ class _InspectorOverlayLayer extends Layer {
final Rect targetRect = MatrixUtils.transformRect(
state.selected.transform, state.selected.rect);
final Offset target = new Offset(targetRect.left, targetRect.center.dy);
final double offsetFromWidget = 9.0;
const double offsetFromWidget = 9.0;
final double verticalOffset = (targetRect.height) / 2 + offsetFromWidget;
_paintDescription(canvas, state.tooltip, state.textDirection, target, verticalOffset, size, targetRect);
......
......@@ -26,7 +26,7 @@ void main() {
});
test('Threshold has a threshold', () {
final Curve step = const Threshold(0.25);
const Curve step = const Threshold(0.25);
expect(step.transform(0.0), 0.0);
expect(step.transform(0.24), 0.0);
expect(step.transform(0.25), 1.0);
......
......@@ -33,9 +33,9 @@ void main() {
});
testWidgets('Minimum size parameter', (WidgetTester tester) async {
final double minSize = 60.0;
const double minSize = 60.0;
await tester.pumpWidget(
boilerplate(child: new CupertinoButton(
boilerplate(child: const CupertinoButton(
child: const Text('X', style: testStyle),
onPressed: null,
minSize: minSize,
......@@ -45,7 +45,7 @@ void main() {
expect(
buttonBox.size,
// 1 10px character + 16px * 2 is smaller than defined 60.0px minimum
new Size.square(minSize),
const Size.square(minSize),
);
});
......@@ -150,7 +150,7 @@ void main() {
});
testWidgets('pressedOpacity parameter', (WidgetTester tester) async {
final double pressedOpacity = 0.5;
const double pressedOpacity = 0.5;
await tester.pumpWidget(boilerplate(child: new CupertinoButton(
pressedOpacity: pressedOpacity,
child: const Text('Tap me'),
......
......@@ -34,7 +34,7 @@ void main() {
});
testWidgets('Contents are between opaque bars', (WidgetTester tester) async {
final Center page1Center = const Center();
const Center page1Center = const Center();
await tester.pumpWidget(
new WidgetsApp(
......@@ -59,7 +59,7 @@ void main() {
),
tabBuilder: (BuildContext context, int index) {
return index == 0
? new CupertinoPageScaffold(
? const CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
backgroundColor: CupertinoColors.white,
middle: const Text('Title'),
......
......@@ -8,7 +8,7 @@ import 'package:test/test.dart';
void main() {
test('color accessors should work', () {
final Color foo = const Color(0x12345678);
const Color foo = const Color(0x12345678);
expect(foo.alpha, equals(0x12));
expect(foo.red, equals(0x34));
expect(foo.green, equals(0x56));
......@@ -16,7 +16,7 @@ void main() {
});
test('paint set to black', () {
final Color c = const Color(0x00000000);
const Color c = const Color(0x00000000);
final Paint p = new Paint();
p.color = c;
expect(c.toString(), equals('Color(0x00000000)'));
......@@ -24,7 +24,7 @@ void main() {
test('color created with out of bounds value', () {
try {
final Color c = const Color(0x100 << 24);
const Color c = const Color(0x100 << 24);
final Paint p = new Paint();
p.color = c;
} catch (e) {
......@@ -34,7 +34,7 @@ void main() {
test('color created with wildly out of bounds value', () {
try {
final Color c = const Color(1 << 1000000);
const Color c = const Color(1 << 1000000);
final Paint p = new Paint();
p.color = c;
} catch (e) {
......
......@@ -1332,7 +1332,7 @@ void main() {
test('color property test', () {
// Add more tests if colorProperty becomes more than a wrapper around
// objectProperty.
final Color color = const Color.fromARGB(255, 255, 255, 255);
const Color color = const Color.fromARGB(255, 255, 255, 255);
final DiagnosticsProperty<Color> simple = new DiagnosticsProperty<Color>(
'name',
color,
......
......@@ -149,7 +149,7 @@ void main() {
test('TapGestureRecognizer _sentTapDown toString', () {
final TapGestureRecognizer tap = new TapGestureRecognizer();
expect(tap.toString(), equalsIgnoringHashCodes('TapGestureRecognizer#00000(state: ready)'));
final PointerEvent event = const PointerDownEvent(pointer: 1, position: const Offset(10.0, 10.0));
const PointerEvent event = const PointerDownEvent(pointer: 1, position: const Offset(10.0, 10.0));
tap.addPointer(event);
tap.didExceedDeadline();
expect(tap.toString(), equalsIgnoringHashCodes('TapGestureRecognizer#00000(state: possible, sent tap down)'));
......
......@@ -32,7 +32,7 @@ void main() {
setUp(ensureTestGestureBinding);
test('Pointer tap events', () {
final ui.PointerDataPacket packet = const ui.PointerDataPacket(
const ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.up),
......@@ -49,7 +49,7 @@ void main() {
});
test('Pointer move events', () {
final ui.PointerDataPacket packet = const ui.PointerDataPacket(
const ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.move),
......@@ -95,7 +95,7 @@ void main() {
});
test('Pointer cancel events', () {
final ui.PointerDataPacket packet = const ui.PointerDataPacket(
const ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.cancel),
......@@ -112,7 +112,7 @@ void main() {
});
test('Can cancel pointers', () {
final ui.PointerDataPacket packet = const ui.PointerDataPacket(
const ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.up),
......@@ -133,7 +133,7 @@ void main() {
});
test('Can expand add and hover pointers', () {
final ui.PointerDataPacket packet = const ui.PointerDataPacket(
const ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.add, device: 24),
const ui.PointerData(change: ui.PointerChange.hover, device: 24),
......
......@@ -28,7 +28,7 @@ void main() {
tap.onTap = () { log.add('tap'); };
void test(Offset delta) {
final Offset origin = const Offset(10.0, 10.0);
const Offset origin = const Offset(10.0, 10.0);
final TestPointer pointer = new TestPointer(5);
final PointerDownEvent down = pointer.down(origin);
horizontalDrag.addPointer(down);
......
......@@ -19,7 +19,7 @@ bool _checkVelocity(Velocity actual, Offset expected) {
}
void main() {
final List<Offset> expected = const <Offset>[
const List<Offset> expected = const <Offset>[
const Offset(219.5762939453125, 1304.6705322265625),
const Offset(355.6900939941406, 967.1700439453125),
const Offset(12.651158332824707, -36.9227180480957),
......@@ -49,8 +49,8 @@ void main() {
});
test('Velocity control test', () {
final Velocity velocity1 = const Velocity(pixelsPerSecond: const Offset(7.0, 0.0));
final Velocity velocity2 = const Velocity(pixelsPerSecond: const Offset(12.0, 0.0));
const Velocity velocity1 = const Velocity(pixelsPerSecond: const Offset(7.0, 0.0));
const Velocity velocity2 = const Velocity(pixelsPerSecond: const Offset(12.0, 0.0));
expect(velocity1, equals(const Velocity(pixelsPerSecond: const Offset(7.0, 0.0))));
expect(velocity1, isNot(equals(velocity2)));
expect(velocity2 - velocity1, equals(const Velocity(pixelsPerSecond: const Offset(5.0, 0.0))));
......
......@@ -46,7 +46,7 @@ class MockPath extends Mock implements ui.Path {}
void main () {
group('Interpolate points', () {
test('- single point', () {
final List<Offset> points = const <Offset>[
const List<Offset> points = const <Offset>[
const Offset(25.0, 1.0),
];
expect(_interpolate(points, 0.0, Offset.lerp), const Offset(25.0, 1.0));
......@@ -55,7 +55,7 @@ void main () {
});
test('- two points', () {
final List<Offset> points = const <Offset>[
const List<Offset> points = const <Offset>[
const Offset(25.0, 1.0),
const Offset(12.0, 12.0),
];
......@@ -65,7 +65,7 @@ void main () {
});
test('- three points', () {
final List<Offset> points = const <Offset>[
const List<Offset> points = const <Offset>[
const Offset(25.0, 1.0),
const Offset(12.0, 12.0),
const Offset(23.0, 9.0),
......@@ -79,7 +79,7 @@ void main () {
});
group('_AnimatedIconPainter', () {
final Size size = const Size(48.0, 48.0);
const Size size = const Size(48.0, 48.0);
final MockCanvas mockCanvas = new MockCanvas();
List<MockPath> generatedPaths;
final _UiPathFactory pathFactory = () {
......
......@@ -627,7 +627,7 @@ void main() {
expect(appBarIsVisible(tester), true);
expect(appBarHeight(tester), 128.0);
final double initialAppBarHeight = 128.0;
const double initialAppBarHeight = 128.0;
final double initialTabBarHeight = tabBarHeight(tester);
// Scroll the not-pinned appbar, collapsing the expanded height. At this
......@@ -660,7 +660,7 @@ void main() {
expect(appBarIsVisible(tester), true);
expect(appBarHeight(tester), 128.0);
final double initialAppBarHeight = 128.0;
const double initialAppBarHeight = 128.0;
final double initialTabBarHeight = tabBarHeight(tester);
// Scroll the floating-pinned appbar, collapsing the expanded height. At this
......
......@@ -68,8 +68,8 @@ void main() {
});
test('MaterialPointArcTween', () {
final Offset begin = const Offset(180.0, 110.0);
final Offset end = const Offset(37.0, 250.0);
const Offset begin = const Offset(180.0, 110.0);
const Offset end = const Offset(37.0, 250.0);
MaterialPointArcTween tween = new MaterialPointArcTween(begin: begin, end: end);
expect(tween.lerp(0.0), begin);
......
......@@ -172,8 +172,8 @@ void main() {
// This test is very similar to the '...explicit splashColor and highlightColor' test
// in icon_button_test.dart. If you change this one, you may want to also change that one.
testWidgets('MaterialButton with explicit splashColor and highlightColor', (WidgetTester tester) async {
final Color directSplashColor = const Color(0xFF000011);
final Color directHighlightColor = const Color(0xFF000011);
const Color directSplashColor = const Color(0xFF000011);
const Color directHighlightColor = const Color(0xFF000011);
Widget buttonWidget = new Material(
child: new Center(
......@@ -207,8 +207,8 @@ void main() {
..rrect(color: directHighlightColor)
);
final Color themeSplashColor1 = const Color(0xFF001100);
final Color themeHighlightColor1 = const Color(0xFF001100);
const Color themeSplashColor1 = const Color(0xFF001100);
const Color themeHighlightColor1 = const Color(0xFF001100);
buttonWidget = new Material(
child: new Center(
......@@ -238,8 +238,8 @@ void main() {
..rrect(color: themeHighlightColor1)
);
final Color themeSplashColor2 = const Color(0xFF002200);
final Color themeHighlightColor2 = const Color(0xFF002200);
const Color themeSplashColor2 = const Color(0xFF002200);
const Color themeHighlightColor2 = const Color(0xFF002200);
await tester.pumpWidget(
new Directionality(
......
......@@ -178,13 +178,13 @@ void main() {
});
testWidgets('Chip in row works ok', (WidgetTester tester) async {
final TextStyle style = const TextStyle(fontFamily: 'Ahem', fontSize: 10.0);
const TextStyle style = const TextStyle(fontFamily: 'Ahem', fontSize: 10.0);
await tester.pumpWidget(
new MaterialApp(
home: new Material(
child: new Row(
children: <Widget>[
new Chip(label: const Text('Test'), labelStyle: style),
children: const <Widget>[
const Chip(label: const Text('Test'), labelStyle: style),
],
),
),
......@@ -196,8 +196,8 @@ void main() {
new MaterialApp(
home: new Material(
child: new Row(
children: <Widget>[
new Flexible(child: new Chip(label: const Text('Test'), labelStyle: style)),
children: const <Widget>[
const Flexible(child: const Chip(label: const Text('Test'), labelStyle: style)),
],
),
),
......@@ -209,8 +209,8 @@ void main() {
new MaterialApp(
home: new Material(
child: new Row(
children: <Widget>[
new Expanded(child: new Chip(label: const Text('Test'), labelStyle: style)),
children: const <Widget>[
const Expanded(child: const Chip(label: const Text('Test'), labelStyle: style)),
],
),
),
......
......@@ -11,7 +11,7 @@ const List<int> accentKeys = const <int>[100, 200, 400, 700];
void main() {
test('MaterialColor basic functionality', () {
final MaterialColor color = const MaterialColor(
const MaterialColor color = const MaterialColor(
500,
const <int, Color>{
50: const Color(50),
......
......@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Drawer control test', (WidgetTester tester) async {
final Key containerKey = const Key('container');
const Key containerKey = const Key('container');
await tester.pumpWidget(
new MaterialApp(
......
......@@ -207,7 +207,7 @@ void main() {
// Regression test for https://github.com/flutter/flutter/issues/12053
// Positions a DropdownButton at the left and right edges of the screen,
// forcing it to be sized down to the viewport width
final String value = 'foo';
const String value = 'foo';
final UniqueKey itemKey = new UniqueKey();
await tester.pumpWidget(
new MaterialApp(
......@@ -220,7 +220,7 @@ void main() {
new DropdownMenuItem<String>(
key: itemKey,
value: value,
child: new Text(value),
child: const Text(value),
),
],
onChanged: (_) {},
......@@ -293,7 +293,7 @@ void main() {
for (TextDirection textDirection in TextDirection.values) {
testWidgets('Dropdown button aligns selected menu item ($textDirection)', (WidgetTester tester) async {
final Key buttonKey = new UniqueKey();
final String value = 'two';
const String value = 'two';
Widget build() => buildFrame(buttonKey: buttonKey, value: value, textDirection: textDirection);
......@@ -339,7 +339,7 @@ void main() {
testWidgets('Dropdown button with isDense:true aligns selected menu item', (WidgetTester tester) async {
final Key buttonKey = new UniqueKey();
final String value = 'two';
const String value = 'two';
Widget build() => buildFrame(buttonKey: buttonKey, value: value, isDense: true);
......
......@@ -7,13 +7,13 @@ import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
void main() {
final Color _dividerColor = const Color(0x1f333333);
const Color _dividerColor = const Color(0x1f333333);
testWidgets('ExpansionTile initial state', (WidgetTester tester) async {
final Key topKey = new UniqueKey();
final Key expandedKey = const PageStorageKey<String>('expanded');
final Key collapsedKey = const PageStorageKey<String>('collapsed');
final Key defaultKey = const PageStorageKey<String>('default');
const Key expandedKey = const PageStorageKey<String>('expanded');
const Key collapsedKey = const PageStorageKey<String>('collapsed');
const Key defaultKey = const PageStorageKey<String>('default');
final Key tileKey = new UniqueKey();
......@@ -50,7 +50,7 @@ void main() {
)
]
),
new ExpansionTile(
const ExpansionTile(
key: defaultKey,
title: const Text('Default'),
children: const <Widget>[
......
......@@ -194,8 +194,8 @@ void main() {
// This test is very similar to the '...explicit splashColor and highlightColor' test
// in buttons_test.dart. If you change this one, you may want to also change that one.
testWidgets('IconButton with explicit splashColor and highlightColor', (WidgetTester tester) async {
final Color directSplashColor = const Color(0xFF00000F);
final Color directHighlightColor = const Color(0xFF0000F0);
const Color directSplashColor = const Color(0xFF00000F);
const Color directHighlightColor = const Color(0xFF0000F0);
Widget buttonWidget = wrap(
child: new IconButton(
......@@ -225,8 +225,8 @@ void main() {
..circle(color: directHighlightColor)
);
final Color themeSplashColor1 = const Color(0xFF000F00);
final Color themeHighlightColor1 = const Color(0xFF00FF00);
const Color themeSplashColor1 = const Color(0xFF000F00);
const Color themeHighlightColor1 = const Color(0xFF00FF00);
buttonWidget = wrap(
child: new IconButton(
......@@ -252,8 +252,8 @@ void main() {
..circle(color: themeHighlightColor1)
);
final Color themeSplashColor2 = const Color(0xFF002200);
final Color themeHighlightColor2 = const Color(0xFF001100);
const Color themeSplashColor2 = const Color(0xFF002200);
const Color themeHighlightColor2 = const Color(0xFF001100);
await tester.pumpWidget(
new Theme(
......
......@@ -10,8 +10,8 @@ import '../rendering/mock_canvas.dart';
void main() {
testWidgets('The InkWell widget renders an ink splash', (WidgetTester tester) async {
final Color highlightColor = const Color(0xAAFF0000);
final Color splashColor = const Color(0xAA0000FF);
const Color highlightColor = const Color(0xAAFF0000);
const Color splashColor = const Color(0xAA0000FF);
final BorderRadius borderRadius = new BorderRadius.circular(6.0);
await tester.pumpWidget(
......@@ -52,8 +52,8 @@ void main() {
});
testWidgets('The InkWell widget renders an ink ripple', (WidgetTester tester) async {
final Color highlightColor = const Color(0xAAFF0000);
final Color splashColor = const Color(0xB40000FF);
const Color highlightColor = const Color(0xAAFF0000);
const Color splashColor = const Color(0xB40000FF);
final BorderRadius borderRadius = new BorderRadius.circular(6.0);
await tester.pumpWidget(
......@@ -111,7 +111,7 @@ void main() {
final double radius = arguments[1];
final Paint paint = arguments[2];
final Offset expectedCenter = tapDownOffset + const Offset(17.0, 17.0);
final double expectedRadius = 56.0;
const double expectedRadius = 56.0;
if (offsetsAreClose(center, expectedCenter) && radiiAreClose(radius, expectedRadius) && paint.color.alpha == 120)
return true;
throw '''
......@@ -129,7 +129,7 @@ void main() {
final double radius = arguments[1];
final Paint paint = arguments[2];
final Offset expectedCenter = tapDownOffset + const Offset(29.0, 29.0);
final double expectedRadius = 73.0;
const double expectedRadius = 73.0;
if (offsetsAreClose(center, expectedCenter) && radiiAreClose(radius, expectedRadius) && paint.color.alpha == 180)
return true;
throw '''
......@@ -149,7 +149,7 @@ void main() {
final double radius = arguments[1];
final Paint paint = arguments[2];
final Offset expectedCenter = inkWellCenter;
final double expectedRadius = 105.0;
const double expectedRadius = 105.0;
if (offsetsAreClose(center, expectedCenter) && radiiAreClose(radius, expectedRadius) && paint.color.alpha == 180)
return true;
throw '''
......@@ -166,7 +166,7 @@ void main() {
final double radius = arguments[1];
final Paint paint = arguments[2];
final Offset expectedCenter = inkWellCenter;
final double expectedRadius = 105.0;
const double expectedRadius = 105.0;
if (offsetsAreClose(center, expectedCenter) && radiiAreClose(radius, expectedRadius) && paint.color.alpha == 0)
return true;
throw '''
......
......@@ -1034,7 +1034,7 @@ void main() {
});
testWidgets('InputDecorator.toString()', (WidgetTester tester) async {
final Widget child = const InputDecorator(
const Widget child = const InputDecorator(
key: const Key('key'),
decoration: const InputDecoration(),
baseStyle: const TextStyle(),
......
......@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('English translations exist for all MaterialLocalizations properties', (WidgetTester tester) async {
final MaterialLocalizations localizations = const DefaultMaterialLocalizations();
const MaterialLocalizations localizations = const DefaultMaterialLocalizations();
expect(localizations.openAppDrawerTooltip, isNotNull);
expect(localizations.backButtonTooltip, isNotNull);
......
......@@ -1044,7 +1044,7 @@ void main() {
bool isDivider(Widget widget, bool top, bool bottom) {
final DecoratedBox box = widget;
final BorderSide side = const BorderSide(color: const Color(0x1F000000), width: 0.5);
const BorderSide side = const BorderSide(color: const Color(0x1F000000), width: 0.5);
return box.decoration == new BoxDecoration(
border: new Border(
......
......@@ -188,7 +188,7 @@ void main() {
testWidgets('Slider has a customizable active color',
(WidgetTester tester) async {
final Color customColor = const Color(0xFF4CD964);
const Color customColor = const Color(0xFF4CD964);
final ThemeData theme = new ThemeData(platform: TargetPlatform.android);
Widget buildApp(Color activeColor) {
return new Directionality(
......@@ -226,7 +226,7 @@ void main() {
testWidgets('Slider has a customizable inactive color',
(WidgetTester tester) async {
final Color customColor = const Color(0xFF4CD964);
const Color customColor = const Color(0xFF4CD964);
final ThemeData theme = new ThemeData(platform: TargetPlatform.android);
Widget buildApp(Color inactiveColor) {
return new Directionality(
......
......@@ -7,16 +7,16 @@ import 'package:flutter/material.dart';
void main() {
testWidgets('SnackBar control test', (WidgetTester tester) async {
final String helloSnackBar = 'Hello SnackBar';
final Key tapTarget = const Key('tap-target');
const String helloSnackBar = 'Hello SnackBar';
const Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp(
home: new Scaffold(
body: new Builder(
builder: (BuildContext context) {
return new GestureDetector(
onTap: () {
Scaffold.of(context).showSnackBar(new SnackBar(
content: new Text(helloSnackBar),
Scaffold.of(context).showSnackBar(const SnackBar(
content: const Text(helloSnackBar),
duration: const Duration(seconds: 2)
));
},
......@@ -53,7 +53,7 @@ void main() {
testWidgets('SnackBar twice test', (WidgetTester tester) async {
int snackBarCount = 0;
final Key tapTarget = const Key('tap-target');
const Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp(
home: new Scaffold(
body: new Builder(
......@@ -128,7 +128,7 @@ void main() {
testWidgets('SnackBar cancel test', (WidgetTester tester) async {
int snackBarCount = 0;
final Key tapTarget = const Key('tap-target');
const Key tapTarget = const Key('tap-target');
int time;
ScaffoldFeatureController<SnackBar, SnackBarClosedReason> lastController;
await tester.pumpWidget(new MaterialApp(
......@@ -214,7 +214,7 @@ void main() {
testWidgets('SnackBar dismiss test', (WidgetTester tester) async {
int snackBarCount = 0;
final Key tapTarget = const Key('tap-target');
const Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp(
home: new Scaffold(
body: new Builder(
......
......@@ -231,7 +231,7 @@ void main() {
testWidgets('Scrollable TabBar tap centers selected tab', (WidgetTester tester) async {
final List<String> tabs = <String>['AAAAAA', 'BBBBBB', 'CCCCCC', 'DDDDDD', 'EEEEEE', 'FFFFFF', 'GGGGGG', 'HHHHHH', 'IIIIII', 'JJJJJJ', 'KKKKKK', 'LLLLLL'];
final Key tabBarKey = const Key('TabBar');
const Key tabBarKey = const Key('TabBar');
await tester.pumpWidget(buildFrame(tabs: tabs, value: 'AAAAAA', isScrollable: true, tabBarKey: tabBarKey));
final TabController controller = DefaultTabController.of(tester.element(find.text('AAAAAA')));
expect(controller, isNotNull);
......@@ -251,7 +251,7 @@ void main() {
testWidgets('TabBar can be scrolled independent of the selection', (WidgetTester tester) async {
final List<String> tabs = <String>['AAAA', 'BBBB', 'CCCC', 'DDDD', 'EEEE', 'FFFF', 'GGGG', 'HHHH', 'IIII', 'JJJJ', 'KKKK', 'LLLL'];
final Key tabBarKey = const Key('TabBar');
const Key tabBarKey = const Key('TabBar');
await tester.pumpWidget(buildFrame(tabs: tabs, value: 'AAAA', isScrollable: true, tabBarKey: tabBarKey));
final TabController controller = DefaultTabController.of(tester.element(find.text('AAAA')));
expect(controller, isNotNull);
......
......@@ -303,7 +303,7 @@ void main() {
expect(controller.selection.baseOffset, -1);
expect(controller.selection.extentOffset, -1);
final String testValue = 'abc def ghi';
const String testValue = 'abc def ghi';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
......@@ -328,7 +328,7 @@ void main() {
)
);
final String testValue = 'abc def ghi';
const String testValue = 'abc def ghi';
await tester.enterText(find.byType(TextField), testValue);
expect(controller.value.text, testValue);
await skipPastScrollingAnimation(tester);
......@@ -358,7 +358,7 @@ void main() {
),
);
final String testValue = 'abc def ghi';
const String testValue = 'abc def ghi';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
......@@ -419,7 +419,7 @@ void main() {
),
);
final String testValue = 'abc def ghi';
const String testValue = 'abc def ghi';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
......@@ -477,7 +477,7 @@ void main() {
),
);
final String testValue = 'abc def ghi';
const String testValue = 'abc def ghi';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
......@@ -587,7 +587,7 @@ void main() {
);
final String testValue = kThreeLines;
final String cutValue = 'First line of stuff ';
const String cutValue = 'First line of stuff ';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
......@@ -1603,11 +1603,11 @@ void main() {
testWidgets('maxLength shows warning when maxLengthEnforced is false.', (WidgetTester tester) async {
final TextEditingController textController = new TextEditingController();
final TextStyle testStyle = const TextStyle(color: Colors.deepPurpleAccent);
const TextStyle testStyle = const TextStyle(color: Colors.deepPurpleAccent);
await tester.pumpWidget(boilerplate(
child: new TextField(
decoration: new InputDecoration(errorStyle: testStyle),
decoration: const InputDecoration(errorStyle: testStyle),
controller: textController,
maxLength: 10,
maxLengthEnforced: false,
......@@ -1686,7 +1686,7 @@ void main() {
)
);
final String testValue = 'x';
const String testValue = 'x';
await tester.enterText(find.byType(TextField), testValue);
await skipPastScrollingAnimation(tester);
expect(controller.selection.baseOffset, -1);
......
......@@ -199,9 +199,9 @@ void main() {
));
expect(find.text('A'), findsOneWidget);
final Key avatarA = const Key('A');
const Key avatarA = const Key('A');
await tester.pumpWidget(buildFrame(
currentAccountPicture: new CircleAvatar(key: avatarA, child: const Text('A')),
currentAccountPicture: const CircleAvatar(key: avatarA, child: const Text('A')),
accountName: const Text('accountName'),
));
expect(
......@@ -310,9 +310,9 @@ void main() {
));
expect(find.text('A'), findsOneWidget);
final Key avatarA = const Key('A');
const Key avatarA = const Key('A');
await tester.pumpWidget(buildFrame(
currentAccountPicture: new CircleAvatar(key: avatarA, child: const Text('A')),
currentAccountPicture: const CircleAvatar(key: avatarA, child: const Text('A')),
accountName: const Text('accountName'),
));
expect(
......
......@@ -179,8 +179,8 @@ void main() {
});
test('AlignmentGeometry add/subtract', () {
final AlignmentGeometry directional = const AlignmentDirectional(1.0, 2.0);
final AlignmentGeometry normal = const Alignment(3.0, 5.0);
const AlignmentGeometry directional = const AlignmentDirectional(1.0, 2.0);
const AlignmentGeometry normal = const Alignment(3.0, 5.0);
expect(directional.add(normal).resolve(TextDirection.ltr), const Alignment(4.0, 7.0));
expect(directional.add(normal).resolve(TextDirection.rtl), const Alignment(2.0, 7.0));
expect(normal.add(normal), normal * 2.0);
......
......@@ -142,17 +142,17 @@ void main() {
});
test('BorderRadius.lerp() crazy', () {
final BorderRadius a = const BorderRadius.only(
const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
final BorderRadius b = const BorderRadius.only(
const BorderRadius b = const BorderRadius.only(
topRight: const Radius.elliptical(100.0, 110.0),
bottomLeft: const Radius.elliptical(120.0, 130.0),
bottomRight: const Radius.elliptical(140.0, 150.0),
);
final BorderRadius c = const BorderRadius.only(
const BorderRadius c = const BorderRadius.only(
topLeft: const Radius.elliptical(5.0, 10.0), // 10,20 -> 0
topRight: const Radius.elliptical(65.0, 75.0), // 30,40 -> 100,110
bottomLeft: const Radius.elliptical(85.0, 95.0), // 50,60 -> 120,130
......@@ -321,17 +321,17 @@ void main() {
});
test('BorderRadiusDirectional.lerp() crazy', () {
final BorderRadiusDirectional a = const BorderRadiusDirectional.only(
const BorderRadiusDirectional a = const BorderRadiusDirectional.only(
topStart: const Radius.elliptical(10.0, 20.0),
topEnd: const Radius.elliptical(30.0, 40.0),
bottomStart: const Radius.elliptical(50.0, 60.0),
);
final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
);
final BorderRadiusDirectional c = const BorderRadiusDirectional.only(
const BorderRadiusDirectional c = const BorderRadiusDirectional.only(
topStart: const Radius.elliptical(5.0, 10.0), // 10,20 -> 0
topEnd: const Radius.elliptical(65.0, 75.0), // 30,40 -> 100,110
bottomStart: const Radius.elliptical(85.0, 95.0), // 50,60 -> 120,130
......@@ -341,23 +341,23 @@ void main() {
});
test('BorderRadiusGeometry.lerp()', () {
final BorderRadius a = const BorderRadius.only(
const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
);
final BorderRadius ltr = const BorderRadius.only(
const BorderRadius ltr = const BorderRadius.only(
topLeft: const Radius.elliptical(5.0, 10.0), // 10,20 -> 0
topRight: const Radius.elliptical(65.0, 75.0), // 30,40 -> 100,110
bottomLeft: const Radius.elliptical(85.0, 95.0), // 50,60 -> 120,130
bottomRight: const Radius.elliptical(70.0, 75.0), // 0,0 -> 140,150
);
final BorderRadius rtl = const BorderRadius.only(
const BorderRadius rtl = const BorderRadius.only(
topLeft: const Radius.elliptical(55.0, 65.0), // 10,20 -> 100,110
topRight: const Radius.elliptical(15.0, 20.0), // 30,40 -> 0,0
bottomLeft: const Radius.elliptical(95.0, 105.0), // 50,60 -> 140,150
......@@ -370,12 +370,12 @@ void main() {
});
test('BorderRadiusGeometry subtract', () {
final BorderRadius a = const BorderRadius.only(
const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
......@@ -395,12 +395,12 @@ void main() {
});
test('BorderRadiusGeometry add', () {
final BorderRadius a = const BorderRadius.only(
const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
......@@ -420,12 +420,12 @@ void main() {
});
test('BorderRadiusGeometry add and multiply', () {
final BorderRadius a = const BorderRadius.only(
const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
......@@ -445,23 +445,23 @@ void main() {
});
test('BorderRadiusGeometry add and subtract', () {
final BorderRadius a = const BorderRadius.only(
const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(300.0, 500.0),
);
final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(30.0, 50.0),
);
final BorderRadius c = const BorderRadius.only(
const BorderRadius c = const BorderRadius.only(
bottomLeft: const Radius.elliptical(3.0, 5.0),
);
final BorderRadius ltr = const BorderRadius.only(
const BorderRadius ltr = const BorderRadius.only(
topLeft: const Radius.elliptical(300.0, 500.0), // tL + 0 - 0
topRight: const Radius.elliptical(30.0, 50.0), // 0 + tE - 0
bottomLeft: const Radius.elliptical(-3.0, -5.0), // 0 + 0 - bL
bottomRight: Radius.zero, // 0 + 0 - 0
);
final BorderRadius rtl = const BorderRadius.only(
const BorderRadius rtl = const BorderRadius.only(
topLeft: const Radius.elliptical(330.0, 550.0), // tL + tE - 0
topRight: Radius.zero, // 0 + 0 - 0
bottomLeft: const Radius.elliptical(-3.0, -5.0), // 0 + 0 - bL
......@@ -472,32 +472,32 @@ void main() {
});
test('BorderRadiusGeometry add and subtract, more', () {
final BorderRadius a = const BorderRadius.only(
const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(300.0, 300.0),
topRight: const Radius.elliptical(500.0, 500.0),
bottomLeft: const Radius.elliptical(700.0, 700.0),
bottomRight: const Radius.elliptical(900.0, 900.0),
);
final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topStart: const Radius.elliptical(30.0, 30.0),
topEnd: const Radius.elliptical(50.0, 50.0),
bottomStart: const Radius.elliptical(70.0, 70.0),
bottomEnd: const Radius.elliptical(90.0, 90.0),
);
final BorderRadius c = const BorderRadius.only(
const BorderRadius c = const BorderRadius.only(
topLeft: const Radius.elliptical(3.0, 3.0),
topRight: const Radius.elliptical(5.0, 5.0),
bottomLeft: const Radius.elliptical(7.0, 7.0),
bottomRight: const Radius.elliptical(9.0, 9.0),
);
final BorderRadius ltr = const BorderRadius.only(
const BorderRadius ltr = const BorderRadius.only(
topLeft: const Radius.elliptical(327.0, 327.0), // tL + tS - tL
topRight: const Radius.elliptical(545.0, 545.0), // tR + tE - tR
bottomLeft: const Radius.elliptical(763.0, 763.0), // bL + bS - bL
bottomRight: const Radius.elliptical(981.0, 981.0), // bR + bE - bR
);
final BorderRadius rtl = const BorderRadius.only(
const BorderRadius rtl = const BorderRadius.only(
topLeft: const Radius.elliptical(347.0, 347.0), // tL + tE - tL
topRight: const Radius.elliptical(525.0, 525.0), // tR + TS - tR
bottomLeft: const Radius.elliptical(783.0, 783.0), // bL + bE + bL
......@@ -508,24 +508,24 @@ void main() {
});
test('BorderRadiusGeometry operators', () {
final BorderRadius a = const BorderRadius.only(
const BorderRadius a = const BorderRadius.only(
topLeft: const Radius.elliptical(10.0, 20.0),
topRight: const Radius.elliptical(30.0, 40.0),
bottomLeft: const Radius.elliptical(50.0, 60.0),
);
final BorderRadiusDirectional b = const BorderRadiusDirectional.only(
const BorderRadiusDirectional b = const BorderRadiusDirectional.only(
topEnd: const Radius.elliptical(100.0, 110.0),
bottomStart: const Radius.elliptical(120.0, 130.0),
bottomEnd: const Radius.elliptical(140.0, 150.0),
);
final BorderRadius ltr = const BorderRadius.only(
const BorderRadius ltr = const BorderRadius.only(
topLeft: const Radius.elliptical(5.0, 10.0), // 10,20 -> 0
topRight: const Radius.elliptical(65.0, 75.0), // 30,40 -> 100,110
bottomLeft: const Radius.elliptical(85.0, 95.0), // 50,60 -> 120,130
bottomRight: const Radius.elliptical(70.0, 75.0), // 0,0 -> 140,150
);
final BorderRadius rtl = const BorderRadius.only(
const BorderRadius rtl = const BorderRadius.only(
topLeft: const Radius.elliptical(55.0, 65.0), // 10,20 -> 100,110
topRight: const Radius.elliptical(15.0, 20.0), // 30,40 -> 0,0
bottomLeft: const Radius.elliptical(95.0, 105.0), // 50,60 -> 140,150
......
......@@ -32,20 +32,20 @@ void main() {
);
});
test('BorderSide - merging', () {
final BorderSide blue = const BorderSide(color: const Color(0xFF0000FF));
final BorderSide blue2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0);
final BorderSide green = const BorderSide(color: const Color(0xFF00FF00));
final BorderSide green2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0);
final BorderSide green3 = const BorderSide(color: const Color(0xFF00FF00), width: 3.0);
final BorderSide green5 = const BorderSide(color: const Color(0xFF00FF00), width: 5.0);
final BorderSide none = const BorderSide(style: BorderStyle.none);
final BorderSide none2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0, style: BorderStyle.none);
final BorderSide none3 = const BorderSide(style: BorderStyle.none, width: 3.0);
final BorderSide side2 = const BorderSide(width: 2.0);
final BorderSide side3 = const BorderSide(width: 3.0);
final BorderSide side5 = const BorderSide(width: 5.0);
final BorderSide solid = const BorderSide(style: BorderStyle.solid);
final BorderSide yellowNone = const BorderSide(style: BorderStyle.none, color: const Color(0xFFFFFF00), width: 0.0);
const BorderSide blue = const BorderSide(color: const Color(0xFF0000FF));
const BorderSide blue2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0);
const BorderSide green = const BorderSide(color: const Color(0xFF00FF00));
const BorderSide green2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0);
const BorderSide green3 = const BorderSide(color: const Color(0xFF00FF00), width: 3.0);
const BorderSide green5 = const BorderSide(color: const Color(0xFF00FF00), width: 5.0);
const BorderSide none = const BorderSide(style: BorderStyle.none);
const BorderSide none2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0, style: BorderStyle.none);
const BorderSide none3 = const BorderSide(style: BorderStyle.none, width: 3.0);
const BorderSide side2 = const BorderSide(width: 2.0);
const BorderSide side3 = const BorderSide(width: 3.0);
const BorderSide side5 = const BorderSide(width: 5.0);
const BorderSide solid = const BorderSide(style: BorderStyle.solid);
const BorderSide yellowNone = const BorderSide(style: BorderStyle.none, color: const Color(0xFFFFFF00), width: 0.0);
// canMerge
expect( BorderSide.canMerge(BorderSide.none, BorderSide.none), isTrue);
expect( BorderSide.canMerge(BorderSide.none, side2), isTrue);
......@@ -92,20 +92,20 @@ void main() {
expect( BorderSide.merge(yellowNone, yellowNone), BorderSide.none);
});
test('BorderSide - asserts when copied incorrectly', () {
final BorderSide green2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0);
final BorderSide blue3 = const BorderSide(color: const Color(0xFF0000FF), width: 3.0);
final BorderSide blue2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0);
final BorderSide green3 = const BorderSide(color: const Color(0xFF00FF00), width: 3.0);
final BorderSide none2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0, style: BorderStyle.none);
const BorderSide green2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0);
const BorderSide blue3 = const BorderSide(color: const Color(0xFF0000FF), width: 3.0);
const BorderSide blue2 = const BorderSide(color: const Color(0xFF0000FF), width: 2.0);
const BorderSide green3 = const BorderSide(color: const Color(0xFF00FF00), width: 3.0);
const BorderSide none2 = const BorderSide(color: const Color(0xFF00FF00), width: 2.0, style: BorderStyle.none);
expect(green2.copyWith(color: const Color(0xFF0000FF), width: 3.0), blue3);
expect(green2.copyWith(width: 3.0), green3);
expect(green2.copyWith(color: const Color(0xFF0000FF)), blue2);
expect(green2.copyWith(style: BorderStyle.none), none2);
});
test('BorderSide - scale', () {
final BorderSide side3 = const BorderSide(width: 3.0, color: const Color(0xFF0000FF));
final BorderSide side6 = const BorderSide(width: 6.0, color: const Color(0xFF0000FF));
final BorderSide none = const BorderSide(style: BorderStyle.none, width: 0.0, color: const Color(0xFF0000FF));
const BorderSide side3 = const BorderSide(width: 3.0, color: const Color(0xFF0000FF));
const BorderSide side6 = const BorderSide(width: 6.0, color: const Color(0xFF0000FF));
const BorderSide none = const BorderSide(style: BorderStyle.none, width: 0.0, color: const Color(0xFF0000FF));
expect(side3.scale(2.0), side6);
expect(side6.scale(0.5), side3);
expect(side6.scale(0.0), none);
......@@ -125,9 +125,9 @@ void main() {
expect(paint2.blendMode, BlendMode.srcOver);
});
test('BorderSide - won\'t lerp into negative widths', () {
final BorderSide side0 = const BorderSide(width: 0.0);
final BorderSide side1 = const BorderSide(width: 1.0);
final BorderSide side2 = const BorderSide(width: 2.0);
const BorderSide side0 = const BorderSide(width: 0.0);
const BorderSide side1 = const BorderSide(width: 1.0);
const BorderSide side2 = const BorderSide(width: 2.0);
expect(BorderSide.lerp(side2, side1, 10.0), BorderSide.none);
expect(BorderSide.lerp(side1, side2, -10.0), BorderSide.none);
expect(BorderSide.lerp(side0, side1, 2.0), side2);
......
......@@ -15,30 +15,30 @@ void main() {
});
test('Border.merge', () {
final BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
final BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
final BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
final BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
const BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
const BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
const BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
const BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
expect(
Border.merge(
new Border(top: yellow2),
new Border(right: magenta3),
const Border(top: yellow2),
const Border(right: magenta3),
),
new Border(top: yellow2, right: magenta3),
const Border(top: yellow2, right: magenta3),
);
expect(
Border.merge(
new Border(bottom: magenta3),
new Border(bottom: magenta3),
const Border(bottom: magenta3),
const Border(bottom: magenta3),
),
new Border(bottom: magenta6),
const Border(bottom: magenta6),
);
expect(
Border.merge(
new Border(left: magenta3, right: yellowNone0),
new Border(right: yellow2),
const Border(left: magenta3, right: yellowNone0),
const Border(right: yellow2),
),
new Border(left: magenta3, right: yellow2),
const Border(left: magenta3, right: yellow2),
);
expect(
Border.merge(const Border(), const Border()),
......@@ -46,43 +46,43 @@ void main() {
);
expect(
() => Border.merge(
new Border(left: magenta3),
new Border(left: yellow2),
const Border(left: magenta3),
const Border(left: yellow2),
),
throwsAssertionError,
);
});
test('Border.add', () {
final BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
final BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
final BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
final BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
const BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
const BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
const BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
const BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
expect(
new Border(top: yellow2) + new Border(right: magenta3),
new Border(top: yellow2, right: magenta3),
const Border(top: yellow2) + const Border(right: magenta3),
const Border(top: yellow2, right: magenta3),
);
expect(
new Border(bottom: magenta3) + new Border(bottom: magenta3),
new Border(bottom: magenta6),
const Border(bottom: magenta3) + const Border(bottom: magenta3),
const Border(bottom: magenta6),
);
expect(
new Border(left: magenta3, right: yellowNone0) + new Border(right: yellow2),
new Border(left: magenta3, right: yellow2),
const Border(left: magenta3, right: yellowNone0) + const Border(right: yellow2),
const Border(left: magenta3, right: yellow2),
);
expect(
const Border() + const Border(),
const Border(),
);
expect(
new Border(left: magenta3) + new Border(left: yellow2),
const Border(left: magenta3) + const Border(left: yellow2),
isNot(const isInstanceOf<Border>()), // see shape_border_test.dart for better tests of this case
);
final Border b3 = new Border(top: magenta3);
final Border b6 = new Border(top: magenta6);
const Border b3 = const Border(top: magenta3);
const Border b6 = const Border(top: magenta6);
expect(b3 + b3, b6);
final Border b0 = new Border(top: yellowNone0);
final Border bZ = const Border();
const Border b0 = const Border(top: yellowNone0);
const Border bZ = const Border();
expect(b0 + b0, bZ);
expect(bZ + bZ, bZ);
expect(b0 + bZ, bZ);
......@@ -90,16 +90,16 @@ void main() {
});
test('Border.scale', () {
final BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
final BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
final BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
final BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
final Border b3 = new Border(left: magenta3);
final Border b6 = new Border(left: magenta6);
const BorderSide magenta3 = const BorderSide(color: const Color(0xFFFF00FF), width: 3.0);
const BorderSide magenta6 = const BorderSide(color: const Color(0xFFFF00FF), width: 6.0);
const BorderSide yellow2 = const BorderSide(color: const Color(0xFFFFFF00), width: 2.0);
const BorderSide yellowNone0 = const BorderSide(color: const Color(0xFFFFFF00), width: 0.0, style: BorderStyle.none);
const Border b3 = const Border(left: magenta3);
const Border b6 = const Border(left: magenta6);
expect(b3.scale(2.0), b6);
final Border bY0 = new Border(top: yellowNone0);
const Border bY0 = const Border(top: yellowNone0);
expect(bY0.scale(3.0), bY0);
final Border bY2 = new Border(top: yellow2);
const Border bY2 = const Border(top: yellow2);
expect(bY2.scale(0.0), bY0);
});
......@@ -195,13 +195,13 @@ void main() {
});
test('Border.lerp', () {
final Border visualWithTop10 = const Border(top: const BorderSide(width: 10.0));
final Border atMinus100 = const Border(left: const BorderSide(width: 0.0), right: const BorderSide(width: 300.0));
final Border at0 = const Border(left: const BorderSide(width: 100.0), right: const BorderSide(width: 200.0));
final Border at25 = const Border(left: const BorderSide(width: 125.0), right: const BorderSide(width: 175.0));
final Border at75 = const Border(left: const BorderSide(width: 175.0), right: const BorderSide(width: 125.0));
final Border at100 = const Border(left: const BorderSide(width: 200.0), right: const BorderSide(width: 100.0));
final Border at200 = const Border(left: const BorderSide(width: 300.0), right: const BorderSide(width: 0.0));
const Border visualWithTop10 = const Border(top: const BorderSide(width: 10.0));
const Border atMinus100 = const Border(left: const BorderSide(width: 0.0), right: const BorderSide(width: 300.0));
const Border at0 = const Border(left: const BorderSide(width: 100.0), right: const BorderSide(width: 200.0));
const Border at25 = const Border(left: const BorderSide(width: 125.0), right: const BorderSide(width: 175.0));
const Border at75 = const Border(left: const BorderSide(width: 175.0), right: const BorderSide(width: 125.0));
const Border at100 = const Border(left: const BorderSide(width: 200.0), right: const BorderSide(width: 100.0));
const Border at200 = const Border(left: const BorderSide(width: 300.0), right: const BorderSide(width: 0.0));
expect(Border.lerp(null, null, -1.0), null);
expect(Border.lerp(visualWithTop10, null, -1.0), const Border(top: const BorderSide(width: 20.0)));
......
......@@ -9,7 +9,7 @@ import '../rendering/mock_canvas.dart';
void main() {
test('BoxDecoration with BorderRadiusDirectional', () {
final BoxDecoration decoration = const BoxDecoration(
const BoxDecoration decoration = const BoxDecoration(
color: const Color(0xFF000000),
borderRadius: const BorderRadiusDirectional.only(topStart: const Radius.circular(100.0)),
);
......
......@@ -7,7 +7,7 @@ import 'package:flutter/painting.dart';
void main() {
test('BorderSide control test', () {
final BorderSide side1 = const BorderSide();
const BorderSide side1 = const BorderSide();
final BorderSide side2 = side1.copyWith(
color: const Color(0xFF00FFFF),
width: 2.0,
......@@ -40,7 +40,7 @@ void main() {
});
test('BorderSide toString test', () {
final BorderSide side1 = const BorderSide();
const BorderSide side1 = const BorderSide();
final BorderSide side2 = side1.copyWith(
color: const Color(0xFF00FFFF),
width: 2.0,
......@@ -87,7 +87,7 @@ void main() {
});
test('BoxShadow control test', () {
final BoxShadow shadow1 = const BoxShadow(blurRadius: 4.0);
const BoxShadow shadow1 = const BoxShadow(blurRadius: 4.0);
final BoxShadow shadow2 = BoxShadow.lerp(null, shadow1, 0.25);
final BoxShadow shadow3 = BoxShadow.lerp(shadow1, null, 0.25);
......
......@@ -10,9 +10,9 @@ import 'common_matchers.dart';
void main() {
test('CircleBorder', () {
final CircleBorder c10 = const CircleBorder(side: const BorderSide(width: 10.0));
final CircleBorder c15 = const CircleBorder(side: const BorderSide(width: 15.0));
final CircleBorder c20 = const CircleBorder(side: const BorderSide(width: 20.0));
const CircleBorder c10 = const CircleBorder(side: const BorderSide(width: 10.0));
const CircleBorder c15 = const CircleBorder(side: const BorderSide(width: 15.0));
const CircleBorder c20 = const CircleBorder(side: const BorderSide(width: 20.0));
expect(c10.dimensions, const EdgeInsets.all(10.0));
expect(c10.scale(2.0), c20);
expect(c20.scale(0.5), c10);
......
......@@ -93,8 +93,8 @@ void main() {
new TestRenderingFlutterBinding(); // initializes the imageCache
test('Decoration.lerp()', () {
final BoxDecoration a = const BoxDecoration(color: const Color(0xFFFFFFFF));
final BoxDecoration b = const BoxDecoration(color: const Color(0x00000000));
const BoxDecoration a = const BoxDecoration(color: const Color(0xFFFFFFFF));
const BoxDecoration b = const BoxDecoration(color: const Color(0x00000000));
BoxDecoration c = Decoration.lerp(a, b, 0.0);
expect(c.color, equals(a.color));
......@@ -117,7 +117,7 @@ void main() {
});
final TestCanvas canvas = new TestCanvas();
final ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero);
const ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero);
boxPainter.paint(canvas, Offset.zero, imageConfiguration);
// The onChanged callback should not be invoked during the call to boxPainter.paint
......@@ -136,7 +136,7 @@ void main() {
});
final TestCanvas canvas = new TestCanvas();
final ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero);
const ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero);
boxPainter.paint(canvas, Offset.zero, imageConfiguration);
// The onChanged callback should be invoked asynchronously.
......@@ -163,7 +163,7 @@ void main() {
final List<Invocation> invocations = <Invocation>[];
final TestCanvas canvas = new TestCanvas(invocations);
final ImageConfiguration imageConfiguration = const ImageConfiguration(
const ImageConfiguration imageConfiguration = const ImageConfiguration(
size: const Size(100.0, 100.0)
);
bool onChangedCalled = false;
......@@ -203,7 +203,7 @@ void main() {
});
test('DecorationImage test', () {
final ColorFilter colorFilter = const ui.ColorFilter.mode(const Color(0xFF00FF00), BlendMode.src);
const ColorFilter colorFilter = const ui.ColorFilter.mode(const Color(0xFF00FF00), BlendMode.src);
final DecorationImage backgroundImage = new DecorationImage(
image: new SynchronousTestImageProvider(),
colorFilter: colorFilter,
......@@ -284,11 +284,11 @@ void main() {
});
test('BoxDecoration.lerp - gradients', () {
final Gradient gradient = const LinearGradient(colors: const <Color>[ const Color(0x00000000), const Color(0xFFFFFFFF) ]);
const Gradient gradient = const LinearGradient(colors: const <Color>[ const Color(0x00000000), const Color(0xFFFFFFFF) ]);
expect(
BoxDecoration.lerp(
const BoxDecoration(),
new BoxDecoration(gradient: gradient),
const BoxDecoration(gradient: gradient),
-1.0,
),
const BoxDecoration(gradient: const LinearGradient(colors: const <Color>[ const Color(0x00000000), const Color(0x00FFFFFF) ]))
......@@ -296,7 +296,7 @@ void main() {
expect(
BoxDecoration.lerp(
const BoxDecoration(),
new BoxDecoration(gradient: gradient),
const BoxDecoration(gradient: gradient),
0.0,
),
const BoxDecoration()
......@@ -304,7 +304,7 @@ void main() {
expect(
BoxDecoration.lerp(
const BoxDecoration(),
new BoxDecoration(gradient: gradient),
const BoxDecoration(gradient: gradient),
0.25,
),
const BoxDecoration(gradient: const LinearGradient(colors: const <Color>[ const Color(0x00000000), const Color(0x40FFFFFF) ]))
......@@ -312,7 +312,7 @@ void main() {
expect(
BoxDecoration.lerp(
const BoxDecoration(),
new BoxDecoration(gradient: gradient),
const BoxDecoration(gradient: gradient),
0.75,
),
const BoxDecoration(gradient: const LinearGradient(colors: const <Color>[ const Color(0x00000000), const Color(0xBFFFFFFF) ]))
......@@ -320,18 +320,18 @@ void main() {
expect(
BoxDecoration.lerp(
const BoxDecoration(),
new BoxDecoration(gradient: gradient),
const BoxDecoration(gradient: gradient),
1.0,
),
new BoxDecoration(gradient: gradient)
const BoxDecoration(gradient: gradient)
);
expect(
BoxDecoration.lerp(
const BoxDecoration(),
new BoxDecoration(gradient: gradient),
const BoxDecoration(gradient: gradient),
2.0,
),
new BoxDecoration(gradient: gradient)
const BoxDecoration(gradient: gradient)
);
});
......
......@@ -39,8 +39,8 @@ void main() {
});
test('EdgeInsets.lerp()', () {
final EdgeInsets a = const EdgeInsets.all(10.0);
final EdgeInsets b = const EdgeInsets.all(20.0);
const EdgeInsets a = const EdgeInsets.all(10.0);
const EdgeInsets b = const EdgeInsets.all(20.0);
expect(EdgeInsets.lerp(a, b, 0.25), equals(a * 1.25));
expect(EdgeInsets.lerp(a, b, 0.25), equals(b * 0.625));
expect(EdgeInsets.lerp(a, b, 0.25), equals(a + const EdgeInsets.all(2.5)));
......@@ -95,7 +95,7 @@ void main() {
});
test('EdgeInsets copyWith', () {
final EdgeInsets sourceEdgeInsets = const EdgeInsets.only(left: 1.0, top: 2.0, bottom: 3.0, right: 4.0);
const EdgeInsets sourceEdgeInsets = const EdgeInsets.only(left: 1.0, top: 2.0, bottom: 3.0, right: 4.0);
final EdgeInsets copy = sourceEdgeInsets.copyWith(left: 5.0, top: 6.0);
expect(copy, const EdgeInsets.only(left: 5.0, top: 6.0, bottom: 3.0, right: 4.0));
});
......@@ -113,8 +113,8 @@ void main() {
});
test('EdgeInsetsGeometry.lerp(normal, ...)', () {
final EdgeInsets a = const EdgeInsets.all(10.0);
final EdgeInsets b = const EdgeInsets.all(20.0);
const EdgeInsets a = const EdgeInsets.all(10.0);
const EdgeInsets b = const EdgeInsets.all(20.0);
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(a * 1.25));
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(b * 0.625));
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(a + const EdgeInsets.all(2.5)));
......@@ -126,8 +126,8 @@ void main() {
});
test('EdgeInsetsGeometry.lerp(directional, ...)', () {
final EdgeInsetsDirectional a = const EdgeInsetsDirectional.only(start: 10.0, end: 10.0);
final EdgeInsetsDirectional b = const EdgeInsetsDirectional.only(start: 20.0, end: 20.0);
const EdgeInsetsDirectional a = const EdgeInsetsDirectional.only(start: 10.0, end: 10.0);
const EdgeInsetsDirectional b = const EdgeInsetsDirectional.only(start: 20.0, end: 20.0);
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(a * 1.25));
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(b * 0.625));
expect(EdgeInsetsGeometry.lerp(a, b, 0.25), equals(a + const EdgeInsetsDirectional.only(start: 2.5, end: 2.5)));
......
......@@ -7,7 +7,7 @@ import 'package:flutter/painting.dart';
void main() {
test('LinearGradient scale test', () {
final LinearGradient testGradient = const LinearGradient(
const LinearGradient testGradient = const LinearGradient(
begin: Alignment.bottomRight,
end: const Alignment(0.7, 1.0),
colors: const <Color>[
......@@ -30,7 +30,7 @@ void main() {
});
test('LinearGradient lerp test', () {
final LinearGradient testGradient1 = const LinearGradient(
const LinearGradient testGradient1 = const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomLeft,
colors: const <Color>[
......@@ -38,7 +38,7 @@ void main() {
const Color(0x66666666),
],
);
final LinearGradient testGradient2 = const LinearGradient(
const LinearGradient testGradient2 = const LinearGradient(
begin: Alignment.topRight,
end: Alignment.topLeft,
colors: const <Color>[
......@@ -153,7 +153,7 @@ void main() {
});
test('RadialGradient lerp test', () {
final RadialGradient testGradient1 = const RadialGradient(
const RadialGradient testGradient1 = const RadialGradient(
center: Alignment.topLeft,
radius: 20.0,
colors: const <Color>[
......@@ -161,7 +161,7 @@ void main() {
const Color(0x66666666),
],
);
final RadialGradient testGradient2 = const RadialGradient(
const RadialGradient testGradient2 = const RadialGradient(
center: Alignment.topRight,
radius: 10.0,
colors: const <Color>[
......@@ -182,7 +182,7 @@ void main() {
});
test('Gradient lerp test (with RadialGradient)', () {
final RadialGradient testGradient1 = const RadialGradient(
const RadialGradient testGradient1 = const RadialGradient(
center: Alignment.topLeft,
radius: 20.0,
colors: const <Color>[
......@@ -190,7 +190,7 @@ void main() {
const Color(0x66666666),
],
);
final RadialGradient testGradient2 = const RadialGradient(
const RadialGradient testGradient2 = const RadialGradient(
center: const Alignment(0.0, -1.0),
radius: 15.0,
colors: const <Color>[
......@@ -198,7 +198,7 @@ void main() {
const Color(0x77777777),
],
);
final RadialGradient testGradient3 = const RadialGradient(
const RadialGradient testGradient3 = const RadialGradient(
center: Alignment.topRight,
radius: 10.0,
colors: const <Color>[
......@@ -216,7 +216,7 @@ void main() {
});
test('Gradient lerp test (LinearGradient to RadialGradient)', () {
final LinearGradient testGradient1 = const LinearGradient(
const LinearGradient testGradient1 = const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: const <Color>[
......@@ -224,7 +224,7 @@ void main() {
const Color(0x66666666),
],
);
final RadialGradient testGradient2 = const RadialGradient(
const RadialGradient testGradient2 = const RadialGradient(
center: Alignment.center,
radius: 20.0,
colors: const <Color>[
......@@ -239,21 +239,21 @@ void main() {
});
test('Gradients can handle missing stops and report mismatched stops', () {
final LinearGradient test1a = const LinearGradient(
const LinearGradient test1a = const LinearGradient(
colors: const <Color>[
const Color(0x11111111),
const Color(0x22222222),
const Color(0x33333333),
],
);
final RadialGradient test1b = const RadialGradient(
const RadialGradient test1b = const RadialGradient(
colors: const <Color>[
const Color(0x11111111),
const Color(0x22222222),
const Color(0x33333333),
],
);
final LinearGradient test2a = const LinearGradient(
const LinearGradient test2a = const LinearGradient(
colors: const <Color>[
const Color(0x11111111),
const Color(0x22222222),
......@@ -261,7 +261,7 @@ void main() {
],
stops: const <double>[0.0, 1.0],
);
final RadialGradient test2b = const RadialGradient(
const RadialGradient test2b = const RadialGradient(
colors: const <Color>[
const Color(0x11111111),
const Color(0x22222222),
......
......@@ -38,7 +38,7 @@ void main() {
test('RoundedRectangleBorder and CircleBorder', () {
final RoundedRectangleBorder r = new RoundedRectangleBorder(side: BorderSide.none, borderRadius: new BorderRadius.circular(10.0));
final CircleBorder c = const CircleBorder(side: BorderSide.none);
const CircleBorder c = const CircleBorder(side: BorderSide.none);
final Rect rect = new Rect.fromLTWH(0.0, 0.0, 100.0, 20.0); // center is x=40..60 y=10
final Matcher looksLikeR = isPathThat(
includes: const <Offset>[ const Offset(30.0, 10.0), const Offset(50.0, 10.0), ],
......
......@@ -72,10 +72,10 @@ void main() {
});
test('Compound borders', () {
final BorderSide side1 = const BorderSide(color: const Color(0xFF00FF00));
final BorderSide side2 = const BorderSide(color: const Color(0xFF0000FF));
final BorderDirectional b1 = new BorderDirectional(top: side1, start: side1, end: side1, bottom: side1);
final BorderDirectional b2 = new BorderDirectional(top: side2, start: side2, end: side2, bottom: side2);
const BorderSide side1 = const BorderSide(color: const Color(0xFF00FF00));
const BorderSide side2 = const BorderSide(color: const Color(0xFF0000FF));
const BorderDirectional b1 = const BorderDirectional(top: side1, start: side1, end: side1, bottom: side1);
const BorderDirectional b2 = const BorderDirectional(top: side2, start: side2, end: side2, bottom: side2);
expect(
(b1 + b2).toString(),
'BorderDirectional(top: BorderSide(Color(0xff00ff00), 1.0, BorderStyle.solid), start: BorderSide(Color(0xff00ff00), 1.0, BorderStyle.solid), end: BorderSide(Color(0xff00ff00), 1.0, BorderStyle.solid), bottom: BorderSide(Color(0xff00ff00), 1.0, BorderStyle.solid)) + '
......
......@@ -15,12 +15,12 @@ void main() {
new TestRenderingFlutterBinding(); // initializes the imageCache
test('ShapeDecoration constructor', () {
final Color colorR = const Color(0xffff0000);
final Color colorG = const Color(0xff00ff00);
const Color colorR = const Color(0xffff0000);
const Color colorG = const Color(0xff00ff00);
final Gradient gradient = new LinearGradient(colors: <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(color: colorR, shape: null), throwsAssertionError);
expect(() => new ShapeDecoration(gradient: gradient, shape: null), throwsAssertionError);
expect(
new ShapeDecoration.fromBoxDecoration(const BoxDecoration(shape: BoxShape.circle)),
const ShapeDecoration(shape: const CircleBorder(side: BorderSide.none)),
......@@ -31,7 +31,7 @@ void main() {
);
expect(
new ShapeDecoration.fromBoxDecoration(new BoxDecoration(shape: BoxShape.circle, border: new Border.all(color: colorG))),
new ShapeDecoration(shape: new CircleBorder(side: new BorderSide(color: colorG))),
const ShapeDecoration(shape: const CircleBorder(side: const BorderSide(color: colorG))),
);
expect(
new ShapeDecoration.fromBoxDecoration(new BoxDecoration(shape: BoxShape.rectangle, border: new Border.all(color: colorR))),
......@@ -44,8 +44,8 @@ void main() {
});
test('ShapeDecoration.lerp and hit test', () {
final Decoration a = const ShapeDecoration(shape: const CircleBorder());
final Decoration b = const ShapeDecoration(shape: const RoundedRectangleBorder());
const Decoration a = const ShapeDecoration(shape: const CircleBorder());
const Decoration b = const ShapeDecoration(shape: const RoundedRectangleBorder());
expect(Decoration.lerp(a, b, 0.0), a);
expect(Decoration.lerp(a, b, 1.0), b);
const Size size = const Size(200.0, 100.0); // at t=0.5, width will be 150 (x=25 to x=175).
......
......@@ -10,9 +10,9 @@ import 'common_matchers.dart';
void main() {
test('StadiumBorder', () {
final StadiumBorder c10 = const StadiumBorder(side: const BorderSide(width: 10.0));
final StadiumBorder c15 = const StadiumBorder(side: const BorderSide(width: 15.0));
final StadiumBorder c20 = const StadiumBorder(side: const BorderSide(width: 20.0));
const StadiumBorder c10 = const StadiumBorder(side: const BorderSide(width: 10.0));
const StadiumBorder c15 = const StadiumBorder(side: const BorderSide(width: 15.0));
const StadiumBorder c20 = const StadiumBorder(side: const BorderSide(width: 20.0));
expect(c10.dimensions, const EdgeInsets.all(10.0));
expect(c10.scale(2.0), c20);
expect(c20.scale(0.5), c10);
......@@ -20,9 +20,9 @@ void main() {
expect(ShapeBorder.lerp(c10, c20, 0.5), c15);
expect(ShapeBorder.lerp(c10, c20, 1.0), c20);
final StadiumBorder c1 = const StadiumBorder(side: const BorderSide(width: 1.0));
const StadiumBorder c1 = const StadiumBorder(side: const BorderSide(width: 1.0));
expect(c1.getOuterPath(new Rect.fromCircle(center: Offset.zero, radius: 1.0)), isUnitCircle);
final StadiumBorder c2 = const StadiumBorder(side: const BorderSide(width: 1.0));
const StadiumBorder c2 = const StadiumBorder(side: const BorderSide(width: 1.0));
expect(c2.getInnerPath(new Rect.fromCircle(center: Offset.zero, radius: 2.0)), isUnitCircle);
final Rect rect = new Rect.fromLTRB(10.0, 20.0, 100.0, 200.0);
expect(
......@@ -36,8 +36,8 @@ void main() {
});
test('StadiumBorder and CircleBorder', () {
final StadiumBorder stadium = const StadiumBorder(side: BorderSide.none);
final CircleBorder circle = const CircleBorder(side: BorderSide.none);
const StadiumBorder stadium = const StadiumBorder(side: BorderSide.none);
const CircleBorder circle = const CircleBorder(side: BorderSide.none);
final Rect rect = new Rect.fromLTWH(0.0, 0.0, 100.0, 20.0);
final Matcher looksLikeS = isPathThat(
includes: const <Offset>[ const Offset(30.0, 10.0), const Offset(50.0, 10.0), ],
......@@ -87,8 +87,8 @@ void main() {
});
test('StadiumBorder and RoundedRectBorder', () {
final StadiumBorder stadium = const StadiumBorder(side: BorderSide.none);
final RoundedRectangleBorder rrect = const RoundedRectangleBorder(side: BorderSide.none);
const StadiumBorder stadium = const StadiumBorder(side: BorderSide.none);
const RoundedRectangleBorder rrect = const RoundedRectangleBorder(side: BorderSide.none);
final Rect rect = new Rect.fromLTWH(0.0, 0.0, 100.0, 50.0);
final Matcher looksLikeS = isPathThat(
includes: const <Offset>[
......
......@@ -13,7 +13,7 @@ void main() {
final TextSpan a2 = new TextSpan(text: text);
final TextSpan b1 = new TextSpan(children: <TextSpan>[ a1 ]);
final TextSpan b2 = new TextSpan(children: <TextSpan>[ a2 ]);
String nullText; // we want these instances to be separate instances so that we're not just checking with a single object
final String nullText = null; // we want these instances to be separate instances so that we're not just checking with a single object
final TextSpan c1 = new TextSpan(text: nullText);
final TextSpan c2 = new TextSpan(text: nullText);
......@@ -31,7 +31,7 @@ void main() {
});
test('TextSpan toStringDeep', () {
final TextSpan test = const TextSpan(
const TextSpan test = const TextSpan(
text: 'a',
style: const TextStyle(
fontSize: 10.0,
......
......@@ -18,7 +18,7 @@ void main() {
equals('TextStyle(<all styles inherited>)'),
);
final TextStyle s1 = const TextStyle(
const TextStyle s1 = const TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.w800,
height: 123.0,
......@@ -134,11 +134,11 @@ void main() {
});
test('TextStyle using package font', () {
final TextStyle s6 = const TextStyle(fontFamily: 'test');
const TextStyle s6 = const TextStyle(fontFamily: 'test');
expect(s6.fontFamily, 'test');
expect(s6.getTextStyle().toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: unspecified, fontStyle: unspecified, textBaseline: unspecified, fontFamily: test, fontSize: unspecified, letterSpacing: unspecified, wordSpacing: unspecified, height: unspecified)');
final TextStyle s7 = const TextStyle(fontFamily: 'test', package: 'p');
const TextStyle s7 = const TextStyle(fontFamily: 'test', package: 'p');
expect(s7.fontFamily, 'packages/p/test');
expect(s7.getTextStyle().toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: unspecified, fontStyle: unspecified, textBaseline: unspecified, fontFamily: packages/p/test, fontSize: unspecified, letterSpacing: unspecified, wordSpacing: unspecified, height: unspecified)');
});
......
......@@ -48,7 +48,7 @@ void main() {
expect(friction.x(0.0), 10.0);
expect(friction.dx(0.0), 600.0);
final double epsilon = 1e-4;
const double epsilon = 1e-4;
expect(friction.isDone(1.0 + epsilon), true);
expect(friction.x(1.0), closeTo(endPosition, epsilon));
expect(friction.dx(1.0), closeTo(endVelocity, epsilon));
......
......@@ -13,7 +13,7 @@ void main() {
});
test('BoxConstraints copyWith', () {
final BoxConstraints constraints = const BoxConstraints(
const BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0,
maxWidth: 7.0,
minHeight: 11.0,
......@@ -36,7 +36,7 @@ void main() {
});
test('BoxConstraints operators', () {
final BoxConstraints constraints = const BoxConstraints(
const BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0,
maxWidth: 7.0,
minHeight: 11.0,
......@@ -62,7 +62,7 @@ void main() {
test('BoxConstraints lerp', () {
expect(BoxConstraints.lerp(null, null, 0.5), isNull);
final BoxConstraints constraints = const BoxConstraints(
const BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0,
maxWidth: 7.0,
minHeight: 11.0,
......@@ -91,19 +91,19 @@ void main() {
});
test('BoxConstraints lerp with unbounded width', () {
final BoxConstraints constraints1 = const BoxConstraints(
const BoxConstraints constraints1 = const BoxConstraints(
minWidth: double.INFINITY,
maxWidth: double.INFINITY,
minHeight: 10.0,
maxHeight: 20.0,
);
final BoxConstraints constraints2 = const BoxConstraints(
const BoxConstraints constraints2 = const BoxConstraints(
minWidth: double.INFINITY,
maxWidth: double.INFINITY,
minHeight: 20.0,
maxHeight: 30.0,
);
final BoxConstraints constraints3 = const BoxConstraints(
const BoxConstraints constraints3 = const BoxConstraints(
minWidth: double.INFINITY,
maxWidth: double.INFINITY,
minHeight: 15.0,
......@@ -113,19 +113,19 @@ void main() {
});
test('BoxConstraints lerp with unbounded height', () {
final BoxConstraints constraints1 = const BoxConstraints(
const BoxConstraints constraints1 = const BoxConstraints(
minWidth: 10.0,
maxWidth: 20.0,
minHeight: double.INFINITY,
maxHeight: double.INFINITY,
);
final BoxConstraints constraints2 = const BoxConstraints(
const BoxConstraints constraints2 = const BoxConstraints(
minWidth: 20.0,
maxWidth: 30.0,
minHeight: double.INFINITY,
maxHeight: double.INFINITY,
);
final BoxConstraints constraints3 = const BoxConstraints(
const BoxConstraints constraints3 = const BoxConstraints(
minWidth: 15.0,
maxWidth: 25.0,
minHeight: double.INFINITY,
......@@ -135,19 +135,19 @@ void main() {
});
test('BoxConstraints lerp from bounded to unbounded', () {
final BoxConstraints constraints1 = const BoxConstraints(
const BoxConstraints constraints1 = const BoxConstraints(
minWidth: double.INFINITY,
maxWidth: double.INFINITY,
minHeight: double.INFINITY,
maxHeight: double.INFINITY,
);
final BoxConstraints constraints2 = const BoxConstraints(
const BoxConstraints constraints2 = const BoxConstraints(
minWidth: 20.0,
maxWidth: 30.0,
minHeight: double.INFINITY,
maxHeight: double.INFINITY,
);
final BoxConstraints constraints3 = const BoxConstraints(
const BoxConstraints constraints3 = const BoxConstraints(
minWidth: double.INFINITY,
maxWidth: double.INFINITY,
minHeight: 20.0,
......@@ -159,7 +159,7 @@ void main() {
});
test('BoxConstraints normalize', () {
final BoxConstraints constraints = const BoxConstraints(
const BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0,
maxWidth: 2.0,
minHeight: 11.0,
......
......@@ -163,7 +163,7 @@ void main() {
),
alignment: Alignment.center,
);
final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
const BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
layout(unconstrained, constraints: viewport);
expect(unconstrained.getMinIntrinsicHeight(100.0), equals(200.0));
expect(unconstrained.getMaxIntrinsicHeight(100.0), equals(200.0));
......@@ -179,7 +179,7 @@ void main() {
),
alignment: Alignment.center,
);
final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
const BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
layout(unconstrained, constraints: viewport);
expect(unconstrained.getMinIntrinsicHeight(100.0), equals(0.0));
expect(unconstrained.getMaxIntrinsicHeight(100.0), equals(0.0));
......@@ -224,7 +224,7 @@ void main() {
flexParentData.flex = 1;
flexParentData.fit = FlexFit.tight;
final BoxConstraints viewport = const BoxConstraints(maxWidth: 100.0);
const BoxConstraints viewport = const BoxConstraints(maxWidth: 100.0);
layout(unconstrained, constraints: viewport);
expect(unconstrained.size.width, equals(100.0), reason: 'constrained width');
......@@ -248,7 +248,7 @@ void main() {
flexParentData.flex = 1;
flexParentData.fit = FlexFit.tight;
final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0);
const BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0);
layout(unconstrained, constraints: viewport);
expect(unconstrained.size.width, equals(200.0), reason: 'unconstrained width');
......
......@@ -36,7 +36,7 @@ void main() {
result = 'no exception';
try {
final BoxConstraints constraints = const BoxConstraints(minWidth: double.NAN, maxWidth: double.NAN, minHeight: 2.0, maxHeight: double.NAN);
const BoxConstraints constraints = const BoxConstraints(minWidth: double.NAN, maxWidth: double.NAN, minHeight: 2.0, maxHeight: double.NAN);
assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) {
result = '$e';
......@@ -49,7 +49,7 @@ void main() {
result = 'no exception';
try {
final BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN);
const BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN);
assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) {
result = '$e';
......@@ -62,7 +62,7 @@ void main() {
result = 'no exception';
try {
final BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN, maxWidth: 0.0/0.0);
const BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN, maxWidth: 0.0/0.0);
assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) {
result = '$e';
......
......@@ -21,12 +21,12 @@ void main() {
});
testWidgets('overflow indicator is shown when overflowing', (WidgetTester tester) async {
final UnconstrainedBox box = const UnconstrainedBox(
const UnconstrainedBox box = const UnconstrainedBox(
child: const SizedBox(width: 200.0, height: 200.0),
);
await tester.pumpWidget(
new Center(
child: new SizedBox(
const Center(
child: const SizedBox(
height: 100.0,
child: box,
),
......@@ -37,8 +37,8 @@ void main() {
expect(find.byType(UnconstrainedBox), paints..rect());
await tester.pumpWidget(
new Center(
child: new SizedBox(
const Center(
child: const SizedBox(
height: 100.0,
child: box,
),
......
......@@ -10,7 +10,7 @@ import '../rendering/mock_canvas.dart';
/// Unit tests error.dart's usage via ErrorWidget.
void main() {
final String errorMessage = 'Some error message';
const String errorMessage = 'Some error message';
testWidgets('test draw error paragraph', (WidgetTester tester) async {
await tester.pumpWidget(new ErrorWidget(new Exception(errorMessage)));
......
......@@ -34,7 +34,7 @@ void main() {
);
final FlexParentData flexParentData = flexible.parentData;
flexParentData.flex = 1;
final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
const BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
layout(flex, constraints: viewport);
expect(flexible.size.height, equals(0.0));
expect(flex.getMinIntrinsicHeight(100.0), equals(200.0));
......@@ -57,7 +57,7 @@ void main() {
);
final FlexParentData flexParentData = flexible.parentData;
flexParentData.flex = 1;
final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
const BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
layout(flex, constraints: viewport);
expect(flexible.size.width, equals(0.0));
expect(flex.getMinIntrinsicHeight(100.0), equals(0.0));
......@@ -74,7 +74,7 @@ void main() {
new RenderAspectRatio(aspectRatio: 1.0),
]
);
final BoxConstraints viewport = const BoxConstraints(maxHeight: 200.0, maxWidth: 1000.0);
const BoxConstraints viewport = const BoxConstraints(maxHeight: 200.0, maxWidth: 1000.0);
layout(flex, constraints: viewport);
expect(flex.getMaxIntrinsicWidth(200.0), equals(0.0));
});
......@@ -292,7 +292,7 @@ void main() {
test('MainAxisSize.min inside unconstrained', () {
FlutterError.onError = (FlutterErrorDetails details) => throw details.exception;
final BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
const BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: square);
......@@ -337,7 +337,7 @@ void main() {
FlutterError.onError = (FlutterErrorDetails details) {
exceptions.add(details.exception);
};
final BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
const BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: square);
......@@ -366,7 +366,7 @@ void main() {
FlutterError.onError = (FlutterErrorDetails details) {
exceptions.add(details.exception);
};
final BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
const BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: square);
......@@ -392,7 +392,7 @@ void main() {
});
test('MainAxisSize.min inside tightly constrained', () {
final BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
const BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: square);
......@@ -412,7 +412,7 @@ void main() {
});
test('Flex RTL', () {
final BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
const BoxConstraints square = const BoxConstraints.tightFor(width: 100.0, height: 100.0);
final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: square);
final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: square);
......
......@@ -31,7 +31,7 @@ class TestLayout {
}
void main() {
final ViewConfiguration testConfiguration = const ViewConfiguration(
const ViewConfiguration testConfiguration = const ViewConfiguration(
size: const Size(800.0, 600.0),
devicePixelRatio: 1.0
);
......
......@@ -225,7 +225,7 @@ void main() {
});
test('nested TextSpans in paragraph handle textScaleFactor correctly.', () {
final TextSpan testSpan = const TextSpan(
const TextSpan testSpan = const TextSpan(
text: 'a',
style: const TextStyle(
fontSize: 10.0,
......
......@@ -7,45 +7,45 @@ import 'package:test/test.dart';
void main() {
test('RelativeRect.==', () {
final RelativeRect r = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const RelativeRect r = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
expect(r, new RelativeRect.fromSize(new Rect.fromLTWH(10.0, 20.0, 0.0, 0.0), const Size(40.0, 60.0)));
});
test('RelativeRect.shift', () {
final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final RelativeRect r2 = r1.shift(const Offset(5.0, 50.0));
expect(r2, const RelativeRect.fromLTRB(15.0, 70.0, 25.0, -10.0));
});
test('RelativeRect.inflate', () {
final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final RelativeRect r2 = r1.inflate(5.0);
expect(r2, const RelativeRect.fromLTRB(5.0, 15.0, 25.0, 35.0));
});
test('RelativeRect.deflate', () {
final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final RelativeRect r2 = r1.deflate(5.0);
expect(r2, const RelativeRect.fromLTRB(15.0, 25.0, 35.0, 45.0));
});
test('RelativeRect.intersect', () {
final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final RelativeRect r2 = const RelativeRect.fromLTRB(0.0, 30.0, 60.0, 0.0);
const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const RelativeRect r2 = const RelativeRect.fromLTRB(0.0, 30.0, 60.0, 0.0);
final RelativeRect r3 = r1.intersect(r2);
final RelativeRect r4 = r2.intersect(r1);
expect(r3, r4);
expect(r3, const RelativeRect.fromLTRB(10.0, 30.0, 60.0, 40.0));
});
test('RelativeRect.toRect', () {
final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final Rect r2 = r1.toRect(new Rect.fromLTRB(10.0, 20.0, 90.0, 180.0));
expect(r2, new Rect.fromLTRB(10.0, 20.0, 50.0, 120.0));
});
test('RelativeRect.toSize', () {
final RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const RelativeRect r1 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final Size r2 = r1.toSize(const Size(80.0, 160.0));
expect(r2, const Size(40.0, 100.0));
});
test('RelativeRect.lerp', () {
final RelativeRect r1 = RelativeRect.fill;
final RelativeRect r2 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const RelativeRect r2 = const RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final RelativeRect r3 = RelativeRect.lerp(r1, r2, 0.5);
expect(r3, const RelativeRect.fromLTRB(5.0, 10.0, 15.0, 20.0));
});
......
......@@ -17,7 +17,7 @@ void main() {
});
test('SliverConstraints', () {
final SliverConstraints a = const SliverConstraints(
const SliverConstraints a = const SliverConstraints(
axisDirection: AxisDirection.down,
growthDirection: GrowthDirection.forward,
userScrollDirection: ScrollDirection.idle,
......@@ -45,7 +45,7 @@ void main() {
crossAxisExtent: 40.0,
viewportMainAxisExtent: 30.0,
);
final SliverConstraints d = const SliverConstraints(
const SliverConstraints d = const SliverConstraints(
axisDirection: AxisDirection.up,
growthDirection: GrowthDirection.reverse,
userScrollDirection: ScrollDirection.forward,
......
......@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
test('TableBorder constructor', () {
final TableBorder border1 = const TableBorder(
const TableBorder border1 = const TableBorder(
left: const BorderSide(width: 1.0),
right: const BorderSide(color: const Color(0xFF00FF00)),
verticalInside: const BorderSide(),
......@@ -69,7 +69,7 @@ void main() {
const BorderSide side4 = const BorderSide(width: 4.0, color: const Color(4));
const BorderSide side5 = const BorderSide(width: 5.0, color: const Color(5));
const BorderSide side6 = const BorderSide(width: 6.0, color: const Color(6));
final TableBorder tableA = const TableBorder(
const TableBorder tableA = const TableBorder(
top: side1,
right: side2,
bottom: side3,
......
......@@ -167,9 +167,9 @@ void main() {
Matrix4 rotateAroundXAxis(double a) {
// 3D rotation transform with alpha=a
final double x = 1.0;
final double y = 0.0;
final double z = 0.0;
const double x = 1.0;
const double y = 0.0;
const double z = 0.0;
final double sc = math.sin(a / 2.0) * math.cos(a / 2.0);
final double sq = math.sin(a / 2.0) * math.sin(a / 2.0);
return new Matrix4.fromList(<double>[
......
......@@ -8,7 +8,7 @@ import 'package:test/test.dart';
void main() {
group('TextInputConfiguration', () {
test('sets expected defaults', () {
final TextInputConfiguration configuration = const TextInputConfiguration();
const TextInputConfiguration configuration = const TextInputConfiguration();
expect(configuration.inputType, TextInputType.text);
expect(configuration.obscureText, false);
expect(configuration.autocorrect, true);
......@@ -16,7 +16,7 @@ void main() {
});
test('serializes to JSON', () async {
final TextInputConfiguration configuration = const TextInputConfiguration(
const TextInputConfiguration configuration = const TextInputConfiguration(
inputType: TextInputType.number,
obscureText: true,
autocorrect: false,
......
......@@ -8,7 +8,7 @@ import 'package:flutter/widgets.dart';
void main() {
testWidgets('AnimatedAlign.debugFillProperties', (WidgetTester tester) async {
final AnimatedAlign box = const AnimatedAlign(
const AnimatedAlign box = const AnimatedAlign(
alignment: Alignment.topCenter,
curve: Curves.ease,
duration: const Duration(milliseconds: 200),
......
......@@ -27,11 +27,11 @@ void main() {
testWidgets('AnimatedContainer control test', (WidgetTester tester) async {
final GlobalKey key = new GlobalKey();
final BoxDecoration decorationA = const BoxDecoration(
const BoxDecoration decorationA = const BoxDecoration(
color: const Color(0xFF00FF00),
);
final BoxDecoration decorationB = const BoxDecoration(
const BoxDecoration decorationB = const BoxDecoration(
color: const Color(0xFF0000FF),
);
......
......@@ -76,9 +76,9 @@ void main() {
final PushRouteObserver observer = new PushRouteObserver();
WidgetsBinding.instance.addObserver(observer);
final String testRouteName = 'testRouteName';
const String testRouteName = 'testRouteName';
final ByteData message = const JSONMethodCodec().encodeMethodCall(
new MethodCall('pushRoute', testRouteName));
const MethodCall('pushRoute', testRouteName));
await BinaryMessages.handlePlatformMessage('flutter/navigation', message, (_) {});
expect(observer.pushedRoute, testRouteName);
......
......@@ -104,7 +104,7 @@ Future<Null> main() async {
});
testWidgets('Bordered Container insets its child', (WidgetTester tester) async {
final Key key = const Key('outerContainer');
const Key key = const Key('outerContainer');
await tester.pumpWidget(
new Center(
child: new Container(
......@@ -123,7 +123,7 @@ Future<Null> main() async {
testWidgets('BoxDecoration paints its border correctly', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/7672
final Key key = const Key('Container with BoxDecoration');
const Key key = const Key('Container with BoxDecoration');
Widget buildFrame(Border border) {
return new Center(
child: new Container(
......@@ -135,7 +135,7 @@ Future<Null> main() async {
);
}
final Color black = const Color(0xFF000000);
const Color black = const Color(0xFF000000);
await tester.pumpWidget(buildFrame(new Border.all()));
expect(find.byKey(key), paints
......@@ -145,25 +145,25 @@ Future<Null> main() async {
expect(find.byKey(key), paints
..rect(color: black, style: PaintingStyle.stroke, strokeWidth: 0.0));
final Color green = const Color(0xFF00FF00);
final BorderSide greenSide = new BorderSide(color: green, width: 10.0);
const Color green = const Color(0xFF00FF00);
const BorderSide greenSide = const BorderSide(color: green, width: 10.0);
await tester.pumpWidget(buildFrame(new Border(top: greenSide)));
await tester.pumpWidget(buildFrame(const Border(top: greenSide)));
expect(find.byKey(key), paints..path(color: green, style: PaintingStyle.fill));
await tester.pumpWidget(buildFrame(new Border(left: greenSide)));
await tester.pumpWidget(buildFrame(const Border(left: greenSide)));
expect(find.byKey(key), paints..path(color: green, style: PaintingStyle.fill));
await tester.pumpWidget(buildFrame(new Border(right: greenSide)));
await tester.pumpWidget(buildFrame(const Border(right: greenSide)));
expect(find.byKey(key), paints..path(color: green, style: PaintingStyle.fill));
await tester.pumpWidget(buildFrame(new Border(bottom: greenSide)));
await tester.pumpWidget(buildFrame(const Border(bottom: greenSide)));
expect(find.byKey(key), paints..path(color: green, style: PaintingStyle.fill));
final Color blue = const Color(0xFF0000FF);
final BorderSide blueSide = new BorderSide(color: blue, width: 0.0);
const Color blue = const Color(0xFF0000FF);
const BorderSide blueSide = const BorderSide(color: blue, width: 0.0);
await tester.pumpWidget(buildFrame(new Border(top: blueSide, right: greenSide, bottom: greenSide)));
await tester.pumpWidget(buildFrame(const Border(top: blueSide, right: greenSide, bottom: greenSide)));
expect(find.byKey(key), paints
..path() // There's not much point checking the arguments to these calls because paintBorder
..path() // reuses the same Paint object each time, configured differently, and so they will
......@@ -268,7 +268,7 @@ Future<Null> main() async {
List<int> itemsTapped;
final Key key = const Key('Container with BoxDecoration');
const Key key = const Key('Container with BoxDecoration');
Widget buildFrame(Border border) {
itemsTapped = <int>[];
return new Center(
......@@ -305,7 +305,7 @@ Future<Null> main() async {
List<int> itemsTapped;
final Key key = const Key('Container with BoxDecoration');
const Key key = const Key('Container with BoxDecoration');
Widget buildFrame(Border border) {
itemsTapped = <int>[];
return new Center(
......
......@@ -539,7 +539,7 @@ void main() {
await tester.pumpWidget(buildTest());
final Offset location = tester.getTopLeft(find.text('0'));
final Offset offset = const Offset(0.0, 5.0);
const Offset offset = const Offset(0.0, 5.0);
final TestGesture gesture = await tester.startGesture(location, pointer: 5);
await gesture.moveBy(offset);
await tester.pumpWidget(buildTest());
......
......@@ -17,8 +17,8 @@ void main() {
final TextEditingController controller = new TextEditingController();
final FocusNode focusNode = new FocusNode();
final FocusScopeNode focusScopeNode = new FocusScopeNode();
final TextStyle textStyle = const TextStyle();
final Color cursorColor = const Color.fromARGB(0xFF, 0xFF, 0x00, 0x00);
const TextStyle textStyle = const TextStyle();
const Color cursorColor = const Color.fromARGB(0xFF, 0xFF, 0x00, 0x00);
setUp(() {
debugResetSemanticsIdCounter();
......
......@@ -166,7 +166,7 @@ void main() {
});
testWidgets('Provide initial value to input when no controller is specified', (WidgetTester tester) async {
final String initialValue = 'hello';
const String initialValue = 'hello';
final GlobalKey<FormFieldState<String>> inputKey = new GlobalKey<FormFieldState<String>>();
Widget builder() {
......@@ -206,7 +206,7 @@ void main() {
testWidgets('Provide initial value to input when controller is specified', (WidgetTester tester) async {
final TextEditingController controller = new TextEditingController();
final String initialValue = 'hello';
const String initialValue = 'hello';
final GlobalKey<FormFieldState<String>> inputKey = new GlobalKey<FormFieldState<String>>();
Widget builder() {
......
......@@ -33,14 +33,14 @@ void main() {
expect(updatedDragDelta, isNull);
expect(didEndDrag, isFalse);
final Offset firstLocation = const Offset(10.0, 10.0);
const Offset firstLocation = const Offset(10.0, 10.0);
final TestGesture gesture = await tester.startGesture(firstLocation, pointer: 7);
expect(didStartDrag, isTrue);
didStartDrag = false;
expect(updatedDragDelta, isNull);
expect(didEndDrag, isFalse);
final Offset secondLocation = const Offset(10.0, 9.0);
const Offset secondLocation = const Offset(10.0, 9.0);
await gesture.moveTo(secondLocation);
expect(didStartDrag, isFalse);
expect(updatedDragDelta, -1.0);
......@@ -60,8 +60,8 @@ void main() {
int gestureCount = 0;
double dragDistance = 0.0;
final Offset downLocation = const Offset(10.0, 10.0);
final Offset upLocation = const Offset(10.0, 50.0); // must be far enough to be more than kTouchSlop
const Offset downLocation = const Offset(10.0, 10.0);
const Offset upLocation = const Offset(10.0, 50.0); // must be far enough to be more than kTouchSlop
final Widget widget = new GestureDetector(
onVerticalDragUpdate: (DragUpdateDetails details) { dragDistance += details.primaryDelta; },
......
......@@ -258,12 +258,12 @@ void main() {
// Expect the height of the secondKey Hero to vary from 100 to 150
// over duration and according to curve.
final Duration duration = const Duration(milliseconds: 300);
const Duration duration = const Duration(milliseconds: 300);
final 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;
final double epsilon = 0.001;
const double epsilon = 0.001;
await tester.pump(duration * 0.25);
expect(
......@@ -505,7 +505,7 @@ void main() {
// Hero a's return flight at 149ms. The outgoing (push) flight took
// 150ms so we should be just about back to where Hero 'a' started.
final double epsilon = 0.001;
const double epsilon = 0.001;
await tester.pump(const Duration(milliseconds: 99));
closeTo(tester.getSize(find.byKey(secondKey)).height - initialHeight, epsilon);
......@@ -575,7 +575,7 @@ void main() {
// Hero a's return flight at 149ms. The outgoing (push) flight took
// 150ms so we should be just about back to where Hero 'a' started.
final double epsilon = 0.001;
const double epsilon = 0.001;
await tester.pump(const Duration(milliseconds: 99));
closeTo(tester.getSize(find.byKey(firstKey)).height - initialHeight, epsilon);
......@@ -587,8 +587,8 @@ void main() {
});
testWidgets('Destination hero disappears mid-flight', (WidgetTester tester) async {
final Key homeHeroKey = const Key('home hero');
final Key routeHeroKey = const Key('route hero');
const Key homeHeroKey = const Key('home hero');
const Key routeHeroKey = const Key('route hero');
bool routeIncludesHero = true;
StateSetter heroCardSetState;
......@@ -690,9 +690,9 @@ void main() {
});
testWidgets('Destination hero scrolls mid-flight', (WidgetTester tester) async {
final Key homeHeroKey = const Key('home hero');
final Key routeHeroKey = const Key('route hero');
final Key routeContainerKey = const Key('route hero container');
const Key homeHeroKey = const Key('home hero');
const Key routeHeroKey = const Key('route hero');
const Key routeContainerKey = const Key('route hero container');
// Show a 200x200 Hero tagged 'H', with key routeHeroKey
final MaterialPageRoute<Null> route = new MaterialPageRoute<Null>(
......@@ -772,9 +772,9 @@ void main() {
});
testWidgets('Destination hero scrolls out of view mid-flight', (WidgetTester tester) async {
final Key homeHeroKey = const Key('home hero');
final Key routeHeroKey = const Key('route hero');
final Key routeContainerKey = const Key('route hero container');
const Key homeHeroKey = const Key('home hero');
const Key routeHeroKey = const Key('route hero');
const Key routeContainerKey = const Key('route hero container');
// Show a 200x200 Hero tagged 'H', with key routeHeroKey
final MaterialPageRoute<Null> route = new MaterialPageRoute<Null>(
......@@ -851,8 +851,8 @@ void main() {
testWidgets('Aborted flight', (WidgetTester tester) async {
// See https://github.com/flutter/flutter/issues/5798
final Key heroABKey = const Key('AB hero');
final Key heroBCKey = const Key('BC hero');
const Key heroABKey = const Key('AB hero');
const Key heroBCKey = const Key('BC hero');
// Show a 150x150 Hero tagged 'BC'
final MaterialPageRoute<Null> routeC = new MaterialPageRoute<Null>(
......@@ -1084,8 +1084,8 @@ void main() {
await tester.pumpWidget(new MaterialApp(routes: createRectTweenHeroRoutes));
expect(tester.getCenter(find.byKey(firstKey)), const Offset(50.0, 50.0));
final double epsilon = 0.001;
final Duration duration = const Duration(milliseconds: 300);
const double epsilon = 0.001;
const Duration duration = const Duration(milliseconds: 300);
final Curve curve = Curves.fastOutSlowIn;
final MaterialPointArcTween pushCenterTween = new MaterialPointArcTween(
begin: const Offset(50.0, 50.0),
......@@ -1156,8 +1156,8 @@ void main() {
await tester.tap(find.text('twoInset'));
await tester.pump(); // begin navigation from / to /twoInset.
final double epsilon = 0.001;
final Duration duration = const Duration(milliseconds: 300);
const double epsilon = 0.001;
const Duration duration = const Duration(milliseconds: 300);
await tester.pump();
final double x0 = tester.getTopLeft(find.byKey(secondKey)).dx;
......
......@@ -20,7 +20,7 @@ void main() {
didTapRight = true;
};
final Key textKey = const Key('text');
const Key textKey = const Key('text');
await tester.pumpWidget(
new Center(
......
......@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
test('IconThemeData control test', () {
final IconThemeData data = const IconThemeData(color: const Color(0xAAAAAAAA), opacity: 0.5, size: 16.0);
const IconThemeData data = const IconThemeData(color: const Color(0xAAAAAAAA), opacity: 0.5, size: 16.0);
expect(data, hasOneLineDescription);
expect(data, equals(data.copyWith()));
......
......@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
test('AssetImage from package', () {
final AssetImage image = const AssetImage(
const AssetImage image = const AssetImage(
'assets/image.png',
package: 'test_package',
);
......@@ -15,7 +15,7 @@ void main() {
});
test('ExactAssetImage from package', () {
final ExactAssetImage image = const ExactAssetImage(
const ExactAssetImage image = const ExactAssetImage(
'assets/image.png',
scale: 1.5,
package: 'test_package',
......
......@@ -150,13 +150,13 @@ TestImage getTestImage(WidgetTester tester, Key key) {
}
Future<Null> pumpTreeToLayout(WidgetTester tester, Widget widget) {
final Duration pumpDuration = const Duration(milliseconds: 0);
const Duration pumpDuration = const Duration(milliseconds: 0);
final EnginePhase pumpPhase = EnginePhase.layout;
return tester.pumpWidget(widget, pumpDuration, pumpPhase);
}
void main() {
final String image = 'assets/image.png';
const String image = 'assets/image.png';
testWidgets('Image for device pixel ratio 1.0', (WidgetTester tester) async {
const double ratio = 1.0;
......
......@@ -100,7 +100,7 @@ void main() {
await tester.pumpWidget(buildBlock(reverse: true));
final Offset target = const Offset(200.0, 200.0);
const Offset target = const Offset(200.0, 200.0);
await tester.tapAt(target);
expect(first, equals(0));
expect(second, equals(1));
......
......@@ -165,7 +165,7 @@ void main() {
});
testWidgets('Navigator.of fails gracefully when not found in context', (WidgetTester tester) async {
final Key targetKey = const Key('foo');
const Key targetKey = const Key('foo');
dynamic exception;
final Widget widget = new ThirdWidget(
targetKey: targetKey,
......
......@@ -50,8 +50,8 @@ class TestRoute<T> extends PageRoute<T> {
}
void main() {
final Duration kTwoTenthsOfTheTransitionDuration = const Duration(milliseconds: 30);
final Duration kFourTenthsOfTheTransitionDuration = const Duration(milliseconds: 60);
const Duration kTwoTenthsOfTheTransitionDuration = const Duration(milliseconds: 30);
const Duration kFourTenthsOfTheTransitionDuration = const Duration(milliseconds: 60);
testWidgets('Check onstage/offstage handling around transitions', (WidgetTester tester) async {
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
void main() {
testWidgets('PageStorage read and write', (WidgetTester tester) async {
final Key builderKey = const PageStorageKey<String>('builderKey');
const Key builderKey = const PageStorageKey<String>('builderKey');
StateSetter setState;
int storedValue = 0;
......
......@@ -96,20 +96,20 @@ void main() {
kNonPositioned,
]);
final DecoratedBox kDecoratedBoxA = const DecoratedBox(decoration: kBoxDecorationA);
final DecoratedBox kDecoratedBoxB = const DecoratedBox(decoration: kBoxDecorationB);
final DecoratedBox kDecoratedBoxC = const DecoratedBox(decoration: kBoxDecorationC);
const DecoratedBox kDecoratedBoxA = const DecoratedBox(decoration: kBoxDecorationA);
const DecoratedBox kDecoratedBoxB = const DecoratedBox(decoration: kBoxDecorationB);
const DecoratedBox kDecoratedBoxC = const DecoratedBox(decoration: kBoxDecorationC);
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
children: <Widget>[
new Positioned(
children: const <Widget>[
const Positioned(
bottom: 5.0,
right: 7.0,
child: kDecoratedBoxA,
),
new Positioned(
const Positioned(
top: 10.0,
left: 10.0,
child: kDecoratedBoxB,
......@@ -128,13 +128,13 @@ void main() {
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
children: <Widget>[
new Positioned(
children: const <Widget>[
const Positioned(
bottom: 6.0,
right: 8.0,
child: kDecoratedBoxA,
),
new Positioned(
const Positioned(
left: 10.0,
right: 10.0,
child: kDecoratedBoxB,
......@@ -181,7 +181,7 @@ void main() {
child: new Container(child: kDecoratedBoxB),
),
new Container(
child: new Positioned(
child: const Positioned(
top: 8.0,
child: kDecoratedBoxC,
),
......@@ -199,10 +199,10 @@ void main() {
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
children: <Widget>[
new Positioned(
children: const <Widget>[
const Positioned(
right: 10.0,
child: new FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB),
child: const FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB),
),
],
),
......@@ -222,10 +222,10 @@ void main() {
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
children: <Widget>[
new Positioned(
children: const <Widget>[
const Positioned(
top: 7.0,
child: new FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB),
child: const FlipWidget(left: kDecoratedBoxA, right: kDecoratedBoxB),
),
],
),
......
......@@ -53,7 +53,7 @@ void main() {
final GlobalKey left = new GlobalKey();
final GlobalKey right = new GlobalKey();
final StateMarker grandchild = const StateMarker();
const StateMarker grandchild = const StateMarker();
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
......@@ -80,7 +80,7 @@ void main() {
expect(grandchildState, isNotNull);
grandchildState.marker = 'grandchild';
final StateMarker newGrandchild = const StateMarker();
const StateMarker newGrandchild = const StateMarker();
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
......@@ -128,7 +128,7 @@ void main() {
final GlobalKey left = new GlobalKey();
final GlobalKey right = new GlobalKey();
final StateMarker grandchild = const StateMarker();
const StateMarker grandchild = const StateMarker();
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
......@@ -151,7 +151,7 @@ void main() {
expect(grandchildState, isNotNull);
grandchildState.marker = 'grandchild';
final StateMarker newGrandchild = const StateMarker();
const StateMarker newGrandchild = const StateMarker();
await tester.pumpWidget(
new Stack(
textDirection: TextDirection.ltr,
......
......@@ -98,7 +98,7 @@ Future<Null> runNavigatorTest(
void main() {
testWidgets('Route settings', (WidgetTester tester) async {
final RouteSettings settings = const RouteSettings(name: 'A');
const RouteSettings settings = const RouteSettings(name: 'A');
expect(settings, hasOneLineDescription);
final RouteSettings settings2 = settings.copyWith(name: 'B');
expect(settings2.name, 'B');
......
This diff is collapsed.
......@@ -7,16 +7,16 @@ import 'package:flutter/widgets.dart';
void main() {
testWidgets('Padding RTL', (WidgetTester tester) async {
final Widget child = const Padding(
const Widget child = const Padding(
padding: const EdgeInsetsDirectional.only(start: 10.0),
child: const Placeholder(),
);
await tester.pumpWidget(new Directionality(
await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr,
child: child,
));
expect(tester.getTopLeft(find.byType(Placeholder)), const Offset(10.0, 0.0));
await tester.pumpWidget(new Directionality(
await tester.pumpWidget(const Directionality(
textDirection: TextDirection.rtl,
child: child,
));
......
......@@ -39,7 +39,7 @@ void main() {
});
testWidgets('SafeArea - changing', (WidgetTester tester) async {
final Widget child = const SafeArea(
const Widget child = const SafeArea(
bottom: false,
child: const SafeArea(
left: false,
......@@ -48,7 +48,7 @@ void main() {
),
);
await tester.pumpWidget(
new MediaQuery(
const MediaQuery(
data: const MediaQueryData(padding: const EdgeInsets.all(20.0)),
child: child,
),
......@@ -56,7 +56,7 @@ void main() {
expect(tester.getTopLeft(find.byType(Placeholder)), const Offset(20.0, 20.0));
expect(tester.getBottomRight(find.byType(Placeholder)), const Offset(780.0, 600.0));
await tester.pumpWidget(
new MediaQuery(
const MediaQuery(
data: const MediaQueryData(padding: const EdgeInsets.only(
left: 100.0,
top: 30.0,
......
......@@ -22,7 +22,7 @@ void main() {
// Tests https://github.com/flutter/flutter/issues/5522
testWidgets('GridView displays correct children with nonzero padding', (WidgetTester tester) async {
final EdgeInsets padding = const EdgeInsets.fromLTRB(0.0, 100.0, 0.0, 0.0);
const EdgeInsets padding = const EdgeInsets.fromLTRB(0.0, 100.0, 0.0, 0.0);
final Widget testWidget = new Directionality(
textDirection: TextDirection.ltr,
......
......@@ -7,15 +7,15 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('SizedBox constructors', (WidgetTester tester) async {
final SizedBox a = const SizedBox();
const SizedBox a = const SizedBox();
expect(a.width, isNull);
expect(a.height, isNull);
final SizedBox b = const SizedBox(width: 10.0);
const SizedBox b = const SizedBox(width: 10.0);
expect(b.width, 10.0);
expect(b.height, isNull);
final SizedBox c = const SizedBox(width: 10.0, height: 20.0);
const SizedBox c = const SizedBox(width: 10.0, height: 20.0);
expect(c.width, 10.0);
expect(c.height, 20.0);
......@@ -27,7 +27,7 @@ void main() {
expect(e.width, 1.0);
expect(e.height, 2.0);
final SizedBox f = const SizedBox.expand();
const SizedBox f = const SizedBox.expand();
expect(f.width, double.INFINITY);
expect(f.height, double.INFINITY);
});
......
......@@ -39,7 +39,7 @@ void verify(WidgetTester tester, List<Rect> answerKey) {
void main() {
testWidgets('Viewport+SliverPadding basic test (VISUAL)', (WidgetTester tester) async {
final EdgeInsets padding = const EdgeInsets.fromLTRB(25.0, 20.0, 15.0, 35.0);
const EdgeInsets padding = const EdgeInsets.fromLTRB(25.0, 20.0, 15.0, 35.0);
await test(tester, 0.0, padding, AxisDirection.down, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
......@@ -78,7 +78,7 @@ void main() {
});
testWidgets('Viewport+SliverPadding basic test (LTR)', (WidgetTester tester) async {
final EdgeInsetsDirectional padding = const EdgeInsetsDirectional.fromSTEB(25.0, 20.0, 15.0, 35.0);
const EdgeInsetsDirectional padding = const EdgeInsetsDirectional.fromSTEB(25.0, 20.0, 15.0, 35.0);
await test(tester, 0.0, padding, AxisDirection.down, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
......@@ -117,7 +117,7 @@ void main() {
});
testWidgets('Viewport+SliverPadding basic test (RTL)', (WidgetTester tester) async {
final EdgeInsetsDirectional padding = const EdgeInsetsDirectional.fromSTEB(25.0, 20.0, 15.0, 35.0);
const EdgeInsetsDirectional padding = const EdgeInsetsDirectional.fromSTEB(25.0, 20.0, 15.0, 35.0);
await test(tester, 0.0, padding, AxisDirection.down, TextDirection.rtl);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
......@@ -156,7 +156,7 @@ void main() {
});
testWidgets('Viewport+SliverPadding hit testing', (WidgetTester tester) async {
final EdgeInsets padding = const EdgeInsets.all(30.0);
const EdgeInsets padding = const EdgeInsets.all(30.0);
await test(tester, 350.0, padding, AxisDirection.down, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
......@@ -178,7 +178,7 @@ void main() {
});
testWidgets('Viewport+SliverPadding hit testing up', (WidgetTester tester) async {
final EdgeInsets padding = const EdgeInsets.all(30.0);
const EdgeInsets padding = const EdgeInsets.all(30.0);
await test(tester, 350.0, padding, AxisDirection.up, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
......@@ -200,7 +200,7 @@ void main() {
});
testWidgets('Viewport+SliverPadding hit testing left', (WidgetTester tester) async {
final EdgeInsets padding = const EdgeInsets.all(30.0);
const EdgeInsets padding = const EdgeInsets.all(30.0);
await test(tester, 350.0, padding, AxisDirection.left, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
......@@ -222,7 +222,7 @@ void main() {
});
testWidgets('Viewport+SliverPadding hit testing right', (WidgetTester tester) async {
final EdgeInsets padding = const EdgeInsets.all(30.0);
const EdgeInsets padding = const EdgeInsets.all(30.0);
await test(tester, 350.0, padding, AxisDirection.right, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment