Unverified Commit 7ceed973 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

replace simple empty Container with w & h with SizedBox (#54394)

* replace simple Container(w & h) with SizedBox

* address review comments

* address review comments
parent b0610be3
...@@ -834,7 +834,7 @@ class _CupertinoAlertContentSection extends StatelessWidget { ...@@ -834,7 +834,7 @@ class _CupertinoAlertContentSection extends StatelessWidget {
if (titleContentGroup.isEmpty) { if (titleContentGroup.isEmpty) {
return SingleChildScrollView( return SingleChildScrollView(
controller: scrollController, controller: scrollController,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
......
...@@ -1036,7 +1036,7 @@ class _ContextMenuRouteStaticState extends State<_ContextMenuRouteStatic> with T ...@@ -1036,7 +1036,7 @@ class _ContextMenuRouteStaticState extends State<_ContextMenuRouteStatic> with T
), ),
), ),
); );
final Container spacer = Container( const SizedBox spacer = SizedBox(
width: _kPadding, width: _kPadding,
height: _kPadding, height: _kPadding,
); );
......
...@@ -867,7 +867,7 @@ class _CupertinoAlertContentSection extends StatelessWidget { ...@@ -867,7 +867,7 @@ class _CupertinoAlertContentSection extends StatelessWidget {
if (title == null && content == null) { if (title == null && content == null) {
return SingleChildScrollView( return SingleChildScrollView(
controller: scrollController, controller: scrollController,
child: Container(width: 0.0, height: 0.0), child: const SizedBox(width: 0.0, height: 0.0),
); );
} }
......
...@@ -175,7 +175,7 @@ class DataCell { ...@@ -175,7 +175,7 @@ class DataCell {
}) : assert(child != null); }) : assert(child != null);
/// A cell that has no content and has zero width and height. /// A cell that has no content and has zero width and height.
static final DataCell empty = DataCell(Container(width: 0.0, height: 0.0)); static const DataCell empty = DataCell(SizedBox(width: 0.0, height: 0.0));
/// The data for the row. /// The data for the row.
/// ///
......
...@@ -100,7 +100,7 @@ class _TextSelectionToolbarState extends State<_TextSelectionToolbar> with Ticke ...@@ -100,7 +100,7 @@ class _TextSelectionToolbarState extends State<_TextSelectionToolbar> with Ticke
// If there is no option available, build an empty widget. // If there is no option available, build an empty widget.
if (items.isEmpty) { if (items.isEmpty) {
return Container(width: 0.0, height: 0.0); return const SizedBox(width: 0.0, height: 0.0);
} }
......
...@@ -236,7 +236,7 @@ void main() { ...@@ -236,7 +236,7 @@ void main() {
}); });
testWidgets('Contents have automatic sliver padding between translucent bars', (WidgetTester tester) async { testWidgets('Contents have automatic sliver padding between translucent bars', (WidgetTester tester) async {
final Container content = Container(height: 600.0, width: 600.0); const SizedBox content = SizedBox(height: 600.0, width: 600.0);
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
...@@ -264,7 +264,7 @@ void main() { ...@@ -264,7 +264,7 @@ void main() {
middle: Text('Title'), middle: Text('Title'),
), ),
child: ListView( child: ListView(
children: <Widget>[ children: const <Widget>[
content, content,
], ],
), ),
......
...@@ -3623,7 +3623,7 @@ void main() { ...@@ -3623,7 +3623,7 @@ void main() {
focusNode: focusNode, focusNode: focusNode,
expands: true, expands: true,
maxLines: null, maxLines: null,
prefix: Container( prefix: const SizedBox(
height: 100, height: 100,
width: 10, width: 10,
), ),
...@@ -3676,7 +3676,7 @@ void main() { ...@@ -3676,7 +3676,7 @@ void main() {
focusNode: focusNode, focusNode: focusNode,
expands: true, expands: true,
maxLines: null, maxLines: null,
prefix: Container( prefix: const SizedBox(
height: 100, height: 100,
width: 10, width: 10,
), ),
...@@ -3730,7 +3730,7 @@ void main() { ...@@ -3730,7 +3730,7 @@ void main() {
focusNode: focusNode, focusNode: focusNode,
expands: true, expands: true,
maxLines: null, maxLines: null,
prefix: Container( prefix: const SizedBox(
height: 100, height: 100,
width: 10, width: 10,
), ),
...@@ -3784,7 +3784,7 @@ void main() { ...@@ -3784,7 +3784,7 @@ void main() {
focusNode: focusNode, focusNode: focusNode,
expands: true, expands: true,
maxLines: null, maxLines: null,
prefix: Container( prefix: const SizedBox(
height: 100, height: 100,
width: 10, width: 10,
), ),
......
...@@ -1084,8 +1084,8 @@ void main() { ...@@ -1084,8 +1084,8 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final RenderBox container = tester.renderObject(find.descendant( final RenderBox container = tester.renderObject(find.descendant(
of: find.byType(FadeTransition), of: find.byType(FadeTransition),
matching: find.byType(Container), matching: find.byType(SizedBox),
)); ).first);
expect(container.size, Size.zero); expect(container.size, Size.zero);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.android, TargetPlatform.fuchsia, TargetPlatform.linux, TargetPlatform.windows })); }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.android, TargetPlatform.fuchsia, TargetPlatform.linux, TargetPlatform.windows }));
...@@ -2252,7 +2252,7 @@ void main() { ...@@ -2252,7 +2252,7 @@ void main() {
await tester.pumpWidget(containedTextFieldBuilder( await tester.pumpWidget(containedTextFieldBuilder(
counter: Container(height: counterHeight), counter: Container(height: counterHeight),
labelText: 'I am labelText', labelText: 'I am labelText',
prefix: Container( prefix: const SizedBox(
width: 10, width: 10,
height: 60, height: 60,
), ),
......
...@@ -61,7 +61,7 @@ void main() { ...@@ -61,7 +61,7 @@ void main() {
padding: const EdgeInsets.all(5.0), padding: const EdgeInsets.all(5.0),
verticalOffset: 20.0, verticalOffset: 20.0,
preferBelow: false, preferBelow: false,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -118,7 +118,7 @@ void main() { ...@@ -118,7 +118,7 @@ void main() {
padding: const EdgeInsets.all(5.0), padding: const EdgeInsets.all(5.0),
verticalOffset: 20.0, verticalOffset: 20.0,
preferBelow: false, preferBelow: false,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -172,7 +172,7 @@ void main() { ...@@ -172,7 +172,7 @@ void main() {
padding: const EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
verticalOffset: 100.0, verticalOffset: 100.0,
preferBelow: false, preferBelow: false,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -228,7 +228,7 @@ void main() { ...@@ -228,7 +228,7 @@ void main() {
padding: const EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
verticalOffset: 100.0, verticalOffset: 100.0,
preferBelow: false, preferBelow: false,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -295,7 +295,7 @@ void main() { ...@@ -295,7 +295,7 @@ void main() {
padding: const EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
verticalOffset: 100.0, verticalOffset: 100.0,
preferBelow: true, preferBelow: true,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -350,7 +350,7 @@ void main() { ...@@ -350,7 +350,7 @@ void main() {
padding: const EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
verticalOffset: 10.0, verticalOffset: 10.0,
preferBelow: true, preferBelow: true,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -407,7 +407,7 @@ void main() { ...@@ -407,7 +407,7 @@ void main() {
padding: const EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
verticalOffset: 10.0, verticalOffset: 10.0,
preferBelow: true, preferBelow: true,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -458,7 +458,7 @@ void main() { ...@@ -458,7 +458,7 @@ void main() {
message: tooltipText, message: tooltipText,
padding: const EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
margin: const EdgeInsets.all(_customMarginValue), margin: const EdgeInsets.all(_customMarginValue),
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -654,7 +654,7 @@ void main() { ...@@ -654,7 +654,7 @@ void main() {
return Tooltip( return Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -696,7 +696,7 @@ void main() { ...@@ -696,7 +696,7 @@ void main() {
key: key, key: key,
decoration: customDecoration, decoration: customDecoration,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -780,12 +780,12 @@ void main() { ...@@ -780,12 +780,12 @@ void main() {
await gesture.moveTo(Offset.zero); await gesture.moveTo(Offset.zero);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( const MaterialApp(
home: Center( home: Center(
child: Tooltip( child: Tooltip(
message: tooltipText, message: tooltipText,
waitDuration: waitDuration, waitDuration: waitDuration,
child: Container( child: SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -838,7 +838,7 @@ void main() { ...@@ -838,7 +838,7 @@ void main() {
child: Tooltip( child: Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container(width: 10.0, height: 10.0), child: const SizedBox(width: 10.0, height: 10.0),
), ),
), ),
], ],
......
...@@ -119,7 +119,7 @@ void main() { ...@@ -119,7 +119,7 @@ void main() {
child: Tooltip( child: Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -177,7 +177,7 @@ void main() { ...@@ -177,7 +177,7 @@ void main() {
child: Tooltip( child: Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -237,7 +237,7 @@ void main() { ...@@ -237,7 +237,7 @@ void main() {
child: Tooltip( child: Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -306,7 +306,7 @@ void main() { ...@@ -306,7 +306,7 @@ void main() {
child: Tooltip( child: Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -377,7 +377,7 @@ void main() { ...@@ -377,7 +377,7 @@ void main() {
child: Tooltip( child: Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -434,7 +434,7 @@ void main() { ...@@ -434,7 +434,7 @@ void main() {
child: Tooltip( child: Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -486,7 +486,7 @@ void main() { ...@@ -486,7 +486,7 @@ void main() {
child: Tooltip( child: Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -542,7 +542,7 @@ void main() { ...@@ -542,7 +542,7 @@ void main() {
child: Tooltip( child: Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -662,7 +662,7 @@ void main() { ...@@ -662,7 +662,7 @@ void main() {
return Tooltip( return Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -704,7 +704,7 @@ void main() { ...@@ -704,7 +704,7 @@ void main() {
return Tooltip( return Tooltip(
key: key, key: key,
message: tooltipText, message: tooltipText,
child: Container( child: const SizedBox(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
), ),
...@@ -837,10 +837,10 @@ void main() { ...@@ -837,10 +837,10 @@ void main() {
waitDuration: customWaitDuration, waitDuration: customWaitDuration,
), ),
), ),
child: Center( child: const Center(
child: Tooltip( child: Tooltip(
message: tooltipText, message: tooltipText,
child: Container( child: SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -878,13 +878,13 @@ void main() { ...@@ -878,13 +878,13 @@ void main() {
await gesture.moveTo(Offset.zero); await gesture.moveTo(Offset.zero);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( const MaterialApp(
home: TooltipTheme( home: TooltipTheme(
data: const TooltipThemeData(waitDuration: customWaitDuration), data: TooltipThemeData(waitDuration: customWaitDuration),
child: Center( child: Center(
child: Tooltip( child: Tooltip(
message: tooltipText, message: tooltipText,
child: Container( child: SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -922,10 +922,10 @@ void main() { ...@@ -922,10 +922,10 @@ void main() {
showDuration: customShowDuration, showDuration: customShowDuration,
), ),
), ),
child: Center( child: const Center(
child: Tooltip( child: Tooltip(
message: tooltipText, message: tooltipText,
child: Container( child: SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -952,13 +952,13 @@ void main() { ...@@ -952,13 +952,13 @@ void main() {
testWidgets('Tooltip showDuration - TooltipTheme', (WidgetTester tester) async { testWidgets('Tooltip showDuration - TooltipTheme', (WidgetTester tester) async {
const Duration customShowDuration = Duration(milliseconds: 3000); const Duration customShowDuration = Duration(milliseconds: 3000);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( const MaterialApp(
home: TooltipTheme( home: TooltipTheme(
data: const TooltipThemeData(showDuration: customShowDuration), data: TooltipThemeData(showDuration: customShowDuration),
child: Center( child: Center(
child: Tooltip( child: Tooltip(
message: tooltipText, message: tooltipText,
child: Container( child: SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
......
...@@ -44,51 +44,51 @@ void main() { ...@@ -44,51 +44,51 @@ void main() {
}); });
testWidgets('Align control test (LTR)', (WidgetTester tester) async { testWidgets('Align control test (LTR)', (WidgetTester tester) async {
await tester.pumpWidget(Directionality( await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Align( child: Align(
child: Container(width: 100.0, height: 80.0), child: SizedBox(width: 100.0, height: 80.0),
alignment: AlignmentDirectional.topStart, alignment: AlignmentDirectional.topStart,
), ),
)); ));
expect(tester.getTopLeft(find.byType(Container)).dx, 0.0); expect(tester.getTopLeft(find.byType(SizedBox)).dx, 0.0);
expect(tester.getBottomRight(find.byType(Container)).dx, 100.0); expect(tester.getBottomRight(find.byType(SizedBox)).dx, 100.0);
await tester.pumpWidget(Directionality( await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Align( child: Align(
child: Container(width: 100.0, height: 80.0), child: SizedBox(width: 100.0, height: 80.0),
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
), ),
)); ));
expect(tester.getTopLeft(find.byType(Container)).dx, 0.0); expect(tester.getTopLeft(find.byType(SizedBox)).dx, 0.0);
expect(tester.getBottomRight(find.byType(Container)).dx, 100.0); expect(tester.getBottomRight(find.byType(SizedBox)).dx, 100.0);
}); });
testWidgets('Align control test (RTL)', (WidgetTester tester) async { testWidgets('Align control test (RTL)', (WidgetTester tester) async {
await tester.pumpWidget(Directionality( await tester.pumpWidget(const Directionality(
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: Align( child: Align(
child: Container(width: 100.0, height: 80.0), child: SizedBox(width: 100.0, height: 80.0),
alignment: AlignmentDirectional.topStart, alignment: AlignmentDirectional.topStart,
), ),
)); ));
expect(tester.getTopLeft(find.byType(Container)).dx, 700.0); expect(tester.getTopLeft(find.byType(SizedBox)).dx, 700.0);
expect(tester.getBottomRight(find.byType(Container)).dx, 800.0); expect(tester.getBottomRight(find.byType(SizedBox)).dx, 800.0);
await tester.pumpWidget(Directionality( await tester.pumpWidget(const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Align( child: Align(
child: Container(width: 100.0, height: 80.0), child: SizedBox(width: 100.0, height: 80.0),
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
), ),
)); ));
expect(tester.getTopLeft(find.byType(Container)).dx, 0.0); expect(tester.getTopLeft(find.byType(SizedBox)).dx, 0.0);
expect(tester.getBottomRight(find.byType(Container)).dx, 100.0); expect(tester.getBottomRight(find.byType(SizedBox)).dx, 100.0);
}); });
testWidgets('Shrink wraps in finite space', (WidgetTester tester) async { testWidgets('Shrink wraps in finite space', (WidgetTester tester) async {
...@@ -97,7 +97,7 @@ void main() { ...@@ -97,7 +97,7 @@ void main() {
SingleChildScrollView( SingleChildScrollView(
child: Align( child: Align(
key: alignKey, key: alignKey,
child: Container( child: const SizedBox(
width: 10.0, width: 10.0,
height: 10.0, height: 10.0,
), ),
......
...@@ -112,7 +112,7 @@ Future<void> main() async { ...@@ -112,7 +112,7 @@ Future<void> main() async {
child: Container( child: Container(
key: key, key: key,
decoration: BoxDecoration(border: Border.all(width: 10.0)), decoration: BoxDecoration(border: Border.all(width: 10.0)),
child: Container( child: const SizedBox(
width: 25.0, width: 25.0,
height: 25.0, height: 25.0,
), ),
......
...@@ -338,9 +338,9 @@ void main() { ...@@ -338,9 +338,9 @@ void main() {
await tester.pumpWidget(Center( await tester.pumpWidget(Center(
child: Column( child: Column(
key: flexKey, key: flexKey,
children: <Widget>[ children: const <Widget>[
Container(width: 100.0, height: 100.0), SizedBox(width: 100.0, height: 100.0),
Container(width: 100.0, height: 150.0), SizedBox(width: 100.0, height: 150.0),
], ],
), ),
)); ));
...@@ -353,9 +353,9 @@ void main() { ...@@ -353,9 +353,9 @@ void main() {
child: Column( child: Column(
key: flexKey, key: flexKey,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: const <Widget>[
Container(width: 100.0, height: 100.0), SizedBox(width: 100.0, height: 100.0),
Container(width: 100.0, height: 150.0), SizedBox(width: 100.0, height: 150.0),
], ],
), ),
)); ));
...@@ -729,9 +729,9 @@ void main() { ...@@ -729,9 +729,9 @@ void main() {
child: Column( child: Column(
key: flexKey, key: flexKey,
verticalDirection: VerticalDirection.up, verticalDirection: VerticalDirection.up,
children: <Widget>[ children: const <Widget>[
Container(width: 100.0, height: 100.0), SizedBox(width: 100.0, height: 100.0),
Container(width: 100.0, height: 150.0), SizedBox(width: 100.0, height: 150.0),
], ],
), ),
)); ));
...@@ -745,9 +745,9 @@ void main() { ...@@ -745,9 +745,9 @@ void main() {
key: flexKey, key: flexKey,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
verticalDirection: VerticalDirection.up, verticalDirection: VerticalDirection.up,
children: <Widget>[ children: const <Widget>[
Container(width: 100.0, height: 100.0), SizedBox(width: 100.0, height: 100.0),
Container(width: 100.0, height: 150.0), SizedBox(width: 100.0, height: 150.0),
], ],
), ),
)); ));
......
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
top: 456.0, top: 456.0,
child: CompositedTransformTarget( child: CompositedTransformTarget(
link: link, link: link,
child: Container(height: 10.0, width: 10.0), child: const SizedBox(height: 10.0, width: 10.0),
), ),
), ),
Positioned( Positioned(
......
...@@ -49,8 +49,8 @@ Widget buildFrame(MultiChildLayoutDelegate delegate) { ...@@ -49,8 +49,8 @@ Widget buildFrame(MultiChildLayoutDelegate delegate) {
return Center( return Center(
child: CustomMultiChildLayout( child: CustomMultiChildLayout(
children: <Widget>[ children: <Widget>[
LayoutId(id: 0, child: Container(width: 150.0, height: 100.0)), LayoutId(id: 0, child: const SizedBox(width: 150.0, height: 100.0)),
LayoutId(id: 1, child: Container(width: 100.0, height: 200.0)), LayoutId(id: 1, child: const SizedBox(width: 100.0, height: 200.0)),
], ],
delegate: delegate, delegate: delegate,
), ),
...@@ -225,13 +225,13 @@ void main() { ...@@ -225,13 +225,13 @@ void main() {
id: 0, id: 0,
child: CustomMultiChildLayout( child: CustomMultiChildLayout(
children: <Widget>[ children: <Widget>[
LayoutId(id: 0, child: Container(width: 150.0, height: 100.0)), LayoutId(id: 0, child: const SizedBox(width: 150.0, height: 100.0)),
LayoutId(id: 1, child: Container(width: 100.0, height: 200.0)), LayoutId(id: 1, child: const SizedBox(width: 100.0, height: 200.0)),
], ],
delegate: delegate, delegate: delegate,
), ),
), ),
LayoutId(id: 1, child: Container(width: 100.0, height: 200.0)), LayoutId(id: 1, child: const SizedBox(width: 100.0, height: 200.0)),
], ],
delegate: delegate, delegate: delegate,
), ),
......
...@@ -195,7 +195,7 @@ void main() { ...@@ -195,7 +195,7 @@ void main() {
expect(target.currentContext.size, const Size(800.0, 600.0)); expect(target.currentContext.size, const Size(800.0, 600.0));
await tester.pumpWidget(Center( await tester.pumpWidget(Center(
child: CustomPaint(key: target, child: Container(height: 0.0, width: 0.0)), child: CustomPaint(key: target, child: const SizedBox(height: 0.0, width: 0.0)),
)); ));
expect(target.currentContext.size, Size.zero); expect(target.currentContext.size, Size.zero);
......
...@@ -97,7 +97,7 @@ void main() { ...@@ -97,7 +97,7 @@ void main() {
onEnter: (_) { logs.add('enter'); }, onEnter: (_) { logs.add('enter'); },
onHover: (_) { logs.add('hover'); }, onHover: (_) { logs.add('hover'); },
onExit: (_) { logs.add('exit'); }, onExit: (_) { logs.add('exit'); },
child: Container(width: 10, height: 10), child: const SizedBox(width: 10, height: 10),
), ),
), ),
), ),
......
...@@ -384,7 +384,7 @@ void main() { ...@@ -384,7 +384,7 @@ void main() {
Widget buildSliver(int i) { Widget buildSliver(int i) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
key: ValueKey<int>(i), key: ValueKey<int>(i),
child: Container(width: 200.0, height: 200.0), child: const SizedBox(width: 200.0, height: 200.0),
); );
} }
......
...@@ -119,9 +119,9 @@ void main() { ...@@ -119,9 +119,9 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
Flow( Flow(
delegate: DuplicatePainterOpacityFlowDelegate(1.0), delegate: DuplicatePainterOpacityFlowDelegate(1.0),
children: <Widget>[ children: const <Widget>[
Container(width: 100.0, height: 100.0), SizedBox(width: 100.0, height: 100.0),
Container(width: 100.0, height: 100.0), SizedBox(width: 100.0, height: 100.0),
], ],
), ),
); );
...@@ -142,8 +142,8 @@ void main() { ...@@ -142,8 +142,8 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
Flow( Flow(
delegate: OpacityFlowDelegate(opacity), delegate: OpacityFlowDelegate(opacity),
children: <Widget>[ children: const <Widget>[
Container(width: 100.0, height: 100.0), SizedBox(width: 100.0, height: 100.0),
], ],
), ),
); );
......
...@@ -40,13 +40,13 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ ...@@ -40,13 +40,13 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
child: ListView( child: ListView(
key: homeRouteKey, key: homeRouteKey,
children: <Widget>[ children: <Widget>[
Container(height: 100.0, width: 100.0), const SizedBox(height: 100.0, width: 100.0),
Card(child: Hero( Card(child: Hero(
tag: 'a', tag: 'a',
transitionOnUserGestures: transitionFromUserGestures, transitionOnUserGestures: transitionFromUserGestures,
child: Container(height: 100.0, width: 100.0, key: firstKey), child: Container(height: 100.0, width: 100.0, key: firstKey),
)), )),
Container(height: 100.0, width: 100.0), const SizedBox(height: 100.0, width: 100.0),
FlatButton( FlatButton(
child: const Text('two'), child: const Text('two'),
onPressed: () { Navigator.pushNamed(context, '/two'); }, onPressed: () { Navigator.pushNamed(context, '/two'); },
...@@ -70,13 +70,13 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ ...@@ -70,13 +70,13 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
child: const Text('pop'), child: const Text('pop'),
onPressed: () { Navigator.pop(context); }, onPressed: () { Navigator.pop(context); },
), ),
Container(height: 150.0, width: 150.0), const SizedBox(height: 150.0, width: 150.0),
Card(child: Hero( Card(child: Hero(
tag: 'a', tag: 'a',
transitionOnUserGestures: transitionFromUserGestures, transitionOnUserGestures: transitionFromUserGestures,
child: Container(height: 150.0, width: 150.0, key: secondKey), child: Container(height: 150.0, width: 150.0, key: secondKey),
)), )),
Container(height: 150.0, width: 150.0), const SizedBox(height: 150.0, width: 150.0),
FlatButton( FlatButton(
child: const Text('three'), child: const Text('three'),
onPressed: () { Navigator.push(context, ThreeRoute()); }, onPressed: () { Navigator.push(context, ThreeRoute()); },
...@@ -96,7 +96,7 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ ...@@ -96,7 +96,7 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
child: const Text('pop'), child: const Text('pop'),
onPressed: () { Navigator.pop(context); }, onPressed: () { Navigator.pop(context); },
), ),
Container(height: 150.0, width: 150.0), const SizedBox(height: 150.0, width: 150.0),
Card( Card(
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 50.0), padding: const EdgeInsets.only(left: 50.0),
...@@ -107,7 +107,7 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ ...@@ -107,7 +107,7 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
), ),
), ),
), ),
Container(height: 150.0, width: 150.0), const SizedBox(height: 150.0, width: 150.0),
FlatButton( FlatButton(
child: const Text('three'), child: const Text('three'),
onPressed: () { Navigator.push(context, ThreeRoute()); }, onPressed: () { Navigator.push(context, ThreeRoute()); },
...@@ -137,9 +137,9 @@ class ThreeRoute extends MaterialPageRoute<void> { ...@@ -137,9 +137,9 @@ class ThreeRoute extends MaterialPageRoute<void> {
key: routeThreeKey, key: routeThreeKey,
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
Container(height: 200.0, width: 200.0), const SizedBox(height: 200.0, width: 200.0),
Card(child: Hero(tag: 'a', child: Container(height: 200.0, width: 200.0, key: thirdKey))), Card(child: Hero(tag: 'a', child: Container(height: 200.0, width: 200.0, key: thirdKey))),
Container(height: 200.0, width: 200.0), const SizedBox(height: 200.0, width: 200.0),
], ],
), ),
); );
...@@ -718,7 +718,7 @@ Future<void> main() async { ...@@ -718,7 +718,7 @@ Future<void> main() async {
return Card( return Card(
child: routeIncludesHero child: routeIncludesHero
? Hero(tag: 'H', child: Container(key: routeHeroKey, height: 200.0, width: 200.0)) ? Hero(tag: 'H', child: Container(key: routeHeroKey, height: 200.0, width: 200.0))
: Container(height: 200.0, width: 200.0), : const SizedBox(height: 200.0, width: 200.0),
); );
}, },
), ),
......
...@@ -189,7 +189,7 @@ void main() { ...@@ -189,7 +189,7 @@ void main() {
Semantics( Semantics(
label: 'node 1', label: 'node 1',
selected: true, selected: true,
child: Container( child: const SizedBox(
width: 10.0, width: 10.0,
height: 10.0, height: 10.0,
), ),
...@@ -197,7 +197,7 @@ void main() { ...@@ -197,7 +197,7 @@ void main() {
Semantics( Semantics(
label: 'node 2', label: 'node 2',
selected: true, selected: true,
child: Container( child: const SizedBox(
width: 10.0, width: 10.0,
height: 10.0, height: 10.0,
), ),
...@@ -205,7 +205,7 @@ void main() { ...@@ -205,7 +205,7 @@ void main() {
Semantics( Semantics(
label: 'node 3', label: 'node 3',
selected: true, selected: true,
child: Container( child: const SizedBox(
width: 10.0, width: 10.0,
height: 10.0, height: 10.0,
), ),
......
...@@ -7,15 +7,15 @@ import 'package:flutter/src/painting/basic_types.dart'; ...@@ -7,15 +7,15 @@ import 'package:flutter/src/painting/basic_types.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
final List<Widget> children = <Widget>[ const List<Widget> children = <Widget>[
Container(width: 200.0, height: 150.0), SizedBox(width: 200.0, height: 150.0),
Container(width: 200.0, height: 150.0), SizedBox(width: 200.0, height: 150.0),
Container(width: 200.0, height: 150.0), SizedBox(width: 200.0, height: 150.0),
Container(width: 200.0, height: 150.0), SizedBox(width: 200.0, height: 150.0),
]; ];
void expectRects(WidgetTester tester, List<Rect> expected) { void expectRects(WidgetTester tester, List<Rect> expected) {
final Finder finder = find.byType(Container); final Finder finder = find.byType(SizedBox);
finder.precache(); finder.precache();
final List<Rect> actual = <Rect>[]; final List<Rect> actual = <Rect>[];
for (int i = 0; i < expected.length; ++i) { for (int i = 0; i < expected.length; ++i) {
......
...@@ -122,7 +122,7 @@ void main() { ...@@ -122,7 +122,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
Center( Center(
child: Listener( child: Listener(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -152,7 +152,7 @@ void main() { ...@@ -152,7 +152,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
Center( Center(
child: Listener( child: Listener(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -170,8 +170,8 @@ void main() { ...@@ -170,8 +170,8 @@ void main() {
expect(enter, isNotNull); expect(enter, isNotNull);
expect(enter.position, equals(const Offset(400.0, 300.0))); expect(enter.position, equals(const Offset(400.0, 300.0)));
expect(exit, isNull); expect(exit, isNull);
await tester.pumpWidget(Center( await tester.pumpWidget(const Center(
child: Container( child: SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -284,7 +284,7 @@ void main() { ...@@ -284,7 +284,7 @@ void main() {
children: <Widget>[ children: <Widget>[
Listener( Listener(
key: key1, key: key1,
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -294,7 +294,7 @@ void main() { ...@@ -294,7 +294,7 @@ void main() {
), ),
Listener( Listener(
key: key2, key: key2,
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -561,7 +561,7 @@ void main() { ...@@ -561,7 +561,7 @@ void main() {
onPointerEnter: (PointerEnterEvent e) => enter.add(e), onPointerEnter: (PointerEnterEvent e) => enter.add(e),
onPointerHover: (PointerHoverEvent e) => hover.add(e), onPointerHover: (PointerHoverEvent e) => hover.add(e),
onPointerExit: (PointerExitEvent e) => exit.add(e), onPointerExit: (PointerExitEvent e) => exit.add(e),
child: Container( child: const SizedBox(
height: 100.0, height: 100.0,
width: 100.0, width: 100.0,
), ),
...@@ -574,7 +574,7 @@ void main() { ...@@ -574,7 +574,7 @@ void main() {
await gesture.addPointer(location: Offset.zero); await gesture.addPointer(location: Offset.zero);
addTearDown(() => gesture?.removePointer()); addTearDown(() => gesture?.removePointer());
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await gesture.moveTo(tester.getCenter(find.byType(Container))); await gesture.moveTo(tester.getCenter(find.byType(SizedBox)));
expect(enter.length, 1); expect(enter.length, 1);
expect(enter.single.position, const Offset(400.0, 300.0)); expect(enter.single.position, const Offset(400.0, 300.0));
......
...@@ -119,7 +119,7 @@ void main() { ...@@ -119,7 +119,7 @@ void main() {
PointerExitEvent exit; PointerExitEvent exit;
await tester.pumpWidget(Center( await tester.pumpWidget(Center(
child: MouseRegion( child: MouseRegion(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -149,7 +149,7 @@ void main() { ...@@ -149,7 +149,7 @@ void main() {
PointerExitEvent exit; PointerExitEvent exit;
await tester.pumpWidget(Center( await tester.pumpWidget(Center(
child: MouseRegion( child: MouseRegion(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -179,7 +179,7 @@ void main() { ...@@ -179,7 +179,7 @@ void main() {
PointerExitEvent exit; PointerExitEvent exit;
await tester.pumpWidget(Center( await tester.pumpWidget(Center(
child: MouseRegion( child: MouseRegion(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -214,8 +214,8 @@ void main() { ...@@ -214,8 +214,8 @@ void main() {
PointerEnterEvent enter; PointerEnterEvent enter;
PointerHoverEvent move; PointerHoverEvent move;
PointerExitEvent exit; PointerExitEvent exit;
await tester.pumpWidget(Center( await tester.pumpWidget(const Center(
child: Container( child: SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -230,7 +230,7 @@ void main() { ...@@ -230,7 +230,7 @@ void main() {
expect(exit, isNull); expect(exit, isNull);
await tester.pumpWidget(Center( await tester.pumpWidget(Center(
child: MouseRegion( child: MouseRegion(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -252,7 +252,7 @@ void main() { ...@@ -252,7 +252,7 @@ void main() {
PointerExitEvent exit; PointerExitEvent exit;
await tester.pumpWidget(Center( await tester.pumpWidget(Center(
child: MouseRegion( child: MouseRegion(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -269,8 +269,8 @@ void main() { ...@@ -269,8 +269,8 @@ void main() {
move = null; move = null;
enter = null; enter = null;
exit = null; exit = null;
await tester.pumpWidget(Center( await tester.pumpWidget(const Center(
child: Container( child: SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -287,7 +287,7 @@ void main() { ...@@ -287,7 +287,7 @@ void main() {
await tester.pumpWidget(Container( await tester.pumpWidget(Container(
alignment: Alignment.center, alignment: Alignment.center,
child: MouseRegion( child: MouseRegion(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -306,7 +306,7 @@ void main() { ...@@ -306,7 +306,7 @@ void main() {
await tester.pumpWidget(Container( await tester.pumpWidget(Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: MouseRegion( child: MouseRegion(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -329,7 +329,7 @@ void main() { ...@@ -329,7 +329,7 @@ void main() {
await tester.pumpWidget(Container( await tester.pumpWidget(Container(
alignment: Alignment.center, alignment: Alignment.center,
child: MouseRegion( child: MouseRegion(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -348,7 +348,7 @@ void main() { ...@@ -348,7 +348,7 @@ void main() {
await tester.pumpWidget(Container( await tester.pumpWidget(Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: MouseRegion( child: MouseRegion(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -471,7 +471,7 @@ void main() { ...@@ -471,7 +471,7 @@ void main() {
children: <Widget>[ children: <Widget>[
MouseRegion( MouseRegion(
key: key1, key: key1,
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -481,7 +481,7 @@ void main() { ...@@ -481,7 +481,7 @@ void main() {
), ),
MouseRegion( MouseRegion(
key: key2, key: key2,
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
...@@ -842,7 +842,7 @@ void main() { ...@@ -842,7 +842,7 @@ void main() {
onEnter: (PointerEnterEvent e) => enter.add(e), onEnter: (PointerEnterEvent e) => enter.add(e),
onHover: (PointerHoverEvent e) => hover.add(e), onHover: (PointerHoverEvent e) => hover.add(e),
onExit: (PointerExitEvent e) => exit.add(e), onExit: (PointerExitEvent e) => exit.add(e),
child: Container( child: const SizedBox(
height: 100.0, height: 100.0,
width: 100.0, width: 100.0,
), ),
...@@ -855,7 +855,7 @@ void main() { ...@@ -855,7 +855,7 @@ void main() {
await gesture.addPointer(location: Offset.zero); await gesture.addPointer(location: Offset.zero);
addTearDown(() => gesture?.removePointer()); addTearDown(() => gesture?.removePointer());
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await gesture.moveTo(tester.getCenter(find.byType(Container))); await gesture.moveTo(tester.getCenter(find.byType(SizedBox)));
expect(enter.length, 1); expect(enter.length, 1);
expect(enter.single.position, const Offset(400.0, 300.0)); expect(enter.single.position, const Offset(400.0, 300.0));
...@@ -1286,7 +1286,7 @@ void main() { ...@@ -1286,7 +1286,7 @@ void main() {
onEnter: (_) { bottomRegionIsHovered = true; }, onEnter: (_) { bottomRegionIsHovered = true; },
onHover: (_) { bottomRegionIsHovered = true; }, onHover: (_) { bottomRegionIsHovered = true; },
onExit: (_) { bottomRegionIsHovered = true; }, onExit: (_) { bottomRegionIsHovered = true; },
child: Container( child: const SizedBox(
width: 10, width: 10,
height: 10, height: 10,
), ),
...@@ -1456,7 +1456,7 @@ void main() { ...@@ -1456,7 +1456,7 @@ void main() {
testWidgets('No new frames are scheduled when mouse moves without triggering callbacks', (WidgetTester tester) async { testWidgets('No new frames are scheduled when mouse moves without triggering callbacks', (WidgetTester tester) async {
await tester.pumpWidget(Center( await tester.pumpWidget(Center(
child: MouseRegion( child: MouseRegion(
child: Container( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
......
...@@ -231,7 +231,7 @@ void main() { ...@@ -231,7 +231,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
children: <Widget>[ children: <Widget>[
StateMarker(key: key), StateMarker(key: key),
Container(width: 100.0, height: 100.0), const SizedBox(width: 100.0, height: 100.0),
], ],
)); ));
...@@ -241,7 +241,7 @@ void main() { ...@@ -241,7 +241,7 @@ void main() {
await tester.pumpWidget(Stack( await tester.pumpWidget(Stack(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
children: <Widget>[ children: <Widget>[
Container(width: 100.0, height: 100.0), const SizedBox(width: 100.0, height: 100.0),
StateMarker(key: key), StateMarker(key: key),
], ],
)); ));
...@@ -253,7 +253,7 @@ void main() { ...@@ -253,7 +253,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
children: <Widget>[ children: <Widget>[
StateMarker(key: key), StateMarker(key: key),
Container(width: 100.0, height: 100.0), const SizedBox(width: 100.0, height: 100.0),
], ],
)); ));
...@@ -267,9 +267,9 @@ void main() { ...@@ -267,9 +267,9 @@ void main() {
await tester.pumpWidget(Stack( await tester.pumpWidget(Stack(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
children: <Widget>[ children: <Widget>[
Container(width: 100.0, height: 100.0), const SizedBox(width: 100.0, height: 100.0),
StateMarker(key: key), StateMarker(key: key),
Container(width: 100.0, height: 100.0), const SizedBox(width: 100.0, height: 100.0),
], ],
)); ));
...@@ -280,7 +280,7 @@ void main() { ...@@ -280,7 +280,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
children: <Widget>[ children: <Widget>[
Container(width: 100.0, height: 100.0, child: StateMarker(key: key)), Container(width: 100.0, height: 100.0, child: StateMarker(key: key)),
Container(width: 100.0, height: 100.0), const SizedBox(width: 100.0, height: 100.0),
], ],
)); ));
...@@ -290,9 +290,9 @@ void main() { ...@@ -290,9 +290,9 @@ void main() {
await tester.pumpWidget(Stack( await tester.pumpWidget(Stack(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
children: <Widget>[ children: <Widget>[
Container(width: 100.0, height: 100.0), const SizedBox(width: 100.0, height: 100.0),
StateMarker(key: key), StateMarker(key: key),
Container(width: 100.0, height: 100.0), const SizedBox(width: 100.0, height: 100.0),
], ],
)); ));
...@@ -302,7 +302,7 @@ void main() { ...@@ -302,7 +302,7 @@ void main() {
await tester.pumpWidget(Stack( await tester.pumpWidget(Stack(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
children: <Widget>[ children: <Widget>[
Container(width: 100.0, height: 100.0), const SizedBox(width: 100.0, height: 100.0),
Container(width: 100.0, height: 100.0, child: StateMarker(key: key)), Container(width: 100.0, height: 100.0, child: StateMarker(key: key)),
], ],
)); ));
...@@ -313,9 +313,9 @@ void main() { ...@@ -313,9 +313,9 @@ void main() {
await tester.pumpWidget(Stack( await tester.pumpWidget(Stack(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
children: <Widget>[ children: <Widget>[
Container(width: 100.0, height: 100.0), const SizedBox(width: 100.0, height: 100.0),
StateMarker(key: key), StateMarker(key: key),
Container(width: 100.0, height: 100.0), const SizedBox(width: 100.0, height: 100.0),
], ],
)); ));
......
...@@ -20,8 +20,8 @@ Widget _buildScroller({ List<String> log }) { ...@@ -20,8 +20,8 @@ Widget _buildScroller({ List<String> log }) {
} }
return false; return false;
}, },
child: SingleChildScrollView( child: const SingleChildScrollView(
child: Container(width: 1000.0, height: 1000.0), child: SizedBox(width: 1000.0, height: 1000.0),
), ),
); );
} }
......
...@@ -312,14 +312,14 @@ void main() { ...@@ -312,14 +312,14 @@ void main() {
children: <Widget>[ children: <Widget>[
Semantics( Semantics(
value: 'value one', value: 'value one',
child: Container( child: const SizedBox(
height: 10.0, height: 10.0,
width: 10.0, width: 10.0,
), ),
), ),
Semantics( Semantics(
value: 'value two', value: 'value two',
child: Container( child: const SizedBox(
height: 10.0, height: 10.0,
width: 10.0, width: 10.0,
), ),
......
...@@ -19,8 +19,8 @@ Shader createShader(Rect bounds) { ...@@ -19,8 +19,8 @@ Shader createShader(Rect bounds) {
void main() { void main() {
testWidgets('Can be constructed', (WidgetTester tester) async { testWidgets('Can be constructed', (WidgetTester tester) async {
final Widget child = Container(width: 100.0, height: 100.0); const Widget child = SizedBox(width: 100.0, height: 100.0);
await tester.pumpWidget(ShaderMask(child: child, shaderCallback: createShader)); await tester.pumpWidget(const ShaderMask(child: child, shaderCallback: createShader));
}, skip: isBrowser); }, skip: isBrowser);
testWidgets('Bounds rect includes offset', (WidgetTester tester) async { testWidgets('Bounds rect includes offset', (WidgetTester tester) async {
...@@ -37,7 +37,7 @@ void main() { ...@@ -37,7 +37,7 @@ void main() {
height: 400.0, height: 400.0,
child: ShaderMask( child: ShaderMask(
shaderCallback: recordShaderBounds, shaderCallback: recordShaderBounds,
child: Container(width: 100.0, height: 100.0), child: const SizedBox(width: 100.0, height: 100.0),
), ),
), ),
); );
......
...@@ -44,7 +44,7 @@ void main() { ...@@ -44,7 +44,7 @@ void main() {
home: Center( home: Center(
child: Semantics( child: Semantics(
label: 'Hello!', label: 'Hello!',
child: Container( child: const SizedBox(
width: 10.0, width: 10.0,
height: 10.0, height: 10.0,
), ),
......
...@@ -581,8 +581,9 @@ void main() { ...@@ -581,8 +581,9 @@ void main() {
children: List<Widget>.generate(10, (int y) { children: List<Widget>.generate(10, (int y) {
return Row( return Row(
children: children[y] = List<Widget>.generate(10, (int x) { children: children[y] = List<Widget>.generate(10, (int x) {
return Container( // nonconst is used below to avoid const constructor and to force a new instance
height: 100.0, return SizedBox(
height: nonconst(100.0),
width: 100.0, width: 100.0,
); );
}), }),
......
...@@ -412,15 +412,15 @@ void main() { ...@@ -412,15 +412,15 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Center( child: Center(
child: Stack( child: Stack(
children: <Widget>[ children: const <Widget>[
Container( SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
Positioned( Positioned(
top: 0.0, top: 0.0,
left: 0.0, left: 0.0,
child: Container( child: SizedBox(
width: 200.0, width: 200.0,
height: 200.0, height: 200.0,
), ),
...@@ -442,15 +442,15 @@ void main() { ...@@ -442,15 +442,15 @@ void main() {
child: Center( child: Center(
child: Stack( child: Stack(
overflow: Overflow.visible, overflow: Overflow.visible,
children: <Widget>[ children: const <Widget>[
Container( SizedBox(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
), ),
Positioned( Positioned(
top: 0.0, top: 0.0,
left: 0.0, left: 0.0,
child: Container( child: SizedBox(
width: 200.0, width: 200.0,
height: 200.0, height: 200.0,
), ),
......
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