avoid-wrapping-in-padding
Warns when a widget is wrapped in a Padding
widget but has padding settings by itself.
Example
❌ Bad:
class CoolWidget {
...
Widget build(...) {
// LINT: Avoid wrapping a 'Container' into a 'Padding' widget. Try using the 'padding' argument of the 'Container' widget directly.
return Padding(
child: Container(),
);
}
}
✅ Good:
class CoolWidget {
Widget build() {
return Container();
}
}
class AnotherWidget {
Widget build() {
return Padding(
child: Icon();
);
}
}