Commit 5b72a2fd authored by Jason Simmons's avatar Jason Simmons

Fix warnings seen when running skyanalyzer in strong mode

parent 6e91cfa4
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'lib/sector_layout.dart'; import 'lib/sector_layout.dart';
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
......
...@@ -6,15 +6,15 @@ void main() { ...@@ -6,15 +6,15 @@ void main() {
Document document = new Document(); Document document = new Document();
test("should throw with invalid arguments", () { test("should throw with invalid arguments", () {
var parent = document.createElement("div"); Element parent = document.createElement("div");
var child = document.createElement("div"); Element child = document.createElement("div");
parent.appendChild(child); parent.appendChild(child);
// TODO(eseidel): This should throw! // TODO(eseidel): This should throw!
// expect(() { // expect(() {
// parent.insertBefore([parent]); // parent.insertBefore([parent]);
// }, throws); // }, throws);
expect(() { expect(() {
child.insertBefore([parent]); child.insertBefore(<Node>[parent]);
}, throws); }, throws);
}); });
......
...@@ -5,36 +5,36 @@ import 'package:test/test.dart'; ...@@ -5,36 +5,36 @@ import 'package:test/test.dart';
import 'dom_utils.dart'; import 'dom_utils.dart';
void main() { void main() {
var document = new Document(); Document document = new Document();
test("should replace elements", () { test("should replace elements", () {
var parent = document.createElement("div"); Element parent = document.createElement("div");
var oldChild = parent.appendChild(document.createElement("div")); Element oldChild = parent.appendChild(document.createElement("div"));
var newChild = document.createElement("div"); Element newChild = document.createElement("div");
oldChild.replaceWith([newChild]); oldChild.replaceWith(<Node>[newChild]);
expect(oldChild.parentNode, isNull); expect(oldChild.parentNode, isNull);
expect(newChild.parentNode, equals(parent)); expect(newChild.parentNode, equals(parent));
}); });
test("should replace text", () { test("should replace text", () {
var parent = document.createElement("div"); Element parent = document.createElement("div");
var oldChild = parent.appendChild(document.createText(" it's a text ")); Node oldChild = parent.appendChild(document.createText(" it's a text "));
var newChild = document.createElement("div"); Element newChild = document.createElement("div");
oldChild.replaceWith([newChild]); oldChild.replaceWith(<Node>[newChild]);
expect(oldChild.parentNode, isNull); expect(oldChild.parentNode, isNull);
expect(newChild.parentNode, equals(parent)); expect(newChild.parentNode, equals(parent));
}); });
test("should replace children with a fragment", () { test("should replace children with a fragment", () {
var fragment = document.createDocumentFragment(); DocumentFragment fragment = document.createDocumentFragment();
var child1 = fragment.appendChild(document.createElement("div")); Element child1 = fragment.appendChild(document.createElement("div"));
var child2 = fragment.appendChild(document.createText(" text ")); Node child2 = fragment.appendChild(document.createText(" text "));
var child3 = fragment.appendChild(document.createText(" ")); Node child3 = fragment.appendChild(document.createText(" "));
var child4 = fragment.appendChild(document.createElement("div")); Element child4 = fragment.appendChild(document.createElement("div"));
var parent = document.createElement("div"); Element parent = document.createElement("div");
var oldChild = parent.appendChild(document.createElement("div")); Element oldChild = parent.appendChild(document.createElement("div"));
var lastChild = parent.appendChild(document.createElement("div")); Element lastChild = parent.appendChild(document.createElement("div"));
oldChild.replaceWith([fragment]); oldChild.replaceWith(<Node>[fragment]);
expect(child1.parentNode, equals(parent)); expect(child1.parentNode, equals(parent));
expect(child2.parentNode, equals(parent)); expect(child2.parentNode, equals(parent));
expect(child3.parentNode, equals(parent)); expect(child3.parentNode, equals(parent));
......
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
longPressRecognized = true; longPressRecognized = true;
}; };
new FakeAsync().run((async) { new FakeAsync().run((FakeAsync async) {
longPress.addPointer(down); longPress.addPointer(down);
GestureArena.instance.close(5); GestureArena.instance.close(5);
expect(longPressRecognized, isFalse); expect(longPressRecognized, isFalse);
...@@ -50,7 +50,7 @@ void main() { ...@@ -50,7 +50,7 @@ void main() {
longPressRecognized = true; longPressRecognized = true;
}; };
new FakeAsync().run((async) { new FakeAsync().run((FakeAsync async) {
longPress.addPointer(down); longPress.addPointer(down);
GestureArena.instance.close(5); GestureArena.instance.close(5);
expect(longPressRecognized, isFalse); expect(longPressRecognized, isFalse);
...@@ -82,7 +82,7 @@ void main() { ...@@ -82,7 +82,7 @@ void main() {
longPressRecognized = true; longPressRecognized = true;
}; };
new FakeAsync().run((async) { new FakeAsync().run((FakeAsync async) {
showPress.addPointer(down); showPress.addPointer(down);
longPress.addPointer(down); longPress.addPointer(down);
GestureArena.instance.close(5); GestureArena.instance.close(5);
......
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
showPressRecognized = true; showPressRecognized = true;
}; };
new FakeAsync().run((async) { new FakeAsync().run((FakeAsync async) {
showPress.addPointer(down); showPress.addPointer(down);
GestureArena.instance.close(5); GestureArena.instance.close(5);
expect(showPressRecognized, isFalse); expect(showPressRecognized, isFalse);
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
showPressRecognized = true; showPressRecognized = true;
}; };
new FakeAsync().run((async) { new FakeAsync().run((FakeAsync async) {
showPress.addPointer(down); showPress.addPointer(down);
GestureArena.instance.close(5); GestureArena.instance.close(5);
expect(showPressRecognized, isFalse); expect(showPressRecognized, isFalse);
......
...@@ -11,7 +11,7 @@ void main() { ...@@ -11,7 +11,7 @@ void main() {
backgroundColor: const Color(0xFF00FF00), backgroundColor: const Color(0xFF00FF00),
gradient: new RadialGradient( gradient: new RadialGradient(
center: Point.origin, radius: 500.0, center: Point.origin, radius: 500.0,
colors: [Colors.yellow[500], Colors.blue[500]]), colors: <Color>[Colors.yellow[500], Colors.blue[500]]),
boxShadow: shadows[3]) boxShadow: shadows[3])
); );
layout(root); layout(root);
...@@ -34,7 +34,7 @@ void main() { ...@@ -34,7 +34,7 @@ void main() {
child: inner child: inner
); );
RenderBox flex = new RenderFlex( RenderBox flex = new RenderFlex(
children: [padding], children: <RenderBox>[padding],
direction: FlexDirection.vertical, direction: FlexDirection.vertical,
alignItems: FlexAlignItems.stretch alignItems: FlexAlignItems.stretch
); );
......
...@@ -6,7 +6,7 @@ import 'rendering_tester.dart'; ...@@ -6,7 +6,7 @@ import 'rendering_tester.dart';
void main() { void main() {
test('Overconstrained flex', () { test('Overconstrained flex', () {
RenderDecoratedBox box = new RenderDecoratedBox(decoration: new BoxDecoration()); RenderDecoratedBox box = new RenderDecoratedBox(decoration: new BoxDecoration());
RenderFlex flex = new RenderFlex(children: [ box ]); RenderFlex flex = new RenderFlex(children: <RenderBox>[box]);
layout(flex, constraints: const BoxConstraints( layout(flex, constraints: const BoxConstraints(
minWidth: 200.0, maxWidth: 100.0, minHeight: 200.0, maxHeight: 100.0) minWidth: 200.0, maxWidth: 100.0, minHeight: 200.0, maxHeight: 100.0)
); );
...@@ -24,7 +24,7 @@ void main() { ...@@ -24,7 +24,7 @@ void main() {
test('Parent data', () { test('Parent data', () {
RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: new BoxDecoration()); RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: new BoxDecoration());
RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration()); RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration());
RenderFlex flex = new RenderFlex(children: [ box1, box2 ]); RenderFlex flex = new RenderFlex(children: <RenderBox>[box1, box2]);
layout(flex, constraints: const BoxConstraints( layout(flex, constraints: const BoxConstraints(
minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0) minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0)
); );
...@@ -33,7 +33,8 @@ void main() { ...@@ -33,7 +33,8 @@ void main() {
expect(box2.size.width, equals(0.0)); expect(box2.size.width, equals(0.0));
expect(box2.size.height, equals(0.0)); expect(box2.size.height, equals(0.0));
box2.parentData.flex = 1; final FlexParentData box2ParentData = box2.parentData;
box2ParentData.flex = 1;
flex.markNeedsLayout(); flex.markNeedsLayout();
pumpFrame(); pumpFrame();
expect(box1.size.width, equals(0.0)); expect(box1.size.width, equals(0.0));
...@@ -47,8 +48,9 @@ void main() { ...@@ -47,8 +48,9 @@ void main() {
RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration()); RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration());
RenderFlex flex = new RenderFlex(); RenderFlex flex = new RenderFlex();
flex.setupParentData(box2); flex.setupParentData(box2);
box2.parentData.flex = 2; final FlexParentData box2ParentData = box2.parentData;
flex.addAll([box1, box2]); box2ParentData.flex = 2;
flex.addAll(<RenderBox>[box1, box2]);
layout(flex, constraints: const BoxConstraints( layout(flex, constraints: const BoxConstraints(
minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0) minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0)
); );
......
...@@ -5,7 +5,7 @@ import 'rendering_tester.dart'; ...@@ -5,7 +5,7 @@ import 'rendering_tester.dart';
void main() { void main() {
test('Basic grid layout test', () { test('Basic grid layout test', () {
List<RenderBox> children = [ List<RenderBox> children = <RenderBox>[
new RenderDecoratedBox(decoration: new BoxDecoration()), new RenderDecoratedBox(decoration: new BoxDecoration()),
new RenderDecoratedBox(decoration: new BoxDecoration()), new RenderDecoratedBox(decoration: new BoxDecoration()),
new RenderDecoratedBox(decoration: new BoxDecoration()), new RenderDecoratedBox(decoration: new BoxDecoration()),
...@@ -15,7 +15,7 @@ void main() { ...@@ -15,7 +15,7 @@ void main() {
RenderGrid grid = new RenderGrid(children: children, maxChildExtent: 100.0); RenderGrid grid = new RenderGrid(children: children, maxChildExtent: 100.0);
layout(grid, constraints: const BoxConstraints(maxWidth: 200.0)); layout(grid, constraints: const BoxConstraints(maxWidth: 200.0));
children.forEach((child) { children.forEach((RenderBox child) {
expect(child.size.width, equals(100.0), reason: "child width"); expect(child.size.width, equals(100.0), reason: "child width");
expect(child.size.height, equals(100.0), reason: "child height"); expect(child.size.height, equals(100.0), reason: "child height");
}); });
...@@ -29,7 +29,7 @@ void main() { ...@@ -29,7 +29,7 @@ void main() {
pumpFrame(); pumpFrame();
children.forEach((child) { children.forEach((RenderBox child) {
expect(child.size.width, equals(50.0), reason: "child width"); expect(child.size.width, equals(50.0), reason: "child width");
expect(child.size.height, equals(50.0), reason: "child height"); expect(child.size.height, equals(50.0), reason: "child height");
}); });
......
...@@ -19,7 +19,7 @@ void main() { ...@@ -19,7 +19,7 @@ void main() {
backgroundColor: const Color(0xFFFF0000) backgroundColor: const Color(0xFFFF0000)
)); ));
RenderBox stack = new RenderStack(children: [red, green]); RenderBox stack = new RenderStack(children: <RenderBox>[red, green]);
(green.parentData as StackParentData) (green.parentData as StackParentData)
..top = 0.0 ..top = 0.0
..right = 0.0 ..right = 0.0
......
...@@ -10,7 +10,7 @@ void main() { ...@@ -10,7 +10,7 @@ void main() {
test('Cannot scroll a non-overflowing block', () { test('Cannot scroll a non-overflowing block', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget( tester.pumpWidget(
new Block([ new Block(<Widget>[
new Container( new Container(
height: 200.0, // less than 600, the height of the test area height: 200.0, // less than 600, the height of the test area
child: new Text('Hello') child: new Text('Hello')
...@@ -37,7 +37,7 @@ void main() { ...@@ -37,7 +37,7 @@ void main() {
test('Can scroll an overflowing block', () { test('Can scroll an overflowing block', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget( tester.pumpWidget(
new Block([ new Block(<Widget>[
new Container( new Container(
height: 2000.0, // more than 600, the height of the test area height: 2000.0, // more than 600, the height of the test area
child: new Text('Hello') child: new Text('Hello')
......
...@@ -6,7 +6,7 @@ import 'widget_tester.dart'; ...@@ -6,7 +6,7 @@ import 'widget_tester.dart';
void main() { void main() {
test('Can be placed in an infinte box', () { test('Can be placed in an infinte box', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new Block([new Center()])); tester.pumpWidget(new Block(<Widget>[new Center()]));
}); });
}); });
} }
...@@ -11,7 +11,7 @@ void main() { ...@@ -11,7 +11,7 @@ void main() {
Key keyB = new GlobalKey(); Key keyB = new GlobalKey();
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
top: 100.0, top: 100.0,
left: 100.0, left: 100.0,
......
...@@ -8,7 +8,7 @@ void main() { ...@@ -8,7 +8,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
DateTime currentValue; DateTime currentValue;
Widget widget = new Block([ Widget widget = new Block(<Widget>[
new DatePicker( new DatePicker(
selectedDate: new DateTime.utc(2015, 6, 9, 7, 12), selectedDate: new DateTime.utc(2015, 6, 9, 7, 12),
firstDate: new DateTime.utc(2013), firstDate: new DateTime.utc(2013),
......
...@@ -8,7 +8,7 @@ import 'widget_tester.dart'; ...@@ -8,7 +8,7 @@ import 'widget_tester.dart';
const double itemExtent = 100.0; const double itemExtent = 100.0;
ScrollDirection scrollDirection = ScrollDirection.vertical; ScrollDirection scrollDirection = ScrollDirection.vertical;
DismissDirection dismissDirection = DismissDirection.horizontal; DismissDirection dismissDirection = DismissDirection.horizontal;
List<int> dismissedItems = []; List<int> dismissedItems = <int>[];
void handleOnResized(item) { void handleOnResized(item) {
expect(dismissedItems.contains(item), isFalse); expect(dismissedItems.contains(item), isFalse);
...@@ -117,7 +117,7 @@ void main() { ...@@ -117,7 +117,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
scrollDirection = ScrollDirection.vertical; scrollDirection = ScrollDirection.vertical;
dismissDirection = DismissDirection.horizontal; dismissDirection = DismissDirection.horizontal;
dismissedItems = []; dismissedItems = <int>[];
tester.pumpWidget(widgetBuilder()); tester.pumpWidget(widgetBuilder());
expect(dismissedItems, isEmpty); expect(dismissedItems, isEmpty);
...@@ -136,7 +136,7 @@ void main() { ...@@ -136,7 +136,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
scrollDirection = ScrollDirection.horizontal; scrollDirection = ScrollDirection.horizontal;
dismissDirection = DismissDirection.vertical; dismissDirection = DismissDirection.vertical;
dismissedItems = []; dismissedItems = <int>[];
tester.pumpWidget(widgetBuilder()); tester.pumpWidget(widgetBuilder());
expect(dismissedItems, isEmpty); expect(dismissedItems, isEmpty);
...@@ -155,7 +155,7 @@ void main() { ...@@ -155,7 +155,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
scrollDirection = ScrollDirection.vertical; scrollDirection = ScrollDirection.vertical;
dismissDirection = DismissDirection.left; dismissDirection = DismissDirection.left;
dismissedItems = []; dismissedItems = <int>[];
tester.pumpWidget(widgetBuilder()); tester.pumpWidget(widgetBuilder());
expect(dismissedItems, isEmpty); expect(dismissedItems, isEmpty);
...@@ -174,7 +174,7 @@ void main() { ...@@ -174,7 +174,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
scrollDirection = ScrollDirection.vertical; scrollDirection = ScrollDirection.vertical;
dismissDirection = DismissDirection.right; dismissDirection = DismissDirection.right;
dismissedItems = []; dismissedItems = <int>[];
tester.pumpWidget(widgetBuilder()); tester.pumpWidget(widgetBuilder());
expect(dismissedItems, isEmpty); expect(dismissedItems, isEmpty);
...@@ -193,7 +193,7 @@ void main() { ...@@ -193,7 +193,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
scrollDirection = ScrollDirection.horizontal; scrollDirection = ScrollDirection.horizontal;
dismissDirection = DismissDirection.up; dismissDirection = DismissDirection.up;
dismissedItems = []; dismissedItems = <int>[];
tester.pumpWidget(widgetBuilder()); tester.pumpWidget(widgetBuilder());
expect(dismissedItems, isEmpty); expect(dismissedItems, isEmpty);
...@@ -212,7 +212,7 @@ void main() { ...@@ -212,7 +212,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
scrollDirection = ScrollDirection.horizontal; scrollDirection = ScrollDirection.horizontal;
dismissDirection = DismissDirection.down; dismissDirection = DismissDirection.down;
dismissedItems = []; dismissedItems = <int>[];
tester.pumpWidget(widgetBuilder()); tester.pumpWidget(widgetBuilder());
expect(dismissedItems, isEmpty); expect(dismissedItems, isEmpty);
...@@ -233,7 +233,7 @@ void main() { ...@@ -233,7 +233,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
scrollDirection = ScrollDirection.horizontal; scrollDirection = ScrollDirection.horizontal;
dismissDirection = DismissDirection.down; dismissDirection = DismissDirection.down;
dismissedItems = []; dismissedItems = <int>[];
tester.pumpWidget(widgetBuilder()); tester.pumpWidget(widgetBuilder());
Element itemElement = tester.findText('0'); Element itemElement = tester.findText('0');
...@@ -261,7 +261,7 @@ void main() { ...@@ -261,7 +261,7 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 1000.0, height: 1000.0,
child: new Column([ child: new Column(<Widget>[
new Test1215DismissableComponent('1'), new Test1215DismissableComponent('1'),
new Test1215DismissableComponent('2') new Test1215DismissableComponent('2')
]) ])
......
...@@ -12,8 +12,8 @@ void main() { ...@@ -12,8 +12,8 @@ void main() {
List accepted = []; List accepted = [];
tester.pumpWidget(new Navigator( tester.pumpWidget(new Navigator(
routes: { routes: <String, RouteBuilder>{
'/': (RouteArguments args) { return new Column([ '/': (RouteArguments args) { return new Column(<Widget>[
new Draggable( new Draggable(
navigator: args.navigator, navigator: args.navigator,
data: 1, data: 1,
......
...@@ -11,7 +11,7 @@ void main() { ...@@ -11,7 +11,7 @@ void main() {
NavigatorState navigator; NavigatorState navigator;
tester.pumpWidget( tester.pumpWidget(
new MaterialApp( new MaterialApp(
routes: { routes: <String, RouteBuilder>{
'/': (RouteArguments args) { '/': (RouteArguments args) {
navigator = args.navigator; navigator = args.navigator;
new Container(); new Container();
...@@ -40,7 +40,7 @@ void main() { ...@@ -40,7 +40,7 @@ void main() {
tester.pumpWidget(new Container()); // throw away the old App and its Navigator tester.pumpWidget(new Container()); // throw away the old App and its Navigator
tester.pumpWidget( tester.pumpWidget(
new MaterialApp( new MaterialApp(
routes: { routes: <String, RouteBuilder>{
'/': (RouteArguments args) { '/': (RouteArguments args) {
navigator = args.navigator; navigator = args.navigator;
new Container(); new Container();
......
...@@ -8,7 +8,7 @@ class Item { ...@@ -8,7 +8,7 @@ class Item {
GlobalKey key2 = new GlobalKey(); GlobalKey key2 = new GlobalKey();
String toString() => "Item($key1, $key2)"; String toString() => "Item($key1, $key2)";
} }
List<Item> items = [new Item(), new Item()]; List<Item> items = <Item>[new Item(), new Item()];
class StatefulLeaf extends StatefulComponent { class StatefulLeaf extends StatefulComponent {
StatefulLeaf({ GlobalKey key }) : super(key: key); StatefulLeaf({ GlobalKey key }) : super(key: key);
...@@ -34,7 +34,7 @@ class KeyedWrapper extends StatelessComponent { ...@@ -34,7 +34,7 @@ class KeyedWrapper extends StatelessComponent {
} }
Widget builder() { Widget builder() {
return new Column([ return new Column(<Widget>[
new KeyedWrapper(items[1].key1, items[1].key2), new KeyedWrapper(items[1].key1, items[1].key2),
new KeyedWrapper(items[0].key1, items[0].key2) new KeyedWrapper(items[0].key1, items[0].key2)
]); ]);
......
...@@ -12,11 +12,11 @@ void main() { ...@@ -12,11 +12,11 @@ void main() {
decoration: const BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFF00FF00) backgroundColor: const Color(0xFF00FF00)
), ),
child: new Stack([ child: new Stack(<Widget>[
new Positioned( new Positioned(
top: 10.0, top: 10.0,
left: 10.0, left: 10.0,
child: new Column([ child: new Column(<Widget>[
new GestureDetector( new GestureDetector(
onTap: () { onTap: () {
didReceiveTap = true; didReceiveTap = true;
......
...@@ -23,7 +23,7 @@ void main() { ...@@ -23,7 +23,7 @@ void main() {
GlobalKey keyB = new GlobalKey(); GlobalKey keyB = new GlobalKey();
tester.pumpWidget( tester.pumpWidget(
new Focus( new Focus(
child: new Column([ child: new Column(<Widget>[
// reverse these when you fix https://github.com/flutter/engine/issues/1495 // reverse these when you fix https://github.com/flutter/engine/issues/1495
new TestFocusable('b', 'B FOCUSED', keyB), new TestFocusable('b', 'B FOCUSED', keyB),
new TestFocusable('a', 'A FOCUSED', keyA), new TestFocusable('a', 'A FOCUSED', keyA),
......
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
tester.pumpWidget(builder()); tester.pumpWidget(builder());
StatefulComponentElement element = tester.findElement((element) => element.widget is FlipComponent); StatefulComponentElement element = tester.findElement((Element element) => element.widget is FlipComponent);
FlipComponentState testComponent = element.state; FlipComponentState testComponent = element.state;
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); expect(callbackTracker, equals([0, 1, 2, 3, 4, 5]));
......
...@@ -37,7 +37,7 @@ void main() { ...@@ -37,7 +37,7 @@ void main() {
child: new Input( child: new Input(
key: inputKey, key: inputKey,
placeholder: 'Placeholder', placeholder: 'Placeholder',
onChanged: (value) { inputValue = value; } onChanged: (String value) { inputValue = value; }
) )
); );
} }
......
...@@ -31,7 +31,7 @@ void main() { ...@@ -31,7 +31,7 @@ void main() {
tester.pumpWidget(builder()); tester.pumpWidget(builder());
StatefulComponentElement element = tester.findElement((element) => element.widget is FlipComponent); StatefulComponentElement element = tester.findElement((Element element) => element.widget is FlipComponent);
FlipComponentState testComponent = element.state; FlipComponentState testComponent = element.state;
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); expect(callbackTracker, equals([0, 1, 2, 3, 4, 5]));
......
...@@ -7,7 +7,7 @@ import 'widget_tester.dart'; ...@@ -7,7 +7,7 @@ import 'widget_tester.dart';
void checkTree(WidgetTester tester, List<BoxDecoration> expectedDecorations) { void checkTree(WidgetTester tester, List<BoxDecoration> expectedDecorations) {
MultiChildRenderObjectElement element = MultiChildRenderObjectElement element =
tester.findElement((element) => element is MultiChildRenderObjectElement); tester.findElement((Element element) => element is MultiChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderStack, isTrue); expect(element.renderObject is RenderStack, isTrue);
RenderStack renderObject = element.renderObject; RenderStack renderObject = element.renderObject;
...@@ -17,7 +17,8 @@ void checkTree(WidgetTester tester, List<BoxDecoration> expectedDecorations) { ...@@ -17,7 +17,8 @@ void checkTree(WidgetTester tester, List<BoxDecoration> expectedDecorations) {
expect(child is RenderDecoratedBox, isTrue); expect(child is RenderDecoratedBox, isTrue);
RenderDecoratedBox decoratedBox = child; RenderDecoratedBox decoratedBox = child;
expect(decoratedBox.decoration, equals(decoration)); expect(decoratedBox.decoration, equals(decoration));
child = decoratedBox.parentData.nextSibling; final StackParentData decoratedBoxParentData = decoratedBox.parentData;
child = decoratedBoxParentData.nextSibling;
} }
expect(child, isNull); expect(child, isNull);
} catch (e) { } catch (e) {
...@@ -31,67 +32,67 @@ void main() { ...@@ -31,67 +32,67 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(decoration: kBoxDecorationA), new DecoratedBox(decoration: kBoxDecorationA),
new DecoratedBox(decoration: kBoxDecorationB), new DecoratedBox(decoration: kBoxDecorationB),
new DecoratedBox(decoration: kBoxDecorationC), new DecoratedBox(decoration: kBoxDecorationC),
]) ])
); );
checkTree(tester, [kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(decoration: kBoxDecorationA), new DecoratedBox(decoration: kBoxDecorationA),
new DecoratedBox(decoration: kBoxDecorationC), new DecoratedBox(decoration: kBoxDecorationC),
]) ])
); );
checkTree(tester, [kBoxDecorationA, kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationC]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(decoration: kBoxDecorationA), new DecoratedBox(decoration: kBoxDecorationA),
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB), new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
new DecoratedBox(decoration: kBoxDecorationC), new DecoratedBox(decoration: kBoxDecorationC),
]) ])
); );
checkTree(tester, [kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB), new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
new DecoratedBox(decoration: kBoxDecorationC), new DecoratedBox(decoration: kBoxDecorationC),
new DecoratedBox(key: new Key('a'), decoration: kBoxDecorationA), new DecoratedBox(key: new Key('a'), decoration: kBoxDecorationA),
]) ])
); );
checkTree(tester, [kBoxDecorationB, kBoxDecorationC, kBoxDecorationA]); checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationC, kBoxDecorationA]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(key: new Key('a'), decoration: kBoxDecorationA), new DecoratedBox(key: new Key('a'), decoration: kBoxDecorationA),
new DecoratedBox(decoration: kBoxDecorationC), new DecoratedBox(decoration: kBoxDecorationC),
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB), new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
]) ])
); );
checkTree(tester, [kBoxDecorationA, kBoxDecorationC, kBoxDecorationB]); checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationC, kBoxDecorationB]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(decoration: kBoxDecorationC), new DecoratedBox(decoration: kBoxDecorationC),
]) ])
); );
checkTree(tester, [kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationC]);
tester.pumpWidget( tester.pumpWidget(
new Stack([]) new Stack(<Widget>[])
); );
checkTree(tester, []); checkTree(tester, <BoxDecoration>[]);
}); });
}); });
...@@ -100,17 +101,17 @@ void main() { ...@@ -100,17 +101,17 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(decoration: kBoxDecorationA), new DecoratedBox(decoration: kBoxDecorationA),
new DecoratedBox(decoration: kBoxDecorationB), new DecoratedBox(decoration: kBoxDecorationB),
new DecoratedBox(decoration: kBoxDecorationC), new DecoratedBox(decoration: kBoxDecorationC),
]) ])
); );
checkTree(tester, [kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(decoration: kBoxDecorationA), new DecoratedBox(decoration: kBoxDecorationA),
new Container( new Container(
child: new DecoratedBox(decoration: kBoxDecorationB) child: new DecoratedBox(decoration: kBoxDecorationB)
...@@ -119,10 +120,10 @@ void main() { ...@@ -119,10 +120,10 @@ void main() {
]) ])
); );
checkTree(tester, [kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(decoration: kBoxDecorationA), new DecoratedBox(decoration: kBoxDecorationA),
new Container( new Container(
child: new Container( child: new Container(
...@@ -133,10 +134,10 @@ void main() { ...@@ -133,10 +134,10 @@ void main() {
]) ])
); );
checkTree(tester, [kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Container( new Container(
child: new Container( child: new Container(
child: new DecoratedBox(decoration: kBoxDecorationB) child: new DecoratedBox(decoration: kBoxDecorationB)
...@@ -149,10 +150,10 @@ void main() { ...@@ -149,10 +150,10 @@ void main() {
]) ])
); );
checkTree(tester, [kBoxDecorationB, kBoxDecorationA, kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationA, kBoxDecorationC]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Container( new Container(
child: new DecoratedBox(decoration: kBoxDecorationB) child: new DecoratedBox(decoration: kBoxDecorationB)
), ),
...@@ -163,10 +164,10 @@ void main() { ...@@ -163,10 +164,10 @@ void main() {
]) ])
); );
checkTree(tester, [kBoxDecorationB, kBoxDecorationA, kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationA, kBoxDecorationC]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Container( new Container(
key: new Key('b'), key: new Key('b'),
child: new DecoratedBox(decoration: kBoxDecorationB) child: new DecoratedBox(decoration: kBoxDecorationB)
...@@ -178,10 +179,10 @@ void main() { ...@@ -178,10 +179,10 @@ void main() {
]) ])
); );
checkTree(tester, [kBoxDecorationB, kBoxDecorationA]); checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationA]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Container( new Container(
key: new Key('a'), key: new Key('a'),
child: new DecoratedBox(decoration: kBoxDecorationA) child: new DecoratedBox(decoration: kBoxDecorationA)
...@@ -193,29 +194,29 @@ void main() { ...@@ -193,29 +194,29 @@ void main() {
]) ])
); );
checkTree(tester, [kBoxDecorationA, kBoxDecorationB]); checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ ]) new Stack(<Widget>[])
); );
checkTree(tester, []); checkTree(tester, <BoxDecoration>[]);
}); });
}); });
test('MultiChildRenderObjectElement with stateful components', () { test('MultiChildRenderObjectElement with stateful components', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(decoration: kBoxDecorationA), new DecoratedBox(decoration: kBoxDecorationA),
new DecoratedBox(decoration: kBoxDecorationB), new DecoratedBox(decoration: kBoxDecorationB),
]) ])
); );
checkTree(tester, [kBoxDecorationA, kBoxDecorationB]); checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new FlipComponent( new FlipComponent(
left: new DecoratedBox(decoration: kBoxDecorationA), left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB) right: new DecoratedBox(decoration: kBoxDecorationB)
...@@ -224,15 +225,15 @@ void main() { ...@@ -224,15 +225,15 @@ void main() {
]) ])
); );
checkTree(tester, [kBoxDecorationA, kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationC]);
flipStatefulComponent(tester); flipStatefulComponent(tester);
tester.pump(); tester.pump();
checkTree(tester, [kBoxDecorationB, kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationC]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new FlipComponent( new FlipComponent(
left: new DecoratedBox(decoration: kBoxDecorationA), left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB) right: new DecoratedBox(decoration: kBoxDecorationB)
...@@ -240,15 +241,15 @@ void main() { ...@@ -240,15 +241,15 @@ void main() {
]) ])
); );
checkTree(tester, [kBoxDecorationB]); checkTree(tester, <BoxDecoration>[kBoxDecorationB]);
flipStatefulComponent(tester); flipStatefulComponent(tester);
tester.pump(); tester.pump();
checkTree(tester, [kBoxDecorationA]); checkTree(tester, <BoxDecoration>[kBoxDecorationA]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new FlipComponent( new FlipComponent(
key: new Key('flip'), key: new Key('flip'),
left: new DecoratedBox(decoration: kBoxDecorationA), left: new DecoratedBox(decoration: kBoxDecorationA),
...@@ -258,7 +259,7 @@ void main() { ...@@ -258,7 +259,7 @@ void main() {
); );
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(key: new Key('c'), decoration: kBoxDecorationC), new DecoratedBox(key: new Key('c'), decoration: kBoxDecorationC),
new FlipComponent( new FlipComponent(
key: new Key('flip'), key: new Key('flip'),
...@@ -268,15 +269,15 @@ void main() { ...@@ -268,15 +269,15 @@ void main() {
]) ])
); );
checkTree(tester, [kBoxDecorationC, kBoxDecorationA]); checkTree(tester, <BoxDecoration>[kBoxDecorationC, kBoxDecorationA]);
flipStatefulComponent(tester); flipStatefulComponent(tester);
tester.pump(); tester.pump();
checkTree(tester, [kBoxDecorationC, kBoxDecorationB]); checkTree(tester, <BoxDecoration>[kBoxDecorationC, kBoxDecorationB]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new FlipComponent( new FlipComponent(
key: new Key('flip'), key: new Key('flip'),
left: new DecoratedBox(decoration: kBoxDecorationA), left: new DecoratedBox(decoration: kBoxDecorationA),
...@@ -286,7 +287,7 @@ void main() { ...@@ -286,7 +287,7 @@ void main() {
]) ])
); );
checkTree(tester, [kBoxDecorationB, kBoxDecorationC]); checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationC]);
}); });
}); });
} }
...@@ -16,7 +16,7 @@ class TestParentData { ...@@ -16,7 +16,7 @@ class TestParentData {
void checkTree(WidgetTester tester, List<TestParentData> expectedParentData) { void checkTree(WidgetTester tester, List<TestParentData> expectedParentData) {
MultiChildRenderObjectElement element = MultiChildRenderObjectElement element =
tester.findElement((element) => element is MultiChildRenderObjectElement); tester.findElement((Element element) => element is MultiChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderStack, isTrue); expect(element.renderObject is RenderStack, isTrue);
RenderStack renderObject = element.renderObject; RenderStack renderObject = element.renderObject;
...@@ -31,7 +31,7 @@ void checkTree(WidgetTester tester, List<TestParentData> expectedParentData) { ...@@ -31,7 +31,7 @@ void checkTree(WidgetTester tester, List<TestParentData> expectedParentData) {
expect(parentData.right, equals(expected.right)); expect(parentData.right, equals(expected.right));
expect(parentData.bottom, equals(expected.bottom)); expect(parentData.bottom, equals(expected.bottom));
expect(parentData.left, equals(expected.left)); expect(parentData.left, equals(expected.left));
child = decoratedBox.parentData.nextSibling; child = (decoratedBox.parentData as StackParentData).nextSibling;
} }
expect(child, isNull); expect(child, isNull);
} catch (e) { } catch (e) {
...@@ -61,7 +61,7 @@ void main() { ...@@ -61,7 +61,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new DecoratedBox(decoration: kBoxDecorationA), new DecoratedBox(decoration: kBoxDecorationA),
new Positioned( new Positioned(
top: 10.0, top: 10.0,
...@@ -72,14 +72,14 @@ void main() { ...@@ -72,14 +72,14 @@ void main() {
]) ])
); );
checkTree(tester, [ checkTree(tester, <TestParentData>[
kNonPositioned, kNonPositioned,
new TestParentData(top: 10.0, left: 10.0), new TestParentData(top: 10.0, left: 10.0),
kNonPositioned, kNonPositioned,
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
bottom: 5.0, bottom: 5.0,
right: 7.0, right: 7.0,
...@@ -94,7 +94,7 @@ void main() { ...@@ -94,7 +94,7 @@ void main() {
]) ])
); );
checkTree(tester, [ checkTree(tester, <TestParentData>[
new TestParentData(bottom: 5.0, right: 7.0), new TestParentData(bottom: 5.0, right: 7.0),
new TestParentData(top: 10.0, left: 10.0), new TestParentData(top: 10.0, left: 10.0),
kNonPositioned, kNonPositioned,
...@@ -105,7 +105,7 @@ void main() { ...@@ -105,7 +105,7 @@ void main() {
DecoratedBox kDecoratedBoxC = new DecoratedBox(decoration: kBoxDecorationC); DecoratedBox kDecoratedBoxC = new DecoratedBox(decoration: kBoxDecorationC);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
bottom: 5.0, bottom: 5.0,
right: 7.0, right: 7.0,
...@@ -120,14 +120,14 @@ void main() { ...@@ -120,14 +120,14 @@ void main() {
]) ])
); );
checkTree(tester, [ checkTree(tester, <TestParentData>[
new TestParentData(bottom: 5.0, right: 7.0), new TestParentData(bottom: 5.0, right: 7.0),
new TestParentData(top: 10.0, left: 10.0), new TestParentData(top: 10.0, left: 10.0),
kNonPositioned, kNonPositioned,
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
bottom: 6.0, bottom: 6.0,
right: 8.0, right: 8.0,
...@@ -142,14 +142,14 @@ void main() { ...@@ -142,14 +142,14 @@ void main() {
]) ])
); );
checkTree(tester, [ checkTree(tester, <TestParentData>[
new TestParentData(bottom: 6.0, right: 8.0), new TestParentData(bottom: 6.0, right: 8.0),
new TestParentData(left: 10.0, right: 10.0), new TestParentData(left: 10.0, right: 10.0),
kNonPositioned, kNonPositioned,
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
kDecoratedBoxA, kDecoratedBoxA,
new Positioned( new Positioned(
left: 11.0, left: 11.0,
...@@ -160,14 +160,14 @@ void main() { ...@@ -160,14 +160,14 @@ void main() {
]) ])
); );
checkTree(tester, [ checkTree(tester, <TestParentData>[
kNonPositioned, kNonPositioned,
new TestParentData(left: 11.0, right: 12.0), new TestParentData(left: 11.0, right: 12.0),
kNonPositioned, kNonPositioned,
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
kDecoratedBoxA, kDecoratedBoxA,
new Positioned( new Positioned(
right: 10.0, right: 10.0,
...@@ -182,14 +182,14 @@ void main() { ...@@ -182,14 +182,14 @@ void main() {
]) ])
); );
checkTree(tester, [ checkTree(tester, <TestParentData>[
kNonPositioned, kNonPositioned,
new TestParentData(right: 10.0), new TestParentData(right: 10.0),
new TestParentData(top: 8.0), new TestParentData(top: 8.0),
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
right: 10.0, right: 10.0,
child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB) child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB)
...@@ -197,19 +197,19 @@ void main() { ...@@ -197,19 +197,19 @@ void main() {
]) ])
); );
checkTree(tester, [ checkTree(tester, <TestParentData>[
new TestParentData(right: 10.0), new TestParentData(right: 10.0),
]); ]);
flipStatefulComponent(tester); flipStatefulComponent(tester);
tester.pump(); tester.pump();
checkTree(tester, [ checkTree(tester, <TestParentData>[
new TestParentData(right: 10.0), new TestParentData(right: 10.0),
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
top: 7.0, top: 7.0,
child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB) child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB)
...@@ -217,22 +217,22 @@ void main() { ...@@ -217,22 +217,22 @@ void main() {
]) ])
); );
checkTree(tester, [ checkTree(tester, <TestParentData>[
new TestParentData(top: 7.0), new TestParentData(top: 7.0),
]); ]);
flipStatefulComponent(tester); flipStatefulComponent(tester);
tester.pump(); tester.pump();
checkTree(tester, [ checkTree(tester, <TestParentData>[
new TestParentData(top: 7.0), new TestParentData(top: 7.0),
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack([]) new Stack(<Widget>[])
); );
checkTree(tester, []); checkTree(tester, <TestParentData>[]);
}); });
}); });
...@@ -241,7 +241,7 @@ void main() { ...@@ -241,7 +241,7 @@ void main() {
expect(cachedException, isNull); expect(cachedException, isNull);
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
top: 5.0, top: 5.0,
bottom: 8.0, bottom: 8.0,
...@@ -257,14 +257,14 @@ void main() { ...@@ -257,14 +257,14 @@ void main() {
expect(cachedException, isNotNull); expect(cachedException, isNotNull);
cachedException = null; cachedException = null;
tester.pumpWidget(new Stack([])); tester.pumpWidget(new Stack(<Widget>[]));
checkTree(tester, []); checkTree(tester, <TestParentData>[]);
expect(cachedException, isNull); expect(cachedException, isNull);
tester.pumpWidget( tester.pumpWidget(
new Container( new Container(
child: new Flex([ child: new Flex(<Widget>[
new Positioned( new Positioned(
top: 6.0, top: 6.0,
left: 7.0, left: 7.0,
...@@ -278,10 +278,10 @@ void main() { ...@@ -278,10 +278,10 @@ void main() {
cachedException = null; cachedException = null;
tester.pumpWidget( tester.pumpWidget(
new Stack([]) new Stack(<Widget>[])
); );
checkTree(tester, []); checkTree(tester, <TestParentData>[]);
}); });
}); });
} }
...@@ -8,11 +8,11 @@ import 'widget_tester.dart'; ...@@ -8,11 +8,11 @@ import 'widget_tester.dart';
void main() { void main() {
test('LinearProgressIndicator changes when its value changes', () { test('LinearProgressIndicator changes when its value changes', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new Block([new LinearProgressIndicator(value: 0.0)])); tester.pumpWidget(new Block(<Widget>[new LinearProgressIndicator(value: 0.0)]));
List<Layer> layers1 = tester.layers; List<Layer> layers1 = tester.layers;
tester.pumpWidget(new Block([new LinearProgressIndicator(value: 0.5)])); tester.pumpWidget(new Block(<Widget>[new LinearProgressIndicator(value: 0.5)]));
List<Layer> layers2 = tester.layers; List<Layer> layers2 = tester.layers;
expect(layers1, isNot(equals(layers2))); expect(layers1, isNot(equals(layers2)));
......
...@@ -19,7 +19,7 @@ void main() { ...@@ -19,7 +19,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationA)); tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationA));
OneChildRenderObjectElement element = OneChildRenderObjectElement element =
tester.findElement((element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is OneChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
RenderDecoratedBox renderObject = element.renderObject; RenderDecoratedBox renderObject = element.renderObject;
...@@ -27,7 +27,7 @@ void main() { ...@@ -27,7 +27,7 @@ void main() {
expect(renderObject.position, equals(BoxDecorationPosition.background)); expect(renderObject.position, equals(BoxDecorationPosition.background));
tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationB)); tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationB));
element = tester.findElement((element) => element is OneChildRenderObjectElement); element = tester.findElement((Element element) => element is OneChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
renderObject = element.renderObject; renderObject = element.renderObject;
...@@ -41,7 +41,7 @@ void main() { ...@@ -41,7 +41,7 @@ void main() {
void checkFullTree() { void checkFullTree() {
OneChildRenderObjectElement element = OneChildRenderObjectElement element =
tester.findElement((element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is OneChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
RenderDecoratedBox renderObject = element.renderObject; RenderDecoratedBox renderObject = element.renderObject;
...@@ -57,7 +57,7 @@ void main() { ...@@ -57,7 +57,7 @@ void main() {
void childBareTree() { void childBareTree() {
OneChildRenderObjectElement element = OneChildRenderObjectElement element =
tester.findElement((element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is OneChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
RenderDecoratedBox renderObject = element.renderObject; RenderDecoratedBox renderObject = element.renderObject;
...@@ -136,7 +136,7 @@ void main() { ...@@ -136,7 +136,7 @@ void main() {
)); ));
OneChildRenderObjectElement element = OneChildRenderObjectElement element =
tester.findElement((element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is OneChildRenderObjectElement);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
RenderDecoratedBox parent = element.renderObject; RenderDecoratedBox parent = element.renderObject;
expect(parent.child is RenderDecoratedBox, isTrue); expect(parent.child is RenderDecoratedBox, isTrue);
...@@ -152,7 +152,7 @@ void main() { ...@@ -152,7 +152,7 @@ void main() {
)); ));
element = element =
tester.findElement((element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is OneChildRenderObjectElement);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
expect(element.renderObject, equals(parent)); expect(element.renderObject, equals(parent));
expect(parent.child, isNull); expect(parent.child, isNull);
......
...@@ -33,7 +33,7 @@ void main() { ...@@ -33,7 +33,7 @@ void main() {
StateMarker grandchild = new StateMarker(); StateMarker grandchild = new StateMarker();
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Container( new Container(
child: new StateMarker(key: left) child: new StateMarker(key: left)
), ),
...@@ -55,7 +55,7 @@ void main() { ...@@ -55,7 +55,7 @@ void main() {
StateMarker newGrandchild = new StateMarker(); StateMarker newGrandchild = new StateMarker();
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Container( new Container(
child: new StateMarker( child: new StateMarker(
key: right, key: right,
...@@ -101,7 +101,7 @@ void main() { ...@@ -101,7 +101,7 @@ void main() {
(key.currentState as StateMarkerState).marker = "marked"; (key.currentState as StateMarkerState).marker = "marked";
tester.pumpWidget(new ScrollableList<int>( tester.pumpWidget(new ScrollableList<int>(
items: [0], items: <int>[0],
itemExtent: 100.0, itemExtent: 100.0,
itemBuilder: (BuildContext context, int item) { itemBuilder: (BuildContext context, int item) {
return new Container( return new Container(
......
...@@ -27,7 +27,7 @@ class ChangerState extends State<Changer> { ...@@ -27,7 +27,7 @@ class ChangerState extends State<Changer> {
void test() { setState(() { _state = true; }); } void test() { setState(() { _state = true; }); }
Widget build(BuildContext) => _state ? new Wrapper(config.child) : config.child; Widget build(BuildContext context) => _state ? new Wrapper(config.child) : config.child;
} }
class Wrapper extends StatelessComponent { class Wrapper extends StatelessComponent {
......
...@@ -10,8 +10,8 @@ ui.Shader createShader(Rect bounds) { ...@@ -10,8 +10,8 @@ ui.Shader createShader(Rect bounds) {
return new LinearGradient( return new LinearGradient(
begin: Point.origin, begin: Point.origin,
end: new Point(0.0, bounds.height), end: new Point(0.0, bounds.height),
colors: [const Color(0x00FFFFFF), const Color(0xFFFFFFFF)], colors: <Color>[const Color(0x00FFFFFF), const Color(0xFFFFFFFF)],
stops: [0.1, 0.35] stops: <double>[0.1, 0.35]
) )
.createShader(); .createShader();
} }
......
...@@ -8,10 +8,10 @@ import 'widget_tester.dart'; ...@@ -8,10 +8,10 @@ import 'widget_tester.dart';
void main() { void main() {
test('SizeObserver notices zero size', () { test('SizeObserver notices zero size', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
List results = []; List<Size> results = <Size>[];
tester.pumpWidget(new Center( tester.pumpWidget(new Center(
child: new SizeObserver( child: new SizeObserver(
callback: (size) { results.add(size); }, callback: (Size size) { results.add(size); },
child: new Container(width:0.0, height:0.0) child: new Container(width:0.0, height:0.0)
) )
)); ));
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
expect(results, equals([Size.zero])); expect(results, equals([Size.zero]));
tester.pumpWidget(new Center( tester.pumpWidget(new Center(
child: new SizeObserver( child: new SizeObserver(
callback: (size) { results.add(size); }, callback: (Size size) { results.add(size); },
child: new Container(width:100.0, height:0.0) child: new Container(width:100.0, height:0.0)
) )
)); ));
...@@ -29,7 +29,7 @@ void main() { ...@@ -29,7 +29,7 @@ void main() {
expect(results, equals([Size.zero, const Size(100.0, 0.0)])); expect(results, equals([Size.zero, const Size(100.0, 0.0)]));
tester.pumpWidget(new Center( tester.pumpWidget(new Center(
child: new SizeObserver( child: new SizeObserver(
callback: (size) { results.add(size); }, callback: (Size size) { results.add(size); },
child: new Container(width:0.0, height:0.0) child: new Container(width:0.0, height:0.0)
) )
)); ));
...@@ -38,7 +38,7 @@ void main() { ...@@ -38,7 +38,7 @@ void main() {
expect(results, equals([Size.zero, const Size(100.0, 0.0), Size.zero])); expect(results, equals([Size.zero, const Size(100.0, 0.0), Size.zero]));
tester.pumpWidget(new Center( tester.pumpWidget(new Center(
child: new SizeObserver( child: new SizeObserver(
callback: (size) { results.add(size); }, callback: (Size size) { results.add(size); },
child: new Container(width:0.0, height:0.0) child: new Container(width:0.0, height:0.0)
) )
)); ));
......
...@@ -11,7 +11,7 @@ void main() { ...@@ -11,7 +11,7 @@ void main() {
Key tapTarget = new Key('tap-target'); Key tapTarget = new Key('tap-target');
tester.pumpWidget(new MaterialApp( tester.pumpWidget(new MaterialApp(
routes: { routes: <String, RouteBuilder>{
'/': (RouteArguments args) { '/': (RouteArguments args) {
return new GestureDetector( return new GestureDetector(
onTap: () { onTap: () {
......
...@@ -35,7 +35,7 @@ Widget buildFrame() { ...@@ -35,7 +35,7 @@ Widget buildFrame() {
key: scrollableListKey, key: scrollableListKey,
snapOffsetCallback: snapOffsetCallback, snapOffsetCallback: snapOffsetCallback,
scrollDirection: scrollDirection, scrollDirection: scrollDirection,
items: [0, 1, 2, 3, 4, 5, 7, 8, 9], items: <int>[0, 1, 2, 3, 4, 5, 7, 8, 9],
itemBuilder: buildItem, itemBuilder: buildItem,
itemExtent: itemExtent itemExtent: itemExtent
) )
......
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
...@@ -6,13 +7,13 @@ import 'widget_tester.dart'; ...@@ -6,13 +7,13 @@ import 'widget_tester.dart';
void main() { void main() {
test('Can construct an empty Stack', () { test('Can construct an empty Stack', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new Stack([])); tester.pumpWidget(new Stack(<Widget>[]));
}); });
}); });
test('Can construct an empty Centered Stack', () { test('Can construct an empty Centered Stack', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new Center(child: new Stack([]))); tester.pumpWidget(new Center(child: new Stack(<Widget>[])));
}); });
}); });
...@@ -21,7 +22,7 @@ void main() { ...@@ -21,7 +22,7 @@ void main() {
Key key = new Key('container'); Key key = new Key('container');
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
left: 10.0, left: 10.0,
child: new Container( child: new Container(
...@@ -33,14 +34,18 @@ void main() { ...@@ -33,14 +34,18 @@ void main() {
]) ])
); );
Element container = tester.findElementByKey(key); Element container;
expect(container.renderObject.parentData.top, isNull); StackParentData parentData;
expect(container.renderObject.parentData.right, isNull);
expect(container.renderObject.parentData.bottom, isNull); container = tester.findElementByKey(key);
expect(container.renderObject.parentData.left, equals(10.0)); parentData = container.renderObject.parentData;
expect(parentData.top, isNull);
expect(parentData.right, isNull);
expect(parentData.bottom, isNull);
expect(parentData.left, equals(10.0));
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
right: 10.0, right: 10.0,
child: new Container( child: new Container(
...@@ -53,10 +58,11 @@ void main() { ...@@ -53,10 +58,11 @@ void main() {
); );
container = tester.findElementByKey(key); container = tester.findElementByKey(key);
expect(container.renderObject.parentData.top, isNull); parentData = container.renderObject.parentData;
expect(container.renderObject.parentData.right, equals(10.0)); expect(parentData.top, isNull);
expect(container.renderObject.parentData.bottom, isNull); expect(parentData.right, equals(10.0));
expect(container.renderObject.parentData.left, isNull); expect(parentData.bottom, isNull);
expect(parentData.left, isNull);
}); });
}); });
...@@ -65,21 +71,24 @@ void main() { ...@@ -65,21 +71,24 @@ void main() {
Key key = new Key('container'); Key key = new Key('container');
Container container = new Container(key: key, width: 10.0, height: 10.0); Container container = new Container(key: key, width: 10.0, height: 10.0);
tester.pumpWidget(new Stack([ new Positioned(left: 10.0, child: container) ])); tester.pumpWidget(new Stack(<Widget>[ new Positioned(left: 10.0, child: container) ]));
Element containerElement = tester.findElementByKey(key); Element containerElement = tester.findElementByKey(key);
expect(containerElement.renderObject.parentData.top, isNull); StackParentData parentData;
expect(containerElement.renderObject.parentData.right, isNull); parentData = containerElement.renderObject.parentData;
expect(containerElement.renderObject.parentData.bottom, isNull); expect(parentData.top, isNull);
expect(containerElement.renderObject.parentData.left, equals(10.0)); expect(parentData.right, isNull);
expect(parentData.bottom, isNull);
expect(parentData.left, equals(10.0));
tester.pumpWidget(new Stack([ container ])); tester.pumpWidget(new Stack(<Widget>[ container ]));
containerElement = tester.findElementByKey(key); containerElement = tester.findElementByKey(key);
expect(containerElement.renderObject.parentData.top, isNull); parentData = containerElement.renderObject.parentData;
expect(containerElement.renderObject.parentData.right, isNull); expect(parentData.top, isNull);
expect(containerElement.renderObject.parentData.bottom, isNull); expect(parentData.right, isNull);
expect(containerElement.renderObject.parentData.left, isNull); expect(parentData.bottom, isNull);
expect(parentData.left, isNull);
}); });
}); });
...@@ -90,7 +99,7 @@ void main() { ...@@ -90,7 +99,7 @@ void main() {
tester.pumpWidget( tester.pumpWidget(
new Center( new Center(
child: new Stack([ child: new Stack(<Widget>[
new Container(key: child0Key, width: 20.0, height: 20.0), new Container(key: child0Key, width: 20.0, height: 20.0),
new Container(key: child1Key, width: 10.0, height: 10.0) new Container(key: child1Key, width: 10.0, height: 10.0)
], ],
...@@ -101,22 +110,24 @@ void main() { ...@@ -101,22 +110,24 @@ void main() {
); );
Element child0 = tester.findElementByKey(child0Key); Element child0 = tester.findElementByKey(child0Key);
expect(child0.renderObject.parentData.position, equals(const Point(0.0, 0.0))); final StackParentData child0RenderObjectParentData = child0.renderObject.parentData;
expect(child0RenderObjectParentData.position, equals(const Point(0.0, 0.0)));
Element child1 = tester.findElementByKey(child1Key); Element child1 = tester.findElementByKey(child1Key);
expect(child1.renderObject.parentData.position, equals(const Point(5.0, 5.0))); final StackParentData child1RenderObjectParentData = child1.renderObject.parentData;
expect(child1RenderObjectParentData.position, equals(const Point(5.0, 5.0)));
}); });
}); });
test('Can construct an empty IndexedStack', () { test('Can construct an empty IndexedStack', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new IndexedStack([])); tester.pumpWidget(new IndexedStack(<Widget>[]));
}); });
}); });
test('Can construct an empty Centered IndexedStack', () { test('Can construct an empty Centered IndexedStack', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new Center(child: new IndexedStack([]))); tester.pumpWidget(new Center(child: new IndexedStack(<Widget>[])));
}); });
}); });
...@@ -126,9 +137,9 @@ void main() { ...@@ -126,9 +137,9 @@ void main() {
List<int> itemsPainted; List<int> itemsPainted;
Widget buildFrame(int index) { Widget buildFrame(int index) {
itemsPainted = []; itemsPainted = <int>[];
List<Widget> items = new List.generate(itemCount, (i) { List<Widget> items = new List<Widget>.generate(itemCount, (i) {
return new CustomPaint(child: new Text('$i'), callback: (_0, _1) { itemsPainted.add(i); }); return new CustomPaint(child: new Text('$i'), callback: (_, __) { itemsPainted.add(i); });
}); });
return new Center(child: new IndexedStack(items, index: index)); return new Center(child: new IndexedStack(items, index: index));
} }
...@@ -154,8 +165,8 @@ void main() { ...@@ -154,8 +165,8 @@ void main() {
List<int> itemsTapped; List<int> itemsTapped;
Widget buildFrame(int index) { Widget buildFrame(int index) {
itemsTapped = []; itemsTapped = <int>[];
List<Widget> items = new List.generate(itemCount, (i) { List<Widget> items = new List<Widget>.generate(itemCount, (i) {
return new GestureDetector(child: new Text('$i'), onTap: () { itemsTapped.add(i); }); return new GestureDetector(child: new Text('$i'), onTap: () { itemsTapped.add(i); });
}); });
return new Center(child: new IndexedStack(items, key: key, index: index)); return new Center(child: new IndexedStack(items, key: key, index: index));
......
...@@ -11,7 +11,7 @@ void main() { ...@@ -11,7 +11,7 @@ void main() {
void checkTree(BoxDecoration expectedDecoration) { void checkTree(BoxDecoration expectedDecoration) {
OneChildRenderObjectElement element = OneChildRenderObjectElement element =
tester.findElement((element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is OneChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
RenderDecoratedBox renderObject = element.renderObject; RenderDecoratedBox renderObject = element.renderObject;
......
...@@ -112,13 +112,13 @@ void main() { ...@@ -112,13 +112,13 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
Widget a = new TestWidget(persistentState: 0x61, syncedState: 0x41, child: new Text('apple')); Widget a = new TestWidget(persistentState: 0x61, syncedState: 0x41, child: new Text('apple'));
Widget b = new TestWidget(persistentState: 0x62, syncedState: 0x42, child: new Text('banana')); Widget b = new TestWidget(persistentState: 0x62, syncedState: 0x42, child: new Text('banana'));
tester.pumpWidget(new Column([])); tester.pumpWidget(new Column(<Widget>[]));
GlobalKey keyA = new GlobalKey(); GlobalKey keyA = new GlobalKey();
GlobalKey keyB = new GlobalKey(); GlobalKey keyB = new GlobalKey();
tester.pumpWidget( tester.pumpWidget(
new Column([ new Column(<Widget>[
new Container( new Container(
key: keyA, key: keyA,
child: a child: a
...@@ -143,7 +143,7 @@ void main() { ...@@ -143,7 +143,7 @@ void main() {
expect(second.syncedState, equals(0x42)); expect(second.syncedState, equals(0x42));
tester.pumpWidget( tester.pumpWidget(
new Column([ new Column(<Widget>[
new Container( new Container(
key: keyA, key: keyA,
child: a child: a
...@@ -170,7 +170,7 @@ void main() { ...@@ -170,7 +170,7 @@ void main() {
// since they are both "old" nodes, they shouldn't sync with each other even though they look alike // since they are both "old" nodes, they shouldn't sync with each other even though they look alike
tester.pumpWidget( tester.pumpWidget(
new Column([ new Column(<Widget>[
new Container( new Container(
key: keyA, key: keyA,
child: b child: b
......
...@@ -49,7 +49,7 @@ class TestBuildCounter extends StatelessComponent { ...@@ -49,7 +49,7 @@ class TestBuildCounter extends StatelessComponent {
void flipStatefulComponent(WidgetTester tester) { void flipStatefulComponent(WidgetTester tester) {
StatefulComponentElement stateElement = StatefulComponentElement stateElement =
tester.findElement((element) => element is StatefulComponentElement); tester.findElement((Element element) => element is StatefulComponentElement);
expect(stateElement, isNotNull); expect(stateElement, isNotNull);
expect(stateElement.state is FlipComponentState, isTrue); expect(stateElement.state is FlipComponentState, isTrue);
FlipComponentState state = stateElement.state; FlipComponentState state = stateElement.state;
......
...@@ -8,7 +8,7 @@ void main() { ...@@ -8,7 +8,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
bool didReceiveTap = false; bool didReceiveTap = false;
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
top: 100.0, top: 100.0,
left: 100.0, left: 100.0,
...@@ -53,7 +53,7 @@ void main() { ...@@ -53,7 +53,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
bool didReceiveTap = false; bool didReceiveTap = false;
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
top: 100.0, top: 100.0,
left: 100.0, left: 100.0,
...@@ -98,7 +98,7 @@ void main() { ...@@ -98,7 +98,7 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
bool didReceiveTap = false; bool didReceiveTap = false;
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(<Widget>[
new Positioned( new Positioned(
top: 100.0, top: 100.0,
left: 100.0, left: 100.0,
......
...@@ -24,11 +24,12 @@ class RootComponentState extends State<RootComponent> { ...@@ -24,11 +24,12 @@ class RootComponentState extends State<RootComponent> {
Widget build(BuildContext context) => child; Widget build(BuildContext context) => child;
} }
typedef Point SizeToPointFunction(Size size);
class WidgetTester { class WidgetTester {
WidgetTester._(FakeAsync async) WidgetTester._(FakeAsync async)
: async = async, : async = async,
clock = async.getClock(new DateTime.utc(2015, 1, 1)) { clock = async.getClock(new DateTime.utc(2015, 1, 1));
}
final FakeAsync async; final FakeAsync async;
final Clock clock; final Clock clock;
...@@ -46,7 +47,7 @@ class WidgetTester { ...@@ -46,7 +47,7 @@ class WidgetTester {
} }
List<Layer> _layers(Layer layer) { List<Layer> _layers(Layer layer) {
List<Layer> result = [layer]; List<Layer> result = <Layer>[layer];
if (layer is ContainerLayer) { if (layer is ContainerLayer) {
ContainerLayer root = layer; ContainerLayer root = layer;
Layer child = root.firstChild; Layer child = root.firstChild;
...@@ -124,7 +125,7 @@ class WidgetTester { ...@@ -124,7 +125,7 @@ class WidgetTester {
return _getElementPoint(element, (Size size) => size.bottomRight(Point.origin)); return _getElementPoint(element, (Size size) => size.bottomRight(Point.origin));
} }
Point _getElementPoint(Element element, Function sizeToPoint) { Point _getElementPoint(Element element, SizeToPointFunction sizeToPoint) {
assert(element != null); assert(element != null);
RenderBox box = element.renderObject as RenderBox; RenderBox box = element.renderObject as RenderBox;
assert(box != null); assert(box != null);
......
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