show bottom nav in pharmacy all pages

merge-update-with-lab-changes
hussam al-habibeh 4 years ago
parent bc91b9ad88
commit 46d7e7ee14

@ -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';
@ -19,22 +20,42 @@ 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;
void initState() {
super.initState();
locator<PharmacyModuleService>().manufacturerList = [];
locator<PharmacyModuleService>().bestSellerProducts = [];
locator<PharmacyModuleService>().lastVisitedProducts = [];
pageController =
PageController(keepPage: true, initialPage: widget.currentTab);
setState(() {
currentTab = widget.currentTab;
});
}
changeCurrentTab(int tab) {
if (pageController.hasClients) {
setState(() {
currentTab = tab;
pageController.jumpToPage(tab);
});
}
}
@override
@ -46,8 +67,20 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
child: AppScaffold(
isBottomBar: true,
extendBody: false,
// isMainPharmacyPages: true,
body: null,
isShowDecPage: false,
isMainPharmacyPages: true,
currentTab: currentTab,
changeCurrentTab: changeCurrentTab,
body: PageView(
physics: NeverScrollableScrollPhysics(),
controller: pageController,
children: [
PharmacyPage(),
PharmacyCategorisePage(),
PharmacyProfilePage(),
CartOrderPage(changeTab: changeCurrentTab),
],
),
),
);
}

@ -48,7 +48,7 @@ class _CartOrderPageState extends State<CartOrderPage> {
appBarTitle: TranslationBase.of(context).shoppingCart,
isShowAppBar: true,
isPharmacy: true,
isBottomBar: true,
//isBottomBar: true,
showHomeAppBarIcon: false,
isShowDecPage: false,
isMainPharmacyPages: true,

@ -37,7 +37,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
baseViewModel: model,
isMainPharmacyPages: true,
isPharmacy: true,
isBottomBar: true,
isShowPharmacyAppbar: true,
backgroundColor: Colors.white,
body: Container(
width: double.infinity,

@ -96,7 +96,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
isShowAppBar: false,
isShowDecPage: true,
isPharmacy: true,
isBottomBar: true,
//isBottomBar: true,
isMainPharmacyPages: true,
body: user != null
? Container(

@ -38,7 +38,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
isShowAppBar: false,
isMainPharmacyPages: true,
isPharmacy: true,
isBottomBar: true,
isShowPharmacyAppbar: true,
baseViewModel: model,
body: Column(
children: [

@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreview
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';
@ -23,6 +24,7 @@ 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';
@ -75,9 +77,10 @@ class AppScaffold extends StatefulWidget {
final bool isHelp;
final bool isLocalLoader;
final Function backButtonTab;
final ValueChanged<int> changeCurrentTab;
final Widget customAppBar;
final int currentTab;
final bool isShowPharmacyAppbar;
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick;
return this;
@ -112,7 +115,10 @@ class AppScaffold extends StatefulWidget {
appBar,
this.customAppBar,
this.isLocalLoader = false,
this.backButtonTab});
this.backButtonTab,
this.changeCurrentTab,
this.currentTab,
this.isShowPharmacyAppbar = false});
@override
_AppScaffoldState createState() => _AppScaffoldState();
@ -128,76 +134,69 @@ class _AppScaffoldState extends State<AppScaffold> {
}
AppBar pharmacyAppbar() {
return Provider.of<PharmacyPagesViewModel>(context, listen: false)
.currentTab !=
4 &&
Provider.of<PharmacyPagesViewModel>(context, listen: false)
.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,
)
],
),
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,
),
onTap: () {
Navigator.push(
context,
FadePage(page: SearchProductsPage()),
);
},
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',
),
),
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',
),
actions: [
IconButton(
// iconSize: 70,
icon: Image.asset(
'assets/images/new-design/qr-code.png',
),
onPressed: _scanQrAndGetProduct //do something,
)
],
centerTitle: true,
)
: null;
onPressed: _scanQrAndGetProduct //do something,
)
],
centerTitle: true,
);
}
@override
@ -208,7 +207,7 @@ class _AppScaffoldState extends State<AppScaffold> {
backgroundColor:
widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
extendBody: widget.extendBody,
appBar: widget.isMainPharmacyPages
appBar: widget.isShowPharmacyAppbar
? pharmacyAppbar()
: widget.isShowAppBar
? widget.customAppBar != null
@ -226,28 +225,42 @@ class _AppScaffoldState extends State<AppScaffold> {
)
: null,
bottomSheet: widget.bottomSheet,
body: (widget.isBottomBar && widget.isPharmacy)
? PageView(
physics: NeverScrollableScrollPhysics(),
controller: pagesViewModel.pageController,
children: [
PharmacyPage(),
PharmacyCategorisePage(),
PharmacyProfilePage(),
CartOrderPage(changeTab: pagesViewModel.changeCurrentTab),
],
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,
)
: mainBody(),
: widget.baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(context),
baseViewModel: widget.baseViewModel,
)
: buildBodyWidget(context),
floatingActionButton: widget.floatingActionButton,
bottomNavigationBar: widget.isBottomBar
? BottomNavPharmacyBar(
changeIndex: pagesViewModel.changeCurrentTab,
index: pagesViewModel.currentTab,
changeIndex: changeCurrentTab,
index: widget.currentTab,
)
: null,
);
}
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,

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

Loading…
Cancel
Save