Merge branch 'pharmacy_fix' into 'development'

Pharmacy fix

See merge request Cloud_Solution/diplomatic-quarter!401
merge-update-with-lab-changes
Mohammad Aljammal 4 years ago
commit 8e30860fc2

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

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

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

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

Loading…
Cancel
Save