Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

reduce false positive for sized_box_for_whitespace #2067

Merged
merged 1 commit into from
Apr 16, 2020

Conversation

a14n
Copy link
Contributor

@a14n a14n commented Apr 15, 2020

Description

Following my comment on the initial PR there are some cases with behaviour changes. For instance the following change doesn't display the same thing (you can try it in dartpad):

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Column(
        children: [
-          ColoredBox(color: Colors.red, child: Container(height: 80)),
+          ColoredBox(color: Colors.red, child: SizedBox(height: 80)),
          SizedBox(height: 80),
-          ColoredBox(color: Colors.blue, child: Container(height: 80)),
+          ColoredBox(color: Colors.blue, child: SizedBox(height: 80)),
        ],
      ),
    );
  }
}

Basically it works with a child or with both width and height.

@a14n
Copy link
Contributor Author

a14n commented Apr 15, 2020

/cc @domesticmouse

@domesticmouse
Copy link
Member

@a14n thanks for the clarification, much appreciated

Copy link
Member

@pq pq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💎

@pq pq merged commit a77e9a2 into dart-lang:master Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants