getShapeBorder method

OutlinedBorder? getShapeBorder(
  1. Map? spec
)

Implementation

OutlinedBorder? getShapeBorder(Map? spec) {
  if (spec == null || spec.isEmpty) return null;

  final borderRadius =
      getBorderRadius(spec["borderRadius"]) ?? BorderRadius.zero;
  BorderSide borderSide = BorderSide.none;
  if (spec["color"] != null && spec["width"] != null) {
    borderSide = BorderSide(
      color: parseColor(spec["color"], defaultColor: Colors.black),
      width: parseDouble(spec["width"], defaultValue: 1.0),
    );
  }

  switch (spec["type"]) {
    case "roundedRectangle":
      return RoundedRectangleBorder(
          side: borderSide, borderRadius: borderRadius);
    case "beveledRectangle":
      return BeveledRectangleBorder(
          side: borderSide, borderRadius: borderRadius);
    case "continuousRectangle":
      return ContinuousRectangleBorder(
          side: borderSide, borderRadius: borderRadius);
    case "circle":
      return CircleBorder(side: borderSide);
    default:
      return null;
  }
}