getShape function

OutlinedBorder getShape({
  1. required CShapeBorder shape,
  2. required CornerRadius radius,
  3. ColorRGBA? borderColor,
  4. double? borderWidth,
})

Implementation

OutlinedBorder getShape({
  required CShapeBorder shape,
  required CornerRadius radius,
  ColorRGBA? borderColor,
  double? borderWidth,
}) {
  final BorderSide side =
      borderColor != null && borderWidth != null && borderWidth > 0
          ? BorderSide(
              color: borderColor.toFlutterColor(),
              width: borderWidth,
            )
          : BorderSide.none;

  switch (shape) {
    case CShapeBorder.rectangle:
      return RoundedRectangleBorder(side: side);
    case CShapeBorder.circle:
      return CircleBorder(side: side);
    case CShapeBorder.stadium:
      return StadiumBorder(side: side);
    case CShapeBorder.roundedRectangle:
      return RoundedRectangleBorder(
        borderRadius: radius.borderRadius,
        side: side,
      );
    case CShapeBorder.continuousRectangle:
      return ContinuousRectangleBorder(
        borderRadius: radius.borderRadius,
        side: side,
      );
    case CShapeBorder.beveledRectangle:
      return BeveledRectangleBorder(
        borderRadius: radius.borderRadius,
        side: side,
      );
  }
}