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
* Fix builds for Flutter 2.10.2

View File

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

View File

@ -6,7 +6,7 @@ buildscript {
}
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"
}
}

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
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;
}
void saveBillingAddress() async {
saveBillingAddress() async {
CustomerAddress customerAddress =
CheckoutSession.getInstance.billingDetails.billingAddress;
@ -66,7 +66,7 @@ class CheckoutSession {
return null;
}
void clearBillingAddress() async =>
clearBillingAddress() async =>
await NyStorage.delete(SharedKey.customerBillingDetails);
saveShippingAddress() async {
@ -88,8 +88,8 @@ class CheckoutSession {
return null;
}
void clearShippingAddress() async =>
NyStorage.delete(SharedKey.customerShippingDetails);
clearShippingAddress() async =>
await NyStorage.delete(SharedKey.customerShippingDetails);
Future<String> total({bool withFormat = false, TaxRate taxRate}) async {
double totalCart = parseWcPrice(await Cart.getInstance.getTotal());

View File

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

View File

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

View File

@ -23,6 +23,7 @@ class CustomerAddressInput extends StatelessWidget {
@required this.txtControllerCity,
@required this.txtControllerPostalCode,
@required this.txtControllerEmailAddress,
this.txtControllerPhoneNumber,
@required this.customerCountry,
@required this.onTapCountry})
: super(key: key);
@ -32,111 +33,92 @@ class CustomerAddressInput extends StatelessWidget {
txtControllerAddressLine,
txtControllerCity,
txtControllerPostalCode,
txtControllerEmailAddress;
txtControllerEmailAddress,
txtControllerPhoneNumber;
final CustomerCountry customerCountry;
final Function() onTapCountry;
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
return ListView(
shrinkWrap: true,
children: <Widget>[
Flexible(
child: Row(
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans("First Name"),
controller: txtControllerFirstName,
shouldAutoFocus: true,
),
Row(
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans("First Name"),
controller: txtControllerFirstName,
shouldAutoFocus: true,
),
Flexible(
child: TextEditingRow(
heading: trans("Last Name"),
controller: txtControllerLastName,
),
),
Flexible(
child: TextEditingRow(
heading: trans("Last Name"),
controller: txtControllerLastName,
),
],
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
),
),
],
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
),
Flexible(
child: Row(
Row(
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans("Address Line"),
controller: txtControllerAddressLine,
),
),
Flexible(
child: TextEditingRow(
heading: trans("City"),
controller: txtControllerCity,
),
),
],
),
Row(
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans("Postal code"),
controller: txtControllerPostalCode,
),
),
Flexible(
child: TextEditingRow(
heading: trans("Email address"),
keyboardType: TextInputType.emailAddress,
controller: txtControllerEmailAddress),
),
],
),
if (txtControllerPhoneNumber != null)
Row(
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans("Address Line"),
controller: txtControllerAddressLine,
),
),
Flexible(
child: TextEditingRow(
heading: trans("City"),
controller: txtControllerCity,
heading: "Phone Number",
controller: txtControllerPhoneNumber,
keyboardType:TextInputType.phone,
),
),
],
),
),
Flexible(
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Row(
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans("Postal code"),
controller: txtControllerPostalCode,
),
),
Flexible(
child: TextEditingRow(
heading: trans("Email address"),
keyboardType: TextInputType.emailAddress,
controller: txtControllerEmailAddress),
),
],
),
),
Flexible(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Row(
children: <Widget>[
if (customerCountry.hasState())
Flexible(
child: Column(
children: [
Container(
height: 23,
child: Text(
trans("State"),
style: Theme.of(context).textTheme.bodyText1,
textAlign: TextAlign.left,
),
width: double.infinity,
),
Padding(
child: SecondaryButton(
title: (customerCountry.state != null
? (customerCountry?.state?.name ?? "")
: trans("Select state")),
action: onTapCountry,
),
padding: EdgeInsets.all(8),
),
],
),
),
if (customerCountry.hasState())
Flexible(
child: Column(
children: [
Container(
height: 23,
child: Text(
trans("Country"),
trans("State"),
style: Theme.of(context).textTheme.bodyText1,
textAlign: TextAlign.left,
),
@ -144,10 +126,9 @@ class CustomerAddressInput extends StatelessWidget {
),
Padding(
child: SecondaryButton(
title: (customerCountry != null &&
(customerCountry?.name ?? "").isNotEmpty
? customerCountry.name
: trans("Select country")),
title: (customerCountry.state != null
? (customerCountry?.state?.name ?? "")
: trans("Select state")),
action: onTapCountry,
),
padding: EdgeInsets.all(8),
@ -155,10 +136,34 @@ class CustomerAddressInput extends StatelessWidget {
],
),
),
].where((element) => element != null).toList(),
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
),
Flexible(
child: Column(
children: [
Container(
height: 23,
child: Text(
trans("Country"),
style: Theme.of(context).textTheme.bodyText1,
textAlign: TextAlign.left,
),
width: double.infinity,
),
Padding(
child: SecondaryButton(
title: (customerCountry != null &&
(customerCountry?.name ?? "").isNotEmpty
? customerCountry.name
: trans("Select country")),
action: onTapCountry,
),
padding: EdgeInsets.all(8),
),
],
),
),
].where((element) => element != null).toList(),
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
),
),
].where((e) => e != null).toList(),

View File

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

View File

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