Skip to content

Commit 579d98f

Browse files
committed
v7.1.0
1 parent 0be591b commit 579d98f

File tree

6 files changed

+195
-161
lines changed

6 files changed

+195
-161
lines changed

LabelStoreMax/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [7.1.0] - 2024-03-31
2+
3+
* Fix PayPal payment issue
4+
* Update Related Products widget
5+
* Update Checkout shipping widget
6+
* Pubspec.yaml dependency updates
7+
18
## [7.0.2] - 2024-03-28
29

310
* Small refactor to project

LabelStoreMax/lib/app/providers/payments/paypal_pay.dart

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010

1111
import 'package:flutter/material.dart';
12+
import 'package:flutter_app/app/models/cart.dart';
1213
import 'package:flutter_paypal_payment/flutter_paypal_payment.dart';
1314
import 'package:woosignal/models/payload/order_wc.dart';
1415
import 'package:woosignal/models/response/order.dart';
@@ -28,15 +29,21 @@ payPalPay(context, {TaxRate? taxRate}) async {
2829
WooSignalApp? wooSignalApp = AppHelper.instance.appConfig;
2930

3031
List<CartLineItem> cartLineItems = await cart.getCart();
31-
String cartTotal = await cart.getTotal();
32+
String taxTotal = await cart.taxAmount(taxRate);
33+
String subtotal = await Cart.getInstance.getSubtotal();
34+
3235
String? currencyCode = wooSignalApp?.currencyMeta?.code;
3336

34-
String shippingTotal =
35-
CheckoutSession.getInstance.shippingType?.getTotal() ?? "0";
37+
String shippingTotal = CheckoutSession.getInstance.shippingType?.getTotal() ?? "0";
38+
String description = "(${cartLineItems.length}) items from ${getEnv('APP_NAME')}".tr(arguments: {"appName": getEnv('APP_NAME')});
39+
40+
if (taxTotal == "") {
41+
taxTotal = "0";
42+
}
3643

37-
String description =
38-
"(${cartLineItems.length}) items from ${getEnv('APP_NAME')}"
39-
.tr(arguments: {"appName": getEnv('APP_NAME')});
44+
if (shippingTotal == "") {
45+
shippingTotal = "0";
46+
}
4047

4148
Navigator.of(context).push(
4249
MaterialPageRoute(
@@ -51,9 +58,10 @@ payPalPay(context, {TaxRate? taxRate}) async {
5158
"total": total,
5259
"currency": currencyCode?.toUpperCase(),
5360
"details": {
54-
"subtotal": cartTotal,
61+
"subtotal": subtotal,
5562
"shipping": shippingTotal,
56-
"shipping_discount": 0
63+
"shipping_discount": 0,
64+
"tax": taxTotal
5765
}
5866
},
5967
"description": description,

LabelStoreMax/lib/resources/pages/checkout_shipping_type_page.dart

Lines changed: 126 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -237,143 +237,138 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
237237
body: SafeAreaWidget(
238238
child: GestureDetector(
239239
onTap: () => FocusScope.of(context).requestFocus(FocusNode()),
240-
child: LayoutBuilder(
241-
builder: (context, constraints) => Column(
242-
crossAxisAlignment: CrossAxisAlignment.start,
243-
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
244-
children: <Widget>[
245-
Padding(
246-
child: Center(
247-
child: Image.asset(
248-
getImageAsset('shipping_icon.png'),
249-
height: 100,
250-
color: (Theme.of(context).brightness == Brightness.light)
251-
? null
252-
: Colors.white,
253-
fit: BoxFit.fitHeight,
254-
),
240+
child: Column(
241+
crossAxisAlignment: CrossAxisAlignment.center,
242+
mainAxisAlignment: MainAxisAlignment.center,
243+
children: [
244+
Padding(
245+
child: Center(
246+
child: Image.asset(
247+
getImageAsset('shipping_icon.png'),
248+
height: 100,
249+
color: (Theme.of(context).brightness == Brightness.light)
250+
? null
251+
: Colors.white,
252+
fit: BoxFit.fitHeight,
255253
),
256-
padding: EdgeInsets.only(top: 20),
257254
),
258-
SizedBox(
259-
child: Container(
260-
child: Column(
261-
crossAxisAlignment: CrossAxisAlignment.center,
262-
mainAxisAlignment: MainAxisAlignment.spaceAround,
263-
children: <Widget>[
264-
(_isLoading
265-
? Expanded(child: AppLoaderWidget())
266-
: (_isShippingSupported
267-
? Expanded(
268-
child: ListView.separated(
269-
itemCount: _wsShippingOptions.length,
270-
separatorBuilder: (context, index) =>
271-
Divider(
272-
color: Colors.black12,
273-
),
274-
itemBuilder:
275-
(BuildContext context, int index) {
276-
return ListTile(
277-
contentPadding: EdgeInsets.only(
278-
left: 16,
279-
right: 16,
280-
),
281-
title: Text(
282-
_wsShippingOptions[index]['title'],
283-
style: Theme.of(context)
255+
padding: EdgeInsets.only(top: 20),
256+
),
257+
Expanded(child: Container(
258+
child: Column(
259+
crossAxisAlignment: CrossAxisAlignment.center,
260+
mainAxisAlignment: MainAxisAlignment.spaceAround,
261+
children: <Widget>[
262+
(_isLoading
263+
? Expanded(child: AppLoaderWidget())
264+
: (_isShippingSupported
265+
? Expanded(
266+
child: ListView.separated(
267+
itemCount: _wsShippingOptions.length,
268+
separatorBuilder: (context, index) =>
269+
Divider(
270+
color: Colors.black12,
271+
),
272+
itemBuilder:
273+
(BuildContext context, int index) {
274+
return ListTile(
275+
contentPadding: EdgeInsets.only(
276+
left: 16,
277+
right: 16,
278+
),
279+
title: Text(
280+
_wsShippingOptions[index]['title'],
281+
style: Theme.of(context)
282+
.textTheme
283+
.titleMedium!
284+
.copyWith(
285+
fontWeight: FontWeight.bold,
286+
),
287+
),
288+
selected: true,
289+
subtitle: NyFutureBuilder<String>(
290+
future: _getShippingPrice(index),
291+
child:
292+
(BuildContext context, data) {
293+
Map<String, dynamic>
294+
shippingOption =
295+
_wsShippingOptions[index];
296+
return RichText(
297+
text: TextSpan(
298+
text: '',
299+
style: Theme.of(context)
300+
.textTheme
301+
.bodyMedium,
302+
children: <TextSpan>[
303+
(shippingOption["object"]
304+
is FreeShipping
305+
? TextSpan(
306+
text: trans(
307+
"Free postage"),
308+
)
309+
: TextSpan(
310+
text:
311+
"${trans("Price")}: ${formatStringCurrency(total: data)}",
312+
)),
313+
if (shippingOption[
314+
"min_amount"] !=
315+
null)
316+
TextSpan(
317+
text:
318+
"\n${trans("Spend a minimum of")} ${formatStringCurrency(total: shippingOption["min_amount"])}",
319+
style:
320+
Theme.of(context)
284321
.textTheme
285-
.titleMedium!
322+
.bodyMedium!
286323
.copyWith(
287-
fontWeight: FontWeight.bold,
288-
),
289-
),
290-
selected: true,
291-
subtitle: NyFutureBuilder<String>(
292-
future: _getShippingPrice(index),
293-
child:
294-
(BuildContext context, data) {
295-
Map<String, dynamic>
296-
shippingOption =
297-
_wsShippingOptions[index];
298-
return RichText(
299-
text: TextSpan(
300-
text: '',
301-
style: Theme.of(context)
302-
.textTheme
303-
.bodyMedium,
304-
children: <TextSpan>[
305-
(shippingOption["object"]
306-
is FreeShipping
307-
? TextSpan(
308-
text: trans(
309-
"Free postage"),
310-
)
311-
: TextSpan(
312-
text:
313-
"${trans("Price")}: ${formatStringCurrency(total: data)}",
314-
)),
315-
if (shippingOption[
316-
"min_amount"] !=
317-
null)
318-
TextSpan(
319-
text:
320-
"\n${trans("Spend a minimum of")} ${formatStringCurrency(total: shippingOption["min_amount"])}",
321-
style:
322-
Theme.of(context)
323-
.textTheme
324-
.bodyMedium!
325-
.copyWith(
326-
fontSize:
327-
14))
328-
],
329-
),
330-
);
331-
},
332-
),
333-
trailing: (CheckoutSession.getInstance
334-
.shippingType !=
335-
null &&
336-
CheckoutSession
337-
.getInstance
338-
.shippingType!
339-
.object ==
340-
_wsShippingOptions[index]
341-
["object"]
342-
? Icon(Icons.check)
343-
: null),
344-
onTap: () =>
345-
_handleCheckoutTapped(index),
346-
);
347-
},
348-
),
349-
)
350-
: Text(
351-
trans(
352-
"Shipping is not supported for your location, sorry"),
353-
style:
354-
Theme.of(context).textTheme.titleLarge,
355-
textAlign: TextAlign.center,
356-
))),
357-
LinkButton(
358-
title: trans("CANCEL"),
359-
action: () => Navigator.pop(context),
360-
),
361-
],
362-
),
363-
decoration: BoxDecoration(
364-
color: ThemeColor.get(context).backgroundContainer,
365-
borderRadius: BorderRadius.circular(10),
366-
boxShadow:
367-
(Theme.of(context).brightness == Brightness.light)
368-
? wsBoxShadow()
369-
: null,
324+
fontSize:
325+
14))
326+
],
327+
),
328+
);
329+
},
330+
),
331+
trailing: (CheckoutSession.getInstance
332+
.shippingType !=
333+
null &&
334+
CheckoutSession
335+
.getInstance
336+
.shippingType!
337+
.object ==
338+
_wsShippingOptions[index]
339+
["object"]
340+
? Icon(Icons.check)
341+
: null),
342+
onTap: () =>
343+
_handleCheckoutTapped(index),
344+
);
345+
},
346+
),
347+
)
348+
: Text(
349+
trans(
350+
"Shipping is not supported for your location, sorry"),
351+
style:
352+
Theme.of(context).textTheme.titleLarge,
353+
textAlign: TextAlign.center,
354+
))),
355+
LinkButton(
356+
title: trans("CANCEL"),
357+
action: () => Navigator.pop(context),
370358
),
371-
padding: EdgeInsets.all(8),
372-
),
373-
height: (constraints.maxHeight - constraints.minHeight) * 0.5,
359+
],
360+
),
361+
decoration: BoxDecoration(
362+
color: ThemeColor.get(context).backgroundContainer,
363+
borderRadius: BorderRadius.circular(10),
364+
boxShadow:
365+
(Theme.of(context).brightness == Brightness.light)
366+
? wsBoxShadow()
367+
: null,
374368
),
375-
],
376-
),
369+
padding: EdgeInsets.all(8),
370+
),),
371+
],
377372
),
378373
),
379374
),

0 commit comments

Comments
 (0)