Check for numeric value
This commit is contained in:
parent
ecd217652f
commit
e72d74a3cf
@ -96,6 +96,7 @@ 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) {
|
||||||
|
if (_isNumeric(freeShipping.cost)) {
|
||||||
Map<String, dynamic> tmpShippingOption = {};
|
Map<String, dynamic> tmpShippingOption = {};
|
||||||
tmpShippingOption = {
|
tmpShippingOption = {
|
||||||
"id": freeShipping.id,
|
"id": freeShipping.id,
|
||||||
@ -105,6 +106,7 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
|||||||
"object": freeShipping
|
"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