Skip to content

Commit adc32e7

Browse files
committed
v6.6.1 updates
1 parent 54f7689 commit adc32e7

36 files changed

+571
-635
lines changed

LabelStoreMax/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [6.6.1] - 2023-05-28
2+
3+
* Refactor widgets + bug fixes
4+
* Refactor extensions.dart
5+
* Pubspec.yaml dependency updates.
6+
17
## [6.6.0] - 2023-05-18
28

39
* Nylo v5.0.0 migration

LabelStoreMax/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 - v6.6.0
7+
### Label StoreMax - v6.6.1
88

99

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

LabelStoreMax/lib/app/controllers/product_category_search_loader_controller.dart

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

1111
import 'package:flutter_app/app/controllers/woosignal_api_loader_controller.dart';
1212
import 'package:woosignal/models/response/product_category.dart';
13-
import 'package:woosignal/models/response/products.dart';
13+
import 'package:woosignal/models/response/product.dart';
1414

1515
class ProductCategorySearchLoaderController
1616
extends WooSignalApiLoaderController<Product> {

LabelStoreMax/lib/app/controllers/product_detail_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'package:flutter_app/app/models/cart_line_item.dart';
1414
import 'package:flutter_app/bootstrap/enums/wishlist_action_enums.dart';
1515
import 'package:flutter_app/bootstrap/helpers.dart';
1616
import 'package:nylo_framework/nylo_framework.dart';
17-
import 'package:woosignal/models/response/products.dart';
17+
import 'package:woosignal/models/response/product.dart';
1818
import 'package:woosignal/models/response/product_variation.dart'
1919
as ws_product_variation;
2020

LabelStoreMax/lib/app/controllers/product_loader_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010

1111
import 'package:flutter_app/app/controllers/woosignal_api_loader_controller.dart';
12-
import 'package:woosignal/models/response/products.dart';
12+
import 'package:woosignal/models/response/product.dart';
1313

1414
class ProductLoaderController extends WooSignalApiLoaderController<Product> {
1515
ProductLoaderController();

LabelStoreMax/lib/app/controllers/product_reviews_loader_controller.dart

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

1111
import 'package:flutter_app/app/controllers/woosignal_api_loader_controller.dart';
1212
import 'package:woosignal/models/response/product_review.dart';
13-
import 'package:woosignal/models/response/products.dart';
13+
import 'package:woosignal/models/response/product.dart';
1414

1515
class ProductReviewsLoaderController
1616
extends WooSignalApiLoaderController<ProductReview> {

LabelStoreMax/lib/app/controllers/product_search_loader_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010

1111
import 'package:flutter_app/app/controllers/woosignal_api_loader_controller.dart';
12-
import 'package:woosignal/models/response/products.dart';
12+
import 'package:woosignal/models/response/product.dart';
1313

1414
class ProductSearchLoaderController
1515
extends WooSignalApiLoaderController<Product> {

LabelStoreMax/lib/app/models/cart_line_item.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import 'package:flutter_app/bootstrap/helpers.dart';
1212
import 'package:nylo_framework/nylo_framework.dart';
1313
import 'package:woosignal/models/response/product_variation.dart';
14-
import 'package:woosignal/models/response/products.dart' as ws_product;
14+
import 'package:woosignal/models/response/product.dart' as ws_product;
1515

1616
class CartLineItem {
1717
String? name;
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
//
2+
// LabelCore
3+
// Label StoreMAX
4+
//
5+
// Created by Anthony Gordon.
6+
// 2023, WooSignal Ltd. All rights reserved.
7+
//
8+
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
//
13+
14+
import 'package:flutter/widgets.dart';
15+
import 'package:flutter_app/app/models/cart.dart';
16+
import 'package:flutter_app/bootstrap/data/order_wc.dart';
17+
import 'package:flutter_app/bootstrap/helpers.dart';
18+
import 'package:flutter_app/resources/pages/checkout_confirmation_page.dart';
19+
import 'package:nylo_framework/nylo_framework.dart';
20+
import 'package:razorpay_flutter/razorpay_flutter.dart';
21+
import 'package:woosignal/models/response/tax_rate.dart';
22+
import 'package:woosignal/models/payload/order_wc.dart';
23+
import 'package:woosignal/models/response/order.dart';
24+
25+
razorPay(context,
26+
{required CheckoutConfirmationPageState state, TaxRate? taxRate}) async {
27+
Razorpay razorpay = Razorpay();
28+
29+
razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS,
30+
(PaymentSuccessResponse response) async {
31+
OrderWC orderWC = await buildOrderWC(taxRate: taxRate);
32+
33+
Order? order = await appWooSignal((api) => api.createOrder(orderWC));
34+
35+
if (order != null) {
36+
Cart.getInstance.clear();
37+
Navigator.pushNamed(context, "/checkout-status", arguments: order);
38+
} else {
39+
showToastNotification(
40+
context,
41+
title: "Error".tr(),
42+
description: trans("Something went wrong, please contact our store"),
43+
);
44+
state.reloadState(showLoader: false);
45+
}
46+
});
47+
48+
razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, (PaymentFailureResponse response) {
49+
showToastNotification(context,
50+
title: trans("Error"),
51+
description: response.message ?? "",
52+
style: ToastNotificationStyleType.WARNING);
53+
state.reloadState(showLoader: false);
54+
});
55+
56+
razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, _handleExternalWallet);
57+
58+
// CHECKOUT HELPER
59+
await checkout(taxRate, (total, billingDetails, cart) async {
60+
var options = {
61+
'key': getEnv('RAZORPAY_API_KEY'),
62+
'amount': (double.parse(total) * 100).toInt(),
63+
'name': getEnv('APP_NAME'),
64+
'description': await cart.cartShortDesc(),
65+
'prefill': {
66+
"name": [
67+
billingDetails!.billingAddress?.firstName,
68+
billingDetails.billingAddress?.lastName
69+
].where((t) => t != null || t != "").toList().join(" "),
70+
"method": "card",
71+
'email': billingDetails.billingAddress?.emailAddress ?? ""
72+
}
73+
};
74+
75+
state.reloadState(showLoader: true);
76+
77+
razorpay.open(options);
78+
});
79+
}
80+
81+
void _handleExternalWallet(ExternalWalletResponse response) {}

LabelStoreMax/lib/bootstrap/extensions.dart

Lines changed: 1 addition & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,9 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_app/bootstrap/helpers.dart';
33
import 'package:flutter_app/resources/themes/styles/color_styles.dart';
4+
import 'package:nylo_framework/nylo_framework.dart';
45

56
extension NyText on Text {
6-
/// Set the Style to use [displayLarge].
7-
Text displayLarge(BuildContext context) {
8-
return setStyle(Theme.of(context).textTheme.displayLarge);
9-
}
10-
11-
/// Set the Style to use [displayMedium].
12-
Text displayMedium(BuildContext context) {
13-
return setStyle(Theme.of(context).textTheme.displayMedium);
14-
}
15-
16-
/// Set the Style to use [displaySmall].
17-
Text displaySmall(BuildContext context) {
18-
return setStyle(Theme.of(context).textTheme.displaySmall);
19-
}
20-
21-
/// Set the Style to use [headlineLarge].
22-
Text headingLarge(BuildContext context) {
23-
return setStyle(Theme.of(context).textTheme.headlineLarge);
24-
}
25-
26-
/// Set the Style to use [headlineMedium].
27-
Text headingMedium(BuildContext context) {
28-
return setStyle(Theme.of(context).textTheme.headlineMedium);
29-
}
30-
31-
/// Set the Style to use [headlineSmall].
32-
Text headingSmall(BuildContext context) {
33-
return setStyle(Theme.of(context).textTheme.headlineSmall);
34-
}
35-
36-
/// Set the Style to use [titleLarge].
37-
Text titleLarge(BuildContext context) {
38-
return setStyle(Theme.of(context).textTheme.titleLarge);
39-
}
40-
41-
/// Set the Style to use [titleMedium].
42-
Text titleMedium(BuildContext context) {
43-
return setStyle(Theme.of(context).textTheme.titleMedium);
44-
}
45-
46-
/// Set the Style to use [titleSmall].
47-
Text titleSmall(BuildContext context) {
48-
return setStyle(Theme.of(context).textTheme.titleSmall);
49-
}
50-
51-
/// Set the Style to use [bodyLarge].
52-
Text large(BuildContext context) {
53-
return setStyle(Theme.of(context).textTheme.bodyLarge);
54-
}
55-
56-
/// Set the Style to use [bodyMedium].
57-
Text medium(BuildContext context) {
58-
return setStyle(Theme.of(context).textTheme.bodyMedium);
59-
}
60-
61-
/// Set the Style to use [bodySmall].
62-
Text small(BuildContext context) {
63-
return setStyle(Theme.of(context).textTheme.bodySmall);
64-
}
65-
66-
/// Make the font bold.
67-
Text fontWeightBold() {
68-
return copyWith(style: TextStyle(fontWeight: FontWeight.bold));
69-
}
70-
71-
/// Make the font light.
72-
Text fontWeightLight() {
73-
return copyWith(style: TextStyle(fontWeight: FontWeight.w300));
74-
}
75-
76-
/// Change the [style].
77-
Text setStyle(TextStyle? style) => copyWith(style: style);
78-
797
/// Sets the color from your [ColorStyles] or [Color].
808
Text setColor(
819
BuildContext context, Color Function(ColorStyles color) newColor,
@@ -84,59 +12,6 @@ extension NyText on Text {
8412
style: TextStyle(
8513
color: newColor(ThemeColor.get(context, themeId: themeId))));
8614
}
87-
88-
/// Aligns text to the left.
89-
Text alignLeft() {
90-
return copyWith(textAlign: TextAlign.left);
91-
}
92-
93-
/// Aligns text to the right.
94-
Text alignRight() {
95-
return copyWith(textAlign: TextAlign.right);
96-
}
97-
98-
/// Aligns text to the center.
99-
Text alignCenter() {
100-
return copyWith(textAlign: TextAlign.center);
101-
}
102-
103-
/// Aligns text to the center.
104-
Text setMaxLines(int maxLines) {
105-
return copyWith(maxLines: maxLines);
106-
}
107-
108-
/// Change the [fontFamily].
109-
Text setFontFamily(String fontFamily) =>
110-
copyWith(style: TextStyle(fontFamily: fontFamily));
111-
112-
/// Helper to apply changes.
113-
Text copyWith(
114-
{Key? key,
115-
StrutStyle? strutStyle,
116-
TextAlign? textAlign,
117-
TextDirection? textDirection = TextDirection.ltr,
118-
Locale? locale,
119-
bool? softWrap,
120-
TextOverflow? overflow,
121-
double? textScaleFactor,
122-
int? maxLines,
123-
String? semanticsLabel,
124-
TextWidthBasis? textWidthBasis,
125-
TextStyle? style}) {
126-
return Text(data ?? "",
127-
key: key ?? this.key,
128-
strutStyle: strutStyle ?? this.strutStyle,
129-
textAlign: textAlign ?? this.textAlign,
130-
textDirection: textDirection ?? this.textDirection,
131-
locale: locale ?? this.locale,
132-
softWrap: softWrap ?? this.softWrap,
133-
overflow: overflow ?? this.overflow,
134-
textScaleFactor: textScaleFactor ?? this.textScaleFactor,
135-
maxLines: maxLines ?? this.maxLines,
136-
semanticsLabel: semanticsLabel ?? this.semanticsLabel,
137-
textWidthBasis: textWidthBasis ?? this.textWidthBasis,
138-
style: style != null ? this.style?.merge(style) ?? style : this.style);
139-
}
14015
}
14116

14217
/// Check if the [Product] is new.

0 commit comments

Comments
 (0)