Pad constructor

const Pad({
  1. double all = 0,
  2. double vertical = 0,
  3. double horizontal = 0,
  4. double left = 0,
  5. double top = 0,
  6. double right = 0,
  7. double bottom = 0,
})

Creates insets with the given values:

  • top, bottom, left and right pixels.
  • all pixels will be added to the top, bottom, left and right.
  • vertical pixels will be added to the top and bottom.
  • horizontal pixels will be added to the left and right.

You can also compose paddings. For example, for all directions with 40 pixels of padding, except the top with 50 pixels:

Pad(all: 40, top: 10);

Note constructor parameters all, vertical and horizontal are used only to compose the final padding value. The resulting Pad object contains only left/right/top/bottom. For example:

Pad(all: 40, vertical: 5, top: 10).top == (40 + 5 + 10) == 55;

Implementation

const Pad({
  double all = 0,
  double vertical = 0,
  double horizontal = 0,
  double left = 0,
  double top = 0,
  double right = 0,
  double bottom = 0,
}) : super.fromLTRB(
        all + left + horizontal,
        all + top + vertical,
        all + right + horizontal,
        all + bottom + vertical,
      );