collapse method

Margins collapse()

Auto margins already have a "value" of zero so can be considered collapsed.

Implementation

Margins collapse() => Margins(
      left: left?.unit == Unit.auto ? left : Margin(0, Unit.px),
      right: right?.unit == Unit.auto ? right : Margin(0, Unit.px),
      top: top?.unit == Unit.auto ? top : Margin(0, Unit.px),
      bottom: bottom?.unit == Unit.auto ? bottom : Margin(0, Unit.px),
    );