padding method
A modifier that insets its widget by the given padding.
Example:
This snippet creates "Hello World!" Text inside a Card that is indented by sixteen pixels in each direction.
Card(child:
Text('Hello World!')
.padding(all: 16),
)
Implementation
Widget padding({
double? all,
double? top,
double? bottom,
double? leading,
double? trailing,
double? horizontal,
double? vertical,
bool handover = true,
}) {
final insets = _insets(
all: all,
top: top,
bottom: bottom,
leading: leading,
trailing: trailing,
horizontal: horizontal,
vertical: vertical,
);
if (handover && this is Container) {
return (this as Container)._rebase(padding: insets);
}
return Padding(child: this, padding: insets);
}