diff --git a/LabelStoreMax/CHANGELOG.md b/LabelStoreMax/CHANGELOG.md index 364f3e4..8a10f38 100644 --- a/LabelStoreMax/CHANGELOG.md +++ b/LabelStoreMax/CHANGELOG.md @@ -1,3 +1,8 @@ +## [2.5.1] - 2020-02-21 + +* Pubspec.yaml dependency updates +* Bug fixes + ## [2.5.0] - 2020-12-23 * Ability to add image placeholders on products diff --git a/LabelStoreMax/lib/labelconfig.dart b/LabelStoreMax/lib/labelconfig.dart index 3a0a790..80fce2e 100644 --- a/LabelStoreMax/lib/labelconfig.dart +++ b/LabelStoreMax/lib/labelconfig.dart @@ -16,7 +16,7 @@ import 'dart:ui'; Developer Notes SUPPORT EMAIL - support@woosignal.com - VERSION - 2.5.0 + VERSION - 2.5.1 https://woosignal.com */ diff --git a/LabelStoreMax/lib/pages/checkout_shipping_type.dart b/LabelStoreMax/lib/pages/checkout_shipping_type.dart index 7bc4dd8..5b6b696 100644 --- a/LabelStoreMax/lib/pages/checkout_shipping_type.dart +++ b/LabelStoreMax/lib/pages/checkout_shipping_type.dart @@ -8,6 +8,8 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'dart:developer'; + import 'package:flutter/material.dart'; import 'package:label_storemax/app_state_options.dart'; import 'package:label_storemax/helpers/tools.dart'; @@ -65,13 +67,18 @@ class _CheckoutShippingTypePageState extends State { .firstWhere((c) => c['name'] == state, orElse: () => null); for (final shipping in wsShipping) { + if (shipping.locations == null) { + continue; + } Locations location = shipping.locations.firstWhere( - (ws) => (ws.type == "state" && - stateMap["code"] != null && - ws.code == "$countryCode:" + stateMap["code"] || - ws.code == postalCode || - ws.code == countryCode), - orElse: () => null); + (ws) => (ws.type == "state" && + stateMap != null && + stateMap["code"] != null && + ws.code == "$countryCode:" + stateMap["code"] || + ws.code == postalCode || + ws.code == countryCode), + orElse: () => null, + ); if (location != null) { _shipping = shipping; @@ -79,76 +86,13 @@ class _CheckoutShippingTypePageState extends State { } } - if (_shipping != null && _shipping.methods != null) { - if (_shipping.methods.flatRate != null) { - _shipping.methods.flatRate - .where((t) => t != null) - .toList() - .forEach((flatRate) { - Map tmpShippingOption = {}; - tmpShippingOption = { - "id": flatRate.id, - "title": flatRate.title, - "method_id": "flat_rate", - "cost": flatRate.cost, - "object": flatRate - }; - _wsShippingOptions.add(tmpShippingOption); - }); - } + _handleShippingZones(_shipping); - if (_shipping.methods.localPickup != null) { - _shipping.methods.localPickup - .where((t) => t != null) - .toList() - .forEach((localPickup) { - Map tmpShippingOption = {}; - tmpShippingOption = { - "id": localPickup.id, - "method_id": "local_pickup", - "title": localPickup.title, - "cost": localPickup.cost, - "object": localPickup - }; - _wsShippingOptions.add(tmpShippingOption); - }); - } - - if (_shipping.methods.freeShipping != null) { - List freeShipping = - _shipping.methods.freeShipping.where((t) => t != null).toList(); - - for (int i = 0; i < freeShipping.length; i++) { - if (isNumeric(freeShipping[i].cost) || - freeShipping[i].cost == 'min_amount') { - if (freeShipping[i].cost == 'min_amount') { - String total = await Cart.getInstance.getTotal(); - if (total != null) { - double doubleTotal = double.parse(total); - double doubleMinimumValue = - double.parse(freeShipping[i].minimumOrderAmount); - - if (doubleTotal < doubleMinimumValue) { - continue; - } - } - } - - Map tmpShippingOption = {}; - tmpShippingOption = { - "id": freeShipping[i].id, - "method_id": "free_shipping", - "title": freeShipping[i].title, - "cost": "0.00", - "min_amount": freeShipping[i].minimumOrderAmount, - "object": freeShipping[i] - }; - _wsShippingOptions.add(tmpShippingOption); - } - } - } + if (_shipping == null) { + WSShipping noZones = wsShipping + .firstWhere((element) => element.parentId == 0, orElse: () => null); + _handleShippingZones(noZones); } - if (_wsShippingOptions.length == 0) { _isShippingSupported = false; } @@ -205,6 +149,78 @@ class _CheckoutShippingTypePageState extends State { return (total).toString(); } + _handleShippingZones(WSShipping shipping) async { + if (shipping != null && shipping.methods != null) { + if (shipping.methods.flatRate != null) { + shipping.methods.flatRate + .where((t) => t != null) + .toList() + .forEach((flatRate) { + Map tmpShippingOption = {}; + tmpShippingOption = { + "id": flatRate.id, + "title": flatRate.title, + "method_id": "flat_rate", + "cost": flatRate.cost, + "object": flatRate + }; + _wsShippingOptions.add(tmpShippingOption); + }); + } + + if (shipping.methods.localPickup != null) { + shipping.methods.localPickup + .where((t) => t != null) + .toList() + .forEach((localPickup) { + Map tmpShippingOption = {}; + tmpShippingOption = { + "id": localPickup.id, + "method_id": "local_pickup", + "title": localPickup.title, + "cost": localPickup.cost, + "object": localPickup + }; + _wsShippingOptions.add(tmpShippingOption); + }); + } + + if (shipping.methods.freeShipping != null) { + List freeShipping = + shipping.methods.freeShipping.where((t) => t != null).toList(); + + for (int i = 0; i < freeShipping.length; i++) { + if (isNumeric(freeShipping[i].cost) || + freeShipping[i].cost == 'min_amount') { + if (freeShipping[i].cost == 'min_amount') { + String total = await Cart.getInstance.getTotal(); + if (total != null) { + double doubleTotal = double.parse(total); + double doubleMinimumValue = + double.parse(freeShipping[i].minimumOrderAmount); + + if (doubleTotal < doubleMinimumValue) { + continue; + } + } + } + + Map tmpShippingOption = {}; + tmpShippingOption = { + "id": freeShipping[i].id, + "method_id": "free_shipping", + "title": freeShipping[i].title, + "cost": "0.00", + "min_amount": freeShipping[i].minimumOrderAmount, + "object": freeShipping[i] + }; + _wsShippingOptions.add(tmpShippingOption); + } + } + } + } + } + @override Widget build(BuildContext context) { return Scaffold( diff --git a/LabelStoreMax/pubspec.lock b/LabelStoreMax/pubspec.lock index efe077c..62bc1d2 100644 --- a/LabelStoreMax/pubspec.lock +++ b/LabelStoreMax/pubspec.lock @@ -248,7 +248,7 @@ packages: name: flutter_staggered_grid_view url: "https://pub.dartlang.org" source: hosted - version: "0.3.3" + version: "0.3.4" flutter_swiper: dependency: "direct main" description: @@ -328,7 +328,7 @@ packages: name: math_expressions url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.0.2" meta: dependency: transitive description: @@ -356,7 +356,7 @@ packages: name: page_transition url: "https://pub.dartlang.org" source: hosted - version: "1.1.7+3" + version: "1.1.7+6" path: dependency: transitive description: diff --git a/LabelStoreMax/pubspec.yaml b/LabelStoreMax/pubspec.yaml index 8cbce1f..1f62749 100644 --- a/LabelStoreMax/pubspec.yaml +++ b/LabelStoreMax/pubspec.yaml @@ -1,7 +1,7 @@ # Official WooSignal App Template for WooCommerce # Label StoreMax -# Version 2.5.0 +# Version 2.5.1 # Homepage: https://woosignal.com # Author: Anthony Gordon # Documentation: https://woosignal.com/docs/app/ios/label-storemax @@ -25,29 +25,29 @@ environment: dependencies: woosignal: ^1.3.1 woosignal_stripe: ^0.1.0 - razorpay_flutter: ^1.2.3 + razorpay_flutter: 1.2.3 wp_json_api: ^2.0.0 shared_preferences: ^0.5.12+4 cached_network_image: ^2.5.0 - page_transition: ^1.1.7+3 + page_transition: ^1.1.7+6 package_info: ^0.4.3+2 url_launcher: ^5.7.10 flutter_money_formatter: ^0.8.3 platform_alert_dialog: ^1.0.0+2 flutter_web_browser: ^0.13.1 - pull_to_refresh: ^1.6.3 + pull_to_refresh: 1.6.3 intl: ^0.16.1 flutter_swiper: ^1.1.6 edge_alert: ^0.0.1 bubble_tab_indicator: ^0.1.4 status_alert: ^0.1.3 - math_expressions: ^2.0.1 + math_expressions: ^2.0.2 hexcolor: ^1.0.6 flutter_spinkit: ^4.1.2+1 flutter_launcher_icons: ^0.8.1 auto_size_text: ^2.1.0 html: ^0.14.0+4 - flutter_staggered_grid_view: ^0.3.3 + flutter_staggered_grid_view: ^0.3.4 flutter: sdk: flutter diff --git a/README.md b/README.md index 31af3a0..18959ba 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # WooCommerce App: Label StoreMax -### Label StoreMax - v2.5.0 +### Label StoreMax - v2.5.1 [Official WooSignal WooCommerce App](https://woosignal.com)