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