Merge branch 'development' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into merge_dev_into_dev_new_design_2.0

 Conflicts:
	lib/main.dart
	lib/pages/final_products_page.dart
	lib/pages/landing/landing_page_pharmcy.dart
	lib/pages/pharmacies/screens/pharmacy_module_page.dart
	lib/widgets/others/app_scaffold_widget.dart
merge-requests/474/head
Elham Rababh 5 years ago
commit 5a389de93f

@ -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();
}
}
}

@ -1,5 +1,6 @@
import 'dart:io'; 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';
@ -23,7 +24,6 @@ import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'core/viewModels/project_view_model.dart'; import 'core/viewModels/project_view_model.dart';
import 'locator.dart'; import 'locator.dart';
import 'pages/pharmacies/compare-list.dart'; import 'pages/pharmacies/compare-list.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
FirebaseApp defaultApp = await Firebase.initializeApp(); FirebaseApp defaultApp = await Firebase.initializeApp();
@ -84,6 +84,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(),
), ),

@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/pr
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/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';
@ -79,9 +80,10 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
allowAny: true, allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model, builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) => Widget child) =>
PharmacyAppScaffold( AppScaffold(
isPharmacy: true,
appBarTitle: appBarTitle, appBarTitle: appBarTitle,
isBottomBar: false, isBottomBar: true,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
isShowDecPage: false, isShowDecPage: false,
@ -91,8 +93,6 @@ 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: [
@ -743,8 +743,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
child: IconButton( child: IconButton(
icon: Icon(Icons.shopping_cart, icon: Icon(Icons.shopping_cart,
size: 18, size: 18,
color: Colors.blue,), color: Colors.blue,
onPressed: () async { ),onPressed: () async {
if(model.finalProducts[index].rxMessage == null){ if(model.finalProducts[index].rxMessage == null){
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await addToCartFunction(1, model.finalProducts[index].id); await addToCartFunction(1, model.finalProducts[index].id);
@ -752,15 +752,15 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
Navigator.push( Navigator.push(
context, context,
FadePage(page: CartOrderPage())); FadePage(page: CartOrderPage()));
}
else{ }else{
AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription);
} }
// //
} }
),
), )
):Container(), :Container(),
], ],
), ),
), ),

@ -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,
),
), ),
); );
} }

@ -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,7 +27,6 @@ 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;
@ -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,8 +387,8 @@ 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: [
@ -424,7 +428,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts( TranslationBase.of( title: Texts(
TranslationBase.of(
context) context)
.brands), .brands),
children: [ children: [
@ -465,7 +470,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts( TranslationBase.of( title: Texts(
TranslationBase.of(
context) context)
.price), .price),
children: [ children: [
@ -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(
Icons
.shopping_cart,
size: 18, size: 18,
color: Colors.blue,), color:
onPressed: () async { Colors.blue,
if(model.parentProducts[index].rxMessage == null){ ),
GifLoaderDialogUtils.showMyDialog(context); onPressed:
await addToCartFunction(1, model.parentProducts[index].id); () async {
GifLoaderDialogUtils.hideDialog(context); if (model
.parentProducts[
index]
.rxMessage ==
null) {
GifLoaderDialogUtils
.showMyDialog(
context);
await addToCartFunction(
1,
model
.parentProducts[
index]
.id);
GifLoaderDialogUtils
.hideDialog(
context);
Navigator.push( Navigator.push(
context, context,
FadePage(page: CartOrderPage())); FadePage(
} page:
else{ CartOrderPage()));
AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); } else {
} AppToast.showErrorToast(
message: TranslationBase.of(
context)
.needPrescription);
} }
}),
), )
): Container(), : 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,13 +33,15 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
isShowDecPage: false, isShowDecPage: false,
body: Container( body: SingleChildScrollView(
child: Container(
child: Column( child: Column(
children: [ children: [
Container( Container(
color: Colors.white, color: Colors.white,
alignment: alignment: languageID == 'ar'
languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, ? Alignment.topRight
: Alignment.topLeft,
padding: languageID == 'ar' padding: languageID == 'ar'
? EdgeInsets.only(right: 10.0, top: 10.0) ? EdgeInsets.only(right: 10.0, top: 10.0)
: EdgeInsets.only(left: 10.0, top: 10.0), : EdgeInsets.only(left: 10.0, top: 10.0),
@ -135,6 +137,7 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
), ),
), ),
), ),
),
); );
} }
} }

@ -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 ||

@ -42,10 +42,12 @@ 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,
backgroundColor: Colors.white, isMainPharmacyPages: true,
isPharmacy: true,
isShowPharmacyAppbar: true,backgroundColor: Colors.white,
body: Container( body: Container(
width: double.infinity, width: double.infinity,
child: SingleChildScrollView( child: SingleChildScrollView(

@ -118,7 +118,7 @@ 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,
@ -133,7 +133,8 @@ class _SearchBrandsPageState extends State<SearchBrandsPage> {
), ),
), ),
Divider(height: 1, color: Colors.grey) Divider(height: 1, color: Colors.grey)
],), ],
),
); );
}, },
), ),

@ -94,8 +94,10 @@ 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: false,
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,
@ -233,8 +235,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Expanded( Expanded(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(context,
context,
FadePage(page: WishlistPage())); FadePage(page: WishlistPage()));
}, },
child: Column( child: Column(

@ -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: [

@ -1,16 +1,32 @@
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/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/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/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: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';
@ -25,7 +41,9 @@ import 'not_auh_page.dart';
VoidCallback _onCartClick; VoidCallback _onCartClick;
class AppScaffold extends StatelessWidget { class AppScaffold extends StatefulWidget {
AppBarWidget appBar;
final String appBarTitle; final String appBarTitle;
final Widget body; final Widget body;
final Widget bottomSheet; final Widget bottomSheet;
@ -39,9 +57,11 @@ class AppScaffold extends StatelessWidget {
final bool isBottomBar; final bool isBottomBar;
final Widget floatingActionButton; final Widget floatingActionButton;
final bool isPharmacy; final bool isPharmacy;
final bool isMainPharmacyPages;
final bool isOfferPackages; final bool isOfferPackages;
final bool showPharmacyCart; final bool showPharmacyCart;
final bool showOfferPackagesCart; final bool showOfferPackagesCart;
final bool extendBody;
final String title; final String title;
final String description; final String description;
final bool isShowDecPage; final bool isShowDecPage;
@ -64,7 +84,14 @@ class AppScaffold extends StatelessWidget {
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AppBarWidget appBar; AppBarWidget appBar;
final ValueChanged<int> changeCurrentTab;
final Widget customAppBar; final Widget customAppBar;
final int currentTab;
final bool isShowPharmacyAppbar;
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick;
return this;
}
AppScaffold( AppScaffold(
{@required this.body, {@required this.body,
@ -79,13 +106,15 @@ class AppScaffold extends StatelessWidget {
this.baseViewModel, this.baseViewModel,
this.floatingActionButton, this.floatingActionButton,
this.isPharmacy = false, this.isPharmacy = false,
this.isMainPharmacyPages = false,
this.showPharmacyCart = true, this.showPharmacyCart = true,
this.isOfferPackages = false, this.isOfferPackages = false,
this.showOfferPackagesCart = false, this.showOfferPackagesCart = false,
this.extendBody = false,
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,20 +131,100 @@ 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>();
@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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
PharmacyPagesViewModel pagesViewModel = Provider.of(context);
AppGlobal.context = context; AppGlobal.context = context;
bool isUserNotLogin = (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && isShowDecPage); bool isUserNotLogin = (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && isShowDecPage);
return Scaffold( return Scaffold(
backgroundColor: backgroundColor ?? CustomColors.appBackgroudGrey2Color, backgroundColor: backgroundColor ?? CustomColors.appBackgroudGrey2Color,
extendBody: widget.extendBody,
appBar: isUserNotLogin appBar: isUserNotLogin
? null ? null
: (showNewAppBar : (showNewAppBar
@ -129,7 +238,9 @@ class AppScaffold extends StatelessWidget {
appBarIcons: appBarIcons, appBarIcons: appBarIcons,
onTap: onTap, onTap: onTap,
) )
: (isShowAppBar : widget.isShowPharmacyAppbar
? pharmacyAppbar()
:(isShowAppBar
? customAppBar != null ? customAppBar != null
? customAppBar ? customAppBar
: appBar = AppBarWidget( : appBar = AppBarWidget(
@ -144,30 +255,55 @@ class AppScaffold extends StatelessWidget {
backButtonTab: backButtonTab, backButtonTab: backButtonTab,
) )
: null)), : null)),
bottomSheet: bottomSheet, bottomSheet: widget.bottomSheet,
body: SafeArea( body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
top: true, widget.isShowDecPage)
bottom: true,
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,
) )
: baseViewModel != null : widget.baseViewModel != null
? NetworkBaseView( ? NetworkBaseView(
child: buildBodyWidget(context), child: buildBodyWidget(context),
baseViewModel: baseViewModel, baseViewModel: widget.baseViewModel,
) )
: buildBodyWidget(context), : buildBodyWidget(context),
), floatingActionButton: widget.floatingActionButton,
bottomNavigationBar: bottomNavigationBar, bottomNavigationBar: widget.isBottomBar
floatingActionButton: floatingActionButton, ? BottomNavPharmacyBar(
changeIndex: changeCurrentTab,
index: widget.currentTab,
)
: null,
); );
} }
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();
} }

@ -9,7 +9,8 @@ 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; int index = 0;
BottomNavPharmacyBar({Key key, this.changeIndex, this.index}) BottomNavPharmacyBar({Key key, this.changeIndex, this.index})
: super(key: key); : super(key: key);

@ -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,

Loading…
Cancel
Save