Skip to main content

Avoid wrapping in padding

Rule id

avoid-wrapping-in-padding

Severity

Warning

Description

Warns when a widget is wrapped in a Padding widget but has a padding settings by itself.

Example

Bad:

class CoolWidget {
...

Widget build(...) {
// LINT
return Padding(
child: Container(),
);
}
}

Good:

class CoolWidget {
Widget build() {
return Container();
}
}

class AnotherWidget {
Widget build() {
return Padding(
child: Icon();
);
}
}