From 183ef7ba667c34748c2a93cf0326615ee6fa9fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20M=C3=B6ltgen?= <39344769+M123-dev@users.noreply.github.com> Date: Sun, 19 Jun 2022 11:29:02 +0200 Subject: [PATCH] fix: The photo sections should not move after photo upload (#2297) * fix: Don't reorder uploaded images * Update add_new_product_page.dart --- .../pages/product/add_new_product_page.dart | 25 +++++++++++-------- packages/smooth_app/pubspec.lock | 12 ++++----- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/packages/smooth_app/lib/pages/product/add_new_product_page.dart b/packages/smooth_app/lib/pages/product/add_new_product_page.dart index dd35bdb5f58..4440f8442ba 100644 --- a/packages/smooth_app/lib/pages/product/add_new_product_page.dart +++ b/packages/smooth_app/lib/pages/product/add_new_product_page.dart @@ -102,20 +102,23 @@ class _AddNewProductPageState extends State { // "other photos" uploaded by the user. if (imageType == ImageField.OTHER) { rows.add(_buildAddImageButton(context, imageType)); - continue; - } - // Everything else can only be uploaded once, skip building the - // "Add Image button" if an image for this type is already uploaded. - if (!_isImageUploadedForType(imageType)) { - rows.add(_buildAddImageButton(context, imageType)); - } - } - // Now build rows for images that are already uploaded. - for (final ImageField imageType in ImageField.values) { - if (_isImageUploadedForType(imageType)) { for (final File image in _uploadedImages[imageType]!) { rows.add(_buildImageUploadedRow(context, imageType, image)); } + continue; + } + + // Everything else can only be uploaded once + if (_isImageUploadedForType(imageType)) { + rows.add( + _buildImageUploadedRow( + context, + imageType, + _uploadedImages[imageType]![0], + ), + ); + } else { + rows.add(_buildAddImageButton(context, imageType)); } } return rows; diff --git a/packages/smooth_app/pubspec.lock b/packages/smooth_app/pubspec.lock index 7e385d728ce..d29a5570bc9 100644 --- a/packages/smooth_app/pubspec.lock +++ b/packages/smooth_app/pubspec.lock @@ -493,7 +493,7 @@ packages: name: glob url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.0" google_mlkit_barcode_scanning: dependency: "direct main" description: @@ -584,7 +584,7 @@ packages: name: image_picker_android url: "https://pub.dartlang.org" source: hosted - version: "0.8.5" + version: "0.8.5+1" image_picker_for_web: dependency: transitive description: @@ -759,7 +759,7 @@ packages: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.0" package_info_plus: dependency: "direct main" description: @@ -836,14 +836,14 @@ packages: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.14" + version: "2.0.15" path_provider_ios: dependency: transitive description: name: path_provider_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.10" path_provider_linux: dependency: transitive description: @@ -1289,7 +1289,7 @@ packages: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.12" url_launcher_windows: dependency: transitive description: