marginStart method

ContainerBuilder marginStart(
  1. double value
)

margin-start / ms-{size} -> 设置开始方向的外边距(LTR 时为 left,RTL 时为 right)

Implementation

ContainerBuilder marginStart(double value) {
  if (_margin == null) {
    _margin = EdgeInsetsDirectional.only(start: value);
  } else if (_margin is EdgeInsetsDirectional) {
    final existing = _margin as EdgeInsetsDirectional;
    _margin = EdgeInsetsDirectional.only(
      start: existing.start + value,
      top: existing.top,
      end: existing.end,
      bottom: existing.bottom,
    );
  } else if (_margin is EdgeInsets) {
    // 如果之前使用的是 EdgeInsets,转换为 EdgeInsetsDirectional
    final existing = _margin as EdgeInsets;
    _margin = EdgeInsetsDirectional.only(
      start: value,
      top: existing.top,
      end: existing.right,
      bottom: existing.bottom,
    );
  }
  return this;
}