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
128 changed files with 1350 additions and 1367 deletions

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()
),
);