useExistingPhotoFor static method
Implementation
static Future<CropParameters?> useExistingPhotoFor({
required BuildContext context,
required ProductImage rawImage,
required String barcode,
required ImageField imageField,
required bool isLoggedInMandatory,
required ProductType? productType,
required OpenFoodFactsLanguage language,
}) async {
final LocalDatabase localDatabase = context.read<LocalDatabase>();
final File? imageFile = await downloadImageUrl(
context,
rawImage.getUrl(
barcode,
imageSize: ImageSize.ORIGINAL,
uriHelper: ProductQuery.getUriProductHelper(productType: productType),
),
DaoInt(localDatabase),
);
if (imageFile == null || !context.mounted) {
return null;
}
return Navigator.of(context).push<CropParameters>(
MaterialPageRoute<CropParameters>(
builder: (BuildContext context) => CropPage(
inputFile: imageFile,
initiallyDifferent: true,
isLoggedInMandatory: isLoggedInMandatory,
cropHelper: ProductCropAgainHelper(
barcode: barcode,
productType: productType,
imageField: imageField,
imageId: int.parse(rawImage.imgid!),
language: language,
),
),
fullscreenDialog: true,
),
);
}