Skip to main content

avoid-wrapping-in-padding

added in: 4.0.0
warning

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