spaceUtilityBuilder<T extends SpaceAttribute> function

EdgeInsetsGeometry spaceUtilityBuilder<T extends SpaceAttribute>(
  1. List<Attribute> attributes
)

Builds a Margin Traits

Implementation

EdgeInsetsGeometry spaceUtilityBuilder<T extends SpaceAttribute>(
  List<Attribute> attributes,
) {
  assert(T != SpaceAttribute);
  double? left;
  double? top;
  double? right;
  double? bottom;

  for (final attr in attributes) {
    /// Only if its of type T
    if (attr is T) {
      if (attr.left != null) {
        left = attr.left;
      }
      if (attr.top != null) {
        top = attr.top;
      }
      if (attr.right != null) {
        right = attr.right;
      }
      if (attr.bottom != null) {
        bottom = attr.bottom;
      }
    }
  }

  return EdgeInsets.only(
    left: left ?? 0.0,
    right: right ?? 0.0,
    top: top ?? 0.0,
    bottom: bottom ?? 0.0,
  );
}