Turn on sized_box_for_whitespace lint, fix instances. (#77099)

This commit is contained in:
Greg Spencer 2021-03-04 01:29:02 +00:00 committed by GitHub
parent 781eb13642
commit c6ef4c75d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
128 changed files with 1350 additions and 1367 deletions

View file

@ -181,7 +181,7 @@ linter:
- provide_deprecation_message
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
- recursive_getters
# - sized_box_for_whitespace # not yet tested
- sized_box_for_whitespace
- slash_for_doc_comments
# - sort_child_properties_last # not yet tested
- sort_constructors_first

View file

@ -14,7 +14,7 @@ void main() {
appBar: AppBar(
title: const Text('RenderFlex OverFlow'),
),
body: Container(
body: SizedBox(
width: 400.0,
child: Row(
children: <Widget>[

View file

@ -12,7 +12,7 @@ class SimpleScroll extends StatelessWidget {
return ListView(
children: <Widget>[
for (int n = 0; n < 200; n += 1)
Container(height: 40.0, child: Text('$n')),
SizedBox(height: 40.0, child: Text('$n')),
],
);
}

View file

@ -87,11 +87,11 @@ class StackSizePage extends StatelessWidget {
Widget build(BuildContext context) {
return Material(
child: Column(
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
width: 200,
height: 100,
child: const ParentWidget(),
child: ParentWidget(),
),
],
),

View file

@ -11,11 +11,11 @@ class TextPage extends StatelessWidget {
Widget build(BuildContext context) {
return Material(
child: Column(
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
width: 200,
height: 100,
child: const TextField(
child: TextField(
key: Key('basic-textfield'),
),
),

View file

@ -136,10 +136,10 @@ Press play to produce texture frames.''';
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
const SizedBox(
width: 300.0,
height: 200.0,
child: const Texture(textureId: 0),
child: Texture(textureId: 0),
),
Container(
width: 300.0,

View file

@ -164,7 +164,7 @@ class _ListItem extends StatelessWidget {
padding: const EdgeInsets.only(top: 9.0),
child: Row(
children: <Widget>[
Container(
SizedBox(
width: 38.0,
child: called!
? Align(

View file

@ -433,7 +433,7 @@ class _DiamondFab extends StatelessWidget {
color: Colors.orange,
child: InkWell(
onTap: onPressed,
child: Container(
child: SizedBox(
width: 56.0,
height: 56.0,
child: IconTheme.merge(

View file

@ -146,7 +146,7 @@ class _ListDemoState extends State<ReorderableListDemo> {
break;
case _ReorderableListType.horizontalAvatar:
case _ReorderableListType.verticalAvatar:
listTile = Container(
listTile = SizedBox(
key: Key(item.value),
height: 100.0,
width: 100.0,

View file

@ -324,7 +324,7 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
return Semantics(
button: true,
value: 'Shopping cart, $totalCartQuantity items',
child: Container(
child: SizedBox(
width: _widthAnimation.value,
height: _heightAnimation.value,
child: Material(

View file

@ -12,9 +12,9 @@ class AsymmetricView extends StatelessWidget {
final List<Product>? products;
List<Container> _buildColumns(BuildContext context) {
List<SizedBox> _buildColumns(BuildContext context) {
if (products == null || products!.isEmpty) {
return const <Container>[];
return const <SizedBox>[];
}
// This will return a list of columns. It will oscillate between the two
@ -25,7 +25,7 @@ class AsymmetricView extends StatelessWidget {
// some kinda awkward math so we use _evenCasesIndex and _oddCasesIndex as
// helpers for creating the index of the product list that will correspond
// to the index of the list of columns.
return List<Container>.generate(_listItemCount(products!.length), (int index) {
return List<SizedBox>.generate(_listItemCount(products!.length), (int index) {
double width = .59 * MediaQuery.of(context).size.width;
Widget column;
if (index.isEven) {
@ -44,7 +44,7 @@ class AsymmetricView extends StatelessWidget {
product: products![_oddCasesIndex(index)],
);
}
return Container(
return SizedBox(
width: width,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),

View file

@ -286,7 +286,7 @@ class _GestureTransformableState extends State<GestureTransformable> with Ticker
// The scene is panned/zoomed/rotated using this Transform widget.
child: Transform(
transform: _transform,
child: Container(
child: SizedBox(
child: widget.child,
height: widget.size.height,
width: widget.size.width,

View file

@ -20,7 +20,7 @@ Future<void> main() async {
key: const Key('ImageList'),
itemCount: numItems,
itemBuilder: (BuildContext context, int position) {
return Container(
return SizedBox(
width: 200,
height: 200,
child: Center(

View file

@ -81,9 +81,9 @@ class PlatformViewPage extends StatelessWidget {
),
body: Column(
children: <Widget>[
Expanded(
child: Container(
child: const UiKitView(viewType: 'platform_view'),
const Expanded(
child: SizedBox(
child: UiKitView(viewType: 'platform_view'),
width: 300,
),
),

View file

@ -198,10 +198,10 @@ class MovableBall extends StatelessWidget {
child: const Center(child: Text('BALL')),
),
);
final Widget dashedBall = Container(
const Widget dashedBall = SizedBox(
width: kBallSize,
height: kBallSize,
child: const CustomPaint(
child: CustomPaint(
painter: DashOutlineCirclePainter()
),
);

View file

@ -38,7 +38,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
container: container,
child: Directionality(
textDirection: TextDirection.ltr,
child: Container(
child: SizedBox(
height: 300.0,
child: Column(
children: <Widget>[

View file

@ -228,7 +228,7 @@ class _AutocompleteOptions<T extends Object> extends StatelessWidget {
alignment: Alignment.topLeft,
child: Material(
elevation: 4.0,
child: Container(
child: SizedBox(
height: 200.0,
child: ListView.builder(
padding: EdgeInsets.zero,

View file

@ -383,7 +383,7 @@ class _DatePickerModeToggleButtonState extends State<_DatePickerModeToggleButton
label: MaterialLocalizations.of(context).selectYearSemanticsLabel,
excludeSemantics: true,
button: true,
child: Container(
child: SizedBox(
height: _subHeaderHeight,
child: InkWell(
onTap: widget.onTitlePressed,

View file

@ -314,7 +314,7 @@ class DayPicker extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Column(
children: <Widget>[
Container(
SizedBox(
height: _kDayPickerRowHeight,
child: Center(
child: ExcludeSemantics(

View file

@ -539,7 +539,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
data: const IconThemeData(
opacity: 0.54
),
child: Container(
child: SizedBox(
// TODO(bkonyi): this won't handle text zoom correctly,
// https://github.com/flutter/flutter/issues/48522
height: 56.0,

View file

@ -682,7 +682,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
canRequestFocus: widget.steps[i].state != StepState.disabled,
child: Row(
children: <Widget>[
Container(
SizedBox(
height: 72.0,
child: Center(
child: _buildIcon(i),

View file

@ -159,7 +159,7 @@ class _TimePickerHeader extends StatelessWidget {
controls = Column(
children: <Widget>[
const SizedBox(height: 16.0),
Container(
SizedBox(
height: kMinInteractiveDimension * 2,
child: Row(
children: <Widget>[
@ -209,7 +209,7 @@ class _TimePickerHeader extends StatelessWidget {
orientation: orientation,
onChanged: onChanged,
),
Container(
SizedBox(
height: kMinInteractiveDimension * 2,
child: Row(
// Hour/minutes should not change positions in RTL locales.
@ -287,7 +287,7 @@ class _HourMinuteControl extends StatelessWidget {
final ShapeBorder shape = timePickerTheme.hourMinuteShape ?? _kDefaultShape;
final Set<MaterialState> states = isSelected ? <MaterialState>{MaterialState.selected} : <MaterialState>{};
return Container(
return SizedBox(
height: _kTimePickerHeaderControlHeight,
child: Material(
color: MaterialStateProperty.resolveAs(backgroundColor, states),
@ -610,7 +610,7 @@ class _DayPeriodControl extends StatelessWidget {
result = _DayPeriodInputPadding(
minSize: const Size(width, kMinInteractiveDimension * 2),
orientation: orientation,
child: Container(
child: SizedBox(
width: width,
height: _kTimePickerHeaderControlHeight,
child: Material(
@ -637,7 +637,7 @@ class _DayPeriodControl extends StatelessWidget {
result = _DayPeriodInputPadding(
minSize: const Size(0.0, kMinInteractiveDimension),
orientation: orientation,
child: Container(
child: SizedBox(
height: 40.0,
child: Material(
clipBehavior: Clip.antiAlias,

View file

@ -292,7 +292,7 @@ class MethodChannel {
/// NSArray* items = [BWPlayApi items];
/// NSMutableArray* json = [NSMutableArray arrayWithCapacity:items.count];
/// for (final BWPlayItem* item in items) {
/// [json addObject:@{@"id":item.itemId, @"title":item.name, @"artist":item.artist}];
/// [json addObject:@{ @"id":item.itemId, @"title":item.name, @"artist":item.artist }];
/// }
/// result(json);
/// } else if ([@"play" isEqualToString:call.method]) {

View file

@ -1502,7 +1502,7 @@ Widget _buildPicker({
onSelectedItemChanged: onSelectedItemChanged,
children: List<Widget>.generate(100, (int index) {
return Center(
child: Container(
child: SizedBox(
width: 400.0,
height: 100.0,
child: Text(index.toString()),

View file

@ -22,7 +22,7 @@ void main() {
itemExtent: 50.0,
onSelectedItemChanged: (_) { },
children: List<Widget>.generate(3, (int index) {
return Container(
return SizedBox(
height: 50.0,
width: 300.0,
child: Text(index.toString()),
@ -65,7 +65,7 @@ void main() {
itemExtent: 50.0,
onSelectedItemChanged: (_) { },
children: List<Widget>.generate(3, (int index) {
return Container(
return SizedBox(
height: 50.0,
width: 300.0,
child: Text(index.toString()),
@ -78,7 +78,7 @@ void main() {
);
expect(
tester.getTopLeft(find.widgetWithText(Container, '1')),
tester.getTopLeft(find.widgetWithText(SizedBox, '1').first),
const Offset(0.0, 125.0),
);
@ -86,11 +86,11 @@ void main() {
await tester.pump();
expect(
tester.getTopLeft(find.widgetWithText(Container, '1')),
tester.getTopLeft(find.widgetWithText(SizedBox, '1').first),
const Offset(0.0, 175.0),
);
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')),
tester.getTopLeft(find.widgetWithText(SizedBox, '0').first),
const Offset(0.0, 125.0),
);
});
@ -191,7 +191,7 @@ void main() {
onSelectedItemChanged: (int index) { selectedItems.add(index); },
children: List<Widget>.generate(100, (int index) {
return Center(
child: Container(
child: SizedBox(
width: 400.0,
height: 100.0,
child: Text(index.toString()),
@ -242,7 +242,7 @@ void main() {
onSelectedItemChanged: (int index) { selectedItems.add(index); },
children: List<Widget>.generate(100, (int index) {
return Center(
child: Container(
child: SizedBox(
width: 400.0,
height: 100.0,
child: Text(index.toString()),
@ -272,7 +272,7 @@ void main() {
onSelectedItemChanged: (int index) { selectedItems.add(index); },
children: List<Widget>.generate(100, (int index) {
return Center(
child: Container(
child: SizedBox(
width: 400.0,
height: 100.0,
child: Text(index.toString()),
@ -288,14 +288,14 @@ void main() {
// The item that was in the center now moved a bit.
expect(
tester.getTopLeft(find.widgetWithText(Container, '10')),
tester.getTopLeft(find.widgetWithText(SizedBox, '10')),
const Offset(200.0, 280.0),
);
await tester.pumpAndSettle();
expect(
tester.getTopLeft(find.widgetWithText(Container, '10')).dy,
tester.getTopLeft(find.widgetWithText(SizedBox, '10')).dy,
moreOrLessEquals(250.0, epsilon: 0.5),
);
expect(selectedItems.isEmpty, true);
@ -306,7 +306,7 @@ void main() {
await tester.pumpAndSettle();
expect(
tester.getTopLeft(find.widgetWithText(Container, '10')).dy,
tester.getTopLeft(find.widgetWithText(SizedBox, '10')).dy,
// It's down by 100.0 now.
moreOrLessEquals(350.0, epsilon: 0.5),
);
@ -327,7 +327,7 @@ void main() {
onSelectedItemChanged: (int index) { selectedItems.add(index); },
children: List<Widget>.generate(100, (int index) {
return Center(
child: Container(
child: SizedBox(
width: 400.0,
height: 100.0,
child: Text(index.toString()),
@ -348,7 +348,7 @@ void main() {
// Should have been flung far enough that even the first item goes off
// screen and gets removed.
expect(find.widgetWithText(Container, '0').evaluate().isEmpty, true);
expect(find.widgetWithText(SizedBox, '0').evaluate().isEmpty, true);
expect(
selectedItems,
@ -361,7 +361,7 @@ void main() {
await tester.pumpAndSettle();
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')).dy,
tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy,
// Should have sprung back to the middle now.
moreOrLessEquals(250.0),
);

View file

@ -21,7 +21,7 @@ void main() {
return SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Container(
return SizedBox(
height: 200.0,
child: Center(child: Text(index.toString())),
);
@ -50,7 +50,7 @@ void main() {
expect(mockHelper.invocations, isEmpty);
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')),
tester.getTopLeft(find.widgetWithText(SizedBox, '0')),
Offset.zero,
);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
@ -85,7 +85,7 @@ void main() {
expect(mockHelper.invocations, hasLength(1));
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')),
tester.getTopLeft(find.widgetWithText(SizedBox, '0')),
const Offset(0.0, 50.0),
);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
@ -114,7 +114,7 @@ void main() {
expect(mockHelper.invocations, isEmpty);
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')),
tester.getTopLeft(find.widgetWithText(SizedBox, '0')),
Offset.zero,
);
}, variant: TargetPlatformVariant.only(TargetPlatform.android));
@ -165,7 +165,7 @@ void main() {
expect(mockHelper.invocations, hasLength(3));
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')),
tester.getTopLeft(find.widgetWithText(SizedBox, '0')),
Offset.zero,
);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
@ -282,7 +282,7 @@ void main() {
// Stays in that state forever until future completes.
await tester.pump(const Duration(seconds: 1000));
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')),
tester.getTopLeft(find.widgetWithText(SizedBox, '0')),
const Offset(0.0, 60.0),
);
@ -355,7 +355,7 @@ void main() {
// Stays in that state forever until future completes.
await tester.pump(const Duration(seconds: 1000));
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')),
tester.getTopLeft(find.widgetWithText(SizedBox, '0')),
const Offset(0.0, 60.0),
);
@ -840,8 +840,8 @@ void main() {
),
);
await tester.fling(find.byType(Container).first, const Offset(0.0, 200.0), 2000.0);
await tester.fling(find.byType(Container).first, const Offset(0.0, -200.0), 3000.0, warnIfMissed: false); // IgnorePointer is enabled while scroll is ballistic.
await tester.fling(find.byType(SizedBox).first, const Offset(0.0, 200.0), 2000.0);
await tester.fling(find.byType(SizedBox).first, const Offset(0.0, -200.0), 3000.0, warnIfMissed: false); // IgnorePointer is enabled while scroll is ballistic.
expect(mockHelper.invocations, isEmpty);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
@ -937,7 +937,7 @@ void main() {
),
);
final double initialFirstCellY = tester.getTopLeft(find.widgetWithText(Container, '0')).dy;
final double initialFirstCellY = tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy;
// Drag down but not enough to trigger the refresh.
await tester.drag(find.text('0'), const Offset(0.0, 50.0), touchSlopY: 0);
@ -952,7 +952,7 @@ void main() {
expect(mockHelper.invocations, hasLength(1));
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')).dy,
tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy,
initialFirstCellY + 50
);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
@ -1074,7 +1074,7 @@ void main() {
await gesture.moveBy(const Offset(0.0, -80.0)); // Overscrolling, need to move more than -40.
await tester.pump();
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')).dy,
tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy,
moreOrLessEquals(49.775111111111116), // Below 50 now.
);
expect(
@ -1116,7 +1116,7 @@ void main() {
RefreshIndicatorMode.refresh,
);
expect(
tester.getRect(find.widgetWithText(Container, '0')),
tester.getRect(find.widgetWithText(SizedBox, '0')),
const Rect.fromLTRB(0.0, 60.0, 800.0, 260.0),
);
@ -1167,7 +1167,7 @@ void main() {
await gesture.moveBy(const Offset(0.0, -200.0));
await tester.pump();
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')).dy,
tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy,
moreOrLessEquals(27.944444444444457),
);
// Need to bring it to 100 * 0.1 to reset to inactive.
@ -1179,7 +1179,7 @@ void main() {
await gesture.moveBy(const Offset(0.0, -35.0));
await tester.pump();
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')).dy,
tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy,
moreOrLessEquals(9.313890708161875),
);
expect(
@ -1219,7 +1219,7 @@ void main() {
await tester.pump();
// The refresh indicator is offscreen now.
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')).dy,
tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy,
moreOrLessEquals(-145.0332383665717),
);
expect(
@ -1236,13 +1236,13 @@ void main() {
);
// Nothing moved.
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')).dy,
tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy,
moreOrLessEquals(-145.0332383665717),
);
await tester.pump(const Duration(seconds: 2));
// Everything stayed as is.
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')).dy,
tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy,
moreOrLessEquals(-145.0332383665717),
);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));

View file

@ -1118,7 +1118,7 @@ void main() {
child: Hero(
tag: 'tag',
transitionOnUserGestures: true,
child: Container(key: container, height: 150.0, width: 150.0)
child: SizedBox(key: container, height: 150.0, width: 150.0)
),
)
);
@ -1131,7 +1131,7 @@ void main() {
child: Hero(
tag: 'tag',
transitionOnUserGestures: true,
child: Container(key: container, height: 150.0, width: 150.0)
child: SizedBox(key: container, height: 150.0, width: 150.0)
)
),
)

View file

@ -4217,7 +4217,7 @@ void main() {
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
SizedBox(
width: 100.0,
child: CupertinoTextField(
controller: controller1,
@ -4228,21 +4228,21 @@ void main() {
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
SizedBox(
width: 100.0,
child: CupertinoTextField(
controller: controller2,
focusNode: focusNode2,
),
),
Container(
SizedBox(
width: 100.0,
child: CupertinoTextField(
controller: controller3,
focusNode: focusNode3,
),
),
Container(
SizedBox(
width: 100.0,
child: CupertinoTextField(
controller: controller4,
@ -4251,7 +4251,7 @@ void main() {
),
],
),
Container(
SizedBox(
width: 100.0,
child: CupertinoTextField(
controller: controller5,

View file

@ -54,6 +54,13 @@ class _CustomCupertinoTextSelectionControls extends CupertinoTextSelectionContro
}
}
class TestBox extends SizedBox {
const TestBox({Key? key}) : super(key: key, width: itemWidth, height: itemHeight);
static const double itemHeight = 44.0;
static const double itemWidth = 100.0;
}
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
@ -75,18 +82,7 @@ void main() {
testWidgets('paginates children if they overflow', (WidgetTester tester) async {
late StateSetter setState;
const double height = 44.0;
const double itemWidth = 100.0;
final List<Widget> children = <Widget>[
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
];
final List<Widget> children = List<Widget>.generate(7, (int i) => const TestBox());
await tester.pumpWidget(
CupertinoApp(
home: Center(
@ -105,25 +101,25 @@ void main() {
);
// All children fit on the screen, so they are all rendered.
expect(find.byType(Container), findsNWidgets(children.length));
expect(find.byType(TestBox), findsNWidgets(children.length));
expect(_findOverflowNextButton(), findsNothing);
expect(_findOverflowBackButton(), findsNothing);
// Adding one more child makes the children overflow.
setState(() {
children.add(
Container(width: itemWidth, height: height),
const TestBox(),
);
});
await tester.pumpAndSettle();
expect(find.byType(Container), findsNWidgets(children.length - 1));
expect(find.byType(TestBox), findsNWidgets(children.length - 1));
expect(_findOverflowNextButton(), findsOneWidget);
expect(_findOverflowBackButton(), findsNothing);
// Tap the overflow next button to show the next page of children.
await tester.tap(_findOverflowNextButton());
await tester.pumpAndSettle();
expect(find.byType(Container), findsNWidgets(1));
expect(find.byType(TestBox), findsNWidgets(1));
expect(_findOverflowNextButton(), findsOneWidget);
expect(_findOverflowBackButton(), findsOneWidget);
@ -131,28 +127,28 @@ void main() {
// disabled and there are no more children to display.
await tester.tap(_findOverflowNextButton());
await tester.pumpAndSettle();
expect(find.byType(Container), findsNWidgets(1));
expect(find.byType(TestBox), findsNWidgets(1));
expect(_findOverflowNextButton(), findsOneWidget);
expect(_findOverflowBackButton(), findsOneWidget);
// Tap the overflow back button to go back to the first page.
await tester.tap(_findOverflowBackButton());
await tester.pumpAndSettle();
expect(find.byType(Container), findsNWidgets(7));
expect(find.byType(TestBox), findsNWidgets(7));
expect(_findOverflowNextButton(), findsOneWidget);
expect(_findOverflowBackButton(), findsNothing);
// Adding 7 more children overflows onto a third page.
setState(() {
children.add(Container(width: itemWidth, height: height));
children.add(Container(width: itemWidth, height: height));
children.add(Container(width: itemWidth, height: height));
children.add(Container(width: itemWidth, height: height));
children.add(Container(width: itemWidth, height: height));
children.add(Container(width: itemWidth, height: height));
children.add(const TestBox());
children.add(const TestBox());
children.add(const TestBox());
children.add(const TestBox());
children.add(const TestBox());
children.add(const TestBox());
});
await tester.pumpAndSettle();
expect(find.byType(Container), findsNWidgets(7));
expect(find.byType(TestBox), findsNWidgets(7));
expect(_findOverflowNextButton(), findsOneWidget);
expect(_findOverflowBackButton(), findsNothing);
@ -160,28 +156,28 @@ void main() {
await tester.tap(_findOverflowNextButton());
await tester.pumpAndSettle();
// With the back button, only six children fit on this page.
expect(find.byType(Container), findsNWidgets(6));
expect(find.byType(TestBox), findsNWidgets(6));
expect(_findOverflowNextButton(), findsOneWidget);
expect(_findOverflowBackButton(), findsOneWidget);
// Tap the overflow next button again to show the third page of children.
await tester.tap(_findOverflowNextButton());
await tester.pumpAndSettle();
expect(find.byType(Container), findsNWidgets(1));
expect(find.byType(TestBox), findsNWidgets(1));
expect(_findOverflowNextButton(), findsOneWidget);
expect(_findOverflowBackButton(), findsOneWidget);
// Tap the overflow back button to go back to the second page.
await tester.tap(_findOverflowBackButton());
await tester.pumpAndSettle();
expect(find.byType(Container), findsNWidgets(6));
expect(find.byType(TestBox), findsNWidgets(6));
expect(_findOverflowNextButton(), findsOneWidget);
expect(_findOverflowBackButton(), findsOneWidget);
// Tap the overflow back button to go back to the first page.
await tester.tap(_findOverflowBackButton());
await tester.pumpAndSettle();
expect(find.byType(Container), findsNWidgets(7));
expect(find.byType(TestBox), findsNWidgets(7));
expect(_findOverflowNextButton(), findsOneWidget);
expect(_findOverflowBackButton(), findsNothing);
}, skip: kIsWeb);

View file

@ -487,7 +487,7 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: Center(
child: Container(
child: SizedBox(
height: 0.0,
width: 0.0,
child: Scaffold(

View file

@ -750,7 +750,7 @@ void main() {
);
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -802,18 +802,16 @@ void main() {
reverseDuration: const Duration(seconds: 2),
),
builder: (BuildContext context) {
return Container(
child: MaterialButton(
child: const Text('BottomSheet'),
onPressed: () => Navigator.pop(context),
key: tapTargetToClose,
),
return MaterialButton(
child: const Text('BottomSheet'),
onPressed: () => Navigator.pop(context),
key: tapTargetToClose,
);
},
);
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),

View file

@ -90,16 +90,16 @@ void main() {
const Key child2Key = Key('child2');
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Center(
child: ButtonBar(
key: buttonBarKey,
// buttonPadding set to zero to simplify test calculations.
buttonPadding: EdgeInsets.zero,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
Container(key: child2Key, width: 100.0, height: 100.0),
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
],
),
),
@ -136,9 +136,9 @@ void main() {
const Key child1Key = Key('child1');
const Key child2Key = Key('child2');
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: ButtonBarTheme(
data: const ButtonBarThemeData(
data: ButtonBarThemeData(
mainAxisSize: MainAxisSize.min,
),
child: Center(
@ -147,9 +147,9 @@ void main() {
// buttonPadding set to zero to simplify test calculations.
buttonPadding: EdgeInsets.zero,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
Container(key: child2Key, width: 100.0, height: 100.0),
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
],
),
),
@ -191,9 +191,9 @@ void main() {
const Key child1Key = Key('child1');
const Key child2Key = Key('child2');
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: ButtonBarTheme(
data: const ButtonBarThemeData(
data: ButtonBarThemeData(
mainAxisSize: MainAxisSize.min,
),
child: Center(
@ -203,9 +203,9 @@ void main() {
buttonPadding: EdgeInsets.zero,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
Container(key: child2Key, width: 100.0, height: 100.0),
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
],
),
),
@ -394,8 +394,8 @@ void main() {
MaterialApp(
home: ButtonBar(
children: <Widget>[
Container(key: keyOne, height: 50.0, width: 800.0),
Container(key: keyTwo, height: 50.0, width: 800.0),
SizedBox(key: keyOne, height: 50.0, width: 800.0),
SizedBox(key: keyTwo, height: 50.0, width: 800.0),
],
),
),
@ -419,8 +419,8 @@ void main() {
// Set padding to zero to align buttons with edge of button bar.
buttonPadding: EdgeInsets.zero,
children: <Widget>[
Container(key: keyOne, height: 50.0, width: 500.0),
Container(key: keyTwo, height: 50.0, width: 500.0),
SizedBox(key: keyOne, height: 50.0, width: 500.0),
SizedBox(key: keyTwo, height: 50.0, width: 500.0),
],
),
),
@ -447,8 +447,8 @@ void main() {
// Set padding to zero to align buttons with edge of button bar.
buttonPadding: EdgeInsets.zero,
children: <Widget>[
Container(key: keyOne, height: 50.0, width: 500.0),
Container(key: keyTwo, height: 50.0, width: 500.0),
SizedBox(key: keyOne, height: 50.0, width: 500.0),
SizedBox(key: keyTwo, height: 50.0, width: 500.0),
],
),
),
@ -474,8 +474,8 @@ void main() {
// Set padding to zero to align buttons with edge of button bar.
buttonPadding: EdgeInsets.zero,
children: <Widget>[
Container(key: keyOne, height: 50.0, width: 500.0),
Container(key: keyTwo, height: 50.0, width: 500.0),
SizedBox(key: keyOne, height: 50.0, width: 500.0),
SizedBox(key: keyTwo, height: 50.0, width: 500.0),
],
),
),
@ -504,8 +504,8 @@ void main() {
// Set padding to zero to align buttons with edge of button bar.
buttonPadding: EdgeInsets.zero,
children: <Widget>[
Container(key: keyOne, height: 50.0, width: 500.0),
Container(key: keyTwo, height: 50.0, width: 500.0),
SizedBox(key: keyOne, height: 50.0, width: 500.0),
SizedBox(key: keyTwo, height: 50.0, width: 500.0),
],
),
),
@ -527,8 +527,8 @@ void main() {
// Set padding to zero to align buttons with edge of button bar.
buttonPadding: EdgeInsets.zero,
children: <Widget>[
Container(key: keyOne, height: 50.0, width: 500.0),
Container(key: keyTwo, height: 50.0, width: 500.0),
SizedBox(key: keyOne, height: 50.0, width: 500.0),
SizedBox(key: keyTwo, height: 50.0, width: 500.0),
],
),
),
@ -560,8 +560,8 @@ void main() {
// out upwards.
overflowDirection: VerticalDirection.up,
children: <Widget>[
Container(key: keyOne, height: 50.0, width: 500.0),
Container(key: keyTwo, height: 50.0, width: 500.0),
SizedBox(key: keyOne, height: 50.0, width: 500.0),
SizedBox(key: keyTwo, height: 50.0, width: 500.0),
],
),
),
@ -586,8 +586,8 @@ void main() {
// Set padding to zero to align buttons with edge of button bar.
buttonPadding: EdgeInsets.zero,
children: <Widget>[
Container(key: keyOne, height: 50.0, width: 500.0),
Container(key: keyTwo, height: 50.0, width: 500.0),
SizedBox(key: keyOne, height: 50.0, width: 500.0),
SizedBox(key: keyTwo, height: 50.0, width: 500.0),
],
),
),
@ -614,8 +614,8 @@ void main() {
// buttons in an overflow case.
overflowButtonSpacing: 10.0,
children: <Widget>[
Container(key: keyOne, height: 50.0, width: 500.0),
Container(key: keyTwo, height: 50.0, width: 500.0),
SizedBox(key: keyOne, height: 50.0, width: 500.0),
SizedBox(key: keyTwo, height: 50.0, width: 500.0),
],
),
),

View file

@ -242,7 +242,7 @@ void main() {
return Container(
alignment: Alignment.center,
child: DropdownButtonHideUnderline(
child: Container(
child: SizedBox(
width: 200.0,
child: DropdownButton<String>(
key: dropdownKey,

View file

@ -105,12 +105,12 @@ Future<void> _testConstrainedLabel(
await tester.pumpWidget(
_wrapForChip(
child: Center(
child: Container(
child: SizedBox(
width: chipParentWidth,
height: chipParentHeight,
child: Chip(
avatar: avatar,
label: Container(
label: SizedBox(
key: labelKey,
width: labelWidth,
height: labelHeight,
@ -321,13 +321,13 @@ void main() {
await tester.pumpWidget(
_wrapForChip(
child: Center(
child: Container(
child: SizedBox(
width: 500.0,
height: 500.0,
child: Column(
children: <Widget>[
Chip(
label: Container(
label: SizedBox(
key: labelKey,
width: labelWidth,
height: labelHeight,
@ -396,7 +396,7 @@ void main() {
Widget chipBuilder (String text, {Widget? avatar, VoidCallback? onDeleted}) {
return MaterialApp(
home: Scaffold(
body: Container(
body: SizedBox(
width: 150,
child: Column(
children: <Widget>[
@ -634,7 +634,7 @@ void main() {
),
Chip(
avatar: const CircleAvatar(child: Text('B')),
label: Container(key: keyB, width: 10.0, height: 10.0),
label: SizedBox(key: keyB, width: 10.0, height: 10.0),
),
],
),
@ -662,7 +662,7 @@ void main() {
child: Column(
children: <Widget>[
Chip(
avatar: Container(key: keyA, width: 20.0, height: 20.0),
avatar: SizedBox(key: keyA, width: 20.0, height: 20.0),
label: const Text('Chip A'),
),
],
@ -680,7 +680,7 @@ void main() {
child: Column(
children: <Widget>[
Chip(
deleteIcon: Container(key: keyA, width: 20.0, height: 20.0),
deleteIcon: SizedBox(key: keyA, width: 20.0, height: 20.0),
label: const Text('Chip A'),
onDeleted: () { },
),
@ -706,7 +706,7 @@ void main() {
child: Center(
child: Chip(
avatar: Placeholder(key: keyA),
label: Container(
label: SizedBox(
key: keyB,
width: 40.0,
height: 40.0,
@ -743,7 +743,7 @@ void main() {
child: Center(
child: Chip(
avatar: Placeholder(key: keyA),
label: Container(
label: SizedBox(
key: keyB,
width: 40.0,
height: 40.0,
@ -1226,13 +1226,13 @@ void main() {
// With avatar, but not selectable.
final UniqueKey avatarKey = UniqueKey();
await pushChip(
avatar: Container(width: 40.0, height: 40.0, key: avatarKey),
avatar: SizedBox(width: 40.0, height: 40.0, key: avatarKey),
);
expect(tester.getSize(find.byType(RawChip)), equals(const Size(104.0, 48.0)));
// Turn on selection.
await pushChip(
avatar: Container(width: 40.0, height: 40.0, key: avatarKey),
avatar: SizedBox(width: 40.0, height: 40.0, key: avatarKey),
selectable: true,
);
await tester.pumpAndSettle();
@ -1384,7 +1384,7 @@ void main() {
final UniqueKey avatarKey = UniqueKey();
await pushChip(
avatar: Container(width: 40.0, height: 40.0, key: avatarKey),
avatar: SizedBox(width: 40.0, height: 40.0, key: avatarKey),
selectable: true,
);
await tester.pumpAndSettle();

View file

@ -130,7 +130,7 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: Material(
child: Container(
child: SizedBox(
height: 24.0,
child: Row(
children: const <Widget>[

View file

@ -1601,7 +1601,7 @@ void main() {
itemHeight: null,
selectedItemBuilder: (BuildContext context) {
return items.map<Widget>((String item) {
return Container(
return SizedBox(
height: double.parse(item),
width: double.parse(item),
child: Center(child: Text(item)),
@ -1629,16 +1629,16 @@ void main() {
await tester.pumpWidget(buildFrame(
value: null,
// [hint] widget is smaller than largest selected item widget
hint: Container(
hint: const SizedBox(
height: 50,
width: 50,
child: const Text('hint')
child: Text('hint')
),
items: items,
itemHeight: null,
selectedItemBuilder: (BuildContext context) {
return items.map<Widget>((String item) {
return Container(
return SizedBox(
height: double.parse(item),
width: double.parse(item),
child: Center(child: Text(item)),
@ -1671,16 +1671,16 @@ void main() {
// to the largest item regardless of which one is selected.
value: selectedItem,
// [hint] widget is larger than largest selected item widget
hint: Container(
hint: const SizedBox(
height: 125,
width: 125,
child: const Text('hint')
child: Text('hint'),
),
items: items,
itemHeight: null,
selectedItemBuilder: (BuildContext context) {
return items.map<Widget>((String item) {
return Container(
return SizedBox(
height: double.parse(item),
width: double.parse(item),
child: Center(child: Text(item)),
@ -1709,16 +1709,16 @@ void main() {
await tester.pumpWidget(buildFrame(
value: null,
// [hint] widget is smaller than largest selected item widget
hint: Container(
hint: const SizedBox(
height: 50,
width: 50,
child: const Text('hint')
child: Text('hint'),
),
items: items,
itemHeight: null,
selectedItemBuilder: (BuildContext context) {
return items.map<Widget>((String item) {
return Container(
return SizedBox(
height: double.parse(item),
width: double.parse(item),
child: Center(child: Text(item)),
@ -1747,16 +1747,16 @@ void main() {
await tester.pumpWidget(buildFrame(
value: null,
// [hint] widget is larger than largest selected item widget
hint: Container(
hint: const SizedBox(
height: 125,
width: 125,
child: const Text('hint')
child: Text('hint')
),
items: items,
itemHeight: null,
selectedItemBuilder: (BuildContext context) {
return items.map<Widget>((String item) {
return Container(
return SizedBox(
height: double.parse(item),
width: double.parse(item),
child: Center(child: Text(item)),
@ -1785,16 +1785,16 @@ void main() {
await tester.pumpWidget(buildFrame(
value: null,
// [hint] widget is smaller than largest selected item widget
disabledHint: Container(
disabledHint: const SizedBox(
height: 50,
width: 50,
child: const Text('hint')
child: Text('hint')
),
items: items,
itemHeight: null,
selectedItemBuilder: (BuildContext context) {
return items.map<Widget>((String item) {
return Container(
return SizedBox(
height: double.parse(item),
width: double.parse(item),
child: Center(child: Text(item)),
@ -1823,16 +1823,16 @@ void main() {
await tester.pumpWidget(buildFrame(
value: null,
// [hint] widget is larger than largest selected item widget
disabledHint: Container(
disabledHint: const SizedBox(
height: 125,
width: 125,
child: const Text('hint')
child: Text('hint')
),
items: items,
itemHeight: null,
selectedItemBuilder: (BuildContext context) {
return items.map<Widget>((String item) {
return Container(
return SizedBox(
height: double.parse(item),
width: double.parse(item),
child: Center(child: Text(item)),

View file

@ -297,15 +297,15 @@ void main() {
});
testWidgets('ExpansionTile expandedAlignment test', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
await tester.pumpWidget(const MaterialApp(
home: Material(
child: Center(
child: ExpansionTile(
title: const Text('title'),
title: Text('title'),
expandedAlignment: Alignment.centerLeft,
children: <Widget>[
Container(height: 100, width: 100),
Container(height: 100, width: 80),
SizedBox(height: 100, width: 100),
SizedBox(height: 100, width: 80),
],
),
),
@ -339,9 +339,9 @@ void main() {
// and expandedCrossAxisAlignment later in the test.
expandedAlignment: Alignment.centerRight,
expandedCrossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(height: 100, width: 100, key: child0Key),
Container(height: 100, width: 80, key: child1Key),
children: const <Widget>[
SizedBox(height: 100, width: 100, key: child0Key),
SizedBox(height: 100, width: 80, key: child1Key),
],
),
),
@ -391,14 +391,14 @@ void main() {
testWidgets('expandedCrossAxisAlignment and expandedAlignment default values', (WidgetTester tester) async {
const Key child1Key = Key('child1');
await tester.pumpWidget(MaterialApp(
await tester.pumpWidget(const MaterialApp(
home: Material(
child: Center(
child: ExpansionTile(
title: const Text('title'),
title: Text('title'),
children: <Widget>[
Container(height: 100, width: 100),
Container(height: 100, width: 80, key: child1Key),
SizedBox(height: 100, width: 100),
SizedBox(height: 100, width: 80, key: child1Key),
],
),
),
@ -424,18 +424,20 @@ void main() {
});
testWidgets('childrenPadding default value', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: Material(
child: Center(
child: ExpansionTile(
title: const Text('title'),
children: <Widget>[
Container(height: 100, width: 100),
],
await tester.pumpWidget(
const MaterialApp(
home: Material(
child: Center(
child: ExpansionTile(
title: Text('title'),
children: <Widget>[
SizedBox(height: 100, width: 100),
],
),
),
),
),
));
);
await tester.tap(find.text('title'));
await tester.pumpAndSettle();
@ -452,19 +454,21 @@ void main() {
});
testWidgets('ExpansionTile childrenPadding test', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: Material(
child: Center(
child: ExpansionTile(
title: const Text('title'),
childrenPadding: const EdgeInsets.fromLTRB(10, 8, 12, 4),
children: <Widget>[
Container(height: 100, width: 100),
],
await tester.pumpWidget(
const MaterialApp(
home: Material(
child: Center(
child: ExpansionTile(
title: Text('title'),
childrenPadding: EdgeInsets.fromLTRB(10, 8, 12, 4),
children: <Widget>[
SizedBox(height: 100, width: 100),
],
),
),
),
),
));
);
await tester.tap(find.text('title'));
await tester.pumpAndSettle();

View file

@ -141,7 +141,7 @@ void main() {
delegate: SliverChildListDelegate(
<Widget>[
for (int i = 0; i < 50; i++)
Container(
SizedBox(
height: 200,
child: Center(child: Text('Item $i')),
),

View file

@ -624,9 +624,9 @@ void main() {
data: data,
child: Scaffold(
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
bottomSheet: bottomSheet ? Container(
bottomSheet: bottomSheet ? const SizedBox(
height: 100,
child: const Center(child: Text('BottomSheet')),
child: Center(child: Text('BottomSheet')),
) : null,
appBar: appBar ? AppBar(title: const Text('Demo')) : null,
bottomNavigationBar: bottomNavigationBar ? BottomNavigationBar(

View file

@ -45,7 +45,7 @@ void main() {
textDirection: TextDirection.ltr,
child: Material(
child: Center(
child: Container(
child: SizedBox(
width: 200.0,
height: 60.0,
child: InkWell(
@ -94,7 +94,7 @@ void main() {
textDirection: TextDirection.ltr,
child: Material(
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 100.0,
child: InkWell(
@ -267,7 +267,7 @@ void main() {
textDirection: TextDirection.ltr,
child: Material(
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 100.0,
child: InkWell(
@ -358,7 +358,7 @@ void main() {
textDirection: TextDirection.ltr,
child: Material(
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 100.0,
child: InkWell(
@ -394,7 +394,7 @@ void main() {
textDirection: TextDirection.ltr,
child: Material(
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 100.0,
child: InkWell(

View file

@ -128,7 +128,7 @@ void main() {
child: Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkWell(
@ -147,7 +147,7 @@ void main() {
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
await gesture.addPointer();
addTearDown(gesture.removePointer);
await gesture.moveTo(tester.getCenter(find.byType(Container)));
await gesture.moveTo(tester.getCenter(find.byType(SizedBox)));
await tester.pumpAndSettle();
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0), color: const Color(0xff00ff00)));
@ -160,7 +160,7 @@ void main() {
child: Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkWell(
@ -184,7 +184,7 @@ void main() {
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
await gesture.addPointer();
addTearDown(gesture.removePointer);
await gesture.moveTo(tester.getCenter(find.byType(Container)));
await gesture.moveTo(tester.getCenter(find.byType(SizedBox)));
await tester.pumpAndSettle();
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0), color: const Color(0xff00ff00)));
@ -198,7 +198,7 @@ void main() {
child: Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkWell(
@ -235,7 +235,7 @@ void main() {
child: Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkWell(
@ -278,7 +278,7 @@ void main() {
child: Center(
child: Focus(
focusNode: focusNode,
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkWell(
@ -316,7 +316,7 @@ void main() {
child: Center(
child: Focus(
focusNode: focusNode,
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkWell(
@ -354,7 +354,7 @@ void main() {
child: Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkResponse(
@ -383,7 +383,7 @@ void main() {
child: Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkWell(
@ -573,9 +573,9 @@ void main() {
addAutomaticKeepAlives: keepAlive,
dragStartBehavior: DragStartBehavior.down,
children: <Widget>[
Container(height: 500.0, child: InkWell(onTap: () {}, child: const Placeholder())),
Container(height: 500.0),
Container(height: 500.0),
SizedBox(height: 500.0, child: InkWell(onTap: () {}, child: const Placeholder())),
const SizedBox(height: 500.0),
const SizedBox(height: 500.0),
],
),
),
@ -721,7 +721,7 @@ void main() {
Material(
child: Directionality(
textDirection: TextDirection.ltr,
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkWell(
@ -730,7 +730,7 @@ void main() {
onLongPress: () {},
onHover: (bool value) { hovering = value; },
focusNode: focusNode,
child: Container(key: childKey),
child: SizedBox(key: childKey),
),
),
),
@ -749,13 +749,13 @@ void main() {
Material(
child: Directionality(
textDirection: TextDirection.ltr,
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkWell(
focusNode: focusNode,
onHover: (bool value) { hovering = value; },
child: Container(key: childKey),
child: SizedBox(key: childKey),
),
),
),
@ -790,7 +790,7 @@ void main() {
key: middleKey,
child: paddedInkWell(
key: innerKey,
child: Container(width: 50, height: 50),
child: const SizedBox(width: 50, height: 50),
),
),
),
@ -852,7 +852,7 @@ void main() {
textDirection: TextDirection.ltr,
child: Align(
alignment: Alignment.topLeft,
child: Container(
child: SizedBox(
width: 200,
height: 100,
child: Row(
@ -863,7 +863,7 @@ void main() {
key: innerKey,
),
),
Container(),
const SizedBox(),
],
),
),
@ -885,7 +885,7 @@ void main() {
textDirection: TextDirection.ltr,
child: Align(
alignment: Alignment.topLeft,
child: Container(
child: SizedBox(
width: 200,
height: 100,
child: Row(
@ -944,7 +944,7 @@ void main() {
key: middleKey,
child: paddedInkWell(
key: innerKey,
child: Container(width: 50, height: 50),
child: const SizedBox(width: 50, height: 50),
),
),
),
@ -974,19 +974,19 @@ void main() {
child: Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkWell(
key: parentKey,
onTap: () {},
child: Center(
child: Container(
child: SizedBox(
width: 100,
height: 50,
child: Row(
children: <Widget>[
Container(
SizedBox(
width: 50,
height: 50,
child: InkWell(
@ -994,7 +994,7 @@ void main() {
onTap: () {},
),
),
Container(
SizedBox(
width: 50,
height: 50,
child: InkWell(
@ -1071,19 +1071,19 @@ void main() {
textDirection: TextDirection.ltr,
child: Align(
alignment: Alignment.topLeft,
child: Container(
child: SizedBox(
width: leftWidth+rightWidth,
height: 100,
child: Row(
children: <Widget>[
Container(
SizedBox(
width: leftWidth,
height: 100,
child: InkWell(
key: leftKey,
onTap: () {},
child: Center(
child: Container(
child: SizedBox(
width: leftWidth,
height: 50,
child: leftChild,
@ -1091,14 +1091,14 @@ void main() {
),
),
),
Container(
SizedBox(
width: rightWidth,
height: 100,
child: InkWell(
key: rightKey,
onTap: () {},
child: Center(
child: Container(
child: SizedBox(
width: leftWidth,
height: 50,
child: rightChild,
@ -1176,13 +1176,13 @@ void main() {
child: GestureDetector(
onHorizontalDragStart: (_) {},
child: Center(
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: InkWell(
onTap: () {},
child: Center(
child: Container(
child: SizedBox(
width: 50,
height: 50,
child: InkWell(

View file

@ -1330,8 +1330,8 @@ void main() {
buildInputDecorator(
// isEmpty: false (default)
// isFocused: false (default)
decoration: InputDecoration(
prefix: Container(
decoration: const InputDecoration(
prefix: SizedBox(
key: pKey,
height: 100,
width: 10,
@ -1374,9 +1374,9 @@ void main() {
buildInputDecorator(
// isEmpty: false (default)
// isFocused: false (default)
decoration: InputDecoration(
border: const OutlineInputBorder(),
prefix: Container(
decoration: const InputDecoration(
border: OutlineInputBorder(),
prefix: SizedBox(
key: pKey,
height: 100,
width: 10,
@ -1905,8 +1905,8 @@ void main() {
buildInputDecorator(
// isEmpty: false (default)
// isFocused: false (default)
decoration: InputDecoration(
prefix: Container(
decoration: const InputDecoration(
prefix: SizedBox(
key: pKey,
height: 100,
width: 10,
@ -1934,8 +1934,8 @@ void main() {
buildInputDecorator(
// isEmpty: false (default)
// isFocused: false (default)
decoration: InputDecoration(
prefix: Container(
decoration: const InputDecoration(
prefix: SizedBox(
key: pKey,
height: 100,
width: 10,
@ -1963,8 +1963,8 @@ void main() {
buildInputDecorator(
// isEmpty: false (default)
// isFocused: false (default)
decoration: InputDecoration(
prefix: Container(
decoration: const InputDecoration(
prefix: SizedBox(
key: pKey,
height: 100,
width: 10,
@ -1995,9 +1995,9 @@ void main() {
// isEmpty: false (default)
// isFocused: false (default)
expands: true,
decoration: InputDecoration(
border: const OutlineInputBorder(),
prefix: Container(
decoration: const InputDecoration(
border: OutlineInputBorder(),
prefix: SizedBox(
key: pKey,
height: 100,
width: 10,
@ -2026,9 +2026,9 @@ void main() {
// isEmpty: false (default)
// isFocused: false (default)
expands: true,
decoration: InputDecoration(
border: const OutlineInputBorder(),
prefix: Container(
decoration: const InputDecoration(
border: OutlineInputBorder(),
prefix: SizedBox(
key: pKey,
height: 100,
width: 10,
@ -2059,9 +2059,9 @@ void main() {
// isEmpty: false (default)
// isFocused: false (default)
expands: true,
decoration: InputDecoration(
border: const OutlineInputBorder(),
prefix: Container(
decoration: const InputDecoration(
border: OutlineInputBorder(),
prefix: SizedBox(
key: pKey,
height: 100,
width: 10,
@ -2090,9 +2090,9 @@ void main() {
// isEmpty: false (default)
// isFocused: false (default)
expands: true,
decoration: InputDecoration(
border: const OutlineInputBorder(),
prefix: Container(
decoration: const InputDecoration(
border: OutlineInputBorder(),
prefix: SizedBox(
key: pKey,
height: 100,
width: 10,
@ -4109,7 +4109,7 @@ void main() {
await tester.pumpWidget(
Center(
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: buildInputDecorator(
@ -4132,7 +4132,7 @@ void main() {
await tester.pumpWidget(
Center(
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: buildInputDecorator(
@ -4260,7 +4260,7 @@ void main() {
Widget getLabeledInputDecorator(FloatingLabelBehavior floatingLabelBehavior) => MaterialApp(
home: Material(
child: Container(
child: SizedBox(
width: 300,
child: TextField(
decoration: InputDecoration(
@ -4361,7 +4361,7 @@ void main() {
await tester.pumpWidget(MaterialApp(
home: Material(
child: Center(
child: Container(
child: SizedBox(
width: 200,
height: 28,
child: TextField(

View file

@ -72,10 +72,10 @@ void main() {
child: Material(
child: Center(
child: ListTile(
leading: Container(key: leadingKey, width: 24.0, height: 24.0),
leading: SizedBox(key: leadingKey, width: 24.0, height: 24.0),
title: const Text('title'),
subtitle: hasSubtitle ? Text('subtitle', textScaleFactor: subtitleScaleFactor) : null,
trailing: Container(key: trailingKey, width: 24.0, height: 24.0),
trailing: SizedBox(key: trailingKey, width: 24.0, height: 24.0),
dense: dense,
isThreeLine: isThreeLine,
),

View file

@ -232,9 +232,9 @@ void main() {
},
child: null,
),
Material(
const Material(
type: MaterialType.transparency,
child: Container(
child: SizedBox(
width: 400.0,
height: 500.0,
),

View file

@ -59,10 +59,10 @@ void main() {
return ListView(
controller: controller,
shrinkWrap: true,
children: <Widget>[
Container(height: 100.0, child: const Text('One')),
Container(height: 100.0, child: const Text('Two')),
Container(height: 100.0, child: const Text('Three')),
children: const <Widget>[
SizedBox(height: 100.0, child: Text('One')),
SizedBox(height: 100.0, child: Text('Two')),
SizedBox(height: 100.0, child: Text('Three')),
],
);
},
@ -94,10 +94,10 @@ void main() {
return ListView(
shrinkWrap: true,
primary: false,
children: <Widget>[
Container(height: 100.0, child: const Text('One')),
Container(height: 100.0, child: const Text('Two')),
Container(height: 100.0, child: const Text('Three')),
children: const <Widget>[
SizedBox(height: 100.0, child: Text('One')),
SizedBox(height: 100.0, child: Text('Two')),
SizedBox(height: 100.0, child: Text('Three')),
],
);
});
@ -126,10 +126,10 @@ void main() {
return ListView(
shrinkWrap: true,
primary: false,
children: <Widget>[
Container(height: 100.0, child: const Text('One')),
Container(height: 100.0, child: const Text('Two')),
Container(height: 100.0, child: const Text('Three')),
children: const <Widget>[
SizedBox(height: 100.0, child: Text('One')),
SizedBox(height: 100.0, child: Text('Two')),
SizedBox(height: 100.0, child: Text('Three')),
],
);
});
@ -165,10 +165,10 @@ void main() {
return ListView(
shrinkWrap: true,
controller: controller,
children: <Widget>[
Container(height: 100.0, child: const Text('One')),
Container(height: 100.0, child: const Text('Two')),
Container(height: 100.0, child: const Text('Three')),
children: const <Widget>[
SizedBox(height: 100.0, child: Text('One')),
SizedBox(height: 100.0, child: Text('Two')),
SizedBox(height: 100.0, child: Text('Three')),
],
);
},
@ -319,18 +319,18 @@ void main() {
return ListView(
controller: controller,
shrinkWrap: true,
children: <Widget>[
Container(height: 100.0, child: const Text('One')),
Container(height: 100.0, child: const Text('Two')),
Container(height: 100.0, child: const Text('Three')),
Container(height: 100.0, child: const Text('Three')),
Container(height: 100.0, child: const Text('Three')),
Container(height: 100.0, child: const Text('Three')),
Container(height: 100.0, child: const Text('Three')),
Container(height: 100.0, child: const Text('Three')),
Container(height: 100.0, child: const Text('Three')),
Container(height: 100.0, child: const Text('Three')),
Container(height: 100.0, child: const Text('Three')),
children: const <Widget>[
SizedBox(height: 100.0, child: Text('One')),
SizedBox(height: 100.0, child: Text('Two')),
SizedBox(height: 100.0, child: Text('Three')),
SizedBox(height: 100.0, child: Text('Three')),
SizedBox(height: 100.0, child: Text('Three')),
SizedBox(height: 100.0, child: Text('Three')),
SizedBox(height: 100.0, child: Text('Three')),
SizedBox(height: 100.0, child: Text('Three')),
SizedBox(height: 100.0, child: Text('Three')),
SizedBox(height: 100.0, child: Text('Three')),
SizedBox(height: 100.0, child: Text('Three')),
],
);
},
@ -516,10 +516,10 @@ void main() {
return ListView(
shrinkWrap: true,
primary: false,
children: <Widget>[
Container(height: 100.0, child: const Text('One')),
Container(height: 100.0, child: const Text('Two')),
Container(height: 100.0, child: const Text('Three')),
children: const <Widget>[
SizedBox(height: 100.0, child: Text('One')),
SizedBox(height: 100.0, child: Text('Two')),
SizedBox(height: 100.0, child: Text('Three')),
],
);
}, backgroundColor: color, elevation: elevation, shape: shape, clipBehavior: clipBehavior);

View file

@ -241,7 +241,7 @@ void main() {
RawMaterialButton(
materialTapTargetSize: MaterialTapTargetSize.padded,
onPressed: () { },
child: Container(
child: SizedBox(
width: 400.0,
height: 400.0,
child: Column(

View file

@ -63,7 +63,7 @@ void main() {
onRefresh: refresh,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Container(
child: SizedBox(
width: 600.0,
child: ListView(
physics: const AlwaysScrollableScrollPhysics(),

View file

@ -1276,7 +1276,7 @@ void main() {
await tester.pumpWidget(MaterialApp(
home: ReorderableListView.builder(
itemBuilder: (BuildContext context, int index) {
return Container(
return SizedBox(
key: ValueKey<int>(items[index]),
height: 100,
child: ReorderableDragStartListener(
@ -1350,7 +1350,7 @@ class _StatefulState extends State<_Stateful> {
@override
Widget build(BuildContext context) {
return Container(
return SizedBox(
width: 48.0,
height: 48.0,
child: Material(

View file

@ -949,7 +949,7 @@ void main() {
),
),
],
drawer: Container(
drawer: SizedBox(
key: drawer,
width: 204.0,
child: SafeArea(
@ -1051,7 +1051,7 @@ void main() {
),
),
],
drawer: Container(
drawer: SizedBox(
key: drawer,
width: 204.0,
child: SafeArea(
@ -2108,7 +2108,7 @@ void main() {
scaffoldMessenger = ScaffoldMessenger.maybeOf(context);
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -2145,7 +2145,7 @@ void main() {
ScaffoldMessenger.of(context);
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),

View file

@ -67,15 +67,15 @@ void main() {
width: 300.0,
child: Scrollbar(
child: ListView(
children: <Widget>[
Container(height: 40.0, child: const Text('0')),
Container(height: 40.0, child: const Text('1')),
Container(height: 40.0, child: const Text('2')),
Container(height: 40.0, child: const Text('3')),
Container(height: 40.0, child: const Text('4')),
Container(height: 40.0, child: const Text('5')),
Container(height: 40.0, child: const Text('6')),
Container(height: 40.0, child: const Text('7')),
children: const <Widget>[
SizedBox(height: 40.0, child: Text('0')),
SizedBox(height: 40.0, child: Text('1')),
SizedBox(height: 40.0, child: Text('2')),
SizedBox(height: 40.0, child: Text('3')),
SizedBox(height: 40.0, child: Text('4')),
SizedBox(height: 40.0, child: Text('5')),
SizedBox(height: 40.0, child: Text('6')),
SizedBox(height: 40.0, child: Text('7')),
],
),
),
@ -101,13 +101,13 @@ void main() {
testWidgets('ScrollbarPainter does not divide by zero', (WidgetTester tester) async {
await tester.pumpWidget(
_buildBoilerplate(child: Container(
_buildBoilerplate(child: SizedBox(
height: 200.0,
width: 300.0,
child: Scrollbar(
child: ListView(
children: <Widget>[
Container(height: 40.0, child: const Text('0')),
children: const <Widget>[
SizedBox(height: 40.0, child: Text('0')),
],
),
),

View file

@ -24,7 +24,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -69,7 +69,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -115,7 +115,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -190,7 +190,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -267,7 +267,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -353,7 +353,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -437,7 +437,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -482,7 +482,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -1603,7 +1603,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -1751,7 +1751,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -1795,7 +1795,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),
@ -2344,7 +2344,7 @@ void main() {
));
},
behavior: HitTestBehavior.opaque,
child: Container(
child: const SizedBox(
height: 100.0,
width: 100.0,
),

View file

@ -529,13 +529,13 @@ void main() {
testWidgets('text field selection toolbar renders correctly inside opacity', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: Scaffold(
body: Center(
child: Container(
child: SizedBox(
width: 100,
height: 100,
child: const Opacity(
child: Opacity(
opacity: 0.5,
child: TextField(
decoration: InputDecoration(hintText: 'Placeholder'),
@ -2406,7 +2406,7 @@ void main() {
Widget? prefix,
}) {
return boilerplate(
child: Container(
child: SizedBox(
height: height,
child: TextField(
key: textFieldKey,
@ -3173,9 +3173,9 @@ void main() {
testWidgets('Can align to center', (WidgetTester tester) async {
await tester.pumpWidget(
overlay(
child: Container(
child: const SizedBox(
width: 300.0,
child: const TextField(
child: TextField(
textAlign: TextAlign.center,
decoration: null,
),
@ -3207,9 +3207,9 @@ void main() {
testWidgets('Can align to center within center', (WidgetTester tester) async {
await tester.pumpWidget(
overlay(
child: Container(
child: const SizedBox(
width: 300.0,
child: const Center(
child: Center(
child: TextField(
textAlign: TextAlign.center,
decoration: null,
@ -3528,7 +3528,7 @@ void main() {
await tester.pumpWidget(
overlay(
child: Container(
child: SizedBox(
width: 100.0,
child: TextField(
controller: controller,
@ -3609,7 +3609,7 @@ void main() {
await tester.pumpWidget(
overlay(
child: Container(
child: SizedBox(
width: 100.0,
child: TextField(
controller: controller,
@ -8177,9 +8177,9 @@ void main() {
testWidgets('Caret center position', (WidgetTester tester) async {
await tester.pumpWidget(
overlay(
child: Container(
child: const SizedBox(
width: 300.0,
child: const TextField(
child: TextField(
textAlign: TextAlign.center,
decoration: null,
),
@ -8217,9 +8217,9 @@ void main() {
testWidgets('Caret indexes into trailing whitespace center align', (WidgetTester tester) async {
await tester.pumpWidget(
overlay(
child: Container(
child: const SizedBox(
width: 300.0,
child: const TextField(
child: TextField(
textAlign: TextAlign.center,
decoration: null,
),
@ -8836,7 +8836,7 @@ void main() {
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
SizedBox(
width: 100.0,
child: TextField(
controller: controller1,
@ -8847,21 +8847,21 @@ void main() {
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
SizedBox(
width: 100.0,
child: TextField(
controller: controller2,
focusNode: focusNode2,
),
),
Container(
SizedBox(
width: 100.0,
child: TextField(
controller: controller3,
focusNode: focusNode3,
),
),
Container(
SizedBox(
width: 100.0,
child: TextField(
controller: controller4,
@ -8870,7 +8870,7 @@ void main() {
),
],
),
Container(
SizedBox(
width: 100.0,
child: TextField(
controller: controller5,
@ -9140,7 +9140,7 @@ void main() {
child: StatefulBuilder(
builder: (BuildContext context, StateSetter setter) {
setState = setter;
return Container(
return SizedBox(
width: isWide ? wideWidth : narrowWidth,
child: TextField(
key: textFieldKey,

View file

@ -52,6 +52,13 @@ class _CustomMaterialTextSelectionControls extends MaterialTextSelectionControls
}
}
class TestBox extends SizedBox {
const TestBox({Key? key}) : super(key: key, width: itemWidth, height: itemHeight);
static const double itemHeight = 44.0;
static const double itemWidth = 100.0;
}
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
@ -72,17 +79,7 @@ void main() {
testWidgets('puts children in an overflow menu if they overflow', (WidgetTester tester) async {
late StateSetter setState;
const double height = 44.0;
const double itemWidth = 100.0;
final List<Widget> children = <Widget>[
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
Container(width: itemWidth, height: height),
];
final List<Widget> children = List<Widget>.generate(7, (int i) => const TestBox());
await tester.pumpWidget(
MaterialApp(
@ -102,29 +99,29 @@ void main() {
);
// All children fit on the screen, so they are all rendered.
expect(find.byType(Container), findsNWidgets(children.length));
expect(find.byType(TestBox), findsNWidgets(children.length));
expect(_findOverflowButton(), findsNothing);
// Adding one more child makes the children overflow.
setState(() {
children.add(
Container(width: itemWidth, height: height),
const TestBox(),
);
});
await tester.pumpAndSettle();
expect(find.byType(Container), findsNWidgets(children.length - 1));
expect(find.byType(TestBox), findsNWidgets(children.length - 1));
expect(_findOverflowButton(), findsOneWidget);
// Tap the overflow button to show the overflow menu.
await tester.tap(_findOverflowButton());
await tester.pumpAndSettle();
expect(find.byType(Container), findsNWidgets(1));
expect(find.byType(TestBox), findsNWidgets(1));
expect(_findOverflowButton(), findsOneWidget);
// Tap the overflow button again to hide the overflow menu.
await tester.tap(_findOverflowButton());
await tester.pumpAndSettle();
expect(find.byType(Container), findsNWidgets(children.length - 1));
expect(find.byType(TestBox), findsNWidgets(children.length - 1));
expect(_findOverflowButton(), findsOneWidget);
});

View file

@ -460,7 +460,7 @@ Material _dayPeriodMaterial(WidgetTester tester) {
}
Container _dayPeriodDivider(WidgetTester tester) {
return tester.widget<Container>(find.descendant(of: find.byWidgetPredicate((Widget w) => '${w.runtimeType}' == '_DayPeriodControl'), matching: find.byType(Container)).at(1));
return tester.widget<Container>(find.descendant(of: find.byWidgetPredicate((Widget w) => '${w.runtimeType}' == '_DayPeriodControl'), matching: find.byType(Container)).at(0));
}
IconButton _entryModeIconButton(WidgetTester tester) {

View file

@ -51,13 +51,13 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
width: 300.0,
child: ListView(
controller: ScrollController(initialScrollOffset: 300.0),
children: children = List<Widget>.generate(20, (int i) {
return Container(
return SizedBox(
height: 100.0,
width: 300.0,
child: Text('Tile $i'),
@ -96,14 +96,14 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 300.0,
width: 200.0,
child: ListView(
scrollDirection: Axis.horizontal,
controller: ScrollController(initialScrollOffset: 300.0),
children: children = List<Widget>.generate(20, (int i) {
return Container(
return SizedBox(
height: 300.0,
width: 100.0,
child: Text('Tile $i'),
@ -142,14 +142,14 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
width: 300.0,
child: ListView(
controller: ScrollController(initialScrollOffset: 300.0),
reverse: true,
children: children = List<Widget>.generate(20, (int i) {
return Container(
return SizedBox(
height: 100.0,
width: 300.0,
child: Text('Tile $i'),
@ -188,7 +188,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 300.0,
width: 200.0,
child: ListView(
@ -196,7 +196,7 @@ void main() {
reverse: true,
controller: ScrollController(initialScrollOffset: 300.0),
children: children = List<Widget>.generate(20, (int i) {
return Container(
return SizedBox(
height: 300.0,
width: 100.0,
child: Text('Tile $i'),
@ -234,14 +234,14 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
width: 300.0,
child: CustomScrollView(
controller: ScrollController(initialScrollOffset: 300.0),
slivers: List<Widget>.generate(20, (int i) {
final Widget sliver = SliverToBoxAdapter(
child: Container(
child: SizedBox(
height: 100.0,
child: Text('Tile $i'),
),
@ -280,7 +280,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 300.0,
width: 200.0,
child: CustomScrollView(
@ -288,7 +288,7 @@ void main() {
controller: ScrollController(initialScrollOffset: 300.0),
slivers: List<Widget>.generate(20, (int i) {
final Widget sliver = SliverToBoxAdapter(
child: Container(
child: SizedBox(
width: 100.0,
child: Text('Tile $i'),
),
@ -327,7 +327,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
width: 300.0,
child: CustomScrollView(
@ -335,7 +335,7 @@ void main() {
reverse: true,
slivers: List<Widget>.generate(20, (int i) {
final Widget sliver = SliverToBoxAdapter(
child: Container(
child: SizedBox(
height: 100.0,
child: Text('Tile $i'),
),
@ -372,21 +372,21 @@ void main() {
testWidgets('Viewport getOffsetToReveal Sliver - up - reverse growth', (WidgetTester tester) async {
const Key centerKey = ValueKey<String>('center');
const EdgeInsets padding = EdgeInsets.only(top: 22.0, bottom: 23.0);
final Widget centerSliver = SliverPadding(
const Widget centerSliver = SliverPadding(
key: centerKey,
padding: padding,
sliver: SliverToBoxAdapter(
child: Container(
child: SizedBox(
height: 100.0,
child: const Text('Tile center'),
child: Text('Tile center'),
),
),
);
final Widget lowerItem = Container(
const Widget lowerItem = SizedBox(
height: 100.0,
child: const Text('Tile lower'),
child: Text('Tile lower'),
);
final Widget lowerSliver = SliverPadding(
const Widget lowerSliver = SliverPadding(
padding: padding,
sliver: SliverToBoxAdapter(
child: lowerItem,
@ -394,10 +394,10 @@ void main() {
);
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
width: 300.0,
child: CustomScrollView(
@ -429,21 +429,21 @@ void main() {
testWidgets('Viewport getOffsetToReveal Sliver - left - reverse growth', (WidgetTester tester) async {
const Key centerKey = ValueKey<String>('center');
const EdgeInsets padding = EdgeInsets.only(left: 22.0, right: 23.0);
final Widget centerSliver = SliverPadding(
const Widget centerSliver = SliverPadding(
key: centerKey,
padding: padding,
sliver: SliverToBoxAdapter(
child: Container(
child: SizedBox(
width: 100.0,
child: const Text('Tile center'),
child: Text('Tile center'),
),
),
);
final Widget lowerItem = Container(
const Widget lowerItem = SizedBox(
width: 100.0,
child: const Text('Tile lower'),
child: Text('Tile lower'),
);
final Widget lowerSliver = SliverPadding(
const Widget lowerSliver = SliverPadding(
padding: padding,
sliver: SliverToBoxAdapter(
child: lowerItem,
@ -451,10 +451,10 @@ void main() {
);
await tester.pumpWidget(
Directionality(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
width: 300.0,
child: CustomScrollView(
@ -490,7 +490,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 300.0,
width: 200.0,
child: CustomScrollView(
@ -499,7 +499,7 @@ void main() {
controller: ScrollController(initialScrollOffset: 300.0),
slivers: List<Widget>.generate(20, (int i) {
final Widget sliver = SliverToBoxAdapter(
child: Container(
child: SizedBox(
width: 100.0,
child: Text('Tile $i'),
),
@ -537,7 +537,7 @@ void main() {
final ScrollController controllerY = ScrollController(initialScrollOffset: 400.0);
final List<List<Widget>> children = List<List<Widget>>.generate(10, (int y) {
return List<Widget>.generate(10, (int x) {
return Container(
return SizedBox(
height: 100.0,
width: 100.0,
child: Text('$x,$y'),
@ -567,13 +567,13 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
width: 200.0,
child: ListView(
controller: controllerY,
children: List<Widget>.generate(10, (int y) {
return Container(
return SizedBox(
height: 100.0,
child: ListView(
scrollDirection: Axis.horizontal,
@ -694,7 +694,7 @@ void main() {
group('Nested viewports (same orientation) showOnScreen', () {
final List<Widget> children = List<Widget>.generate(10, (int i) {
return Container(
return SizedBox(
height: 100.0,
width: 300.0,
child: Text('$i'),
@ -706,16 +706,16 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
width: 300.0,
child: ListView(
controller: outer,
children: <Widget>[
Container(
const SizedBox(
height: 200.0,
),
Container(
SizedBox(
height: 200.0,
width: 300.0,
child: ListView(
@ -723,7 +723,7 @@ void main() {
children: children,
),
),
Container(
const SizedBox(
height: 200.0,
),
],
@ -896,16 +896,16 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
width: 200.0,
child: ListView(
controller: controllerY,
children: <Widget>[
Container(
const SizedBox(
height: 150.0,
),
Container(
SizedBox(
height: 100.0,
child: ListView(
physics: const PageScrollPhysics(), // Turns off `allowImplicitScrolling`
@ -921,7 +921,7 @@ void main() {
],
),
),
Container(
const SizedBox(
height: 150.0,
),
],
@ -946,16 +946,16 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
width: 200.0,
child: ListView(
controller: controllerY,
children: <Widget>[
Container(
const SizedBox(
height: 150.0,
),
Container(
SizedBox(
height: 100.0,
child: CustomScrollView(
physics: const PageScrollPhysics(), // Turns off `allowImplicitScrolling`
@ -981,7 +981,7 @@ void main() {
],
),
),
Container(
const SizedBox(
height: 150.0,
),
],
@ -1005,12 +1005,12 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
child: ListView(
controller: controller = ScrollController(initialScrollOffset: 300.0),
children: children = List<Widget>.generate(20, (int i) {
return Container(
return SizedBox(
height: 300.0,
child: Text('Tile $i'),
);
@ -1068,7 +1068,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 600.0,
child: CustomScrollView(
controller: controller = ScrollController(initialScrollOffset: 300.0),
@ -1084,7 +1084,7 @@ void main() {
),
)
: SliverToBoxAdapter(
child: Container(
child: SizedBox(
height: 300.0,
child: Text('Tile $i'),
),
@ -1134,7 +1134,7 @@ void main() {
return Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 400.0,
width: 400.0,
child: CustomScrollView(
@ -1146,7 +1146,7 @@ void main() {
? floatingHeader
: SliverToBoxAdapter(
key: (i == 19) ? const Key('19') : null,
child: Container(
child: SizedBox(
height: 300.0,
width: 300,
child: Text('Tile $i'),
@ -1437,7 +1437,7 @@ void main() {
return Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 400.0,
width: 400.0,
child: CustomScrollView(
@ -1545,14 +1545,14 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 300.0,
child: CustomScrollView(
cacheExtent: 0,
controller: outerController,
slivers: <Widget>[
SliverToBoxAdapter(
child: Container(
child: SizedBox(
height: 300,
child: CustomScrollView(
controller: innerController,
@ -1580,7 +1580,7 @@ void main() {
),
);
tester.renderObject(find.widgetWithText(SizedBox, 'Tile 1', skipOffstage: false)).showOnScreen();
tester.renderObject(find.widgetWithText(SizedBox, 'Tile 1', skipOffstage: false).first).showOnScreen();
await tester.pumpAndSettle();
// The inner viewport scrolls to reveal the 2nd tile.
expect(innerController.offset, 300.0);

View file

@ -425,7 +425,7 @@ void main() {
},
onShowHoverHighlight: (bool value) => hovering = value,
onShowFocusHighlight: (bool value) => focusing = value,
child: Container(width: 100, height: 100, key: containerKey),
child: SizedBox(width: 100, height: 100, key: containerKey),
),
),
),
@ -800,7 +800,7 @@ void main() {
},
onShowHoverHighlight: supplyCallbacks ? (bool value) => hovering = value : null,
onShowFocusHighlight: supplyCallbacks ? (bool value) => focusing = value : null,
child: Container(width: 100, height: 100, key: key),
child: SizedBox(width: 100, height: 100, key: key),
),
),
),

View file

@ -114,10 +114,10 @@ void main() {
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
children: const <Widget>[
Align(
widthFactor: 0.5,
child: Container(
child: SizedBox(
height: 100.0,
width: 100.0,
),
@ -137,11 +137,11 @@ void main() {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
children: const <Widget>[
Align(
alignment: Alignment.center,
heightFactor: 0.5,
child: Container(
child: SizedBox(
height: 100.0,
width: 100.0,
),

View file

@ -63,13 +63,13 @@ void main() {
textDirection: TextDirection.ltr,
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
children: const <Widget>[
AnimatedAlign(
alignment: Alignment.center,
curve: Curves.ease,
widthFactor: 0.5,
duration: const Duration(milliseconds: 200),
child: Container(
duration: Duration(milliseconds: 200),
child: SizedBox(
height: 100.0,
width: 100.0,
),
@ -87,13 +87,13 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Column(
children: <Widget>[
children: const <Widget>[
AnimatedAlign(
alignment: Alignment.center,
curve: Curves.ease,
heightFactor: 0.5,
duration: const Duration(milliseconds: 200),
child: Container(
duration: Duration(milliseconds: 200),
child: SizedBox(
height: 100.0,
width: 100.0,
),
@ -112,12 +112,12 @@ void main() {
textDirection: TextDirection.ltr,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
children: const <Widget>[
AnimatedAlign(
alignment: Alignment.center,
curve: Curves.ease,
duration: const Duration(milliseconds: 200),
child: Container(
duration: Duration(milliseconds: 200),
child: SizedBox(
height: 100.0,
width: 100.0,
),
@ -126,7 +126,7 @@ void main() {
),
),
);
final RenderBox box = tester.renderObject<RenderBox>(find.byType(Container));
final RenderBox box = tester.renderObject<RenderBox>(find.byType(SizedBox));
expect(box.size, equals(const Size(100.0, 100)));
});
@ -138,12 +138,12 @@ void main() {
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
children: const <Widget>[
AnimatedAlign(
alignment: Alignment.center,
curve: Curves.ease,
duration: const Duration(milliseconds: 200),
child: Container(
duration: Duration(milliseconds: 200),
child: SizedBox(
height: 100.0,
width: 100.0,
),
@ -153,7 +153,7 @@ void main() {
),
),
);
final RenderBox box = tester.renderObject<RenderBox>(find.byType(Container));
final RenderBox box = tester.renderObject<RenderBox>(find.byType(SizedBox).last);
expect(box.size, equals(const Size(100.0, 100)));
});
}

View file

@ -123,7 +123,7 @@ void tests({ required bool impliedMode }) {
addSemanticIndexes: false,
cacheExtent: 0.0,
children: generateList(
Container(height: 12.3, child: const Placeholder()), // about 50 widgets visible
const SizedBox(height: 12.3, child: Placeholder()), // about 50 widgets visible
impliedMode: impliedMode,
),
),
@ -231,7 +231,7 @@ void main() {
cacheExtent: 0.0,
children: <Widget>[
AutomaticKeepAlive(
child: Container(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(0), child: Placeholder()),
@ -239,15 +239,15 @@ void main() {
]),
),
),
AutomaticKeepAlive(
child: Container(
key: const GlobalObjectKey<_LeafState>(2),
const AutomaticKeepAlive(
child: SizedBox(
key: GlobalObjectKey<_LeafState>(2),
height: 400.0,
),
),
AutomaticKeepAlive(
child: Container(
key: const GlobalObjectKey<_LeafState>(3),
const AutomaticKeepAlive(
child: SizedBox(
key: GlobalObjectKey<_LeafState>(3),
height: 400.0,
),
),
@ -315,7 +315,7 @@ void main() {
cacheExtent: 0.0,
children: <Widget>[
AutomaticKeepAlive(
child: Container(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(0), child: Placeholder()),
@ -324,7 +324,7 @@ void main() {
),
),
AutomaticKeepAlive(
child: Container(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(2), child: Placeholder()),
@ -333,7 +333,7 @@ void main() {
),
),
AutomaticKeepAlive(
child: Container(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(4), child: Placeholder()),
@ -371,7 +371,7 @@ void main() {
cacheExtent: 0.0,
children: <Widget>[
AutomaticKeepAlive(
child: Container(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(1), child: Placeholder()),
@ -379,7 +379,7 @@ void main() {
),
),
AutomaticKeepAlive(
child: Container(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(2), child: Placeholder()),
@ -388,7 +388,7 @@ void main() {
),
),
AutomaticKeepAlive(
child: Container(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(4), child: Placeholder()),
@ -435,7 +435,7 @@ void main() {
cacheExtent: 0.0,
children: <Widget>[
AutomaticKeepAlive(
child: Container(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(1), child: Placeholder()),
@ -444,14 +444,14 @@ void main() {
),
),
AutomaticKeepAlive(
child: Container(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
]),
),
),
AutomaticKeepAlive(
child: Container(
child: SizedBox(
height: 400.0,
child: Stack(children: const <Widget>[
Leaf(key: GlobalObjectKey<_LeafState>(3), child: Placeholder()),
@ -486,7 +486,7 @@ void main() {
key: GlobalObjectKey<_AlwaysKeepAliveState>(0),
);
}
return Container(
return SizedBox(
height: 44.0,
child: Text('FooBar $index'),
);
@ -520,7 +520,7 @@ void main() {
key: GlobalObjectKey<_AlwaysKeepAliveState>(index),
);
}
return Container(
return SizedBox(
height: 44.0,
child: Text('FooBar $index'),
);
@ -573,9 +573,9 @@ class _AlwaysKeepAliveState extends State<_AlwaysKeepAlive> with AutomaticKeepAl
@override
Widget build(BuildContext context) {
super.build(context);
return Container(
return const SizedBox(
height: 48.0,
child: const Text('keep me alive'),
child: Text('keep me alive'),
);
}
}
@ -591,9 +591,9 @@ class AlwaysKeepAliveRenderBoxState extends State<_AlwaysKeepAlive> with Automat
@override
Widget build(BuildContext context) {
super.build(context);
return Container(
return const SizedBox(
height: 48.0,
child: const Text('keep me alive'),
child: Text('keep me alive'),
);
}
}

View file

@ -21,10 +21,10 @@ void main() {
await tester.pumpWidget(Center(
child: Column(
key: columnKey,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Expanded(child: Container(key: child1Key, width: 100.0, height: 100.0)),
Container(key: child2Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
Expanded(child: SizedBox(key: child1Key, width: 100.0, height: 100.0)),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
],
),
));
@ -67,10 +67,10 @@ void main() {
await tester.pumpWidget(Center(
child: Column(
key: columnKey,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
Container(key: child2Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
],
),
));
@ -112,9 +112,9 @@ void main() {
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
],
),
));
@ -151,10 +151,10 @@ void main() {
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
Container(key: child2Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
],
),
));
@ -197,10 +197,10 @@ void main() {
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
Container(key: child2Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
],
),
));
@ -244,11 +244,11 @@ void main() {
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
Container(key: child2Key, width: 100.0, height: 100.0),
Container(key: child3Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
SizedBox(key: child3Key, width: 100.0, height: 100.0),
],
),
));
@ -297,10 +297,10 @@ void main() {
child: Column(
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 20.0),
Container(key: child1Key, width: 100.0, height: 20.0),
Container(key: child2Key, width: 100.0, height: 20.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 20.0),
SizedBox(key: child1Key, width: 100.0, height: 20.0),
SizedBox(key: child2Key, width: 100.0, height: 20.0),
],
),
));
@ -368,13 +368,13 @@ void main() {
const Key childKey = Key('childKey');
await tester.pumpWidget(Center(
child: Container(
child: SizedBox(
width: 0.0,
height: 0.0,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
key: childKey,
width: 100.0,
height: 100.0,
@ -405,10 +405,10 @@ void main() {
child: Column(
key: columnKey,
verticalDirection: VerticalDirection.up,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Expanded(child: Container(key: child1Key, width: 100.0, height: 100.0)),
Container(key: child2Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
Expanded(child: SizedBox(key: child1Key, width: 100.0, height: 100.0)),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
],
),
));
@ -452,10 +452,10 @@ void main() {
child: Column(
key: columnKey,
verticalDirection: VerticalDirection.up,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
Container(key: child2Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
],
),
));
@ -498,9 +498,9 @@ void main() {
key: columnKey,
mainAxisAlignment: MainAxisAlignment.center,
verticalDirection: VerticalDirection.up,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
],
),
));
@ -538,10 +538,10 @@ void main() {
key: columnKey,
mainAxisAlignment: MainAxisAlignment.end,
verticalDirection: VerticalDirection.up,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
Container(key: child2Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
],
),
));
@ -585,10 +585,10 @@ void main() {
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
verticalDirection: VerticalDirection.up,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
Container(key: child2Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
],
),
));
@ -633,11 +633,11 @@ void main() {
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceAround,
verticalDirection: VerticalDirection.up,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0),
Container(key: child1Key, width: 100.0, height: 100.0),
Container(key: child2Key, width: 100.0, height: 100.0),
Container(key: child3Key, width: 100.0, height: 100.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 100.0),
SizedBox(key: child1Key, width: 100.0, height: 100.0),
SizedBox(key: child2Key, width: 100.0, height: 100.0),
SizedBox(key: child3Key, width: 100.0, height: 100.0),
],
),
));
@ -687,10 +687,10 @@ void main() {
key: columnKey,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
verticalDirection: VerticalDirection.up,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 20.0),
Container(key: child1Key, width: 100.0, height: 20.0),
Container(key: child2Key, width: 100.0, height: 20.0),
children: const <Widget>[
SizedBox(key: child0Key, width: 100.0, height: 20.0),
SizedBox(key: child1Key, width: 100.0, height: 20.0),
SizedBox(key: child2Key, width: 100.0, height: 20.0),
],
),
));
@ -760,14 +760,14 @@ void main() {
const Key childKey = Key('childKey');
await tester.pumpWidget(Center(
child: Container(
child: SizedBox(
width: 0.0,
height: 0.0,
child: Column(
mainAxisSize: MainAxisSize.min,
verticalDirection: VerticalDirection.up,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
key: childKey,
width: 100.0,
height: 100.0,

View file

@ -35,7 +35,7 @@ void main() {
link: linkToUse ?? link,
targetAnchor: Alignment.center,
followerAnchor: Alignment.center,
child: Container(key: key, height: 20.0, width: 20.0),
child: SizedBox(key: key, height: 20.0, width: 20.0),
),
),
],
@ -76,7 +76,7 @@ void main() {
link: link,
targetAnchor: targetAlignment,
followerAnchor: followerAlignment,
child: Container(key: key, height: 20.0, width: 20.0),
child: SizedBox(key: key, height: 20.0, width: 20.0),
),
),
],
@ -119,7 +119,7 @@ void main() {
angle: 1.0, // radians
child: CompositedTransformTarget(
link: link,
child: Container(key: key1, width: 80.0, height: 10.0),
child: SizedBox(key: key1, width: 80.0, height: 10.0),
),
),
),
@ -132,7 +132,7 @@ void main() {
link: link,
targetAnchor: targetAlignment,
followerAnchor: followerAlignment,
child: Container(key: key2, width: 40.0, height: 20.0),
child: SizedBox(key: key2, width: 40.0, height: 20.0),
),
),
),
@ -184,7 +184,7 @@ void main() {
angle: 1.0, // radians
child: CompositedTransformTarget(
link: link,
child: Container(key: key1, width: 80.0, height: 10.0),
child: SizedBox(key: key1, width: 80.0, height: 10.0),
),
),
),
@ -205,7 +205,7 @@ void main() {
link: link,
targetAnchor: targetAlignment,
followerAnchor: followerAlignment,
child: Container(key: key2, width: 40.0, height: 20.0),
child: SizedBox(key: key2, width: 40.0, height: 20.0),
),
),
),
@ -262,7 +262,7 @@ void main() {
top: 456.0,
child: CompositedTransformTarget(
link: link,
child: Container(key: key1, height: 10.0, width: 10.0),
child: SizedBox(key: key1, height: 10.0, width: 10.0),
),
),
CompositedTransformFollower(
@ -271,7 +271,7 @@ void main() {
key: key2,
behavior: HitTestBehavior.opaque,
onTap: () { tapped = true; },
child: Container(key: key3, height: 2.0, width: 2.0),
child: SizedBox(key: key3, height: 2.0, width: 2.0),
),
),
],

View file

@ -46,7 +46,7 @@ Widget buildTest({
? <DismissDirection, double>{}
: <DismissDirection, double>{DismissDirection.startToEnd: startToEndThreshold},
crossAxisEndOffset: crossAxisEndOffset,
child: Container(
child: SizedBox(
width: itemExtent,
height: itemExtent,
child: Text(item.toString()),
@ -574,7 +574,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 1000.0,
child: Column(
@ -755,7 +755,7 @@ void main() {
background: background,
dismissThresholds: const <DismissDirection, double>{},
crossAxisEndOffset: crossAxisEndOffset,
child: Container(
child: SizedBox(
width: itemExtent,
height: itemExtent,
child: Text(1.toString()),

View file

@ -30,7 +30,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onMove: (_) => moveCount++,
onAccept: accepted.add,
@ -103,7 +103,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target 1'));
return const SizedBox(height: 100.0, child: Text('Target 1'));
},
onLeave: (int? data) {
if (data != null) {
@ -113,7 +113,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target 2'));
return const SizedBox(height: 100.0, child: Text('Target 2'));
},
onLeave: (int? data) {
if (data != null) {
@ -178,7 +178,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target 1'));
return const SizedBox(height: 100.0, child: Text('Target 1'));
},
onLeave: (Object? data) {
if (data is int) {
@ -188,7 +188,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target 2'));
return const SizedBox(height: 100.0, child: Text('Target 2'));
},
onLeave: (Object? data) {
if (data is int) {
@ -255,7 +255,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target 1'));
return const SizedBox(height: 100.0, child: Text('Target 1'));
},
onMove: (DragTargetDetails<int> details) {
targetMoveCount['Target 1'] =
@ -264,7 +264,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target 2'));
return const SizedBox(height: 100.0, child: Text('Target 2'));
},
onMove: (DragTargetDetails<int> details) {
targetMoveCount['Target 2'] =
@ -328,7 +328,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target 1'));
return const SizedBox(height: 100.0, child: Text('Target 1'));
},
onMove: (DragTargetDetails<dynamic> details) {
if (details.data is int) {
@ -339,7 +339,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target 2'));
return const SizedBox(height: 100.0, child: Text('Target 2'));
},
onMove: (DragTargetDetails<dynamic> details) {
if (details.data is int) {
@ -1163,7 +1163,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
onAcceptWithDetails: acceptedDetails.add,
@ -1235,9 +1235,9 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(
return const SizedBox(
height: 100.0,
child: const Text('Target'),
child: Text('Target'),
);
},
onWillAccept: (int? data) => false,
@ -1311,10 +1311,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(
height: 100.0,
child: const Text('Target'),
);
return const SizedBox(height: 100.0, child: Text('Target'));
},
onWillAccept: (int? data) => false,
onAccept: accepted.add,
@ -1364,10 +1361,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(
height: 100.0,
child: const Text('Target'),
);
return const SizedBox(height: 100.0, child: Text('Target'));
},
onWillAccept: (int? data) => false,
onAccept: accepted.add,
@ -1434,7 +1428,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(
return SizedBox(
height: 100.0,
child: rejects.isNotEmpty
? const Text('Rejected')
@ -1492,7 +1486,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(
return SizedBox(
height: 100.0,
child: rejects.isNotEmpty
? const Text('Rejected')
@ -1577,9 +1571,9 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(
return const SizedBox(
height: 100.0,
child: const Text('Target'),
child: Text('Target'),
);
},
onWillAccept: (int? data) => false,
@ -1649,7 +1643,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
onAcceptWithDetails: acceptedDetails.add,
@ -1790,7 +1784,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
onAcceptWithDetails: acceptedDetails.add,
@ -1863,10 +1857,10 @@ void main() {
children: <Widget>[
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return IgnorePointer(
child: Container(
return const IgnorePointer(
child: SizedBox(
height: 100.0,
child: const Text('Target1'),
child: Text('Target1'),
),
);
},
@ -1875,10 +1869,10 @@ void main() {
),
DragTarget<double>(
builder: (BuildContext context, List<double?> data, List<dynamic> rejects) {
return IgnorePointer(
child: Container(
return const IgnorePointer(
child: SizedBox(
height: 100.0,
child: const Text('Target2'),
child: Text('Target2'),
),
);
},
@ -1992,10 +1986,10 @@ void main() {
children: <Widget>[
DragTarget<DragTargetData>(
builder: (BuildContext context, List<DragTargetData?> data, List<dynamic> rejects) {
return IgnorePointer(
child: Container(
return const IgnorePointer(
child: SizedBox(
height: 100.0,
child: const Text('Target1'),
child: Text('Target1'),
),
);
}, onAccept: acceptedDragTargetDatas.add,
@ -2003,10 +1997,10 @@ void main() {
),
DragTarget<ExtendedDragTargetData>(
builder: (BuildContext context, List<ExtendedDragTargetData?> data, List<dynamic> rejects) {
return IgnorePointer(
child: Container(
return const IgnorePointer(
child: SizedBox(
height: 100.0,
child: const Text('Target2'),
child: Text('Target2'),
),
);
},
@ -2058,7 +2052,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
onAcceptWithDetails: acceptedDetails.add,
@ -2317,7 +2311,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
onAcceptWithDetails: acceptedDetails.add,
@ -2347,7 +2341,7 @@ void main() {
children: <Widget>[
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
onAcceptWithDetails: acceptedDetails.add,
@ -2427,7 +2421,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
onAcceptWithDetails: acceptedDetails.add,
@ -2512,7 +2506,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
onAcceptWithDetails: acceptedDetails.add,
@ -2696,7 +2690,7 @@ void main() {
navigatorKey: rootNavigatorKey,
home: Column(
children: <Widget>[
Container(
SizedBox(
height: 200.0,
child: Navigator(
key: childNavigatorKey,
@ -2718,8 +2712,8 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(
height: 300.0, child: const Center(child: Text('Target 1')),
return const SizedBox(
height: 300.0, child: Center(child: Text('Target 1')),
);
},
),
@ -2765,7 +2759,7 @@ void main() {
),
DragTarget<Object>(
builder: (BuildContext context, List<Object?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
),
@ -2801,7 +2795,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
),
@ -2837,7 +2831,7 @@ void main() {
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
onWillAccept: (int? data) {
@ -3033,11 +3027,11 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: Column(
children: <Widget>[
children: const <Widget>[
Draggable<int>(
hitTestBehavior: hitTestBehavior,
feedback: Container(height: 50.0, child: const Text('Draggable')),
child: Container(height: 50.0, child: const Text('Target')),
feedback: SizedBox(height: 50.0, child: Text('Draggable')),
child: SizedBox(height: 50.0, child: Text('Target')),
),
],
),
@ -3058,7 +3052,7 @@ void main() {
hitTestBehavior: hitTestBehavior,
builder: (BuildContext context, List<int?> data,
List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
),
],
@ -3139,7 +3133,7 @@ Future<void> _testChildAnchorFeedbackPosition({ required WidgetTester tester, do
),
DragTarget<int>(
builder: (BuildContext context, List<int?> data, List<dynamic> rejects) {
return Container(height: 100.0, child: const Text('Target'));
return const SizedBox(height: 100.0, child: Text('Target'));
},
onAccept: accepted.add,
onAcceptWithDetails: acceptedDetails.add,

View file

@ -49,7 +49,7 @@ void main() {
await tester.pumpWidget(MaterialApp(
home: Center(
child: Container(
child: SizedBox(
height: 300.0,
child: ListView(
controller: scrollController,
@ -61,7 +61,7 @@ void main() {
style: textStyle,
cursorColor: cursorColor,
),
Container(
const SizedBox(
height: 350.0,
),
],
@ -88,12 +88,12 @@ void main() {
await tester.pumpWidget(MaterialApp(
home: Center(
child: Container(
child: SizedBox(
height: 300.0,
child: ListView(
controller: scrollController,
children: <Widget>[
Container(
const SizedBox(
height: 200.0,
),
EditableText(
@ -104,7 +104,7 @@ void main() {
style: textStyle,
cursorColor: cursorColor,
),
Container(
const SizedBox(
height: 850.0,
),
],
@ -134,12 +134,12 @@ void main() {
await tester.pumpWidget(MaterialApp(
home: Center(
child: Container(
child: SizedBox(
height: 300.0,
child: ListView(
controller: scrollController,
children: <Widget>[
Container(
const SizedBox(
height: 350.0,
),
EditableText(
@ -149,7 +149,7 @@ void main() {
style: textStyle,
cursorColor: cursorColor,
),
Container(
const SizedBox(
height: 350.0,
),
],
@ -183,13 +183,13 @@ void main() {
await tester.pumpWidget(MaterialApp(
home: Center(
child: Container(
child: SizedBox(
height: 300.0,
child: ListView(
physics: const NoImplicitScrollPhysics(),
controller: scrollController,
children: <Widget>[
Container(
const SizedBox(
height: 350.0,
),
EditableText(
@ -199,7 +199,7 @@ void main() {
style: textStyle,
cursorColor: cursorColor,
),
Container(
const SizedBox(
height: 350.0,
),
],
@ -281,7 +281,7 @@ void main() {
await tester.pumpWidget(MaterialApp(
home: Center(
child: Container(
child: SizedBox(
height: 300.0,
child: ListView(
controller: scrollController,
@ -333,12 +333,12 @@ void main() {
await tester.pumpWidget(MaterialApp(
home: Align(
alignment: Alignment.bottomCenter,
child: Container(
child: SizedBox(
height: 300.0,
child: ListView(
controller: scrollController,
children: <Widget>[
Container(
const SizedBox(
key: container,
height: 200.0,
),
@ -350,7 +350,7 @@ void main() {
style: textStyle,
cursorColor: cursorColor,
),
Container(
const SizedBox(
height: 400.0,
),
],
@ -406,7 +406,7 @@ void main() {
),
)
: SliverToBoxAdapter(
child: Container(
child: SizedBox(
height: 100.0,
child: Text('Tile $i'),
),
@ -469,7 +469,7 @@ void main() {
),
)
: SliverToBoxAdapter(
child: Container(
child: SizedBox(
height: 100.0,
child: Text('Tile $i'),
),

View file

@ -22,14 +22,14 @@ Widget buildSingleChildScrollView(Axis scrollDirection, { bool reverse = false }
reverse: reverse,
child: ListBody(
mainAxis: scrollDirection,
children: <Widget>[
Container(key: const ValueKey<int>(0), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(1), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(2), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(3), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(4), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(5), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(6), width: 200.0, height: 200.0),
children: const <Widget>[
SizedBox(key: ValueKey<int>(0), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(1), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(2), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(3), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(4), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(5), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(6), width: 200.0, height: 200.0),
],
),
),
@ -50,14 +50,14 @@ Widget buildListView(Axis scrollDirection, { bool reverse = false, bool shrinkWr
reverse: reverse,
addSemanticIndexes: false,
shrinkWrap: shrinkWrap,
children: <Widget>[
Container(key: const ValueKey<int>(0), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(1), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(2), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(3), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(4), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(5), width: 200.0, height: 200.0),
Container(key: const ValueKey<int>(6), width: 200.0, height: 200.0),
children: const <Widget>[
SizedBox(key: ValueKey<int>(0), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(1), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(2), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(3), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(4), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(5), width: 200.0, height: 200.0),
SizedBox(key: ValueKey<int>(6), width: 200.0, height: 200.0),
],
),
),
@ -187,10 +187,10 @@ void main() {
child: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Container(height: 200.0),
Container(height: 200.0),
Container(height: 200.0),
Container(
const SizedBox(height: 200.0),
const SizedBox(height: 200.0),
const SizedBox(height: 200.0),
SizedBox(
height: 200.0,
child: Center(
child: Transform(
@ -204,9 +204,9 @@ void main() {
),
),
),
Container(height: 200.0),
Container(height: 200.0),
Container(height: 200.0),
const SizedBox(height: 200.0),
const SizedBox(height: 200.0),
const SizedBox(height: 200.0),
],
),
),
@ -230,9 +230,9 @@ void main() {
final List<Row> rows = List<Row>.generate(
7,
(int y) => Row(
children: List<Container>.generate(
children: List<SizedBox>.generate(
7,
(int x) => Container(key: ValueKey<String>('$x, $y'), width: 200.0, height: 200.0,),
(int x) => SizedBox(key: ValueKey<String>('$x, $y'), width: 200.0, height: 200.0,),
),
),
);
@ -519,10 +519,10 @@ void main() {
height: 400.0,
child: ListView(
children: <Widget>[
Container(height: 200.0),
Container(height: 200.0),
Container(height: 200.0),
Container(
const SizedBox(height: 200.0),
const SizedBox(height: 200.0),
const SizedBox(height: 200.0),
SizedBox(
height: 200.0,
child: Center(
child: Transform(
@ -536,9 +536,9 @@ void main() {
),
),
),
Container(height: 200.0),
Container(height: 200.0),
Container(height: 200.0),
const SizedBox(height: 200.0),
const SizedBox(height: 200.0),
const SizedBox(height: 200.0),
],
),
),
@ -722,20 +722,20 @@ void main() {
return Viewport(
offset: offset,
center: const ValueKey<String>('center'),
slivers: <Widget>[
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(-6), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(-5), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(-4), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(-3), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(-2), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(-1), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(0), width: 200.0, height: 200.0), key: const ValueKey<String>('center')),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(1), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(2), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(3), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(4), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(5), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: Container(key: const ValueKey<int>(6), width: 200.0, height: 200.0)),
slivers: const <Widget>[
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(-6), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(-5), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(-4), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(-3), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(-2), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(-1), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(0), width: 200.0, height: 200.0), key: ValueKey<String>('center')),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(1), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(2), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(3), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(4), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(5), width: 200.0, height: 200.0)),
SliverToBoxAdapter(child: SizedBox(key: ValueKey<int>(6), width: 200.0, height: 200.0)),
],
);
},

View file

@ -13,11 +13,11 @@ void main() {
await tester.pumpWidget(
Center(
child: Container(
child: SizedBox(
width: 200.0,
child: FittedBox(
key: outside,
child: Container(
child: SizedBox(
key: inside,
width: 100.0,
height: 50.0,
@ -48,12 +48,12 @@ void main() {
await tester.pumpWidget(
Center(
child: Container(
child: SizedBox(
width: 200.0,
height: 200.0,
child: FittedBox(
key: outside,
child: Container(
child: SizedBox(
key: inside,
width: 100.0,
height: 50.0,
@ -83,13 +83,13 @@ void main() {
await tester.pumpWidget(
Center(
child: Container(
child: SizedBox(
width: 200.0,
height: 200.0,
child: FittedBox(
key: outside,
fit: BoxFit.cover,
child: Container(
child: SizedBox(
key: inside,
width: 100.0,
height: 50.0,
@ -139,14 +139,14 @@ void main() {
Directionality(
textDirection: TextDirection.rtl,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 100.0,
child: FittedBox(
key: outside,
fit: BoxFit.scaleDown,
alignment: AlignmentDirectional.bottomEnd,
child: Container(
child: SizedBox(
key: inside,
width: 10.0,
height: 10.0,
@ -180,14 +180,14 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 100.0,
child: FittedBox(
key: outside,
fit: BoxFit.scaleDown,
alignment: AlignmentDirectional.bottomEnd,
child: Container(
child: SizedBox(
key: inside,
width: 10.0,
height: 10.0,
@ -221,14 +221,14 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 100.0,
child: FittedBox(
key: outside,
fit: BoxFit.scaleDown,
alignment: AlignmentDirectional.center,
child: Container(
child: SizedBox(
key: inside,
width: 10.0,
height: 10.0,
@ -262,14 +262,14 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 100.0,
child: FittedBox(
key: outside,
fit: BoxFit.scaleDown,
alignment: AlignmentDirectional.center,
child: Container(
child: SizedBox(
key: inside,
width: 30.0,
height: 10.0,
@ -303,14 +303,14 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 100.0,
child: FittedBox(
key: outside,
fit: BoxFit.fill,
alignment: AlignmentDirectional.center,
child: Container(
child: SizedBox(
key: inside,
width: 30.0,
height: 10.0,
@ -493,12 +493,12 @@ void main() {
await tester.pumpWidget(
Center(
child: Container(
child: SizedBox(
width: 200.0,
child: FittedBox(
key: outside,
fit: BoxFit.scaleDown,
child: Container(
child: SizedBox(
key: inside,
width: 100.0,
height: 50.0,
@ -522,12 +522,12 @@ void main() {
await tester.pumpWidget(
Center(
child: Container(
child: SizedBox(
width: 200.0,
child: FittedBox(
key: outside,
fit: BoxFit.scaleDown,
child: Container(
child: SizedBox(
key: inside,
width: 400.0,
height: 200.0,
@ -550,12 +550,12 @@ void main() {
final Key outside = UniqueKey();
final Widget scaleDownWidget = Center(
child: Container(
child: SizedBox(
width: 200.0,
child: FittedBox(
key: outside,
fit: BoxFit.scaleDown,
child: Container(
child: const SizedBox(
width: 100.0,
height: 50.0,
),
@ -564,11 +564,11 @@ void main() {
);
final Widget coverWidget = Center(
child: Container(
child: SizedBox(
width: 200.0,
child: FittedBox(
key: outside,
child: Container(
child: const SizedBox(
width: 100.0,
height: 50.0,
),

View file

@ -65,16 +65,16 @@ void main() {
// both of these cases have failed in the past due to floating point issues
await tester.pumpWidget(
Center(
child: Container(
child: SizedBox(
height: 400.0,
child: Column(
children: <Widget>[
Expanded(child: Container()),
Expanded(child: Container()),
Expanded(child: Container()),
Expanded(child: Container()),
Expanded(child: Container()),
Expanded(child: Container()),
children: const <Widget>[
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
],
),
),
@ -82,16 +82,16 @@ void main() {
);
await tester.pumpWidget(
Center(
child: Container(
child: SizedBox(
height: 199.0,
child: Column(
children: <Widget>[
Expanded(child: Container()),
Expanded(child: Container()),
Expanded(child: Container()),
Expanded(child: Container()),
Expanded(child: Container()),
Expanded(child: Container()),
children: const <Widget>[
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
Expanded(child: SizedBox()),
],
),
),

View file

@ -74,14 +74,14 @@ void main() {
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Focus(focusNode: focusNode1, child: Container(width: 200, height: 100),),
Focus(focusNode: focusNode1, child: const SizedBox(width: 200, height: 100),),
Transform.translate(
offset: const Offset(10, 20),
child: Transform.scale(
scale: 0.33,
child: Transform.rotate(
angle: math.pi,
child: Focus(focusNode: focusNode2, child: Container(width: 200, height: 100)),
child: Focus(focusNode: focusNode2, child: const SizedBox(width: 200, height: 100)),
),
),
),

View file

@ -38,11 +38,11 @@ void main() {
children: <Widget>[
Focus(
key: key2,
child: Container(key: key3, width: 100, height: 100),
child: SizedBox(key: key3, width: 100, height: 100),
),
Focus(
key: key4,
child: Container(key: key5, width: 100, height: 100),
child: SizedBox(key: key5, width: 100, height: 100),
),
],
),
@ -77,11 +77,11 @@ void main() {
children: <Widget>[
Focus(
key: key2,
child: Container(key: key3, width: 100, height: 100),
child: SizedBox(key: key3, width: 100, height: 100),
),
Focus(
key: key4,
child: Container(key: key5, width: 100, height: 100),
child: SizedBox(key: key5, width: 100, height: 100),
),
],
),
@ -413,11 +413,11 @@ void main() {
children: <Widget>[
Focus(
key: key2,
child: Container(key: key3, width: 100, height: 100),
child: SizedBox(key: key3, width: 100, height: 100),
),
Focus(
key: key4,
child: Container(key: key5, width: 100, height: 100),
child: SizedBox(key: key5, width: 100, height: 100),
),
],
),
@ -849,13 +849,13 @@ void main() {
FocusTraversalOrder(
order: const NumericFocusOrder(2),
child: Focus(
child: Container(key: key1, width: 100, height: 100),
child: SizedBox(key: key1, width: 100, height: 100),
),
),
FocusTraversalOrder(
order: const NumericFocusOrder(1),
child: Focus(
child: Container(key: key2, width: 100, height: 100),
child: SizedBox(key: key2, width: 100, height: 100),
),
),
],
@ -1225,12 +1225,12 @@ void main() {
Focus(
debugLabel: 'upperLeft',
onFocusChange: (bool focus) => focusUpperLeft = focus,
child: Container(width: 100, height: 100, key: upperLeftKey),
child: SizedBox(width: 100, height: 100, key: upperLeftKey),
),
Focus(
debugLabel: 'upperRight',
onFocusChange: (bool focus) => focusUpperRight = focus,
child: Container(width: 100, height: 100, key: upperRightKey),
child: SizedBox(width: 100, height: 100, key: upperRightKey),
),
],
),
@ -1239,12 +1239,12 @@ void main() {
Focus(
debugLabel: 'lowerLeft',
onFocusChange: (bool focus) => focusLowerLeft = focus,
child: Container(width: 100, height: 100, key: lowerLeftKey),
child: SizedBox(width: 100, height: 100, key: lowerLeftKey),
),
Focus(
debugLabel: 'lowerRight',
onFocusChange: (bool focus) => focusLowerRight = focus,
child: Container(width: 100, height: 100, key: lowerRightKey),
child: SizedBox(width: 100, height: 100, key: lowerRightKey),
),
],
),
@ -1356,7 +1356,7 @@ void main() {
return Focus(
debugLabel: keys[index].toString(),
onFocusChange: (bool isFocused) => focus[index] = isFocused,
child: Container(width: 100, height: 100, key: keys[index]),
child: SizedBox(width: 100, height: 100, key: keys[index]),
);
}
@ -1498,11 +1498,11 @@ void main() {
children: <Widget>[
Focus(
debugLabel: 'upperLeft',
child: Container(width: 100, height: 100, key: upperLeftKey),
child: SizedBox(width: 100, height: 100, key: upperLeftKey),
),
Focus(
debugLabel: 'upperRight',
child: Container(width: 100, height: 100, key: upperRightKey),
child: SizedBox(width: 100, height: 100, key: upperRightKey),
),
],
),
@ -1510,7 +1510,7 @@ void main() {
children: <Widget>[
Focus(
debugLabel: 'lowerLeft',
child: Container(width: 100, height: 100, key: lowerLeftKey),
child: SizedBox(width: 100, height: 100, key: lowerLeftKey),
),
const Focus(
debugLabel: 'lowerRight',
@ -1613,11 +1613,11 @@ void main() {
Focus(
autofocus: true,
debugLabel: 'upperLeft',
child: Container(width: 100, height: 100, key: upperLeftKey),
child: SizedBox(width: 100, height: 100, key: upperLeftKey),
),
Focus(
debugLabel: 'upperRight',
child: Container(width: 100, height: 100, key: upperRightKey),
child: SizedBox(width: 100, height: 100, key: upperRightKey),
),
],
),
@ -1625,11 +1625,11 @@ void main() {
children: <Widget>[
Focus(
debugLabel: 'lowerLeft',
child: Container(width: 100, height: 100, key: lowerLeftKey),
child: SizedBox(width: 100, height: 100, key: lowerLeftKey),
),
Focus(
debugLabel: 'lowerRight',
child: Container(width: 100, height: 100, key: lowerRightKey),
child: SizedBox(width: 100, height: 100, key: lowerRightKey),
),
],
),
@ -1909,7 +1909,7 @@ void main() {
children: <Widget>[
Row(
children: <Widget>[
Container(
SizedBox(
width: 100,
height: 100,
child: EditableText(
@ -1922,7 +1922,7 @@ void main() {
style: const TextStyle(),
),
),
Container(
SizedBox(
width: 100,
height: 100,
child: EditableText(
@ -1938,7 +1938,7 @@ void main() {
),
Row(
children: <Widget>[
Container(
SizedBox(
width: 100,
height: 100,
child: EditableText(
@ -1950,7 +1950,7 @@ void main() {
style: const TextStyle(),
),
),
Container(
SizedBox(
width: 100,
height: 100,
child: EditableText(

View file

@ -1030,7 +1030,7 @@ void main() {
await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 100,
child: CustomScrollView(
controller: ScrollController(),

View file

@ -155,7 +155,7 @@ void main() {
color: const Color(0xFF00FF00),
),
),
Container(
SizedBox(
width: 100.0,
height: 100.0,
child: GestureDetector(

View file

@ -18,7 +18,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 200.0,
child: GridView.extent(
maxCrossAxisExtent: 100.0,
@ -47,7 +47,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 200.0,
child: GridView.extent(
maxCrossAxisExtent: 60.0,

View file

@ -43,7 +43,7 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
Card(child: Hero(
tag: 'a',
transitionOnUserGestures: transitionFromUserGestures,
child: Container(height: 100.0, width: 100.0, key: firstKey),
child: SizedBox(height: 100.0, width: 100.0, key: firstKey),
)),
const SizedBox(height: 100.0, width: 100.0),
TextButton(
@ -73,7 +73,7 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
Card(child: Hero(
tag: 'a',
transitionOnUserGestures: transitionFromUserGestures,
child: Container(height: 150.0, width: 150.0, key: secondKey),
child: SizedBox(height: 150.0, width: 150.0, key: secondKey),
)),
const SizedBox(height: 150.0, width: 150.0),
TextButton(
@ -102,7 +102,7 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
child: Hero(
tag: 'a',
transitionOnUserGestures: transitionFromUserGestures,
child: Container(height: 150.0, width: 150.0, key: secondKey),
child: SizedBox(height: 150.0, width: 150.0, key: secondKey),
),
),
),
@ -123,7 +123,7 @@ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
child: Hero(
tag: 'a',
transitionOnUserGestures: transitionFromUserGestures,
child: Container(height: 150.0, width: 150.0, key: simpleKey),
child: SizedBox(height: 150.0, width: 150.0, key: simpleKey),
),
),
),
@ -137,7 +137,7 @@ class ThreeRoute extends MaterialPageRoute<void> {
child: ListView(
children: <Widget>[
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: SizedBox(height: 200.0, width: 200.0, key: thirdKey))),
const SizedBox(height: 200.0, width: 200.0),
],
),
@ -497,10 +497,10 @@ Future<void> main() async {
onTap: () {
log.add('foo');
},
child: Container(
child: const SizedBox(
width: 100.0,
height: 100.0,
child: const Text('foo'),
child: Text('foo'),
),
),
),
@ -515,10 +515,10 @@ Future<void> main() async {
onTap: () {
log.add('bar');
},
child: Container(
child: const SizedBox(
width: 100.0,
height: 150.0,
child: const Text('bar'),
child: Text('bar'),
),
),
),
@ -813,7 +813,7 @@ Future<void> main() async {
heroCardSetState = setState;
return Card(
child: routeIncludesHero
? Hero(tag: 'H', child: Container(key: routeHeroKey, height: 200.0, width: 200.0))
? const Hero(tag: 'H', child: SizedBox(key: routeHeroKey, height: 200.0, width: 200.0))
: const SizedBox(height: 200.0, width: 200.0),
);
},
@ -836,8 +836,8 @@ Future<void> main() async {
builder: (BuildContext context) { // Navigator.push() needs context
return ListView(
children: <Widget> [
Card(
child: Hero(tag: 'H', child: Container(key: homeHeroKey, height: 100.0, width: 100.0)),
const Card(
child: Hero(tag: 'H', child: SizedBox(key: homeHeroKey, height: 100.0, width: 100.0)),
),
TextButton(
child: const Text('PUSH'),
@ -914,7 +914,7 @@ Future<void> main() async {
// This container will appear at Y=100
Container(
key: routeContainerKey,
child: Hero(tag: 'H', child: Container(key: routeHeroKey, height: 200.0, width: 200.0)),
child: const Hero(tag: 'H', child: SizedBox(key: routeHeroKey, height: 200.0, width: 200.0)),
),
TextButton(
child: const Text('POP'),
@ -945,7 +945,7 @@ Future<void> main() async {
const SizedBox(height: 200.0),
// This container will appear at Y=200
Container(
child: Hero(tag: 'H', child: Container(key: homeHeroKey, height: 100.0, width: 100.0)),
child: const Hero(tag: 'H', child: SizedBox(key: homeHeroKey, height: 100.0, width: 100.0)),
),
TextButton(
child: const Text('PUSH'),
@ -1004,7 +1004,7 @@ Future<void> main() async {
// This container will appear at Y=100
Container(
key: routeContainerKey,
child: Hero(tag: 'H', child: Container(key: routeHeroKey, height: 200.0, width: 200.0)),
child: const Hero(tag: 'H', child: SizedBox(key: routeHeroKey, height: 200.0, width: 200.0)),
),
const SizedBox(height: 800.0),
],
@ -1024,7 +1024,7 @@ Future<void> main() async {
const SizedBox(height: 200.0),
// This container will appear at Y=200
Container(
child: Hero(tag: 'H', child: Container(key: homeHeroKey, height: 100.0, width: 100.0)),
child: const Hero(tag: 'H', child: SizedBox(key: homeHeroKey, height: 100.0, width: 100.0)),
),
TextButton(
child: const Text('PUSH'),
@ -1080,12 +1080,12 @@ Future<void> main() async {
children: <Widget>[
// This container will appear at Y=0
Container(
child: Hero(
child: const Hero(
tag: 'BC',
child: Container(
child: SizedBox(
key: heroBCKey,
height: 150.0,
child: const Text('Hero'),
child: Text('Hero'),
),
),
),
@ -1105,12 +1105,12 @@ Future<void> main() async {
const SizedBox(height: 100.0),
// This container will appear at Y=100
Container(
child: Hero(
child: const Hero(
tag: 'AB',
child: Container(
child: SizedBox(
key: heroABKey,
height: 200.0,
child: const Text('Hero'),
child: Text('Hero'),
),
),
),
@ -1119,11 +1119,11 @@ Future<void> main() async {
onPressed: () { Navigator.push(context, routeC); },
),
Container(
child: Hero(
child: const Hero(
tag: 'BC',
child: Container(
child: SizedBox(
height: 150.0,
child: const Text('Hero'),
child: Text('Hero'),
),
),
),
@ -1145,12 +1145,12 @@ Future<void> main() async {
const SizedBox(height: 200.0),
// This container will appear at Y=200
Container(
child: Hero(
child: const Hero(
tag: 'AB',
child: Container(
child: SizedBox(
height: 100.0,
width: 100.0,
child: const Text('Hero'),
child: Text('Hero'),
),
),
),
@ -1309,7 +1309,7 @@ Future<void> main() async {
Hero(
tag: 'a',
createRectTween: createRectTween,
child: Container(height: 100.0, width: 100.0, key: firstKey),
child: SizedBox(height: 100.0, width: 100.0, key: firstKey),
),
TextButton(
child: const Text('two'),
@ -1332,7 +1332,7 @@ Future<void> main() async {
Hero(
tag: 'a',
createRectTween: createRectTween,
child: Container(height: 200.0, width: 100.0, key: secondKey),
child: SizedBox(height: 200.0, width: 100.0, key: secondKey),
),
],
),
@ -1424,7 +1424,7 @@ Future<void> main() async {
Hero(
tag: 'a',
createRectTween: createRectTween,
child: Container(height: 100.0, width: 100.0, key: firstKey),
child: SizedBox(height: 100.0, width: 100.0, key: firstKey),
),
TextButton(
child: const Text('two'),
@ -1447,7 +1447,7 @@ Future<void> main() async {
Hero(
tag: 'a',
createRectTween: createRectTween,
child: Container(height: 200.0, width: 100.0, key: secondKey),
child: SizedBox(height: 200.0, width: 100.0, key: secondKey),
),
],
),
@ -2402,7 +2402,7 @@ Future<void> main() async {
Hero(
tag: 'hero',
transitionOnUserGestures: true,
child: Container(
child: SizedBox(
width: 100,
child: Image(
image: imageProvider,
@ -2572,7 +2572,7 @@ Future<void> main() async {
createRectTween: (Rect? begin, Rect? end) {
return RectTween(begin: begin, end: end);
},
child: Container(
child: SizedBox(
key: container1,
height: 100,
width: 100,
@ -2593,7 +2593,7 @@ Future<void> main() async {
createRectTween: (Rect? begin, Rect? end) {
return RectTween(begin: begin, end: end);
},
child: Container(
child: SizedBox(
key: container2,
height: 200,
width: 200,

View file

@ -137,7 +137,7 @@ Widget buildImageAtRatio(String imageName, Key key, double ratio, bool inferSize
Widget buildImageCacheResized(String name, Key key, int width, int height, int cacheWidth, int cacheHeight) {
return Center(
child: RepaintBoundary(
child: Container(
child: SizedBox(
width: 250,
height: 250,
child: Center(

View file

@ -298,7 +298,7 @@ void main() {
Directionality(
textDirection: TextDirection.rtl,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 50.0,
child: Image(
@ -313,7 +313,7 @@ void main() {
Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
expect(find.byType(SizedBox), paints
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..translate(x: 50.0, y: 0.0)
..scale(x: -1.0, y: 1.0)
@ -327,7 +327,7 @@ void main() {
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()..scale()));
expect(find.byType(SizedBox), isNot(paints..scale()..scale()));
});
testWidgets('Image LTR with alignment topEnd (and pointless match)', (WidgetTester tester) async {
@ -335,7 +335,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 50.0,
child: Image(
@ -350,7 +350,7 @@ void main() {
Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
expect(find.byType(SizedBox), paints
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
@ -361,7 +361,7 @@ void main() {
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(SizedBox), isNot(paints..scale()));
});
testWidgets('Image RTL with alignment topEnd', (WidgetTester tester) async {
@ -369,7 +369,7 @@ void main() {
Directionality(
textDirection: TextDirection.rtl,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 50.0,
child: Image(
@ -383,7 +383,7 @@ void main() {
Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
expect(find.byType(SizedBox), paints
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(16.0, 0.0, 32.0, 9.0))
@ -394,7 +394,7 @@ void main() {
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(96.0, 0.0, 112.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(SizedBox), isNot(paints..scale()));
});
testWidgets('Image LTR with alignment topEnd', (WidgetTester tester) async {
@ -402,7 +402,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 50.0,
child: Image(
@ -416,7 +416,7 @@ void main() {
Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
expect(find.byType(SizedBox), paints
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
@ -427,7 +427,7 @@ void main() {
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(SizedBox), isNot(paints..scale()));
});
testWidgets('Image RTL with alignment center-right and match', (WidgetTester tester) async {
@ -435,7 +435,7 @@ void main() {
Directionality(
textDirection: TextDirection.rtl,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 50.0,
child: Image(
@ -447,15 +447,15 @@ void main() {
),
),
);
expect(find.byType(Container), paints
expect(find.byType(SizedBox), paints
..translate(x: 50.0, y: 0.0)
..scale(x: -1.0, y: 1.0)
..translate(x: -50.0, y: 0.0)
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(0.0, 20.5, 16.0, 29.5))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()..scale()));
expect(find.byType(Container), isNot(paints..drawImageRect()..drawImageRect()));
expect(find.byType(SizedBox), isNot(paints..scale()..scale()));
expect(find.byType(SizedBox), isNot(paints..drawImageRect()..drawImageRect()));
});
testWidgets('Image RTL with alignment center-right and no match', (WidgetTester tester) async {
@ -463,7 +463,7 @@ void main() {
Directionality(
textDirection: TextDirection.rtl,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 50.0,
child: Image(
@ -476,11 +476,11 @@ void main() {
Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
expect(find.byType(SizedBox), paints
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(Container), isNot(paints..drawImageRect()..drawImageRect()));
expect(find.byType(SizedBox), isNot(paints..scale()));
expect(find.byType(SizedBox), isNot(paints..drawImageRect()..drawImageRect()));
});
testWidgets('Image LTR with alignment center-right and match', (WidgetTester tester) async {
@ -488,7 +488,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 50.0,
child: Image(
@ -502,11 +502,11 @@ void main() {
Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
expect(find.byType(SizedBox), paints
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(Container), isNot(paints..drawImageRect()..drawImageRect()));
expect(find.byType(SizedBox), isNot(paints..scale()));
expect(find.byType(SizedBox), isNot(paints..drawImageRect()..drawImageRect()));
});
testWidgets('Image LTR with alignment center-right and no match', (WidgetTester tester) async {
@ -514,7 +514,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
width: 100.0,
height: 50.0,
child: Image(
@ -528,11 +528,11 @@ void main() {
Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
expect(find.byType(SizedBox), paints
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(Container), isNot(paints..drawImageRect()..drawImageRect()));
expect(find.byType(SizedBox), isNot(paints..scale()));
expect(find.byType(SizedBox), isNot(paints..drawImageRect()..drawImageRect()));
});
testWidgets('Image - Switch needing direction', (WidgetTester tester) async {

View file

@ -547,7 +547,7 @@ class _TestTweenAnimationBuilderWidgetState extends _TestAnimatedWidgetState {
duration: duration,
onEnd: widget.callback,
builder: (BuildContext context, double? size, Widget? child) {
return Container(
return SizedBox(
child: child,
width: size,
height: size,

View file

@ -20,7 +20,7 @@ void main() {
body: Center(
child: InteractiveViewer(
transformationController: transformationController,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -31,7 +31,7 @@ void main() {
// Attempting to drag to pan doesn't work because the child fits inside
// the viewport and has a tight boundary.
final Offset childOffset = tester.getTopLeft(find.byType(Container));
final Offset childOffset = tester.getTopLeft(find.byType(SizedBox));
final Offset childInterior = Offset(
childOffset.dx + 20.0,
childOffset.dy + 20.0,
@ -76,7 +76,7 @@ void main() {
boundaryMargin: const EdgeInsets.all(boundaryMargin),
minScale: minScale,
transformationController: transformationController,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -86,7 +86,7 @@ void main() {
expect(transformationController.value, equals(Matrix4.identity()));
// Dragging to pan works only until it hits the boundary.
final Offset childOffset = tester.getTopLeft(find.byType(Container));
final Offset childOffset = tester.getTopLeft(find.byType(SizedBox));
final Offset childInterior = Offset(
childOffset.dx + 20.0,
childOffset.dy + 20.0,
@ -133,7 +133,7 @@ void main() {
constrained: false,
scaleEnabled: false,
transformationController: transformationController,
child: Container(width: 2000.0, height: 2000.0),
child: const SizedBox(width: 2000.0, height: 2000.0),
),
),
),
@ -143,7 +143,7 @@ void main() {
expect(transformationController.value, equals(Matrix4.identity()));
// Attempting to move against the boundary doesn't work.
final Offset childOffset = tester.getTopLeft(find.byType(Container));
final Offset childOffset = tester.getTopLeft(find.byType(SizedBox));
final Offset childInterior = Offset(
childOffset.dx + 20.0,
childOffset.dy + 20.0,
@ -211,7 +211,7 @@ void main() {
boundaryMargin: const EdgeInsets.all(double.infinity),
minScale: minScale,
transformationController: transformationController,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -222,7 +222,7 @@ void main() {
// Drag to pan works because even though the viewport fits perfectly
// around the child, there is no boundary.
final Offset childOffset = tester.getTopLeft(find.byType(Container));
final Offset childOffset = tester.getTopLeft(find.byType(SizedBox));
final Offset childInterior = Offset(
childOffset.dx + 20.0,
childOffset.dy + 20.0,
@ -268,7 +268,7 @@ void main() {
alignPanAxis: true,
boundaryMargin: const EdgeInsets.all(double.infinity),
transformationController: transformationController,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -278,7 +278,7 @@ void main() {
expect(transformationController.value, equals(Matrix4.identity()));
// Perform a diagonal drag gesture.
final Offset childOffset = tester.getTopLeft(find.byType(Container));
final Offset childOffset = tester.getTopLeft(find.byType(SizedBox));
final Offset childInterior = Offset(
childOffset.dx + 20.0,
childOffset.dy + 20.0,
@ -308,7 +308,7 @@ void main() {
alignPanAxis: true,
boundaryMargin: const EdgeInsets.all(double.infinity),
transformationController: transformationController,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -318,7 +318,7 @@ void main() {
expect(transformationController.value, equals(Matrix4.identity()));
// Perform a horizontally leaning diagonal drag gesture.
final Offset childOffset = tester.getTopLeft(find.byType(Container));
final Offset childOffset = tester.getTopLeft(find.byType(SizedBox));
final Offset childInterior = Offset(
childOffset.dx + 20.0,
childOffset.dy + 10.0,
@ -350,7 +350,7 @@ void main() {
boundaryMargin: const EdgeInsets.all(boundaryMargin),
minScale: minScale,
transformationController: transformationController,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -358,7 +358,7 @@ void main() {
);
// Fling the child.
final Offset childOffset = tester.getTopLeft(find.byType(Container));
final Offset childOffset = tester.getTopLeft(find.byType(SizedBox));
const Offset flingEnd = Offset(20.0, 15.0);
await tester.flingFrom(childOffset, flingEnd, 1000.0);
await tester.pump();
@ -411,7 +411,7 @@ void main() {
boundaryMargin: const EdgeInsets.all(boundaryMargin),
minScale: minScale,
transformationController: transformationController,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -423,7 +423,7 @@ void main() {
expect(translation.y, 0.0);
// Pan into the corner of the boundaries.
final Offset childOffset = tester.getTopLeft(find.byType(Container));
final Offset childOffset = tester.getTopLeft(find.byType(SizedBox));
const Offset flingEnd = Offset(20.0, 15.0);
await tester.flingFrom(childOffset, flingEnd, 1000.0);
await tester.pumpAndSettle();
@ -433,7 +433,7 @@ void main() {
// Zoom out so the entire child is visible. The child will also be
// translated in order to keep it inside the boundaries.
final Offset childCenter = tester.getCenter(find.byType(Container));
final Offset childCenter = tester.getCenter(find.byType(SizedBox));
Offset scaleStart1 = Offset(childCenter.dx - 40.0, childCenter.dy);
Offset scaleStart2 = Offset(childCenter.dx + 40.0, childCenter.dy);
Offset scaleEnd1 = Offset(childCenter.dx - 10.0, childCenter.dy);
@ -497,7 +497,7 @@ void main() {
boundaryMargin: const EdgeInsets.all(boundaryMargin),
minScale: minScale,
transformationController: transformationController,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -510,12 +510,12 @@ void main() {
// Pan into the corner of the boundaries in two gestures, since
// alignPanAxis prevents diagonal panning.
final Offset childOffset1 = tester.getTopLeft(find.byType(Container));
final Offset childOffset1 = tester.getTopLeft(find.byType(SizedBox));
const Offset flingEnd1 = Offset(20.0, 0.0);
await tester.flingFrom(childOffset1, flingEnd1, 1000.0);
await tester.pumpAndSettle();
await tester.pump(const Duration(seconds: 5));
final Offset childOffset2 = tester.getTopLeft(find.byType(Container));
final Offset childOffset2 = tester.getTopLeft(find.byType(SizedBox));
const Offset flingEnd2 = Offset(0.0, 15.0);
await tester.flingFrom(childOffset2, flingEnd2, 1000.0);
await tester.pumpAndSettle();
@ -525,7 +525,7 @@ void main() {
// Zoom out so the entire child is visible. The child will also be
// translated in order to keep it inside the boundaries.
final Offset childCenter = tester.getCenter(find.byType(Container));
final Offset childCenter = tester.getCenter(find.byType(SizedBox));
Offset scaleStart1 = Offset(childCenter.dx - 40.0, childCenter.dy);
Offset scaleStart2 = Offset(childCenter.dx + 40.0, childCenter.dy);
Offset scaleEnd1 = Offset(childCenter.dx - 10.0, childCenter.dy);
@ -584,7 +584,7 @@ void main() {
body: Center(
child: InteractiveViewer(
transformationController: transformationController,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -607,7 +607,7 @@ void main() {
child: InteractiveViewer(
transformationController: transformationController,
scaleEnabled: false,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -645,7 +645,7 @@ void main() {
onInteractionEnd: (ScaleEndDetails details){
currentVelocity = details.velocity;
},
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -684,7 +684,7 @@ void main() {
maxScale: 100000,
minScale: 0.01,
transformationController: transformationController,
child: Container(width: 1000.0, height: 1000.0),
child: const SizedBox(width: 1000.0, height: 1000.0),
),
)),
),
@ -728,7 +728,7 @@ void main() {
onInteractionEnd: (ScaleEndDetails details){
currentVelocity = details.velocity;
},
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -818,7 +818,7 @@ void main() {
child: InteractiveViewer(
boundaryMargin: const EdgeInsets.all(boundaryMargin),
transformationController: transformationController,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -830,7 +830,7 @@ void main() {
expect(translation.y, 0.0);
// Start a pan gesture.
final Offset childCenter = tester.getCenter(find.byType(Container));
final Offset childCenter = tester.getCenter(find.byType(SizedBox));
final TestGesture gesture = await tester.createGesture();
await gesture.down(childCenter);
await tester.pump();
@ -922,7 +922,7 @@ void main() {
scale = details.scale;
},
transformationController: transformationController,
child: Container(width: 200.0, height: 200.0),
child: const SizedBox(width: 200.0, height: 200.0),
),
),
),
@ -936,7 +936,7 @@ void main() {
// Pinch to zoom isn't immediately detected for a small amount of
// movement due to the GestureDetector.
final Offset childOffset = tester.getTopLeft(find.byType(Container));
final Offset childOffset = tester.getTopLeft(find.byType(SizedBox));
final Offset childInterior = Offset(
childOffset.dx + 20.0,
childOffset.dy + 20.0,

View file

@ -103,7 +103,7 @@ void main() {
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
addSemanticIndexes: false,
children: generateList(Container(height: 12.3, child: const Placeholder())), // about 50 widgets visible
children: generateList(const SizedBox(height: 12.3, child: Placeholder())), // about 50 widgets visible
),
),
);

View file

@ -22,7 +22,7 @@ void main() {
itemExtent: 100.0,
itemBuilder: (BuildContext context, int index) {
callbackTracker.add(index);
return Container(
return SizedBox(
key: ValueKey<int>(index),
height: 100.0,
child: Text('$index'),
@ -70,7 +70,7 @@ void main() {
final IndexedWidgetBuilder itemBuilder = (BuildContext context, int index) {
callbackTracker.add(index);
return Container(
return SizedBox(
key: ValueKey<int>(index),
width: 500.0, // this should be ignored
height: 400.0, // should be overridden by itemExtent
@ -143,7 +143,7 @@ void main() {
final IndexedWidgetBuilder itemBuilder = (BuildContext context, int index) {
callbackTracker.add(index);
return Container(
return SizedBox(
key: ValueKey<int>(index),
width: 400.0, // this should be overridden by itemExtent
height: 500.0, // this should be ignored

View file

@ -14,13 +14,13 @@ void main() {
child: ListView(
cacheExtent: 0.0,
controller: controller,
children: <Widget>[
Container(height: 400.0, child: const Text('1')),
Container(height: 400.0, child: const Text('2')),
Container(height: 400.0, child: const Text('3')),
Container(height: 400.0, child: const Text('4')),
Container(height: 400.0, child: const Text('5')),
Container(height: 400.0, child: const Text('6')),
children: const <Widget>[
SizedBox(height: 400.0, child: Text('1')),
SizedBox(height: 400.0, child: Text('2')),
SizedBox(height: 400.0, child: Text('3')),
SizedBox(height: 400.0, child: Text('4')),
SizedBox(height: 400.0, child: Text('5')),
SizedBox(height: 400.0, child: Text('6')),
],
),
),
@ -37,13 +37,13 @@ void main() {
child: ListView(
cacheExtent: 0.0,
controller: controller,
children: <Widget>[
Container(height: 200.0, child: const Text('1')),
Container(height: 400.0, child: const Text('2')),
Container(height: 400.0, child: const Text('3')),
Container(height: 400.0, child: const Text('4')),
Container(height: 400.0, child: const Text('5')),
Container(height: 400.0, child: const Text('6')),
children: const <Widget>[
SizedBox(height: 200.0, child: Text('1')),
SizedBox(height: 400.0, child: Text('2')),
SizedBox(height: 400.0, child: Text('3')),
SizedBox(height: 400.0, child: Text('4')),
SizedBox(height: 400.0, child: Text('5')),
SizedBox(height: 400.0, child: Text('6')),
],
),
),
@ -72,13 +72,13 @@ void main() {
textDirection: TextDirection.ltr,
child: ListView(
controller: controller,
children: <Widget>[
Container(height: 400.0, child: const Text('1')),
Container(height: 400.0, child: const Text('2')),
Container(height: 400.0, child: const Text('3')),
Container(height: 400.0, child: const Text('4')),
Container(height: 400.0, child: const Text('5')),
Container(height: 400.0, child: const Text('6')),
children: const <Widget>[
SizedBox(height: 400.0, child: Text('1')),
SizedBox(height: 400.0, child: Text('2')),
SizedBox(height: 400.0, child: Text('3')),
SizedBox(height: 400.0, child: Text('4')),
SizedBox(height: 400.0, child: Text('5')),
SizedBox(height: 400.0, child: Text('6')),
],
),
),
@ -94,13 +94,13 @@ void main() {
textDirection: TextDirection.ltr,
child: ListView(
controller: controller,
children: <Widget>[
Container(height: 200.0, child: const Text('1')),
Container(height: 400.0, child: const Text('2')),
Container(height: 400.0, child: const Text('3')),
Container(height: 400.0, child: const Text('4')),
Container(height: 400.0, child: const Text('5')),
Container(height: 400.0, child: const Text('6')),
children: const <Widget>[
SizedBox(height: 200.0, child: Text('1')),
SizedBox(height: 400.0, child: Text('2')),
SizedBox(height: 400.0, child: Text('3')),
SizedBox(height: 400.0, child: Text('4')),
SizedBox(height: 400.0, child: Text('5')),
SizedBox(height: 400.0, child: Text('6')),
],
),
),
@ -129,11 +129,11 @@ void main() {
textDirection: TextDirection.ltr,
child: ListView(
controller: controller,
children: <Widget>[
Container(height: 400.0, child: const Text('0')),
Container(height: 400.0, child: const Text('1')),
Container(height: 400.0, child: const Text('2')),
Container(height: 400.0, child: const Text('3')),
children: const <Widget>[
SizedBox(height: 400.0, child: Text('0')),
SizedBox(height: 400.0, child: Text('1')),
SizedBox(height: 400.0, child: Text('2')),
SizedBox(height: 400.0, child: Text('3')),
],
),
),
@ -143,20 +143,20 @@ void main() {
expect(find.text('2'), findsNothing);
expect(find.text('3'), findsNothing);
final Finder findItemA = find.descendant(of: find.byType(Container), matching: find.text('A'));
final Finder findItemB = find.descendant(of: find.byType(Container), matching: find.text('B'));
final Finder findItemA = find.descendant(of: find.byType(SizedBox), matching: find.text('A'));
final Finder findItemB = find.descendant(of: find.byType(SizedBox), matching: find.text('B'));
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: ListView(
controller: controller,
children: <Widget>[
Container(height: 10.0, child: const Text('A')),
Container(height: 10.0, child: const Text('B')),
Container(height: 400.0, child: const Text('0')),
Container(height: 400.0, child: const Text('1')),
Container(height: 400.0, child: const Text('2')),
Container(height: 400.0, child: const Text('3')),
children: const <Widget>[
SizedBox(height: 10.0, child: Text('A')),
SizedBox(height: 10.0, child: Text('B')),
SizedBox(height: 400.0, child: Text('0')),
SizedBox(height: 400.0, child: Text('1')),
SizedBox(height: 400.0, child: Text('2')),
SizedBox(height: 400.0, child: Text('3')),
],
),
),
@ -179,13 +179,13 @@ void main() {
textDirection: TextDirection.ltr,
child: ListView(
controller: controller,
children: <Widget>[
Container(height: 200.0, child: const Text('A')),
Container(height: 200.0, child: const Text('B')),
Container(height: 400.0, child: const Text('0')),
Container(height: 400.0, child: const Text('1')),
Container(height: 400.0, child: const Text('2')),
Container(height: 400.0, child: const Text('3')),
children: const <Widget>[
SizedBox(height: 200.0, child: Text('A')),
SizedBox(height: 200.0, child: Text('B')),
SizedBox(height: 400.0, child: Text('0')),
SizedBox(height: 400.0, child: Text('1')),
SizedBox(height: 400.0, child: Text('2')),
SizedBox(height: 400.0, child: Text('3')),
],
),
),

View file

@ -11,7 +11,7 @@ Widget buildFrame({ bool reverse = false, required TextDirection textDirection }
return Directionality(
textDirection: textDirection,
child: Center(
child: Container(
child: SizedBox(
height: 50.0,
child: ListView(
itemExtent: 290.0,
@ -19,9 +19,7 @@ Widget buildFrame({ bool reverse = false, required TextDirection textDirection }
reverse: reverse,
physics: const BouncingScrollPhysics(),
children: items.map<Widget>((int item) {
return Container(
child: Text('$item'),
);
return Text('$item');
}).toList(),
),
),

View file

@ -14,10 +14,10 @@ void main() {
textDirection: TextDirection.ltr,
child: ListView(
key: blockKey,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
height: 200.0, // less than 600, the height of the test area
child: const Text('Hello'),
child: Text('Hello'),
),
],
),
@ -42,10 +42,10 @@ void main() {
textDirection: TextDirection.ltr,
child: ListView(
key: blockKey,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
height: 2000.0, // more than 600, the height of the test area
child: const Text('Hello'),
child: Text('Hello'),
),
],
),

View file

@ -402,7 +402,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
child: ListView(
cacheExtent: 500.0,
@ -431,12 +431,12 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
child: ListView(
cacheExtent: 500.0,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
height: 100.0,
),
],
@ -456,19 +456,19 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
child: ListView(
itemExtent: 100.0,
cacheExtent: 500.0,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
height: 100.0,
),
Container(
SizedBox(
height: 100.0,
),
Container(
SizedBox(
height: 100.0,
),
],
@ -486,13 +486,13 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
child: ListView(
itemExtent: 100.0,
cacheExtent: 500.0,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
height: 100.0,
),
],
@ -511,13 +511,13 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
child: ListView(
scrollDirection: Axis.horizontal,
itemExtent: 100.0,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
height: 100.0,
),
],
@ -547,15 +547,15 @@ void main() {
return Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
width: 100.0,
child: ListView(
controller: controller,
scrollDirection: scrollDirection,
itemExtent: 50.0,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
height: 50.0,
width: 50.0,
),

View file

@ -24,7 +24,7 @@ void main() {
left: ListView.builder(
itemBuilder: (BuildContext context, int index) {
callbackTracker.add(index);
return Container(
return SizedBox(
key: ValueKey<int>(index),
height: 100.0,
child: Text('$index'),
@ -70,7 +70,7 @@ void main() {
final IndexedWidgetBuilder itemBuilder = (BuildContext context, int index) {
callbackTracker.add(index);
return Container(
return SizedBox(
key: ValueKey<int>(index),
width: 500.0, // this should be ignored
height: 200.0,
@ -133,7 +133,7 @@ void main() {
final IndexedWidgetBuilder itemBuilder = (BuildContext context, int index) {
callbackTracker.add(index);
return Container(
return SizedBox(
key: ValueKey<int>(index),
height: 500.0, // this should be ignored
width: 200.0,
@ -184,7 +184,7 @@ void main() {
final IndexedWidgetBuilder itemBuilder = (BuildContext context, int index) {
callbackTracker.add(index);
return Container(
return SizedBox(
key: ValueKey<int>(index),
width: 500.0, // this should be ignored
height: 220.0,
@ -440,18 +440,18 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 200.0,
child: ListView(
cacheExtent: 500.0,
controller: ScrollController(initialScrollOffset: 300.0),
children: <Widget>[
Container(height: 140.0, child: text),
Container(height: 160.0, child: text),
Container(height: 90.0, child: text),
Container(height: 110.0, child: text),
Container(height: 80.0, child: text),
Container(height: 70.0, child: text),
children: const <Widget>[
SizedBox(height: 140.0, child: text),
SizedBox(height: 160.0, child: text),
SizedBox(height: 90.0, child: text),
SizedBox(height: 110.0, child: text),
SizedBox(height: 80.0, child: text),
SizedBox(height: 70.0, child: text),
],
),
),
@ -467,7 +467,7 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Container(
body: SizedBox(
height: 500.0,
child: CustomScrollView(
controller: ScrollController(initialScrollOffset: 120.0),
@ -479,9 +479,9 @@ void main() {
delegate: ListView.builder(
itemExtent: 100.0,
itemCount: 100,
itemBuilder: (_, __) => Container(
itemBuilder: (_, __) => const SizedBox(
height: 40.0,
child: const Text('hey'),
child: Text('hey'),
)).childrenDelegate),
],
),
@ -498,7 +498,7 @@ void main() {
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.rtl,
child: Container(
child: SizedBox(
height: 200.0,
child: ListView.builder(
padding: EdgeInsets.zero,

View file

@ -20,7 +20,7 @@ Widget buildCard(BuildContext context, int index) {
return const SizedBox(height: 100);
}
return Container(
return SizedBox(
key: ValueKey<String>(items[index]),
height: 100.0,
child: DefaultTextStyle(

View file

@ -151,7 +151,7 @@ void main() {
onSelectedItemChanged: (_) { },
childDelegate: ListWheelChildLoopingListDelegate(
children: List<Widget>.generate(10, (int index) {
return Container(
return SizedBox(
width: 400.0,
height: 100.0,
child: Text(index.toString()),
@ -164,13 +164,13 @@ void main() {
// The first item is at the center of the viewport.
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')),
tester.getTopLeft(find.widgetWithText(SizedBox, '0')),
const Offset(0.0, 250.0),
);
// The last item is just before the first item.
expect(
tester.getTopLeft(find.widgetWithText(Container, '9')),
tester.getTopLeft(find.widgetWithText(SizedBox, '9')),
const Offset(0.0, 150.0),
);
@ -179,7 +179,7 @@ void main() {
// We have passed the end of the list, the list should have looped back.
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')),
tester.getTopLeft(find.widgetWithText(SizedBox, '0')),
const Offset(0.0, 250.0),
);
});
@ -197,7 +197,7 @@ void main() {
onSelectedItemChanged: (_) { },
childDelegate: ListWheelChildBuilderDelegate(
builder: (BuildContext context, int index) {
return Container(
return SizedBox(
width: 400.0,
height: 100.0,
child: Text(index.toString()),
@ -212,7 +212,7 @@ void main() {
controller.jumpTo(-100000.0);
await tester.pump();
expect(
tester.getTopLeft(find.widgetWithText(Container, '-1000')),
tester.getTopLeft(find.widgetWithText(SizedBox, '-1000')),
const Offset(0.0, 250.0),
);
@ -220,7 +220,7 @@ void main() {
controller.jumpTo(100000.0);
await tester.pump();
expect(
tester.getTopLeft(find.widgetWithText(Container, '1000')),
tester.getTopLeft(find.widgetWithText(SizedBox, '1000')),
const Offset(0.0, 250.0),
);
});
@ -242,7 +242,7 @@ void main() {
builder: (BuildContext context, int index) {
if (index < -15 || index > -5)
return null;
return Container(
return SizedBox(
width: 400.0,
height: 100.0,
child: CustomPaint(
@ -362,7 +362,7 @@ void main() {
expect(builtChildren.contains(index), false);
builtChildren.add(index);
return Container(
return SizedBox(
width: 400.0,
height: 100.0,
child: Text(index.toString()),
@ -616,10 +616,10 @@ void main() {
textDirection: TextDirection.ltr,
child: ListWheelScrollView(
itemExtent: 100.0,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
width: 200.0,
child: const Center(
child: Center(
child: Text('blah'),
),
),
@ -673,10 +673,10 @@ void main() {
child: ListWheelScrollView(
controller: controller,
itemExtent: 100.0,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
width: 200.0,
child: const Center(
child: Center(
child: Text('blah'),
),
),
@ -703,10 +703,10 @@ void main() {
controller: controller,
diameterRatio: 3.0,
itemExtent: 100.0,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
width: 200.0,
child: const Center(
child: Center(
child: Text('blah'),
),
),
@ -732,10 +732,10 @@ void main() {
controller: controller,
perspective: 0.0001,
itemExtent: 100.0,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
width: 200.0,
child: const Center(
child: Center(
child: Text('blah'),
),
),
@ -761,10 +761,10 @@ void main() {
child: ListWheelScrollView(
controller: controller,
itemExtent: 100.0,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
width: 200.0,
child: const Center(
child: Center(
child: Text('blah'),
),
),
@ -794,10 +794,10 @@ void main() {
controller: controller,
itemExtent: 100.0,
offAxisFraction: 0.5,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
width: 200.0,
child: const Center(
child: Center(
child: Text('blah'),
),
),
@ -840,10 +840,10 @@ void main() {
offAxisFraction: 0.5,
useMagnifier: true,
magnification: 1.5,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
width: 200.0,
child: const Center(
child: Center(
child: Text('blah'),
),
),
@ -888,10 +888,10 @@ void main() {
child: ListWheelScrollView(
itemExtent: 100.0,
onSelectedItemChanged: onItemChange,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
width: 200.0,
child: const Center(
child: Center(
child: Text('blah'),
),
),
@ -1275,7 +1275,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 500.0,
width: 300.0,
child: ListWheelScrollView(
@ -1284,7 +1284,7 @@ void main() {
children: outerChildren = List<Widget>.generate(10, (int i) {
return Container(
child: Center(
child: innerChildren[i] = Container(
child: innerChildren[i] = SizedBox(
height: 50.0,
width: 50.0,
child: Text('Item $i'),
@ -1346,7 +1346,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 500.0,
width: 300.0,
child: ListWheelScrollView(
@ -1356,7 +1356,7 @@ void main() {
outerChildren = List<Widget>.generate(10, (int i) {
return Container(
child: Center(
child: innerChildren[i] = Container(
child: innerChildren[i] = SizedBox(
height: 50.0,
width: 50.0,
child: Text('Item $i'),

View file

@ -575,10 +575,10 @@ void main() {
});
testWidgets('applies mouse cursor', (WidgetTester tester) async {
await tester.pumpWidget(_Scaffold(
await tester.pumpWidget(const _Scaffold(
topLeft: MouseRegion(
cursor: SystemMouseCursors.text,
child: Container(width: 10, height: 10),
child: SizedBox(width: 10, height: 10),
),
));
@ -1085,7 +1085,7 @@ void main() {
height: 100,
width: 10,
alignment: moved ? Alignment.topLeft : Alignment.bottomLeft,
child: Container(
child: SizedBox(
height: 10,
width: 10,
child: HoverClient(
@ -1363,7 +1363,7 @@ void main() {
addTearDown(gesture.removePointer);
await tester.pumpWidget(_Scaffold(
topLeft: Container(
topLeft: SizedBox(
height: 10,
width: 10,
child: MouseRegion(
@ -1384,7 +1384,7 @@ void main() {
logs.clear();
await tester.pumpWidget(_Scaffold(
topLeft: Container(
topLeft: SizedBox(
height: 10,
width: 10,
child: MouseRegion(
@ -1405,7 +1405,7 @@ void main() {
// Compare: It repaints if the MouseRegion is deactivated.
await tester.pumpWidget(_Scaffold(
topLeft: Container(
topLeft: SizedBox(
height: 10,
width: 10,
child: MouseRegion(
@ -1430,7 +1430,7 @@ void main() {
final VoidCallback onPaintChild = () { logs.add('paint'); };
await tester.pumpWidget(_Scaffold(
topLeft: Container(
topLeft: SizedBox(
height: 10,
width: 10,
child: MouseRegion(
@ -1450,7 +1450,7 @@ void main() {
logs.clear();
await tester.pumpWidget(_Scaffold(
topLeft: Container(
topLeft: SizedBox(
height: 10,
width: 10,
child: MouseRegion(
@ -1476,7 +1476,7 @@ void main() {
final VoidCallback onPaintChild = () { logPaints.add('paint'); };
await tester.pumpWidget(_Scaffold(
topLeft: Container(
topLeft: SizedBox(
height: 10,
width: 10,
child: MouseRegion(
@ -1496,7 +1496,7 @@ void main() {
logEnters.clear();
await tester.pumpWidget(_Scaffold(
topLeft: Container(
topLeft: SizedBox(
height: 10,
width: 10,
child: MouseRegion(
@ -1526,7 +1526,7 @@ void main() {
final VoidCallback onPaintChild = () { logPaints.add('paint'); };
await tester.pumpWidget(_Scaffold(
topLeft: Container(
topLeft: SizedBox(
height: 10,
width: 10,
child: MouseRegion(
@ -1548,7 +1548,7 @@ void main() {
logEnters.clear();
await tester.pumpWidget(_Scaffold(
topLeft: Container(
topLeft: SizedBox(
height: 10,
width: 10,
child: MouseRegion(
@ -1569,7 +1569,7 @@ void main() {
logEnters.clear();
await tester.pumpWidget(_Scaffold(
topLeft: Container(
topLeft: SizedBox(
height: 10,
width: 10,
child: MouseRegion(

View file

@ -71,43 +71,41 @@ Widget buildTest({
body: TabBarView(
children: <Widget>[
ListView(
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
height: 300.0,
child: const Text('aaa1'),
child: Text('aaa1'),
),
Container(
SizedBox(
height: 200.0,
child: const Text('aaa2'),
child: Text('aaa2'),
),
Container(
SizedBox(
height: 100.0,
child: const Text('aaa3'),
child: Text('aaa3'),
),
Container(
SizedBox(
height: 50.0,
child: const Text('aaa4'),
child: Text('aaa4'),
),
],
),
ListView(
dragStartBehavior: DragStartBehavior.down,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
height: 100.0,
child: const Text('bbb1'),
child: Text('bbb1'),
),
],
),
Container(
child: const Center(child: Text('ccc1')),
),
const Center(child: Text('ccc1')),
ListView(
dragStartBehavior: DragStartBehavior.down,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
height: 10000.0,
child: const Text('ddd1'),
child: Text('ddd1'),
),
],
),
@ -773,11 +771,11 @@ void main() {
),
];
},
body: SingleChildScrollView(
body: const SingleChildScrollView(
dragStartBehavior: DragStartBehavior.down,
child: Container(
child: SizedBox(
height: 1000.0,
child: const Placeholder(key: key2),
child: Placeholder(key: key2),
),
),
),
@ -2391,9 +2389,9 @@ class _TestLayoutExtentIsNegative extends StatelessWidget {
pinned: true,
forceElevated: innerBoxIsScrolled,
backgroundColor: Colors.blue[300],
title: Container(
title: const SizedBox(
height: 50,
child: const Center(
child: Center(
child: Text('Sticky Header'),
),
),

View file

@ -58,7 +58,7 @@ void main() {
child: SizedOverflowBox(
size: const Size(100.0, 100.0),
alignment: Alignment.topRight,
child: Container(height: 50.0, width: 50.0, key: inner),
child: SizedBox(height: 50.0, width: 50.0, key: inner),
),
),
));
@ -81,7 +81,7 @@ void main() {
child: SizedOverflowBox(
size: const Size(100.0, 100.0),
alignment: AlignmentDirectional.bottomStart,
child: Container(height: 50.0, width: 50.0, key: inner),
child: SizedBox(height: 50.0, width: 50.0, key: inner),
),
),
));

View file

@ -65,11 +65,11 @@ void main() {
axisDirection: AxisDirection.down,
color: const Color(0x0DFFFFFF),
notificationPredicate: (ScrollNotification notification) => notification.depth == 1,
child: SingleChildScrollView(
child: const SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Container(
child: SizedBox(
width: 600.0,
child: const CustomScrollView(
child: CustomScrollView(
slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 2000.0)),
],

View file

@ -11,7 +11,7 @@ final List<GlobalKey> globalKeys = defaultPages.map<GlobalKey>((_) => GlobalKey(
int? currentPage;
Widget buildPage(int page) {
return Container(
return SizedBox(
key: globalKeys[page],
width: pageSize.width,
height: pageSize.height,
@ -36,7 +36,7 @@ Widget buildFrame({
return Directionality(
textDirection: textDirection,
child: Center(
child: Container(
child: SizedBox(
width: pageSize.width, height: pageSize.height, child: child,
),
),

View file

@ -141,11 +141,11 @@ void main() {
//
//
testWidgets('entirely overlapping, direct child', (WidgetTester tester) async {
final List<Widget> children = <Widget>[
Container(
const List<Widget> children = <Widget>[
SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 1.0,
color: Colors.green,
child: Material(
@ -169,19 +169,19 @@ void main() {
//
//
testWidgets('entirely overlapping, correct painting order', (WidgetTester tester) async {
final List<Widget> children = <Widget>[
Container(
const List<Widget> children = <Widget>[
SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 1.0,
color: Colors.green,
),
),
Container(
SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 2.0,
color: Colors.blue,
),
@ -201,19 +201,19 @@ void main() {
//
//
testWidgets('entirely overlapping, wrong painting order', (WidgetTester tester) async {
final List<Widget> children = <Widget>[
Container(
const List<Widget> children = <Widget>[
SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 2.0,
color: Colors.green,
),
),
Container(
SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 1.0,
color: Colors.blue,
),
@ -237,10 +237,10 @@ void main() {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: const Rect.fromLTWH(150, 150, 150, 150),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 3.0,
color: Colors.brown,
),
@ -248,10 +248,10 @@ void main() {
),
Positioned.fromRect(
rect: const Rect.fromLTWH(20, 20, 140, 150),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 2.0,
color: Colors.red,
shape: CircleBorder(),
@ -275,10 +275,10 @@ void main() {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: const Rect.fromLTWH(20, 20, 140, 150),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 3.0,
color: Colors.brown,
),
@ -286,10 +286,10 @@ void main() {
),
Positioned.fromRect(
rect: const Rect.fromLTWH(50, 50, 100, 100),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 2.0,
color: Colors.red,
shape: CircleBorder(),
@ -313,10 +313,10 @@ void main() {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: const Rect.fromLTWH(150, 150, 150, 150),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 3.0,
color: Colors.brown,
),
@ -324,10 +324,10 @@ void main() {
),
Positioned.fromRect(
rect: const Rect.fromLTWH(30, 20, 150, 150),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 2.0,
color: Colors.red,
shape: CircleBorder(),
@ -354,10 +354,10 @@ void main() {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: const Rect.fromLTWH(150, 150, 150, 150),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 1.0,
color: Colors.brown,
child: Padding(
@ -372,10 +372,10 @@ void main() {
),
Positioned.fromRect(
rect: const Rect.fromLTWH(30, 20, 180, 180),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 1.0,
color: Colors.red,
),
@ -398,10 +398,10 @@ void main() {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: const Rect.fromLTWH(150, 150, 150, 150),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 3.0,
color: Colors.brown,
),
@ -409,10 +409,10 @@ void main() {
),
Positioned.fromRect(
rect: const Rect.fromLTWH(30, 20, 150, 150),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 2.0,
color: Colors.red,
shape: CircleBorder(),
@ -442,7 +442,7 @@ void main() {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: const Rect.fromLTWH(140, 100, 140, 150),
child: Container(
child: SizedBox(
width: 300,
height: 300,
child: Transform.rotate(
@ -456,10 +456,10 @@ void main() {
),
Positioned.fromRect(
rect: const Rect.fromLTWH(50, 50, 100, 100),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 2.0,
color: Colors.red,
shape: CircleBorder()),
@ -483,7 +483,7 @@ void main() {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: const Rect.fromLTWH(140, 100, 140, 150),
child: Container(
child: SizedBox(
width: 300,
height: 300,
child: Transform.rotate(
@ -497,10 +497,10 @@ void main() {
),
Positioned.fromRect(
rect: const Rect.fromLTWH(50, 50, 100, 100),
child: Container(
child: const SizedBox(
width: 300,
height: 300,
child: const Material(
child: Material(
elevation: 2.0,
color: Colors.red,
shape: CircleBorder()),

View file

@ -1885,16 +1885,16 @@ void main() {
viewsController.registerViewType('webview');
await tester.pumpWidget(
Container(width: 300, height: 600,
SizedBox(width: 300, height: 600,
child: Stack(
alignment: Alignment.topLeft,
children: <Widget>[
Transform.translate(
offset: const Offset(0, 100),
child: Container(
child: const SizedBox(
width: 300,
height: 500,
child: const UiKitView(viewType: 'webview', layoutDirection: TextDirection.ltr)),),
child: UiKitView(viewType: 'webview', layoutDirection: TextDirection.ltr)),),
Transform.translate(
offset: const Offset(0, 500),
child: Container(

View file

@ -86,7 +86,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: Container(
child: SizedBox(
height: 100.0,
width: 100.0,
child: Stack(

View file

@ -25,7 +25,7 @@ void main() {
});
},
itemBuilder: (BuildContext context, int index) {
return Container(
return SizedBox(
height: 100,
child: Text('item ${items[index]}'),
);
@ -63,7 +63,7 @@ void main() {
});
},
itemBuilder: (BuildContext context, int index) {
return Container(
return SizedBox(
height: 100,
child: Text('item ${items[index]}'),
);

View file

@ -205,7 +205,7 @@ void main() {
child: ListView(
itemExtent: 100.0,
children: <Widget>[
Container(
SizedBox(
key: const Key('container'),
height: 100.0,
child: StateMarker(key: key),
@ -279,7 +279,7 @@ void main() {
await tester.pumpWidget(Stack(
textDirection: TextDirection.ltr,
children: <Widget>[
Container(width: 100.0, height: 100.0, child: StateMarker(key: key)),
SizedBox(width: 100.0, height: 100.0, child: StateMarker(key: key)),
const SizedBox(width: 100.0, height: 100.0),
],
));
@ -303,7 +303,7 @@ void main() {
textDirection: TextDirection.ltr,
children: <Widget>[
const SizedBox(width: 100.0, height: 100.0),
Container(width: 100.0, height: 100.0, child: StateMarker(key: key)),
SizedBox(width: 100.0, height: 100.0, child: StateMarker(key: key)),
],
));

View file

@ -46,9 +46,9 @@ void main() {
child: Row(
key: rowKey,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Expanded(child: Container(key: child1Key, width: 100.0, height: 100.0, child: log(2))),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Expanded(child: SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2))),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -77,9 +77,9 @@ void main() {
child: Row(
key: rowKey,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -108,8 +108,8 @@ void main() {
key: rowKey,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
],
),
));
@ -139,9 +139,9 @@ void main() {
key: rowKey,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -171,9 +171,9 @@ void main() {
key: rowKey,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -204,10 +204,10 @@ void main() {
key: rowKey,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
Container(key: child3Key, width: 100.0, height: 100.0, child: log(4)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child3Key, width: 100.0, height: 100.0, child: log(4)),
],
),
));
@ -237,9 +237,9 @@ void main() {
key: rowKey,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(key: child0Key, width: 200.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 200.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 200.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 200.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 200.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 200.0, height: 100.0, child: log(3)),
],
),
));
@ -268,8 +268,8 @@ void main() {
key: rowKey,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 150.0, height: 100.0, child: log(2)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 150.0, height: 100.0, child: log(2)),
],
),
));
@ -285,14 +285,14 @@ void main() {
const Key childKey = Key('childKey');
await tester.pumpWidget(Center(
child: Container(
child: SizedBox(
width: 0.0,
height: 0.0,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
key: childKey,
width: 100.0,
height: 100.0,
@ -325,9 +325,9 @@ void main() {
key: rowKey,
textDirection: TextDirection.ltr,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Expanded(child: Container(key: child1Key, width: 100.0, height: 100.0, child: log(2))),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Expanded(child: SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2))),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -375,9 +375,9 @@ void main() {
key: rowKey,
textDirection: TextDirection.ltr,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -424,8 +424,8 @@ void main() {
mainAxisAlignment: MainAxisAlignment.center,
textDirection: TextDirection.ltr,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
],
),
));
@ -467,9 +467,9 @@ void main() {
textDirection: TextDirection.ltr,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -517,9 +517,9 @@ void main() {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
textDirection: TextDirection.ltr,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -568,10 +568,10 @@ void main() {
mainAxisAlignment: MainAxisAlignment.spaceAround,
textDirection: TextDirection.ltr,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
Container(key: child3Key, width: 100.0, height: 100.0, child: log(4)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child3Key, width: 100.0, height: 100.0, child: log(4)),
],
),
));
@ -625,9 +625,9 @@ void main() {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
textDirection: TextDirection.ltr,
children: <Widget>[
Container(key: child0Key, width: 200.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 200.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 200.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 200.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 200.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 200.0, height: 100.0, child: log(3)),
],
),
));
@ -674,8 +674,8 @@ void main() {
mainAxisSize: MainAxisSize.min,
textDirection: TextDirection.ltr,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 150.0, height: 100.0, child: log(2)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 150.0, height: 100.0, child: log(2)),
],
),
));
@ -707,15 +707,15 @@ void main() {
const Key childKey = Key('childKey');
await tester.pumpWidget(Center(
child: Container(
child: SizedBox(
width: 0.0,
height: 0.0,
child: Row(
textDirection: TextDirection.ltr,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
key: childKey,
width: 100.0,
height: 100.0,
@ -748,9 +748,9 @@ void main() {
key: rowKey,
textDirection: TextDirection.rtl,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Expanded(child: Container(key: child1Key, width: 100.0, height: 100.0, child: log(2))),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Expanded(child: SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2))),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -798,9 +798,9 @@ void main() {
key: rowKey,
textDirection: TextDirection.rtl,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -847,8 +847,8 @@ void main() {
mainAxisAlignment: MainAxisAlignment.center,
textDirection: TextDirection.rtl,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
],
),
));
@ -890,9 +890,9 @@ void main() {
textDirection: TextDirection.rtl,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -940,9 +940,9 @@ void main() {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
textDirection: TextDirection.rtl,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
],
),
));
@ -991,10 +991,10 @@ void main() {
mainAxisAlignment: MainAxisAlignment.spaceAround,
textDirection: TextDirection.rtl,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
Container(key: child3Key, width: 100.0, height: 100.0, child: log(4)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 100.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 100.0, height: 100.0, child: log(3)),
SizedBox(key: child3Key, width: 100.0, height: 100.0, child: log(4)),
],
),
));
@ -1048,9 +1048,9 @@ void main() {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
textDirection: TextDirection.rtl,
children: <Widget>[
Container(key: child0Key, width: 200.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 200.0, height: 100.0, child: log(2)),
Container(key: child2Key, width: 200.0, height: 100.0, child: log(3)),
SizedBox(key: child0Key, width: 200.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 200.0, height: 100.0, child: log(2)),
SizedBox(key: child2Key, width: 200.0, height: 100.0, child: log(3)),
],
),
));
@ -1097,8 +1097,8 @@ void main() {
mainAxisSize: MainAxisSize.min,
textDirection: TextDirection.rtl,
children: <Widget>[
Container(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
Container(key: child1Key, width: 150.0, height: 100.0, child: log(2)),
SizedBox(key: child0Key, width: 100.0, height: 100.0, child: log(1)),
SizedBox(key: child1Key, width: 150.0, height: 100.0, child: log(2)),
],
),
));
@ -1130,15 +1130,15 @@ void main() {
const Key childKey = Key('childKey');
await tester.pumpWidget(Center(
child: Container(
child: SizedBox(
width: 0.0,
height: 0.0,
child: Row(
textDirection: TextDirection.rtl,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
children: const <Widget>[
SizedBox(
key: childKey,
width: 100.0,
height: 100.0,

View file

@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
List<Widget> children(int n) {
return List<Widget>.generate(n, (int i) {
return Container(height: 100.0, child: Text('$i'));
return SizedBox(height: 100.0, child: Text('$i'));
});
}

View file

@ -17,7 +17,7 @@ void main() {
child: ListView(
controller: controller,
children: kStates.map<Widget>((String state) {
return Container(
return SizedBox(
height: 200.0,
child: Text(state),
);
@ -56,7 +56,7 @@ void main() {
key: const Key('second'),
controller: controller,
children: kStates.map<Widget>((String state) {
return Container(
return SizedBox(
height: 200.0,
child: Text(state),
);
@ -82,7 +82,7 @@ void main() {
key: const Key('second'),
controller: controller2,
children: kStates.map<Widget>((String state) {
return Container(
return SizedBox(
height: 200.0,
child: Text(state),
);
@ -106,7 +106,7 @@ void main() {
controller: controller2,
physics: const BouncingScrollPhysics(),
children: kStates.map<Widget>((String state) {
return Container(
return SizedBox(
height: 200.0,
child: Text(state),
);
@ -213,7 +213,7 @@ void main() {
child: ListView(
controller: controller,
children: kStates.map<Widget>((String state) {
return Container(height: 200.0, child: Text(state));
return SizedBox(height: 200.0, child: Text(state));
}).toList(),
),
),
@ -222,7 +222,7 @@ void main() {
child: ListView(
controller: controller,
children: kStates.map<Widget>((String state) {
return Container(height: 200.0, child: Text(state));
return SizedBox(height: 200.0, child: Text(state));
}).toList(),
),
),
@ -253,7 +253,7 @@ void main() {
child: ListView(
controller: controller,
children: kStates.map<Widget>((String state) {
return Container(height: 200.0, child: Text(state));
return SizedBox(height: 200.0, child: Text(state));
}).toList(),
),
),
@ -262,7 +262,7 @@ void main() {
child: ListView(
controller: controller,
children: kStates.map<Widget>((String state) {
return Container(height: 200.0, child: Text(state));
return SizedBox(height: 200.0, child: Text(state));
}).toList(),
),
),
@ -291,7 +291,7 @@ void main() {
child: ListView(
controller: controller,
children: kStates.map<Widget>((String state) {
return Container(height: 200.0, child: Text(state));
return SizedBox(height: 200.0, child: Text(state));
}).toList(),
),
),
@ -324,7 +324,7 @@ void main() {
key: UniqueKey(), // it's a different ListView every time
controller: controller,
children: List<Widget>.generate(50, (int index) {
return Container(height: 100.0, child: Text('Item $index'));
return SizedBox(height: 100.0, child: Text('Item $index'));
}).toList(),
),
),
@ -339,18 +339,18 @@ void main() {
// scroll offset.
ScrollController controller = ScrollController(initialScrollOffset: 200.0);
await tester.pumpWidget(buildFrame(controller));
expect(tester.getTopLeft(find.widgetWithText(Container, 'Item 2')), Offset.zero);
expect(tester.getTopLeft(find.widgetWithText(SizedBox, 'Item 2')), Offset.zero);
controller.jumpTo(2000.0);
await tester.pump();
expect(tester.getTopLeft(find.widgetWithText(Container, 'Item 20')), Offset.zero);
expect(tester.getTopLeft(find.widgetWithText(SizedBox, 'Item 20')), Offset.zero);
// The initialScrollOffset isn't used in this case, because the scrolloffset
// can be restored.
controller = ScrollController(initialScrollOffset: 25.0);
await tester.pumpWidget(buildFrame(controller));
expect(controller.offset, 2000.0);
expect(tester.getTopLeft(find.widgetWithText(Container, 'Item 20')), Offset.zero);
expect(tester.getTopLeft(find.widgetWithText(SizedBox, 'Item 20')), Offset.zero);
// keepScrollOffset: false. The scroll offset is -not- restored
// when the ListView is recreated with a new ScrollController and
@ -359,7 +359,7 @@ void main() {
controller = ScrollController(keepScrollOffset: false, initialScrollOffset: 100.0);
await tester.pumpWidget(buildFrame(controller));
expect(controller.offset, 100.0);
expect(tester.getTopLeft(find.widgetWithText(Container, 'Item 1')), Offset.zero);
expect(tester.getTopLeft(find.widgetWithText(SizedBox, 'Item 1')), Offset.zero);
});
}

View file

@ -851,7 +851,7 @@ void main() {
child: ListView(
controller: controller,
children: kStates.map<Widget>((String state) {
return Container(
return SizedBox(
height: 200.0,
child: Text(state),
);

Some files were not shown because too many files have changed in this diff Show more