fix gallery

This commit is contained in:
Phuoc Nguyen
2025-11-17 16:08:20 +07:00
parent ff3629d6d1
commit 0798b28db5
5 changed files with 118 additions and 53 deletions

32
docs/review.sh Normal file
View File

@@ -0,0 +1,32 @@
# create review
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.item_feedback.update' \
--header 'Cookie: sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; full_name=Ha%20Duy%20Lam; sid=42ab54811fb7eadc8c67a6651c68519c8655e9b3e7b797628dcd0b88; system_user=yes; user_id=lamhd%40gmail.com; user_image=' \
--header 'X-Frappe-Csrf-Token: a22fa53eeaa923f71f2fd879d2863a0985a6f2107f5f7f66d34cd62d' \
--header 'Content-Type: application/json' \
--data-raw '{
"item_id": "Gạch ốp Signature SIG.P-8806",
"rating" : 0.5,
"comment" : "Good job 2",
"name" : "ITEM-Gạch ốp Signature SIG.P-8806-tiennld6@dbiz.com"
}'
# delete review
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.item_feedback.delete' \
--header 'Cookie: sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; full_name=Ha%20Duy%20Lam; sid=42ab54811fb7eadc8c67a6651c68519c8655e9b3e7b797628dcd0b88; system_user=yes; user_id=lamhd%40gmail.com; user_image=' \
--header 'X-Frappe-Csrf-Token: a22fa53eeaa923f71f2fd879d2863a0985a6f2107f5f7f66d34cd62d' \
--header 'Content-Type: application/json' \
--data-raw '{
"name" : "ITEM-Gạch ốp Signature SIG.P-8806-tiennld6@dbiz.com"
}'
#get list review
curl --location 'https://land.dbiz.com//api/method/building_material.building_material.api.item_feedback.get_list' \
--header 'Cookie: sid=a0c9a51c8d1fbbec824283115094bdca939bb829345e0005334aa99f; full_name=Ha%20Duy%20Lam; sid=42ab54811fb7eadc8c67a6651c68519c8655e9b3e7b797628dcd0b88; system_user=yes; user_id=lamhd%40gmail.com; user_image=' \
--header 'X-Frappe-Csrf-Token: a22fa53eeaa923f71f2fd879d2863a0985a6f2107f5f7f66d34cd62d' \
--header 'Content-Type: application/json' \
--data '{
"limit_page_length" : 10,
"limit_start" : 0,
"item_id" : "GIB20 G04"
}'

View File

@@ -491,6 +491,7 @@
DEVELOPMENT_TEAM = 9R5X2DM2C8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "DBIZ Partner";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -674,6 +675,7 @@
DEVELOPMENT_TEAM = 9R5X2DM2C8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "DBIZ Partner";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -697,6 +699,7 @@
DEVELOPMENT_TEAM = 9R5X2DM2C8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "DBIZ Partner";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",

View File

@@ -19,9 +19,9 @@ import 'package:worker/features/products/domain/entities/product.dart';
/// - Image indicators (dots)
/// - Thumbnail gallery row (horizontal scroll)
class ImageGallerySection extends StatefulWidget {
final Product product;
const ImageGallerySection({super.key, required this.product});
final Product product;
@override
State<ImageGallerySection> createState() => _ImageGallerySectionState();
@@ -203,48 +203,78 @@ class _ImageGallerySectionState extends State<ImageGallerySection> {
// Thumbnail Gallery
if (images.length > 1)
Container(
height: 92,
padding: const EdgeInsets.all(16),
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: images.length,
itemBuilder: (context, index) {
final isActive = _currentImageIndex == index;
return GestureDetector(
onTap: () => _changeImage(index),
child: Container(
width: 60,
height: 60,
margin: const EdgeInsets.only(right: 12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: isActive
? AppColors.primaryBlue
: Colors.transparent,
width: 2,
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: CachedNetworkImage(
imageUrl: images[index],
fit: BoxFit.cover,
placeholder: (context, url) =>
Container(color: AppColors.grey100),
errorWidget: (context, url, error) => Container(
color: AppColors.grey100,
child: const Icon(
FontAwesomeIcons.image,
size: 20,
color: AppColors.grey500,
child: SizedBox(
height: 80,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: images.length,
itemBuilder: (context, index) {
final isActive = _currentImageIndex == index;
final imageUrl = images[index];
final imageName = widget.product.imageCaptions[imageUrl];
return GestureDetector(
onTap: () => _changeImage(index),
child: Container(
margin: const EdgeInsets.only(right: 12),
child: Column(
mainAxisSize: .min,
mainAxisAlignment: .end,
children: [
// Image name above thumbnail (only show for active/selected)
if (isActive && imageName != null && imageName.isNotEmpty)
Padding(
padding: const EdgeInsets.only(bottom: 4),
child: Text(
imageName,
style: const TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: AppColors.primaryBlue,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
// Thumbnail image
Container(
width: 60,
height: 60,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: isActive
? AppColors.primaryBlue
: Colors.transparent,
width: 2,
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: CachedNetworkImage(
imageUrl: imageUrl,
fit: BoxFit.cover,
placeholder: (context, url) =>
Container(color: AppColors.grey100),
errorWidget: (context, url, error) => Container(
color: AppColors.grey100,
child: const Icon(
FontAwesomeIcons.image,
size: 20,
color: AppColors.grey500,
),
),
),
),
),
),
],
),
),
),
);
},
);
},
),
),
),
],
@@ -255,15 +285,15 @@ class _ImageGallerySectionState extends State<ImageGallerySection> {
/// Image Lightbox for full-screen image viewing
class _ImageLightbox extends StatefulWidget {
final List<String> images;
final Map<String, String> imageCaptions;
final int initialIndex;
const _ImageLightbox({
required this.images,
required this.imageCaptions,
required this.initialIndex,
});
final List<String> images;
final Map<String, String> imageCaptions;
final int initialIndex;
@override
State<_ImageLightbox> createState() => _ImageLightboxState();

View File

@@ -912,10 +912,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
url: "https://pub.dev"
source: hosted
version: "1.16.0"
version: "1.17.0"
mime:
dependency: transitive
description:
@@ -1437,26 +1437,26 @@ packages:
dependency: transitive
description:
name: test
sha256: "65e29d831719be0591f7b3b1a32a3cda258ec98c58c7b25f7b84241bc31215bb"
sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7"
url: "https://pub.dev"
source: hosted
version: "1.26.2"
version: "1.26.3"
test_api:
dependency: transitive
description:
name: test_api
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
url: "https://pub.dev"
source: hosted
version: "0.7.6"
version: "0.7.7"
test_core:
dependency: transitive
description:
name: test_core
sha256: "80bf5a02b60af04b09e14f6fe68b921aad119493e26e490deaca5993fef1b05a"
sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0"
url: "https://pub.dev"
source: hosted
version: "0.6.11"
version: "0.6.12"
timing:
dependency: transitive
description:
@@ -1650,5 +1650,5 @@ packages:
source: hosted
version: "2.1.0"
sdks:
dart: ">=3.9.2 <4.0.0"
dart: ">=3.10.0 <4.0.0"
flutter: ">=3.35.0"

View File

@@ -16,10 +16,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+3
version: 1.0.0+4
environment:
sdk: ^3.9.2
sdk: ^3.10.0
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions