Skip to content

Commit

Permalink
chore: offDart270 - removed code now duplicate with off-dart 2.7.0 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurtanuki committed Jul 20, 2023
1 parent b9c6be7 commit 4a5cc50
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions packages/smooth_app/lib/helpers/product_cards_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -258,21 +258,6 @@ List<MapEntry<ProductImageData, ImageProvider?>> getSelectedImages(
return result.entries.toList();
}

// TODO(monsieurtanuki): move to off-dart in ImageHelper
String _getBarcodeSubPath(final String barcode) {
if (barcode.length < 9) {
return barcode;
}
final String p1 = barcode.substring(0, 3);
final String p2 = barcode.substring(3, 6);
final String p3 = barcode.substring(6, 9);
if (barcode.length == 9) {
return '$p1/$p2/$p3';
}
final String p4 = barcode.substring(9);
return '$p1/$p2/$p3/$p4';
}

String _getImageRoot() =>
OpenFoodAPIConfiguration.globalQueryType == QueryType.PROD
? 'https://images.openfoodfacts.org/images/products'
Expand All @@ -283,7 +268,7 @@ String getLocalizedProductImageUrl(
final ProductImage productImage,
) =>
'${_getImageRoot()}/'
'${_getBarcodeSubPath(product.barcode!)}/'
'${ImageHelper.getBarcodeSubPath(product.barcode!)}/'
'${ImageHelper.getProductImageFilename(productImage, imageSize: ImageSize.DISPLAY)}';

/// Returns the languages for which [imageField] has images for that [product].
Expand Down

0 comments on commit 4a5cc50

Please sign in to comment.