From d48f9f4bd0087814efffaad172aba1028a47de4a Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Sun, 24 May 2026 20:59:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(client):=20=E5=95=86=E5=93=81=E5=85=AC?= =?UTF-8?q?=E5=BC=80=E9=A1=B5=E6=9A=82=E6=97=A0=E5=9B=BE=E7=89=87=E6=97=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=A8=E5=BA=97=E5=90=8D=E9=A6=96=E5=AD=97?= =?UTF-8?q?=EF=BC=8C=E6=9B=BF=E6=8D=A2=E7=A1=AC=E7=BC=96=E7=A0=81=E5=B2=A9?= =?UTF-8?q?=E7=BE=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _EmptyGalleryContent 接收 shopName 参数,无图片时展示 门店名第一个字符的文字头像,不再显示品牌名。 Co-Authored-By: Claude Sonnet 4.6 --- .../screens/public/public_product_screen.dart | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/client/lib/screens/public/public_product_screen.dart b/client/lib/screens/public/public_product_screen.dart index 780ed72..732e782 100644 --- a/client/lib/screens/public/public_product_screen.dart +++ b/client/lib/screens/public/public_product_screen.dart @@ -130,7 +130,7 @@ class _PublicProductScreenState extends State { slivers: [ // 1. Gallery SliverToBoxAdapter( - child: _HeroGallery(imageUrls: imageUrls), + child: _HeroGallery(imageUrls: imageUrls, shopName: shop?['name'] as String? ?? ''), ), // 2. Verified ribbon SliverToBoxAdapter( @@ -227,7 +227,8 @@ class _PublicProductScreenState extends State { class _HeroGallery extends StatefulWidget { final List imageUrls; - const _HeroGallery({required this.imageUrls}); + final String shopName; + const _HeroGallery({required this.imageUrls, this.shopName = ''}); @override State<_HeroGallery> createState() => _HeroGalleryState(); @@ -280,7 +281,7 @@ class _HeroGalleryState extends State<_HeroGallery> { ), // Image or placeholder if (urls.isEmpty) - _EmptyGalleryContent() + _EmptyGalleryContent(shopName: widget.shopName) else PageView.builder( controller: _ctrl, @@ -291,7 +292,7 @@ class _HeroGalleryState extends State<_HeroGallery> { child: Image.network( urls[i], fit: BoxFit.contain, - errorBuilder: (_, __, ___) => _EmptyGalleryContent(), + errorBuilder: (_, __, ___) => _EmptyGalleryContent(shopName: widget.shopName), ), ), ), @@ -409,8 +410,12 @@ class _HeroGalleryState extends State<_HeroGallery> { } class _EmptyGalleryContent extends StatelessWidget { + final String shopName; + const _EmptyGalleryContent({this.shopName = ''}); + @override Widget build(BuildContext context) { + final initial = shopName.isNotEmpty ? shopName.characters.first : '店'; return Center( child: Column( mainAxisSize: MainAxisSize.min, @@ -421,9 +426,9 @@ class _EmptyGalleryContent extends StatelessWidget { color: const Color(0xFF0F3057), borderRadius: BorderRadius.circular(12), ), - child: const Center( - child: Text('岩美', - style: TextStyle(color: Colors.white70, fontSize: 18, fontWeight: FontWeight.w700)), + child: Center( + child: Text(initial, + style: const TextStyle(color: Colors.white70, fontSize: 28, fontWeight: FontWeight.w700)), ), ), const SizedBox(height: 12),