padding method
Adds padding around this widget.
Implementation
@widgetFactory
Widget padding({
double? start,
double? end,
double? left,
double? right,
double? top,
double? bottom,
double? horizontal,
double? vertical,
double? all,
EdgeInsetsGeometry? padding,
bool sliver = false,
}) {
assert(() {
_debugCheckParameterCombinations(modifier: 'padding', [
{'start': start, 'end': end},
{'left': left, 'right': right},
]);
_debugCheckParameterCombinations(modifier: 'padding', [
{
'start': start,
'end': end,
'left': left,
'right': right,
'top': top,
'bottom': bottom,
},
{'horizontal': horizontal, 'vertical': vertical},
{'all': all},
{'padding': padding},
]);
return true;
}());
if (padding == null) {
if (all != null) {
padding = EdgeInsets.all(all);
} else if (horizontal != null || vertical != null) {
padding = EdgeInsets.symmetric(
horizontal: horizontal ?? 0,
vertical: vertical ?? 0,
);
} else if (start != null || end != null) {
padding = EdgeInsetsDirectional.only(
start: start ?? 0,
end: end ?? 0,
top: top ?? 0,
bottom: bottom ?? 0,
);
} else {
padding = EdgeInsets.only(
left: left ?? 0,
right: right ?? 0,
top: top ?? 0,
bottom: bottom ?? 0,
);
}
}
if (sliver) {
return FleetSliverPadding(
padding: padding,
sliver: this,
);
} else {
return FleetPadding(
padding: padding,
child: this,
);
}
}