From 4309952b170d5520e679628bd3bff464b3425e06 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Thu, 7 Oct 2021 10:12:33 +0300 Subject: [PATCH] fixed subCategories --- lib/config/config.dart | 12 +- lib/pages/parent_categorise_page.dart | 135 ++++++++++-------- lib/pages/pharmacies/my_reviews.dart | 4 +- lib/pages/pharmacies/wishlist.dart | 3 +- lib/pages/sub_categories_modalsheet.dart | 108 ++++++++++++++ .../pharmacy_services/review_service.dart | 2 + 6 files changed, 198 insertions(+), 66 deletions(-) create mode 100644 lib/pages/sub_categories_modalsheet.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 5af95569..2e7213c0 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,16 +13,16 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; +//const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs -const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; -const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +//const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // Pharmacy Production URLs -// const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; -// const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; + const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; + const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity'; diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 40bf2dc7..79b49871 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -16,7 +16,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/pages/sub_categories_modalsheet.dart'; import 'base/base_view.dart'; class ParentCategorisePage extends StatefulWidget { @@ -114,56 +114,65 @@ class _ParentCategorisePageState extends State { ), ), onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return Container( - // height: MediaQuery.of(context) - // .size - // .height * - // 0.89, - color: Colors.white, - child: Center( - child: ListView.builder( - scrollDirection: Axis.vertical, - itemCount: model.categoriseParent.length, - itemBuilder: (BuildContext context, int index) { - return Container( - child: Padding( - padding: EdgeInsets.all(4.0), - child: InkWell( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(projectViewModel.isArabic - ? model.categoriseParent[index].namen - : model.categoriseParent[index].name), - Divider( - thickness: 0.6, - color: Colors.black12, - ) - ], - ), - onTap: () { - Navigator.push( - context, - FadePage( - page: SubCategorisePage( - title: model.categoriseParent[index].name, - id: model.categoriseParent[index].id, - parentId: id, - )), - ); - }, - ), - ), - ); - }), - ), - ); - }, + Navigator.push( + context, + FadePage( + page: SubCategoriseModalsheet( +// id: model.categorise[0].id, +// titleName: model.categorise[0].name, + ) + ), ); +// showModalBottomSheet( +// isScrollControlled: true, +// context: context, +// builder: (BuildContext context) { +// return Container( +// // height: MediaQuery.of(context) +// // .size +// // .height * +// // 0.89, +// color: Colors.white, +// child: Center( +// child: ListView.builder( +// scrollDirection: Axis.vertical, +// itemCount: model.categoriseParent.length, +// itemBuilder: (BuildContext context, int index) { +// return Container( +// child: Padding( +// padding: EdgeInsets.all(4.0), +// child: InkWell( +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Texts(projectViewModel.isArabic +// ? model.categoriseParent[index].namen +// : model.categoriseParent[index].name), +// Divider( +// thickness: 0.6, +// color: Colors.black12, +// ) +// ], +// ), +// onTap: () { +// Navigator.push( +// context, +// FadePage( +// page: SubCategorisePage( +// title: model.categoriseParent[index].name, +// id: model.categoriseParent[index].id, +// parentId: id, +// )), +// ); +// }, +// ), +// ), +// ); +// }), +// ), +// ); +// }, +// ); }, ), ), @@ -300,7 +309,8 @@ class _ParentCategorisePageState extends State { width: 10.0, ), Texts( - 'Refine', + TranslationBase.of(context).refine, +// 'Refine', fontWeight: FontWeight.w600, ), SizedBox( @@ -308,7 +318,8 @@ class _ParentCategorisePageState extends State { ), InkWell( child: Texts( - 'Close', +// 'Close', + TranslationBase.of(context).closeIt, color: Colors.red, fontWeight: FontWeight.w600, fontSize: 15.0, @@ -327,7 +338,9 @@ class _ParentCategorisePageState extends State { Column( children: [ ExpansionTile( - title: Texts('Categorise'), + title: Texts( TranslationBase.of( + context) + .categorise), children: [ ProcedureListWidget( model: model, @@ -356,7 +369,9 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts('Brands'), + title: Texts( TranslationBase.of( + context) + .brands), children: [ ProcedureListWidget( model: model, @@ -385,7 +400,9 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts('Price'), + title: Texts( TranslationBase.of( + context) + .price), children: [ Container( color: Color(0xffEEEEEE), @@ -446,7 +463,9 @@ class _ParentCategorisePageState extends State { Container( width: 100, child: Button( - label: 'Reset', + label: TranslationBase.of( + context) + .reset, backgroundColor: Colors.red, ), ), @@ -486,7 +505,9 @@ class _ParentCategorisePageState extends State { Navigator.pop(context); }, - label: 'Apply', + label: TranslationBase.of( + context) + .apply, backgroundColor: Colors.green, ), ), diff --git a/lib/pages/pharmacies/my_reviews.dart b/lib/pages/pharmacies/my_reviews.dart index efb93f96..029f8ca4 100644 --- a/lib/pages/pharmacies/my_reviews.dart +++ b/lib/pages/pharmacies/my_reviews.dart @@ -121,7 +121,7 @@ reviewDetails(data, rate, myRate) { : data.product.name, style: TextStyle( color: Colors.black54, - fontSize: languageID == 'ar' ? 7 : 13, + fontSize: languageID == 'ar' ? 12 : 13, fontWeight: FontWeight.bold), ), ), @@ -187,7 +187,7 @@ reviewDetails(data, rate, myRate) { padding: languageID == 'ar' ? EdgeInsets.only(right: 10) : EdgeInsets.only(left: 10), - child: Text(data.createdOnUtc.toString())), + child: Text(data.createdOnUtc.toString().substring(0 , 11))), ], ), ), diff --git a/lib/pages/pharmacies/wishlist.dart b/lib/pages/pharmacies/wishlist.dart index b75f709b..c90f2138 100644 --- a/lib/pages/pharmacies/wishlist.dart +++ b/lib/pages/pharmacies/wishlist.dart @@ -42,7 +42,8 @@ class _WishlistPageState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Text( - 'There is no data', + TranslationBase.of(context).noData, +// 'There is no data', style: TextStyle(fontSize: 30), ), ) diff --git a/lib/pages/sub_categories_modalsheet.dart b/lib/pages/sub_categories_modalsheet.dart new file mode 100644 index 00000000..f1ff0e08 --- /dev/null +++ b/lib/pages/sub_categories_modalsheet.dart @@ -0,0 +1,108 @@ + +import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'base/base_view.dart'; +import 'package:provider/provider.dart'; + + + + +class SubCategoriseModalsheet extends StatefulWidget { + String id; + String titleName; + + SubCategoriseModalsheet({this.id, this.titleName}); + @override + _SubCategoriseModalsheetState createState() => _SubCategoriseModalsheetState(id: id, titleName: titleName); + +} + +class _SubCategoriseModalsheetState extends State { + String id; + String titleName; +// List categoriesList = []; + _SubCategoriseModalsheetState({this.id, this.titleName}); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getCategoriseParent(i: id), + builder: (_, model, wi) => AppScaffold( + // appBarTitle: titleName, + appBarTitle: TranslationBase.of(context).categorise, + isBottomBar: false, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: Container( + color: Colors.white, + child: Center( + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: model.categoriseParent.length, + itemBuilder: (BuildContext context, int index) { + return Container( + child: Padding( + padding: EdgeInsets.all(4.0), + child: InkWell( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(projectViewModel.isArabic + ? model.categoriseParent[index].namen + : model.categoriseParent[index].name), + SizedBox( + height: 10, + ), + Divider( + thickness: 0.6, + color: Colors.black12, + ) + ], + ), + onTap: () { + Navigator.push( + context, + FadePage( + page: SubCategorisePage( + title: model.categoriseParent[index].name, + id: model.categoriseParent[index].id, + parentId: id, + )), + ); + }, + ), + ), + ); + }), + ), + ), + + ), + ); + } +// getCatName() { +// +// if (widget.id == '1' ) +// return Texts("text1"); +// else if (widget.id == '2' ) +// return Texts("text2"); +// else if (widget.id == '3') +// return Texts("text3"); +// else if (widget.id == '4' ) +// return Texts("text4"); +// } + + +} \ No newline at end of file diff --git a/lib/services/pharmacy_services/review_service.dart b/lib/services/pharmacy_services/review_service.dart index 44839955..c85d68e2 100644 --- a/lib/services/pharmacy_services/review_service.dart +++ b/lib/services/pharmacy_services/review_service.dart @@ -28,6 +28,8 @@ class ReviewService extends BaseService { _reviewList.clear(); response['reviews'].forEach((item) { _reviewList.add(Review.fromJson(item)); + print (response); + print (item['reviewText']); }); }, onFailure: (String error, int statusCode) { hasError = true;