-
-
Notifications
You must be signed in to change notification settings - Fork 287
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
feat: image list gallery #2724
feat: image list gallery #2724
Conversation
523d7e4
to
d748bc6
Compare
Codecov Report
@@ Coverage Diff @@
## develop #2724 +/- ##
==========================================
- Coverage 8.86% 7.04% -1.83%
==========================================
Files 161 223 +62
Lines 6623 10679 +4056
==========================================
+ Hits 587 752 +165
- Misses 6036 9927 +3891
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@monsieurtanuki @M123-dev @g123k if you could give me an initial code review it would be great! |
@VaiTon For the record it's a "draft": not something reviewers spend time on spontaneously. Unless instructed to :) |
@VaiTon I don't mean to be rude but you don't provide any explanation on the PR and any |
Sorry! I really thought I put something in the body of the PR while I didn't 😆. For the Draft, I did that on purpose but I'd like your review code wise to continue this path or not. edit @monsieurtanuki added an explanation and a video! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @VaiTon!
Nothing that shocks me in your code, except the ignore_for_file: cast_nullable_to_non_nullable
that is definitely NOT a good idea and needs to be removed immediately.
Other suggestions:
- don't hesitate to put
///
comments - don't hesitate, instead of lousy
Widget _buildBlablabla
methods, to create a new widget in a new specific class (with its own///
comments, and maybe in its own specific file) - it's better for clarity and flutter performances
packages/smooth_app/lib/pages/product/product_image_gallery_view.dart
Outdated
Show resolved
Hide resolved
packages/smooth_app/lib/pages/product/product_image_gallery_view.dart
Outdated
Show resolved
Hide resolved
packages/smooth_app/lib/pages/product/product_image_gallery_view.dart
Outdated
Show resolved
Hide resolved
packages/smooth_app/lib/pages/product/product_image_viewer.dart
Outdated
Show resolved
Hide resolved
Havn't had a look at the code, but this is definitely great to have, AFAIK the images are the most important part of the product, so we should make it easy to edit and send them. We can use this and build upon. Some related issues:
|
The main issue I found while coding this is that at the moment we only have like 4 categories displayed instead of every image. For example the Nutella has lots of images on the website but on the app only 4 are displayed. |
Do we need to show more then that |
I don't know what we're supposed to display in Smoothie, but this is the data we get from the server (https://world.openfoodfacts.org/cgi/search.pl?code=3017620425035&json=1&search_terms=): "image_front_small_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/front_en.381.200.jpg",
"image_front_thumb_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/front_en.381.100.jpg",
"image_front_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/front_en.381.400.jpg",
"image_ingredients_small_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/ingredients_en.379.200.jpg",
"image_ingredients_thumb_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/ingredients_en.379.100.jpg",
"image_ingredients_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/ingredients_en.379.400.jpg",
"image_nutrition_small_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/nutrition_en.368.200.jpg",
"image_nutrition_thumb_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/nutrition_en.368.100.jpg",
"image_nutrition_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/nutrition_en.368.400.jpg",
"image_packaging_small_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/packaging_en.369.200.jpg",
"image_packaging_thumb_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/packaging_en.369.100.jpg",
"image_packaging_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/packaging_en.369.400.jpg",
"image_small_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/front_en.381.200.jpg",
"image_thumb_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/front_en.381.100.jpg",
"image_url": "https://images.openfoodfacts.org/images/products/301/762/042/5035/front_en.381.400.jpg", |
|
@monsieurtanuki the query that we do in the Android app is: /**
* Returns images for the current product
*
* @param barcode barcode for the current product
*/
@GET("$API_P/product/{barcode}.json?fields=images")
suspend fun getProductImages(@Path("barcode") barcode: String): ObjectNode |
@VaiTon Add |
Where should I do this? The idea was to query for all the images only in the gallery view |
…ta` to better reflect its work
Either you do that always for all products, and add Or you want specifically to extract those images only if the user goes to a specific page: then you have to Future<List<ProductImage>?> getFetchedProduct() async {
final ProductQueryConfiguration configuration = ProductQueryConfiguration(
barcode,
fields: [ProductQuery.IMAGES],
language: ProductQuery.getLanguage(),
country: ProductQuery.getCountry(),
);
final ProductResult result;
try {
result = await OpenFoodAPIClient.getProduct(configuration);
} catch (e) {
return null;
}
if (result.status == 1) {
final Product? product = result.product;
if (product != null) {
return product.images;
}
}
return null;
} But then you probably have to cache the results somehow... |
@monsieurtanuki thanks! I think that we maybe could do without caching for now, as editing images requires an internet connection to download them (as far as I understand) |
Ohh luckily I don't know kotlin if you have to |
Now it should display every image. I'm not understanding why they're not opening in full screen anymore though.. |
…dart Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com>
# Conflicts: # packages/smooth_app/lib/pages/product/edit_product_page.dart
ad2384f
to
dbcd334
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @VaiTon: the SmoothBackButton
is cool, but I have other comments too.
packages/smooth_app/lib/generic_lib/widgets/smooth_list_tile_card.dart
Outdated
Show resolved
Hide resolved
packages/smooth_app/lib/pages/product/product_image_viewer.dart
Outdated
Show resolved
Hide resolved
import 'package:smooth_app/generic_lib/widgets/smooth_product_image_container.dart'; | ||
import 'package:smooth_app/themes/constant_icons.dart'; | ||
|
||
class SmoothListTileCard extends StatelessWidget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The big misunderstanding is that I never imagined that you would display an image inside a "normal" ListTile
. I expected something similar to the website: tons of pictures in a grid.
I don't know if there were explicit expectations regarding UX/UI, but I must say I'm not a big fan of:
- all the waste space with no added value (the "title")
- the cropped image
- the image ratio
We should start from there: how is it supposed to look? @teolemon Are you OK with the latest screenshots?
Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com>
thanks 👍 |
So we can keep the list for the selected images and a grid for the unselected images? Even keeping a list we would be able to make some actions doable only for selected images |
I don't know the V1, but from what I see in the website it's a bit by chapter: front, ingredients, ... Let's imagine what we should display for each chapter (selected image with special power, and all the images). Something like that:
Btw @VaiTon I would happily (not happily, but seriously) review your code once we agree on the display and your generated screenshots. |
@VaiTon @monsieurtanuki here's what I have in Figma |
@monsieurtanuki would that be in a single page? Because unselected images do not have a field so we should display every unselected image for every field |
@teolemon which is what we have on android. I don't think that's really what we want because it does not separate the selected images from the unselected ones. |
So we could use that in 2 places:
|
Personally I had no expectations, except a grid, so I'm not really the person to ask. |
@teolemon what about |
@openfoodfacts/smooth-app any comments? Otherwise I'm implementing this one in a different PR. (50+ comments on this one) |
@VaiTon Your latest screenshot looks good, except that I would not display images with different aspect ratio for "selected" and "unselected" images. As in your screenshot you put 4 "unselected" images in a row, I guess you could put 2 "selected" images in a row with the same aspect ratio. |
In V1 (at least for android) we had a "Image gallery" page which would display the list of every image related to the product.
Here we have the carousel that gets activated whenever you click on the images (or click on edit images in the edit view) but it's not really a listing of every image related to the product.
That's why, as suggested by @teolemon, with this PR I'm implementing a product image gallery view as a list of clickable items. When a tile is clicked the corresponding image is opened (if existing) to be viewed/edited, or taken.
Below a video representing the flow:
2022-08-05.00-54-25.mp4
Updated screenshot