Merge branch 'development' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into pharmacy_fix_bugs

merge-requests/402/head
mosazaid 4 years ago
commit c558fe6bd9

@ -49,7 +49,6 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) { onModelReady: (model) {
//TODO Elham* fix all services in order handel errors in better way in the service //TODO Elham* fix all services in order handel errors in better way in the service
if (widget.productType == 1) { if (widget.productType == 1) {
model.getFinalProducts(i: id); model.getFinalProducts(i: id);
@ -78,7 +77,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
isBottomBar: false, isBottomBar: false,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
isShowDecPage: true, isShowDecPage: false,
baseViewModel: model, baseViewModel: model,
body: Container( body: Container(
height: MediaQuery.of(context).size.height * 5.87, height: MediaQuery.of(context).size.height * 5.87,

@ -110,35 +110,6 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
centerTitle: true, centerTitle: true,
) )
: null, : null,
// : AppBar(
// backgroundColor: Color(0xff5AB145),
// elevation: 0,
// textTheme: TextTheme(
// headline6: TextStyle(
// color: Colors.white, fontWeight: FontWeight.bold),
// ),
// title: Text(getText(currentTab).toUpperCase()),
// leading: Builder(
// builder: (BuildContext context) {
// return IconButton(
// icon: Icon(Icons.arrow_back),
// color: Colors.white,
// onPressed: () => Scaffold.of(context).openDrawer(),
// );
// },
// ),
// actions: [
// // IconButton(
// // iconSize: 70,
// // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg',
// // height: 100, width: 100, fit: BoxFit.cover),
// // onPressed: () {
// // triggerRobot();
// // } //do something,
// // )
// ],
// centerTitle: true,
// ),
extendBody: false, extendBody: false,
body: PageView( body: PageView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
@ -146,14 +117,9 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
children: [ children: [
PharmacyPage(), PharmacyPage(),
PharmacyCategorisePage(), PharmacyCategorisePage(),
// OffersCategorisePage(),
WishlistPage(false),
PharmacyProfilePage(), PharmacyProfilePage(),
// Container(
// child: Text('text'),
// ),
CartOrderPage(), CartOrderPage(),
], // Please do not remove the BookingOptions from this array ],
), ),
bottomNavigationBar: BottomNavPharmacyBar( bottomNavigationBar: BottomNavPharmacyBar(
changeIndex: _changeCurrentTab, changeIndex: _changeCurrentTab,

File diff suppressed because it is too large Load Diff

@ -24,9 +24,10 @@ class CartOrderPage extends StatelessWidget {
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
AppScaffold appScaffold; AppScaffold appScaffold;
return BaseView<OrderPreviewViewModel>( return BaseView<OrderPreviewViewModel>(
onModelReady: (model){ onModelReady: (model) {
model.getShoppingCart().then((value){ model.getShoppingCart().then((value) {
appScaffold.appBar.badgeUpdater('${model.cartResponse.quantityCount ?? 0}'); appScaffold.appBar
.badgeUpdater('${model.cartResponse.quantityCount ?? 0}');
}); });
}, },
builder: (_, model, wi) => ChangeNotifierProvider.value( builder: (_, model, wi) => ChangeNotifierProvider.value(
@ -69,21 +70,37 @@ class CartOrderPage extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
...List.generate( ...List.generate(
cart.shoppingCarts != null ? cart.shoppingCarts.length : 0, cart.shoppingCarts != null
? cart.shoppingCarts.length
: 0,
(index) => ProductOrderItem( (index) => ProductOrderItem(
cart.shoppingCarts[index], () {print(cart.shoppingCarts[index].quantity); cart.shoppingCarts[index], () {
model.changeProductQuantity(cart.shoppingCarts[index]).then((value) { print(cart.shoppingCarts[index]
if (model.state != ViewState.Error) { .quantity);
appScaffold.appBar.badgeUpdater('${value.quantityCount ?? 0}'); model
.changeProductQuantity(
cart.shoppingCarts[index])
.then((value) {
if (model.state !=
ViewState.Error) {
appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}');
} }
if (model.state == if (model.state ==
ViewState.ErrorLocal) {Utils.showErrorToast(model.error);} ViewState.ErrorLocal) {
Utils.showErrorToast(
model.error);
}
}); });
}, }, () {
() { model
model.deleteProduct(cart.shoppingCarts[index]).then((value){ .deleteProduct(
if (model.state != ViewState.Error) { cart.shoppingCarts[index])
appScaffold.appBar.badgeUpdater('${value.quantityCount ?? 0}'); .then((value) {
if (model.state !=
ViewState.Error) {
appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}');
} }
}); });
})) }))
@ -200,7 +217,8 @@ class CartOrderPage extends StatelessWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text(TranslationBase.of(context).noData, child: Text(
TranslationBase.of(context).noData,
// 'There is no data', // 'There is no data',
style: TextStyle(fontSize: 30), style: TextStyle(fontSize: 30),
), ),
@ -270,9 +288,8 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
width: 25.0, width: 25.0,
height: widget.height * 0.070, height: widget.height * 0.070,
decoration: new BoxDecoration( decoration: new BoxDecoration(
color: !isAgree color:
? Color(0xffeeeeee) !isAgree ? Color(0xffeeeeee) : Colors.green,
: Colors.green,
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
child: !isAgree child: !isAgree

@ -52,16 +52,14 @@ class ProductTileItem extends StatelessWidget {
return InkWell( return InkWell(
onTap: () => productOnClick(context), onTap: () => productOnClick(context),
splashColor: Theme.of(context).primaryColor, splashColor: Theme.of(context).primaryColor,
child: Card(
elevation: 2,
shape: Border(right: BorderSide(color: Colors.grey.shade300, width: 1)),
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 0,
),
child: Container( child: Container(
margin: EdgeInsets.all(7),
decoration: BoxDecoration(
border:Border.all(color: Colors.grey.shade300,width: 0.5),
borderRadius: BorderRadius.circular(8)
),
padding: EdgeInsets.symmetric(horizontal: 4), padding: EdgeInsets.symmetric(horizontal: 4),
width: MediaQuery.of(context).size.width / 3, width: MediaQuery.of(context).size.width / 2.8,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -92,16 +90,21 @@ class ProductTileItem extends StatelessWidget {
borderRadius: borderRadius:
BorderRadius.only(topLeft: Radius.circular(6)), BorderRadius.only(topLeft: Radius.circular(6)),
), ),
child: item.rxMessage != null ? Texts( child: item.rxMessage != null
projectProvider.isArabic ? item.rxMessagen : item.rxMessage, ? Texts(
projectProvider.isArabic
? item.rxMessagen
: item.rxMessage,
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
): Texts(""), )
: Texts(""),
) )
], ],
), ),
SizedBox(height: 8,),
Container( Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: 6, horizontal: 6,
@ -120,7 +123,7 @@ class ProductTileItem extends StatelessWidget {
padding: const EdgeInsets.only(top: 4, bottom: 4), padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Texts( child: Texts(
"SAR ${item.price}", "SAR ${item.price}",
bold: true, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
), ),
), ),
@ -135,19 +138,13 @@ class ProductTileItem extends StatelessWidget {
: 0, : 0,
forceStars: true), forceStars: true),
), ),
/*Texts(
"(${item.approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
),*/
], ],
), ),
], ],
), ),
)
],
), ),
SizedBox(height: 5,),
],
), ),
), ),
); );

@ -93,7 +93,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
}, },
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).myAccount, appBarTitle: TranslationBase.of(context).myAccount,
isShowAppBar: true, isShowAppBar: false,
isShowDecPage: false, isShowDecPage: false,
isPharmacy: true, isPharmacy: true,
body: user != null body: user != null

@ -30,6 +30,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategorise(), onModelReady: (model) => model.getCategorise(),
allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model, builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) => Widget child) =>
AppScaffold( AppScaffold(

@ -55,9 +55,10 @@ class WishListService extends BaseService {
// } // }
Future getWishlist() async { Future getWishlist() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); //TODO we need to check why the customer id comes null
String customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID)?? "0";
hasError = false; hasError = false;
await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2", await baseAppClient.getPharmacy(GET_WISHLIST+customerId +"?shopping_cart_type=2",
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear(); _wishListProducts.clear();
response['shopping_carts'].forEach((item) { response['shopping_carts'].forEach((item) {

@ -30,7 +30,7 @@ class StarRating extends StatelessWidget {
) )
), ),
if (totalCount!=null) if (totalCount!=null)
SizedBox(width: 9.0), SizedBox(width: 5.0),
if (totalCount!=null) if (totalCount!=null)
Texts("("+totalCount.toString()+")", style: "overline", color: Colors.grey[400],) Texts("("+totalCount.toString()+")", style: "overline", color: Colors.grey[400],)
] ]

@ -177,6 +177,7 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
} }
String _badgeText = "0"; String _badgeText = "0";
class AppBarWidgetState extends State<AppBarWidget> { class AppBarWidgetState extends State<AppBarWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -218,33 +219,35 @@ class AppBarWidgetState extends State<AppBarWidget> {
centerTitle: true, centerTitle: true,
actions: <Widget>[ actions: <Widget>[
(widget.isPharmacy && widget.showPharmacyCart) (widget.isPharmacy && widget.showPharmacyCart)
? IconButton( ? Container()
icon: Badge( // ? IconButton(
shape: BadgeShape.circle, // icon: Badge(
badgeContent: Text(_badgeText, style: TextStyle(color: Colors.white)), // shape: BadgeShape.circle,
child: Icon(Icons.shopping_cart)), // badgeContent: Text(_badgeText, style: TextStyle(color: Colors.white)),
color: Colors.white, // child: Icon(Icons.shopping_cart)),
onPressed: () { // color: Colors.white,
Navigator.of(context).popUntil(ModalRoute.withName('/')); // onPressed: () {
}) // Navigator.of(context).popUntil(ModalRoute.withName('/'));
// })
: Container(), : Container(),
(widget.isOfferPackages && widget.showOfferPackagesCart) (widget.isOfferPackages && widget.showOfferPackagesCart)
? IconButton( ? Container()
icon: Badge( // ? IconButton(
position: BadgePosition.topStart(top: -15, start: -10), // icon: Badge(
badgeContent: Text( // position: BadgePosition.topStart(top: -15, start: -10),
_badgeText, // badgeContent: Text(
style: TextStyle( // _badgeText,
fontSize: 9, // style: TextStyle(
color: Colors.white, // fontSize: 9,
fontWeight: FontWeight.normal), // color: Colors.white,
), // fontWeight: FontWeight.normal),
child: Icon(Icons.shopping_cart)), // ),
color: Colors.white, // child: Icon(Icons.shopping_cart)),
onPressed: () { // color: Colors.white,
// Cart Click Event // onPressed: () {
if (_onCartClick != null) _onCartClick(); // // Cart Click Event
}) // if (_onCartClick != null) _onCartClick();
// })
: Container(), : Container(),
if (widget.showHomeAppBarIcon) if (widget.showHomeAppBarIcon)
IconButton( IconButton(

@ -17,7 +17,6 @@ class BottomNavPharmacyBar extends StatefulWidget {
} }
class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> { class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
int _index = 0;
_changeIndex(int index) { _changeIndex(int index) {
widget.changeIndex(index); widget.changeIndex(index);
@ -43,19 +42,6 @@ class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
currentIndex: 0, currentIndex: 0,
title: TranslationBase.of(context).Alhabibapp, title: TranslationBase.of(context).Alhabibapp,
), ),
// Container(
// height: 65.0,
// child: Center(
// child: VerticalDivider(
// color: Colors.grey,
// thickness: 0.5,
// width: 0.3,
// indent: 25.5,
// ),
// ),
// ),
BottomNavPharmacyItem( BottomNavPharmacyItem(
icon: EvaIcons.list, icon: EvaIcons.list,
activeIcon: EvaIcons.list, activeIcon: EvaIcons.list,
@ -64,20 +50,6 @@ class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
currentIndex: 1, currentIndex: 1,
title: TranslationBase.of(context).categorise, title: TranslationBase.of(context).categorise,
), ),
// Expanded(
// child: SizedBox(
// height: 50,
// child: Column(
// mainAxisSize: MainAxisSize.min,
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// SizedBox(height: 22),
// ],
// ),
// ),
// ),
// Added Calendar Icon to access book appointment flow
BottomNavPharmacyItem( BottomNavPharmacyItem(
icon: EvaIcons.home, icon: EvaIcons.home,
activeIcon: EvaIcons.home, activeIcon: EvaIcons.home,
@ -86,13 +58,12 @@ class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
currentIndex: 0, currentIndex: 0,
isHome: true, isHome: true,
title: TranslationBase.of(context).home), title: TranslationBase.of(context).home),
BottomNavPharmacyItem( BottomNavPharmacyItem(
icon: EvaIcons.person, icon: EvaIcons.person,
activeIcon: EvaIcons.person, activeIcon: EvaIcons.person,
changeIndex: _changeIndex, changeIndex: _changeIndex,
index: widget.index, index: widget.index,
currentIndex: 3, currentIndex: 2,
title: TranslationBase.of(context).myAccount, title: TranslationBase.of(context).myAccount,
), ),
BottomNavPharmacyItem( BottomNavPharmacyItem(
@ -100,7 +71,7 @@ class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
activeIcon: EvaIcons.shoppingCartOutline, activeIcon: EvaIcons.shoppingCartOutline,
changeIndex: _changeIndex, changeIndex: _changeIndex,
index: widget.index, index: widget.index,
currentIndex: 4, currentIndex: 3,
title: TranslationBase.of(context).cart) title: TranslationBase.of(context).cart)
], ],
), ),

@ -1,6 +1,10 @@
import 'package:diplomaticquarterapp/Constants.dart'; import 'package:diplomaticquarterapp/Constants.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/login/welcome.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class BottomNavPharmacyItem extends StatelessWidget { class BottomNavPharmacyItem extends StatelessWidget {
final String title; final String title;
@ -33,7 +37,16 @@ class BottomNavPharmacyItem extends StatelessWidget {
child: InkWell( child: InkWell(
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
splashColor: Colors.transparent, splashColor: Colors.transparent,
onTap: () => changeIndex(currentIndex), onTap: () {
if(!Provider.of<ProjectViewModel>(context, listen: false).isLogin && (currentIndex == 2|| currentIndex == 3))
Navigator.push(
context,
FadePage(page: WelcomeLogin()),
);
else
changeIndex(currentIndex);
},
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

Loading…
Cancel
Save