Skip to content

Commit ae433b9

Browse files
committed
v2.5.1 updates
1 parent 0968caf commit ae433b9

File tree

6 files changed

+100
-79
lines changed

6 files changed

+100
-79
lines changed

LabelStoreMax/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [2.5.1] - 2020-02-21
2+
3+
* Pubspec.yaml dependency updates
4+
* Bug fixes
5+
16
## [2.5.0] - 2020-12-23
27

38
* Ability to add image placeholders on products

LabelStoreMax/lib/labelconfig.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import 'dart:ui';
1616
Developer Notes
1717
1818
SUPPORT EMAIL - support@woosignal.com
19-
VERSION - 2.5.0
19+
VERSION - 2.5.1
2020
https://woosignal.com
2121
*/
2222

LabelStoreMax/lib/pages/checkout_shipping_type.dart

Lines changed: 84 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// distributed under the License is distributed on an "AS IS" BASIS,
99
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010

11+
import 'dart:developer';
12+
1113
import 'package:flutter/material.dart';
1214
import 'package:label_storemax/app_state_options.dart';
1315
import 'package:label_storemax/helpers/tools.dart';
@@ -65,23 +67,92 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
6567
.firstWhere((c) => c['name'] == state, orElse: () => null);
6668

6769
for (final shipping in wsShipping) {
70+
if (shipping.locations == null) {
71+
continue;
72+
}
6873
Locations location = shipping.locations.firstWhere(
69-
(ws) => (ws.type == "state" &&
70-
stateMap["code"] != null &&
71-
ws.code == "$countryCode:" + stateMap["code"] ||
72-
ws.code == postalCode ||
73-
ws.code == countryCode),
74-
orElse: () => null);
74+
(ws) => (ws.type == "state" &&
75+
stateMap != null &&
76+
stateMap["code"] != null &&
77+
ws.code == "$countryCode:" + stateMap["code"] ||
78+
ws.code == postalCode ||
79+
ws.code == countryCode),
80+
orElse: () => null,
81+
);
7582

7683
if (location != null) {
7784
_shipping = shipping;
7885
break;
7986
}
8087
}
8188

82-
if (_shipping != null && _shipping.methods != null) {
83-
if (_shipping.methods.flatRate != null) {
84-
_shipping.methods.flatRate
89+
_handleShippingZones(_shipping);
90+
91+
if (_shipping == null) {
92+
WSShipping noZones = wsShipping
93+
.firstWhere((element) => element.parentId == 0, orElse: () => null);
94+
_handleShippingZones(noZones);
95+
}
96+
if (_wsShippingOptions.length == 0) {
97+
_isShippingSupported = false;
98+
}
99+
100+
setState(() {
101+
_isLoading = false;
102+
});
103+
}
104+
105+
Future<String> _getShippingPrice(int index) async {
106+
double total = 0;
107+
List<CartLineItem> cartLineItem = await Cart.getInstance.getCart();
108+
109+
total +=
110+
await workoutShippingCostWC(sum: _wsShippingOptions[index]['cost']);
111+
112+
switch (_wsShippingOptions[index]['method_id']) {
113+
case "flat_rate":
114+
FlatRate flatRate = (_wsShippingOptions[index]['object'] as FlatRate);
115+
116+
if (cartLineItem.firstWhere(
117+
(t) => t.shippingClassId == null || t.shippingClassId == "0",
118+
orElse: () => null) !=
119+
null) {
120+
total += await workoutShippingClassCostWC(
121+
sum: flatRate.classCost,
122+
cartLineItem: cartLineItem
123+
.where((t) =>
124+
t.shippingClassId == null || t.shippingClassId == "0")
125+
.toList());
126+
}
127+
128+
List<CartLineItem> cItemsWithShippingClasses = cartLineItem
129+
.where((t) => t.shippingClassId != null && t.shippingClassId != "0")
130+
.toList();
131+
for (int i = 0; i < cItemsWithShippingClasses.length; i++) {
132+
ShippingClasses shippingClasses = flatRate.shippingClasses.firstWhere(
133+
(d) => d.id == cItemsWithShippingClasses[i].shippingClassId,
134+
orElse: () => null);
135+
if (shippingClasses != null) {
136+
double classTotal = await workoutShippingClassCostWC(
137+
sum: shippingClasses.cost,
138+
cartLineItem: cartLineItem
139+
.where((g) => g.shippingClassId == shippingClasses.id)
140+
.toList());
141+
total += classTotal;
142+
}
143+
}
144+
145+
break;
146+
default:
147+
break;
148+
}
149+
return (total).toString();
150+
}
151+
152+
_handleShippingZones(WSShipping shipping) async {
153+
if (shipping != null && shipping.methods != null) {
154+
if (shipping.methods.flatRate != null) {
155+
shipping.methods.flatRate
85156
.where((t) => t != null)
86157
.toList()
87158
.forEach((flatRate) {
@@ -97,8 +168,8 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
97168
});
98169
}
99170

100-
if (_shipping.methods.localPickup != null) {
101-
_shipping.methods.localPickup
171+
if (shipping.methods.localPickup != null) {
172+
shipping.methods.localPickup
102173
.where((t) => t != null)
103174
.toList()
104175
.forEach((localPickup) {
@@ -114,9 +185,9 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
114185
});
115186
}
116187

117-
if (_shipping.methods.freeShipping != null) {
188+
if (shipping.methods.freeShipping != null) {
118189
List<FreeShipping> freeShipping =
119-
_shipping.methods.freeShipping.where((t) => t != null).toList();
190+
shipping.methods.freeShipping.where((t) => t != null).toList();
120191

121192
for (int i = 0; i < freeShipping.length; i++) {
122193
if (isNumeric(freeShipping[i].cost) ||
@@ -148,61 +219,6 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
148219
}
149220
}
150221
}
151-
152-
if (_wsShippingOptions.length == 0) {
153-
_isShippingSupported = false;
154-
}
155-
156-
setState(() {
157-
_isLoading = false;
158-
});
159-
}
160-
161-
Future<String> _getShippingPrice(int index) async {
162-
double total = 0;
163-
List<CartLineItem> cartLineItem = await Cart.getInstance.getCart();
164-
165-
total +=
166-
await workoutShippingCostWC(sum: _wsShippingOptions[index]['cost']);
167-
168-
switch (_wsShippingOptions[index]['method_id']) {
169-
case "flat_rate":
170-
FlatRate flatRate = (_wsShippingOptions[index]['object'] as FlatRate);
171-
172-
if (cartLineItem.firstWhere(
173-
(t) => t.shippingClassId == null || t.shippingClassId == "0",
174-
orElse: () => null) !=
175-
null) {
176-
total += await workoutShippingClassCostWC(
177-
sum: flatRate.classCost,
178-
cartLineItem: cartLineItem
179-
.where((t) =>
180-
t.shippingClassId == null || t.shippingClassId == "0")
181-
.toList());
182-
}
183-
184-
List<CartLineItem> cItemsWithShippingClasses = cartLineItem
185-
.where((t) => t.shippingClassId != null && t.shippingClassId != "0")
186-
.toList();
187-
for (int i = 0; i < cItemsWithShippingClasses.length; i++) {
188-
ShippingClasses shippingClasses = flatRate.shippingClasses.firstWhere(
189-
(d) => d.id == cItemsWithShippingClasses[i].shippingClassId,
190-
orElse: () => null);
191-
if (shippingClasses != null) {
192-
double classTotal = await workoutShippingClassCostWC(
193-
sum: shippingClasses.cost,
194-
cartLineItem: cartLineItem
195-
.where((g) => g.shippingClassId == shippingClasses.id)
196-
.toList());
197-
total += classTotal;
198-
}
199-
}
200-
201-
break;
202-
default:
203-
break;
204-
}
205-
return (total).toString();
206222
}
207223

208224
@override

LabelStoreMax/pubspec.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ packages:
248248
name: flutter_staggered_grid_view
249249
url: "https://pub.dartlang.org"
250250
source: hosted
251-
version: "0.3.3"
251+
version: "0.3.4"
252252
flutter_swiper:
253253
dependency: "direct main"
254254
description:
@@ -328,7 +328,7 @@ packages:
328328
name: math_expressions
329329
url: "https://pub.dartlang.org"
330330
source: hosted
331-
version: "2.0.1"
331+
version: "2.0.2"
332332
meta:
333333
dependency: transitive
334334
description:
@@ -356,7 +356,7 @@ packages:
356356
name: page_transition
357357
url: "https://pub.dartlang.org"
358358
source: hosted
359-
version: "1.1.7+3"
359+
version: "1.1.7+6"
360360
path:
361361
dependency: transitive
362362
description:

LabelStoreMax/pubspec.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Official WooSignal App Template for WooCommerce
22

33
# Label StoreMax
4-
# Version 2.5.0
4+
# Version 2.5.1
55
# Homepage: https://woosignal.com
66
# Author: Anthony Gordon <agordon@woosignal.com>
77
# Documentation: https://woosignal.com/docs/app/ios/label-storemax
@@ -25,29 +25,29 @@ environment:
2525
dependencies:
2626
woosignal: ^1.3.1
2727
woosignal_stripe: ^0.1.0
28-
razorpay_flutter: ^1.2.3
28+
razorpay_flutter: 1.2.3
2929
wp_json_api: ^2.0.0
3030
shared_preferences: ^0.5.12+4
3131
cached_network_image: ^2.5.0
32-
page_transition: ^1.1.7+3
32+
page_transition: ^1.1.7+6
3333
package_info: ^0.4.3+2
3434
url_launcher: ^5.7.10
3535
flutter_money_formatter: ^0.8.3
3636
platform_alert_dialog: ^1.0.0+2
3737
flutter_web_browser: ^0.13.1
38-
pull_to_refresh: ^1.6.3
38+
pull_to_refresh: 1.6.3
3939
intl: ^0.16.1
4040
flutter_swiper: ^1.1.6
4141
edge_alert: ^0.0.1
4242
bubble_tab_indicator: ^0.1.4
4343
status_alert: ^0.1.3
44-
math_expressions: ^2.0.1
44+
math_expressions: ^2.0.2
4545
hexcolor: ^1.0.6
4646
flutter_spinkit: ^4.1.2+1
4747
flutter_launcher_icons: ^0.8.1
4848
auto_size_text: ^2.1.0
4949
html: ^0.14.0+4
50-
flutter_staggered_grid_view: ^0.3.3
50+
flutter_staggered_grid_view: ^0.3.4
5151
flutter:
5252
sdk: flutter
5353

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# WooCommerce App: Label StoreMax
66

7-
### Label StoreMax - v2.5.0
7+
### Label StoreMax - v2.5.1
88

99

1010
[Official WooSignal WooCommerce App](https://woosignal.com)

0 commit comments

Comments
 (0)