spacingCustom method

EdgeInsets spacingCustom({
  1. required AFSpacing spacing,
  2. int? horizontal,
  3. int? vertical,
  4. int? top,
  5. int? bottom,
  6. int? left,
  7. int? right,
  8. int? all,
})

Implementation

EdgeInsets spacingCustom({
  required AFSpacing spacing,
  int? horizontal,
  int? vertical,
  int? top,
  int? bottom,
  int? left,
  int? right,
  int? all
}) {
  final basicSizes = spacing.sizes;
  const m = 0.0;
  var t = m;
  var b = m;
  var l = m;
  var r = m;
  if(all != null) {
    assert(all >= 0 && all < 6, badSizeIndexError);
    final ms = basicSizes[all];
    t = ms;
    b = ms;
    l = ms;
    r = ms;
  }
  if(vertical != null) {
    assert(vertical >= 0 && vertical < 6, badSizeIndexError);
    final ms = basicSizes[vertical];
    b = ms;
    t = ms;
  }
  if(horizontal != null) {
    assert(horizontal >= 0 && horizontal < 6, badSizeIndexError);
    final ms = basicSizes[horizontal];
    l = ms;
    r = ms;
  }
  if(top != null) {
    assert(top >= 0 && top < 6, badSizeIndexError);
    t = basicSizes[top];
  }
  if(bottom != null) {
    assert(bottom >= 0 && bottom < 6, badSizeIndexError);
    b = basicSizes[bottom];
  }
  if(left != null) {
    assert(left >= 0 && left < 6, badSizeIndexError);
    l = basicSizes[left];
  }
  if(right != null) {
    assert(right >= 0 && right < 6, badSizeIndexError);
    r = basicSizes[right];
  }

  return EdgeInsets.fromLTRB(l, t, r, b);
}