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/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/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.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';
@ -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/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; ProjectViewModel projectProvider;
int currentTab = 0;
PageController pageController;
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;
});
}
changeCurrentTab(int tab) {
if (pageController.hasClients) {
setState(() {
currentTab = tab;
pageController.jumpToPage(tab);
});
}
} }
@override @override
@ -46,8 +67,20 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
child: AppScaffold( child: AppScaffold(
isBottomBar: true, isBottomBar: true,
extendBody: false, extendBody: false,
// isMainPharmacyPages: true, isShowDecPage: false,
body: null, 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, appBarTitle: TranslationBase.of(context).shoppingCart,
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
isBottomBar: true, //isBottomBar: true,
showHomeAppBarIcon: false, showHomeAppBarIcon: false,
isShowDecPage: false, isShowDecPage: false,
isMainPharmacyPages: true, isMainPharmacyPages: true,

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

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

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

@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreview
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.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.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/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';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.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/services/robo_search/event_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.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/bottom_bar.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
@ -75,9 +77,10 @@ class AppScaffold extends StatefulWidget {
final bool isHelp; final bool isHelp;
final bool isLocalLoader; final bool isLocalLoader;
final Function backButtonTab; final Function backButtonTab;
final ValueChanged<int> changeCurrentTab;
final Widget customAppBar; final Widget customAppBar;
final int currentTab;
final bool isShowPharmacyAppbar;
AppScaffold setOnAppBarCartClick(VoidCallback onClick) { AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick; _onCartClick = onClick;
return this; return this;
@ -112,7 +115,10 @@ class AppScaffold extends StatefulWidget {
appBar, appBar,
this.customAppBar, this.customAppBar,
this.isLocalLoader = false, this.isLocalLoader = false,
this.backButtonTab}); this.backButtonTab,
this.changeCurrentTab,
this.currentTab,
this.isShowPharmacyAppbar = false});
@override @override
_AppScaffoldState createState() => _AppScaffoldState(); _AppScaffoldState createState() => _AppScaffoldState();
@ -128,76 +134,69 @@ class _AppScaffoldState extends State<AppScaffold> {
} }
AppBar pharmacyAppbar() { AppBar pharmacyAppbar() {
return Provider.of<PharmacyPagesViewModel>(context, listen: false) return AppBar(
.currentTab != backgroundColor: Color(0xff5AB145),
4 && elevation: 0,
Provider.of<PharmacyPagesViewModel>(context, listen: false) title: Container(
.currentTab != height: MediaQuery.of(context).size.height * 0.056,
3 decoration: BoxDecoration(
? AppBar( borderRadius: BorderRadius.circular(5.0),
backgroundColor: Color(0xff5AB145), color: Colors.white,
elevation: 0, ),
title: Container( child: InkWell(
height: MediaQuery.of(context).size.height * 0.056, child: Padding(
decoration: BoxDecoration( padding: EdgeInsets.all(5.0),
borderRadius: BorderRadius.circular(5.0), child: Row(
color: Colors.white, //crossAxisAlignment: CrossAxisAlignment.center,
), mainAxisAlignment: MainAxisAlignment.start,
child: InkWell( children: [
child: Padding( Icon(Icons.search, size: 25.0),
padding: EdgeInsets.all(5.0), SizedBox(
child: Row( width: 15.0,
//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: () { Texts(
Navigator.push( TranslationBase.of(context).searchProductHere,
context, fontSize: 13,
FadePage(page: SearchProductsPage()), )
); ],
}, ),
),
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: () { actions: [
Provider.of<PharmacyPagesViewModel>(context, listen: false) IconButton(
.changeCurrentTab(0); // iconSize: 70,
}, icon: Image.asset(
child: Container( 'assets/images/new-design/qr-code.png',
height: 2.0,
width: 10.0,
child: Image.asset(
'assets/images/pharmacy_logo.png',
),
),
);
},
), ),
actions: [ onPressed: _scanQrAndGetProduct //do something,
IconButton( )
// iconSize: 70, ],
icon: Image.asset( centerTitle: true,
'assets/images/new-design/qr-code.png', );
),
onPressed: _scanQrAndGetProduct //do something,
)
],
centerTitle: true,
)
: null;
} }
@override @override
@ -208,7 +207,7 @@ class _AppScaffoldState extends State<AppScaffold> {
backgroundColor: backgroundColor:
widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
extendBody: widget.extendBody, extendBody: widget.extendBody,
appBar: widget.isMainPharmacyPages appBar: widget.isShowPharmacyAppbar
? pharmacyAppbar() ? pharmacyAppbar()
: widget.isShowAppBar : widget.isShowAppBar
? widget.customAppBar != null ? widget.customAppBar != null
@ -226,28 +225,42 @@ class _AppScaffoldState extends State<AppScaffold> {
) )
: null, : null,
bottomSheet: widget.bottomSheet, bottomSheet: widget.bottomSheet,
body: (widget.isBottomBar && widget.isPharmacy) body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
? PageView( widget.isShowDecPage)
physics: NeverScrollableScrollPhysics(), ? NotAutPage(
controller: pagesViewModel.pageController, title: widget.title ?? widget.appBarTitle,
children: [ description: widget.description,
PharmacyPage(), infoList: widget.infoList,
PharmacyCategorisePage(), imagesInfo: widget.imagesInfo,
PharmacyProfilePage(),
CartOrderPage(changeTab: pagesViewModel.changeCurrentTab),
],
) )
: mainBody(), : widget.baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(context),
baseViewModel: widget.baseViewModel,
)
: buildBodyWidget(context),
floatingActionButton: widget.floatingActionButton, floatingActionButton: widget.floatingActionButton,
bottomNavigationBar: widget.isBottomBar bottomNavigationBar: widget.isBottomBar
? BottomNavPharmacyBar( ? BottomNavPharmacyBar(
changeIndex: pagesViewModel.changeCurrentTab, changeIndex: changeCurrentTab,
index: pagesViewModel.currentTab, index: widget.currentTab,
) )
: null, : 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() { Widget mainBody() {
return SafeArea( return SafeArea(
top: true, top: true,

@ -8,8 +8,9 @@ import 'bottom_nav_pharmacy_home_item.dart';
import 'bottom_nav_pharmacy_item.dart'; import 'bottom_nav_pharmacy_item.dart';
class BottomNavPharmacyBar extends StatefulWidget { class BottomNavPharmacyBar extends StatefulWidget {
final Function 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);

Loading…
Cancel
Save