diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b9e446d9..79294bfb 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -642,6 +642,7 @@ const Map localizedValues = { "years-old": {"en": "years old", "ar": "سنة"}, "drag-point": {"en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك"}, "refine": {"en": "Refine", "ar": "تصفية"}, + "subGroup": {"en": "Subgroup", "ar": "مجموعة فرعيه"}, "max": {"en": "Max", "ar": "اعلى"}, "compeleteOrderMsg": {"en": "Order has been placed successfully!!", "ar": "تم اتمام الطلب بنجاح"}, "addToCompareMsg": {"en": "You have added a product to the Compare list", "ar": "تمت الاضافه لقائمة المقارنه"}, diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index d40d490f..022dde75 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -202,7 +202,7 @@ class _SearchProductsPageState extends State { ? MediaQuery.of(context) .size .width / - 5 + 3 : 0, padding: EdgeInsets.all(4), decoration: BoxDecoration( diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 325e5fd9..94afac3b 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -22,6 +22,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:rating_bar/rating_bar.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart' as utils ; import 'base/base_view.dart'; import 'final_products_page.dart'; @@ -416,7 +417,7 @@ class _SubCategorisePageState extends State { title: Texts( TranslationBase.of( context) - .categorise), + .subGroup), children: [ ProcedureListWidget( model: model, @@ -837,7 +838,7 @@ class _SubCategorisePageState extends State { context) .size .width / - 5 + 3 : 0, padding: EdgeInsets.all(4), @@ -993,273 +994,425 @@ class _SubCategorisePageState extends State { itemCount: model.subProducts.length, itemBuilder: (BuildContext context, int index) { - return InkWell( - child: Card( - child: Row( - children: [ - Stack( + return InkWell( + child: Card( + child: Row( children: [ - Column( + Stack( children: [ - Container( - decoration: - BoxDecoration(), - child: Padding( - padding: - EdgeInsets - .only( - left: 9.0, - top: 8.0, - right: 10.0, + Column( + children: [ + Container( + decoration: BoxDecoration(), + child: Padding( + padding: EdgeInsets.only( + left: 9.0, + top: 8.0, + right: 10.0, + ), + ), ), - ), - ), - Container( - margin: EdgeInsets - .fromLTRB( - 0, 0, 0, 0), - alignment: Alignment - .center, - child: model - .subProducts[ - index] - .images - .isNotEmpty - ? Image.network( - model - .subProducts[ - index] - .images[ - 0] - .thumb, - fit: BoxFit - .contain, - height: 70, - ) - : Text(TranslationBase.of( - context) - .noImage), + Container( + margin: EdgeInsets.fromLTRB(0, 0, 0, 8), + alignment: Alignment.center, + child:(model.subProducts[index].images != null && + model.subProducts[index].images.length > 0) + ? Image.network( + model.subProducts[index].images[0].src, + fit: BoxFit.cover, + height: 80, + width: 80, + + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + width: 80, + ), + ), + ], ), - ], - ), - Column( - children: [ - Container( - width: model - .subProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 5.3 - : 0, - padding: - EdgeInsets.all( - 4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: BorderRadius.only( - topLeft: Radius - .circular( - 6)), - ), - child: model - .subProducts[ - index] - .rxMessage != - null - ? Texts( - projectProvider - .isArabic - ? model - .subProducts[ - index] - .rxMessagen - : model - .subProducts[index] - .rxMessage, - color: Colors - .white, - regular: - true, - fontSize: - 10, - fontWeight: - FontWeight - .w400, - ) - : Texts(""), -// Texts( -// model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "", -// color: Colors.white, -// regular: true, -// fontSize: 10, -// fontWeight: FontWeight.w400, -// ), + Column( + children: [ + Container( + width: model.subProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 3.70 : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + //borderRadius: BorderRadius.only(topLeft: Radius.circular(5)), + ), + child:model.subProducts[index].rxMessage != null + ? Texts( + projectProvider.isArabic ? model.subProducts[index].rxMessagen : model.subProducts[index].rxMessage, + color: Colors.white, + regular: true, + fontSize: 8, + fontWeight: FontWeight.w600, + ) + : Texts(""), + ), + ], ), ], ), - ], - ), - Container( - height: 130.0, - margin: - EdgeInsets.symmetric( - horizontal: 0, - vertical: 0, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - SizedBox( - height: 4.0, - ), - Container( - width: MediaQuery.of( - context) - .size - .width * - 0.65, - child: Texts( - projectViewModel - .isArabic - ? model - .subProducts[ - index] - .namen - : model - .subProducts[ - index] - .name, - // model.subProducts[index].name, - regular: true, - fontSize: 13.2, - fontWeight: - FontWeight.w500, - maxLines: 5, - ), - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), - child: Texts( - "SAR ${model.subProducts[index].price}", - bold: true, - fontSize: 14, - ), + Container( + height: 100.0, + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, ), - Row( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ -// StarRating( -// totalAverage: model.subProducts[index].approvedRatingSum > 0 -// ? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble() -// : 0, -// forceStars: true), - RatingBar.readOnly( - initialRating: model - .subProducts[ - index] - .approvedRatingSum - .toDouble(), - size: 15.0, - filledColor: - Colors.yellow[ - 700], - emptyColor: Colors - .grey[500], - isHalfAllowed: - true, - halfFilledIcon: - Icons - .star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of(context).size.width * 0.55, + child: Texts(projectViewModel.isArabic ? model.subProducts[index].namen : model.subProducts[index].name, + regular: true, + fontSize: 13.2, + fontWeight: FontWeight.w500, + maxLines: 5, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: const EdgeInsets.only(top: 4, bottom: 4), + child: Texts( + "SAR ${model.subProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + RatingBar.readOnly( + initialRating: model.subProducts[index].approvedRatingSum.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + Texts( + "(${model.subProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + ], ), - Texts( - "(${model.subProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight - .w400, - ) ], ), - ], - ), + ), + widget.authenticatedUserObject.isLogin + ? Container( + child: IconButton( + icon: Icon( + Icons.shopping_cart, + size: 18, + color: CustomColors.green, + ), + onPressed: () async { + if (model.subProducts[index].isRx == false) { + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, model.subProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); + utils.Utils.navigateToCartPage(); + + + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } +// + }), + ) + : Container(), + ], ), - widget.authenticatedUserObject - .isLogin - ? Container( - child: IconButton( - icon: Icon( - Icons - .shopping_cart, - size: 18, - color: - CustomColors - .green, - ), - onPressed: - () async { - if (model - .subProducts[ - index] - .isRx == false) { - GifLoaderDialogUtils - .showMyDialog( - context); - await addToCartFunction( - 1, - model - .subProducts[ - index] - .id); - GifLoaderDialogUtils - .hideDialog( - context); - Utils - .navigateToCartPage(); - } else { - AppToast.showErrorToast( - message: TranslationBase.of( - context) - .needPrescription); - } - }), - ) - : Container(), - ], - ), - ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.subProducts[ - index]), - )), - }, - ); + ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage(model.subProducts[index]), + )), + }, + ); +// return InkWell( +// child: Card( +// child: Row( +// children: [ +// Stack( +// children: [ +// Column( +// children: [ +// Container( +// decoration: +// BoxDecoration(), +// child: Padding( +// padding: +// EdgeInsets +// .only( +// left: 9.0, +// top: 8.0, +// right: 10.0, +// ), +// ), +// ), +// Container( +// margin: EdgeInsets +// .fromLTRB( +// 0, 0, 0, 0), +// alignment: Alignment +// .center, +// child: model +// .subProducts[ +// index] +// .images +// .isNotEmpty +// ? Image.network( +// model +// .subProducts[ +// index] +// .images[ +// 0] +// .thumb, +// fit: BoxFit +// .contain, +// height: 70, +// ) +// : Text(TranslationBase.of( +// context) +// .noImage), +// ), +// ], +// ), +// Column( +// children: [ +// Container( +// width: model +// .subProducts[ +// index] +// .rxMessage != +// null +// ? MediaQuery.of( +// context) +// .size +// .width / +// 3.70 +// : 0, +// padding: +// EdgeInsets.all( +// 4), +// decoration: +// BoxDecoration( +// color: Color( +// 0xffb23838), +// // borderRadius: BorderRadius.only( +// // topLeft: Radius +// // .circular( +// // 6)), +// ), +// child: model +// .subProducts[ +// index] +// .rxMessage != +// null +// ? Texts( +// projectProvider +// .isArabic +// ? model +// .subProducts[ +// index] +// .rxMessagen +// : model +// .subProducts[index] +// .rxMessage, +// color: Colors +// .white, +// regular: +// true, +// fontSize: +// 10, +// fontWeight: +// FontWeight +// .w400, +// ) +// : Texts(""), +// // Texts( +// // model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "", +// // color: Colors.white, +// // regular: true, +// // fontSize: 10, +// // fontWeight: FontWeight.w400, +// // ), +// ), +// ], +// ), +// ], +// ), +// Container( +// height: 130.0, +// margin: +// EdgeInsets.symmetric( +// horizontal: 0, +// vertical: 0, +// ), +// child: Column( +// mainAxisAlignment: +// MainAxisAlignment +// .spaceAround, +// crossAxisAlignment: +// CrossAxisAlignment +// .start, +// children: [ +// SizedBox( +// height: 4.0, +// ), +// Container( +// width: MediaQuery.of( +// context) +// .size +// .width * +// 0.65, +// child: Texts( +// projectViewModel +// .isArabic +// ? model +// .subProducts[ +// index] +// .namen +// : model +// .subProducts[ +// index] +// .name, +// // model.subProducts[index].name, +// regular: true, +// fontSize: 13.2, +// fontWeight: +// FontWeight.w500, +// maxLines: 5, +// ), +// ), +// SizedBox( +// height: 8.0, +// ), +// Padding( +// padding: +// const EdgeInsets +// .only( +// top: 4, +// bottom: 4), +// child: Texts( +// "SAR ${model.subProducts[index].price}", +// bold: true, +// fontSize: 14, +// ), +// ), +// Row( +// children: [ +// // StarRating( +// // totalAverage: model.subProducts[index].approvedRatingSum > 0 +// // ? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble() +// // : 0, +// // forceStars: true), +// RatingBar.readOnly( +// initialRating: model +// .subProducts[ +// index] +// .approvedRatingSum +// .toDouble(), +// size: 15.0, +// filledColor: +// Colors.yellow[ +// 700], +// emptyColor: Colors +// .grey[500], +// isHalfAllowed: +// true, +// halfFilledIcon: +// Icons +// .star_half, +// filledIcon: +// Icons.star, +// emptyIcon: +// Icons.star, +// ), +// Texts( +// "(${model.subProducts[index].approvedTotalReviews})", +// regular: true, +// fontSize: 10, +// fontWeight: +// FontWeight +// .w400, +// ) +// ], +// ), +// ], +// ), +// ), +// widget.authenticatedUserObject +// .isLogin +// ? Container( +// child: IconButton( +// icon: Icon( +// Icons +// .shopping_cart, +// size: 18, +// color: +// CustomColors +// .green, +// ), +// onPressed: +// () async { +// if (model +// .subProducts[ +// index] +// .isRx == false) { +// GifLoaderDialogUtils +// .showMyDialog( +// context); +// await addToCartFunction( +// 1, +// model +// .subProducts[ +// index] +// .id); +// GifLoaderDialogUtils +// .hideDialog( +// context); +// Utils +// .navigateToCartPage(); +// } else { +// AppToast.showErrorToast( +// message: TranslationBase.of( +// context) +// .needPrescription); +// } +// }), +// ) +// : Container(), +// ], +// ), +// ), +// onTap: () => { +// Navigator.push( +// context, +// FadePage( +// page: ProductDetailPage( +// model.subProducts[ +// index]), +// )), +// }, +// ); }), ) : Padding( diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index ff0043e0..a7dc47db 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1225,6 +1225,8 @@ class TranslationBase { String get refine => localizedValues['refine'][locale.languageCode]; + String get subGroup => localizedValues['subGroup'][locale.languageCode]; + String get max => localizedValues['max'][locale.languageCode]; String get min => localizedValues['min'][locale.languageCode];