Merge branch 'haroon-new-design' into 'development_new_design_2.0'

Haroon new design

See merge request Cloud_Solution/diplomatic-quarter!481
merge-requests/482/merge
haroon amjad 4 years ago
commit 541f5f06e7

@ -16,9 +16,7 @@ const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_ORDERS = '/api/orders';
const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
// const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/'; const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs // Pharmacy UAT URLs
// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';

@ -144,12 +144,12 @@ class OrderPreviewService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future getLacumAccountInformation() async { Future getLacumAccountInformation(String identificationNo) async {
hasError = false; hasError = false;
super.error = ""; super.error = "";
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['IdentificationNo'] = user.patientIdentificationNo; body['IdentificationNo'] = identificationNo;
try { try {
await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION,
@ -164,12 +164,12 @@ class OrderPreviewService extends BaseService {
} }
} }
Future getLacumGroupInformation() async { Future getLacumGroupInformation(String identificationNo) async {
hasError = false; hasError = false;
super.error = ""; super.error = "";
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['IdentificationNo'] = user.patientIdentificationNo; body['IdentificationNo'] = identificationNo;
body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}"; body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}";
try { try {

@ -0,0 +1,17 @@
import 'package:flutter/cupertino.dart';
class PharmacyPagesViewModel with ChangeNotifier {
int currentTab = 0;
PageController pageController;
PharmacyPagesViewModel() {
pageController = PageController(keepPage: true);
}
changeCurrentTab(int tab) {
if (pageController.hasClients) {
currentTab = tab;
pageController.jumpToPage(tab);
notifyListeners();
}
}
}

@ -31,6 +31,11 @@ class OrderPreviewViewModel extends BaseViewModel {
PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData(); PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData();
double totalAdditionalShippingCharge = 0; double totalAdditionalShippingCharge = 0;
setShoppingCartResponse(ShoppingCartResponse cart){
cartResponse = cart;
notifyListeners();
}
Future getOrderPreviewData() async { Future getOrderPreviewData() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _orderService.getAddresses(); await _orderService.getAddresses();
@ -156,25 +161,25 @@ class OrderPreviewViewModel extends BaseViewModel {
return _orderService.getPaymentOptionName(paymentOption); return _orderService.getPaymentOptionName(paymentOption);
} }
getInformationsByAddress() async { getInformationsByAddress(String identificationNo) async {
await getLacumAccountInformation();
await getShippingOption(); await getShippingOption();
await getLacumAccountInformation(identificationNo);
} }
getLacumAccountInformation() async { getLacumAccountInformation(String identificationNo) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _orderService.getLacumAccountInformation(); await _orderService.getLacumAccountInformation(identificationNo);
if (_orderService.hasError) { if (_orderService.hasError) {
error = _orderService.error; error = _orderService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
getLacumGroupData(); getLacumGroupData(identificationNo);
} }
} }
Future getLacumGroupData() async { Future getLacumGroupData(String identificationNo) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _orderService.getLacumGroupInformation(); await _orderService.getLacumGroupInformation(identificationNo);
paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation; paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation;
paymentCheckoutData.usedLakumPoints = paymentCheckoutData paymentCheckoutData.usedLakumPoints = paymentCheckoutData
.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount; .lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount;

@ -1,13 +1,17 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart';
import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart';
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../locator.dart'; import '../../../locator.dart';
@ -61,12 +65,39 @@ class ProductDetailViewModel extends BaseViewModel{
Future addToCartData(quantity, itemID) async { Future addToCartData(quantity, itemID) async {
hasError = false; hasError = false;
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _productDetailService.addToCart(quantity, itemID); var resp = await _productDetailService.addToCart(quantity, itemID);
ShoppingCartResponse object = _handleGetShoppingCartResponse(resp);
if (_productDetailService.hasError) { if (_productDetailService.hasError) {
error = _productDetailService.error; error = _productDetailService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else {
setState(ViewState.Idle); setState(ViewState.Idle);
Provider.of<OrderPreviewViewModel>(locator<NavigationService>().navigatorKey.currentContext, listen: false)
.setShoppingCartResponse( object);
}
}
ShoppingCartResponse _handleGetShoppingCartResponse(Map res) {
ShoppingCartResponse cartResponse = ShoppingCartResponse();
if (res == null) {
error = "response is null";
setState(ViewState.Error);
return null;
}
print(res);
cartResponse.itemCount = res["item_count"];
cartResponse.quantityCount = res["quantity_count"];
cartResponse.subtotal = res["subtotal"];
cartResponse.subtotalWithVat = res["subtotal_with_vat"];
cartResponse.subtotalVatAmount = res["subtotal_vat_amount"];
cartResponse.subtotalVatRate = res["subtotal_vat_rate"];
cartResponse.shoppingCarts = List();
res["shopping_carts"].forEach((item) {
ShoppingCart shoppingCart = ShoppingCart.fromJson(item);
cartResponse.shoppingCarts.add(shoppingCart);
});
return cartResponse;
} }
Future addToWishlistData(itemID) async { Future addToWishlistData(itemID) async {

@ -1,5 +1,4 @@
import 'dart:io'; import 'package:diplomaticquarterapp/core/viewModels/PharmacyPagesViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/routes.dart';
@ -84,6 +83,9 @@ class _MyApp extends State<MyApp> {
SizeConfig().init(constraints, orientation); SizeConfig().init(constraints, orientation);
return MultiProvider( return MultiProvider(
providers: [ providers: [
ChangeNotifierProvider<PharmacyPagesViewModel>(
create: (context) => PharmacyPagesViewModel(),
),
ChangeNotifierProvider<ProjectViewModel>( ChangeNotifierProvider<ProjectViewModel>(
create: (context) => ProjectViewModel(), create: (context) => ProjectViewModel(),
), ),

@ -4,17 +4,17 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/image.dart' as flutterImage;
import 'base/base_view.dart'; import 'base/base_view.dart';
dynamic languageID; dynamic languageID;
@ -22,8 +22,7 @@ dynamic languageID;
class FinalProductsPage extends StatefulWidget { class FinalProductsPage extends StatefulWidget {
final String id; final String id;
final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>();
FinalProductsPage({this.id, this.productType = 1}); FinalProductsPage({this.id, this.productType = 1});
@ -33,7 +32,9 @@ class FinalProductsPage extends StatefulWidget {
class _FinalProductsPageState extends State<FinalProductsPage> { class _FinalProductsPageState extends State<FinalProductsPage> {
String id; String id;
_FinalProductsPageState({this.id}); _FinalProductsPageState({this.id});
String categoriseName = "Personal Care"; String categoriseName = "Personal Care";
String appBarTitle = ""; String appBarTitle = "";
bool styleOne = true; bool styleOne = true;
@ -77,11 +78,10 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
} }
}, },
allowAny: true, allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold(
Widget child) => isPharmacy: true,
PharmacyAppScaffold(
appBarTitle: appBarTitle, appBarTitle: appBarTitle,
isBottomBar: false, isBottomBar: true,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
isShowDecPage: false, isShowDecPage: false,
@ -91,16 +91,13 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
//Expanded widget heree if nassery
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: Texts( child: Texts(
"$appBarTitle " + "$appBarTitle " + TranslationBase.of(context).products,
TranslationBase.of(context).products,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@ -154,29 +151,21 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
? Expanded( ? Expanded(
child: model.finalProducts.length > 0 child: model.finalProducts.length > 0
? Container( ? Container(
height: MediaQuery.of(context).size.height * height: MediaQuery.of(context).size.height * 3.90,
3.90,
child: GridView.builder( child: GridView.builder(
gridDelegate: gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 0.5, crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0, mainAxisSpacing: 2.0,
childAspectRatio: 1.0, childAspectRatio: 1.0,
), ),
itemCount: model.finalProducts.length, itemCount: model.finalProducts.length,
itemBuilder: itemBuilder: (BuildContext context, int index) {
(BuildContext context, int index) {
return NetworkBaseView( return NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: InkWell( child: InkWell(
child: Card( child: Card(
color: color: model.finalProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white,
model.finalProducts[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0, elevation: 0,
shape: Border( shape: Border(
right: BorderSide( right: BorderSide(
@ -198,226 +187,84 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
), ),
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: 8, horizontal: 8,
vertical: 1, vertical: 4,
// vertical: 2,
), ),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius: BorderRadius.only(
BorderRadius.only( topLeft: Radius.circular(110.0),
topLeft: Radius.circular(
110.0),
), ),
color: Colors.white, color: Colors.white,
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(horizontal: 0),
horizontal: 4,
),
width: MediaQuery.of(context).size.width / 3, width: MediaQuery.of(context).size.width / 3,
// width: MediaQuery.of(context)
// .size
// .width /
// 1,
// height: MediaQuery.of(context)
// .size
// .width /
// 1,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [ children: [
Stack( Stack(
children: [ children: [
Container( Container(
margin: EdgeInsets margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
.fromLTRB(0, 1, alignment: Alignment.center,
0, 0), child: Image.network(
alignment: Alignment model.finalProducts[index].images.isNotEmpty
.center, ? model.finalProducts[index].images[0].thumb
child:
Image.network(
model
.finalProducts[
index]
.images
.isNotEmpty
? model
.finalProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover, fit: BoxFit.cover,
height: 70, height: 80,
), ),
), ),
// Container( Container(
// width: model width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 2.8 : 0,
// .finalProducts[ padding: EdgeInsets.all(4),
// index] decoration: BoxDecoration(
// .rxMessage != color: Color(0xffb23838),
// null borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
// ? MediaQuery.of(
// context)
// .size
// .width /
// 2.8
// : 0,
// padding:
// EdgeInsets.all(
// 4),
// decoration:
// BoxDecoration(
// color: Color(
// 0xffb23838),
// borderRadius: BorderRadius.only(
// topLeft: Radius
// .circular(
// 6)),
// ),
// child: model
// .finalProducts[
// index]
// .rxMessage !=
// null
// ? Texts(
// languageID ==
// 'ar'
// ? model
// .finalProducts[
// index]
// .rxMessagen
// : model
// .finalProducts[index]
// .rxMessage,
// color: Colors
// .white,
// regular:
// true,
// fontSize:
// 10,
// fontWeight:
// FontWeight
// .w600,
// )
// : Texts(""),
// ),
],
),
Container(
margin: EdgeInsets
.symmetric(
horizontal: 0,
vertical: 2,
),
width: model
.finalProducts[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
2.0
: 0,
padding:
EdgeInsets.fromLTRB(8,4,8,4),
decoration:
BoxDecoration(
color: Color(
0xffb23838),
// borderRadius: BorderRadius.only(
// topLeft: Radius
// .circular(
// 6)),
), ),
child: model child: model.finalProducts[index].rxMessage != null
.finalProducts[
index]
.rxMessage !=
null
? Texts( ? Texts(
languageID == languageID == 'ar' ? model.finalProducts[index].rxMessagen : model.finalProducts[index].rxMessage,
'ar' color: Colors.white,
? model regular: true,
.finalProducts[ fontSize: 10,
index] fontWeight: FontWeight.w600,
.rxMessagen
: model
.finalProducts[index]
.rxMessage,
color: Colors
.white,
regular:
true,
fontSize:
10,
fontWeight:
FontWeight
.w600,
) )
: Texts(""), : Texts(""),
), ),
],
),
Container( Container(
margin: EdgeInsets margin: EdgeInsets.symmetric(
.symmetric(
horizontal: 6, horizontal: 6,
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [ children: [
if (model if (model.finalProducts[index].discountName != null)
.finalProducts[
index]
.discountName !=
null)
Container( Container(
width: double width: double.infinity,
.infinity,
height: 13.0, height: 13.0,
decoration: decoration: BoxDecoration(
BoxDecoration( color: Color(0xff5AB145),
color: Color(
0xff5AB145),
), ),
child: Center( child: Center(
child: Texts( child: Texts(
model model.finalProducts[index].discountName,
.finalProducts[ regular: true,
index] color: Colors.white,
.discountName, fontSize: 10.4,
regular:
true,
color: Colors
.white,
fontSize:
10.4,
), ),
), ),
), ),
Texts( Texts(
model model.finalProducts[index].name,
.finalProducts[
index]
.name,
regular: true, regular: true,
fontSize: 12, fontSize: 12,
fontWeight: fontWeight: FontWeight.w400,
FontWeight
.w400,
), ),
Padding( Padding(
padding: padding: const EdgeInsets.only(top: 4, bottom: 4),
const EdgeInsets
.only(
top: 4,
bottom:
4),
child: Texts( child: Texts(
"SAR ${model.finalProducts[index].price}", "SAR ${model.finalProducts[index].price}",
bold: true, bold: true,
@ -427,20 +274,15 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
Row( Row(
children: [ children: [
StarRating( StarRating(
totalAverage: model.finalProducts[index].approvedRatingSum > totalAverage: model.finalProducts[index].approvedRatingSum > 0
0 ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble()
? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble())
.toDouble()
: 0, : 0,
forceStars: forceStars: true),
true),
Texts( Texts(
"(${model.finalProducts[index].approvedTotalReviews})", "(${model.finalProducts[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight: FontWeight.w400,
FontWeight
.w400,
) )
], ],
), ),
@ -455,9 +297,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: ProductDetailPage( page: ProductDetailPage(model.finalProducts[index]),
model.finalProducts[
index]),
)), )),
}, },
)); ));
@ -466,10 +306,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
) )
: Container( : Container(
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [ children: [
Align( Align(
alignment: Alignment.center, alignment: Alignment.center,
@ -493,285 +331,143 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
: Expanded( : Expanded(
child: model.finalProducts.length > 0 child: model.finalProducts.length > 0
? Container( ? Container(
height: MediaQuery.of(context).size.height * height: MediaQuery.of(context).size.height * 5.0,
5.0,
child: ListView.builder( child: ListView.builder(
itemCount: model.finalProducts.length, itemCount: model.finalProducts.length,
itemBuilder: itemBuilder: (BuildContext context, int index) {
(BuildContext context, int index) {
return InkWell( return InkWell(
child: Card( child: Card(
child: Padding( child: Row(
padding: const EdgeInsets.all(4.0), children: [
child: Row( Stack(
children: [ children: [
Stack( Column(
children: [ children: [
Column( Container(
children: [ decoration: BoxDecoration(),
Container( child: Padding(
decoration: padding: EdgeInsets.only(
BoxDecoration(), left: 9.0,
child: Padding( top: 8.0,
padding: right: 10.0,
EdgeInsets
.only(
left: 2.0,
top: 2.0,
right: 2.0,
),
), ),
), ),
Container( ),
// margin: EdgeInsets Container(
// .fromLTRB( margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
// 8, 0, 8, 0), alignment: Alignment.center,
alignment: Alignment child: Image.network(
.center, model.finalProducts[index].images.isNotEmpty
child: ? model.finalProducts[index].images[0].thumb
Image.network( : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
model fit: BoxFit.contain,
.finalProducts[ height: 80,
index]
.images
.isNotEmpty
? model
.finalProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit
.contain,
height: 70,
),
), ),
], ),
), ],
// Column(
// children: [
// Container(
// width: model
// .finalProducts[
// 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: Texts(
// model
// .finalProducts[
// index]
// .rxMessage !=
// null
// ? model
// .finalProducts[
// index]
// .rxMessage
// : "",
// color:
// Colors.white,
// regular: true,
// fontSize: 10,
// fontWeight:
// FontWeight
// .w600,
// ),
// ),
// ],
// ),
],
),
Container(
height: 130.0,
margin:
EdgeInsets.symmetric(
horizontal: 0,
vertical: 6,
), ),
child: Column( Column(
mainAxisAlignment:
MainAxisAlignment
.spaceAround,
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [ children: [
Container( Container(
margin: EdgeInsets width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0,
.symmetric( padding: EdgeInsets.all(4),
horizontal: 4, decoration: BoxDecoration(
vertical: 0, color: Color(0xffb23838),
), borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
width: model
.finalProducts[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
2.0
: 0,
padding:
EdgeInsets.all(
4),
decoration:
BoxDecoration(
color: Color(
0xffb23838),
// borderRadius: BorderRadius.only(
// topLeft: Radius
// .circular(
// 6)),
), ),
child: model
.finalProducts[
index]
.rxMessage !=
null
? Texts(
languageID ==
'ar'
? model
.finalProducts[
index]
.rxMessagen
: model
.finalProducts[index]
.rxMessage,
color: Colors
.white,
regular:
true,
fontSize:
10,
fontWeight:
FontWeight
.w600,
)
: Texts(""),
),
SizedBox(
height: 4.0,
),
Container(
width: MediaQuery.of(
context)
.size
.width *
0.65,
child: Texts( child: Texts(
model model.finalProducts[index].rxMessage != null ? model.finalProducts[index].rxMessage : "",
.finalProducts[ color: Colors.white,
index]
.name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 10,
fontWeight: fontWeight: FontWeight.w600,
FontWeight.w500,
maxLines: 5,
), ),
), ),
SizedBox(
height: 8.0,
),
Padding(
padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.finalProducts[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model
.finalProducts[
index]
.approvedRatingSum >
0
? (model.finalProducts[index].approvedRatingSum.toDouble() /
model.finalProducts[index].approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars:
true),
Texts(
"(${model.finalProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight
.w400,
)
],
),
], ],
), ),
],
),
Container(
height: 100.0,
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
), ),
child: Column(
widget.authenticatedUserObject.isLogin mainAxisAlignment: MainAxisAlignment.spaceAround,
? Container( crossAxisAlignment: CrossAxisAlignment.start,
child: IconButton( children: [
icon: Icon(Icons.shopping_cart, SizedBox(
size: 18, height: 4.0,
color: Colors.blue,), ),
onPressed: () async { Container(
if(model.finalProducts[index].rxMessage == null){ width: MediaQuery.of(context).size.width * 0.65,
GifLoaderDialogUtils.showMyDialog(context); child: Texts(
await addToCartFunction(1, model.finalProducts[index].id); model.finalProducts[index].name,
GifLoaderDialogUtils.hideDialog(context); regular: true,
Navigator.push( fontSize: 13.2,
context, fontWeight: FontWeight.w500,
FadePage(page: CartOrderPage())); maxLines: 5,
} ),
else{ ),
AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); SizedBox(
} height: 8.0,
),
Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Texts(
"SAR ${model.finalProducts[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model.finalProducts[index].approvedRatingSum > 0
? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble()
: 0,
forceStars: true),
Texts(
"(${model.finalProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
)
],
),
],
),
),
widget.authenticatedUserObject.isLogin
? Container(
child: IconButton(
icon: Icon(
Icons.shopping_cart,
size: 18,
color: Colors.blue,
),
onPressed: () async {
if (model.finalProducts[index].rxMessage == null) {
GifLoaderDialogUtils.showMyDialog(context);
await addToCartFunction(1, model.finalProducts[index].id);
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: CartOrderPage()));
} else {
AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription);
}
// //
} }),
)
), : Container(),
):Container(), ],
],
),
), ),
), ),
onTap: () => { onTap: () => {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: ProductDetailPage( page: ProductDetailPage(model.finalProducts[index]),
model.finalProducts[
index]),
)), )),
}, },
); );
@ -779,10 +475,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
) )
: Container( : Container(
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [ children: [
Align( Align(
alignment: Alignment.center, alignment: Alignment.center,

@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/PharmacyPagesViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_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/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart';
@ -14,36 +15,46 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../locator.dart'; import '../../locator.dart';
class LandingPagePharmacy extends StatefulWidget { class LandingPagePharmacy extends StatefulWidget {
final int currentTab;
const LandingPagePharmacy({Key key, this.currentTab = 0}) : super(key: key);
@override @override
_LandingPagePharmacyState createState() => _LandingPagePharmacyState(); _LandingPagePharmacyState createState() => _LandingPagePharmacyState();
} }
class _LandingPagePharmacyState extends State<LandingPagePharmacy> { class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
ProjectViewModel projectProvider;
int currentTab = 0; int currentTab = 0;
PageController pageController; PageController pageController;
ProjectViewModel projectProvider;
_changeCurrentTab(int tab) {
setState(() {
currentTab = tab;
pageController.jumpToPage(tab);
});
}
void initState() { void initState() {
super.initState(); super.initState();
locator<PharmacyModuleService>().manufacturerList = []; locator<PharmacyModuleService>().manufacturerList = [];
locator<PharmacyModuleService>().bestSellerProducts = []; locator<PharmacyModuleService>().bestSellerProducts = [];
locator<PharmacyModuleService>().lastVisitedProducts = []; locator<PharmacyModuleService>().lastVisitedProducts = [];
pageController =
PageController(keepPage: true, initialPage: widget.currentTab);
setState(() {
currentTab = widget.currentTab;
});
}
pageController = PageController(keepPage: true); changeCurrentTab(int tab) {
if (pageController.hasClients) {
setState(() {
currentTab = tab;
pageController.jumpToPage(tab);
});
}
} }
@override @override
@ -52,75 +63,13 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
onWillPop: () async { onWillPop: () async {
return false; return false;
}, },
child: Scaffold( child: AppScaffold(
appBar: currentTab != 4 && currentTab != 3 isBottomBar: true,
? AppBar(
backgroundColor: Color(0xff5AB145),
elevation: 0,
title: Container(
height: MediaQuery.of(context).size.height * 0.056,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color: Colors.white,
),
child: InkWell(
child: Padding(
padding: EdgeInsets.all(5.0),
child: Row(
//crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(Icons.search, size: 25.0),
SizedBox(
width: 15.0,
),
Texts(
TranslationBase.of(context).searchProductHere,
fontSize: 13,
)
],
),
),
onTap: () {
Navigator.push(
context,
FadePage(page: SearchProductsPage()),
);
},
),
),
leading: Builder(
builder: (BuildContext context) {
return InkWell(
onTap: () {
setState(() {
currentTab = 0;
pageController.jumpToPage(0);
});
},
child: Container(
height: 2.0,
width: 10.0,
child: Image.asset(
'assets/images/pharmacy_logo.png',
),
),
);
},
),
actions: [
IconButton(
// iconSize: 70,
icon: Image.asset(
'assets/images/new-design/qr-code.png',
),
onPressed: _scanQrAndGetProduct //do something,
)
],
centerTitle: true,
)
: null,
extendBody: false, extendBody: false,
isShowDecPage: false,
isMainPharmacyPages: true,
currentTab: currentTab,
changeCurrentTab: changeCurrentTab,
body: PageView( body: PageView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
controller: pageController, controller: pageController,
@ -128,13 +77,9 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
PharmacyPage(), PharmacyPage(),
PharmacyCategorisePage(), PharmacyCategorisePage(),
PharmacyProfilePage(), PharmacyProfilePage(),
CartOrderPage(changeTab: _changeCurrentTab), CartOrderPage(changeTab: changeCurrentTab),
], ],
), ),
bottomNavigationBar: BottomNavPharmacyBar(
changeIndex: _changeCurrentTab,
index: currentTab,
),
), ),
); );
} }

@ -384,6 +384,7 @@ class _Login extends State<Login> {
getRegisterData() async { getRegisterData() async {
var registerData = await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN); var registerData = await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN);
await sharedPref.remove(REGISTER_DATA_FOR_LOGIIN);
if (registerData != null) { if (registerData != null) {
setState(() { setState(() {

@ -329,15 +329,17 @@ class _Register extends State<Register> {
nRequest['LogInTokenID'] = response['LogInTokenID']; nRequest['LogInTokenID'] = response['LogInTokenID'];
if (response['hasFile'] == true) { if (response['hasFile'] == true) {
ConfirmDialog dialog = new ConfirmDialog( ConfirmDialog dialog = new ConfirmDialog(
context: context, context: context,
confirmMessage: response['ErrorEndUserMessage'], confirmMessage: response['ErrorEndUserMessage'],
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
okFunction: () { cancelText: TranslationBase.of(context).cancel,
AlertDialogBox.closeAlertDialog(context); okFunction: () {
AlertDialogBox.closeAlertDialog(context);
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest); sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest);
Navigator.of(context).push(FadePage(page: Login())); Navigator.of(context).push(FadePage(page: Login()));
}).showAlertDialog(context); },
cancelFunction: () {})
.showAlertDialog(context);
} else { } else {
nRequest['forRegister'] = true; nRequest['forRegister'] = true;
nRequest['isRegister'] = true; nRequest['isRegister'] = true;

@ -40,7 +40,7 @@ class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayo
if(viewModel.service.customer != null) { if(viewModel.service.customer != null) {
var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id); var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id);
await viewModel.service.addProductToCart(request, context: context).then((response){ await viewModel.service.addProductToCart(request, context: context).then((response){
appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
}).catchError((error) { }).catchError((error) {
utils.Utils.showErrorToast(error); utils.Utils.showErrorToast(error);
}); });
@ -50,7 +50,7 @@ class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayo
@override @override
void afterFirstLayout(BuildContext context) async{ void afterFirstLayout(BuildContext context) async{
appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
} }
@override @override

@ -96,7 +96,7 @@ class _PackagesHomePageState extends State<PackagesHomePage> with AfterLayoutMix
if(viewModel.service.customer != null) { if(viewModel.service.customer != null) {
var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id); var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id);
await viewModel.service.addProductToCart(request, context: context).then((response){ await viewModel.service.addProductToCart(request, context: context).then((response){
appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
}).catchError((error) { }).catchError((error) {
utils.Utils.showErrorToast(error.toString()); utils.Utils.showErrorToast(error.toString());
}); });

@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart'; import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -26,13 +27,12 @@ import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/pages/sub_categories_modalsheet.dart'; import 'package:diplomaticquarterapp/pages/sub_categories_modalsheet.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
class ParentCategorisePage extends StatefulWidget { class ParentCategorisePage extends StatefulWidget {
String id; String id;
String titleName; String titleName;
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>(); locator<AuthenticatedUserObject>();
ParentCategorisePage({this.id, this.titleName}); ParentCategorisePage({this.id, this.titleName});
@ -46,9 +46,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
String titleName; String titleName;
final dynamic productID; final dynamic productID;
_ParentCategorisePageState({
this.id,
_ParentCategorisePageState({this.id, this.titleName, this.productID,}); this.titleName,
this.productID,
});
Map<String, bool> values = {'huusam': false, 'ali': false, 'noor': false}; Map<String, bool> values = {'huusam': false, 'ali': false, 'noor': false};
bool checkedBrands = false; bool checkedBrands = false;
@ -75,9 +77,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
allowAny: true, allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model, builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) => Widget child) =>
PharmacyAppScaffold( AppScaffold(
isPharmacy: true,
appBarTitle: titleName, appBarTitle: titleName,
isBottomBar: false, isBottomBar: true,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
isShowDecPage: false, isShowDecPage: false,
@ -139,8 +142,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
page: SubCategoriseModalsheet( page: SubCategoriseModalsheet(
// id: model.categorise[0].id, // id: model.categorise[0].id,
// titleName: model.categorise[0].name, // titleName: model.categorise[0].name,
) )),
),
); );
// showModalBottomSheet<void>( // showModalBottomSheet<void>(
// isScrollControlled: true, // isScrollControlled: true,
@ -348,13 +350,13 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
width: 10.0, width: 10.0,
), ),
Texts( Texts(
TranslationBase.of(
TranslationBase.of(context).refine, context)
.refine,
// 'Refine', // 'Refine',
fontWeight: fontWeight:
FontWeight.w600, FontWeight.w600,
), ),
SizedBox( SizedBox(
width: 250.0, width: 250.0,
@ -362,7 +364,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
InkWell( InkWell(
child: Texts( child: Texts(
// 'Close', // 'Close',
TranslationBase.of(context).closeIt, TranslationBase.of(
context)
.closeIt,
color: Colors.red, color: Colors.red,
fontWeight: fontWeight:
FontWeight.w600, FontWeight.w600,
@ -383,10 +387,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column( Column(
children: [ children: [
ExpansionTile( ExpansionTile(
title: Texts(
title: Texts( TranslationBase.of( TranslationBase.of(
context) context)
.categorise), .categorise),
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
@ -424,9 +428,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts( TranslationBase.of( title: Texts(
context) TranslationBase.of(
.brands), context)
.brands),
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
@ -465,9 +470,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts( TranslationBase.of( title: Texts(
context) TranslationBase.of(
.price), context)
.price),
children: [ children: [
Container( Container(
color: Color( color: Color(
@ -558,14 +564,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Container( Container(
width: 100, width: 100,
child: Button( child: Button(
label: TranslationBase.of(
label: TranslationBase.of( context)
context)
.reset, .reset,
backgroundColor: Colors.red, backgroundColor:
Colors.red,
), ),
), ),
SizedBox( SizedBox(
@ -629,13 +632,12 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Navigator.pop( Navigator.pop(
context); context);
}, },
label: TranslationBase.of(
label: TranslationBase.of( context)
context)
.apply, .apply,
backgroundColor: Colors.green, backgroundColor:
Colors
.green,
), ),
), ),
], ],
@ -1131,7 +1133,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
padding: padding:
const EdgeInsets const EdgeInsets
.only( .only(
top: 4, bottom: 4), top: 4,
bottom: 4),
child: Texts( child: Texts(
"SAR ${model.parentProducts[index].price}", "SAR ${model.parentProducts[index].price}",
bold: true, bold: true,
@ -1167,30 +1170,50 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
], ],
), ),
), ),
widget.authenticatedUserObject
widget.authenticatedUserObject.isLogin ? .isLogin
Container( ? Container(
child: IconButton( child: IconButton(
icon: Icon(Icons.shopping_cart, icon: Icon(
size: 18, Icons
color: Colors.blue,), .shopping_cart,
onPressed: () async { size: 18,
if(model.parentProducts[index].rxMessage == null){ color:
GifLoaderDialogUtils.showMyDialog(context); Colors.blue,
await addToCartFunction(1, model.parentProducts[index].id); ),
GifLoaderDialogUtils.hideDialog(context); onPressed:
Navigator.push( () async {
context, if (model
FadePage(page: CartOrderPage())); .parentProducts[
} index]
else{ .rxMessage ==
AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); null) {
} GifLoaderDialogUtils
.showMyDialog(
} context);
await addToCartFunction(
), 1,
): Container(), model
.parentProducts[
index]
.id);
GifLoaderDialogUtils
.hideDialog(
context);
Navigator.push(
context,
FadePage(
page:
CartOrderPage()));
} else {
AppToast.showErrorToast(
message: TranslationBase.of(
context)
.needPrescription);
}
}),
)
: Container(),
], ],
), ),
), ),
@ -1238,8 +1261,6 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
), ),
)); ));
} }
addToCartFunction(quantity, itemID) async { addToCartFunction(quantity, itemID) async {
@ -1264,7 +1285,4 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
} }
return false; return false;
} }
} }

@ -33,105 +33,108 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
isShowDecPage: false, isShowDecPage: false,
body: Container( body: SingleChildScrollView(
child: Column( child: Container(
children: [ child: Column(
Container( children: [
color: Colors.white, Container(
alignment: color: Colors.white,
languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, alignment: languageID == 'ar'
padding: languageID == 'ar' ? Alignment.topRight
? EdgeInsets.only(right: 10.0, top: 10.0) : Alignment.topLeft,
: EdgeInsets.only(left: 10.0, top: 10.0), padding: languageID == 'ar'
child: Text( ? EdgeInsets.only(right: 10.0, top: 10.0)
TranslationBase.of(context).topBrands, : EdgeInsets.only(left: 10.0, top: 10.0),
style: TextStyle( child: Text(
fontWeight: FontWeight.bold, TranslationBase.of(context).topBrands,
style: TextStyle(
fontWeight: FontWeight.bold,
),
), ),
), ),
), Container(
Container( height: 220,
height: 220, width: double.infinity,
width: double.infinity,
color: Colors.white,
child: topBrand(context),
),
SizedBox(
height: 10,
),
Container(
height: MediaQuery.of(context).size.height * 0.056,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color: Colors.white, color: Colors.white,
child: topBrand(context),
), ),
child: InkWell( SizedBox(
child: Padding( height: 10,
padding: EdgeInsets.all(8.0), ),
child: Row( Container(
//crossAxisAlignment: CrossAxisAlignment.center, height: MediaQuery.of(context).size.height * 0.056,
mainAxisAlignment: MainAxisAlignment.start, decoration: BoxDecoration(
children: [ borderRadius: BorderRadius.circular(5.0),
Icon(Icons.search, size: 25.0), color: Colors.white,
SizedBox( ),
width: 15.0, child: InkWell(
), child: Padding(
Texts( padding: EdgeInsets.all(8.0),
TranslationBase.of(context).searchProductHere, child: Row(
fontSize: 13, //crossAxisAlignment: CrossAxisAlignment.center,
) mainAxisAlignment: MainAxisAlignment.start,
], children: [
Icon(Icons.search, size: 25.0),
SizedBox(
width: 15.0,
),
Texts(
TranslationBase.of(context).searchProductHere,
fontSize: 13,
)
],
),
), ),
onTap: () {
Navigator.push(
context,
FadePage(page: SearchBrandsPage()),
);
},
), ),
onTap: () {
Navigator.push(
context,
FadePage(page: SearchBrandsPage()),
);
},
), ),
), SizedBox(
SizedBox( height: 10,
height: 10, ),
), Container(
Container( height: 420,
height: 420, width: double.infinity,
width: double.infinity, color: Colors.white,
color: Colors.white, child: ListView.builder(
child: ListView.builder( itemCount: model.brandsListList.length,
itemCount: model.brandsListList.length, itemBuilder: (BuildContext context, int index) {
itemBuilder: (BuildContext context, int index) { return InkWell(
return InkWell( child: Container(
child: Container( margin: EdgeInsets.only(top: 50, left: 10),
margin: EdgeInsets.only(top: 50, left: 10), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, children: [
children: [ languageID == 'ar'
languageID == 'ar' ? Text(model.brandsListList[index].namen)
? Text(model.brandsListList[index].namen) : Text(model.brandsListList[index].name),
: Text(model.brandsListList[index].name), SizedBox(
SizedBox( height: 3,
height: 3, ),
), Divider(height: 1, color: Colors.grey)
Divider(height: 1, color: Colors.grey) ],
], ),
), ),
), onTap: () {
onTap: () { Navigator.push(
Navigator.push( context,
context, MaterialPageRoute(
MaterialPageRoute( builder: (context) => FinalProductsPage(
builder: (context) => FinalProductsPage( id: model.brandsListList[index].id
id: model.brandsListList[index].id .toString(),
.toString(), )),
)), );
); },
}, );
); }),
}), ),
), ],
], ),
), ),
), ),
), ),

@ -55,8 +55,10 @@ class _CartOrderPageState extends State<CartOrderPage> {
appBarTitle: TranslationBase.of(context).shoppingCart, appBarTitle: TranslationBase.of(context).shoppingCart,
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
//isBottomBar: true,
showHomeAppBarIcon: false, showHomeAppBarIcon: false,
isShowDecPage: true, isShowDecPage: false,
isMainPharmacyPages: true,
baseViewModel: model, baseViewModel: model,
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: !(model.cartResponse.shoppingCarts == null || body: !(model.cartResponse.shoppingCarts == null ||
@ -103,8 +105,8 @@ class _CartOrderPageState extends State<CartOrderPage> {
.shoppingCarts[index]) .shoppingCarts[index])
.then((value) { .then((value) {
if (model.state != ViewState.Error) { if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater( // appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}'); // '${value.quantityCount ?? 0}');
} }
if (model.state == if (model.state ==
ViewState.ErrorLocal) { ViewState.ErrorLocal) {
@ -117,8 +119,8 @@ class _CartOrderPageState extends State<CartOrderPage> {
.shoppingCarts[index]) .shoppingCarts[index])
.then((value) { .then((value) {
if (model.state != ViewState.Error) { if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater( // appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}'); // '${value.quantityCount ?? 0}');
} }
}); });
})) }))

@ -89,7 +89,7 @@ class PaymentBottomWidget extends StatelessWidget {
message: message:
"Order has been placed successfully!!"); "Order has been placed successfully!!");
openPayment( openPayment(
model.orderListModel[0], model.user); model.orderListModel[0], model.authenticatedUserObject.user);
} else { } else {
AppToast.showErrorToast(message: model.error); AppToast.showErrorToast(message: model.error);
} }

@ -37,14 +37,14 @@ class SelectAddressWidget extends StatefulWidget {
class _SelectAddressWidgetState extends State<SelectAddressWidget> { class _SelectAddressWidgetState extends State<SelectAddressWidget> {
AddressInfo address; AddressInfo address;
_navigateToAddressPage() { _navigateToAddressPage(String identificationNo) {
Navigator.push(context, FadePage(page: PharmacyAddressesPage())) Navigator.push(context, FadePage(page: PharmacyAddressesPage()))
.then((result) { .then((result) {
if (result != null) { if (result != null) {
address = result; address = result;
widget.model.paymentCheckoutData.address = widget.model.paymentCheckoutData.address =
Addresses.fromJson(address.toJson()); Addresses.fromJson(address.toJson());
widget.model.getInformationsByAddress(); widget.model.getInformationsByAddress(identificationNo);
widget.changeMainState(); widget.changeMainState();
} }
}); });
@ -66,7 +66,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
color: Colors.white, color: Colors.white,
child: address == null child: address == null
? InkWell( ? InkWell(
onTap: () => {_navigateToAddressPage()}, onTap: () => {_navigateToAddressPage(model.user.patientIdentificationNo)},
child: Container( child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row( child: Row(
@ -125,7 +125,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
), ),
), ),
InkWell( InkWell(
onTap: () => {_navigateToAddressPage()}, onTap: () => {_navigateToAddressPage(model.authenticatedUserObject.user.patientIdentificationNo)},
child: Texts( child: Texts(
TranslationBase.of(context).changeAddress, TranslationBase.of(context).changeAddress,
fontSize: 12, fontSize: 12,

@ -42,21 +42,24 @@ class _PharmacyPageState extends State<PharmacyPage> {
allowAny: true, allowAny: true,
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
title: "", title: "",
isShowAppBar: false,
isShowDecPage: false, isShowDecPage: false,
baseViewModel: model, baseViewModel: model,
isMainPharmacyPages: true,
isPharmacy: true,
isShowPharmacyAppbar: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: Container( body: Container(
width: double.infinity, width: double.infinity,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
//crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
BannerPager(model), BannerPager(model),
// GridViewButtons(model),
PrescriptionsWidget(), PrescriptionsWidget(),
// ShopByBrandWidget(), ShopByBrandWidget(),
RecentlyViewedWidget(), RecentlyViewedWidget(),
BestSellerWidget(), BestSellerWidget(),
ShopByBrandWidget(),
], ],
), ),
), ),

@ -1,10 +1,7 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart';
@ -14,7 +11,6 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_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 'package:flutter/material.dart';
import 'availability_info.dart'; import 'availability_info.dart';
@ -106,8 +102,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
deleteFromWishlistFunction: () async { deleteFromWishlistFunction: () async {
await deleteFromWishlistFunction(itemID: itemID, model: model); await deleteFromWishlistFunction(itemID: itemID, model: model);
}, },
isInWishList:isInWishList, isInWishList: isInWishList,
addToCartFunction:addToCartFunction , addToCartFunction: addToCartFunction,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
@ -125,8 +121,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
), ),
if (widget.product.discountDescription != null) if (widget.product.discountDescription != null) DiscountDescription(product: widget.product)
DiscountDescription(product: widget.product)
], ],
), ),
), ),
@ -144,15 +139,11 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
setState(() {}); setState(() {});
}, },
deleteFromWishlistFunction: (item) { deleteFromWishlistFunction: (item) {
deleteFromWishlistFunction( deleteFromWishlistFunction(itemID: item, model: model);
itemID: item, model: model);
setState(() {}); setState(() {});
}, },
notifyMeWhenAvailable: (context, itemId) { notifyMeWhenAvailable: (context, itemId) {
notifyMeWhenAvailable( notifyMeWhenAvailable(itemId: itemId, customerId: customerId, model: model);
itemId: itemId,
customerId: customerId,
model: model);
}, },
isInWishList: isInWishList, isInWishList: isInWishList,
), ),
@ -167,8 +158,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10),
vertical: 15, horizontal: 10),
child: Texts( child: Texts(
TranslationBase.of(context).specification, TranslationBase.of(context).specification,
fontSize: 15, fontSize: 15,
@ -205,16 +195,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).details, TranslationBase.of(context).details,
style: TextStyle( style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isDetails color: isDetails ? Colors.green : Colors.transparent,
? Colors.green
: Colors.transparent,
) )
], ],
), ),
@ -225,14 +211,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
children: [ children: [
FlatButton( FlatButton(
onPressed: () async { onPressed: () async {
if (widget.product.approvedTotalReviews > if (widget.product.approvedTotalReviews > 0) {
0) { GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog( await model.getProductReviewsData(widget.product.id);
context); GifLoaderDialogUtils.hideDialog(context);
await model.getProductReviewsData(
widget.product.id);
GifLoaderDialogUtils.hideDialog(
context);
} else { } else {
model.clearReview(); model.clearReview();
} }
@ -244,16 +226,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).reviews, TranslationBase.of(context).reviews,
style: TextStyle( style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isReviews color: isReviews ? Colors.green : Colors.transparent,
? Colors.green
: Colors.transparent,
), ),
], ],
), ),
@ -264,8 +242,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
children: [ children: [
FlatButton( FlatButton(
onPressed: () async { onPressed: () async {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context);
await model.getProductLocationData(); await model.getProductLocationData();
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
@ -277,16 +254,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).availability, TranslationBase.of(context).availability,
style: TextStyle( style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isAvailability color: isAvailability ? Colors.green : Colors.transparent,
? Colors.green
: Colors.transparent,
), ),
], ],
), ),
@ -315,12 +288,16 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
RecommendedProducts(product: widget.product,productDetailViewModel: model, RecommendedProducts(
product: widget.product,
productDetailViewModel: model,
addToWishlistFunction: (itemID) async { addToWishlistFunction: (itemID) async {
await addToWishlistFunction(itemID: itemID, model: model); await addToWishlistFunction(itemID: itemID, model: model);
}, deleteFromWishlistFunction: (itemID) async { },
deleteFromWishlistFunction: (itemID) async {
await deleteFromWishlistFunction(itemID: itemID, model: model); await deleteFromWishlistFunction(itemID: itemID, model: model);
},) },
)
], ],
), ),
), ),
@ -339,6 +316,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
)); ));
} }
addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async {
await model.addToCartData(quantity, itemID);
}
addToWishlistFunction({itemID, ProductDetailViewModel model}) async { addToWishlistFunction({itemID, ProductDetailViewModel model}) async {
isInWishList = true; isInWishList = true;
await model.addToWishlistData(itemID); await model.addToWishlistData(itemID);
@ -350,31 +331,18 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
await model.deleteWishlistData(itemID); await model.deleteWishlistData(itemID);
setState(() {}); setState(() {});
} }
addToCartFunction(
{quantity,
itemID,
ProductDetailViewModel model}) async {
GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID);
GifLoaderDialogUtils.hideDialog(context);
}
addToShoppingCartFunction( addToCartFunction({
{quantity, quantity,
itemID, itemID,
ProductDetailViewModel model}) async { ProductDetailViewModel model,
}) async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID); await model.addToCartData(quantity, itemID);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Navigator.push(
context,
FadePage(page: CartOrderPage()));
} }
} }
notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model}) async {
notifyMeWhenAvailable(
{itemId, customerId, ProductDetailViewModel model}) async {
await model.notifyMe(customerId, itemId); await model.notifyMe(customerId, itemId);
} }

@ -25,9 +25,19 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
final bool isInWishList; final bool isInWishList;
final Function addToCartFunction; final Function addToCartFunction;
ProductAppBar({Key key, this.product, this.model, this.addToWishlistFunction, this.quantity, this.deleteFromWishlistFunction, this.isInWishList, this.addToCartFunction}) : super(key: key); ProductAppBar(
{Key key,
this.product,
this.model,
this.addToWishlistFunction,
this.quantity,
this.deleteFromWishlistFunction,
this.isInWishList,
this.addToCartFunction})
: super(key: key);
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -69,7 +79,11 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
MaterialPageRoute(builder: (context) => CartOrderPage()), MaterialPageRoute(builder: (context) => CartOrderPage()),
); );
}), }),
if (Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount != 0) if (Provider.of<OrderPreviewViewModel>(context,
listen: false)
.cartResponse
.quantityCount !=
0)
Positioned( Positioned(
top: 0, top: 0,
right: -1.0, right: -1.0,
@ -79,10 +93,14 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
), ),
padding: EdgeInsets.only(left: 5, right: 4.5), padding: EdgeInsets.only(left: 5, right: 4.5),
height: 19, height: 18,
child: Center( child: Center(
child: Texts( child: Texts(
orderPreviewViewModel.cartResponse.quantityCount.toString(), Provider.of<OrderPreviewViewModel>(context,
listen: false)
.cartResponse
.quantityCount
.toString(),
style: "caption", style: "caption",
medium: true, medium: true,
color: Colors.white, color: Colors.white,
@ -130,7 +148,11 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
onTap: () async { onTap: () async {
if (quantity > 0) { if (quantity > 0) {
{ {
await addToCartFunction(quantity: quantity, itemID: itemID, model: model); await addToCartFunction(
quantity: quantity,
itemID: itemID,
model: model,
context: context);
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
@ -144,7 +166,9 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
color: !isInWishList ? Colors.white : Colors.red[800], color: !isInWishList ? Colors.white : Colors.red[800],
), ),
title: Text( title: Text(
isInWishList ? TranslationBase.of(context).removeFromWishlist : TranslationBase.of(context).addToWishlist, isInWishList
? TranslationBase.of(context).removeFromWishlist
: TranslationBase.of(context).addToWishlist,
), ),
onTap: () async { onTap: () async {
if (isInWishList) if (isInWishList)
@ -159,7 +183,8 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
TranslationBase.of(context).compare, TranslationBase.of(context).compare,
), ),
onTap: () { onTap: () {
Provider.of<CompareList>(context, listen: false).addItem(specificationData); Provider.of<CompareList>(context, listen: false)
.addItem(specificationData);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),

@ -118,22 +118,23 @@ class _SearchBrandsPageState extends State<SearchBrandsPage> {
itemCount: model.searchList.length, itemCount: model.searchList.length,
itemBuilder: (BuildContext ctx, index) { itemBuilder: (BuildContext ctx, index) {
return Padding( return Padding(
padding:EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Container( child: Container(
child: Text( child: Text(
model.searchList[index].name, model.searchList[index].name,
style: TextStyle(fontSize: 20), style: TextStyle(fontSize: 20),
),
), ),
), ),
), Divider(height: 1, color: Colors.grey)
Divider(height: 1, color: Colors.grey) ],
],), ),
); );
}, },
), ),

@ -36,7 +36,7 @@ class PrescriptionsWidget extends StatelessWidget {
ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()), ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()),
Container( Container(
margin: EdgeInsets.only(right: 10.0, left: 10.0), margin: EdgeInsets.only(right: 10.0, left: 10.0),
height: MediaQuery.of(context).size.height * 0.28, height: MediaQuery.of(context).size.height * 0.18,
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
shrinkWrap: true, shrinkWrap: true,

@ -94,9 +94,12 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
}, },
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).myAccount, appBarTitle: TranslationBase.of(context).myAccount,
isShowAppBar: false, isShowAppBar: true,
isShowDecPage: false, isShowDecPage: true,
isPharmacy: true, isPharmacy: true,
//isBottomBar: true,
isMainPharmacyPages: true,
body: user != null body: user != null
? Container( ? Container(
color: Colors.white, color: Colors.white,
@ -208,7 +211,9 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
Text( Text(
TranslationBase.of(context).lakum, TranslationBase.of(context).lakum,
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold),
), ),
], ],
), ),
@ -217,7 +222,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Expanded( Expanded(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: WishlistPage())); Navigator.push(context,
FadePage(page: WishlistPage()));
}, },
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -243,7 +249,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Expanded( Expanded(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: MyReviewsPage())); Navigator.push(context,
FadePage(page: MyReviewsPage()));
}, },
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -288,7 +295,9 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
children: <Widget>[ children: <Widget>[
Text( Text(
TranslationBase.of(context).myAccount, TranslationBase.of(context).myAccount,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -299,7 +308,10 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: HomePrescriptionsPage())); Navigator.push(
context,
FadePage(
page: HomePrescriptionsPage()));
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -312,7 +324,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
width: 15, width: 15,
), ),
Text( Text(
TranslationBase.of(context).myPrescription, TranslationBase.of(context)
.myPrescription,
style: TextStyle( style: TextStyle(
fontSize: 13.0, fontSize: 13.0,
), ),
@ -329,11 +342,15 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: ComparePage())); Navigator.push(context,
FadePage(page: ComparePage()));
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Image.asset('assets/images/pharmacy/compare.png', width: 35, height: 35), Image.asset(
'assets/images/pharmacy/compare.png',
width: 35,
height: 35),
SizedBox( SizedBox(
width: 15, width: 15,
), ),
@ -355,7 +372,10 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: HomePrescriptionsPage())); Navigator.push(
context,
FadePage(
page: HomePrescriptionsPage()));
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -368,7 +388,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
width: 20, width: 20,
), ),
Text( Text(
TranslationBase.of(context).medicationsRefill, TranslationBase.of(context)
.medicationsRefill,
style: TextStyle( style: TextStyle(
fontSize: 13.0, fontSize: 13.0,
), ),
@ -385,7 +406,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: MyFamily())); Navigator.push(
context, FadePage(page: MyFamily()));
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -415,7 +437,10 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: PharmacyAddressesPage())); Navigator.push(
context,
FadePage(
page: PharmacyAddressesPage()));
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -428,7 +453,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
width: 20, width: 20,
), ),
Text( Text(
TranslationBase.of(context).shippingAddresses, TranslationBase.of(context)
.shippingAddresses,
style: TextStyle( style: TextStyle(
fontSize: 13.0, fontSize: 13.0,
), ),
@ -445,7 +471,10 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: PharmacyTermsConditions())); Navigator.push(
context,
FadePage(
page: PharmacyTermsConditions()));
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -458,7 +487,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
width: 10, width: 10,
), ),
Text( Text(
TranslationBase.of(context).conditionsHMG, TranslationBase.of(context)
.conditionsHMG,
style: TextStyle( style: TextStyle(
fontSize: 13.0, fontSize: 13.0,
), ),
@ -475,7 +505,15 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, this.mobileNo, this.languageId))); Navigator.push(
context,
FadePage(
page: LakumTermsConditions(
this.identificationNo,
this.firstName,
this.lastName,
this.mobileNo,
this.languageId)));
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -490,7 +528,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
width: 10, width: 10,
), ),
Text( Text(
TranslationBase.of(context).conditions, TranslationBase.of(context)
.conditions,
style: TextStyle( style: TextStyle(
fontSize: 13.0, fontSize: 13.0,
), ),
@ -521,7 +560,9 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
children: <Widget>[ children: <Widget>[
Text( Text(
TranslationBase.of(context).reachUs, TranslationBase.of(context).reachUs,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold),
), ),
SizedBox( SizedBox(
height: 5, height: 5,
@ -532,7 +573,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: LiveChatPage())); Navigator.push(context,
FadePage(page: LiveChatPage()));
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -560,7 +602,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push(context, FadePage(page: FindUsPage())); Navigator.push(context,
FadePage(page: FindUsPage()));
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -573,7 +616,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
width: 20, width: 20,
), ),
Text( Text(
TranslationBase.of(context).ourLocations, TranslationBase.of(context)
.ourLocations,
style: TextStyle(fontSize: 13.0), style: TextStyle(fontSize: 13.0),
), ),
], ],

@ -35,6 +35,10 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
Widget child) => Widget child) =>
AppScaffold( AppScaffold(
isShowDecPage: false, isShowDecPage: false,
isShowAppBar: false,
isMainPharmacyPages: true,
isPharmacy: true,
isShowPharmacyAppbar: true,
baseViewModel: model, baseViewModel: model,
body: Column( body: Column(
children: [ children: [

@ -2,10 +2,14 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart';
import 'package:diplomaticquarterapp/models/pharmacy/addToCartModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
class ProductDetailService extends BaseService { class ProductDetailService extends BaseService {
@ -73,7 +77,7 @@ class ProductDetailService extends BaseService {
}, body: request); }, body: request);
} }
Future addToCart(quantity, itemID) async { Future<Map> addToCart(quantity, itemID) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false; hasError = false;
Map<String, dynamic> request; Map<String, dynamic> request;
@ -88,9 +92,8 @@ class ProductDetailService extends BaseService {
"language_id": 1 "language_id": 1
} }
}; };
dynamic localRes;
await baseAppClient.pharmacyPost(GET_SHOPPING_CART, isExternal: false, await baseAppClient.pharmacyPost(GET_SHOPPING_CART, isExternal: false,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_addToCartModel.clear(); _addToCartModel.clear();
@ -98,11 +101,14 @@ class ProductDetailService extends BaseService {
_addToCartModel.add(Wishlist.fromJson(item)); _addToCartModel.add(Wishlist.fromJson(item));
}); });
AppToast.showSuccessToast(message: 'You have added a product to the cart'); AppToast.showSuccessToast(message: 'You have added a product to the cart');
localRes = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage()); AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
}, body: request); }, body: request);
return Future.value(localRes);
} }
Future notifyMe(customerId, itemID) async { Future notifyMe(customerId, itemID) async {
@ -142,7 +148,7 @@ class ProductDetailService extends BaseService {
Future getWishlistItems() async { Future getWishlistItems() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false; hasError = false;
await baseAppClient.getPharmacy(GET_WISHLIST.toString()+customerId.toString()+"?shopping_cart_type=2", await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2",
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear(); _wishListProducts.clear();
response['shopping_carts'].forEach((item) { response['shopping_carts'].forEach((item) {

@ -1,17 +1,30 @@
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:badges/badges.dart'; import 'package:badges/badges.dart';
import 'package:barcode_scan_fix/barcode_scan.dart';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
import 'package:diplomaticquarterapp/core/viewModels/PharmacyPagesViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/search_products_page.dart';
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -25,7 +38,7 @@ import 'not_auh_page.dart';
VoidCallback _onCartClick; VoidCallback _onCartClick;
class AppScaffold extends StatelessWidget { class AppScaffold extends StatefulWidget {
final String appBarTitle; final String appBarTitle;
final Widget body; final Widget body;
final Widget bottomSheet; final Widget bottomSheet;
@ -60,12 +73,18 @@ class AppScaffold extends StatelessWidget {
List<String> dropDownList; List<String> dropDownList;
final Function(int) dropDownIndexChange; final Function(int) dropDownIndexChange;
Function onTap; Function onTap;
final bool isMainPharmacyPages;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); final bool extendBody;
final ValueChanged<int> changeCurrentTab;
AppBarWidget appBar; final int currentTab;
final bool isShowPharmacyAppbar;
final Widget customAppBar; final Widget customAppBar;
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick;
return this;
}
AppScaffold( AppScaffold(
{@required this.body, {@required this.body,
this.appBarTitle = '', this.appBarTitle = '',
@ -73,6 +92,8 @@ class AppScaffold extends StatelessWidget {
this.isShowAppBar = false, this.isShowAppBar = false,
this.showNewAppBar = false, this.showNewAppBar = false,
this.showNewAppBarTitle = false, this.showNewAppBarTitle = false,
this.isMainPharmacyPages = false,
this.extendBody = false,
this.hasAppBarParam, this.hasAppBarParam,
this.bottomSheet, this.bottomSheet,
this.bottomNavigationBar, this.bottomNavigationBar,
@ -85,7 +106,7 @@ class AppScaffold extends StatelessWidget {
this.title, this.title,
this.description, this.description,
this.isShowDecPage = true, this.isShowDecPage = true,
this.isBottomBar, this.isBottomBar = false,
this.backgroundColor, this.backgroundColor,
this.preferredSize = 0.0, this.preferredSize = 0.0,
this.appBarIcons, this.appBarIcons,
@ -102,78 +123,200 @@ class AppScaffold extends StatelessWidget {
appBar, appBar,
this.customAppBar, this.customAppBar,
this.isLocalLoader = false, this.isLocalLoader = false,
this.backButtonTab}); this.backButtonTab,
this.changeCurrentTab,
this.currentTab,
this.isShowPharmacyAppbar = false});
AppScaffold setOnAppBarCartClick(VoidCallback onClick) { @override
_onCartClick = onClick; _AppScaffoldState createState() => _AppScaffoldState();
return this; }
class _AppScaffoldState extends State<AppScaffold> {
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AppBarWidget appBar;
@override
void initState() {
// TODO: implement initState
super.initState();
}
AppBar pharmacyAppbar() {
return AppBar(
backgroundColor: Color(0xff5AB145),
elevation: 0,
title: Container(
height: MediaQuery.of(context).size.height * 0.056,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color: Colors.white,
),
child: InkWell(
child: Padding(
padding: EdgeInsets.all(5.0),
child: Row(
//crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(Icons.search, size: 25.0),
SizedBox(
width: 15.0,
),
Texts(
TranslationBase.of(context).searchProductHere,
fontSize: 13,
)
],
),
),
onTap: () {
Navigator.push(
context,
FadePage(page: SearchProductsPage()),
);
},
),
),
leading: Builder(
builder: (BuildContext context) {
return InkWell(
onTap: () {
Provider.of<PharmacyPagesViewModel>(context, listen: false).changeCurrentTab(0);
},
child: Container(
height: 2.0,
width: 10.0,
child: Image.asset(
'assets/images/pharmacy_logo.png',
),
),
);
},
),
actions: [
IconButton(
// iconSize: 70,
icon: Image.asset(
'assets/images/new-design/qr-code.png',
),
onPressed: _scanQrAndGetProduct //do something,
)
],
centerTitle: true,
);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppGlobal.context = context; AppGlobal.context = context;
PharmacyPagesViewModel pagesViewModel = Provider.of(context);
bool isUserNotLogin = (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && isShowDecPage); bool isUserNotLogin = (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && widget.isShowDecPage);
return Scaffold( return Scaffold(
backgroundColor: backgroundColor ?? CustomColors.appBackgroudGrey2Color, backgroundColor: widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color,
// appBar: widget.isShowPharmacyAppbar
// ? pharmacyAppbar()
// : widget.isShowAppBar
// ? widget.customAppBar != null
// ? widget.customAppBar
appBar: isUserNotLogin appBar: isUserNotLogin
? null ? null
: (showNewAppBar : widget.isShowPharmacyAppbar
? NewAppBarWidget( ? pharmacyAppbar()
title: appBarTitle, : (widget.showNewAppBar
showTitle: showNewAppBarTitle, ? NewAppBarWidget(
showDropDown: showDropDown, title: widget.appBarTitle,
dropdownIndexValue: dropdownIndexValue, showTitle: widget.showNewAppBarTitle,
dropDownList: dropDownList ?? [], showDropDown: widget.showDropDown,
dropDownIndexChange: dropDownIndexChange, dropdownIndexValue: widget.dropdownIndexValue,
appBarIcons: appBarIcons, dropDownList: widget.dropDownList ?? [],
onTap: onTap, dropDownIndexChange: widget.dropDownIndexChange,
) appBarIcons: widget.appBarIcons,
: (isShowAppBar onTap: widget.onTap,
? customAppBar != null )
? customAppBar : (widget.isShowAppBar
: appBar = AppBarWidget( ? widget.customAppBar != null
appBarTitle: appBarTitle, ? widget.customAppBar
appBarIcons: appBarIcons, : appBar = AppBarWidget(
showHomeAppBarIcon: showHomeAppBarIcon, appBarTitle: widget.appBarTitle,
isPharmacy: isPharmacy, appBarIcons: widget.appBarIcons,
showPharmacyCart: showPharmacyCart, showHomeAppBarIcon: widget.showHomeAppBarIcon,
isOfferPackages: isOfferPackages, isPharmacy: widget.isPharmacy,
showOfferPackagesCart: showOfferPackagesCart, showPharmacyCart: widget.showPharmacyCart,
isShowDecPage: isShowDecPage, isOfferPackages: widget.isOfferPackages,
backButtonTab: backButtonTab, showOfferPackagesCart: widget.showOfferPackagesCart,
) isShowDecPage: widget.isShowDecPage,
: null)), backButtonTab: widget.backButtonTab,
bottomSheet: bottomSheet, )
: null)),
bottomSheet: widget.bottomSheet,
body: SafeArea( body: SafeArea(
top: true, top: true,
bottom: true, bottom: true,
child: isUserNotLogin child: isUserNotLogin
? NotAutPage( ? NotAutPage(
title: title ?? appBarTitle, title: widget.title ?? widget.appBarTitle,
description: description, description: widget.description,
infoList: infoList, infoList: widget.infoList,
imagesInfo: imagesInfo, imagesInfo: widget.imagesInfo,
icon: icon, icon: widget.icon,
) )
: baseViewModel != null : widget.baseViewModel != null
? NetworkBaseView( ? NetworkBaseView(
child: buildBodyWidget(context), child: buildBodyWidget(context),
baseViewModel: baseViewModel, baseViewModel: widget.baseViewModel,
) )
: buildBodyWidget(context), : buildBodyWidget(context),
), ),
bottomNavigationBar: bottomNavigationBar, bottomNavigationBar: widget.isBottomBar
floatingActionButton: floatingActionButton, ? BottomNavPharmacyBar(
changeIndex: changeCurrentTab,
index: widget.currentTab,
)
: null,
floatingActionButton: widget.floatingActionButton,
); );
} }
void changeCurrentTab(int value) {
if (widget.isMainPharmacyPages) {
widget.changeCurrentTab(value);
} else {
Navigator.pushAndRemoveUntil(
locator<NavigationService>().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: value)), (Route<dynamic> r) => false);
}
}
void _scanQrAndGetProduct() async {
try {
String result = await BarcodeScanner.scan();
try {
String barcode = result;
GifLoaderDialogUtils.showMyDialog(context);
await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", onSuccess: (dynamic response, int statusCode) {
print(response);
var product = PharmacyProduct.fromJson(response["products"][0]);
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: ProductDetailPage(product)));
}, onFailure: (String error, int statusCode) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: "Product not found");
});
} catch (apiEx) {
AppToast.showErrorToast(message: "Something went wrong, please try again");
}
} catch (barcodeEx) {}
}
buildAppLoaderWidget(bool isLoading) { buildAppLoaderWidget(bool isLoading) {
return isLoading ? AppLoaderWidget() : Container(); return isLoading ? AppLoaderWidget() : Container();
} }
buildBodyWidget(context) { buildBodyWidget(context) {
return Stack(children: <Widget>[body, isHelp == true ? RobotIcon() : Container()]); return Stack(children: <Widget>[widget.body, widget.isHelp == true ? RobotIcon() : Container()]);
} }
} }
@ -206,7 +349,6 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
// centerTitle: false, // centerTitle: false,
title: Row( title: Row(
children: [ children: [
if (showTitle) if (showTitle)
Expanded( Expanded(
child: Text( child: Text(
@ -256,17 +398,19 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
], ],
), ),
actions: <Widget>[ actions: <Widget>[
if (appBarIcons != null) ...appBarIcons else if (appBarIcons != null)
IconButton( ...appBarIcons
onPressed: () { else
Navigator.pushAndRemoveUntil( IconButton(
context, onPressed: () {
MaterialPageRoute(builder: (context) => LandingPage()), Navigator.pushAndRemoveUntil(
(Route<dynamic> route) => false, context,
); MaterialPageRoute(builder: (context) => LandingPage()),
}, (Route<dynamic> route) => false,
icon: Icon(Icons.home), );
), },
icon: Icon(Icons.home),
),
], ],
); );
} }

@ -7,9 +7,9 @@ import 'bottom_nav_pharmacy_item.dart';
class BottomNavPharmacyBar extends StatefulWidget { class BottomNavPharmacyBar extends StatefulWidget {
final ValueChanged<int> changeIndex; final ValueChanged<int> changeIndex;
final int index;
BottomNavPharmacyBar({Key key, this.changeIndex, this.index}) : super(key: key); BottomNavPharmacyBar({Key key, this.changeIndex, this.index}) : super(key: key);
int index = 0;
@override @override
_BottomNavPharmacyBarState createState() => _BottomNavPharmacyBarState(); _BottomNavPharmacyBarState createState() => _BottomNavPharmacyBarState();

@ -9,7 +9,7 @@ class BottomNavHomeItem extends StatelessWidget {
final Image image; final Image image;
final String title; final String title;
final ValueChanged<int> changeIndex; final Function changeIndex;
final int index; final int index;
final int currentIndex; final int currentIndex;
final Function onTap; final Function onTap;
@ -62,7 +62,6 @@ class BottomNavHomeItem extends StatelessWidget {
'assets/images/habib-logo.png', 'assets/images/habib-logo.png',
), ),
height: 22.0, height: 22.0,
), ),
SizedBox( SizedBox(
height: 5, height: 5,

@ -163,7 +163,7 @@ class productTile extends StatelessWidget {
), ),
onPressed: () async { onPressed: () async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await addToCartFunction(1, productID); await addToCartFunction(1, productID, context);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Navigator.push( Navigator.push(
context, context,
@ -292,7 +292,7 @@ class productTile extends StatelessWidget {
// await x.deletWishlistData(itemID); // await x.deletWishlistData(itemID);
// } // }
addToCartFunction(quantity, itemID) async { addToCartFunction(quantity, itemID, BuildContext context) async {
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
await x.addToCartData(quantity, itemID); await x.addToCartData(quantity, itemID);
} }

Loading…
Cancel
Save