public static ShapeDecoration fromBoxDecoration(BoxDecoration source) { ShapeBorder shape = null; switch (source.shape) { case BoxShape.circle: if (source.border != null) { D.assert(source.border.isUniform); shape = new CircleBorder(side: source.border.top); } else { shape = new CircleBorder(); } break; case BoxShape.rectangle: if (source.borderRadius != null) { D.assert(source.border == null || source.border.isUniform); shape = new RoundedRectangleBorder( side: source.border?.top ?? BorderSide.none, borderRadius: source.borderRadius ); } else { shape = source.border ?? new Border(); } break; } return(new ShapeDecoration( color: source.color, image: source.image, gradient: source.gradient, shadows: source.boxShadow, shape: shape )); }
public _BoxDecorationPainter(BoxDecoration decoration, VoidCallback onChanged) : base(onChanged) { D.assert(decoration != null); this._decoration = decoration; }