|
|
|
@ -14,7 +14,6 @@ import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.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';
|
|
|
|
@ -135,8 +134,7 @@ class AppScaffold extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _AppScaffoldState extends State<AppScaffold> {
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject =
|
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
|
|
|
|
|
AppBarWidget appBar;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@ -185,8 +183,7 @@ class _AppScaffoldState extends State<AppScaffold> {
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Provider.of<PharmacyPagesViewModel>(context, listen: false)
|
|
|
|
|
.changeCurrentTab(0);
|
|
|
|
|
Provider.of<PharmacyPagesViewModel>(context, listen: false).changeCurrentTab(0);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
height: 2.0,
|
|
|
|
@ -216,12 +213,9 @@ class _AppScaffoldState extends State<AppScaffold> {
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
PharmacyPagesViewModel pagesViewModel = Provider.of(context);
|
|
|
|
|
|
|
|
|
|
bool isUserNotLogin =
|
|
|
|
|
(!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
|
|
|
|
|
widget.isShowDecPage);
|
|
|
|
|
bool isUserNotLogin = (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && widget.isShowDecPage);
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor:
|
|
|
|
|
widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color,
|
|
|
|
|
backgroundColor: widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color,
|
|
|
|
|
|
|
|
|
|
// appBar: widget.isShowPharmacyAppbar
|
|
|
|
|
// ? pharmacyAppbar()
|
|
|
|
@ -254,8 +248,7 @@ class _AppScaffoldState extends State<AppScaffold> {
|
|
|
|
|
isPharmacy: widget.isPharmacy,
|
|
|
|
|
showPharmacyCart: widget.showPharmacyCart,
|
|
|
|
|
isOfferPackages: widget.isOfferPackages,
|
|
|
|
|
showOfferPackagesCart:
|
|
|
|
|
widget.showOfferPackagesCart,
|
|
|
|
|
showOfferPackagesCart: widget.showOfferPackagesCart,
|
|
|
|
|
isShowDecPage: widget.isShowDecPage,
|
|
|
|
|
backButtonTab: widget.backButtonTab,
|
|
|
|
|
)
|
|
|
|
@ -294,10 +287,7 @@ class _AppScaffoldState extends State<AppScaffold> {
|
|
|
|
|
widget.changeCurrentTab(value);
|
|
|
|
|
} else {
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
locator<NavigationService>().navigatorKey.currentContext,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => LandingPagePharmacy(currentTab: value)),
|
|
|
|
|
(Route<dynamic> r) => false);
|
|
|
|
|
locator<NavigationService>().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: value)), (Route<dynamic> r) => false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -307,9 +297,7 @@ class _AppScaffoldState extends State<AppScaffold> {
|
|
|
|
|
try {
|
|
|
|
|
String barcode = result;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await BaseAppClient()
|
|
|
|
|
.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode",
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
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);
|
|
|
|
@ -319,8 +307,7 @@ class _AppScaffoldState extends State<AppScaffold> {
|
|
|
|
|
AppToast.showErrorToast(message: "Product not found");
|
|
|
|
|
});
|
|
|
|
|
} catch (apiEx) {
|
|
|
|
|
AppToast.showErrorToast(
|
|
|
|
|
message: "Something went wrong, please try again");
|
|
|
|
|
AppToast.showErrorToast(message: "Something went wrong, please try again");
|
|
|
|
|
}
|
|
|
|
|
} catch (barcodeEx) {}
|
|
|
|
|
}
|
|
|
|
@ -330,10 +317,7 @@ class _AppScaffoldState extends State<AppScaffold> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildBodyWidget(context) {
|
|
|
|
|
return Stack(children: <Widget>[
|
|
|
|
|
widget.body,
|
|
|
|
|
widget.isHelp == true ? RobotIcon() : Container()
|
|
|
|
|
]);
|
|
|
|
|
return Stack(children: <Widget>[widget.body, widget.isHelp == true ? RobotIcon() : Container()]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -347,16 +331,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
final List<Widget> appBarIcons;
|
|
|
|
|
Function onTap;
|
|
|
|
|
|
|
|
|
|
NewAppBarWidget(
|
|
|
|
|
{Key key,
|
|
|
|
|
this.showTitle = false,
|
|
|
|
|
this.showDropDown = false,
|
|
|
|
|
this.title = "",
|
|
|
|
|
this.dropDownList,
|
|
|
|
|
this.appBarIcons,
|
|
|
|
|
this.dropdownIndexValue,
|
|
|
|
|
this.dropDownIndexChange,
|
|
|
|
|
this.onTap})
|
|
|
|
|
NewAppBarWidget({Key key, this.showTitle = false, this.showDropDown = false, this.title = "", this.dropDownList, this.appBarIcons, this.dropdownIndexValue, this.dropDownIndexChange, this.onTap})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@ -381,13 +356,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
title,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 24,
|
|
|
|
|
fontFamily:
|
|
|
|
|
(projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -1.44,
|
|
|
|
|
height: 35 / 24),
|
|
|
|
|
fontSize: 24, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (showDropDown)
|
|
|
|
@ -399,8 +368,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
alignedDropdown: true,
|
|
|
|
|
child: DropdownButton<int>(
|
|
|
|
|
iconEnabledColor: CustomColors.grey2,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: CustomColors.lightGreyColor, fontSize: 12),
|
|
|
|
|
style: TextStyle(color: CustomColors.lightGreyColor, fontSize: 12),
|
|
|
|
|
dropdownColor: CustomColors.lightGreyColor,
|
|
|
|
|
value: dropdownIndexValue,
|
|
|
|
|
items: [
|
|
|
|
@ -411,9 +379,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
dropDownList[i],
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontFamily: (projectViewModel.isArabic
|
|
|
|
|
? 'Cairo'
|
|
|
|
|
: 'Poppins'),
|
|
|
|
|
fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2B2E31),
|
|
|
|
|
letterSpacing: -.48,
|
|
|
|
@ -455,8 +421,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
|
|
|
|
|
final AuthenticatedUserObject authenticatedUserObject =
|
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
final AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
|
|
|
|
|
|
|
|
|
|
final String appBarTitle;
|
|
|
|
|
final bool showHomeAppBarIcon;
|
|
|
|
@ -509,22 +474,12 @@ class AppBarWidgetState extends State<AppBarWidget> {
|
|
|
|
|
|
|
|
|
|
return AppBar(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
backgroundColor: widget.isPharmacy
|
|
|
|
|
? Colors.green
|
|
|
|
|
: Theme.of(context).appBarTheme.color,
|
|
|
|
|
backgroundColor: widget.isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
|
|
|
|
|
textTheme: TextTheme(
|
|
|
|
|
headline6: TextStyle(
|
|
|
|
|
color: Theme.of(context).textTheme.headline1.color,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
title: Text(
|
|
|
|
|
widget.authenticatedUserObject.isLogin || !widget.isShowDecPage
|
|
|
|
|
? widget.appBarTitle.toUpperCase()
|
|
|
|
|
: TranslationBase.of(context).serviceInformationTitle,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Theme.of(context).textTheme.headline1.color,
|
|
|
|
|
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
|
|
|
|
|
title: Text(widget.authenticatedUserObject.isLogin || !widget.isShowDecPage ? widget.appBarTitle.toUpperCase() : TranslationBase.of(context).serviceInformationTitle,
|
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, color: Theme.of(context).textTheme.headline1.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
|
|
|
|
|
leading: Builder(
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return ArrowBack(
|
|
|
|
@ -538,8 +493,7 @@ class AppBarWidgetState extends State<AppBarWidget> {
|
|
|
|
|
? IconButton(
|
|
|
|
|
icon: Badge(
|
|
|
|
|
badgeContent: Text(
|
|
|
|
|
orderPreviewViewModel.cartResponse.quantityCount
|
|
|
|
|
.toString(),
|
|
|
|
|
orderPreviewViewModel.cartResponse.quantityCount.toString(),
|
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
|
),
|
|
|
|
|
child: Icon(Icons.shopping_cart)),
|
|
|
|
@ -554,10 +508,7 @@ class AppBarWidgetState extends State<AppBarWidget> {
|
|
|
|
|
position: BadgePosition.topStart(top: -15, start: -10),
|
|
|
|
|
badgeContent: Text(
|
|
|
|
|
_badgeText,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 9,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.normal),
|
|
|
|
|
style: TextStyle(fontSize: 9, color: Colors.white, fontWeight: FontWeight.normal),
|
|
|
|
|
),
|
|
|
|
|
child: Icon(Icons.shopping_cart)),
|
|
|
|
|
color: Colors.white,
|
|
|
|
@ -571,10 +522,7 @@ class AppBarWidgetState extends State<AppBarWidget> {
|
|
|
|
|
icon: Icon(FontAwesomeIcons.home),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) => LandingPage()),
|
|
|
|
|
(Route<dynamic> r) => false);
|
|
|
|
|
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
|
|
|
|
|
|
|
|
|
|
// Cart Click Event
|
|
|
|
|
if (_onCartClick != null) _onCartClick();
|
|
|
|
|