Merge branch 'product_detail_page' into 'development'

add count to cart

See merge request Cloud_Solution/diplomatic-quarter!422
merge-update-with-lab-changes
Mohammad Aljammal 4 years ago
commit ad8fd65f75

@ -1,9 +1,11 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -62,6 +64,8 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
), ),
if (authenticatedUserObject.isLogin) if (authenticatedUserObject.isLogin)
Row( Row(
children: [
Stack(
children: [ children: [
IconWithBg( IconWithBg(
icon: Icons.shopping_cart, icon: Icons.shopping_cart,
@ -73,6 +77,23 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
builder: (context) => CartOrderPage()), builder: (context) => CartOrderPage()),
); );
}), }),
if(Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount !=0)
Positioned(
top:0, right: -1.0,
child: Container(
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.only(left: 5, right: 4.5),
height: 18,
child: Center(child: Texts(Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount.toString(), style: "caption", medium: true, color: Colors.white,)),
),
)
],
),
SizedBox( SizedBox(
width: 10, width: 10,
), ),

Loading…
Cancel
Save