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) { 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,

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,24 +70,40 @@ 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
.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(
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,21 +288,20 @@ 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
? null ? null
: Padding( : Padding(
padding: const EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
child: Icon( child: Icon(
Icons.check, Icons.check,
color: Colors.white, color: Colors.white,
size: 25, size: 25,
), ),
), ),
), ),
), ),
Expanded( Expanded(

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

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

Loading…
Cancel
Save