Merge branch 'development' into haroon-new-design

# Conflicts:
#	lib/core/viewModels/pharmacyModule/product_detail_view_model.dart
#	lib/main.dart
#	lib/pages/final_products_page.dart
#	lib/pages/landing/landing_page_pharmcy.dart
#	lib/pages/login/login.dart
#	lib/pages/pharmacies/screens/pharmacy_module_page.dart
#	lib/pages/pharmacies/screens/product-details/product-detail.dart
#	lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart
#	lib/pages/pharmacy/profile/profile.dart
#	lib/services/pharmacy_services/product_detail_service.dart
#	lib/widgets/others/app_scaffold_widget.dart
#	lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart
merge-requests/481/head
haroon amjad 4 years ago
commit 925e3cb686

@ -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();
double totalAdditionalShippingCharge = 0;
setShoppingCartResponse(ShoppingCartResponse cart){
cartResponse = cart;
notifyListeners();
}
Future getOrderPreviewData() async {
setState(ViewState.Busy);
await _orderService.getAddresses();

@ -1,13 +1,17 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.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/locationModel.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/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../locator.dart';
@ -61,12 +65,39 @@ class ProductDetailViewModel extends BaseViewModel{
Future addToCartData(quantity, itemID) async {
hasError = false;
setState(ViewState.BusyLocal);
await _productDetailService.addToCart(quantity, itemID);
var resp = await _productDetailService.addToCart(quantity, itemID);
ShoppingCartResponse object = _handleGetShoppingCartResponse(resp);
if (_productDetailService.hasError) {
error = _productDetailService.error;
setState(ViewState.ErrorLocal);
} else
} else {
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 {

@ -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/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/routes.dart';
@ -84,6 +83,9 @@ class _MyApp extends State<MyApp> {
SizeConfig().init(constraints, orientation);
return MultiProvider(
providers: [
ChangeNotifierProvider<PharmacyPagesViewModel>(
create: (context) => PharmacyPagesViewModel(),
),
ChangeNotifierProvider<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/locator.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/gif_loader_dialog_utils.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/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/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/image.dart' as flutterImage;
import 'base/base_view.dart';
dynamic languageID;
@ -22,8 +22,7 @@ dynamic languageID;
class FinalProductsPage extends StatefulWidget {
final String id;
final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
FinalProductsPage({this.id, this.productType = 1});
@ -33,7 +32,9 @@ class FinalProductsPage extends StatefulWidget {
class _FinalProductsPageState extends State<FinalProductsPage> {
String id;
_FinalProductsPageState({this.id});
String categoriseName = "Personal Care";
String appBarTitle = "";
bool styleOne = true;
@ -77,11 +78,10 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
}
},
allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold(
isPharmacy: true,
appBarTitle: appBarTitle,
isBottomBar: false,
isBottomBar: true,
isShowAppBar: true,
backgroundColor: Colors.white,
isShowDecPage: false,
@ -91,16 +91,13 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//Expanded widget heree if nassery
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsets.all(8.0),
child: Texts(
"$appBarTitle " +
TranslationBase.of(context).products,
"$appBarTitle " + TranslationBase.of(context).products,
fontWeight: FontWeight.w600,
),
),
@ -154,29 +151,21 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
? Expanded(
child: model.finalProducts.length > 0
? Container(
height: MediaQuery.of(context).size.height *
3.90,
height: MediaQuery.of(context).size.height * 3.90,
child: GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
childAspectRatio: 1.0,
),
itemCount: model.finalProducts.length,
itemBuilder:
(BuildContext context, int index) {
itemBuilder: (BuildContext context, int index) {
return NetworkBaseView(
baseViewModel: model,
child: InkWell(
child: Card(
color:
model.finalProducts[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
color: model.finalProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white,
elevation: 0,
shape: Border(
right: BorderSide(
@ -198,226 +187,84 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
),
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 1,
// vertical: 2,
vertical: 4,
),
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.only(
topLeft: Radius.circular(
110.0),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(110.0),
),
color: Colors.white,
),
padding: EdgeInsets.symmetric(
horizontal: 4,
),
padding: EdgeInsets.symmetric(horizontal: 0),
width: MediaQuery.of(context).size.width / 3,
// width: MediaQuery.of(context)
// .size
// .width /
// 1,
// height: MediaQuery.of(context)
// .size
// .width /
// 1,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
children: [
Container(
margin: EdgeInsets
.fromLTRB(0, 1,
0, 0),
alignment: Alignment
.center,
child:
Image.network(
model
.finalProducts[
index]
.images
.isNotEmpty
? model
.finalProducts[
index]
.images[0]
.thumb
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
alignment: Alignment.center,
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',
fit: BoxFit.cover,
height: 70,
height: 80,
),
),
// Container(
// width: model
// .finalProducts[
// index]
// .rxMessage !=
// null
// ? 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)),
Container(
width: model.finalProducts[index].rxMessage != null ? 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
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,
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(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (model
.finalProducts[
index]
.discountName !=
null)
if (model.finalProducts[index].discountName != null)
Container(
width: double
.infinity,
width: double.infinity,
height: 13.0,
decoration:
BoxDecoration(
color: Color(
0xff5AB145),
decoration: BoxDecoration(
color: Color(0xff5AB145),
),
child: Center(
child: Texts(
model
.finalProducts[
index]
.discountName,
regular:
true,
color: Colors
.white,
fontSize:
10.4,
model.finalProducts[index].discountName,
regular: true,
color: Colors.white,
fontSize: 10.4,
),
),
),
Texts(
model
.finalProducts[
index]
.name,
model.finalProducts[index].name,
regular: true,
fontSize: 12,
fontWeight:
FontWeight
.w400,
fontWeight: FontWeight.w400,
),
Padding(
padding:
const EdgeInsets
.only(
top: 4,
bottom:
4),
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Texts(
"SAR ${model.finalProducts[index].price}",
bold: true,
@ -427,20 +274,15 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
Row(
children: [
StarRating(
totalAverage: model.finalProducts[index].approvedRatingSum >
0
? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble())
.toDouble()
totalAverage: model.finalProducts[index].approvedRatingSum > 0
? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble()
: 0,
forceStars:
true),
forceStars: true),
Texts(
"(${model.finalProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight
.w400,
fontWeight: FontWeight.w400,
)
],
),
@ -455,9 +297,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.finalProducts[
index]),
page: ProductDetailPage(model.finalProducts[index]),
)),
},
));
@ -466,10 +306,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
)
: Container(
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Align(
alignment: Alignment.center,
@ -493,285 +331,143 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
: Expanded(
child: model.finalProducts.length > 0
? Container(
height: MediaQuery.of(context).size.height *
5.0,
height: MediaQuery.of(context).size.height * 5.0,
child: ListView.builder(
itemCount: model.finalProducts.length,
itemBuilder:
(BuildContext context, int index) {
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: Card(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: Row(
children: [
Stack(
children: [
Column(
children: [
Container(
decoration:
BoxDecoration(),
child: Padding(
padding:
EdgeInsets
.only(
left: 2.0,
top: 2.0,
right: 2.0,
),
child: Row(
children: [
Stack(
children: [
Column(
children: [
Container(
decoration: BoxDecoration(),
child: Padding(
padding: EdgeInsets.only(
left: 9.0,
top: 8.0,
right: 10.0,
),
),
Container(
// margin: EdgeInsets
// .fromLTRB(
// 8, 0, 8, 0),
alignment: Alignment
.center,
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',
fit: BoxFit
.contain,
height: 70,
),
),
Container(
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
alignment: Alignment.center,
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',
fit: BoxFit.contain,
height: 80,
),
],
),
// 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(
mainAxisAlignment:
MainAxisAlignment
.spaceAround,
crossAxisAlignment:
CrossAxisAlignment
.start,
Column(
children: [
Container(
margin: EdgeInsets
.symmetric(
horizontal: 4,
vertical: 0,
),
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)),
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: 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(
model
.finalProducts[
index]
.name,
model.finalProducts[index].rxMessage != null ? model.finalProducts[index].rxMessage : "",
color: Colors.white,
regular: true,
fontSize: 13.2,
fontWeight:
FontWeight.w500,
maxLines: 5,
fontSize: 10,
fontWeight: FontWeight.w600,
),
),
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,
),
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);
}
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 4.0,
),
Container(
width: MediaQuery.of(context).size.width * 0.65,
child: Texts(
model.finalProducts[index].name,
regular: true,
fontSize: 13.2,
fontWeight: FontWeight.w500,
maxLines: 5,
),
),
SizedBox(
height: 8.0,
),
Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Texts(
"SAR ${model.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: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.finalProducts[
index]),
page: ProductDetailPage(model.finalProducts[index]),
)),
},
);
@ -779,10 +475,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
)
: Container(
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Align(
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/service/client/base_app_client.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/pages/pharmacies/screens/cart-page/cart-order-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/translations_delegate_base.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/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../locator.dart';
class LandingPagePharmacy extends StatefulWidget {
final int currentTab;
const LandingPagePharmacy({Key key, this.currentTab = 0}) : super(key: key);
@override
_LandingPagePharmacyState createState() => _LandingPagePharmacyState();
}
class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
ProjectViewModel projectProvider;
int currentTab = 0;
PageController pageController;
ProjectViewModel projectProvider;
_changeCurrentTab(int tab) {
setState(() {
currentTab = tab;
pageController.jumpToPage(tab);
});
}
void initState() {
super.initState();
locator<PharmacyModuleService>().manufacturerList = [];
locator<PharmacyModuleService>().bestSellerProducts = [];
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
@ -52,75 +63,13 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
onWillPop: () async {
return false;
},
child: Scaffold(
appBar: currentTab != 4 && currentTab != 3
? 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,
child: AppScaffold(
isBottomBar: true,
extendBody: false,
isShowDecPage: false,
isMainPharmacyPages: true,
currentTab: currentTab,
changeCurrentTab: changeCurrentTab,
body: PageView(
physics: NeverScrollableScrollPhysics(),
controller: pageController,
@ -128,13 +77,9 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
PharmacyPage(),
PharmacyCategorisePage(),
PharmacyProfilePage(),
CartOrderPage(changeTab: _changeCurrentTab),
CartOrderPage(changeTab: changeCurrentTab),
],
),
bottomNavigationBar: BottomNavPharmacyBar(
changeIndex: _changeCurrentTab,
index: currentTab,
),
),
);
}

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

@ -33,105 +33,108 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
isShowAppBar: true,
isPharmacy: true,
isShowDecPage: false,
body: Container(
child: Column(
children: [
Container(
color: Colors.white,
alignment:
languageID == 'ar' ? Alignment.topRight : Alignment.topLeft,
padding: languageID == 'ar'
? EdgeInsets.only(right: 10.0, top: 10.0)
: EdgeInsets.only(left: 10.0, top: 10.0),
child: Text(
TranslationBase.of(context).topBrands,
style: TextStyle(
fontWeight: FontWeight.bold,
body: SingleChildScrollView(
child: Container(
child: Column(
children: [
Container(
color: Colors.white,
alignment: languageID == 'ar'
? Alignment.topRight
: Alignment.topLeft,
padding: languageID == 'ar'
? EdgeInsets.only(right: 10.0, top: 10.0)
: EdgeInsets.only(left: 10.0, top: 10.0),
child: Text(
TranslationBase.of(context).topBrands,
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
),
Container(
height: 220,
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),
Container(
height: 220,
width: double.infinity,
color: Colors.white,
child: topBrand(context),
),
child: InkWell(
child: Padding(
padding: EdgeInsets.all(8.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,
)
],
SizedBox(
height: 10,
),
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(8.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: SearchBrandsPage()),
);
},
),
onTap: () {
Navigator.push(
context,
FadePage(page: SearchBrandsPage()),
);
},
),
),
SizedBox(
height: 10,
),
Container(
height: 420,
width: double.infinity,
color: Colors.white,
child: ListView.builder(
itemCount: model.brandsListList.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: Container(
margin: EdgeInsets.only(top: 50, left: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
languageID == 'ar'
? Text(model.brandsListList[index].namen)
: Text(model.brandsListList[index].name),
SizedBox(
height: 3,
),
Divider(height: 1, color: Colors.grey)
],
SizedBox(
height: 10,
),
Container(
height: 420,
width: double.infinity,
color: Colors.white,
child: ListView.builder(
itemCount: model.brandsListList.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: Container(
margin: EdgeInsets.only(top: 50, left: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
languageID == 'ar'
? Text(model.brandsListList[index].namen)
: Text(model.brandsListList[index].name),
SizedBox(
height: 3,
),
Divider(height: 1, color: Colors.grey)
],
),
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FinalProductsPage(
id: model.brandsListList[index].id
.toString(),
)),
);
},
);
}),
),
],
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FinalProductsPage(
id: model.brandsListList[index].id
.toString(),
)),
);
},
);
}),
),
],
),
),
),
),

@ -55,8 +55,10 @@ class _CartOrderPageState extends State<CartOrderPage> {
appBarTitle: TranslationBase.of(context).shoppingCart,
isShowAppBar: true,
isPharmacy: true,
//isBottomBar: true,
showHomeAppBarIcon: false,
isShowDecPage: true,
isShowDecPage: false,
isMainPharmacyPages: true,
baseViewModel: model,
backgroundColor: Colors.white,
body: !(model.cartResponse.shoppingCarts == null ||

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

@ -3,6 +3,8 @@ import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.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';
@ -338,6 +340,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
),
));
}
addToShoppingCartFunction({quantity,itemID,ProductDetailViewModel model})async{
await model.addToCartData(quantity,itemID);
}
addToWishlistFunction({itemID, ProductDetailViewModel model}) async {
isInWishList = true;
@ -353,22 +359,11 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
addToCartFunction(
{quantity,
itemID,
ProductDetailViewModel model}) async {
GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID);
GifLoaderDialogUtils.hideDialog(context);
}
addToShoppingCartFunction(
{quantity,
itemID,
ProductDetailViewModel model}) async {
ProductDetailViewModel model,
}) async {
GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID);
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(
context,
FadePage(page: CartOrderPage()));
}
}

@ -25,9 +25,19 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
final bool isInWishList;
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
Widget build(BuildContext context) {
@ -69,7 +79,11 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
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(
top: 0,
right: -1.0,
@ -79,10 +93,14 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.only(left: 5, right: 4.5),
height: 19,
height: 18,
child: Center(
child: Texts(
orderPreviewViewModel.cartResponse.quantityCount.toString(),
Provider.of<OrderPreviewViewModel>(context,
listen: false)
.cartResponse
.quantityCount
.toString(),
style: "caption",
medium: true,
color: Colors.white,
@ -130,7 +148,11 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
onTap: () async {
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();
}
@ -144,7 +166,9 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
color: !isInWishList ? Colors.white : Colors.red[800],
),
title: Text(
isInWishList ? TranslationBase.of(context).removeFromWishlist : TranslationBase.of(context).addToWishlist,
isInWishList
? TranslationBase.of(context).removeFromWishlist
: TranslationBase.of(context).addToWishlist,
),
onTap: () async {
if (isInWishList)
@ -159,7 +183,8 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
TranslationBase.of(context).compare,
),
onTap: () {
Provider.of<CompareList>(context, listen: false).addItem(specificationData);
Provider.of<CompareList>(context, listen: false)
.addItem(specificationData);
Navigator.of(context).pop();
},
),

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

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

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

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

@ -1,17 +1,36 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:badges/badges.dart';
import 'package:barcode_scan_fix/barcode_scan.dart';
import 'package:diplomaticquarterapp/config/config.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/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/pharmacyModule/OrderPreviewViewModel.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_pharmcy.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/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart';
import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart';
import 'package:diplomaticquarterapp/pages/search_products_page.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/robo_search/event_provider.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/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.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/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
@ -25,7 +44,9 @@ import 'not_auh_page.dart';
VoidCallback _onCartClick;
class AppScaffold extends StatelessWidget {
class AppScaffold extends StatefulWidget {
AppBarWidget appBar;
final String appBarTitle;
final Widget body;
final Widget bottomSheet;
@ -39,9 +60,11 @@ class AppScaffold extends StatelessWidget {
final bool isBottomBar;
final Widget floatingActionButton;
final bool isPharmacy;
final bool isMainPharmacyPages;
final bool isOfferPackages;
final bool showPharmacyCart;
final bool showOfferPackagesCart;
final bool extendBody;
final String title;
final String description;
final bool isShowDecPage;
@ -60,11 +83,18 @@ class AppScaffold extends StatelessWidget {
List<String> dropDownList;
final Function(int) dropDownIndexChange;
Function onTap;
final ValueChanged<int> changeCurrentTab;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AppBarWidget appBar;
final Widget customAppBar;
final int currentTab;
final bool isShowPharmacyAppbar;
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick;
return this;
}
AppScaffold(
{@required this.body,
@ -79,13 +109,15 @@ class AppScaffold extends StatelessWidget {
this.baseViewModel,
this.floatingActionButton,
this.isPharmacy = false,
this.isMainPharmacyPages = false,
this.showPharmacyCart = true,
this.isOfferPackages = false,
this.showOfferPackagesCart = false,
this.extendBody = false,
this.title,
this.description,
this.isShowDecPage = true,
this.isBottomBar,
this.isBottomBar = false,
this.backgroundColor,
this.preferredSize = 0.0,
this.appBarIcons,
@ -102,15 +134,91 @@ class AppScaffold extends StatelessWidget {
appBar,
this.customAppBar,
this.isLocalLoader = false,
this.backButtonTab});
this.backButtonTab,
this.changeCurrentTab,
this.currentTab,
this.isShowPharmacyAppbar = false});
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick;
return this;
@override
_AppScaffoldState createState() => _AppScaffoldState();
}
class _AppScaffoldState extends State<AppScaffold> {
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
@override
void 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
Widget build(BuildContext context) {
PharmacyPagesViewModel pagesViewModel = Provider.of(context);
AppGlobal.context = context;
bool isUserNotLogin = (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && isShowDecPage);
@ -118,32 +226,34 @@ class AppScaffold extends StatelessWidget {
backgroundColor: backgroundColor ?? CustomColors.appBackgroudGrey2Color,
appBar: isUserNotLogin
? null
: (showNewAppBar
? NewAppBarWidget(
title: appBarTitle,
showTitle: showNewAppBarTitle,
showDropDown: showDropDown,
dropdownIndexValue: dropdownIndexValue,
dropDownList: dropDownList ?? [],
dropDownIndexChange: dropDownIndexChange,
appBarIcons: appBarIcons,
onTap: onTap,
)
: (isShowAppBar
? customAppBar != null
? customAppBar
: appBar = AppBarWidget(
appBarTitle: appBarTitle,
appBarIcons: appBarIcons,
showHomeAppBarIcon: showHomeAppBarIcon,
isPharmacy: isPharmacy,
showPharmacyCart: showPharmacyCart,
isOfferPackages: isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart,
isShowDecPage: isShowDecPage,
backButtonTab: backButtonTab,
)
: null)),
: (widget.isShowPharmacyAppbar
? pharmacyAppbar()
: showNewAppBar
? NewAppBarWidget(
title: appBarTitle,
showTitle: showNewAppBarTitle,
showDropDown: showDropDown,
dropdownIndexValue: dropdownIndexValue,
dropDownList: dropDownList ?? [],
dropDownIndexChange: dropDownIndexChange,
appBarIcons: appBarIcons,
onTap: onTap,
)
: (isShowAppBar
? customAppBar != null
? customAppBar
: appBar = AppBarWidget(
appBarTitle: appBarTitle,
appBarIcons: appBarIcons,
showHomeAppBarIcon: showHomeAppBarIcon,
isPharmacy: isPharmacy,
showPharmacyCart: showPharmacyCart,
isOfferPackages: isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart,
isShowDecPage: isShowDecPage,
backButtonTab: backButtonTab,
)
: null)),
bottomSheet: bottomSheet,
body: SafeArea(
top: true,
@ -168,6 +278,27 @@ class AppScaffold extends StatelessWidget {
);
}
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) {
return isLoading ? AppLoaderWidget() : Container();
}
@ -206,7 +337,6 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
// centerTitle: false,
title: Row(
children: [
if (showTitle)
Expanded(
child: Text(
@ -256,17 +386,19 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
],
),
actions: <Widget>[
if (appBarIcons != null) ...appBarIcons else
IconButton(
onPressed: () {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> route) => false,
);
},
icon: Icon(Icons.home),
),
if (appBarIcons != null)
...appBarIcons
else
IconButton(
onPressed: () {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> route) => false,
);
},
icon: Icon(Icons.home),
),
],
);
}

@ -10,6 +10,10 @@ class BottomNavPharmacyBar extends StatefulWidget {
final int index;
BottomNavPharmacyBar({Key key, this.changeIndex, this.index}) : super(key: key);
int index = 0;
BottomNavPharmacyBar({Key key, this.changeIndex, this.index})
: super(key: key);
@override
_BottomNavPharmacyBarState createState() => _BottomNavPharmacyBarState();

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

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

Loading…
Cancel
Save