openfoodfacts / smooth-app

The new Open Food Facts mobile application for Android and iOS, crafted with Flutter and Dart
https://world.openfoodfacts.org/open-food-facts-mobile-app?utm_source=off&utf_medium=web&utm_campaign=github-repo
Apache License 2.0
742 stars 260 forks source link

The photo list performs very badly #5445

Closed g123k closed 5 days ago

g123k commented 6 days ago

Hi everyone,

During the demo at CommuniTea, I have noticed that the screen containing the list of photos performs really badly with lots of frame drops.

https://github.com/openfoodfacts/smooth-app/assets/246838/86000ba3-61a5-41b0-8756-d351dfe2926e

monsieurtanuki commented 6 days ago

@g123k I confirm my first impression that computing the background color of the date tag from the image palette is not a good idea UI/UX-wise, as it implicitly tells that background colors have a meaning, where they don't.

Besides, as I commented here, you're somehow downloading the image twice just for that palette effect.

It also looks like the biggest version of the picture is downloaded. A 400px version would probably make sense for a gallery. A fix would be to download only the more relevant ImageSize version in ProductImageWidget, something like that:

        widget.productImage.getUrl(
          widget.barcode,
          uriHelper: ProductQuery.uriProductHelper,
          imageSize: _computeBestImageSize(),
        ),
// ...
ImageSize? _computeBestImageSize() {
  if (squareSize <= 400) {
    return ImageSize.DISPLAY;
  }
  return null;
}