|
|
|
|
@ -12,13 +12,8 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreview
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
@ -27,7 +22,6 @@ import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.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';
|
|
|
|
|
@ -45,8 +39,6 @@ import 'not_auh_page.dart';
|
|
|
|
|
VoidCallback _onCartClick;
|
|
|
|
|
|
|
|
|
|
class AppScaffold extends StatefulWidget {
|
|
|
|
|
AppBarWidget appBar;
|
|
|
|
|
|
|
|
|
|
final String appBarTitle;
|
|
|
|
|
final Widget body;
|
|
|
|
|
final Widget bottomSheet;
|
|
|
|
|
@ -60,11 +52,9 @@ class AppScaffold extends StatefulWidget {
|
|
|
|
|
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;
|
|
|
|
|
@ -83,13 +73,12 @@ class AppScaffold extends StatefulWidget {
|
|
|
|
|
List<String> dropDownList;
|
|
|
|
|
final Function(int) dropDownIndexChange;
|
|
|
|
|
Function onTap;
|
|
|
|
|
final bool isMainPharmacyPages;
|
|
|
|
|
final bool extendBody;
|
|
|
|
|
final ValueChanged<int> changeCurrentTab;
|
|
|
|
|
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
|
|
|
|
|
|
|
|
|
|
final Widget customAppBar;
|
|
|
|
|
final int currentTab;
|
|
|
|
|
final bool isShowPharmacyAppbar;
|
|
|
|
|
final Widget customAppBar;
|
|
|
|
|
|
|
|
|
|
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
|
|
|
|
|
_onCartClick = onClick;
|
|
|
|
|
@ -103,17 +92,17 @@ class AppScaffold extends StatefulWidget {
|
|
|
|
|
this.isShowAppBar = false,
|
|
|
|
|
this.showNewAppBar = false,
|
|
|
|
|
this.showNewAppBarTitle = false,
|
|
|
|
|
this.isMainPharmacyPages = false,
|
|
|
|
|
this.extendBody = false,
|
|
|
|
|
this.hasAppBarParam,
|
|
|
|
|
this.bottomSheet,
|
|
|
|
|
this.bottomNavigationBar,
|
|
|
|
|
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,
|
|
|
|
|
@ -145,9 +134,11 @@ class AppScaffold extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _AppScaffoldState extends State<AppScaffold> {
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
|
|
|
|
|
AppBarWidget appBar;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
// TODO: implement initState
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -218,66 +209,87 @@ class _AppScaffoldState extends State<AppScaffold> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
PharmacyPagesViewModel pagesViewModel = Provider.of(context);
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
PharmacyPagesViewModel pagesViewModel = Provider.of(context);
|
|
|
|
|
|
|
|
|
|
bool isUserNotLogin = (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && isShowDecPage);
|
|
|
|
|
bool isUserNotLogin = (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && widget.isShowDecPage);
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: backgroundColor ?? CustomColors.appBackgroudGrey2Color,
|
|
|
|
|
backgroundColor: widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color,
|
|
|
|
|
|
|
|
|
|
// appBar: widget.isShowPharmacyAppbar
|
|
|
|
|
// ? pharmacyAppbar()
|
|
|
|
|
// : widget.isShowAppBar
|
|
|
|
|
// ? widget.customAppBar != null
|
|
|
|
|
// ? widget.customAppBar
|
|
|
|
|
|
|
|
|
|
appBar: isUserNotLogin
|
|
|
|
|
? null
|
|
|
|
|
: (widget.isShowPharmacyAppbar
|
|
|
|
|
: widget.isShowPharmacyAppbar
|
|
|
|
|
? pharmacyAppbar()
|
|
|
|
|
: showNewAppBar
|
|
|
|
|
: (widget.showNewAppBar
|
|
|
|
|
? NewAppBarWidget(
|
|
|
|
|
title: appBarTitle,
|
|
|
|
|
showTitle: showNewAppBarTitle,
|
|
|
|
|
showDropDown: showDropDown,
|
|
|
|
|
dropdownIndexValue: dropdownIndexValue,
|
|
|
|
|
dropDownList: dropDownList ?? [],
|
|
|
|
|
dropDownIndexChange: dropDownIndexChange,
|
|
|
|
|
appBarIcons: appBarIcons,
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
title: widget.appBarTitle,
|
|
|
|
|
showTitle: widget.showNewAppBarTitle,
|
|
|
|
|
showDropDown: widget.showDropDown,
|
|
|
|
|
dropdownIndexValue: widget.dropdownIndexValue,
|
|
|
|
|
dropDownList: widget.dropDownList ?? [],
|
|
|
|
|
dropDownIndexChange: widget.dropDownIndexChange,
|
|
|
|
|
appBarIcons: widget.appBarIcons,
|
|
|
|
|
onTap: widget.onTap,
|
|
|
|
|
)
|
|
|
|
|
: (isShowAppBar
|
|
|
|
|
? customAppBar != null
|
|
|
|
|
? customAppBar
|
|
|
|
|
: (widget.isShowAppBar
|
|
|
|
|
? widget.customAppBar != null
|
|
|
|
|
? widget.customAppBar
|
|
|
|
|
: appBar = AppBarWidget(
|
|
|
|
|
appBarTitle: appBarTitle,
|
|
|
|
|
appBarIcons: appBarIcons,
|
|
|
|
|
showHomeAppBarIcon: showHomeAppBarIcon,
|
|
|
|
|
isPharmacy: isPharmacy,
|
|
|
|
|
showPharmacyCart: showPharmacyCart,
|
|
|
|
|
isOfferPackages: isOfferPackages,
|
|
|
|
|
showOfferPackagesCart: showOfferPackagesCart,
|
|
|
|
|
isShowDecPage: isShowDecPage,
|
|
|
|
|
backButtonTab: backButtonTab,
|
|
|
|
|
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: bottomSheet,
|
|
|
|
|
bottomSheet: widget.bottomSheet,
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
top: true,
|
|
|
|
|
bottom: true,
|
|
|
|
|
child: isUserNotLogin
|
|
|
|
|
? NotAutPage(
|
|
|
|
|
title: title ?? appBarTitle,
|
|
|
|
|
description: description,
|
|
|
|
|
infoList: infoList,
|
|
|
|
|
imagesInfo: imagesInfo,
|
|
|
|
|
icon: icon,
|
|
|
|
|
title: widget.title ?? widget.appBarTitle,
|
|
|
|
|
description: widget.description,
|
|
|
|
|
infoList: widget.infoList,
|
|
|
|
|
imagesInfo: widget.imagesInfo,
|
|
|
|
|
icon: widget.icon,
|
|
|
|
|
)
|
|
|
|
|
: baseViewModel != null
|
|
|
|
|
: widget.baseViewModel != null
|
|
|
|
|
? NetworkBaseView(
|
|
|
|
|
child: buildBodyWidget(context),
|
|
|
|
|
baseViewModel: baseViewModel,
|
|
|
|
|
baseViewModel: widget.baseViewModel,
|
|
|
|
|
)
|
|
|
|
|
: buildBodyWidget(context),
|
|
|
|
|
),
|
|
|
|
|
bottomNavigationBar: bottomNavigationBar,
|
|
|
|
|
floatingActionButton: floatingActionButton,
|
|
|
|
|
bottomNavigationBar: widget.isBottomBar
|
|
|
|
|
? BottomNavPharmacyBar(
|
|
|
|
|
changeIndex: changeCurrentTab,
|
|
|
|
|
index: widget.currentTab,
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
|
floatingActionButton: widget.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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _scanQrAndGetProduct() async {
|
|
|
|
|
try {
|
|
|
|
|
String result = await BarcodeScanner.scan();
|
|
|
|
|
@ -304,7 +316,7 @@ class _AppScaffoldState extends State<AppScaffold> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildBodyWidget(context) {
|
|
|
|
|
return Stack(children: <Widget>[body, isHelp == true ? RobotIcon() : Container()]);
|
|
|
|
|
return Stack(children: <Widget>[widget.body, widget.isHelp == true ? RobotIcon() : Container()]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|