prestashopImage static method

String prestashopImage(
  1. String url, [
  2. kSize? size = kSize.medium
])

Implementation

static String prestashopImage(String url, [kSize? size = kSize.medium]) {
  if (url.contains('?')) {
    switch (size) {
      case kSize.large:
        return url.replaceFirst('?', '/large_default?');
      case kSize.small:
        return url.replaceFirst('?', '/small_default?');
      default: // kSize.medium
        return url.replaceFirst('?', '/medium_default?');
    }
  }
  switch (size) {
    case kSize.large:
      return '$url/large_default';
    case kSize.small:
      return '$url/small_default';
    default: // kSize.medium
      return '$url/medium_default';
  }
}