v2.6.0 updates
This commit is contained in:
parent
85d47226ee
commit
6280fde9f5
@ -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
|
## [2.5.1] - 2020-02-21
|
||||||
|
|
||||||
* Pubspec.yaml dependency updates
|
* Pubspec.yaml dependency updates
|
||||||
|
|||||||
2645
LabelStoreMax/assets/default_shipping.json
Normal file
2645
LabelStoreMax/assets/default_shipping.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -171,5 +171,6 @@
|
|||||||
"No more orders": "Keine Bestellungen mehr",
|
"No more orders": "Keine Bestellungen mehr",
|
||||||
"Account updated": "Konto aktualisiert",
|
"Account updated": "Konto aktualisiert",
|
||||||
"Spend a minimum of": "Geben Sie mindestens ein",
|
"Spend a minimum of": "Geben Sie mindestens ein",
|
||||||
"for": "zum"
|
"for": "zum",
|
||||||
|
"Buy Product": "Produkt kaufen"
|
||||||
}
|
}
|
||||||
@ -171,5 +171,6 @@
|
|||||||
"No more orders": "No more orders",
|
"No more orders": "No more orders",
|
||||||
"Account updated": "Account updated",
|
"Account updated": "Account updated",
|
||||||
"Spend a minimum of": "Spend a minimum of",
|
"Spend a minimum of": "Spend a minimum of",
|
||||||
"for": "for"
|
"for": "for",
|
||||||
|
"Buy Product": "Buy Product"
|
||||||
}
|
}
|
||||||
@ -171,5 +171,6 @@
|
|||||||
"No more orders": "No mas pedidos",
|
"No more orders": "No mas pedidos",
|
||||||
"Account updated": "Cuenta actualizada",
|
"Account updated": "Cuenta actualizada",
|
||||||
"Spend a minimum of": "Gasta un mínimo de",
|
"Spend a minimum of": "Gasta un mínimo de",
|
||||||
"for": "para"
|
"for": "para",
|
||||||
|
"Buy Product": "Comprar producto"
|
||||||
}
|
}
|
||||||
@ -171,5 +171,6 @@
|
|||||||
"No more orders": "Plus de commandes",
|
"No more orders": "Plus de commandes",
|
||||||
"Account updated": "Compte mis à jour",
|
"Account updated": "Compte mis à jour",
|
||||||
"Spend a minimum of": "Dépensez un minimum de",
|
"Spend a minimum of": "Dépensez un minimum de",
|
||||||
"for": "pour"
|
"for": "pour",
|
||||||
|
"Buy Product": "Acheter un produit"
|
||||||
}
|
}
|
||||||
@ -171,5 +171,6 @@
|
|||||||
"No more orders": "aur koee aadesh nahin",
|
"No more orders": "aur koee aadesh nahin",
|
||||||
"Account updated": "khaata apadet kiya gaya",
|
"Account updated": "khaata apadet kiya gaya",
|
||||||
"Spend a minimum of": "kam se kam kharch karen",
|
"Spend a minimum of": "kam se kam kharch karen",
|
||||||
"for": "ke liye"
|
"for": "ke liye",
|
||||||
|
"Buy Product": "utpaad khareeden"
|
||||||
}
|
}
|
||||||
@ -171,5 +171,6 @@
|
|||||||
"No more orders": "Niente più ordini",
|
"No more orders": "Niente più ordini",
|
||||||
"Account updated": "Account aggiornato",
|
"Account updated": "Account aggiornato",
|
||||||
"Spend a minimum of": "Spendi un minimo di",
|
"Spend a minimum of": "Spendi un minimo di",
|
||||||
"for": "per"
|
"for": "per",
|
||||||
|
"Buy Product": "Acquista prodotto"
|
||||||
}
|
}
|
||||||
@ -171,5 +171,6 @@
|
|||||||
"No more orders": "Não há mais pedidos",
|
"No more orders": "Não há mais pedidos",
|
||||||
"Account updated": "Conta atualizada",
|
"Account updated": "Conta atualizada",
|
||||||
"Spend a minimum of": "Gaste um mínimo de",
|
"Spend a minimum of": "Gaste um mínimo de",
|
||||||
"for": "para"
|
"for": "para",
|
||||||
|
"Buy Product": "Comprar Produto"
|
||||||
}
|
}
|
||||||
@ -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"}
|
|
||||||
];
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -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"}
|
|
||||||
];
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -66,11 +66,11 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
|
|||||||
billing.address1 = billingDetails.billingAddress.addressLine;
|
billing.address1 = billingDetails.billingAddress.addressLine;
|
||||||
billing.city = billingDetails.billingAddress.city;
|
billing.city = billingDetails.billingAddress.city;
|
||||||
billing.postcode = billingDetails.billingAddress.postalCode;
|
billing.postcode = billingDetails.billingAddress.postalCode;
|
||||||
billing.country = billingDetails.billingAddress.country;
|
|
||||||
billing.email = billingDetails.billingAddress.emailAddress;
|
billing.email = billingDetails.billingAddress.emailAddress;
|
||||||
if (billingDetails.billingAddress.country == "United States") {
|
if (billingDetails.billingAddress.customerCountry.hasState()) {
|
||||||
billing.state = billingDetails.billingAddress.state;
|
billing.state = billingDetails.billingAddress.customerCountry.state.name;
|
||||||
}
|
}
|
||||||
|
billing.country = billingDetails.billingAddress.customerCountry.name;
|
||||||
|
|
||||||
orderWC.billing = billing;
|
orderWC.billing = billing;
|
||||||
|
|
||||||
@ -81,10 +81,10 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
|
|||||||
shipping.address1 = billingDetails.shippingAddress.addressLine;
|
shipping.address1 = billingDetails.shippingAddress.addressLine;
|
||||||
shipping.city = billingDetails.shippingAddress.city;
|
shipping.city = billingDetails.shippingAddress.city;
|
||||||
shipping.postcode = billingDetails.shippingAddress.postalCode;
|
shipping.postcode = billingDetails.shippingAddress.postalCode;
|
||||||
if (billingDetails.shippingAddress.country == "United States") {
|
if (billingDetails.shippingAddress.customerCountry.hasState()) {
|
||||||
shipping.state = billingDetails.shippingAddress.state;
|
billing.state = billingDetails.shippingAddress.customerCountry.state.name;
|
||||||
}
|
}
|
||||||
shipping.country = billingDetails.shippingAddress.country;
|
billing.country = billingDetails.shippingAddress.customerCountry.name;
|
||||||
|
|
||||||
orderWC.shipping = shipping;
|
orderWC.shipping = shipping;
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
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.dart';
|
||||||
import 'package:label_storemax/models/cart_line_item.dart';
|
import 'package:label_storemax/models/cart_line_item.dart';
|
||||||
import 'package:label_storemax/models/checkout_session.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:label_storemax/models/payment_type.dart';
|
||||||
import 'package:html/parser.dart';
|
import 'package:html/parser.dart';
|
||||||
import 'package:flutter_web_browser/flutter_web_browser.dart';
|
import 'package:flutter_web_browser/flutter_web_browser.dart';
|
||||||
@ -157,7 +159,7 @@ String workoutSaleDiscount(
|
|||||||
|
|
||||||
openBrowserTab({@required String url}) async {
|
openBrowserTab({@required String url}) async {
|
||||||
await FlutterWebBrowser.openWebPage(
|
await FlutterWebBrowser.openWebPage(
|
||||||
url: url, androidToolbarColor: Colors.white70);
|
url: url, customTabsOptions: CustomTabsOptions(toolbarColor: Colors.white70));
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeInsets safeAreaDefault() {
|
EdgeInsets safeAreaDefault() {
|
||||||
@ -544,3 +546,26 @@ class UserAuth {
|
|||||||
|
|
||||||
String redirect = "/home";
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -16,7 +16,7 @@ import 'dart:ui';
|
|||||||
Developer Notes
|
Developer Notes
|
||||||
|
|
||||||
SUPPORT EMAIL - support@woosignal.com
|
SUPPORT EMAIL - support@woosignal.com
|
||||||
VERSION - 2.5.1
|
VERSION - 2.6.0
|
||||||
https://woosignal.com
|
https://woosignal.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -11,6 +11,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:hexcolor/hexcolor.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_billing_details.dart';
|
||||||
import 'package:label_storemax/pages/account_detail.dart';
|
import 'package:label_storemax/pages/account_detail.dart';
|
||||||
import 'package:label_storemax/pages/account_landing.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_profile_update.dart';
|
||||||
import 'package:label_storemax/pages/account_register.dart';
|
import 'package:label_storemax/pages/account_register.dart';
|
||||||
import 'package:label_storemax/pages/account_shipping_details.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/error_page.dart';
|
||||||
import 'package:label_storemax/pages/product_image_viewer_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/order.dart';
|
||||||
import 'package:woosignal/models/response/product_category.dart';
|
import 'package:woosignal/models/response/product_category.dart';
|
||||||
import 'package:woosignal/models/response/products.dart';
|
import 'package:woosignal/models/response/products.dart';
|
||||||
@ -201,6 +204,12 @@ void main() async {
|
|||||||
child: HomeSearchPage(),
|
child: HomeSearchPage(),
|
||||||
type: PageTransitionType.bottomToTop,
|
type: PageTransitionType.bottomToTop,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
case '/customer-countries':
|
||||||
|
return PageTransition(
|
||||||
|
child: CustomerCountriesPage(),
|
||||||
|
type: PageTransitionType.bottomToTop,
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -49,6 +49,10 @@ class CheckoutSession {
|
|||||||
CustomerAddress customerAddress =
|
CustomerAddress customerAddress =
|
||||||
CheckoutSession.getInstance.billingDetails.billingAddress;
|
CheckoutSession.getInstance.billingDetails.billingAddress;
|
||||||
|
|
||||||
|
if (customerAddress == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String billingAddress = jsonEncode(customerAddress.toJson());
|
String billingAddress = jsonEncode(customerAddress.toJson());
|
||||||
sharedPref.save(sfKeyBillingCheckout, billingAddress);
|
sharedPref.save(sfKeyBillingCheckout, billingAddress);
|
||||||
}
|
}
|
||||||
@ -74,6 +78,10 @@ class CheckoutSession {
|
|||||||
CustomerAddress customerAddress =
|
CustomerAddress customerAddress =
|
||||||
CheckoutSession.getInstance.billingDetails.shippingAddress;
|
CheckoutSession.getInstance.billingDetails.shippingAddress;
|
||||||
|
|
||||||
|
if (customerAddress == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String shippingAddress = jsonEncode(customerAddress.toJson());
|
String shippingAddress = jsonEncode(customerAddress.toJson());
|
||||||
sharedPref.save(sfKeyShippingCheckout, shippingAddress);
|
sharedPref.save(sfKeyShippingCheckout, shippingAddress);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,22 +1,23 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
|
||||||
|
import 'package:label_storemax/models/customer_country.dart';
|
||||||
|
|
||||||
class CustomerAddress {
|
class CustomerAddress {
|
||||||
String firstName;
|
String firstName;
|
||||||
String lastName;
|
String lastName;
|
||||||
String addressLine;
|
String addressLine;
|
||||||
String city;
|
String city;
|
||||||
String postalCode;
|
String postalCode;
|
||||||
String state;
|
|
||||||
String country;
|
|
||||||
String emailAddress;
|
String emailAddress;
|
||||||
|
CustomerCountry customerCountry;
|
||||||
|
|
||||||
CustomerAddress(
|
CustomerAddress(
|
||||||
{this.firstName,
|
{this.firstName,
|
||||||
@ -24,9 +25,8 @@ class CustomerAddress {
|
|||||||
this.addressLine,
|
this.addressLine,
|
||||||
this.city,
|
this.city,
|
||||||
this.postalCode,
|
this.postalCode,
|
||||||
this.state,
|
this.emailAddress,
|
||||||
this.country,
|
this.customerCountry});
|
||||||
this.emailAddress});
|
|
||||||
|
|
||||||
void initAddress() {
|
void initAddress() {
|
||||||
firstName = "";
|
firstName = "";
|
||||||
@ -34,8 +34,7 @@ class CustomerAddress {
|
|||||||
addressLine = "";
|
addressLine = "";
|
||||||
city = "";
|
city = "";
|
||||||
postalCode = "";
|
postalCode = "";
|
||||||
state = "";
|
customerCountry = CustomerCountry();
|
||||||
country = "";
|
|
||||||
emailAddress = "";
|
emailAddress = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +44,9 @@ class CustomerAddress {
|
|||||||
this.addressLine.isEmpty ||
|
this.addressLine.isEmpty ||
|
||||||
this.city.isEmpty ||
|
this.city.isEmpty ||
|
||||||
this.postalCode.isEmpty) ||
|
this.postalCode.isEmpty) ||
|
||||||
(this.country == "United States" ? this.state.isEmpty : false);
|
(this.customerCountry.hasState() == true
|
||||||
|
? (this.customerCountry?.state?.name ?? "").isEmpty
|
||||||
|
: false);
|
||||||
|
|
||||||
String addressFull() {
|
String addressFull() {
|
||||||
List<String> tmpArrAddress = new List<String>();
|
List<String> tmpArrAddress = new List<String>();
|
||||||
@ -58,11 +59,12 @@ class CustomerAddress {
|
|||||||
if (postalCode != null && postalCode != "") {
|
if (postalCode != null && postalCode != "") {
|
||||||
tmpArrAddress.add(postalCode);
|
tmpArrAddress.add(postalCode);
|
||||||
}
|
}
|
||||||
if (state != null && state != "") {
|
if (this.customerCountry != null &&
|
||||||
tmpArrAddress.add(state);
|
this.customerCountry?.state?.name != null) {
|
||||||
|
tmpArrAddress.add(this.customerCountry?.state?.name);
|
||||||
}
|
}
|
||||||
if (country != null && country != "") {
|
if (this.customerCountry != null && this.customerCountry?.name != null) {
|
||||||
tmpArrAddress.add(country);
|
tmpArrAddress.add(this.customerCountry.name);
|
||||||
}
|
}
|
||||||
return tmpArrAddress.join(", ");
|
return tmpArrAddress.join(", ");
|
||||||
}
|
}
|
||||||
@ -84,8 +86,7 @@ class CustomerAddress {
|
|||||||
addressLine = json['address_line'];
|
addressLine = json['address_line'];
|
||||||
city = json['city'];
|
city = json['city'];
|
||||||
postalCode = json['postal_code'];
|
postalCode = json['postal_code'];
|
||||||
state = json['state'];
|
this.customerCountry = CustomerCountry.fromJson(json['customer_country']);
|
||||||
country = json['country'];
|
|
||||||
emailAddress = json['email_address'];
|
emailAddress = json['email_address'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,9 +97,13 @@ class CustomerAddress {
|
|||||||
data['address_line'] = this.addressLine;
|
data['address_line'] = this.addressLine;
|
||||||
data['city'] = this.city;
|
data['city'] = this.city;
|
||||||
data['postal_code'] = this.postalCode;
|
data['postal_code'] = this.postalCode;
|
||||||
data['state'] = this.state;
|
data['state'] = this.customerCountry.state;
|
||||||
data['country'] = this.country;
|
data['country'] = this.customerCountry.name;
|
||||||
data['email_address'] = this.emailAddress;
|
data['email_address'] = this.emailAddress;
|
||||||
|
data['customer_country'] = null;
|
||||||
|
if (this.customerCountry != null) {
|
||||||
|
data['customer_country'] = this.customerCountry.toJson();
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
48
LabelStoreMax/lib/models/customer_country.dart
Normal file
48
LabelStoreMax/lib/models/customer_country.dart
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
38
LabelStoreMax/lib/models/default_shipping.dart
Normal file
38
LabelStoreMax/lib/models/default_shipping.dart
Normal 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'];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -40,8 +40,7 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
|
|||||||
TextEditingController _txtShippingPostalCode;
|
TextEditingController _txtShippingPostalCode;
|
||||||
TextEditingController _txtShippingCountry;
|
TextEditingController _txtShippingCountry;
|
||||||
|
|
||||||
bool _isLoading;
|
bool _isLoading, _isUpdating;
|
||||||
bool _isUpdating;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -32,14 +32,11 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
|||||||
RefreshController _refreshController =
|
RefreshController _refreshController =
|
||||||
RefreshController(initialRefresh: false);
|
RefreshController(initialRefresh: false);
|
||||||
|
|
||||||
bool _shouldStopRequests;
|
bool _shouldStopRequests, waitForNextRequest, _isLoading, _isLoadingOrders;
|
||||||
bool waitForNextRequest;
|
|
||||||
|
|
||||||
int _page;
|
int _page;
|
||||||
List<Order> _orders;
|
List<Order> _orders;
|
||||||
WCCustomerInfoResponse _wcCustomerInfoResponse;
|
WCCustomerInfoResponse _wcCustomerInfoResponse;
|
||||||
bool _isLoading;
|
|
||||||
bool _isLoadingOrders;
|
|
||||||
int _currentTabIndex = 0;
|
int _currentTabIndex = 0;
|
||||||
Widget _activeBody;
|
Widget _activeBody;
|
||||||
|
|
||||||
@ -296,7 +293,9 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
|||||||
|
|
||||||
if (orders.length <= 0) {
|
if (orders.length <= 0) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
_isLoadingOrders = false;
|
||||||
_shouldStopRequests = true;
|
_shouldStopRequests = true;
|
||||||
|
_activeBody = _widgetOrders();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -359,7 +358,7 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"#" + _orders[i].id.toString(),
|
"#${_orders[i].id.toString()}",
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -33,8 +33,7 @@ class AccountLandingPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _AccountLandingPageState extends State<AccountLandingPage> {
|
class _AccountLandingPageState extends State<AccountLandingPage> {
|
||||||
bool _hasTappedLogin;
|
bool _hasTappedLogin;
|
||||||
TextEditingController _tfEmailController;
|
TextEditingController _tfEmailController, _tfPasswordController;
|
||||||
TextEditingController _tfPasswordController;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// 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),
|
margin: EdgeInsets.only(left: 0),
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
"${capitalize(trans(context, "Order"))} #" + _orderId.toString(),
|
"${capitalize(trans(context, "Order"))} #${_orderId.toString()}",
|
||||||
style: Theme.of(context).primaryTextTheme.headline6,
|
style: Theme.of(context).primaryTextTheme.headline6,
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
@ -80,7 +80,8 @@ class _AccountOrderDetailPageState extends State<AccountOrderDetailPage> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
"${capitalize(trans(context, "Ships to"))}:")),
|
"${capitalize(trans(context, "Ships to"))}:"),
|
||||||
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
[
|
[
|
||||||
@ -125,7 +126,8 @@ class _AccountOrderDetailPageState extends State<AccountOrderDetailPage> {
|
|||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -149,10 +151,12 @@ class _AccountOrderDetailPageState extends State<AccountOrderDetailPage> {
|
|||||||
padding: const EdgeInsets.only(top: 10),
|
padding: const EdgeInsets.only(top: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
@ -190,7 +194,8 @@ class _AccountOrderDetailPageState extends State<AccountOrderDetailPage> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
itemCount: _order.lineItems.length,
|
itemCount: _order.lineItems.length,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -31,8 +31,7 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
|
|||||||
_AccountProfileUpdatePageState();
|
_AccountProfileUpdatePageState();
|
||||||
|
|
||||||
bool isLoading;
|
bool isLoading;
|
||||||
TextEditingController _tfFirstName;
|
TextEditingController _tfFirstName, _tfLastName;
|
||||||
TextEditingController _tfLastName;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
@ -147,7 +146,7 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
|
|||||||
wpUserInfoUpdatedResponse = await WPJsonAPI.instance.api((request) =>
|
wpUserInfoUpdatedResponse = await WPJsonAPI.instance.api((request) =>
|
||||||
request.wpUpdateUserInfo(userToken,
|
request.wpUpdateUserInfo(userToken,
|
||||||
firstName: firstName, lastName: lastName));
|
firstName: firstName, lastName: lastName));
|
||||||
} on Exception catch (e) {
|
} on Exception catch (_) {
|
||||||
showEdgeAlertWith(context,
|
showEdgeAlertWith(context,
|
||||||
title: trans(context, "Invalid details"),
|
title: trans(context, "Invalid details"),
|
||||||
desc: trans(context, "Please check your email and password"),
|
desc: trans(context, "Please check your email and password"),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -41,8 +41,7 @@ class _AccountShippingDetailsPageState
|
|||||||
TextEditingController _txtShippingState;
|
TextEditingController _txtShippingState;
|
||||||
TextEditingController _txtShippingCountry;
|
TextEditingController _txtShippingCountry;
|
||||||
|
|
||||||
bool _isLoading;
|
bool _isLoading, _isUpdating;
|
||||||
bool _isUpdating;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -37,10 +37,9 @@ class _BrowseCategoryPageState extends State<BrowseCategoryPage> {
|
|||||||
RefreshController _refreshController =
|
RefreshController _refreshController =
|
||||||
RefreshController(initialRefresh: false);
|
RefreshController(initialRefresh: false);
|
||||||
ProductCategory _selectedCategory;
|
ProductCategory _selectedCategory;
|
||||||
bool _isLoading;
|
|
||||||
int _page;
|
int _page;
|
||||||
bool _shouldStopRequests;
|
bool _shouldStopRequests, waitForNextRequest, _isLoading;
|
||||||
bool waitForNextRequest;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -27,12 +27,11 @@ class _BrowseSearchState extends State<BrowseSearchPage> {
|
|||||||
|
|
||||||
RefreshController _refreshController =
|
RefreshController _refreshController =
|
||||||
RefreshController(initialRefresh: false);
|
RefreshController(initialRefresh: false);
|
||||||
|
|
||||||
List<WS.Product> _products = [];
|
List<WS.Product> _products = [];
|
||||||
String _search;
|
String _search;
|
||||||
bool _isLoading;
|
|
||||||
int _page;
|
int _page;
|
||||||
bool _shouldStopRequests;
|
bool _shouldStopRequests, waitForNextRequest, _isLoading;
|
||||||
bool waitForNextRequest;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -10,17 +10,16 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:label_storemax/app_payment_methods.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/helpers/tools.dart';
|
||||||
import 'package:label_storemax/labelconfig.dart';
|
import 'package:label_storemax/labelconfig.dart';
|
||||||
import 'package:label_storemax/models/cart.dart';
|
import 'package:label_storemax/models/cart.dart';
|
||||||
import 'package:label_storemax/models/checkout_session.dart';
|
import 'package:label_storemax/models/checkout_session.dart';
|
||||||
import 'package:label_storemax/models/customer_address.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/app_loader.dart';
|
||||||
import 'package:label_storemax/widgets/buttons.dart';
|
import 'package:label_storemax/widgets/buttons.dart';
|
||||||
import 'package:label_storemax/widgets/woosignal_ui.dart';
|
import 'package:label_storemax/widgets/woosignal_ui.dart';
|
||||||
import 'package:woosignal/models/response/tax_rate.dart';
|
import 'package:woosignal/models/response/tax_rate.dart';
|
||||||
import 'package:label_storemax/app_country_options.dart';
|
|
||||||
|
|
||||||
class CheckoutConfirmationPage extends StatefulWidget {
|
class CheckoutConfirmationPage extends StatefulWidget {
|
||||||
CheckoutConfirmationPage({Key key}) : super(key: key);
|
CheckoutConfirmationPage({Key key}) : super(key: key);
|
||||||
@ -33,11 +32,10 @@ class CheckoutConfirmationPage extends StatefulWidget {
|
|||||||
class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
||||||
CheckoutConfirmationPageState();
|
CheckoutConfirmationPageState();
|
||||||
|
|
||||||
bool _showFullLoader;
|
bool _showFullLoader, _isProcessingPayment;
|
||||||
|
|
||||||
List<TaxRate> _taxRates;
|
List<TaxRate> _taxRates;
|
||||||
TaxRate _taxRate;
|
TaxRate _taxRate;
|
||||||
bool _isProcessingPayment;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -89,54 +87,57 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String country =
|
CustomerCountry shippingCountry = CheckoutSession
|
||||||
CheckoutSession.getInstance.billingDetails.shippingAddress.country;
|
.getInstance.billingDetails.shippingAddress.customerCountry;
|
||||||
String state =
|
|
||||||
CheckoutSession.getInstance.billingDetails.shippingAddress.state;
|
|
||||||
String postalCode =
|
String postalCode =
|
||||||
CheckoutSession.getInstance.billingDetails.shippingAddress.postalCode;
|
CheckoutSession.getInstance.billingDetails.shippingAddress.postalCode;
|
||||||
|
|
||||||
Map<String, dynamic> countryMap = appCountryOptions
|
if (shippingCountry == null) {
|
||||||
.firstWhere((c) => c['name'] == country, orElse: () => null);
|
|
||||||
|
|
||||||
if (countryMap == null) {
|
|
||||||
_showFullLoader = false;
|
_showFullLoader = false;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaxRate taxRate;
|
TaxRate taxRate;
|
||||||
|
if (shippingCountry.hasState()) {
|
||||||
Map<String, dynamic> stateMap;
|
taxRate = _taxRates.firstWhere(
|
||||||
if (state != null) {
|
(t) {
|
||||||
stateMap = appStateOptions.firstWhere((c) => c['name'] == state,
|
if (shippingCountry == null ||
|
||||||
orElse: () => null);
|
(shippingCountry?.state?.code ?? "") == "") {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stateMap != 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(
|
taxRate = _taxRates.firstWhere(
|
||||||
(t) =>
|
(t) =>
|
||||||
t.country == countryMap["code"] &&
|
t.country == shippingCountry.countryCode &&
|
||||||
t.state == stateMap["code"] &&
|
|
||||||
t.postcode == postalCode,
|
t.postcode == postalCode,
|
||||||
orElse: () => null);
|
orElse: () => null,
|
||||||
|
);
|
||||||
|
|
||||||
if (taxRate == null) {
|
if (taxRate == null) {
|
||||||
taxRate = _taxRates.firstWhere(
|
taxRate = _taxRates.firstWhere(
|
||||||
(t) =>
|
(t) => t.country == shippingCountry.countryCode,
|
||||||
t.country == countryMap["code"] && t.state == stateMap["code"],
|
orElse: () => null,
|
||||||
orElse: () => null);
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (taxRate == null) {
|
|
||||||
taxRate = _taxRates.firstWhere(
|
|
||||||
(t) => t.country == countryMap["code"] && t.postcode == postalCode,
|
|
||||||
orElse: () => null);
|
|
||||||
|
|
||||||
if (taxRate == null) {
|
|
||||||
taxRate = _taxRates.firstWhere((t) => t.country == countryMap["code"],
|
|
||||||
orElse: () => null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +166,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
|||||||
_actionSelectShipping() {
|
_actionSelectShipping() {
|
||||||
CustomerAddress shippingAddress =
|
CustomerAddress shippingAddress =
|
||||||
CheckoutSession.getInstance.billingDetails.shippingAddress;
|
CheckoutSession.getInstance.billingDetails.shippingAddress;
|
||||||
if (shippingAddress == null || shippingAddress.country == "") {
|
if (shippingAddress == null || shippingAddress.customerCountry == null) {
|
||||||
showEdgeAlertWith(context,
|
showEdgeAlertWith(context,
|
||||||
title: trans(context, "Oops"),
|
title: trans(context, "Oops"),
|
||||||
desc: trans(context, "Add your shipping details first"),
|
desc: trans(context, "Add your shipping details first"),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// 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.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:label_storemax/app_state_options.dart';
|
|
||||||
import 'package:label_storemax/helpers/tools.dart';
|
import 'package:label_storemax/helpers/tools.dart';
|
||||||
import 'package:label_storemax/models/billing_details.dart';
|
import 'package:label_storemax/models/billing_details.dart';
|
||||||
import 'package:label_storemax/models/checkout_session.dart';
|
import 'package:label_storemax/models/checkout_session.dart';
|
||||||
import 'package:label_storemax/models/customer_address.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/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/widgets/woosignal_ui.dart';
|
||||||
import 'package:label_storemax/app_country_options.dart';
|
|
||||||
|
|
||||||
class CheckoutDetailsPage extends StatefulWidget {
|
class CheckoutDetailsPage extends StatefulWidget {
|
||||||
CheckoutDetailsPage();
|
CheckoutDetailsPage();
|
||||||
@ -28,268 +29,52 @@ class CheckoutDetailsPage extends StatefulWidget {
|
|||||||
class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
||||||
_CheckoutDetailsPageState();
|
_CheckoutDetailsPageState();
|
||||||
|
|
||||||
bool _valDifferentShippingAddress = false;
|
bool _hasDifferentShippingAddress = false;
|
||||||
int activeTabIndex = 0;
|
int activeTabIndex = 0;
|
||||||
|
|
||||||
// BILLING TEXT CONTROLLERS
|
// TEXT CONTROLLERS
|
||||||
TextEditingController _txtBillingFirstName;
|
TextEditingController
|
||||||
TextEditingController _txtBillingLastName;
|
// billing
|
||||||
TextEditingController _txtBillingAddressLine;
|
_txtBillingFirstName,
|
||||||
TextEditingController _txtBillingCity;
|
_txtBillingLastName,
|
||||||
TextEditingController _txtBillingPostalCode;
|
_txtBillingAddressLine,
|
||||||
TextEditingController _txtBillingEmailAddress;
|
_txtBillingCity,
|
||||||
|
_txtBillingPostalCode,
|
||||||
|
_txtBillingEmailAddress,
|
||||||
|
// shipping
|
||||||
|
_txtShippingFirstName,
|
||||||
|
_txtShippingLastName,
|
||||||
|
_txtShippingAddressLine,
|
||||||
|
_txtShippingCity,
|
||||||
|
_txtShippingPostalCode,
|
||||||
|
_txtShippingEmailAddress;
|
||||||
|
|
||||||
TextEditingController _txtShippingFirstName;
|
CustomerCountry _billingCountry, _shippingCountry;
|
||||||
TextEditingController _txtShippingLastName;
|
|
||||||
TextEditingController _txtShippingAddressLine;
|
|
||||||
TextEditingController _txtShippingCity;
|
|
||||||
TextEditingController _txtShippingPostalCode;
|
|
||||||
TextEditingController _txtShippingEmailAddress;
|
|
||||||
|
|
||||||
String _strBillingCountry;
|
|
||||||
String _strBillingState;
|
|
||||||
|
|
||||||
String _strShippingCountry;
|
|
||||||
String _strShippingState;
|
|
||||||
|
|
||||||
var valRememberDetails = true;
|
var valRememberDetails = true;
|
||||||
Widget activeTab;
|
Widget activeTab;
|
||||||
|
|
||||||
Widget tabShippingDetails() {
|
Widget tabShippingDetails() => CustomerAddressInput(
|
||||||
return Flexible(
|
txtControllerFirstName: _txtShippingFirstName,
|
||||||
child: Column(
|
txtControllerLastName: _txtShippingLastName,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
txtControllerAddressLine: _txtShippingAddressLine,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
txtControllerCity: _txtShippingCity,
|
||||||
children: <Widget>[
|
txtControllerPostalCode: _txtShippingPostalCode,
|
||||||
_valDifferentShippingAddress
|
txtControllerEmailAddress: _txtShippingEmailAddress,
|
||||||
? Divider(
|
customerCountry: _shippingCountry,
|
||||||
height: 0,
|
onTapCountry: () => _navigateToSelectCountry(type: "shipping"),
|
||||||
)
|
|
||||||
: 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 tabBillingDetails() {
|
Widget tabBillingDetails() => CustomerAddressInput(
|
||||||
return Flexible(
|
txtControllerFirstName: _txtBillingFirstName,
|
||||||
child: Column(
|
txtControllerLastName: _txtBillingLastName,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
txtControllerAddressLine: _txtBillingAddressLine,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
txtControllerCity: _txtBillingCity,
|
||||||
children: <Widget>[
|
txtControllerPostalCode: _txtBillingPostalCode,
|
||||||
_valDifferentShippingAddress
|
txtControllerEmailAddress: _txtBillingEmailAddress,
|
||||||
? Divider(
|
customerCountry: _billingCountry,
|
||||||
height: 0,
|
onTapCountry: () => _navigateToSelectCountry(type: "billing"),
|
||||||
)
|
|
||||||
: 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(),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -317,146 +102,70 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
|||||||
CheckoutSession.getInstance.billingDetails.billingAddress.initAddress();
|
CheckoutSession.getInstance.billingDetails.billingAddress.initAddress();
|
||||||
}
|
}
|
||||||
BillingDetails billingDetails = CheckoutSession.getInstance.billingDetails;
|
BillingDetails billingDetails = CheckoutSession.getInstance.billingDetails;
|
||||||
_txtBillingFirstName.text = billingDetails.billingAddress.firstName;
|
_setFieldsFromCustomerAddress(billingDetails.billingAddress,
|
||||||
_txtBillingLastName.text = billingDetails.billingAddress.lastName;
|
type: "billing");
|
||||||
_txtBillingAddressLine.text = billingDetails.billingAddress.addressLine;
|
_setFieldsFromCustomerAddress(billingDetails.shippingAddress,
|
||||||
_txtBillingCity.text = billingDetails.billingAddress.city;
|
type: "shipping");
|
||||||
_txtBillingPostalCode.text = billingDetails.billingAddress.postalCode;
|
|
||||||
_txtBillingEmailAddress.text = billingDetails.billingAddress.emailAddress;
|
|
||||||
_strBillingCountry = billingDetails.billingAddress.country;
|
|
||||||
_strBillingState = billingDetails.billingAddress.state;
|
|
||||||
|
|
||||||
_txtShippingFirstName.text = billingDetails.shippingAddress.firstName;
|
_hasDifferentShippingAddress =
|
||||||
_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 =
|
|
||||||
CheckoutSession.getInstance.shipToDifferentAddress;
|
CheckoutSession.getInstance.shipToDifferentAddress;
|
||||||
valRememberDetails = billingDetails.rememberDetails ?? true;
|
valRememberDetails = billingDetails.rememberDetails ?? true;
|
||||||
_sfCustomerAddress();
|
_setCustomersDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
_sfCustomerAddress() async {
|
_setCustomersDetails() async {
|
||||||
CustomerAddress sfCustomerBillingAddress =
|
CustomerAddress sfCustomerBillingAddress =
|
||||||
await CheckoutSession.getInstance.getBillingAddress();
|
await CheckoutSession.getInstance.getBillingAddress();
|
||||||
if (sfCustomerBillingAddress != null) {
|
_setFieldsFromCustomerAddress(sfCustomerBillingAddress, type: "billing");
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomerAddress sfCustomerShippingAddress =
|
CustomerAddress sfCustomerShippingAddress =
|
||||||
await CheckoutSession.getInstance.getShippingAddress();
|
await CheckoutSession.getInstance.getShippingAddress();
|
||||||
if (sfCustomerShippingAddress != null) {
|
_setFieldsFromCustomerAddress(sfCustomerShippingAddress, type: "shipping");
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_showSelectCountryModal(String type) {
|
_setFieldsFromCustomerAddress(CustomerAddress customerAddress,
|
||||||
wsModalBottom(
|
{@required String type}) {
|
||||||
context,
|
assert(type != "");
|
||||||
title: trans(context, "Select a country"),
|
if (customerAddress == null) {
|
||||||
bodyWidget: ListView.separated(
|
return;
|
||||||
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") {
|
_setFields(
|
||||||
_strBillingCountry = strName["name"];
|
firstName: customerAddress.firstName,
|
||||||
Navigator.of(context).pop();
|
lastName: customerAddress.lastName,
|
||||||
activeTab = tabBillingDetails();
|
addressLine: customerAddress.addressLine,
|
||||||
if (strName["code"] == "US") {
|
city: customerAddress.city,
|
||||||
_showSelectStateModal(type);
|
postalCode: customerAddress.postalCode,
|
||||||
} else {
|
emailAddress: customerAddress.emailAddress,
|
||||||
_strBillingState = "";
|
customerCountry: customerAddress.customerCountry,
|
||||||
}
|
type: type);
|
||||||
}
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (cxt, i) => Divider(
|
|
||||||
height: 0,
|
|
||||||
color: Colors.black12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_showSelectStateModal(String type) {
|
_setFields(
|
||||||
wsModalBottom(
|
{@required String firstName,
|
||||||
context,
|
@required String lastName,
|
||||||
title: trans(context, "Select a state"),
|
@required String addressLine,
|
||||||
bodyWidget: ListView.separated(
|
@required String city,
|
||||||
itemCount: appStateOptions.length,
|
@required String postalCode,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
@required String emailAddress,
|
||||||
Map<String, String> strName = appStateOptions[index];
|
@required CustomerCountry customerCountry,
|
||||||
|
String type}) {
|
||||||
return InkWell(
|
if (type == "billing") {
|
||||||
child: Container(
|
_txtBillingFirstName.text = firstName;
|
||||||
child: Text(
|
_txtBillingLastName.text = lastName;
|
||||||
strName["name"],
|
_txtBillingAddressLine.text = addressLine;
|
||||||
style: Theme.of(context).primaryTextTheme.bodyText1,
|
_txtBillingCity.text = city;
|
||||||
),
|
_txtBillingPostalCode.text = postalCode;
|
||||||
padding: EdgeInsets.only(top: 25, bottom: 25),
|
_txtBillingEmailAddress.text = emailAddress;
|
||||||
),
|
_billingCountry = customerCountry;
|
||||||
splashColor: Colors.grey,
|
} else if (type == "shipping") {
|
||||||
highlightColor: Colors.black12,
|
_txtShippingFirstName.text = firstName;
|
||||||
onTap: () => setState(() {
|
_txtShippingLastName.text = lastName;
|
||||||
if (type == "shipping") {
|
_txtShippingAddressLine.text = addressLine;
|
||||||
_strShippingState = strName["name"];
|
_txtShippingCity.text = city;
|
||||||
Navigator.of(context).pop();
|
_txtShippingPostalCode.text = postalCode;
|
||||||
activeTab = tabShippingDetails();
|
_txtShippingEmailAddress.text = emailAddress;
|
||||||
} else if (type == "billing") {
|
_shippingCountry = customerCountry;
|
||||||
_strBillingState = strName["name"];
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
activeTab = tabBillingDetails();
|
|
||||||
}
|
}
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (cxt, i) => Divider(
|
|
||||||
height: 0,
|
|
||||||
color: Colors.black12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -475,110 +184,75 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
|||||||
minimum: safeAreaDefault(),
|
minimum: safeAreaDefault(),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () => FocusScope.of(context).requestFocus(new FocusNode()),
|
onTap: () => FocusScope.of(context).requestFocus(new FocusNode()),
|
||||||
child: LayoutBuilder(
|
child: Column(
|
||||||
builder: (context, constraints) => Column(
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
Flexible(
|
||||||
child: Container(
|
fit: FlexFit.tight,
|
||||||
margin: EdgeInsets.only(top: 10),
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 6),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
_valDifferentShippingAddress
|
(_hasDifferentShippingAddress
|
||||||
? Padding(
|
? Padding(
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.center,
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.spaceAround,
|
MainAxisAlignment.spaceAround,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Flexible(
|
SwitchAddressTab(
|
||||||
child: InkWell(
|
title:
|
||||||
child: Container(
|
|
||||||
width: double.infinity,
|
|
||||||
child: Text(
|
|
||||||
trans(context, "Billing Details"),
|
trans(context, "Billing Details"),
|
||||||
style: Theme.of(context)
|
currentTabIndex: activeTabIndex,
|
||||||
.textTheme
|
type: "billing",
|
||||||
.subtitle1
|
onTapAction: () => setState(() {
|
||||||
.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;
|
activeTabIndex = 0;
|
||||||
activeTab = tabBillingDetails();
|
activeTab = tabBillingDetails();
|
||||||
});
|
})),
|
||||||
},
|
SwitchAddressTab(
|
||||||
),
|
title: trans(
|
||||||
),
|
context, "Shipping Address"),
|
||||||
Flexible(
|
currentTabIndex: activeTabIndex,
|
||||||
child: InkWell(
|
type: "shipping",
|
||||||
child: Container(
|
onTapAction: () => setState(() {
|
||||||
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;
|
activeTabIndex = 1;
|
||||||
activeTab = tabShippingDetails();
|
activeTab =
|
||||||
});
|
tabShippingDetails();
|
||||||
},
|
})),
|
||||||
),
|
|
||||||
)
|
|
||||||
].where((e) => e != null).toList(),
|
].where((e) => e != null).toList(),
|
||||||
),
|
),
|
||||||
padding: EdgeInsets.symmetric(vertical: 8),
|
padding: EdgeInsets.symmetric(vertical: 8),
|
||||||
)
|
)
|
||||||
: null,
|
: null),
|
||||||
activeTab ?? tabBillingDetails(),
|
|
||||||
].where((e) => e != null).toList(),
|
].where((e) => e != null).toList(),
|
||||||
),
|
),
|
||||||
|
height: 60,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
fit: FlexFit.tight,
|
||||||
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
boxShadow: wsBoxShadow(),
|
boxShadow: wsBoxShadow(),
|
||||||
),
|
),
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
|
child: (activeTab ?? tabBillingDetails())),
|
||||||
),
|
),
|
||||||
height:
|
],
|
||||||
(constraints.maxHeight - constraints.minHeight) * 0.62,
|
|
||||||
),
|
),
|
||||||
Column(
|
),
|
||||||
|
Container(
|
||||||
|
height: 160,
|
||||||
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
@ -589,7 +263,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
|||||||
style: Theme.of(context).primaryTextTheme.bodyText2,
|
style: Theme.of(context).primaryTextTheme.bodyText2,
|
||||||
),
|
),
|
||||||
Checkbox(
|
Checkbox(
|
||||||
value: _valDifferentShippingAddress,
|
value: _hasDifferentShippingAddress,
|
||||||
onChanged: _onChangeShipping,
|
onChanged: _onChangeShipping,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -617,8 +291,8 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
|||||||
action: () => _useDetailsTapped()),
|
action: () => _useDetailsTapped()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -626,96 +300,119 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_useDetailsTapped() {
|
_useDetailsTapped() {
|
||||||
CustomerAddress customerBillingAddress = new CustomerAddress();
|
CustomerAddress customerBillingAddress = _setCustomerAddress(
|
||||||
customerBillingAddress.firstName = _txtBillingFirstName.text;
|
firstName: _txtBillingFirstName.text,
|
||||||
customerBillingAddress.lastName = _txtBillingLastName.text;
|
lastName: _txtBillingLastName.text,
|
||||||
customerBillingAddress.addressLine = _txtBillingAddressLine.text;
|
addressLine: _txtBillingAddressLine.text,
|
||||||
customerBillingAddress.city = _txtBillingCity.text;
|
city: _txtBillingCity.text,
|
||||||
customerBillingAddress.postalCode = _txtBillingPostalCode.text;
|
postalCode: _txtBillingPostalCode.text,
|
||||||
customerBillingAddress.state = _strBillingState;
|
emailAddress: _txtBillingEmailAddress.text,
|
||||||
customerBillingAddress.country = _strBillingCountry;
|
customerCountry: _billingCountry);
|
||||||
customerBillingAddress.emailAddress = _txtBillingEmailAddress.text;
|
|
||||||
|
|
||||||
if (!_valDifferentShippingAddress) {
|
|
||||||
CheckoutSession.getInstance.billingDetails.shippingAddress =
|
CheckoutSession.getInstance.billingDetails.shippingAddress =
|
||||||
customerBillingAddress;
|
customerBillingAddress;
|
||||||
|
|
||||||
CheckoutSession.getInstance.billingDetails.billingAddress =
|
CheckoutSession.getInstance.billingDetails.billingAddress =
|
||||||
customerBillingAddress;
|
customerBillingAddress;
|
||||||
|
|
||||||
if (valRememberDetails == true) {
|
if (_hasDifferentShippingAddress == true) {
|
||||||
CheckoutSession.getInstance.saveBillingAddress();
|
CustomerAddress customerShippingAddress = _setCustomerAddress(
|
||||||
}
|
firstName: _txtShippingFirstName.text,
|
||||||
} else {
|
lastName: _txtShippingLastName.text,
|
||||||
CustomerAddress customerShippingAddress = new CustomerAddress();
|
addressLine: _txtShippingAddressLine.text,
|
||||||
customerShippingAddress.firstName = _txtShippingFirstName.text;
|
city: _txtShippingCity.text,
|
||||||
customerShippingAddress.lastName = _txtShippingLastName.text;
|
postalCode: _txtShippingPostalCode.text,
|
||||||
customerShippingAddress.addressLine = _txtShippingAddressLine.text;
|
emailAddress: _txtShippingEmailAddress.text,
|
||||||
customerShippingAddress.city = _txtShippingCity.text;
|
customerCountry: _shippingCountry);
|
||||||
customerShippingAddress.postalCode = _txtShippingPostalCode.text;
|
|
||||||
customerShippingAddress.state = _strShippingState;
|
|
||||||
customerShippingAddress.country = _strShippingCountry;
|
|
||||||
customerShippingAddress.emailAddress = _txtShippingEmailAddress.text;
|
|
||||||
|
|
||||||
if (customerShippingAddress.hasMissingFields()) {
|
if (customerShippingAddress.hasMissingFields()) {
|
||||||
showEdgeAlertWith(context,
|
showEdgeAlertWith(
|
||||||
|
context,
|
||||||
title: trans(context, "Oops"),
|
title: trans(context, "Oops"),
|
||||||
desc: trans(
|
desc: trans(
|
||||||
context,
|
context,
|
||||||
trans(context,
|
trans(context,
|
||||||
"Invalid shipping address, please check your shipping details"),
|
"Invalid shipping address, please check your shipping details"),
|
||||||
),
|
),
|
||||||
style: EdgeAlertStyle.WARNING);
|
style: EdgeAlertStyle.WARNING,
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckoutSession.getInstance.billingDetails.billingAddress =
|
|
||||||
customerBillingAddress;
|
|
||||||
|
|
||||||
CheckoutSession.getInstance.billingDetails.shippingAddress =
|
CheckoutSession.getInstance.billingDetails.shippingAddress =
|
||||||
customerShippingAddress;
|
customerShippingAddress;
|
||||||
|
}
|
||||||
|
|
||||||
if (valRememberDetails == true) {
|
if (valRememberDetails == true) {
|
||||||
CheckoutSession.getInstance.saveBillingAddress();
|
CheckoutSession.getInstance.saveBillingAddress();
|
||||||
CheckoutSession.getInstance.saveShippingAddress();
|
CheckoutSession.getInstance.saveShippingAddress();
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
CheckoutSession.getInstance.billingDetails.rememberDetails =
|
|
||||||
valRememberDetails;
|
|
||||||
|
|
||||||
if (valRememberDetails != true) {
|
|
||||||
CheckoutSession.getInstance.clearBillingAddress();
|
CheckoutSession.getInstance.clearBillingAddress();
|
||||||
CheckoutSession.getInstance.clearShippingAddress();
|
CheckoutSession.getInstance.clearShippingAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckoutSession.getInstance.billingDetails.rememberDetails =
|
||||||
|
valRememberDetails;
|
||||||
CheckoutSession.getInstance.shipToDifferentAddress =
|
CheckoutSession.getInstance.shipToDifferentAddress =
|
||||||
_valDifferentShippingAddress;
|
_hasDifferentShippingAddress;
|
||||||
|
|
||||||
CheckoutSession.getInstance.shippingType = null;
|
CheckoutSession.getInstance.shippingType = null;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onChangeShipping(bool value) async {
|
_onChangeShipping(bool value) async {
|
||||||
_valDifferentShippingAddress = value;
|
_hasDifferentShippingAddress = value;
|
||||||
activeTabIndex = 1;
|
activeTabIndex = 1;
|
||||||
if (value == true) {
|
activeTab = value == true ? tabShippingDetails() : tabBillingDetails();
|
||||||
activeTab = tabShippingDetails();
|
|
||||||
} else {
|
|
||||||
activeTab = tabBillingDetails();
|
|
||||||
}
|
|
||||||
CustomerAddress sfCustomerShippingAddress =
|
CustomerAddress sfCustomerShippingAddress =
|
||||||
await CheckoutSession.getInstance.getShippingAddress();
|
await CheckoutSession.getInstance.getShippingAddress();
|
||||||
if (sfCustomerShippingAddress == null) {
|
if (sfCustomerShippingAddress == null) {
|
||||||
_txtShippingFirstName.text = "";
|
_setFields(
|
||||||
_txtShippingLastName.text = "";
|
firstName: "",
|
||||||
_txtShippingAddressLine.text = "";
|
lastName: "",
|
||||||
_txtShippingCity.text = "";
|
addressLine: "",
|
||||||
_txtShippingPostalCode.text = "";
|
city: "",
|
||||||
_txtShippingEmailAddress.text = "";
|
postalCode: "",
|
||||||
_strShippingState = "";
|
emailAddress: "",
|
||||||
_strShippingCountry = "";
|
customerCountry: new CustomerCountry());
|
||||||
}
|
}
|
||||||
setState(() {});
|
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(() {});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// 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.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:label_storemax/app_state_options.dart';
|
|
||||||
import 'package:label_storemax/helpers/tools.dart';
|
import 'package:label_storemax/helpers/tools.dart';
|
||||||
import 'package:label_storemax/models/cart.dart';
|
import 'package:label_storemax/models/cart.dart';
|
||||||
import 'package:label_storemax/models/cart_line_item.dart';
|
import 'package:label_storemax/models/cart_line_item.dart';
|
||||||
import 'package:label_storemax/models/checkout_session.dart';
|
import 'package:label_storemax/models/checkout_session.dart';
|
||||||
import 'package:label_storemax/models/customer_address.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/models/shipping_type.dart';
|
||||||
import 'package:label_storemax/widgets/app_loader.dart';
|
import 'package:label_storemax/widgets/app_loader.dart';
|
||||||
import 'package:label_storemax/widgets/buttons.dart';
|
import 'package:label_storemax/widgets/buttons.dart';
|
||||||
import 'package:label_storemax/widgets/woosignal_ui.dart';
|
import 'package:label_storemax/widgets/woosignal_ui.dart';
|
||||||
import 'package:woosignal/models/response/shipping_method.dart';
|
import 'package:woosignal/models/response/shipping_method.dart';
|
||||||
import 'package:label_storemax/app_country_options.dart';
|
|
||||||
|
|
||||||
class CheckoutShippingTypePage extends StatefulWidget {
|
class CheckoutShippingTypePage extends StatefulWidget {
|
||||||
CheckoutShippingTypePage();
|
CheckoutShippingTypePage();
|
||||||
@ -33,8 +32,7 @@ class CheckoutShippingTypePage extends StatefulWidget {
|
|||||||
class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
||||||
_CheckoutShippingTypePageState();
|
_CheckoutShippingTypePageState();
|
||||||
|
|
||||||
bool _isShippingSupported;
|
bool _isShippingSupported, _isLoading;
|
||||||
bool _isLoading;
|
|
||||||
List<Map<String, dynamic>> _wsShippingOptions;
|
List<Map<String, dynamic>> _wsShippingOptions;
|
||||||
WSShipping _shipping;
|
WSShipping _shipping;
|
||||||
|
|
||||||
@ -52,29 +50,47 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
|||||||
_getShippingMethods() async {
|
_getShippingMethods() async {
|
||||||
List<WSShipping> wsShipping =
|
List<WSShipping> wsShipping =
|
||||||
await appWooSignal((api) => api.getShippingMethods());
|
await appWooSignal((api) => api.getShippingMethods());
|
||||||
|
|
||||||
CustomerAddress customerAddress =
|
CustomerAddress customerAddress =
|
||||||
CheckoutSession.getInstance.billingDetails.shippingAddress;
|
CheckoutSession.getInstance.billingDetails.shippingAddress;
|
||||||
String postalCode = customerAddress.postalCode;
|
String postalCode = customerAddress.postalCode;
|
||||||
String country = customerAddress.country;
|
CustomerCountry customerCountry = customerAddress.customerCountry;
|
||||||
String state = customerAddress.state;
|
|
||||||
|
|
||||||
String countryCode = appCountryOptions
|
if (customerCountry == null) {
|
||||||
.firstWhere((c) => c['name'] == country, orElse: () => null)["code"];
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
Map<String, dynamic> stateMap = appStateOptions
|
});
|
||||||
.firstWhere((c) => c['name'] == state, orElse: () => null);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (final shipping in wsShipping) {
|
for (final shipping in wsShipping) {
|
||||||
if (shipping.locations == null) {
|
if (shipping.locations == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Locations location = shipping.locations.firstWhere(
|
Locations location = shipping.locations.firstWhere(
|
||||||
(ws) => (ws.type == "state" &&
|
(ws) {
|
||||||
stateMap != null &&
|
if (customerCountry.countryCode == null || ws.code == null) {
|
||||||
stateMap["code"] != null &&
|
return false;
|
||||||
ws.code == "$countryCode:" + stateMap["code"] ||
|
}
|
||||||
ws.code == postalCode ||
|
|
||||||
ws.code == countryCode),
|
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,
|
orElse: () => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
179
LabelStoreMax/lib/pages/customer_countries.dart
Normal file
179
LabelStoreMax/lib/pages/customer_countries.dart
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -35,9 +35,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
final GlobalKey _key = GlobalKey();
|
final GlobalKey _key = GlobalKey();
|
||||||
|
|
||||||
int _page;
|
int _page;
|
||||||
bool _shouldStopRequests;
|
bool _shouldStopRequests, waitForNextRequest, _isLoading;
|
||||||
bool waitForNextRequest;
|
|
||||||
bool _isLoading;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// 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/app_loader.dart';
|
||||||
import 'package:label_storemax/widgets/buttons.dart';
|
import 'package:label_storemax/widgets/buttons.dart';
|
||||||
import 'package:label_storemax/widgets/cart_icon.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/product_variation.dart' as WS;
|
||||||
import 'package:woosignal/models/response/products.dart' as WSProduct;
|
import 'package:woosignal/models/response/products.dart' as WSProduct;
|
||||||
import 'package:flutter_swiper/flutter_swiper.dart';
|
import 'package:flutter_swiper/flutter_swiper.dart';
|
||||||
@ -462,14 +463,17 @@ class _ProductDetailState extends State<ProductDetailPage> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(
|
(_product.type != "external"
|
||||||
|
? Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
trans(context, "Quantity"),
|
trans(context, "Quantity"),
|
||||||
style:
|
style: Theme.of(context)
|
||||||
Theme.of(context).primaryTextTheme.bodyText1,
|
.primaryTextTheme
|
||||||
|
.bodyText1,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -496,7 +500,8 @@ class _ProductDetailState extends State<ProductDetailPage> {
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
|
: null),
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
@ -515,7 +520,15 @@ class _ProductDetailState extends State<ProductDetailPage> {
|
|||||||
),
|
),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
)),
|
)),
|
||||||
Flexible(
|
_product.type == "external"
|
||||||
|
? Flexible(
|
||||||
|
child: wsPrimaryButton(
|
||||||
|
context,
|
||||||
|
title: trans(context, "Buy Product"),
|
||||||
|
action: () => _viewExternalProduct(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Flexible(
|
||||||
child: wsPrimaryButton(
|
child: wsPrimaryButton(
|
||||||
context,
|
context,
|
||||||
title: trans(context, "Add to cart"),
|
title: trans(context, "Add to cart"),
|
||||||
@ -524,7 +537,7 @@ class _ProductDetailState extends State<ProductDetailPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
].where((e) => e != null).toList(),
|
||||||
),
|
),
|
||||||
height: 140,
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -14,8 +14,6 @@
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:label_storemax/helpers/data/order_wc.dart';
|
import 'package:label_storemax/helpers/data/order_wc.dart';
|
||||||
import 'package:label_storemax/helpers/tools.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:label_storemax/pages/checkout_confirmation.dart';
|
||||||
import 'package:woosignal/models/payload/order_wc.dart';
|
import 'package:woosignal/models/payload/order_wc.dart';
|
||||||
import 'package:woosignal/models/response/order.dart';
|
import 'package:woosignal/models/response/order.dart';
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// 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/data/order_wc.dart';
|
||||||
import 'package:label_storemax/helpers/tools.dart';
|
import 'package:label_storemax/helpers/tools.dart';
|
||||||
import 'package:label_storemax/labelconfig.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:label_storemax/pages/checkout_confirmation.dart';
|
||||||
import 'package:woosignal/models/payload/order_wc.dart';
|
import 'package:woosignal/models/payload/order_wc.dart';
|
||||||
import 'package:woosignal/models/response/order.dart';
|
import 'package:woosignal/models/response/order.dart';
|
||||||
@ -44,7 +42,8 @@ stripePay(context,
|
|||||||
"line1": billingDetails.shippingAddress.addressLine,
|
"line1": billingDetails.shippingAddress.addressLine,
|
||||||
"city": billingDetails.shippingAddress.city,
|
"city": billingDetails.shippingAddress.city,
|
||||||
"postal_code": billingDetails.shippingAddress.postalCode,
|
"postal_code": billingDetails.shippingAddress.postalCode,
|
||||||
"country": billingDetails.shippingAddress.country
|
"country":
|
||||||
|
(billingDetails.shippingAddress?.customerCountry?.name ?? "")
|
||||||
};
|
};
|
||||||
|
|
||||||
String cartShortDesc = await cart.cartShortDesc();
|
String cartShortDesc = await cart.cartShortDesc();
|
||||||
@ -108,11 +107,13 @@ stripePay(context,
|
|||||||
state.reloadState(showLoader: false);
|
state.reloadState(showLoader: false);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
showEdgeAlertWith(context,
|
showEdgeAlertWith(
|
||||||
|
context,
|
||||||
title: trans(context, "Oops!"),
|
title: trans(context, "Oops!"),
|
||||||
desc: trans(context, "Something went wrong, please try again."),
|
desc: trans(context, "Something went wrong, please try again."),
|
||||||
icon: Icons.payment,
|
icon: Icons.payment,
|
||||||
style: EdgeAlertStyle.WARNING);
|
style: EdgeAlertStyle.WARNING,
|
||||||
|
);
|
||||||
state.reloadState(showLoader: false);
|
state.reloadState(showLoader: false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -22,6 +22,8 @@ Widget wsPrimaryButton(BuildContext context,
|
|||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
style: Theme.of(context).primaryTextTheme.button.copyWith(fontSize: 16),
|
style: Theme.of(context).primaryTextTheme.button.copyWith(fontSize: 16),
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
onPressed: action ?? null,
|
onPressed: action ?? null,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
@ -41,6 +43,8 @@ Widget wsSecondaryButton(BuildContext context,
|
|||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
onPressed: action,
|
onPressed: action,
|
||||||
color: HexColor("#f6f6f9"),
|
color: HexColor("#f6f6f9"),
|
||||||
@ -60,6 +64,8 @@ Widget wsLinkButton(BuildContext context,
|
|||||||
title,
|
title,
|
||||||
style: Theme.of(context).primaryTextTheme.bodyText1,
|
style: Theme.of(context).primaryTextTheme.bodyText1,
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
onPressed: action,
|
onPressed: action,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
@ -48,7 +48,8 @@ Widget wsCartIcon(BuildContext context, {Key key}) {
|
|||||||
),
|
),
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
),
|
),
|
||||||
top: 0)
|
top: 0,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onPressed: () => Navigator.pushNamed(context, "/cart")
|
onPressed: () => Navigator.pushNamed(context, "/cart")
|
||||||
|
|||||||
136
LabelStoreMax/lib/widgets/customer_address_input.dart
Normal file
136
LabelStoreMax/lib/widgets/customer_address_input.dart
Normal 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(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
50
LabelStoreMax/lib/widgets/switch_address_tab.dart
Normal file
50
LabelStoreMax/lib/widgets/switch_address_tab.dart
Normal 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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
// Label StoreMAX
|
// Label StoreMAX
|
||||||
//
|
//
|
||||||
// Created by Anthony Gordon.
|
// 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
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
# Official WooSignal App Template for WooCommerce
|
# Official WooSignal App Template for WooCommerce
|
||||||
|
|
||||||
# Label StoreMax
|
# Label StoreMax
|
||||||
# Version 2.5.1
|
# Version 2.6.0
|
||||||
# Homepage: https://woosignal.com
|
# Homepage: https://woosignal.com
|
||||||
# Author: Anthony Gordon <agordon@woosignal.com>
|
# Author: Anthony Gordon <agordon@woosignal.com>
|
||||||
# Documentation: https://woosignal.com/docs/app/ios/label-storemax
|
# Documentation: https://woosignal.com/docs/app/ios/label-storemax
|
||||||
@ -81,6 +81,7 @@ flutter:
|
|||||||
- assets/images/dark_powered_by_stripe.png
|
- assets/images/dark_powered_by_stripe.png
|
||||||
- assets/images/cash_on_delivery.jpeg
|
- assets/images/cash_on_delivery.jpeg
|
||||||
- assets/images/razorpay.png
|
- assets/images/razorpay.png
|
||||||
|
- assets/default_shipping.json
|
||||||
- lang/en.json
|
- lang/en.json
|
||||||
- lang/es.json
|
- lang/es.json
|
||||||
- lang/fr.json
|
- lang/fr.json
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user