diff --git a/lib/widgets/goods_details/detail_img/goods_details_img.dart b/lib/widgets/goods_details/detail_img/goods_details_img.dart index b3d3593..3e5d68b 100644 --- a/lib/widgets/goods_details/detail_img/goods_details_img.dart +++ b/lib/widgets/goods_details/detail_img/goods_details_img.dart @@ -19,8 +19,7 @@ class GoodsDetailsImgWidget extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( - create: (_) => - GoodsDetailsImgBloc(repository: GoodsDetailsImgRepository()), + create: (_) => GoodsDetailsImgBloc(repository: GoodsDetailsImgRepository()), //..add(GoodsDetailsImgInitEvent(model: model)), child: GoodsDetailsImgWidgetContainer( model, @@ -36,16 +35,13 @@ class GoodsDetailsImgWidgetContainer extends StatefulWidget { const GoodsDetailsImgWidgetContainer(this.model, {Key key}) : super(key: key); @override - _GoodsDetailsImgWidgetContainerState createState() => - _GoodsDetailsImgWidgetContainerState(); + _GoodsDetailsImgWidgetContainerState createState() => _GoodsDetailsImgWidgetContainerState(); } -class _GoodsDetailsImgWidgetContainerState - extends State { +class _GoodsDetailsImgWidgetContainerState extends State { @override void initState() { - BlocProvider.of(context) - .add(GoodsDetailsImgInitEvent(model: widget?.model)); + BlocProvider.of(context).add(GoodsDetailsImgInitEvent(model: widget?.model)); super.initState(); } @@ -99,8 +95,7 @@ class _GoodsDetailsImgWidgetContainerState return GestureDetector( onTap: () { if (item != null) { - PhotoPreview.showPhotoPreviewByimages(context, [item], - currentIndex: 0, heroTagSuffix: "bottom"); + PhotoPreview.showPhotoPreviewByimages(context, [item], currentIndex: 0, heroTagSuffix: "bottom"); } }, child: Hero( @@ -109,18 +104,27 @@ class _GoodsDetailsImgWidgetContainerState imageUrl: item ?? '', fit: BoxFit.fitWidth, // 默认default图片 - placeholder: (context, url){ + placeholder: (context, url) { return AspectRatio( - aspectRatio: 1/1, - child: _shimmerWidget(height: double.infinity, width: double.infinity,), + aspectRatio: 1 / 1, + child: _shimmerWidget( + height: double.infinity, + width: double.infinity, + ), ); }, - progressIndicatorBuilder: (context, url ,progress){ + progressIndicatorBuilder: (context, url, progress) { return AspectRatio( - aspectRatio: 1/1, - child: _shimmerWidget(height: double.infinity, width: double.infinity,), + aspectRatio: 1 / 1, + child: _shimmerWidget( + height: double.infinity, + width: double.infinity, + ), ); }, + errorWidget: (BuildContext context, String url, dynamic error) { + return Container(); + }, ), )); }).toList(), @@ -136,8 +140,7 @@ class _GoodsDetailsImgWidgetContainerState color: Colors.white, margin: const EdgeInsets.only(top: 6), width: double.infinity, - padding: - const EdgeInsets.only(top: 15, bottom: 15, left: 12.5, right: 12.5), + padding: const EdgeInsets.only(top: 15, bottom: 15, left: 12.5, right: 12.5), child: _getLeftWidget(model), ); } @@ -152,9 +155,7 @@ class _GoodsDetailsImgWidgetContainerState ), const SizedBox(width: 2.5), Text(model?.title ?? '商品详情', - style: TextStyle( - color: HexColor.fromHex(model?.title_color ?? '#333333'), - fontSize: 12)), + style: TextStyle(color: HexColor.fromHex(model?.title_color ?? '#333333'), fontSize: 12)), ], ); }