Created
December 26, 2022 03:29
-
-
Save thuycom205/8a7791b4951dd37f4c1244822384088c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CacheImage buildCacheImage() { | |
if(item.product!.productType == ProductType.Configurable){ | |
if(item.product!.variants!=null&&item.product!.variants!.length > 0){ | |
if(item.product!.variants!.first.product!=null&& | |
item.product!.variants!.first.product!.mediaGallery!=null&& | |
item.product!.variants!.first.product!.mediaGallery!.isNotEmpty){ | |
return CacheImage( | |
imageUrl: item.product!.variants!.first.product!.mediaGallery!.first.url??"", | |
boxFit: BoxFit.cover, | |
); | |
}else{ | |
return CacheImage( | |
imageUrl: item.product!.image?.url ?? "", | |
boxFit: BoxFit.cover, | |
); | |
} | |
}else{ | |
return CacheImage( | |
imageUrl: item.product!.image?.url ?? "", | |
boxFit: BoxFit.cover, | |
); | |
} | |
} | |
return CacheImage( | |
imageUrl: item.product!.image?.url ?? "", | |
boxFit: BoxFit.cover, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment