Merge branch 'bottom_nav_pharmacy' into 'development'

Bottom nav pharmacy

See merge request Cloud_Solution/diplomatic-quarter!478
merge-update-with-lab-changes
Mohammad Aljammal 4 years ago
commit c0cf2f71a2

@ -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,4 +1,5 @@
import 'package:diplomaticquarterapp/analytics/google-analytics.dart';
import 'package:diplomaticquarterapp/core/viewModels/PharmacyPagesViewModel.dart';
import 'package:diplomaticquarterapp/theme/theme_notifier.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/routes.dart';
@ -19,7 +20,6 @@ import 'locator.dart';
import 'pages/pharmacies/compare-list.dart';
import 'package:firebase_core/firebase_core.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
FirebaseApp defaultApp = await Firebase.initializeApp();
@ -34,7 +34,6 @@ class MyApp extends StatefulWidget {
}
class _MyApp extends State<MyApp> {
@override
void initState() {
// ProjectViewModel projectProvider;
@ -52,7 +51,6 @@ class _MyApp extends State<MyApp> {
.showNow(title: "Payload", subtitle: payload, payload: payload);
});
// final themeNotifier = Provider.of<ThemeNotifier>(context);
precacheImage(AssetImage('assets/images/powerd-by.jpg'), context);
return LayoutBuilder(
@ -62,6 +60,9 @@ class _MyApp extends State<MyApp> {
SizeConfig().init(constraints, orientation);
return MultiProvider(
providers: [
ChangeNotifierProvider<PharmacyPagesViewModel>(
create: (context) => PharmacyPagesViewModel(),
),
ChangeNotifierProvider<ProjectViewModel>(
create: (context) => ProjectViewModel(),
),
@ -85,9 +86,7 @@ class _MyApp extends State<MyApp> {
],
child: Consumer<ProjectViewModel>(
builder: (context, projectProvider, child) => MaterialApp(
navigatorObservers: [
GAnalytics.shared.navObserver()
],
navigatorObservers: [GAnalytics.shared.navObserver()],
navigatorKey: locator<NavigationService>().navigatorKey,
showSemanticsDebugger: false,
title: 'Diplomatic Quarter App',

@ -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/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';
@ -23,7 +24,7 @@ class FinalProductsPage extends StatefulWidget {
final String id;
final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>();
FinalProductsPage({this.id, this.productType = 1});
@ -79,9 +80,10 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
AppScaffold(
isPharmacy: true,
appBarTitle: appBarTitle,
isBottomBar: false,
isBottomBar: true,
isShowAppBar: true,
backgroundColor: Colors.white,
isShowDecPage: false,
@ -91,8 +93,6 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//Expanded widget heree if nassery
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -613,30 +613,51 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
],
),
),
widget.authenticatedUserObject.isLogin
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: 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(),
],
),
),

@ -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/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
@ -15,36 +16,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
@ -53,75 +64,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,
@ -129,41 +78,13 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
PharmacyPage(),
PharmacyCategorisePage(),
PharmacyProfilePage(),
CartOrderPage(changeTab: _changeCurrentTab),
CartOrderPage(changeTab: changeCurrentTab),
],
),
bottomNavigationBar: BottomNavPharmacyBar(
changeIndex: _changeCurrentTab,
index: currentTab,
),
),
);
}
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) {}
}
getText(currentTab) {
switch (currentTab) {
case 2:

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

@ -35,105 +35,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(),
)),
);
},
);
}),
),
],
),
),
),
),

@ -48,8 +48,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,
backButtonTab:
widget.changeTab != null ? () => widget.changeTab(0) : null,

@ -21,36 +21,38 @@ class _PharmacyPageState extends State<PharmacyPage> {
Widget build(BuildContext context) {
OrderPreviewViewModel orderPreviewViewModel = Provider.of(context);
return WillPopScope(
onWillPop: ()async{
onWillPop: () async {
return false;
},
child:BaseView<PharmacyModuleViewModel>(
onModelReady: (model) async {
await model.getSavedLanguage();
await model.getBannerList();
if(model.isLogin)
await orderPreviewViewModel.getShoppingCart();
},
allowAny: true,
builder: (_, model, wi) => AppScaffold(
title: "",
isShowAppBar: false,
isShowDecPage: false,
baseViewModel: model,
backgroundColor: Colors.white,
body: Container(
width: double.infinity,
child: SingleChildScrollView(
child: Column(
//crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
BannerPager(model),
GridViewButtons(model),
PrescriptionsWidget(),
ShopByBrandWidget(),
RecentlyViewedWidget(),
BestSellerWidget(),
],),
child: BaseView<PharmacyModuleViewModel>(
onModelReady: (model) async {
await model.getSavedLanguage();
await model.getBannerList();
if (model.isLogin) await orderPreviewViewModel.getShoppingCart();
},
allowAny: true,
builder: (_, model, wi) => AppScaffold(
title: "",
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(),
RecentlyViewedWidget(),
BestSellerWidget(),
],
),
),
),
),

@ -108,22 +108,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,11 +94,13 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).myAccount,
isShowAppBar: false,
isShowDecPage: false,
isShowDecPage: true,
isPharmacy: true,
//isBottomBar: true,
isMainPharmacyPages: true,
body: user != null
? Container(
color: Colors.white,
color: Colors.white,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
@ -233,8 +235,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
Expanded(
child: InkWell(
onTap: () {
Navigator.push(
context,
Navigator.push(context,
FadePage(page: WishlistPage()));
},
child: Column(

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

@ -1,20 +1,34 @@
import 'package:badges/badges.dart';
import 'package:barcode_scan_fix/barcode_scan.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/config/size_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/insurance/insurance_update_screen.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/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/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:diplomaticquarterapp/widgets/typewriter/typewiter.dart';
@ -33,7 +47,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;
@ -44,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;
@ -59,12 +77,14 @@ class AppScaffold extends StatelessWidget {
final bool isHelp;
final bool isLocalLoader;
final Function backButtonTab;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AppBarWidget appBar;
final ValueChanged<int> changeCurrentTab;
final Widget customAppBar;
final int currentTab;
final bool isShowPharmacyAppbar;
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick;
return this;
}
AppScaffold(
{@required this.body,
@ -76,13 +96,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,
@ -93,58 +115,197 @@ 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;
return Scaffold(
backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar
? customAppBar != null
? customAppBar
: appBar = AppBarWidget(
appBarTitle: appBarTitle,
appBarIcons: appBarIcons,
showHomeAppBarIcon: showHomeAppBarIcon,
isPharmacy: isPharmacy,
showPharmacyCart: showPharmacyCart,
isOfferPackages: isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart,
isShowDecPage: isShowDecPage,
backButtonTab: backButtonTab,
widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
extendBody: widget.extendBody,
appBar: widget.isShowPharmacyAppbar
? pharmacyAppbar()
: widget.isShowAppBar
? widget.customAppBar != null
? widget.customAppBar
: widget.appBar = AppBarWidget(
appBarTitle: widget.appBarTitle,
appBarIcons: widget.appBarIcons,
showHomeAppBarIcon: widget.showHomeAppBarIcon,
isPharmacy: widget.isPharmacy,
showPharmacyCart: widget.showPharmacyCart,
isOfferPackages: widget.isOfferPackages,
showOfferPackagesCart: widget.showOfferPackagesCart,
isShowDecPage: widget.isShowDecPage,
backButtonTab: widget.backButtonTab,
)
: null,
bottomSheet: widget.bottomSheet,
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
widget.isShowDecPage)
? NotAutPage(
title: widget.title ?? widget.appBarTitle,
description: widget.description,
infoList: widget.infoList,
imagesInfo: widget.imagesInfo,
)
: widget.baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(context),
baseViewModel: widget.baseViewModel,
)
: buildBodyWidget(context),
floatingActionButton: widget.floatingActionButton,
bottomNavigationBar: widget.isBottomBar
? BottomNavPharmacyBar(
changeIndex: changeCurrentTab,
index: widget.currentTab,
)
: null,
bottomSheet: bottomSheet,
body: SafeArea(
top: true,
bottom: true,
child:
(!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
isShowDecPage)
? NotAutPage(
title: title ?? appBarTitle,
description: description,
infoList: infoList,
imagesInfo: imagesInfo,
)
: baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(context),
baseViewModel: baseViewModel,
)
: buildBodyWidget(context),
),
floatingActionButton: floatingActionButton,
);
}
void changeCurrentTab(int value) {
if (widget.isMainPharmacyPages) {
widget.changeCurrentTab(value);
} else {
Navigator.pushAndRemoveUntil(
locator<NavigationService>().navigatorKey.currentContext,
MaterialPageRoute(
builder: (context) => LandingPagePharmacy(currentTab: value)),
(Route<dynamic> r) => false);
}
}
Widget mainBody() {
return SafeArea(
top: true,
bottom: true,
child: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
widget.isShowDecPage)
? NotAutPage(
title: widget.title ?? widget.appBarTitle,
description: widget.description,
infoList: widget.infoList,
imagesInfo: widget.imagesInfo,
)
: widget.baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(context),
baseViewModel: widget.baseViewModel,
)
: buildBodyWidget(context),
);
}
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();
}
@ -152,15 +313,15 @@ class AppScaffold extends StatelessWidget {
buildBodyWidget(context) {
return Stack(children: <Widget>[
Center(
child: isLoading
child: widget.isLoading
? CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
)
: body),
isHelp == true ? RobotIcon() : Container()
: widget.body),
widget.isHelp == true ? RobotIcon() : Container()
]);
}
}
@ -263,7 +424,8 @@ class AppBarWidgetState extends State<AppBarWidget> {
icon: Badge(
position: BadgePosition.topStart(top: -15, start: -10),
badgeContent: Text(
orderPreviewViewModel.cartResponse.quantityCount.toString() /*_badgeText*/,
orderPreviewViewModel.cartResponse.quantityCount
.toString() /*_badgeText*/,
style: TextStyle(
fontSize: 9,
color: Colors.white,

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

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

Loading…
Cancel
Save