Merge pull request #34 from woosignal/master

v5.8.0 updates
This commit is contained in:
Anthony Gordon 2022-03-29 23:55:36 +01:00 committed by GitHub
commit 249f98790a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 151 additions and 115 deletions

View File

@ -1,3 +1,9 @@
## [5.8.0] - 2022-03-29
* Add phone number to customer input form
* Gradle version bump
* Pubspec.yaml dependency updates
## [5.7.3] - 2022-02-21 ## [5.7.3] - 2022-02-21
* Fix builds for Flutter 2.10.2 * Fix builds for Flutter 2.10.2

View File

@ -4,7 +4,7 @@
# WooCommerce App: Label StoreMax # WooCommerce App: Label StoreMax
### Label StoreMax - v5.7.3 ### Label StoreMax - v5.8.0
[Official WooSignal WooCommerce App](https://woosignal.com) [Official WooSignal WooCommerce App](https://woosignal.com)

View File

@ -6,7 +6,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.2.2' classpath 'com.android.tools.build:gradle:7.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

View File

@ -44,7 +44,7 @@ class CheckoutSession {
coupon = null; coupon = null;
} }
void saveBillingAddress() async { saveBillingAddress() async {
CustomerAddress customerAddress = CustomerAddress customerAddress =
CheckoutSession.getInstance.billingDetails.billingAddress; CheckoutSession.getInstance.billingDetails.billingAddress;
@ -66,7 +66,7 @@ class CheckoutSession {
return null; return null;
} }
void clearBillingAddress() async => clearBillingAddress() async =>
await NyStorage.delete(SharedKey.customerBillingDetails); await NyStorage.delete(SharedKey.customerBillingDetails);
saveShippingAddress() async { saveShippingAddress() async {
@ -88,8 +88,8 @@ class CheckoutSession {
return null; return null;
} }
void clearShippingAddress() async => clearShippingAddress() async =>
NyStorage.delete(SharedKey.customerShippingDetails); await NyStorage.delete(SharedKey.customerShippingDetails);
Future<String> total({bool withFormat = false, TaxRate taxRate}) async { Future<String> total({bool withFormat = false, TaxRate taxRate}) async {
double totalCart = parseWcPrice(await Cart.getInstance.getTotal()); double totalCart = parseWcPrice(await Cart.getInstance.getTotal());

View File

@ -17,6 +17,7 @@ class CustomerAddress {
String city; String city;
String postalCode; String postalCode;
String emailAddress; String emailAddress;
String phoneNumber;
CustomerCountry customerCountry; CustomerCountry customerCountry;
CustomerAddress( CustomerAddress(
@ -26,6 +27,7 @@ class CustomerAddress {
this.city, this.city,
this.postalCode, this.postalCode,
this.emailAddress, this.emailAddress,
this.phoneNumber,
this.customerCountry}); this.customerCountry});
void initAddress() { void initAddress() {
@ -36,6 +38,7 @@ class CustomerAddress {
postalCode = ""; postalCode = "";
customerCountry = CustomerCountry(); customerCountry = CustomerCountry();
emailAddress = ""; emailAddress = "";
phoneNumber = "";
} }
bool hasMissingFields() => bool hasMissingFields() =>
@ -85,6 +88,9 @@ class CustomerAddress {
addressLine = json['address_line']; addressLine = json['address_line'];
city = json['city']; city = json['city'];
postalCode = json['postal_code']; postalCode = json['postal_code'];
if (json['phone_number'] != null) {
phoneNumber = json['phone_number'];
}
customerCountry = CustomerCountry.fromJson(json['customer_country']); customerCountry = CustomerCountry.fromJson(json['customer_country']);
emailAddress = json['email_address']; emailAddress = json['email_address'];
} }
@ -98,6 +104,9 @@ class CustomerAddress {
data['postal_code'] = postalCode; data['postal_code'] = postalCode;
data['state'] = customerCountry.state; data['state'] = customerCountry.state;
data['country'] = customerCountry.name; data['country'] = customerCountry.name;
if (phoneNumber != null && phoneNumber != "") {
data['phone_number'] = phoneNumber;
}
data['email_address'] = emailAddress; data['email_address'] = emailAddress;
data['customer_country'] = null; data['customer_country'] = null;
if (customerCountry != null) { if (customerCountry != null) {

View File

@ -65,6 +65,9 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
billing.city = billingDetails.billingAddress.city; billing.city = billingDetails.billingAddress.city;
billing.postcode = billingDetails.billingAddress.postalCode; billing.postcode = billingDetails.billingAddress.postalCode;
billing.email = billingDetails.billingAddress.emailAddress; billing.email = billingDetails.billingAddress.emailAddress;
if (billingDetails.billingAddress.phoneNumber != "") {
billing.phone = billingDetails.billingAddress.phoneNumber;
}
if (billingDetails.billingAddress.customerCountry.hasState()) { if (billingDetails.billingAddress.customerCountry.hasState()) {
billing.state = billingDetails.billingAddress.customerCountry.state.name; billing.state = billingDetails.billingAddress.customerCountry.state.name;
} }

View File

@ -44,6 +44,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
_txtBillingCity = TextEditingController(), _txtBillingCity = TextEditingController(),
_txtBillingPostalCode = TextEditingController(), _txtBillingPostalCode = TextEditingController(),
_txtBillingEmailAddress = TextEditingController(), _txtBillingEmailAddress = TextEditingController(),
_txtBillingPhoneNumber = TextEditingController(),
// shipping // shipping
_txtShippingFirstName = TextEditingController(), _txtShippingFirstName = TextEditingController(),
_txtShippingLastName = TextEditingController(), _txtShippingLastName = TextEditingController(),
@ -74,6 +75,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
txtControllerCity: _txtBillingCity, txtControllerCity: _txtBillingCity,
txtControllerPostalCode: _txtBillingPostalCode, txtControllerPostalCode: _txtBillingPostalCode,
txtControllerEmailAddress: _txtBillingEmailAddress, txtControllerEmailAddress: _txtBillingEmailAddress,
txtControllerPhoneNumber: _txtBillingPhoneNumber,
customerCountry: _billingCountry, customerCountry: _billingCountry,
onTapCountry: () => _navigateToSelectCountry(type: "billing"), onTapCountry: () => _navigateToSelectCountry(type: "billing"),
); );
@ -107,6 +109,9 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
CustomerAddress sfCustomerShippingAddress = CustomerAddress sfCustomerShippingAddress =
await CheckoutSession.getInstance.getShippingAddress(); await CheckoutSession.getInstance.getShippingAddress();
_setFieldsFromCustomerAddress(sfCustomerShippingAddress, type: "shipping"); _setFieldsFromCustomerAddress(sfCustomerShippingAddress, type: "shipping");
setState(() {
});
} }
_setFieldsFromCustomerAddress(CustomerAddress customerAddress, _setFieldsFromCustomerAddress(CustomerAddress customerAddress,
@ -122,6 +127,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
city: customerAddress.city, city: customerAddress.city,
postalCode: customerAddress.postalCode, postalCode: customerAddress.postalCode,
emailAddress: customerAddress.emailAddress, emailAddress: customerAddress.emailAddress,
phoneNumber: customerAddress.phoneNumber,
customerCountry: customerAddress.customerCountry, customerCountry: customerAddress.customerCountry,
type: type, type: type,
); );
@ -134,6 +140,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
@required String city, @required String city,
@required String postalCode, @required String postalCode,
@required String emailAddress, @required String emailAddress,
@required String phoneNumber,
@required CustomerCountry customerCountry, @required CustomerCountry customerCountry,
String type}) { String type}) {
if (type == "billing") { if (type == "billing") {
@ -142,6 +149,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
_txtBillingAddressLine.text = addressLine; _txtBillingAddressLine.text = addressLine;
_txtBillingCity.text = city; _txtBillingCity.text = city;
_txtBillingPostalCode.text = postalCode; _txtBillingPostalCode.text = postalCode;
_txtBillingPhoneNumber.text = phoneNumber;
_txtBillingEmailAddress.text = emailAddress; _txtBillingEmailAddress.text = emailAddress;
_billingCountry = customerCountry; _billingCountry = customerCountry;
} else if (type == "shipping") { } else if (type == "shipping") {
@ -172,20 +180,19 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Flexible( Expanded(
fit: FlexFit.tight,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
if (_hasDifferentShippingAddress)
Container( Container(
margin: EdgeInsets.symmetric(vertical: 0), margin: EdgeInsets.symmetric(vertical: 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[ children: <Widget>[
(_hasDifferentShippingAddress Padding(
? Padding(
child: Row( child: Row(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.center, CrossAxisAlignment.center,
@ -212,14 +219,12 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
].where((e) => e != null).toList(), ].where((e) => e != null).toList(),
), ),
padding: EdgeInsets.symmetric(vertical: 4), padding: EdgeInsets.symmetric(vertical: 4),
) ),
: null),
].where((e) => e != null).toList(), ].where((e) => e != null).toList(),
), ),
height: 60, height: 60,
), ),
Flexible( Expanded(
fit: FlexFit.tight,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: ThemeColor.get(context).backgroundContainer, color: ThemeColor.get(context).backgroundContainer,
@ -230,7 +235,8 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
: null, : null,
), ),
padding: EdgeInsets.only(left: 8, right: 8, top: 8), padding: EdgeInsets.only(left: 8, right: 8, top: 8),
child: (activeTab ?? tabBillingDetails()), margin: EdgeInsets.only(top: 8),
child: (activeTab ?? tabBillingDetails())
), ),
), ),
], ],
@ -274,7 +280,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
), ),
PrimaryButton( PrimaryButton(
title: trans("USE DETAILS"), title: trans("USE DETAILS"),
action: () => _useDetailsTapped(), action: _useDetailsTapped,
), ),
], ],
), ),
@ -286,15 +292,17 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
); );
} }
_useDetailsTapped() { _useDetailsTapped() async {
CustomerAddress customerBillingAddress = _setCustomerAddress( CustomerAddress customerBillingAddress = _setCustomerAddress(
firstName: _txtBillingFirstName.text, firstName: _txtBillingFirstName.text,
lastName: _txtBillingLastName.text, lastName: _txtBillingLastName.text,
addressLine: _txtBillingAddressLine.text, addressLine: _txtBillingAddressLine.text,
city: _txtBillingCity.text, city: _txtBillingCity.text,
postalCode: _txtBillingPostalCode.text, postalCode: _txtBillingPostalCode.text,
phoneNumber: _txtBillingPhoneNumber.text,
emailAddress: _txtBillingEmailAddress.text, emailAddress: _txtBillingEmailAddress.text,
customerCountry: _billingCountry); customerCountry: _billingCountry,
);
CheckoutSession.getInstance.billingDetails.shippingAddress = CheckoutSession.getInstance.billingDetails.shippingAddress =
customerBillingAddress; customerBillingAddress;
@ -350,11 +358,11 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
} }
if (valRememberDetails == true) { if (valRememberDetails == true) {
CheckoutSession.getInstance.saveBillingAddress(); await CheckoutSession.getInstance.saveBillingAddress();
CheckoutSession.getInstance.saveShippingAddress(); await CheckoutSession.getInstance.saveShippingAddress();
} else { } else {
CheckoutSession.getInstance.clearBillingAddress(); await CheckoutSession.getInstance.clearBillingAddress();
CheckoutSession.getInstance.clearShippingAddress(); await CheckoutSession.getInstance.clearShippingAddress();
} }
CheckoutSession.getInstance.billingDetails.rememberDetails = CheckoutSession.getInstance.billingDetails.rememberDetails =
@ -380,6 +388,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
addressLine: "", addressLine: "",
city: "", city: "",
postalCode: "", postalCode: "",
phoneNumber: "",
emailAddress: "", emailAddress: "",
customerCountry: CustomerCountry()); customerCountry: CustomerCountry());
} }
@ -393,6 +402,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
@required String city, @required String city,
@required String postalCode, @required String postalCode,
@required String emailAddress, @required String emailAddress,
String phoneNumber,
@required CustomerCountry customerCountry}) { @required CustomerCountry customerCountry}) {
CustomerAddress customerShippingAddress = CustomerAddress(); CustomerAddress customerShippingAddress = CustomerAddress();
customerShippingAddress.firstName = firstName; customerShippingAddress.firstName = firstName;
@ -400,6 +410,9 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
customerShippingAddress.addressLine = addressLine; customerShippingAddress.addressLine = addressLine;
customerShippingAddress.city = city; customerShippingAddress.city = city;
customerShippingAddress.postalCode = postalCode; customerShippingAddress.postalCode = postalCode;
if (phoneNumber != null && phoneNumber != "") {
customerShippingAddress.phoneNumber = phoneNumber;
}
customerShippingAddress.customerCountry = customerCountry; customerShippingAddress.customerCountry = customerCountry;
customerShippingAddress.emailAddress = emailAddress; customerShippingAddress.emailAddress = emailAddress;
return customerShippingAddress; return customerShippingAddress;

View File

@ -23,6 +23,7 @@ class CustomerAddressInput extends StatelessWidget {
@required this.txtControllerCity, @required this.txtControllerCity,
@required this.txtControllerPostalCode, @required this.txtControllerPostalCode,
@required this.txtControllerEmailAddress, @required this.txtControllerEmailAddress,
this.txtControllerPhoneNumber,
@required this.customerCountry, @required this.customerCountry,
@required this.onTapCountry}) @required this.onTapCountry})
: super(key: key); : super(key: key);
@ -32,19 +33,18 @@ class CustomerAddressInput extends StatelessWidget {
txtControllerAddressLine, txtControllerAddressLine,
txtControllerCity, txtControllerCity,
txtControllerPostalCode, txtControllerPostalCode,
txtControllerEmailAddress; txtControllerEmailAddress,
txtControllerPhoneNumber;
final CustomerCountry customerCountry; final CustomerCountry customerCountry;
final Function() onTapCountry; final Function() onTapCountry;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return ListView(
crossAxisAlignment: CrossAxisAlignment.center, shrinkWrap: true,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Flexible( Row(
child: Row(
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: TextEditingRow( child: TextEditingRow(
@ -63,9 +63,7 @@ class CustomerAddressInput extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
), ),
), Row(
Flexible(
child: Row(
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: TextEditingRow( child: TextEditingRow(
@ -81,9 +79,7 @@ class CustomerAddressInput extends StatelessWidget {
), ),
], ],
), ),
), Row(
Flexible(
child: Row(
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: TextEditingRow( child: TextEditingRow(
@ -99,9 +95,19 @@ class CustomerAddressInput extends StatelessWidget {
), ),
], ],
), ),
), if (txtControllerPhoneNumber != null)
Row(
children: <Widget>[
Flexible( Flexible(
child: Padding( child: TextEditingRow(
heading: "Phone Number",
controller: txtControllerPhoneNumber,
keyboardType:TextInputType.phone,
),
),
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4), padding: const EdgeInsets.symmetric(horizontal: 4),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -160,7 +166,6 @@ class CustomerAddressInput extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
), ),
), ),
),
].where((e) => e != null).toList(), ].where((e) => e != null).toList(),
); );
} }

View File

@ -1,7 +1,7 @@
# Official WooSignal App Template for WooCommerce # Official WooSignal App Template for WooCommerce
# Label StoreMax # Label StoreMax
# Version: 5.7.3 # Version: 5.8.0
# Author: Anthony Gordon # Author: Anthony Gordon
# Homepage: https://woosignal.com # Homepage: https://woosignal.com
# Documentation: https://woosignal.com/docs/app/label-storemax # Documentation: https://woosignal.com/docs/app/label-storemax
@ -29,9 +29,9 @@ dependencies:
analyzer: ^1.5.0 analyzer: ^1.5.0
intl: ^0.17.0 intl: ^0.17.0
page_transition: ^2.0.5 page_transition: ^2.0.5
nylo_framework: ^2.1.4 nylo_framework: ^2.2.0
woosignal: ^3.0.5 woosignal: ^3.0.5
flutter_stripe: ^2.1.1 flutter_stripe: ^2.4.0
wp_json_api: ^3.1.3 wp_json_api: ^3.1.3
cached_network_image: ^3.2.0 cached_network_image: ^3.2.0
package_info: ^2.0.2 package_info: ^2.0.2

View File

@ -4,7 +4,7 @@
# WooCommerce App: Label StoreMax # WooCommerce App: Label StoreMax
### Label StoreMax - v5.7.3 ### Label StoreMax - v5.8.0
[Official WooSignal WooCommerce App](https://woosignal.com) [Official WooSignal WooCommerce App](https://woosignal.com)