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