marginEnd method
margin-end / me-{size} -> 设置结束方向的外边距(LTR 时为 right,RTL 时为 left)
Implementation
ContainerBuilder marginEnd(double value) {
if (_margin == null) {
_margin = EdgeInsetsDirectional.only(end: value);
} else if (_margin is EdgeInsetsDirectional) {
final existing = _margin as EdgeInsetsDirectional;
_margin = EdgeInsetsDirectional.only(
start: existing.start,
top: existing.top,
end: existing.end + value,
bottom: existing.bottom,
);
} else if (_margin is EdgeInsets) {
// 如果之前使用的是 EdgeInsets,转换为 EdgeInsetsDirectional
final existing = _margin as EdgeInsets;
_margin = EdgeInsetsDirectional.only(
start: existing.left,
top: existing.top,
end: value,
bottom: existing.bottom,
);
}
return this;
}