|
|
|
@ -1,13 +1,16 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:rating_bar/rating_bar.dart';
|
|
|
|
|
|
|
|
|
|
class productTile extends StatelessWidget {
|
|
|
|
@ -27,6 +30,7 @@ class productTile extends StatelessWidget {
|
|
|
|
|
final dynamic productID;
|
|
|
|
|
final Function onDelete;
|
|
|
|
|
final dynamic approvedTotalReviews;
|
|
|
|
|
final dynamic isRx;
|
|
|
|
|
|
|
|
|
|
// final VoidCallback deleteWishlistItems;
|
|
|
|
|
|
|
|
|
@ -47,10 +51,12 @@ class productTile extends StatelessWidget {
|
|
|
|
|
this.productID,
|
|
|
|
|
this.onDelete,
|
|
|
|
|
this.approvedTotalReviews,
|
|
|
|
|
this.isRx
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
return Container(
|
|
|
|
|
height: 180,
|
|
|
|
|
width: double.infinity,
|
|
|
|
@ -87,7 +93,16 @@ class productTile extends StatelessWidget {
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
|
child: Align(
|
|
|
|
|
child: projectViewModel
|
|
|
|
|
.isArabic ? Align(
|
|
|
|
|
alignment: Alignment.topRight,
|
|
|
|
|
child: RichText(
|
|
|
|
|
text: TextSpan(
|
|
|
|
|
text: productName,
|
|
|
|
|
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
): Align(
|
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
|
child: RichText(
|
|
|
|
|
text: TextSpan(
|
|
|
|
@ -99,7 +114,17 @@ class productTile extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
|
child: Align(
|
|
|
|
|
child: projectViewModel
|
|
|
|
|
.isArabic ? Align(
|
|
|
|
|
alignment: Alignment.topRight,
|
|
|
|
|
child: RichText(
|
|
|
|
|
text: TextSpan(
|
|
|
|
|
text: 'SAR $productPrice',
|
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
:Align(
|
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
|
child: RichText(
|
|
|
|
|
text: TextSpan(
|
|
|
|
@ -163,10 +188,14 @@ class productTile extends StatelessWidget {
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if(isRx == false){
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await addToCartFunction(1, productID, context);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
Utils.navigateToCartPage();
|
|
|
|
|
Utils.navigateToCartPage();}
|
|
|
|
|
else {
|
|
|
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|