Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: offDart270 - removed code now duplicate with off-dart 2.7.0 #4343

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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