getInputBorder method

InputBorder? getInputBorder(
  1. Map? spec
)

Implementation

InputBorder? getInputBorder(Map? spec) {
  if (spec == null || spec.isEmpty) {
    return null;
  }

  final type = spec["_type"] ?? "default";
  final borderSide = BorderSide(
    color: parseColor(spec["color"], defaultColor: Colors.black),
    width: parseDouble(spec["width"], defaultValue: 1.0),
  );

  switch (type) {
    case "OutlineInputBorder":
      return OutlineInputBorder(
        borderSide: borderSide,
        borderRadius: getBorderRadius(spec["borderRadius"]) ??
            const BorderRadius.all(Radius.circular(4.0)),
        gapPadding: parseDouble(spec["gapPadding"], defaultValue: 4.0),
      );
    default:
      return UnderlineInputBorder(
          borderSide: borderSide,
          borderRadius: getBorderRadius(spec["borderRadius"]) ??
              const BorderRadius.only(
                  topLeft: Radius.circular(4.0),
                  topRight: Radius.circular(4.0)));
  }
}