import 'package:adaptix/adaptix.dart'; import 'package:flutter/material.dart'; import 'package:sapaly_shop/services/app_constants.dart'; import 'package:sapaly_shop/themes/app_theme.dart'; class ProductCard extends StatelessWidget { final String imageUrl, price, discountPrice, description; final int discountPriceValue; final VoidCallback onPressed; const ProductCard({ Key? key, required this.imageUrl, required this.price, required this.discountPrice, required this.description, required this.onPressed, required this.discountPriceValue, }) : super(key: key); @override Widget build(BuildContext context) { return Card( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15.adaptedPx()), ), child: TextButton( onPressed: onPressed, style: TextButton.styleFrom( padding: EdgeInsets.zero, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15.adaptedPx()), ), ), child: Column( children: [ ClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(15.adaptedPx()), topRight: Radius.circular(15.adaptedPx()), ), child: Image.network( imageUrl, fit: BoxFit.fitWidth, alignment: Alignment.center, height: AppConstants.deviceHeight(context) / 7, width: double.infinity, ), ), Padding( padding: EdgeInsets.symmetric( horizontal: 4.adaptedPx(), vertical: 5.adaptedPx(), ), child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ Text( price, maxLines: 2, softWrap: true, style: Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w600, color: AppTheme.blackColor, fontSize: 13.adaptedPx(), ), ), SizedBox(width: 5.adaptedPx()), discountPriceValue == 0 ? Container() : Text( discountPrice, maxLines: 2, softWrap: true, style: Theme.of(context) .primaryTextTheme .bodyMedium ?.copyWith( fontWeight: FontWeight.w400, color: AppTheme.redColor, decoration: TextDecoration.lineThrough, fontSize: 10.adaptedPx(), ), ), const Spacer(), SizedBox( width: 30.adaptedPx(), height: 30.adaptedPx(), child: RawMaterialButton( shape: const CircleBorder(), fillColor: AppTheme.lightPrimaryColor, onPressed: () {}, child: const Icon( Icons.add, color: AppTheme.whiteColor, ), ), ), ], ), ), Expanded( child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.adaptedPx()), child: Align( alignment: Alignment.centerLeft, child: Text( description, softWrap: true, style: Theme.of(context).primaryTextTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w400, color: AppTheme.blackColor, fontSize: 11.adaptedPx(), ), ), ), ), ), ], ), ), ); } }