v2.5.1 updates

This commit is contained in:
Anthony 2021-02-21 22:43:50 +00:00
parent 0968caf300
commit ae433b9e83
6 changed files with 106 additions and 85 deletions

View File

@ -1,3 +1,8 @@
## [2.5.1] - 2020-02-21
* Pubspec.yaml dependency updates
* Bug fixes
## [2.5.0] - 2020-12-23 ## [2.5.0] - 2020-12-23
* Ability to add image placeholders on products * Ability to add image placeholders on products

View File

@ -16,7 +16,7 @@ import 'dart:ui';
Developer Notes Developer Notes
SUPPORT EMAIL - support@woosignal.com SUPPORT EMAIL - support@woosignal.com
VERSION - 2.5.0 VERSION - 2.5.1
https://woosignal.com https://woosignal.com
*/ */

View File

@ -8,6 +8,8 @@
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:label_storemax/app_state_options.dart'; import 'package:label_storemax/app_state_options.dart';
import 'package:label_storemax/helpers/tools.dart'; import 'package:label_storemax/helpers/tools.dart';
@ -65,13 +67,18 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
.firstWhere((c) => c['name'] == state, orElse: () => null); .firstWhere((c) => c['name'] == state, orElse: () => null);
for (final shipping in wsShipping) { for (final shipping in wsShipping) {
if (shipping.locations == null) {
continue;
}
Locations location = shipping.locations.firstWhere( Locations location = shipping.locations.firstWhere(
(ws) => (ws.type == "state" && (ws) => (ws.type == "state" &&
stateMap != null &&
stateMap["code"] != null && stateMap["code"] != null &&
ws.code == "$countryCode:" + stateMap["code"] || ws.code == "$countryCode:" + stateMap["code"] ||
ws.code == postalCode || ws.code == postalCode ||
ws.code == countryCode), ws.code == countryCode),
orElse: () => null); orElse: () => null,
);
if (location != null) { if (location != null) {
_shipping = shipping; _shipping = shipping;
@ -79,76 +86,13 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
} }
} }
if (_shipping != null && _shipping.methods != null) { _handleShippingZones(_shipping);
if (_shipping.methods.flatRate != null) {
_shipping.methods.flatRate
.where((t) => t != null)
.toList()
.forEach((flatRate) {
Map<String, dynamic> 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) { if (_shipping == null) {
_shipping.methods.localPickup WSShipping noZones = wsShipping
.where((t) => t != null) .firstWhere((element) => element.parentId == 0, orElse: () => null);
.toList() _handleShippingZones(noZones);
.forEach((localPickup) {
Map<String, dynamic> 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> 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<String, dynamic> 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 (_wsShippingOptions.length == 0) { if (_wsShippingOptions.length == 0) {
_isShippingSupported = false; _isShippingSupported = false;
} }
@ -205,6 +149,78 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
return (total).toString(); 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<String, dynamic> 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<String, dynamic> 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> 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<String, dynamic> 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(

View File

@ -248,7 +248,7 @@ packages:
name: flutter_staggered_grid_view name: flutter_staggered_grid_view
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.3" version: "0.3.4"
flutter_swiper: flutter_swiper:
dependency: "direct main" dependency: "direct main"
description: description:
@ -328,7 +328,7 @@ packages:
name: math_expressions name: math_expressions
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.2"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -356,7 +356,7 @@ packages:
name: page_transition name: page_transition
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.7+3" version: "1.1.7+6"
path: path:
dependency: transitive dependency: transitive
description: description:

View File

@ -1,7 +1,7 @@
# Official WooSignal App Template for WooCommerce # Official WooSignal App Template for WooCommerce
# Label StoreMax # Label StoreMax
# Version 2.5.0 # Version 2.5.1
# Homepage: https://woosignal.com # Homepage: https://woosignal.com
# Author: Anthony Gordon <agordon@woosignal.com> # Author: Anthony Gordon <agordon@woosignal.com>
# Documentation: https://woosignal.com/docs/app/ios/label-storemax # Documentation: https://woosignal.com/docs/app/ios/label-storemax
@ -25,29 +25,29 @@ environment:
dependencies: dependencies:
woosignal: ^1.3.1 woosignal: ^1.3.1
woosignal_stripe: ^0.1.0 woosignal_stripe: ^0.1.0
razorpay_flutter: ^1.2.3 razorpay_flutter: 1.2.3
wp_json_api: ^2.0.0 wp_json_api: ^2.0.0
shared_preferences: ^0.5.12+4 shared_preferences: ^0.5.12+4
cached_network_image: ^2.5.0 cached_network_image: ^2.5.0
page_transition: ^1.1.7+3 page_transition: ^1.1.7+6
package_info: ^0.4.3+2 package_info: ^0.4.3+2
url_launcher: ^5.7.10 url_launcher: ^5.7.10
flutter_money_formatter: ^0.8.3 flutter_money_formatter: ^0.8.3
platform_alert_dialog: ^1.0.0+2 platform_alert_dialog: ^1.0.0+2
flutter_web_browser: ^0.13.1 flutter_web_browser: ^0.13.1
pull_to_refresh: ^1.6.3 pull_to_refresh: 1.6.3
intl: ^0.16.1 intl: ^0.16.1
flutter_swiper: ^1.1.6 flutter_swiper: ^1.1.6
edge_alert: ^0.0.1 edge_alert: ^0.0.1
bubble_tab_indicator: ^0.1.4 bubble_tab_indicator: ^0.1.4
status_alert: ^0.1.3 status_alert: ^0.1.3
math_expressions: ^2.0.1 math_expressions: ^2.0.2
hexcolor: ^1.0.6 hexcolor: ^1.0.6
flutter_spinkit: ^4.1.2+1 flutter_spinkit: ^4.1.2+1
flutter_launcher_icons: ^0.8.1 flutter_launcher_icons: ^0.8.1
auto_size_text: ^2.1.0 auto_size_text: ^2.1.0
html: ^0.14.0+4 html: ^0.14.0+4
flutter_staggered_grid_view: ^0.3.3 flutter_staggered_grid_view: ^0.3.4
flutter: flutter:
sdk: flutter sdk: flutter

View File

@ -4,7 +4,7 @@
# WooCommerce App: Label StoreMax # WooCommerce App: Label StoreMax
### Label StoreMax - v2.5.0 ### Label StoreMax - v2.5.1
[Official WooSignal WooCommerce App](https://woosignal.com) [Official WooSignal WooCommerce App](https://woosignal.com)