@@ -205,68 +205,82 @@ List<BoxShadow> wsBoxShadow({double blurRadius}) {
205205
206206Widget wsCardProductItem (BuildContext context,
207207 {int index, Product product, onTap}) {
208- return InkWell (
209- child: Container (
210- padding: EdgeInsets .all (10 ),
211- margin: EdgeInsets .all (5 ),
212- decoration: BoxDecoration (
213- color: Colors .white,
214- borderRadius: BorderRadius .circular (5 ),
215- boxShadow: wsBoxShadow (blurRadius: 4 ),
216- ),
217- child: Column (
218- mainAxisAlignment: MainAxisAlignment .spaceAround,
219- children: < Widget > [
220- Flexible (
221- child: CachedNetworkImage (
222- imageUrl:
223- (product.images.length > 0 ? product.images.first.src : "" ),
224- placeholder: (context, url) => new CircularProgressIndicator (),
225- errorWidget: (context, url, error) => new Icon (Icons .error),
226- fit: BoxFit .contain,
208+ return LayoutBuilder (
209+ builder: (cxt,constraints) => InkWell (
210+ child: Container (
211+ margin: EdgeInsets .all (4 ),
212+ child: Column (
213+ crossAxisAlignment: CrossAxisAlignment .start,
214+ children: < Widget > [
215+ ClipRRect (
216+ borderRadius: BorderRadius .circular (3.0 ),
217+ child: CachedNetworkImage (
218+ imageUrl:
219+ (product.images.length > 0 ? product.images.first.src : "" ),
220+ placeholder: (context, url) => Center (child: CircularProgressIndicator ()),
221+ errorWidget: (context, url, error) => new Icon (Icons .error),
222+ fit: BoxFit .cover,
223+ height: constraints.maxHeight / 1.8 ,
224+ width: double .infinity,
225+ ),
227226 ),
228- flex: 4 ,
229- ),
230- Flexible (
231- child: Row (
232- crossAxisAlignment: CrossAxisAlignment .center,
233- mainAxisAlignment: MainAxisAlignment .center,
234- children: < Widget > [
235- Text (
227+ Padding (
228+ padding: const EdgeInsets .only (top: 1 ),
229+ child: Text (
230+ product.name,
231+ style: Theme .of (context).textTheme.bodyText2,
232+ overflow: TextOverflow .ellipsis,
233+ maxLines: 2 ,
234+ textAlign: TextAlign .left,
235+ ),
236+ ),
237+ Flexible (
238+ child: Padding (
239+ padding: const EdgeInsets .only (top: 1 ),
240+ child: Text (
236241 formatStringCurrency (total: product.price),
237- style: Theme .of (context).textTheme.bodyText1,
238- textAlign: TextAlign .center,
242+ style: Theme .of (context).textTheme.bodyText1.copyWith (
243+ fontWeight: FontWeight .w600,
244+ fontSize: 16
245+ ),
246+ textAlign: TextAlign .left,
239247 ),
240- (product.onSale
241- ? Padding (
242- padding: const EdgeInsets .only (left: 8 ),
243- child: Text (
244- formatStringCurrency (total: product.regularPrice),
245- style: Theme .of (context).textTheme.bodyText1.copyWith (
246- decoration: TextDecoration .lineThrough,
247- color: Colors .grey,
248- ),
249- textAlign: TextAlign .left,
250- ),
251- )
252- : null ),
253- ].where ((t) => t != null ).toList (),
248+ ),
254249 ),
255- flex: 1 ,
256- ),
257- Expanded (
258- child: Text (
259- product.name,
260- style: Theme .of (context).textTheme.bodyText2,
261- overflow: TextOverflow .clip,
262- maxLines: 1 ,
250+ Flexible (
251+ child: Container (
252+ child: (product.onSale && product.type != "variable"
253+ ? RichText (
254+ textAlign: TextAlign .left,
255+ text: TextSpan (
256+ text: '' ,
257+ style: Theme .of (context).textTheme.bodyText1,
258+ children: < TextSpan > [
259+ TextSpan (text: '${trans (context , "Was" )}: ' , style: Theme .of (context).textTheme.bodyText1.copyWith (
260+ color: Colors .black54,
261+ fontSize: 11
262+ ),),
263+ TextSpan (text: formatStringCurrency (total: product.regularPrice), style: Theme .of (context).textTheme.bodyText1.copyWith (
264+ decoration: TextDecoration .lineThrough,
265+ color: Colors .grey,
266+ fontSize: 11
267+ ),),
268+ TextSpan (text: " | ${workoutSaleDiscount (salePrice : product .salePrice , priceBefore : product .regularPrice )}% ${trans (context , "off" )}" , style: Theme .of (context).textTheme.bodyText1.copyWith (
269+ color: Colors .black87,
270+ fontSize: 11
271+ ),),
272+ ],
273+ ),
274+ )
275+ : null ),
276+ width: double .infinity,
277+ ),
263278 ),
264- flex: 1 ,
265- )
266- ],
279+ ].where ((e) => e != null ).toList (),
280+ ),
267281 ),
282+ onTap: () => onTap (product),
268283 ),
269- onTap: () => onTap (product),
270284 );
271285}
272286
0 commit comments