margin method
A modifier that insets margin around its widget by the given value(s).
Example:
This snippet creates "Hello World!" Text inside a Card that has margin around it by sixteen pixels in each direction.
Card(child:
Text('Hello World!')
.padding(all: 16),
)
Implementation
Widget margin({
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(margin: insets);
}
return Container(child: this, margin: insets);
}