avif: updated gallery widget to display message for non supported avif image type

This commit is contained in:
Max Pylypenko
2025-10-12 00:46:37 +07:00
parent 93a11a16e4
commit 51c41c800e
9 changed files with 54 additions and 9 deletions

View File

@@ -471,6 +471,10 @@
},
"gallery": "Galeria",
"@gallery": {},
"galleryAvifNotSupported": "AVIF no és compatible",
"@galleryAvifNotSupported": {},
"galleryAvifNotSupportedDetail": "Les imatges AVIF encara no són compatibles.",
"@galleryAvifNotSupportedDetail": {},
"addImage": "Afegeix imatge",
"@addImage": {},
"dataCopied": "Dades copiades a una nova entrada",

View File

@@ -508,6 +508,10 @@
"@takePicture": {},
"gallery": "Galerie",
"@gallery": {},
"galleryAvifNotSupported": "AVIF není podporován",
"@galleryAvifNotSupported": {},
"galleryAvifNotSupportedDetail": "Obrazy AVIF zatím nejsou podporovány.",
"@galleryAvifNotSupportedDetail": {},
"productFound": "Produkt nalezen",
"@productFound": {
"description": "Header label for dialog when product is found with barcode"

View File

@@ -357,6 +357,10 @@
"@addImage": {},
"gallery": "Galerie",
"@gallery": {},
"galleryAvifNotSupported": "AVIF wird nicht unterstützt",
"@galleryAvifNotSupported": {},
"galleryAvifNotSupportedDetail": "AVIF-Bilder werden noch nicht unterstützt.",
"@galleryAvifNotSupportedDetail": {},
"chooseFromLibrary": "Wähle aus der Bibliothek",
"@chooseFromLibrary": {},
"takePicture": "Bild aufnehmen",

View File

@@ -680,6 +680,10 @@
"@chooseFromLibrary": {},
"gallery": "Gallery",
"@gallery": {},
"galleryAvifNotSupported": "AVIF not supported",
"@galleryAvifNotSupported": {},
"galleryAvifNotSupportedDetail": "AVIF images are not supported yet.",
"@galleryAvifNotSupportedDetail": {},
"addImage": "Add image",
"@addImage": {},
"dataCopied": "Data copied to new entry",
@@ -1032,4 +1036,4 @@
"darkMode": "Always dark mode",
"lightMode": "Always light mode",
"systemMode": "System settings"
}
}

View File

@@ -344,6 +344,10 @@
"@addImage": {},
"gallery": "Galería",
"@gallery": {},
"galleryAvifNotSupported": "AVIF no compatible",
"@galleryAvifNotSupported": {},
"galleryAvifNotSupportedDetail": "Las imágenes AVIF aún no son compatibles.",
"@galleryAvifNotSupportedDetail": {},
"chooseFromLibrary": "Elije de la biblioteca de fotos",
"@chooseFromLibrary": {},
"takePicture": "Toma una foto",

View File

@@ -354,6 +354,10 @@
"@addImage": {},
"gallery": "Galerie",
"@gallery": {},
"galleryAvifNotSupported": "AVIF non pris en charge",
"@galleryAvifNotSupported": {},
"galleryAvifNotSupportedDetail": "AVIF non pris en charge",
"@galleryAvifNotSupportedDetail": {},
"chooseFromLibrary": "Choisir depuis la bibliothèque",
"@chooseFromLibrary": {},
"takePicture": "Prendre une photo",

View File

@@ -473,6 +473,10 @@
"@chooseFromLibrary": {},
"gallery": "Gallery",
"@gallery": {},
"galleryAvifNotSupported": "AVIFはサポートされていません",
"@galleryAvifNotSupported": {},
"galleryAvifNotSupportedDetail": "AVIF形式の画像はまだサポートされていません。",
"@galleryAvifNotSupportedDetail": {},
"addImage": "Add image",
"@addImage": {},
"dataCopied": "Data copied to new entry",

View File

@@ -479,6 +479,10 @@
"@chooseFromLibrary": {},
"gallery": "Галерея",
"@gallery": {},
"galleryAvifNotSupported": "AVIF не підтримується",
"@galleryAvifNotSupported": {},
"galleryAvifNotSupportedDetail": "Зображення AVIF поки що не підтримуються.",
"@galleryAvifNotSupportedDetail": {},
"addImage": "Додати зображення",
"@addImage": {},
"dataCopied": "Дані скопійовано до нового запису",

View File

@@ -35,6 +35,7 @@ class Gallery extends StatelessWidget {
@override
Widget build(BuildContext context) {
final provider = Provider.of<GalleryProvider>(context);
final i18n = AppLocalizations.of(context);
return Padding(
padding: const EdgeInsets.all(5),
@@ -57,13 +58,20 @@ class Gallery extends StatelessWidget {
context: context,
);
},
child: FadeInImage(
key: Key('image-${currentImage.id!}'),
placeholder: const AssetImage('assets/images/placeholder.png'),
image: NetworkImage(currentImage.url!),
fit: BoxFit.cover,
imageSemanticLabel: currentImage.description,
),
child: currentImage.url!.toLowerCase().endsWith('.avif')
? AspectRatio(
aspectRatio: 1,
child: Center(
child: Text(i18n.galleryAvifNotSupported),
),
)
: FadeInImage(
key: Key('image-${currentImage.id!}'),
placeholder: const AssetImage('assets/images/placeholder.png'),
image: NetworkImage(currentImage.url!),
fit: BoxFit.cover,
imageSemanticLabel: currentImage.description,
),
);
},
),
@@ -82,6 +90,7 @@ class ImageDetail extends StatelessWidget {
@override
Widget build(BuildContext context) {
final i18n = AppLocalizations.of(context);
return Container(
key: Key('image-${image.id!}-detail'),
padding: const EdgeInsets.all(10),
@@ -92,7 +101,11 @@ class ImageDetail extends StatelessWidget {
style: Theme.of(context).textTheme.headlineSmall,
),
Expanded(
child: Image.network(image.url!, semanticLabel: image.description),
child: image.url!.toLowerCase().endsWith('.avif')
? Center(
child: Text(i18n.galleryAvifNotSupportedDetail),
)
: Image.network(image.url!, semanticLabel: image.description),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),