v2.6.0 updates

This commit is contained in:
Anthony 2021-02-24 19:11:47 +00:00
parent 85d47226ee
commit 6280fde9f5
67 changed files with 3752 additions and 1189 deletions

View File

@ -1,3 +1,10 @@
## [2.6.0] - 2020-02-24
* Ability to manage affiliate products
* Refreshed design for checkout details screen
* New logic to manage shipping better
* Bug fixes
## [2.5.1] - 2020-02-21
* Pubspec.yaml dependency updates

File diff suppressed because it is too large Load Diff

View File

@ -171,5 +171,6 @@
"No more orders": "Keine Bestellungen mehr",
"Account updated": "Konto aktualisiert",
"Spend a minimum of": "Geben Sie mindestens ein",
"for": "zum"
"for": "zum",
"Buy Product": "Produkt kaufen"
}

View File

@ -171,5 +171,6 @@
"No more orders": "No more orders",
"Account updated": "Account updated",
"Spend a minimum of": "Spend a minimum of",
"for": "for"
"for": "for",
"Buy Product": "Buy Product"
}

View File

@ -171,5 +171,6 @@
"No more orders": "No mas pedidos",
"Account updated": "Cuenta actualizada",
"Spend a minimum of": "Gasta un mínimo de",
"for": "para"
"for": "para",
"Buy Product": "Comprar producto"
}

View File

@ -171,5 +171,6 @@
"No more orders": "Plus de commandes",
"Account updated": "Compte mis à jour",
"Spend a minimum of": "Dépensez un minimum de",
"for": "pour"
"for": "pour",
"Buy Product": "Acheter un produit"
}

View File

@ -171,5 +171,6 @@
"No more orders": "aur koee aadesh nahin",
"Account updated": "khaata apadet kiya gaya",
"Spend a minimum of": "kam se kam kharch karen",
"for": "ke liye"
"for": "ke liye",
"Buy Product": "utpaad khareeden"
}

View File

@ -171,5 +171,6 @@
"No more orders": "Niente più ordini",
"Account updated": "Account aggiornato",
"Spend a minimum of": "Spendi un minimo di",
"for": "per"
"for": "per",
"Buy Product": "Acquista prodotto"
}

View File

@ -171,5 +171,6 @@
"No more orders": "Não há mais pedidos",
"Account updated": "Conta atualizada",
"Spend a minimum of": "Gaste um mínimo de",
"for": "para"
"for": "para",
"Buy Product": "Comprar Produto"
}

View File

@ -1,257 +0,0 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// COUNTRY OPTIONS
var appCountryOptions = [
{"name": "United Kingdom", "code": "GB"},
{"name": "United States", "code": "US"},
{"name": "Afghanistan", "code": "AF"},
{"name": "Åland Islands", "code": "AX"},
{"name": "Albania", "code": "AL"},
{"name": "Algeria", "code": "DZ"},
{"name": "American Samoa", "code": "AS"},
{"name": "AndorrA", "code": "AD"},
{"name": "Angola", "code": "AO"},
{"name": "Anguilla", "code": "AI"},
{"name": "Antarctica", "code": "AQ"},
{"name": "Antigua and Barbuda", "code": "AG"},
{"name": "Argentina", "code": "AR"},
{"name": "Armenia", "code": "AM"},
{"name": "Aruba", "code": "AW"},
{"name": "Australia", "code": "AU"},
{"name": "Austria", "code": "AT"},
{"name": "Azerbaijan", "code": "AZ"},
{"name": "Bahamas", "code": "BS"},
{"name": "Bahrain", "code": "BH"},
{"name": "Bangladesh", "code": "BD"},
{"name": "Barbados", "code": "BB"},
{"name": "Belarus", "code": "BY"},
{"name": "Belgium", "code": "BE"},
{"name": "Belize", "code": "BZ"},
{"name": "Benin", "code": "BJ"},
{"name": "Bermuda", "code": "BM"},
{"name": "Bhutan", "code": "BT"},
{"name": "Bolivia", "code": "BO"},
{"name": "Bosnia and Herzegovina", "code": "BA"},
{"name": "Botswana", "code": "BW"},
{"name": "Bouvet Island", "code": "BV"},
{"name": "Brazil", "code": "BR"},
{"name": "British Indian Ocean Territory", "code": "IO"},
{"name": "Brunei Darussalam", "code": "BN"},
{"name": "Bulgaria", "code": "BG"},
{"name": "Burkina Faso", "code": "BF"},
{"name": "Burundi", "code": "BI"},
{"name": "Cambodia", "code": "KH"},
{"name": "Cameroon", "code": "CM"},
{"name": "Canada", "code": "CA"},
{"name": "Cape Verde", "code": "CV"},
{"name": "Cayman Islands", "code": "KY"},
{"name": "Central African Republic", "code": "CF"},
{"name": "Chad", "code": "TD"},
{"name": "Chile", "code": "CL"},
{"name": "China", "code": "CN"},
{"name": "Christmas Island", "code": "CX"},
{"name": "Cocos (Keeling) Islands", "code": "CC"},
{"name": "Colombia", "code": "CO"},
{"name": "Comoros", "code": "KM"},
{"name": "Congo", "code": "CG"},
{"name": "Congo, The Democratic Republic of the", "code": "CD"},
{"name": "Cook Islands", "code": "CK"},
{"name": "Costa Rica", "code": "CR"},
{"name": "Cote D\"Ivoire", "code": "CI"},
{"name": "Croatia", "code": "HR"},
{"name": "Cuba", "code": "CU"},
{"name": "Cyprus", "code": "CY"},
{"name": "Czech Republic", "code": "CZ"},
{"name": "Denmark", "code": "DK"},
{"name": "Djibouti", "code": "DJ"},
{"name": "Dominica", "code": "DM"},
{"name": "Dominican Republic", "code": "DO"},
{"name": "Ecuador", "code": "EC"},
{"name": "Egypt", "code": "EG"},
{"name": "El Salvador", "code": "SV"},
{"name": "Equatorial Guinea", "code": "GQ"},
{"name": "Eritrea", "code": "ER"},
{"name": "Estonia", "code": "EE"},
{"name": "Ethiopia", "code": "ET"},
{"name": "Falkland Islands (Malvinas)", "code": "FK"},
{"name": "Faroe Islands", "code": "FO"},
{"name": "Fiji", "code": "FJ"},
{"name": "Finland", "code": "FI"},
{"name": "France", "code": "FR"},
{"name": "French Guiana", "code": "GF"},
{"name": "French Polynesia", "code": "PF"},
{"name": "French Southern Territories", "code": "TF"},
{"name": "Gabon", "code": "GA"},
{"name": "Gambia", "code": "GM"},
{"name": "Georgia", "code": "GE"},
{"name": "Germany", "code": "DE"},
{"name": "Ghana", "code": "GH"},
{"name": "Gibraltar", "code": "GI"},
{"name": "Greece", "code": "GR"},
{"name": "Greenland", "code": "GL"},
{"name": "Grenada", "code": "GD"},
{"name": "Guadeloupe", "code": "GP"},
{"name": "Guam", "code": "GU"},
{"name": "Guatemala", "code": "GT"},
{"name": "Guernsey", "code": "GG"},
{"name": "Guinea", "code": "GN"},
{"name": "Guinea-Bissau", "code": "GW"},
{"name": "Guyana", "code": "GY"},
{"name": "Haiti", "code": "HT"},
{"name": "Heard Island and Mcdonald Islands", "code": "HM"},
{"name": "Holy See (Vatican City State)", "code": "VA"},
{"name": "Honduras", "code": "HN"},
{"name": "Hong Kong", "code": "HK"},
{"name": "Hungary", "code": "HU"},
{"name": "Iceland", "code": "IS"},
{"name": "India", "code": "IN"},
{"name": "Indonesia", "code": "ID"},
{"name": "Iran, Islamic Republic Of", "code": "IR"},
{"name": "Iraq", "code": "IQ"},
{"name": "Ireland", "code": "IE"},
{"name": "Isle of Man", "code": "IM"},
{"name": "Israel", "code": "IL"},
{"name": "Italy", "code": "IT"},
{"name": "Jamaica", "code": "JM"},
{"name": "Japan", "code": "JP"},
{"name": "Jersey", "code": "JE"},
{"name": "Jordan", "code": "JO"},
{"name": "Kazakhstan", "code": "KZ"},
{"name": "Kenya", "code": "KE"},
{"name": "Kiribati", "code": "KI"},
{"name": "Korea, Democratic People\"S Republic of", "code": "KP"},
{"name": "Korea, Republic of", "code": "KR"},
{"name": "Kuwait", "code": "KW"},
{"name": "Kyrgyzstan", "code": "KG"},
{"name": "Lao People\"S Democratic Republic", "code": "LA"},
{"name": "Latvia", "code": "LV"},
{"name": "Lebanon", "code": "LB"},
{"name": "Lesotho", "code": "LS"},
{"name": "Liberia", "code": "LR"},
{"name": "Libyan Arab Jamahiriya", "code": "LY"},
{"name": "Liechtenstein", "code": "LI"},
{"name": "Lithuania", "code": "LT"},
{"name": "Luxembourg", "code": "LU"},
{"name": "Macao", "code": "MO"},
{"name": "Macedonia, The Former Yugoslav Republic of", "code": "MK"},
{"name": "Madagascar", "code": "MG"},
{"name": "Malawi", "code": "MW"},
{"name": "Malaysia", "code": "MY"},
{"name": "Maldives", "code": "MV"},
{"name": "Mali", "code": "ML"},
{"name": "Malta", "code": "MT"},
{"name": "Marshall Islands", "code": "MH"},
{"name": "Martinique", "code": "MQ"},
{"name": "Mauritania", "code": "MR"},
{"name": "Mauritius", "code": "MU"},
{"name": "Mayotte", "code": "YT"},
{"name": "Mexico", "code": "MX"},
{"name": "Micronesia, Federated States of", "code": "FM"},
{"name": "Moldova, Republic of", "code": "MD"},
{"name": "Monaco", "code": "MC"},
{"name": "Mongolia", "code": "MN"},
{"name": "Montserrat", "code": "MS"},
{"name": "Morocco", "code": "MA"},
{"name": "Mozambique", "code": "MZ"},
{"name": "Myanmar", "code": "MM"},
{"name": "Namibia", "code": "NA"},
{"name": "Nauru", "code": "NR"},
{"name": "Nepal", "code": "NP"},
{"name": "Netherlands", "code": "NL"},
{"name": "Netherlands Antilles", "code": "AN"},
{"name": "New Caledonia", "code": "NC"},
{"name": "New Zealand", "code": "NZ"},
{"name": "Nicaragua", "code": "NI"},
{"name": "Niger", "code": "NE"},
{"name": "Nigeria", "code": "NG"},
{"name": "Niue", "code": "NU"},
{"name": "Norfolk Island", "code": "NF"},
{"name": "Northern Mariana Islands", "code": "MP"},
{"name": "Norway", "code": "NO"},
{"name": "Oman", "code": "OM"},
{"name": "Pakistan", "code": "PK"},
{"name": "Palau", "code": "PW"},
{"name": "Palestinian Territory, Occupied", "code": "PS"},
{"name": "Panama", "code": "PA"},
{"name": "Papua New Guinea", "code": "PG"},
{"name": "Paraguay", "code": "PY"},
{"name": "Peru", "code": "PE"},
{"name": "Philippines", "code": "PH"},
{"name": "Pitcairn", "code": "PN"},
{"name": "Poland", "code": "PL"},
{"name": "Portugal", "code": "PT"},
{"name": "Puerto Rico", "code": "PR"},
{"name": "Qatar", "code": "QA"},
{"name": "Reunion", "code": "RE"},
{"name": "Romania", "code": "RO"},
{"name": "Russian Federation", "code": "RU"},
{"name": "RWANDA", "code": "RW"},
{"name": "Saint Helena", "code": "SH"},
{"name": "Saint Kitts and Nevis", "code": "KN"},
{"name": "Saint Lucia", "code": "LC"},
{"name": "Saint Pierre and Miquelon", "code": "PM"},
{"name": "Saint Vincent and the Grenadines", "code": "VC"},
{"name": "Samoa", "code": "WS"},
{"name": "San Marino", "code": "SM"},
{"name": "Sao Tome and Principe", "code": "ST"},
{"name": "Saudi Arabia", "code": "SA"},
{"name": "Senegal", "code": "SN"},
{"name": "Serbia and Montenegro", "code": "CS"},
{"name": "Seychelles", "code": "SC"},
{"name": "Sierra Leone", "code": "SL"},
{"name": "Singapore", "code": "SG"},
{"name": "Slovakia", "code": "SK"},
{"name": "Slovenia", "code": "SI"},
{"name": "Solomon Islands", "code": "SB"},
{"name": "Somalia", "code": "SO"},
{"name": "South Africa", "code": "ZA"},
{"name": "South Georgia and the South Sandwich Islands", "code": "GS"},
{"name": "Spain", "code": "ES"},
{"name": "Sri Lanka", "code": "LK"},
{"name": "Sudan", "code": "SD"},
{"name": "Suriname", "code": "SR"},
{"name": "Svalbard and Jan Mayen", "code": "SJ"},
{"name": "Swaziland", "code": "SZ"},
{"name": "Sweden", "code": "SE"},
{"name": "Switzerland", "code": "CH"},
{"name": "Syrian Arab Republic", "code": "SY"},
{"name": "Taiwan, Province of China", "code": "TW"},
{"name": "Tajikistan", "code": "TJ"},
{"name": "Tanzania, United Republic of", "code": "TZ"},
{"name": "Thailand", "code": "TH"},
{"name": "Timor-Leste", "code": "TL"},
{"name": "Togo", "code": "TG"},
{"name": "Tokelau", "code": "TK"},
{"name": "Tonga", "code": "TO"},
{"name": "Trinidad and Tobago", "code": "TT"},
{"name": "Tunisia", "code": "TN"},
{"name": "Turkey", "code": "TR"},
{"name": "Turkmenistan", "code": "TM"},
{"name": "Turks and Caicos Islands", "code": "TC"},
{"name": "Tuvalu", "code": "TV"},
{"name": "Uganda", "code": "UG"},
{"name": "Ukraine", "code": "UA"},
{"name": "United Arab Emirates", "code": "AE"},
{"name": "United States Minor Outlying Islands", "code": "UM"},
{"name": "Uruguay", "code": "UY"},
{"name": "Uzbekistan", "code": "UZ"},
{"name": "Vanuatu", "code": "VU"},
{"name": "Venezuela", "code": "VE"},
{"name": "Viet Nam", "code": "VN"},
{"name": "Virgin Islands, British", "code": "VG"},
{"name": "Virgin Islands, U.S.", "code": "VI"},
{"name": "Wallis and Futuna", "code": "WF"},
{"name": "Western Sahara", "code": "EH"},
{"name": "Yemen", "code": "YE"},
{"name": "Zambia", "code": "ZM"},
{"name": "Zimbabwe", "code": "ZW"}
];

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,74 +0,0 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// STATE OPTIONS
// ONLY USED IF COUNTRY IS US
var appStateOptions = [
{"code": "AL", "name": "Alabama"},
{"code": "AK", "name": "Alaska"},
{"code": "AS", "name": "American Samoa"},
{"code": "AZ", "name": "Arizona"},
{"code": "AR", "name": "Arkansas"},
{"code": "CA", "name": "California"},
{"code": "CO", "name": "Colorado"},
{"code": "CT", "name": "Connecticut"},
{"code": "DE", "name": "Delaware"},
{"code": "DC", "name": "District Of Columbia"},
{"code": "FM", "name": "Federated States Of Micronesia"},
{"code": "FL", "name": "Florida"},
{"code": "GA", "name": "Georgia"},
{"code": "GU", "name": "Guam"},
{"code": "HI", "name": "Hawaii"},
{"code": "ID", "name": "Idaho"},
{"code": "IL", "name": "Illinois"},
{"code": "IN", "name": "Indiana"},
{"code": "IA", "name": "Iowa"},
{"code": "KS", "name": "Kansas"},
{"code": "KY", "name": "Kentucky"},
{"code": "LA", "name": "Louisiana"},
{"code": "ME", "name": "Maine"},
{"code": "MH", "name": "Marshall Islands"},
{"code": "MD", "name": "Maryland"},
{"code": "MA", "name": "Massachusetts"},
{"code": "MI", "name": "Michigan"},
{"code": "MN", "name": "Minnesota"},
{"code": "MS", "name": "Mississippi"},
{"code": "MO", "name": "Missouri"},
{"code": "MT", "name": "Montana"},
{"code": "NE", "name": "Nebraska"},
{"code": "NV", "name": "Nevada"},
{"code": "NH", "name": "New Hampshire"},
{"code": "NJ", "name": "New Jersey"},
{"code": "NM", "name": "New Mexico"},
{"code": "NY", "name": "New York"},
{"code": "NC", "name": "North Carolina"},
{"code": "ND", "name": "North Dakota"},
{"code": "MP", "name": "Northern Mariana Islands"},
{"code": "OH", "name": "Ohio"},
{"code": "OK", "name": "Oklahoma"},
{"code": "OR", "name": "Oregon"},
{"code": "PW", "name": "Palau"},
{"code": "PA", "name": "Pennsylvania"},
{"code": "PR", "name": "Puerto Rico"},
{"code": "RI", "name": "Rhode Island"},
{"code": "SC", "name": "South Carolina"},
{"code": "SD", "name": "South Dakota"},
{"code": "TN", "name": "Tennessee"},
{"code": "TX", "name": "Texas"},
{"code": "UT", "name": "Utah"},
{"code": "VT", "name": "Vermont"},
{"code": "VI", "name": "Virgin Islands"},
{"code": "VA", "name": "Virginia"},
{"code": "WA", "name": "Washington"},
{"code": "WV", "name": "West Virginia"},
{"code": "WI", "name": "Wisconsin"},
{"code": "WY", "name": "Wyoming"}
];

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -50,7 +50,7 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
tmpLineItem.total =
(cartItem.quantity > 1 ? cartItem.getCartTotal() : cartItem.subtotal);
tmpLineItem.subtotal =
tmpLineItem.subtotal =
(parseWcPrice(cartItem.subtotal) * cartItem.quantity).toString();
lineItems.add(tmpLineItem);
@ -66,11 +66,11 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
billing.address1 = billingDetails.billingAddress.addressLine;
billing.city = billingDetails.billingAddress.city;
billing.postcode = billingDetails.billingAddress.postalCode;
billing.country = billingDetails.billingAddress.country;
billing.email = billingDetails.billingAddress.emailAddress;
if (billingDetails.billingAddress.country == "United States") {
billing.state = billingDetails.billingAddress.state;
if (billingDetails.billingAddress.customerCountry.hasState()) {
billing.state = billingDetails.billingAddress.customerCountry.state.name;
}
billing.country = billingDetails.billingAddress.customerCountry.name;
orderWC.billing = billing;
@ -81,10 +81,10 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
shipping.address1 = billingDetails.shippingAddress.addressLine;
shipping.city = billingDetails.shippingAddress.city;
shipping.postcode = billingDetails.shippingAddress.postalCode;
if (billingDetails.shippingAddress.country == "United States") {
shipping.state = billingDetails.shippingAddress.state;
if (billingDetails.shippingAddress.customerCountry.hasState()) {
billing.state = billingDetails.shippingAddress.customerCountry.state.name;
}
shipping.country = billingDetails.shippingAddress.country;
billing.country = billingDetails.shippingAddress.customerCountry.name;
orderWC.shipping = shipping;

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,13 +1,14 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import 'dart:convert';
import 'dart:developer';
import 'package:flutter/cupertino.dart';
@ -22,6 +23,7 @@ import 'package:label_storemax/models/billing_details.dart';
import 'package:label_storemax/models/cart.dart';
import 'package:label_storemax/models/cart_line_item.dart';
import 'package:label_storemax/models/checkout_session.dart';
import 'package:label_storemax/models/default_shipping.dart';
import 'package:label_storemax/models/payment_type.dart';
import 'package:html/parser.dart';
import 'package:flutter_web_browser/flutter_web_browser.dart';
@ -157,7 +159,7 @@ String workoutSaleDiscount(
openBrowserTab({@required String url}) async {
await FlutterWebBrowser.openWebPage(
url: url, androidToolbarColor: Colors.white70);
url: url, customTabsOptions: CustomTabsOptions(toolbarColor: Colors.white70));
}
EdgeInsets safeAreaDefault() {
@ -544,3 +546,26 @@ class UserAuth {
String redirect = "/home";
}
Future<List<DefaultShipping>> getDefaultShipping(BuildContext context) async {
String data = await DefaultAssetBundle.of(context)
.loadString("assets/default_shipping.json");
dynamic dataJson = json.decode(data);
List<DefaultShipping> shipping = [];
dataJson.forEach((key, value) {
DefaultShipping defaultShipping = DefaultShipping();
defaultShipping.code = key;
defaultShipping.country = value['country'];
defaultShipping.states = [];
if (value['states'] != null) {
value['states'].forEach((key1, value2) {
defaultShipping.states
.add(DefaultShippingState(code: key1, name: value2));
});
}
shipping.add(defaultShipping);
});
return shipping;
}

View File

@ -3,7 +3,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -16,7 +16,7 @@ import 'dart:ui';
Developer Notes
SUPPORT EMAIL - support@woosignal.com
VERSION - 2.5.1
VERSION - 2.6.0
https://woosignal.com
*/

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -11,6 +11,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:label_storemax/helpers/shared_pref.dart';
import 'package:label_storemax/pages/account_billing_details.dart';
import 'package:label_storemax/pages/account_detail.dart';
import 'package:label_storemax/pages/account_landing.dart';
@ -18,8 +19,10 @@ import 'package:label_storemax/pages/account_order_detail.dart';
import 'package:label_storemax/pages/account_profile_update.dart';
import 'package:label_storemax/pages/account_register.dart';
import 'package:label_storemax/pages/account_shipping_details.dart';
import 'package:label_storemax/pages/customer_countries.dart';
import 'package:label_storemax/pages/error_page.dart';
import 'package:label_storemax/pages/product_image_viewer_page.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:woosignal/models/response/order.dart';
import 'package:woosignal/models/response/product_category.dart';
import 'package:woosignal/models/response/products.dart';
@ -201,6 +204,12 @@ void main() async {
child: HomeSearchPage(),
type: PageTransitionType.bottomToTop,
);
case '/customer-countries':
return PageTransition(
child: CustomerCountriesPage(),
type: PageTransitionType.bottomToTop,
);
default:
return null;
}

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -49,6 +49,10 @@ class CheckoutSession {
CustomerAddress customerAddress =
CheckoutSession.getInstance.billingDetails.billingAddress;
if (customerAddress == null) {
return;
}
String billingAddress = jsonEncode(customerAddress.toJson());
sharedPref.save(sfKeyBillingCheckout, billingAddress);
}
@ -74,6 +78,10 @@ class CheckoutSession {
CustomerAddress customerAddress =
CheckoutSession.getInstance.billingDetails.shippingAddress;
if (customerAddress == null) {
return;
}
String shippingAddress = jsonEncode(customerAddress.toJson());
sharedPref.save(sfKeyShippingCheckout, shippingAddress);
}

View File

@ -1,22 +1,23 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import 'package:label_storemax/models/customer_country.dart';
class CustomerAddress {
String firstName;
String lastName;
String addressLine;
String city;
String postalCode;
String state;
String country;
String emailAddress;
CustomerCountry customerCountry;
CustomerAddress(
{this.firstName,
@ -24,9 +25,8 @@ class CustomerAddress {
this.addressLine,
this.city,
this.postalCode,
this.state,
this.country,
this.emailAddress});
this.emailAddress,
this.customerCountry});
void initAddress() {
firstName = "";
@ -34,8 +34,7 @@ class CustomerAddress {
addressLine = "";
city = "";
postalCode = "";
state = "";
country = "";
customerCountry = CustomerCountry();
emailAddress = "";
}
@ -45,7 +44,9 @@ class CustomerAddress {
this.addressLine.isEmpty ||
this.city.isEmpty ||
this.postalCode.isEmpty) ||
(this.country == "United States" ? this.state.isEmpty : false);
(this.customerCountry.hasState() == true
? (this.customerCountry?.state?.name ?? "").isEmpty
: false);
String addressFull() {
List<String> tmpArrAddress = new List<String>();
@ -58,11 +59,12 @@ class CustomerAddress {
if (postalCode != null && postalCode != "") {
tmpArrAddress.add(postalCode);
}
if (state != null && state != "") {
tmpArrAddress.add(state);
if (this.customerCountry != null &&
this.customerCountry?.state?.name != null) {
tmpArrAddress.add(this.customerCountry?.state?.name);
}
if (country != null && country != "") {
tmpArrAddress.add(country);
if (this.customerCountry != null && this.customerCountry?.name != null) {
tmpArrAddress.add(this.customerCountry.name);
}
return tmpArrAddress.join(", ");
}
@ -84,8 +86,7 @@ class CustomerAddress {
addressLine = json['address_line'];
city = json['city'];
postalCode = json['postal_code'];
state = json['state'];
country = json['country'];
this.customerCountry = CustomerCountry.fromJson(json['customer_country']);
emailAddress = json['email_address'];
}
@ -96,9 +97,13 @@ class CustomerAddress {
data['address_line'] = this.addressLine;
data['city'] = this.city;
data['postal_code'] = this.postalCode;
data['state'] = this.state;
data['country'] = this.country;
data['state'] = this.customerCountry.state;
data['country'] = this.customerCountry.name;
data['email_address'] = this.emailAddress;
data['customer_country'] = null;
if (this.customerCountry != null) {
data['customer_country'] = this.customerCountry.toJson();
}
return data;
}
}

View File

@ -0,0 +1,48 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import 'package:label_storemax/models/default_shipping.dart';
class CustomerCountry {
String countryCode;
String name;
DefaultShippingState state;
CustomerCountry({this.countryCode, this.name, this.state});
CustomerCountry.fromDefaultShipping({DefaultShipping defaultShipping}) {
countryCode = defaultShipping.code;
name = defaultShipping.country;
if ((defaultShipping.states?.length ?? 0) == 1) {
state = defaultShipping.states.first;
}
}
CustomerCountry.fromJson(Map<String, dynamic> json) {
countryCode = json['country_code'];
name = json['name'];
state = DefaultShippingState.fromJson(json['state']);
}
bool hasState() {
return this.state != null && this.state.name != null ? true : false;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['country_code'] = this.countryCode;
data['name'] = this.name;
data['state'] = null;
if (this.state != null) {
data['state'] = this.state.toJson();
}
return data;
}
}

View File

@ -0,0 +1,38 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
class DefaultShipping {
String code;
String country;
List<DefaultShippingState> states;
DefaultShipping({this.code, this.country, this.states});
}
class DefaultShippingState {
String code;
String name;
DefaultShippingState({this.code, this.name});
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['code'] = code;
data['name'] = name;
return data;
}
DefaultShippingState.fromJson(Map<String, dynamic> json) {
if (json == null) {
return;
}
this.code = json['code'];
this.name = json['name'];
}
}

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -40,8 +40,7 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
TextEditingController _txtShippingPostalCode;
TextEditingController _txtShippingCountry;
bool _isLoading;
bool _isUpdating;
bool _isLoading, _isUpdating;
@override
void initState() {

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -32,14 +32,11 @@ class _AccountDetailPageState extends State<AccountDetailPage>
RefreshController _refreshController =
RefreshController(initialRefresh: false);
bool _shouldStopRequests;
bool waitForNextRequest;
bool _shouldStopRequests, waitForNextRequest, _isLoading, _isLoadingOrders;
int _page;
List<Order> _orders;
WCCustomerInfoResponse _wcCustomerInfoResponse;
bool _isLoading;
bool _isLoadingOrders;
int _currentTabIndex = 0;
Widget _activeBody;
@ -296,7 +293,9 @@ class _AccountDetailPageState extends State<AccountDetailPage>
if (orders.length <= 0) {
setState(() {
_isLoadingOrders = false;
_shouldStopRequests = true;
_activeBody = _widgetOrders();
});
return;
}
@ -359,7 +358,7 @@ class _AccountDetailPageState extends State<AccountDetailPage>
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
"#" + _orders[i].id.toString(),
"#${_orders[i].id.toString()}",
maxLines: 1,
overflow: TextOverflow.ellipsis,
),

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -33,8 +33,7 @@ class AccountLandingPage extends StatefulWidget {
class _AccountLandingPageState extends State<AccountLandingPage> {
bool _hasTappedLogin;
TextEditingController _tfEmailController;
TextEditingController _tfPasswordController;
TextEditingController _tfEmailController, _tfPasswordController;
@override
void initState() {

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -53,7 +53,7 @@ class _AccountOrderDetailPageState extends State<AccountOrderDetailPage> {
margin: EdgeInsets.only(left: 0),
),
title: Text(
"${capitalize(trans(context, "Order"))} #" + _orderId.toString(),
"${capitalize(trans(context, "Order"))} #${_orderId.toString()}",
style: Theme.of(context).primaryTextTheme.headline6,
),
centerTitle: true,
@ -79,8 +79,9 @@ class _AccountOrderDetailPageState extends State<AccountOrderDetailPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
child: Text(
"${capitalize(trans(context, "Ships to"))}:")),
child: Text(
"${capitalize(trans(context, "Ships to"))}:"),
),
Flexible(
child: Text(
[
@ -110,87 +111,91 @@ class _AccountOrderDetailPageState extends State<AccountOrderDetailPage> {
),
),
Expanded(
child: ListView.builder(
itemBuilder: (cxt, i) {
return Card(
child: ListTile(
contentPadding: EdgeInsets.only(
top: 5, bottom: 5, left: 8, right: 6),
title: Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: HexColor("#fcfcfc"), width: 1),
child: ListView.builder(
itemBuilder: (cxt, i) {
return Card(
child: ListTile(
contentPadding: EdgeInsets.only(
top: 5, bottom: 5, left: 8, right: 6),
title: Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: HexColor("#fcfcfc"), width: 1),
),
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
child: Text(
_order.lineItems[i].name,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
child: Text(
_order.lineItems[i].name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
Text(
capitalize(
formatStringCurrency(
total: _order.lineItems[i].price),
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
Text(
capitalize(
formatStringCurrency(
total: _order.lineItems[i].price),
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
],
),
),
),
subtitle: Padding(
padding: const EdgeInsets.only(top: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
formatStringCurrency(
total: _order.lineItems[i].total,
subtitle: Padding(
padding: const EdgeInsets.only(top: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
formatStringCurrency(
total: _order.lineItems[i].total,
),
style: Theme.of(context)
.primaryTextTheme
.bodyText2
.copyWith(
fontWeight: FontWeight.w600,
color: Colors.black,
),
textAlign: TextAlign.left,
),
style: Theme.of(context)
.primaryTextTheme
.bodyText2
.copyWith(
fontWeight: FontWeight.w600,
color: Colors.black,
),
textAlign: TextAlign.left,
),
Text(
"x" +
_order.lineItems[i].quantity
.toString(),
style: Theme.of(context)
.primaryTextTheme
.bodyText1
.copyWith(
fontWeight: FontWeight.w600,
color: Colors.black,
),
textAlign: TextAlign.left,
),
],
),
],
Text(
"x" +
_order.lineItems[i].quantity
.toString(),
style: Theme.of(context)
.primaryTextTheme
.bodyText1
.copyWith(
fontWeight: FontWeight.w600,
color: Colors.black,
),
textAlign: TextAlign.left,
),
],
),
],
),
),
),
),
);
},
itemCount: _order.lineItems.length,
)),
);
},
itemCount: _order.lineItems.length,
),
),
],
),
),

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -31,8 +31,7 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
_AccountProfileUpdatePageState();
bool isLoading;
TextEditingController _tfFirstName;
TextEditingController _tfLastName;
TextEditingController _tfFirstName, _tfLastName;
@override
void dispose() {
@ -147,7 +146,7 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
wpUserInfoUpdatedResponse = await WPJsonAPI.instance.api((request) =>
request.wpUpdateUserInfo(userToken,
firstName: firstName, lastName: lastName));
} on Exception catch (e) {
} on Exception catch (_) {
showEdgeAlertWith(context,
title: trans(context, "Invalid details"),
desc: trans(context, "Please check your email and password"),

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -41,8 +41,7 @@ class _AccountShippingDetailsPageState
TextEditingController _txtShippingState;
TextEditingController _txtShippingCountry;
bool _isLoading;
bool _isUpdating;
bool _isLoading, _isUpdating;
@override
void initState() {

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -37,10 +37,9 @@ class _BrowseCategoryPageState extends State<BrowseCategoryPage> {
RefreshController _refreshController =
RefreshController(initialRefresh: false);
ProductCategory _selectedCategory;
bool _isLoading;
int _page;
bool _shouldStopRequests;
bool waitForNextRequest;
bool _shouldStopRequests, waitForNextRequest, _isLoading;
@override
void initState() {

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -27,12 +27,11 @@ class _BrowseSearchState extends State<BrowseSearchPage> {
RefreshController _refreshController =
RefreshController(initialRefresh: false);
List<WS.Product> _products = [];
String _search;
bool _isLoading;
int _page;
bool _shouldStopRequests;
bool waitForNextRequest;
bool _shouldStopRequests, waitForNextRequest, _isLoading;
@override
void initState() {

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -10,17 +10,16 @@
import 'package:flutter/material.dart';
import 'package:label_storemax/app_payment_methods.dart';
import 'package:label_storemax/app_state_options.dart';
import 'package:label_storemax/helpers/tools.dart';
import 'package:label_storemax/labelconfig.dart';
import 'package:label_storemax/models/cart.dart';
import 'package:label_storemax/models/checkout_session.dart';
import 'package:label_storemax/models/customer_address.dart';
import 'package:label_storemax/models/customer_country.dart';
import 'package:label_storemax/widgets/app_loader.dart';
import 'package:label_storemax/widgets/buttons.dart';
import 'package:label_storemax/widgets/woosignal_ui.dart';
import 'package:woosignal/models/response/tax_rate.dart';
import 'package:label_storemax/app_country_options.dart';
class CheckoutConfirmationPage extends StatefulWidget {
CheckoutConfirmationPage({Key key}) : super(key: key);
@ -33,11 +32,10 @@ class CheckoutConfirmationPage extends StatefulWidget {
class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
CheckoutConfirmationPageState();
bool _showFullLoader;
bool _showFullLoader, _isProcessingPayment;
List<TaxRate> _taxRates;
TaxRate _taxRate;
bool _isProcessingPayment;
@override
void initState() {
@ -89,54 +87,57 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
});
return;
}
String country =
CheckoutSession.getInstance.billingDetails.shippingAddress.country;
String state =
CheckoutSession.getInstance.billingDetails.shippingAddress.state;
CustomerCountry shippingCountry = CheckoutSession
.getInstance.billingDetails.shippingAddress.customerCountry;
String postalCode =
CheckoutSession.getInstance.billingDetails.shippingAddress.postalCode;
Map<String, dynamic> countryMap = appCountryOptions
.firstWhere((c) => c['name'] == country, orElse: () => null);
if (countryMap == null) {
if (shippingCountry == null) {
_showFullLoader = false;
setState(() {});
return;
}
TaxRate taxRate;
Map<String, dynamic> stateMap;
if (state != null) {
stateMap = appStateOptions.firstWhere((c) => c['name'] == state,
orElse: () => null);
}
if (stateMap != null) {
if (shippingCountry.hasState()) {
taxRate = _taxRates.firstWhere(
(t) =>
t.country == countryMap["code"] &&
t.state == stateMap["code"] &&
t.postcode == postalCode,
orElse: () => null);
(t) {
if (shippingCountry == null ||
(shippingCountry?.state?.code ?? "") == "") {
return false;
}
if (taxRate == null) {
taxRate = _taxRates.firstWhere(
(t) =>
t.country == countryMap["code"] && t.state == stateMap["code"],
orElse: () => null);
}
List<String> stateElements = shippingCountry.state.code.split(":");
String state = stateElements.last;
if (t.country == shippingCountry.countryCode &&
t.state == state &&
t.postcode == postalCode) {
return true;
}
if (t.country == shippingCountry.countryCode && t.state == state) {
return true;
}
return false;
},
orElse: () => null,
);
}
if (taxRate == null) {
taxRate = _taxRates.firstWhere(
(t) => t.country == countryMap["code"] && t.postcode == postalCode,
orElse: () => null);
(t) =>
t.country == shippingCountry.countryCode &&
t.postcode == postalCode,
orElse: () => null,
);
if (taxRate == null) {
taxRate = _taxRates.firstWhere((t) => t.country == countryMap["code"],
orElse: () => null);
taxRate = _taxRates.firstWhere(
(t) => t.country == shippingCountry.countryCode,
orElse: () => null,
);
}
}
@ -165,7 +166,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
_actionSelectShipping() {
CustomerAddress shippingAddress =
CheckoutSession.getInstance.billingDetails.shippingAddress;
if (shippingAddress == null || shippingAddress.country == "") {
if (shippingAddress == null || shippingAddress.customerCountry == null) {
showEdgeAlertWith(context,
title: trans(context, "Oops"),
desc: trans(context, "Add your shipping details first"),

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -9,14 +9,15 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import 'package:flutter/material.dart';
import 'package:label_storemax/app_state_options.dart';
import 'package:label_storemax/helpers/tools.dart';
import 'package:label_storemax/models/billing_details.dart';
import 'package:label_storemax/models/checkout_session.dart';
import 'package:label_storemax/models/customer_address.dart';
import 'package:label_storemax/models/customer_country.dart';
import 'package:label_storemax/widgets/buttons.dart';
import 'package:label_storemax/widgets/customer_address_input.dart';
import 'package:label_storemax/widgets/switch_address_tab.dart';
import 'package:label_storemax/widgets/woosignal_ui.dart';
import 'package:label_storemax/app_country_options.dart';
class CheckoutDetailsPage extends StatefulWidget {
CheckoutDetailsPage();
@ -28,268 +29,52 @@ class CheckoutDetailsPage extends StatefulWidget {
class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
_CheckoutDetailsPageState();
bool _valDifferentShippingAddress = false;
bool _hasDifferentShippingAddress = false;
int activeTabIndex = 0;
// BILLING TEXT CONTROLLERS
TextEditingController _txtBillingFirstName;
TextEditingController _txtBillingLastName;
TextEditingController _txtBillingAddressLine;
TextEditingController _txtBillingCity;
TextEditingController _txtBillingPostalCode;
TextEditingController _txtBillingEmailAddress;
// TEXT CONTROLLERS
TextEditingController
// billing
_txtBillingFirstName,
_txtBillingLastName,
_txtBillingAddressLine,
_txtBillingCity,
_txtBillingPostalCode,
_txtBillingEmailAddress,
// shipping
_txtShippingFirstName,
_txtShippingLastName,
_txtShippingAddressLine,
_txtShippingCity,
_txtShippingPostalCode,
_txtShippingEmailAddress;
TextEditingController _txtShippingFirstName;
TextEditingController _txtShippingLastName;
TextEditingController _txtShippingAddressLine;
TextEditingController _txtShippingCity;
TextEditingController _txtShippingPostalCode;
TextEditingController _txtShippingEmailAddress;
String _strBillingCountry;
String _strBillingState;
String _strShippingCountry;
String _strShippingState;
CustomerCountry _billingCountry, _shippingCountry;
var valRememberDetails = true;
Widget activeTab;
Widget tabShippingDetails() {
return Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
_valDifferentShippingAddress
? Divider(
height: 0,
)
: null,
Flexible(
child: Row(
children: <Widget>[
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "First Name"),
controller: _txtShippingFirstName,
shouldAutoFocus: true,
),
),
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "Last Name"),
controller: _txtShippingLastName,
),
),
],
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
),
),
Flexible(
child: Row(
children: <Widget>[
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "Address Line"),
controller: _txtShippingAddressLine,
),
),
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "City"),
controller: _txtShippingCity,
),
),
],
),
),
Flexible(
child: Row(
children: <Widget>[
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "Postal code"),
controller: _txtShippingPostalCode,
),
),
Flexible(
child: wsTextEditingRow(context,
heading: trans(context, "Email address"),
keyboardType: TextInputType.emailAddress,
controller: _txtShippingEmailAddress),
),
],
),
),
Flexible(
child: Row(
children: <Widget>[
(_strShippingCountry == "United States"
? Flexible(
child: Padding(
child: wsSecondaryButton(
context,
title: (_strShippingState != null &&
_strShippingState.isNotEmpty
? trans(context, "Selected") +
"\n" +
_strShippingState
: trans(context, "Select state")),
action: () => _showSelectStateModal("shipping"),
),
padding: EdgeInsets.all(8),
),
)
: null),
Flexible(
child: Padding(
child: wsSecondaryButton(
context,
title: (_strShippingCountry != null &&
_strShippingCountry.isNotEmpty
? trans(context, "Selected") +
"\n" +
_strShippingCountry
: trans(context, "Select country")),
action: () => _showSelectCountryModal("shipping"),
),
padding: EdgeInsets.all(8),
),
),
].where((element) => element != null).toList(),
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
),
),
].where((e) => e != null).toList(),
),
);
}
Widget tabShippingDetails() => CustomerAddressInput(
txtControllerFirstName: _txtShippingFirstName,
txtControllerLastName: _txtShippingLastName,
txtControllerAddressLine: _txtShippingAddressLine,
txtControllerCity: _txtShippingCity,
txtControllerPostalCode: _txtShippingPostalCode,
txtControllerEmailAddress: _txtShippingEmailAddress,
customerCountry: _shippingCountry,
onTapCountry: () => _navigateToSelectCountry(type: "shipping"),
);
Widget tabBillingDetails() {
return Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
_valDifferentShippingAddress
? Divider(
height: 0,
)
: null,
Flexible(
child: Row(
children: <Widget>[
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "First Name"),
controller: _txtBillingFirstName,
shouldAutoFocus: true,
),
),
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "Last Name"),
controller: _txtBillingLastName,
),
),
],
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
),
),
Flexible(
child: Row(
children: <Widget>[
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "Address Line"),
controller: _txtBillingAddressLine,
),
),
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "City"),
controller: _txtBillingCity,
),
),
],
),
),
Flexible(
child: Row(
children: <Widget>[
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "Postal code"),
controller: _txtBillingPostalCode,
),
),
Flexible(
child: wsTextEditingRow(context,
heading: trans(context, "Email address"),
keyboardType: TextInputType.emailAddress,
controller: _txtBillingEmailAddress),
),
],
),
),
Flexible(
child: Row(
children: <Widget>[
(_strBillingCountry == "United States"
? Flexible(
child: Padding(
child: wsSecondaryButton(
context,
title: (_strBillingState != null &&
_strBillingState.isNotEmpty
? trans(context, "Selected") +
"\n" +
_strBillingState
: trans(context, "Select state")),
action: () => _showSelectStateModal("billing"),
),
padding: EdgeInsets.all(8),
),
)
: null),
Flexible(
child: Padding(
child: wsSecondaryButton(
context,
title: (_strBillingCountry != null &&
_strBillingCountry.isNotEmpty
? trans(context, "Selected") +
"\n" +
_strBillingCountry
: trans(context, "Select country")),
action: () => _showSelectCountryModal("billing"),
),
padding: EdgeInsets.all(8),
),
),
].where((element) => element != null).toList(),
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
),
),
].where((e) => e != null).toList(),
),
);
}
Widget tabBillingDetails() => CustomerAddressInput(
txtControllerFirstName: _txtBillingFirstName,
txtControllerLastName: _txtBillingLastName,
txtControllerAddressLine: _txtBillingAddressLine,
txtControllerCity: _txtBillingCity,
txtControllerPostalCode: _txtBillingPostalCode,
txtControllerEmailAddress: _txtBillingEmailAddress,
customerCountry: _billingCountry,
onTapCountry: () => _navigateToSelectCountry(type: "billing"),
);
@override
void initState() {
@ -317,146 +102,70 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
CheckoutSession.getInstance.billingDetails.billingAddress.initAddress();
}
BillingDetails billingDetails = CheckoutSession.getInstance.billingDetails;
_txtBillingFirstName.text = billingDetails.billingAddress.firstName;
_txtBillingLastName.text = billingDetails.billingAddress.lastName;
_txtBillingAddressLine.text = billingDetails.billingAddress.addressLine;
_txtBillingCity.text = billingDetails.billingAddress.city;
_txtBillingPostalCode.text = billingDetails.billingAddress.postalCode;
_txtBillingEmailAddress.text = billingDetails.billingAddress.emailAddress;
_strBillingCountry = billingDetails.billingAddress.country;
_strBillingState = billingDetails.billingAddress.state;
_setFieldsFromCustomerAddress(billingDetails.billingAddress,
type: "billing");
_setFieldsFromCustomerAddress(billingDetails.shippingAddress,
type: "shipping");
_txtShippingFirstName.text = billingDetails.shippingAddress.firstName;
_txtShippingLastName.text = billingDetails.shippingAddress.lastName;
_txtShippingAddressLine.text = billingDetails.shippingAddress.addressLine;
_txtShippingCity.text = billingDetails.shippingAddress.city;
_txtShippingPostalCode.text = billingDetails.shippingAddress.postalCode;
_txtShippingEmailAddress.text = billingDetails.shippingAddress.emailAddress;
_strShippingCountry = billingDetails.shippingAddress.country;
_strShippingState = billingDetails.shippingAddress.state;
_valDifferentShippingAddress =
_hasDifferentShippingAddress =
CheckoutSession.getInstance.shipToDifferentAddress;
valRememberDetails = billingDetails.rememberDetails ?? true;
_sfCustomerAddress();
_setCustomersDetails();
}
_sfCustomerAddress() async {
_setCustomersDetails() async {
CustomerAddress sfCustomerBillingAddress =
await CheckoutSession.getInstance.getBillingAddress();
if (sfCustomerBillingAddress != null) {
CustomerAddress customerAddress = sfCustomerBillingAddress;
_txtBillingFirstName.text = customerAddress.firstName;
_txtBillingLastName.text = customerAddress.lastName;
_txtBillingAddressLine.text = customerAddress.addressLine;
_txtBillingCity.text = customerAddress.city;
_txtBillingPostalCode.text = customerAddress.postalCode;
_txtBillingEmailAddress.text = customerAddress.emailAddress;
_strBillingState = customerAddress.state;
_strBillingCountry = customerAddress.country;
}
_setFieldsFromCustomerAddress(sfCustomerBillingAddress, type: "billing");
CustomerAddress sfCustomerShippingAddress =
await CheckoutSession.getInstance.getShippingAddress();
if (sfCustomerShippingAddress != null) {
CustomerAddress customerAddress = sfCustomerShippingAddress;
_txtShippingFirstName.text = customerAddress.firstName;
_txtShippingLastName.text = customerAddress.lastName;
_txtShippingAddressLine.text = customerAddress.addressLine;
_txtShippingCity.text = customerAddress.city;
_txtShippingPostalCode.text = customerAddress.postalCode;
_txtShippingEmailAddress.text = customerAddress.emailAddress;
_strShippingCountry = customerAddress.country;
_strShippingState = customerAddress.state;
_setFieldsFromCustomerAddress(sfCustomerShippingAddress, type: "shipping");
}
_setFieldsFromCustomerAddress(CustomerAddress customerAddress,
{@required String type}) {
assert(type != "");
if (customerAddress == null) {
return;
}
_setFields(
firstName: customerAddress.firstName,
lastName: customerAddress.lastName,
addressLine: customerAddress.addressLine,
city: customerAddress.city,
postalCode: customerAddress.postalCode,
emailAddress: customerAddress.emailAddress,
customerCountry: customerAddress.customerCountry,
type: type);
}
_showSelectCountryModal(String type) {
wsModalBottom(
context,
title: trans(context, "Select a country"),
bodyWidget: ListView.separated(
itemCount: appCountryOptions.length,
itemBuilder: (BuildContext context, int index) {
Map<String, String> strName = appCountryOptions[index];
return InkWell(
child: Container(
child: Text(strName["name"],
style: Theme.of(context).primaryTextTheme.bodyText1),
padding: EdgeInsets.only(top: 25, bottom: 25),
),
splashColor: Colors.grey,
highlightColor: Colors.black12,
onTap: () => setState(() {
if (type == "shipping") {
_strShippingCountry = strName["name"];
activeTab = tabShippingDetails();
Navigator.of(context).pop();
if (strName["code"] == "US") {
_showSelectStateModal(type);
} else {
_strShippingState = "";
}
} else if (type == "billing") {
_strBillingCountry = strName["name"];
Navigator.of(context).pop();
activeTab = tabBillingDetails();
if (strName["code"] == "US") {
_showSelectStateModal(type);
} else {
_strBillingState = "";
}
}
}),
);
},
separatorBuilder: (cxt, i) => Divider(
height: 0,
color: Colors.black12,
),
),
);
}
_showSelectStateModal(String type) {
wsModalBottom(
context,
title: trans(context, "Select a state"),
bodyWidget: ListView.separated(
itemCount: appStateOptions.length,
itemBuilder: (BuildContext context, int index) {
Map<String, String> strName = appStateOptions[index];
return InkWell(
child: Container(
child: Text(
strName["name"],
style: Theme.of(context).primaryTextTheme.bodyText1,
),
padding: EdgeInsets.only(top: 25, bottom: 25),
),
splashColor: Colors.grey,
highlightColor: Colors.black12,
onTap: () => setState(() {
if (type == "shipping") {
_strShippingState = strName["name"];
Navigator.of(context).pop();
activeTab = tabShippingDetails();
} else if (type == "billing") {
_strBillingState = strName["name"];
Navigator.of(context).pop();
activeTab = tabBillingDetails();
}
}),
);
},
separatorBuilder: (cxt, i) => Divider(
height: 0,
color: Colors.black12,
),
),
);
_setFields(
{@required String firstName,
@required String lastName,
@required String addressLine,
@required String city,
@required String postalCode,
@required String emailAddress,
@required CustomerCountry customerCountry,
String type}) {
if (type == "billing") {
_txtBillingFirstName.text = firstName;
_txtBillingLastName.text = lastName;
_txtBillingAddressLine.text = addressLine;
_txtBillingCity.text = city;
_txtBillingPostalCode.text = postalCode;
_txtBillingEmailAddress.text = emailAddress;
_billingCountry = customerCountry;
} else if (type == "shipping") {
_txtShippingFirstName.text = firstName;
_txtShippingLastName.text = lastName;
_txtShippingAddressLine.text = addressLine;
_txtShippingCity.text = city;
_txtShippingPostalCode.text = postalCode;
_txtShippingEmailAddress.text = emailAddress;
_shippingCountry = customerCountry;
}
}
@override
@ -475,110 +184,75 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
minimum: safeAreaDefault(),
child: GestureDetector(
onTap: () => FocusScope.of(context).requestFocus(new FocusNode()),
child: LayoutBuilder(
builder: (context, constraints) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
SizedBox(
child: Container(
margin: EdgeInsets.only(top: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
_valDifferentShippingAddress
? Padding(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: <Widget>[
Flexible(
child: InkWell(
child: Container(
width: double.infinity,
child: Text(
trans(context, "Billing Details"),
style: Theme.of(context)
.textTheme
.subtitle1
.copyWith(
color: activeTabIndex == 0
? Colors.white
: Colors.black),
textAlign: TextAlign.center,
),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(4),
color: activeTabIndex == 0
? Colors.black
: Colors.white,
),
padding: EdgeInsets.symmetric(
horizontal: 4, vertical: 4),
),
onTap: () {
setState(() {
activeTabIndex = 0;
activeTab = tabBillingDetails();
});
},
),
),
Flexible(
child: InkWell(
child: Container(
width: double.infinity,
child: Text(
trans(context, "Shipping Address"),
style: Theme.of(context)
.textTheme
.subtitle1
.copyWith(
color: activeTabIndex == 1
? Colors.white
: Colors.black),
textAlign: TextAlign.center,
),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(4),
color: activeTabIndex == 1
? Colors.black
: Colors.white,
),
padding: EdgeInsets.symmetric(
horizontal: 4, vertical: 2),
),
onTap: () {
setState(() {
activeTabIndex = 1;
activeTab = tabShippingDetails();
});
},
),
)
].where((e) => e != null).toList(),
),
padding: EdgeInsets.symmetric(vertical: 8),
)
: null,
activeTab ?? tabBillingDetails(),
].where((e) => e != null).toList(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
fit: FlexFit.tight,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.symmetric(vertical: 6),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
(_hasDifferentShippingAddress
? Padding(
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: <Widget>[
SwitchAddressTab(
title:
trans(context, "Billing Details"),
currentTabIndex: activeTabIndex,
type: "billing",
onTapAction: () => setState(() {
activeTabIndex = 0;
activeTab = tabBillingDetails();
})),
SwitchAddressTab(
title: trans(
context, "Shipping Address"),
currentTabIndex: activeTabIndex,
type: "shipping",
onTapAction: () => setState(() {
activeTabIndex = 1;
activeTab =
tabShippingDetails();
})),
].where((e) => e != null).toList(),
),
padding: EdgeInsets.symmetric(vertical: 8),
)
: null),
].where((e) => e != null).toList(),
),
height: 60,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: wsBoxShadow(),
Flexible(
fit: FlexFit.tight,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: wsBoxShadow(),
),
padding: EdgeInsets.all(8),
child: (activeTab ?? tabBillingDetails())),
),
padding: EdgeInsets.all(8),
),
height:
(constraints.maxHeight - constraints.minHeight) * 0.62,
],
),
Column(
),
Container(
height: 160,
child: Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -589,7 +263,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
style: Theme.of(context).primaryTextTheme.bodyText2,
),
Checkbox(
value: _valDifferentShippingAddress,
value: _hasDifferentShippingAddress,
onChanged: _onChangeShipping,
)
],
@ -617,8 +291,8 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
action: () => _useDetailsTapped()),
],
),
],
),
),
],
),
),
),
@ -626,96 +300,119 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
}
_useDetailsTapped() {
CustomerAddress customerBillingAddress = new CustomerAddress();
customerBillingAddress.firstName = _txtBillingFirstName.text;
customerBillingAddress.lastName = _txtBillingLastName.text;
customerBillingAddress.addressLine = _txtBillingAddressLine.text;
customerBillingAddress.city = _txtBillingCity.text;
customerBillingAddress.postalCode = _txtBillingPostalCode.text;
customerBillingAddress.state = _strBillingState;
customerBillingAddress.country = _strBillingCountry;
customerBillingAddress.emailAddress = _txtBillingEmailAddress.text;
CustomerAddress customerBillingAddress = _setCustomerAddress(
firstName: _txtBillingFirstName.text,
lastName: _txtBillingLastName.text,
addressLine: _txtBillingAddressLine.text,
city: _txtBillingCity.text,
postalCode: _txtBillingPostalCode.text,
emailAddress: _txtBillingEmailAddress.text,
customerCountry: _billingCountry);
if (!_valDifferentShippingAddress) {
CheckoutSession.getInstance.billingDetails.shippingAddress =
customerBillingAddress;
CheckoutSession.getInstance.billingDetails.shippingAddress =
customerBillingAddress;
CheckoutSession.getInstance.billingDetails.billingAddress =
customerBillingAddress;
CheckoutSession.getInstance.billingDetails.billingAddress =
customerBillingAddress;
if (valRememberDetails == true) {
CheckoutSession.getInstance.saveBillingAddress();
}
} else {
CustomerAddress customerShippingAddress = new CustomerAddress();
customerShippingAddress.firstName = _txtShippingFirstName.text;
customerShippingAddress.lastName = _txtShippingLastName.text;
customerShippingAddress.addressLine = _txtShippingAddressLine.text;
customerShippingAddress.city = _txtShippingCity.text;
customerShippingAddress.postalCode = _txtShippingPostalCode.text;
customerShippingAddress.state = _strShippingState;
customerShippingAddress.country = _strShippingCountry;
customerShippingAddress.emailAddress = _txtShippingEmailAddress.text;
if (_hasDifferentShippingAddress == true) {
CustomerAddress customerShippingAddress = _setCustomerAddress(
firstName: _txtShippingFirstName.text,
lastName: _txtShippingLastName.text,
addressLine: _txtShippingAddressLine.text,
city: _txtShippingCity.text,
postalCode: _txtShippingPostalCode.text,
emailAddress: _txtShippingEmailAddress.text,
customerCountry: _shippingCountry);
if (customerShippingAddress.hasMissingFields()) {
showEdgeAlertWith(context,
title: trans(context, "Oops"),
desc: trans(
context,
trans(context,
"Invalid shipping address, please check your shipping details"),
),
style: EdgeAlertStyle.WARNING);
showEdgeAlertWith(
context,
title: trans(context, "Oops"),
desc: trans(
context,
trans(context,
"Invalid shipping address, please check your shipping details"),
),
style: EdgeAlertStyle.WARNING,
);
return;
}
CheckoutSession.getInstance.billingDetails.billingAddress =
customerBillingAddress;
CheckoutSession.getInstance.billingDetails.shippingAddress =
customerShippingAddress;
if (valRememberDetails == true) {
CheckoutSession.getInstance.saveBillingAddress();
CheckoutSession.getInstance.saveShippingAddress();
}
}
CheckoutSession.getInstance.billingDetails.rememberDetails =
valRememberDetails;
if (valRememberDetails != true) {
if (valRememberDetails == true) {
CheckoutSession.getInstance.saveBillingAddress();
CheckoutSession.getInstance.saveShippingAddress();
} else {
CheckoutSession.getInstance.clearBillingAddress();
CheckoutSession.getInstance.clearShippingAddress();
}
CheckoutSession.getInstance.billingDetails.rememberDetails =
valRememberDetails;
CheckoutSession.getInstance.shipToDifferentAddress =
_valDifferentShippingAddress;
_hasDifferentShippingAddress;
CheckoutSession.getInstance.shippingType = null;
Navigator.pop(context);
}
_onChangeShipping(bool value) async {
_valDifferentShippingAddress = value;
_hasDifferentShippingAddress = value;
activeTabIndex = 1;
if (value == true) {
activeTab = tabShippingDetails();
} else {
activeTab = tabBillingDetails();
}
activeTab = value == true ? tabShippingDetails() : tabBillingDetails();
CustomerAddress sfCustomerShippingAddress =
await CheckoutSession.getInstance.getShippingAddress();
if (sfCustomerShippingAddress == null) {
_txtShippingFirstName.text = "";
_txtShippingLastName.text = "";
_txtShippingAddressLine.text = "";
_txtShippingCity.text = "";
_txtShippingPostalCode.text = "";
_txtShippingEmailAddress.text = "";
_strShippingState = "";
_strShippingCountry = "";
_setFields(
firstName: "",
lastName: "",
addressLine: "",
city: "",
postalCode: "",
emailAddress: "",
customerCountry: new CustomerCountry());
}
setState(() {});
}
CustomerAddress _setCustomerAddress(
{@required String firstName,
@required String lastName,
@required String addressLine,
@required String city,
@required String postalCode,
@required String emailAddress,
@required CustomerCountry customerCountry}) {
CustomerAddress customerShippingAddress = new CustomerAddress();
customerShippingAddress.firstName = firstName;
customerShippingAddress.lastName = lastName;
customerShippingAddress.addressLine = addressLine;
customerShippingAddress.city = city;
customerShippingAddress.postalCode = postalCode;
customerShippingAddress.customerCountry = customerCountry;
customerShippingAddress.emailAddress = emailAddress;
return customerShippingAddress;
}
_navigateToSelectCountry({String type}) {
Navigator.pushNamed(context, "/customer-countries").then((value) {
if (value == null || type == null) {
return;
}
if (type == "billing") {
_billingCountry =
CustomerCountry.fromDefaultShipping(defaultShipping: value);
activeTab = tabBillingDetails();
} else if (type == "shipping") {
_shippingCountry =
CustomerCountry.fromDefaultShipping(defaultShipping: value);
activeTab = tabShippingDetails();
}
setState(() {});
});
}
}

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -9,18 +9,17 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import 'package:flutter/material.dart';
import 'package:label_storemax/app_state_options.dart';
import 'package:label_storemax/helpers/tools.dart';
import 'package:label_storemax/models/cart.dart';
import 'package:label_storemax/models/cart_line_item.dart';
import 'package:label_storemax/models/checkout_session.dart';
import 'package:label_storemax/models/customer_address.dart';
import 'package:label_storemax/models/customer_country.dart';
import 'package:label_storemax/models/shipping_type.dart';
import 'package:label_storemax/widgets/app_loader.dart';
import 'package:label_storemax/widgets/buttons.dart';
import 'package:label_storemax/widgets/woosignal_ui.dart';
import 'package:woosignal/models/response/shipping_method.dart';
import 'package:label_storemax/app_country_options.dart';
class CheckoutShippingTypePage extends StatefulWidget {
CheckoutShippingTypePage();
@ -33,8 +32,7 @@ class CheckoutShippingTypePage extends StatefulWidget {
class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
_CheckoutShippingTypePageState();
bool _isShippingSupported;
bool _isLoading;
bool _isShippingSupported, _isLoading;
List<Map<String, dynamic>> _wsShippingOptions;
WSShipping _shipping;
@ -52,29 +50,47 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
_getShippingMethods() async {
List<WSShipping> wsShipping =
await appWooSignal((api) => api.getShippingMethods());
CustomerAddress customerAddress =
CheckoutSession.getInstance.billingDetails.shippingAddress;
String postalCode = customerAddress.postalCode;
String country = customerAddress.country;
String state = customerAddress.state;
CustomerCountry customerCountry = customerAddress.customerCountry;
String countryCode = appCountryOptions
.firstWhere((c) => c['name'] == country, orElse: () => null)["code"];
Map<String, dynamic> stateMap = appStateOptions
.firstWhere((c) => c['name'] == state, orElse: () => null);
if (customerCountry == null) {
setState(() {
_isLoading = false;
});
return;
}
for (final shipping in wsShipping) {
if (shipping.locations == null) {
continue;
}
Locations location = shipping.locations.firstWhere(
(ws) => (ws.type == "state" &&
stateMap != null &&
stateMap["code"] != null &&
ws.code == "$countryCode:" + stateMap["code"] ||
ws.code == postalCode ||
ws.code == countryCode),
(ws) {
if (customerCountry.countryCode == null || ws.code == null) {
return false;
}
if (ws.type == "state") {
if (customerCountry.state != null &&
(customerCountry.state?.code ?? "") != "") {
return ws.code == customerCountry.state.code;
}
}
if (ws.type == "postcode" && ws.code == postalCode) {
return true;
}
if (ws.type == "country" && ws.code == customerCountry.countryCode) {
return true;
}
return false;
},
orElse: () => null,
);

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -0,0 +1,179 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import 'package:flutter/material.dart';
import 'package:label_storemax/helpers/tools.dart';
import 'package:label_storemax/models/default_shipping.dart';
import 'package:label_storemax/widgets/woosignal_ui.dart';
class CustomerCountriesPage extends StatefulWidget {
CustomerCountriesPage();
@override
_CustomerCountriesPageState createState() => _CustomerCountriesPageState();
}
class _CustomerCountriesPageState extends State<CustomerCountriesPage> {
_CustomerCountriesPageState();
List<DefaultShipping> _defaultShipping = [], _activeShippingResults = [];
TextEditingController _tfSearchCountry;
@override
void initState() {
super.initState();
_tfSearchCountry = TextEditingController();
_getDefaultShipping();
}
_getDefaultShipping() async {
_defaultShipping = await getDefaultShipping(context);
_activeShippingResults = _defaultShipping;
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomPadding: false,
appBar: AppBar(
backgroundColor: Colors.transparent,
title: Text(
trans(context, "Select a country"),
style: Theme.of(context).primaryTextTheme.headline6,
),
centerTitle: true,
),
body: SafeArea(
minimum: safeAreaDefault(),
child: Column(
children: [
Container(
padding: EdgeInsets.symmetric(vertical: 4, horizontal: 16),
margin: EdgeInsets.only(bottom: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
spreadRadius: 2,
blurRadius: 3,
offset: Offset(0, 2), // changes position of shadow
),
],
),
height: 60,
child: Row(
children: [
Container(
height: 50,
margin: EdgeInsets.symmetric(horizontal: 4),
padding: EdgeInsets.only(right: 8),
child: Icon(Icons.search),
),
Expanded(
child: TextField(
controller: _tfSearchCountry,
autofocus: true,
onChanged: _handleOnChanged,
decoration: InputDecoration(
border: InputBorder.none,
),
),
),
],
),
),
Expanded(
child: ListView.builder(
itemBuilder: (cxt, i) {
DefaultShipping defaultShipping = _activeShippingResults[i];
return InkWell(
onTap: () => _handleCountryTapped(defaultShipping),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey[200])),
margin: EdgeInsets.symmetric(vertical: 4),
padding:
EdgeInsets.symmetric(vertical: 16, horizontal: 8),
child: Text(defaultShipping.country),
),
);
},
itemCount: _activeShippingResults.length),
),
],
),
),
);
}
_handleOnChanged(String value) {
_activeShippingResults = _defaultShipping
.where((element) =>
element.country.toLowerCase().contains(value.toLowerCase()))
.toList();
setState(() {});
}
_handleCountryTapped(DefaultShipping defaultShipping) {
if (defaultShipping.states.length > 0) {
_handleStates(defaultShipping);
return;
}
_popWithShippingResult(defaultShipping);
}
_handleStates(DefaultShipping defaultShipping) {
FocusScope.of(context).unfocus();
wsModalBottom(
context,
title: trans(context, "Select a state"),
bodyWidget: ListView.separated(
itemCount: defaultShipping.states.length,
itemBuilder: (BuildContext context, int index) {
DefaultShippingState state = defaultShipping.states[index];
return InkWell(
child: Container(
child: Text(
state.name,
style: Theme.of(context).primaryTextTheme.bodyText1,
),
padding: EdgeInsets.only(top: 25, bottom: 25),
),
splashColor: Colors.grey,
highlightColor: Colors.black12,
onTap: () {
Navigator.pop(context);
_popWithShippingResult(defaultShipping, state: state);
},
);
},
separatorBuilder: (cxt, i) => Divider(
height: 0,
color: Colors.black12,
),
),
);
}
_popWithShippingResult(DefaultShipping defaultShipping,
{DefaultShippingState state}) {
if (state != null) {
defaultShipping.states = [];
defaultShipping.states.add(state);
}
Navigator.pop(context, defaultShipping);
}
}

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -35,9 +35,7 @@ class _HomePageState extends State<HomePage> {
final GlobalKey _key = GlobalKey();
int _page;
bool _shouldStopRequests;
bool waitForNextRequest;
bool _isLoading;
bool _shouldStopRequests, waitForNextRequest, _isLoading;
@override
void initState() {

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -17,6 +17,7 @@ import 'package:label_storemax/models/cart_line_item.dart';
import 'package:label_storemax/widgets/app_loader.dart';
import 'package:label_storemax/widgets/buttons.dart';
import 'package:label_storemax/widgets/cart_icon.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:woosignal/models/response/product_variation.dart' as WS;
import 'package:woosignal/models/response/products.dart' as WSProduct;
import 'package:flutter_swiper/flutter_swiper.dart';
@ -462,41 +463,45 @@ class _ProductDetailState extends State<ProductDetailPage> {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
trans(context, "Quantity"),
style:
Theme.of(context).primaryTextTheme.bodyText1,
),
Row(
children: <Widget>[
IconButton(
icon: Icon(
Icons.remove_circle_outline,
size: 28,
(_product.type != "external"
? Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
trans(context, "Quantity"),
style: Theme.of(context)
.primaryTextTheme
.bodyText1,
),
onPressed: _removeQuantityTapped,
),
Text(
_quantityIndicator.toString(),
style: Theme.of(context)
.primaryTextTheme
.bodyText1,
),
IconButton(
icon: Icon(
Icons.add_circle_outline,
size: 28,
),
onPressed: _addQuantityTapped,
),
],
)
],
),
Row(
children: <Widget>[
IconButton(
icon: Icon(
Icons.remove_circle_outline,
size: 28,
),
onPressed: _removeQuantityTapped,
),
Text(
_quantityIndicator.toString(),
style: Theme.of(context)
.primaryTextTheme
.bodyText1,
),
IconButton(
icon: Icon(
Icons.add_circle_outline,
size: 28,
),
onPressed: _addQuantityTapped,
),
],
)
],
)
: null),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -515,16 +520,24 @@ class _ProductDetailState extends State<ProductDetailPage> {
),
alignment: Alignment.centerLeft,
)),
Flexible(
child: wsPrimaryButton(
context,
title: trans(context, "Add to cart"),
action: () => _addItemToCart(),
),
),
_product.type == "external"
? Flexible(
child: wsPrimaryButton(
context,
title: trans(context, "Buy Product"),
action: () => _viewExternalProduct(),
),
)
: Flexible(
child: wsPrimaryButton(
context,
title: trans(context, "Add to cart"),
action: () => _addItemToCart(),
),
),
],
),
],
].where((e) => e != null).toList(),
),
height: 140,
),
@ -600,4 +613,11 @@ class _ProductDetailState extends State<ProductDetailPage> {
});
}
}
_viewExternalProduct() {
if (_product.externalUrl != null && _product.externalUrl.isNotEmpty) {
// launch(_product.externalUrl);
openBrowserTab(url: _product.externalUrl);
}
}
}

View File

@ -2,7 +2,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -3,7 +3,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -14,8 +14,6 @@
import 'package:flutter/widgets.dart';
import 'package:label_storemax/helpers/data/order_wc.dart';
import 'package:label_storemax/helpers/tools.dart';
import 'package:label_storemax/models/cart.dart';
import 'package:label_storemax/models/checkout_session.dart';
import 'package:label_storemax/pages/checkout_confirmation.dart';
import 'package:woosignal/models/payload/order_wc.dart';
import 'package:woosignal/models/response/order.dart';

View File

@ -3,7 +3,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -3,7 +3,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -3,7 +3,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -16,8 +16,6 @@ import 'package:flutter/material.dart';
import 'package:label_storemax/helpers/data/order_wc.dart';
import 'package:label_storemax/helpers/tools.dart';
import 'package:label_storemax/labelconfig.dart';
import 'package:label_storemax/models/cart.dart';
import 'package:label_storemax/models/checkout_session.dart';
import 'package:label_storemax/pages/checkout_confirmation.dart';
import 'package:woosignal/models/payload/order_wc.dart';
import 'package:woosignal/models/response/order.dart';
@ -44,7 +42,8 @@ stripePay(context,
"line1": billingDetails.shippingAddress.addressLine,
"city": billingDetails.shippingAddress.city,
"postal_code": billingDetails.shippingAddress.postalCode,
"country": billingDetails.shippingAddress.country
"country":
(billingDetails.shippingAddress?.customerCountry?.name ?? "")
};
String cartShortDesc = await cart.cartShortDesc();
@ -108,11 +107,13 @@ stripePay(context,
state.reloadState(showLoader: false);
}
} catch (ex) {
showEdgeAlertWith(context,
title: trans(context, "Oops!"),
desc: trans(context, "Something went wrong, please try again."),
icon: Icons.payment,
style: EdgeAlertStyle.WARNING);
showEdgeAlertWith(
context,
title: trans(context, "Oops!"),
desc: trans(context, "Something went wrong, please try again."),
icon: Icons.payment,
style: EdgeAlertStyle.WARNING,
);
state.reloadState(showLoader: false);
}
}

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -22,6 +22,8 @@ Widget wsPrimaryButton(BuildContext context,
child: Text(
title,
style: Theme.of(context).primaryTextTheme.button.copyWith(fontSize: 16),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
onPressed: action ?? null,
elevation: 0,
@ -41,6 +43,8 @@ Widget wsSecondaryButton(BuildContext context,
color: Colors.black87,
),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
onPressed: action,
color: HexColor("#f6f6f9"),
@ -60,6 +64,8 @@ Widget wsLinkButton(BuildContext context,
title,
style: Theme.of(context).primaryTextTheme.bodyText1,
textAlign: TextAlign.left,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
onPressed: action,
elevation: 0,

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
@ -26,29 +26,30 @@ Widget wsCartIcon(BuildContext context, {Key key}) {
),
bottom: 0),
Positioned.fill(
child: Align(
child: FutureBuilder<List<CartLineItem>>(
future: Cart.getInstance.getCart(),
builder: (BuildContext context,
AsyncSnapshot<List<CartLineItem>> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
child: Align(
child: FutureBuilder<List<CartLineItem>>(
future: Cart.getInstance.getCart(),
builder: (BuildContext context,
AsyncSnapshot<List<CartLineItem>> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return Text("");
default:
if (snapshot.hasError)
return Text("");
default:
if (snapshot.hasError)
return Text("");
else
return new Text(
snapshot.data.length.toString(),
style: Theme.of(context).primaryTextTheme.bodyText1,
textAlign: TextAlign.center,
);
}
},
),
alignment: Alignment.topCenter,
else
return new Text(
snapshot.data.length.toString(),
style: Theme.of(context).primaryTextTheme.bodyText1,
textAlign: TextAlign.center,
);
}
},
),
top: 0)
alignment: Alignment.topCenter,
),
top: 0,
)
],
),
onPressed: () => Navigator.pushNamed(context, "/cart")

View File

@ -0,0 +1,136 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:label_storemax/helpers/tools.dart';
import 'package:label_storemax/models/customer_country.dart';
import 'package:label_storemax/widgets/buttons.dart';
import 'package:label_storemax/widgets/woosignal_ui.dart';
class CustomerAddressInput extends StatelessWidget {
const CustomerAddressInput(
{Key key,
@required this.txtControllerFirstName,
@required this.txtControllerLastName,
@required this.txtControllerAddressLine,
@required this.txtControllerCity,
@required this.txtControllerPostalCode,
@required this.txtControllerEmailAddress,
@required this.customerCountry,
@required this.onTapCountry})
: super(key: key);
final TextEditingController txtControllerFirstName;
final TextEditingController txtControllerLastName;
final TextEditingController txtControllerAddressLine;
final TextEditingController txtControllerCity;
final TextEditingController txtControllerPostalCode;
final TextEditingController txtControllerEmailAddress;
final CustomerCountry customerCountry;
final Function() onTapCountry;
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Flexible(
child: Row(
children: <Widget>[
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "First Name"),
controller: txtControllerFirstName,
shouldAutoFocus: true,
),
),
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "Last Name"),
controller: txtControllerLastName,
),
),
],
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
),
),
Flexible(
child: Row(
children: <Widget>[
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "Address Line"),
controller: txtControllerAddressLine,
),
),
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "City"),
controller: txtControllerCity,
),
),
],
),
),
Flexible(
child: Row(
children: <Widget>[
Flexible(
child: wsTextEditingRow(
context,
heading: trans(context, "Postal code"),
controller: txtControllerPostalCode,
),
),
Flexible(
child: wsTextEditingRow(context,
heading: trans(context, "Email address"),
keyboardType: TextInputType.emailAddress,
controller: txtControllerEmailAddress),
),
],
),
),
Flexible(
child: Row(
children: <Widget>[
(customerCountry.hasState()
? Flexible(
child: Padding(
child: wsSecondaryButton(
context,
title: (customerCountry.state != null
? "${trans(context, "Selected")}\n${customerCountry?.state?.name ?? ""}"
: trans(context, "Select state")),
action: onTapCountry,
),
padding: EdgeInsets.all(8),
),
)
: null),
Flexible(
child: Padding(
child: wsSecondaryButton(
context,
title: (customerCountry != null &&
(customerCountry?.name ?? "").isNotEmpty
? "${trans(context, "Selected")}\n${customerCountry.name}"
: trans(context, "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 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -0,0 +1,50 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class SwitchAddressTab extends StatelessWidget {
const SwitchAddressTab({
Key key,
@required this.type,
@required this.title,
@required this.currentTabIndex,
@required this.onTapAction,
}) : super(key: key);
final String type;
final String title;
final int currentTabIndex;
final Function() onTapAction;
@override
Widget build(BuildContext context) {
bool isActive = false;
if (type == "shipping" && currentTabIndex == 1) {
isActive = true;
}
if (type == "billing" && currentTabIndex == 0) {
isActive = true;
}
return Flexible(
child: InkWell(
child: Container(
width: double.infinity,
child: Text(
this.title,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: isActive ? Colors.white : Colors.black,
),
textAlign: TextAlign.center,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: isActive ? Colors.black : Colors.white,
),
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 2),
),
onTap: onTapAction,
),
);
}
}

View File

@ -1,7 +1,7 @@
// Label StoreMAX
//
// Created by Anthony Gordon.
// 2020, WooSignal Ltd. All rights reserved.
// 2021, WooSignal Ltd. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software

View File

@ -1,7 +1,7 @@
# Official WooSignal App Template for WooCommerce
# Label StoreMax
# Version 2.5.1
# Version 2.6.0
# Homepage: https://woosignal.com
# Author: Anthony Gordon <agordon@woosignal.com>
# Documentation: https://woosignal.com/docs/app/ios/label-storemax
@ -81,6 +81,7 @@ flutter:
- assets/images/dark_powered_by_stripe.png
- assets/images/cash_on_delivery.jpeg
- assets/images/razorpay.png
- assets/default_shipping.json
- lang/en.json
- lang/es.json
- lang/fr.json

View File

@ -4,7 +4,7 @@
# WooCommerce App: Label StoreMax
### Label StoreMax - v2.5.1
### Label StoreMax - v2.6.0
[Official WooSignal WooCommerce App](https://woosignal.com)