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