Bladeren bron

1223 商品详情图返回错误时去掉占位图片

tags/0.0.3+1
23028876916@qq.com 3 jaren geleden
bovenliggende
commit
6eda82d30f
1 gewijzigde bestanden met toevoegingen van 22 en 21 verwijderingen
  1. +22
    -21
      lib/widgets/goods_details/detail_img/goods_details_img.dart

+ 22
- 21
lib/widgets/goods_details/detail_img/goods_details_img.dart Bestand weergeven

@@ -19,8 +19,7 @@ class GoodsDetailsImgWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocProvider<GoodsDetailsImgBloc>(
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<GoodsDetailsImgWidgetContainer> {
class _GoodsDetailsImgWidgetContainerState extends State<GoodsDetailsImgWidgetContainer> {
@override
void initState() {
BlocProvider.of<GoodsDetailsImgBloc>(context)
.add(GoodsDetailsImgInitEvent(model: widget?.model));
BlocProvider.of<GoodsDetailsImgBloc>(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)),
],
);
}


Laden…
Annuleren
Opslaan