Commit 00cbdb38 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by Adam Barth

prefer const constructor (#8031)

parent e151a1a4
......@@ -232,7 +232,7 @@ class SnackBar extends StatelessWidget {
child: new Semantics(
container: true,
child: new Dismissable(
key: new Key('dismissable'),
key: const Key('dismissable'),
direction: DismissDirection.down,
resizeDuration: null,
onDismissed: (DismissDirection direction) {
......
......@@ -135,7 +135,7 @@ typedef void GlobalKeyRemoveListener(GlobalKey key);
/// A key that is unique across the entire app.
///
/// Global keys uniquely indentify elements. Global keys provide access to other
/// Global keys uniquely identify elements. Global keys provide access to other
/// objects that are associated with elements, such as the a [BuildContext] and,
/// for [StatefulWidget]s, a [State].
///
......
......@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Drawer control test', (WidgetTester tester) async {
final Key containerKey = new Key('container');
final Key containerKey = const Key('container');
await tester.pumpWidget(
new Scaffold(
......
......@@ -44,7 +44,7 @@ void main() {
testWidgets('Floating action animation', (WidgetTester tester) async {
await tester.pumpWidget(new Scaffold(
floatingActionButton: new FloatingActionButton(
key: new Key("one"),
key: const Key('one'),
onPressed: null,
child: new Text("1")
)
......@@ -54,7 +54,7 @@ void main() {
await tester.pumpWidget(new Scaffold(
floatingActionButton: new FloatingActionButton(
key: new Key("two"),
key: const Key('two'),
onPressed: null,
child: new Text("2")
)
......@@ -68,7 +68,7 @@ void main() {
await tester.pumpWidget(new Scaffold(
floatingActionButton: new FloatingActionButton(
key: new Key("one"),
key: const Key('one'),
onPressed: null,
child: new Text("1")
)
......
......@@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
void main() {
testWidgets('SnackBar control test', (WidgetTester tester) async {
String helloSnackBar = 'Hello SnackBar';
Key tapTarget = new Key('tap-target');
Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp(
home: new Scaffold(
body: new Builder(
......@@ -53,7 +53,7 @@ void main() {
testWidgets('SnackBar twice test', (WidgetTester tester) async {
int snackBarCount = 0;
Key tapTarget = new Key('tap-target');
Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp(
home: new Scaffold(
body: new Builder(
......@@ -128,7 +128,7 @@ void main() {
testWidgets('SnackBar cancel test', (WidgetTester tester) async {
int snackBarCount = 0;
Key tapTarget = new Key('tap-target');
Key tapTarget = const Key('tap-target');
int time;
ScaffoldFeatureController<SnackBar, SnackBarClosedReason> lastController;
await tester.pumpWidget(new MaterialApp(
......@@ -214,7 +214,7 @@ void main() {
testWidgets('SnackBar dismiss test', (WidgetTester tester) async {
int snackBarCount = 0;
Key tapTarget = new Key('tap-target');
Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp(
home: new Scaffold(
body: new Builder(
......
......@@ -168,7 +168,7 @@ void main() {
testWidgets('Scrollable TabBar tap centers selected tab', (WidgetTester tester) async {
List<String> tabs = <String>['AAAAAA', 'BBBBBB', 'CCCCCC', 'DDDDDD', 'EEEEEE', 'FFFFFF', 'GGGGGG', 'HHHHHH', 'IIIIII', 'JJJJJJ', 'KKKKKK', 'LLLLLL'];
Key tabBarKey = new Key('TabBar');
Key tabBarKey = const Key('TabBar');
await tester.pumpWidget(buildFrame(tabs: tabs, value: 'AAAAAA', isScrollable: true, tabBarKey: tabBarKey));
TabController controller = DefaultTabController.of(tester.element(find.text('AAAAAA')));
expect(controller, isNotNull);
......@@ -189,7 +189,7 @@ void main() {
testWidgets('TabBar can be scrolled independent of the selection', (WidgetTester tester) async {
List<String> tabs = <String>['AAAA', 'BBBB', 'CCCC', 'DDDD', 'EEEE', 'FFFF', 'GGGG', 'HHHH', 'IIII', 'JJJJ', 'KKKK', 'LLLL'];
Key tabBarKey = new Key('TabBar');
Key tabBarKey = const Key('TabBar');
await tester.pumpWidget(buildFrame(tabs: tabs, value: 'AAAA', isScrollable: true, tabBarKey: tabBarKey));
TabController controller = DefaultTabController.of(tester.element(find.text('AAAA')));
expect(controller, isNotNull);
......
......@@ -38,7 +38,7 @@ Future<Point> startPicker(WidgetTester tester, ValueChanged<TimeOfDay> onChanged
await tester.pumpWidget(new _TimePickerLauncher(onChanged: onChanged));
await tester.tap(find.text('X'));
await tester.pumpUntilNoTransientCallbacks(const Duration(seconds: 1));
return tester.getCenter(find.byKey(new Key('time-picker-dial')));
return tester.getCenter(find.byKey(const Key('time-picker-dial')));
}
Future<Null> finishPicker(WidgetTester tester) async {
......
......@@ -8,9 +8,9 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('UserAccountsDrawerHeader test', (WidgetTester tester) async {
final Key avatarA = new Key('A');
final Key avatarC = new Key('C');
final Key avatarD = new Key('D');
final Key avatarA = const Key('A');
final Key avatarC = const Key('C');
final Key avatarD = const Key('D');
await tester.pumpWidget(
new Material(
......@@ -146,7 +146,7 @@ void main() {
));
expect(find.text('A'), findsOneWidget);
final Key avatarA = new Key('A');
final Key avatarA = const Key('A');
await tester.pumpWidget(buildFrame(
currentAccountPicture: new CircleAvatar(key: avatarA, child: new Text('A')),
accountName: new Text('accountName'),
......
......@@ -10,7 +10,7 @@ void main() {
await tester.pumpWidget(
new Center(
child: new DefaultTextStyle(
style: new TextStyle(
style: const TextStyle(
fontFamily: 'Ahem',
fontSize: 100.0,
),
......@@ -28,7 +28,7 @@ void main() {
baseline: 180.0,
baselineType: TextBaseline.alphabetic,
child: new DefaultTextStyle(
style: new TextStyle(
style: const TextStyle(
fontFamily: 'Ahem',
fontSize: 100.0,
),
......
......@@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
final Key blockKey = new Key('test');
final Key blockKey = const Key('test');
void main() {
testWidgets('Cannot scroll a non-overflowing block', (WidgetTester tester) async {
......
......@@ -23,7 +23,7 @@ void main() {
});
testWidgets('Bordered Container insets its child', (WidgetTester tester) async {
Key key = new Key('outerContainer');
Key key = const Key('outerContainer');
await tester.pumpWidget(
new Center(
child: new Container(
......@@ -42,7 +42,7 @@ void main() {
testWidgets('BoxDecoration paints its border correctly', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/7672
final Key key = new Key('Container with BoxDecoration');
final Key key = const Key('Container with BoxDecoration');
Widget buildFrame(Border border) {
return new Center(
child: new Container(
......
......@@ -8,10 +8,10 @@ import 'package:flutter/widgets.dart';
void main() {
testWidgets('Column with one flexible child', (WidgetTester tester) async {
final Key columnKey = new Key('column');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key columnKey = const Key('column');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// Default is MainAxisAlignment.start so children so the children's
......@@ -54,10 +54,10 @@ void main() {
});
testWidgets('Column with default main axis parameters', (WidgetTester tester) async {
final Key columnKey = new Key('column');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key columnKey = const Key('column');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// Default is MainAxisAlignment.start so children so the children's
......@@ -100,9 +100,9 @@ void main() {
});
testWidgets('Column with MainAxisAlignment.center', (WidgetTester tester) async {
final Key columnKey = new Key('column');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key columnKey = const Key('column');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 200, 300
......@@ -138,10 +138,10 @@ void main() {
});
testWidgets('Column with MainAxisAlignment.end', (WidgetTester tester) async {
final Key columnKey = new Key('column');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key columnKey = const Key('column');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 300, 400, 500.
......@@ -184,10 +184,10 @@ void main() {
});
testWidgets('Column with MainAxisAlignment.spaceBetween', (WidgetTester tester) async {
final Key columnKey = new Key('column');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key columnKey = const Key('column');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 0, 250, 500
......@@ -230,11 +230,11 @@ void main() {
});
testWidgets('Column with MainAxisAlignment.spaceAround', (WidgetTester tester) async {
final Key columnKey = new Key('column');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key child3Key = new Key('child3');
final Key columnKey = const Key('column');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
final Key child3Key = const Key('child3');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x100 children's top edges should be at 25, 175, 325, 475
......@@ -284,10 +284,10 @@ void main() {
});
testWidgets('Column with MainAxisAlignment.spaceEvenly', (WidgetTester tester) async {
final Key columnKey = new Key('column');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key columnKey = const Key('column');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
// The 100x20 children's top edges should be at 135, 290, 445
......@@ -330,7 +330,7 @@ void main() {
});
testWidgets('Column and MainAxisSize.min', (WidgetTester tester) async {
final Key flexKey = new Key('flexKey');
final Key flexKey = const Key('flexKey');
// Default is MainAxisSize.max so the Column should be as high as the test: 600.
await tester.pumpWidget(new Center(
......@@ -363,7 +363,7 @@ void main() {
});
testWidgets('Column MainAxisSize.min layout at zero size', (WidgetTester tester) async {
final Key childKey = new Key('childKey');
final Key childKey = const Key('childKey');
await tester.pumpWidget(new Center(
child: new Container(
......
......@@ -21,13 +21,13 @@ Widget buildSingleChildScrollView(Axis scrollDirection, { bool reverse: false })
child: new BlockBody(
mainAxis: scrollDirection,
children: <Widget>[
new Container(key: new ValueKey<int>(0), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(1), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(2), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(3), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(4), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(5), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(6), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(0), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(1), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(2), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(3), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(4), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(5), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(6), width: 200.0, height: 200.0),
],
),
),
......@@ -45,13 +45,13 @@ Widget buildListView(Axis scrollDirection, { bool reverse: false, bool shrinkWra
reverse: reverse,
shrinkWrap: shrinkWrap,
children: <Widget>[
new Container(key: new ValueKey<int>(0), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(1), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(2), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(3), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(4), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(5), width: 200.0, height: 200.0),
new Container(key: new ValueKey<int>(6), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(0), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(1), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(2), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(3), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(4), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(5), width: 200.0, height: 200.0),
new Container(key: const ValueKey<int>(6), width: 200.0, height: 200.0),
],
),
),
......@@ -189,7 +189,7 @@ void main() {
child: new Transform(
transform: new Matrix4.rotationZ(math.PI),
child: new Container(
key: new ValueKey<int>(0),
key: const ValueKey<int>(0),
width: 100.0,
height: 100.0,
decoration: const BoxDecoration(
......@@ -391,7 +391,7 @@ void main() {
viewportBuilder: (BuildContext context, ViewportOffset offset) {
return new Viewport2(
offset: offset,
center: new ValueKey<int>(4),
center: const ValueKey<int>(4),
slivers: <Widget>[
buildSliver(0),
buildSliver(1),
......@@ -441,7 +441,7 @@ void main() {
child: new Transform(
transform: new Matrix4.rotationZ(math.PI),
child: new Container(
key: new ValueKey<int>(0),
key: const ValueKey<int>(0),
width: 100.0,
height: 100.0,
decoration: const BoxDecoration(
......
......@@ -5,9 +5,9 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
Key firstKey = new Key('first');
Key secondKey = new Key('second');
Key thirdKey = new Key('third');
Key firstKey = const Key('first');
Key secondKey = const Key('second');
Key thirdKey = const Key('third');
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
'/': (BuildContext context) => new Material(
......
......@@ -20,7 +20,7 @@ void main() {
didTapRight = true;
};
Key textKey = new Key('text');
Key textKey = const Key('text');
await tester.pumpWidget(
new Center(
......
......@@ -47,11 +47,11 @@ void main() {
expect(new ObjectKey(const Object()) == new ObjectKey(const Object()), isTrue); // ignore: prefer_const_constructors
expect(new ObjectKey(new Object()) == new ObjectKey(new Object()), isFalse);
expect(new ValueKey<bool>(true), hasOneLineDescription);
expect(const ValueKey<bool>(true), hasOneLineDescription);
expect(new UniqueKey(), hasOneLineDescription);
expect(new ObjectKey(true), hasOneLineDescription);
expect(const ObjectKey(true), hasOneLineDescription);
expect(new GlobalKey(), hasOneLineDescription);
expect(new GlobalKey(debugLabel: 'hello'), hasOneLineDescription);
expect(new GlobalObjectKey(true), hasOneLineDescription);
expect(const GlobalObjectKey(true), hasOneLineDescription);
});
}
......@@ -61,7 +61,7 @@ void main() {
new Stack(
children: <Widget>[
new DecoratedBox(decoration: kBoxDecorationA),
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
new DecoratedBox(key: const Key('b'), decoration: kBoxDecorationB),
new DecoratedBox(decoration: kBoxDecorationC),
]
)
......@@ -72,9 +72,9 @@ void main() {
await tester.pumpWidget(
new Stack(
children: <Widget>[
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
new DecoratedBox(key: const Key('b'), decoration: kBoxDecorationB),
new DecoratedBox(decoration: kBoxDecorationC),
new DecoratedBox(key: new Key('a'), decoration: kBoxDecorationA),
new DecoratedBox(key: const Key('a'), decoration: kBoxDecorationA),
]
)
);
......@@ -84,9 +84,9 @@ void main() {
await tester.pumpWidget(
new Stack(
children: <Widget>[
new DecoratedBox(key: new Key('a'), decoration: kBoxDecorationA),
new DecoratedBox(key: const Key('a'), decoration: kBoxDecorationA),
new DecoratedBox(decoration: kBoxDecorationC),
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
new DecoratedBox(key: const Key('b'), decoration: kBoxDecorationB),
]
)
);
......@@ -193,11 +193,11 @@ void main() {
new Stack(
children: <Widget>[
new Container(
key: new Key('b'),
key: const Key('b'),
child: new DecoratedBox(decoration: kBoxDecorationB)
),
new Container(
key: new Key('a'),
key: const Key('a'),
child: new DecoratedBox(decoration: kBoxDecorationA)
),
]
......@@ -210,11 +210,11 @@ void main() {
new Stack(
children: <Widget>[
new Container(
key: new Key('a'),
key: const Key('a'),
child: new DecoratedBox(decoration: kBoxDecorationA)
),
new Container(
key: new Key('b'),
key: const Key('b'),
child: new DecoratedBox(decoration: kBoxDecorationB)
),
]
......@@ -283,7 +283,7 @@ void main() {
new Stack(
children: <Widget>[
new FlipWidget(
key: new Key('flip'),
key: const Key('flip'),
left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB)
),
......@@ -294,9 +294,9 @@ void main() {
await tester.pumpWidget(
new Stack(
children: <Widget>[
new DecoratedBox(key: new Key('c'), decoration: kBoxDecorationC),
new DecoratedBox(key: const Key('c'), decoration: kBoxDecorationC),
new FlipWidget(
key: new Key('flip'),
key: const Key('flip'),
left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB)
),
......@@ -315,11 +315,11 @@ void main() {
new Stack(
children: <Widget>[
new FlipWidget(
key: new Key('flip'),
key: const Key('flip'),
left: new DecoratedBox(decoration: kBoxDecorationA),
right: new DecoratedBox(decoration: kBoxDecorationB)
),
new DecoratedBox(key: new Key('c'), decoration: kBoxDecorationC),
new DecoratedBox(key: const Key('c'), decoration: kBoxDecorationC),
]
)
);
......
......@@ -162,7 +162,7 @@ void main() {
});
testWidgets('Navigator.of fails gracefully when not found in context', (WidgetTester tester) async {
Key targetKey = new Key('foo');
Key targetKey = const Key('foo');
dynamic exception;
Widget widget = new ThirdWidget(
targetKey: targetKey,
......
......@@ -206,7 +206,7 @@ void main() {
new Container(
width: 2000.0,
height: 2000.0,
decoration: new BoxDecoration(
decoration: const BoxDecoration(
backgroundColor: const Color(0xFF00FF00),
),
),
......
......@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
void main() {
testWidgets('PageStorage read and write', (WidgetTester tester) async {
final Key builderKey = new Key('builderKey');
final Key builderKey = const Key('builderKey');
StateSetter setState;
int storedValue = 0;
......@@ -56,7 +56,7 @@ void main() {
);
}
Key key = new Key('Key one');
Key key = const Key('Key one');
await tester.pumpWidget(buildWidthKey(key));
Element builderElement = tester.element(find.byKey(key));
expect(PageStorage.of(builderElement), isNotNull);
......@@ -65,7 +65,7 @@ void main() {
// New StatefulBuilder widget - different key - but the same PageStorage identifier.
key = new Key('Key two');
key = const Key('Key two');
await tester.pumpWidget(buildWidthKey(key));
builderElement = tester.element(find.byKey(key));
expect(PageStorage.of(builderElement), isNotNull);
......
......@@ -199,7 +199,7 @@ void main() {
itemExtent: 100.0,
children: <Widget>[
new Container(
key: new Key('container'),
key: const Key('container'),
height: 100.0,
child: new StateMarker(key: key),
),
......
......@@ -8,10 +8,10 @@ import 'package:flutter/widgets.dart';
void main() {
testWidgets('Row with one Flexible child', (WidgetTester tester) async {
final Key rowKey = new Key('row');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key rowKey = const Key('row');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// Default is MainAxisAlignment.start so children so the children's
......@@ -54,10 +54,10 @@ void main() {
});
testWidgets('Row with default main axis parameters', (WidgetTester tester) async {
final Key rowKey = new Key('row');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key rowKey = const Key('row');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// Default is MainAxisAlignment.start so children so the children's
......@@ -100,9 +100,9 @@ void main() {
});
testWidgets('Row with MainAxisAlignment.center', (WidgetTester tester) async {
final Key rowKey = new Key('row');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key rowKey = const Key('row');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's left edges should be at 300, 400
......@@ -138,10 +138,10 @@ void main() {
});
testWidgets('Row with MainAxisAlignment.end', (WidgetTester tester) async {
final Key rowKey = new Key('row');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key rowKey = const Key('row');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's left edges should be at 500, 600, 700.
......@@ -184,10 +184,10 @@ void main() {
});
testWidgets('Row with MainAxisAlignment.spaceBetween', (WidgetTester tester) async {
final Key rowKey = new Key('row');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key rowKey = const Key('row');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's left edges should be at 0, 350, 700
......@@ -230,11 +230,11 @@ void main() {
});
testWidgets('Row with MainAxisAlignment.spaceAround', (WidgetTester tester) async {
final Key rowKey = new Key('row');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key child3Key = new Key('child3');
final Key rowKey = const Key('row');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
final Key child3Key = const Key('child3');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 100x100 children's left edges should be at 50, 250, 450, 650
......@@ -284,10 +284,10 @@ void main() {
});
testWidgets('Row with MainAxisAlignment.spaceEvenly', (WidgetTester tester) async {
final Key rowKey = new Key('row');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key child2Key = new Key('child2');
final Key rowKey = const Key('row');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
final Key child2Key = const Key('child2');
// Default is MainAxisSize.max so the Row should be as wide as the test: 800.
// The 200x100 children's left edges should be at 50, 300, 550
......@@ -330,9 +330,9 @@ void main() {
});
testWidgets('Row and MainAxisSize.min', (WidgetTester tester) async {
final Key rowKey = new Key('rowKey');
final Key child0Key = new Key('child0');
final Key child1Key = new Key('child1');
final Key rowKey = const Key('rowKey');
final Key child0Key = const Key('child0');
final Key child1Key = const Key('child1');
// Row with MainAxisSize.min without flexible children shrink wraps.
// Row's width should be 250, children should be at 0, 100.
......@@ -368,7 +368,7 @@ void main() {
});
testWidgets('Row MainAxisSize.min layout at zero size', (WidgetTester tester) async {
final Key childKey = new Key('childKey');
final Key childKey = const Key('childKey');
await tester.pumpWidget(new Center(
child: new Container(
......
......@@ -45,7 +45,7 @@ void main() {
expect(realOffset(), equals(controller.offset));
await tester.pumpWidget(new ListView(
key: new Key('second'),
key: const Key('second'),
controller: controller,
children: kStates.map<Widget>((String state) {
return new Container(
......@@ -66,7 +66,7 @@ void main() {
ScrollController controller2 = new ScrollController();
await tester.pumpWidget(new ListView(
key: new Key('second'),
key: const Key('second'),
controller: controller2,
children: kStates.map<Widget>((String state) {
return new Container(
......@@ -84,7 +84,7 @@ void main() {
expect(() => controller.animateTo(132.0, duration: const Duration(milliseconds: 300), curve: Curves.ease), throws);
await tester.pumpWidget(new ListView(
key: new Key('second'),
key: const Key('second'),
controller: controller2,
physics: const BouncingScrollPhysics(),
children: kStates.map<Widget>((String state) {
......
......@@ -27,7 +27,7 @@ void main() {
});
testWidgets('Can change position data', (WidgetTester tester) async {
Key key = new Key('container');
Key key = const Key('container');
await tester.pumpWidget(
new Stack(
......@@ -82,7 +82,7 @@ void main() {
});
testWidgets('Can remove parent data', (WidgetTester tester) async {
Key key = new Key('container');
Key key = const Key('container');
Container container = new Container(key: key, width: 10.0, height: 10.0);
await tester.pumpWidget(new Stack(children: <Widget>[ new Positioned(left: 10.0, child: container) ]));
......@@ -110,8 +110,8 @@ void main() {
});
testWidgets('Can align non-positioned children', (WidgetTester tester) async {
Key child0Key = new Key('child0');
Key child1Key = new Key('child1');
Key child0Key = const Key('child0');
Key child1Key = const Key('child1');
await tester.pumpWidget(
new Center(
......@@ -173,7 +173,7 @@ void main() {
});
testWidgets('Can hit test an IndexedStack', (WidgetTester tester) async {
Key key = new Key('indexedStack');
Key key = const Key('indexedStack');
int itemCount = 3;
List<int> itemsTapped;
......@@ -197,7 +197,7 @@ void main() {
});
testWidgets('Can set width and height', (WidgetTester tester) async {
Key key = new Key('container');
Key key = const Key('container');
BoxDecoration kBoxDecoration = const BoxDecoration(
backgroundColor: const Color(0xFF00FF00)
......
......@@ -58,7 +58,7 @@ void main() {
testWidgets('Don\'t rebuild subwidgets', (WidgetTester tester) async {
await tester.pumpWidget(
new FlipWidget(
key: new Key('rebuild test'),
key: const Key('rebuild test'),
left: new TestBuildCounter(),
right: new DecoratedBox(decoration: kBoxDecorationB)
)
......
......@@ -45,8 +45,8 @@ class OuterContainerState extends State<OuterContainer> {
void main() {
testWidgets('resync stateful widget', (WidgetTester tester) async {
Key innerKey = new Key('inner');
Key outerKey = new Key('outer');
Key innerKey = const Key('inner');
Key outerKey = const Key('outer');
InnerWidget inner1 = new InnerWidget(key: innerKey);
InnerWidget inner2;
......
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