getFit static method

BoxFit getFit(
  1. String? fit
)

how the image will fit within the space it is given

Implementation

static BoxFit getFit(String? fit) {
  var boxFit = BoxFit.cover;

  if (isNullOrEmpty(fit)) return boxFit;
  fit = fit!.toLowerCase();

  switch (fit) {
    case 'cover':
      boxFit = BoxFit.cover;
      break;
    case 'fitheight':
    case 'height':
      boxFit = BoxFit.fitHeight;
      break;
    case 'fitwidth':
    case 'width':
      boxFit = BoxFit.fitWidth;
      break;
    case 'fill':
      boxFit = BoxFit.fill;
      break;
    case 'contain':
      boxFit = BoxFit.contain;
      break;
    case 'scaledown':
    case 'scale':
      boxFit = BoxFit.scaleDown;
      break;
    case 'none':
      boxFit = BoxFit.none;
      break;
    default:
      boxFit = BoxFit.cover;
  }
  return boxFit;
}