Check for numeric value
This commit is contained in:
parent
ecd217652f
commit
e72d74a3cf
@ -96,15 +96,17 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
|||||||
|
|
||||||
if (_shipping.methods.freeShipping != null) {
|
if (_shipping.methods.freeShipping != null) {
|
||||||
_shipping.methods.freeShipping.forEach((freeShipping) {
|
_shipping.methods.freeShipping.forEach((freeShipping) {
|
||||||
Map<String, dynamic> tmpShippingOption = {};
|
if (_isNumeric(freeShipping.cost)) {
|
||||||
tmpShippingOption = {
|
Map<String, dynamic> tmpShippingOption = {};
|
||||||
"id": freeShipping.id,
|
tmpShippingOption = {
|
||||||
"method_id": "free_shipping",
|
"id": freeShipping.id,
|
||||||
"title": freeShipping.title,
|
"method_id": "free_shipping",
|
||||||
"cost": freeShipping.cost,
|
"title": freeShipping.title,
|
||||||
"object": freeShipping
|
"cost": freeShipping.cost,
|
||||||
};
|
"object": freeShipping
|
||||||
_wsShippingOptions.add(tmpShippingOption);
|
};
|
||||||
|
_wsShippingOptions.add(tmpShippingOption);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,6 +120,13 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _isNumeric(String str) {
|
||||||
|
if(str == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return double.tryParse(str) != null;
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> _getShippingPrice(int index) async {
|
Future<String> _getShippingPrice(int index) async {
|
||||||
double total = 0;
|
double total = 0;
|
||||||
List<CartLineItem> cartLineItem = await Cart.getInstance.getCart();
|
List<CartLineItem> cartLineItem = await Cart.getInstance.getCart();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user