padding method

  1. @widgetFactory
Widget padding({
  1. double? start,
  2. double? end,
  3. double? left,
  4. double? right,
  5. double? top,
  6. double? bottom,
  7. double? horizontal,
  8. double? vertical,
  9. double? all,
  10. EdgeInsetsGeometry? padding,
  11. bool sliver = false,
})

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