v3.0.0 - Major release, Flutter 2.0.0+ support + more
This commit is contained in:
parent
b935c2a29d
commit
ed6460836f
@ -1,3 +1,11 @@
|
||||
## [3.0.0] - 2020-03-08
|
||||
|
||||
* Major release
|
||||
* Flutter 2.0.0+ support
|
||||
* Manage app from WooSignal
|
||||
* Code tidy up
|
||||
* Bug fixes
|
||||
|
||||
## [2.6.0] - 2020-02-24
|
||||
|
||||
* Ability to manage affiliate products
|
||||
|
||||
@ -1 +1 @@
|
||||
bc983e13b3efb48b50e7a3cb8fc4ede2
|
||||
5b271ab1c6a17b054237577340baf791
|
||||
@ -1,18 +1,18 @@
|
||||
#
|
||||
# NOTE: This podspec is NOT to be published. It is only used as a local source!
|
||||
# This is a generated file; do not edit or check into version control.
|
||||
#
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'Flutter'
|
||||
s.version = '1.0.0'
|
||||
s.summary = 'High-performance, high-fidelity mobile apps.'
|
||||
s.description = <<-DESC
|
||||
Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
|
||||
DESC
|
||||
s.homepage = 'https://flutter.io'
|
||||
s.license = { :type => 'MIT' }
|
||||
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
|
||||
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.vendored_frameworks = 'Flutter.framework'
|
||||
# Framework linking is handled by Flutter tooling, not CocoaPods.
|
||||
# Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
|
||||
s.vendored_frameworks = 'path/to/nothing'
|
||||
end
|
||||
|
||||
@ -265,7 +265,6 @@
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
|
||||
"${PODS_ROOT}/../Flutter/Flutter.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Stripe/Stripe.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/device_info/device_info.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/flutter_money_formatter/flutter_money_formatter.framework",
|
||||
@ -283,7 +282,6 @@
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Stripe.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_money_formatter.framework",
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
||||
@ -172,5 +172,7 @@
|
||||
"Account updated": "Konto aktualisiert",
|
||||
"Spend a minimum of": "Geben Sie mindestens ein",
|
||||
"for": "zum",
|
||||
"Buy Product": "Produkt kaufen"
|
||||
"Buy Product": "Produkt kaufen",
|
||||
"Retry": "Wiederholen",
|
||||
"Retry later": "Versuchen Sie es später erneut"
|
||||
}
|
||||
@ -172,5 +172,7 @@
|
||||
"Account updated": "Account updated",
|
||||
"Spend a minimum of": "Spend a minimum of",
|
||||
"for": "for",
|
||||
"Buy Product": "Buy Product"
|
||||
"Buy Product": "Buy Product",
|
||||
"Retry": "Retry",
|
||||
"Retry later": "Retry later"
|
||||
}
|
||||
@ -172,5 +172,7 @@
|
||||
"Account updated": "Cuenta actualizada",
|
||||
"Spend a minimum of": "Gasta un mínimo de",
|
||||
"for": "para",
|
||||
"Buy Product": "Comprar producto"
|
||||
"Buy Product": "Comprar producto",
|
||||
"Retry": "Rever",
|
||||
"Retry later": "Reintentar más tarde"
|
||||
}
|
||||
@ -172,5 +172,7 @@
|
||||
"Account updated": "Compte mis à jour",
|
||||
"Spend a minimum of": "Dépensez un minimum de",
|
||||
"for": "pour",
|
||||
"Buy Product": "Acheter un produit"
|
||||
"Buy Product": "Acheter un produit",
|
||||
"Retry": "Recommencez",
|
||||
"Retry later": "Réessayer plus tard"
|
||||
}
|
||||
@ -172,5 +172,7 @@
|
||||
"Account updated": "khaata apadet kiya gaya",
|
||||
"Spend a minimum of": "kam se kam kharch karen",
|
||||
"for": "ke liye",
|
||||
"Buy Product": "utpaad khareeden"
|
||||
"Buy Product": "utpaad khareeden",
|
||||
"Retry": "pun: prayaas karen",
|
||||
"Retry later": "baad mein pun: prayaas karen"
|
||||
}
|
||||
@ -172,5 +172,7 @@
|
||||
"Account updated": "Account aggiornato",
|
||||
"Spend a minimum of": "Spendi un minimo di",
|
||||
"for": "per",
|
||||
"Buy Product": "Acquista prodotto"
|
||||
"Buy Product": "Acquista prodotto",
|
||||
"Retry": "Riprova",
|
||||
"Retry later": "Riprova più tardi"
|
||||
}
|
||||
@ -172,5 +172,7 @@
|
||||
"Account updated": "Conta atualizada",
|
||||
"Spend a minimum of": "Gaste um mínimo de",
|
||||
"for": "para",
|
||||
"Buy Product": "Comprar Produto"
|
||||
"Buy Product": "Comprar Produto",
|
||||
"Retry": "Tentar novamente",
|
||||
"Retry later": "Tentar mais tarde"
|
||||
}
|
||||
17
LabelStoreMax/lib/generated_plugin_registrant.dart
Normal file
17
LabelStoreMax/lib/generated_plugin_registrant.dart
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:shared_preferences_web/shared_preferences_web.dart';
|
||||
import 'package:url_launcher_web/url_launcher_web.dart';
|
||||
|
||||
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
|
||||
|
||||
// ignore: public_member_api_docs
|
||||
void registerPlugins(Registrar registrar) {
|
||||
SharedPreferencesPlugin.registerWith(registrar);
|
||||
UrlLauncherPlugin.registerWith(registrar);
|
||||
registrar.registerMessageHandler();
|
||||
}
|
||||
9
LabelStoreMax/lib/helpers/app_helper.dart
Normal file
9
LabelStoreMax/lib/helpers/app_helper.dart
Normal file
@ -0,0 +1,9 @@
|
||||
import 'package:woosignal/models/response/woosignal_app.dart';
|
||||
|
||||
class AppHelper {
|
||||
AppHelper._privateConstructor();
|
||||
|
||||
static final AppHelper instance = AppHelper._privateConstructor();
|
||||
|
||||
WooSignalApp appConfig;
|
||||
}
|
||||
@ -40,9 +40,7 @@ class AppLocalizations {
|
||||
});
|
||||
}
|
||||
|
||||
String trans(String key) {
|
||||
return _localizedStrings[key];
|
||||
}
|
||||
String trans(String key) => _localizedStrings[key];
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
||||
@ -10,18 +10,20 @@
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/shared_pref/sp_user_id.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
import 'package:label_storemax/labelconfig.dart';
|
||||
import 'package:label_storemax/models/billing_details.dart';
|
||||
import 'package:label_storemax/models/cart.dart';
|
||||
import 'package:label_storemax/models/cart_line_item.dart';
|
||||
import 'package:label_storemax/models/checkout_session.dart';
|
||||
import 'package:woosignal/models/payload/order_wc.dart';
|
||||
import 'package:woosignal/models/response/tax_rate.dart';
|
||||
import 'package:woosignal/models/response/woosignal_app.dart';
|
||||
|
||||
Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
|
||||
OrderWC orderWC = OrderWC();
|
||||
WooSignalApp wooSignalApp = AppHelper.instance.appConfig;
|
||||
|
||||
String paymentMethodName = CheckoutSession.getInstance.paymentType.name ?? "";
|
||||
|
||||
@ -33,9 +35,9 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
|
||||
|
||||
orderWC.setPaid = markPaid;
|
||||
orderWC.status = "pending";
|
||||
orderWC.currency = app_currency_iso.toUpperCase();
|
||||
orderWC.currency = wooSignalApp.currencyMeta.code.toUpperCase();
|
||||
orderWC.customerId =
|
||||
(use_wp_login == true) ? int.parse(await readUserId()) : 0;
|
||||
(wooSignalApp.wpLoginEnabled == 1) ? int.parse(await readUserId()) : 0;
|
||||
|
||||
List<LineItems> lineItems = [];
|
||||
List<CartLineItem> cartItems = await Cart.getInstance.getCart();
|
||||
@ -89,7 +91,7 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
|
||||
orderWC.shipping = shipping;
|
||||
|
||||
orderWC.shippingLines = [];
|
||||
if (app_disable_shipping == false) {
|
||||
if (wooSignalApp.disableShipping != 1) {
|
||||
Map<String, dynamic> shippingLineFeeObj =
|
||||
CheckoutSession.getInstance.shippingType.toShippingLineFee();
|
||||
if (shippingLineFeeObj != null) {
|
||||
|
||||
@ -20,8 +20,7 @@ storeUserId(String v) async {
|
||||
|
||||
Future<String> readUserId() async {
|
||||
SharedPref sharedPref = SharedPref();
|
||||
String val = await sharedPref.read(keyUserId);
|
||||
return val;
|
||||
return await sharedPref.read(keyUserId);
|
||||
}
|
||||
|
||||
destroyUserId(BuildContext context) async {
|
||||
|
||||
@ -15,6 +15,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:label_storemax/app_payment_methods.dart';
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/app_localizations.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:label_storemax/labelconfig.dart';
|
||||
@ -127,7 +128,7 @@ String formatDoubleCurrency({double total}) {
|
||||
FlutterMoneyFormatter fmf = FlutterMoneyFormatter(
|
||||
amount: total,
|
||||
settings: MoneyFormatterSettings(
|
||||
symbol: app_currency_symbol,
|
||||
symbol: AppHelper.instance.appConfig.currencyMeta.symbolNative,
|
||||
),
|
||||
);
|
||||
return fmf.output.symbolOnLeft;
|
||||
@ -143,7 +144,7 @@ String formatStringCurrency({@required String total}) {
|
||||
FlutterMoneyFormatter fmf = FlutterMoneyFormatter(
|
||||
amount: tmpVal,
|
||||
settings: MoneyFormatterSettings(
|
||||
symbol: app_currency_symbol,
|
||||
symbol: AppHelper.instance.appConfig.currencyMeta.symbolNative,
|
||||
),
|
||||
);
|
||||
return fmf.output.symbolOnLeft;
|
||||
@ -159,7 +160,8 @@ String workoutSaleDiscount(
|
||||
|
||||
openBrowserTab({@required String url}) async {
|
||||
await FlutterWebBrowser.openWebPage(
|
||||
url: url, customTabsOptions: CustomTabsOptions(toolbarColor: Colors.white70));
|
||||
url: url,
|
||||
customTabsOptions: CustomTabsOptions(toolbarColor: Colors.white70));
|
||||
}
|
||||
|
||||
EdgeInsets safeAreaDefault() {
|
||||
@ -438,9 +440,7 @@ String dateFormatted({@required String date, @required String formatType}) =>
|
||||
|
||||
enum FormatType {
|
||||
DateTime,
|
||||
|
||||
Date,
|
||||
|
||||
Time,
|
||||
}
|
||||
|
||||
@ -511,8 +511,7 @@ Widget refreshableScroll(context,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
height: 200,
|
||||
child: wsCardProductItem(
|
||||
context,
|
||||
child: ProductItemContainer(
|
||||
index: (index),
|
||||
product: products[index],
|
||||
onTap: onTap,
|
||||
@ -523,7 +522,7 @@ Widget refreshableScroll(context,
|
||||
mainAxisSpacing: 4.0,
|
||||
crossAxisSpacing: 4.0,
|
||||
)
|
||||
: wsNoResults(context)),
|
||||
: NoProductResults()),
|
||||
);
|
||||
}
|
||||
|
||||
@ -554,11 +553,8 @@ Future<List<DefaultShipping>> getDefaultShipping(BuildContext context) async {
|
||||
List<DefaultShipping> shipping = [];
|
||||
|
||||
dataJson.forEach((key, value) {
|
||||
DefaultShipping defaultShipping = DefaultShipping();
|
||||
defaultShipping.code = key;
|
||||
defaultShipping.country = value['country'];
|
||||
|
||||
defaultShipping.states = [];
|
||||
DefaultShipping defaultShipping =
|
||||
DefaultShipping(code: key, country: value['country'], states: []);
|
||||
if (value['states'] != null) {
|
||||
value['states'].forEach((key1, value2) {
|
||||
defaultShipping.states
|
||||
|
||||
@ -16,7 +16,7 @@ import 'dart:ui';
|
||||
Developer Notes
|
||||
|
||||
SUPPORT EMAIL - support@woosignal.com
|
||||
VERSION - 2.6.0
|
||||
VERSION - 3.0.0
|
||||
https://woosignal.com
|
||||
*/
|
||||
|
||||
@ -29,20 +29,8 @@ const app_key = "Your app key from WooSignal";
|
||||
// Your App key from WooSignal
|
||||
// link: https://woosignal.com/dashboard/apps
|
||||
|
||||
const app_logo_url = "https://woosignal.com/images/120x120_woosignal.png";
|
||||
|
||||
const app_terms_url = "https://yourdomain.com/terms";
|
||||
const app_privacy_url = "https://yourdomain.com/privacy";
|
||||
|
||||
/*<! ------ APP SETTINGS ------!>*/
|
||||
|
||||
const app_currency_symbol = "\£";
|
||||
const app_currency_iso = "gbp";
|
||||
|
||||
const app_products_prices_include_tax = true;
|
||||
|
||||
const app_disable_shipping = false;
|
||||
|
||||
const Locale app_locale = Locale('en');
|
||||
|
||||
const List<Locale> app_locales_supported = [
|
||||
@ -57,7 +45,8 @@ const List<Locale> app_locales_supported = [
|
||||
// then create a new lang json file using keys from en.json
|
||||
// e.g. lang/es.json
|
||||
|
||||
const app_product_placeholder_image = "https://woosignal.com/images/woocommerce-placeholder.png";
|
||||
const app_product_placeholder_image =
|
||||
"https://woosignal.com/images/woocommerce-placeholder.png";
|
||||
|
||||
/*<! ------ PAYMENT GATEWAYS ------!>*/
|
||||
|
||||
@ -73,25 +62,12 @@ const app_payment_methods = ["Stripe"];
|
||||
|
||||
const app_stripe_account = "Your Stripe Key from WooSignal";
|
||||
|
||||
const app_stripe_live_mode = false;
|
||||
const app_stripe_live_mode = false; // set to true for live Stripe payments
|
||||
// For Live Payments follow the below steps
|
||||
// #1 SET the above to true for live payments
|
||||
// #2 Next visit https://woosignal.com/dashboard
|
||||
// #3 Then change "Environment for Stripe" to Live mode
|
||||
|
||||
/*<! ------ WP LOGIN (OPTIONAL) ------!>*/
|
||||
|
||||
// Allows customers to login/register, view account, purchase items as a user.
|
||||
// #1 Install the "WP JSON API" plugin on WordPress via https://woosignal.com/plugins/wordpress/wp-json-api
|
||||
// #2 Next activate the plugin on your WordPress and enable "use_wp_login = true"
|
||||
// link: https://woosignal.com/dashboard/plugins
|
||||
|
||||
const use_wp_login = false;
|
||||
const app_base_url = "https://mysite.com"; // change to your url
|
||||
const app_forgot_password_url =
|
||||
"https://mysite.com/my-account/lost-password"; // change to your forgot password url
|
||||
const app_wp_api_path = "/wp-json"; // By default "/wp-json" should work
|
||||
|
||||
/*<! ------ Razor Pay (OPTIONAL) ------!>*/
|
||||
// https://razorpay.com/
|
||||
|
||||
|
||||
@ -11,7 +11,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
import 'package:label_storemax/helpers/shared_pref.dart';
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
import 'package:label_storemax/pages/account_billing_details.dart';
|
||||
import 'package:label_storemax/pages/account_detail.dart';
|
||||
import 'package:label_storemax/pages/account_landing.dart';
|
||||
@ -21,11 +22,12 @@ import 'package:label_storemax/pages/account_register.dart';
|
||||
import 'package:label_storemax/pages/account_shipping_details.dart';
|
||||
import 'package:label_storemax/pages/customer_countries.dart';
|
||||
import 'package:label_storemax/pages/error_page.dart';
|
||||
import 'package:label_storemax/pages/no_connection_page.dart';
|
||||
import 'package:label_storemax/pages/product_image_viewer_page.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:woosignal/models/response/order.dart';
|
||||
import 'package:woosignal/models/response/product_category.dart';
|
||||
import 'package:woosignal/models/response/products.dart';
|
||||
import 'package:woosignal/models/response/woosignal_app.dart';
|
||||
import 'package:wp_json_api/wp_json_api.dart';
|
||||
import 'labelconfig.dart';
|
||||
import 'package:label_storemax/pages/checkout_details.dart';
|
||||
@ -52,18 +54,25 @@ void main() async {
|
||||
await SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
]);
|
||||
String initialRoute = '/no-connection';
|
||||
WooSignalApp wooSignalApp = await appWooSignal((api) => api.getApp());
|
||||
|
||||
String initialRoute = "/home";
|
||||
if (use_wp_login == true) {
|
||||
WPJsonAPI.instance.initWith(
|
||||
baseUrl: app_base_url,
|
||||
shouldDebug: app_debug,
|
||||
wpJsonPath: app_wp_api_path);
|
||||
if (wooSignalApp != null) {
|
||||
initialRoute = "/home";
|
||||
AppHelper.instance.appConfig = wooSignalApp;
|
||||
|
||||
if (wooSignalApp.wpLoginEnabled == 1) {
|
||||
WPJsonAPI.instance.initWith(
|
||||
baseUrl: wooSignalApp.wpLoginBaseUrl,
|
||||
shouldDebug: wooSignalApp.appDebug == 1 ? true : false,
|
||||
wpJsonPath: wooSignalApp.wpLoginWpApiPath,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
runApp(
|
||||
new MaterialApp(
|
||||
title: app_name,
|
||||
title: wooSignalApp?.appName ?? "Label StoreMax",
|
||||
color: Colors.white,
|
||||
debugShowCheckedModeBanner: false,
|
||||
initialRoute: initialRoute,
|
||||
@ -81,6 +90,7 @@ void main() async {
|
||||
new AccountBillingDetailsPage(),
|
||||
'/account-shipping-details': (BuildContext context) =>
|
||||
new AccountShippingDetailsPage(),
|
||||
'/no-connection': (BuildContext context) => new NoConnectionPage(),
|
||||
},
|
||||
onGenerateRoute: (settings) {
|
||||
switch (settings.name) {
|
||||
|
||||
@ -10,8 +10,9 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/shared_pref.dart';
|
||||
import 'package:label_storemax/labelconfig.dart';
|
||||
import 'package:label_storemax/models/cart_line_item.dart';
|
||||
import 'package:label_storemax/models/checkout_session.dart';
|
||||
import 'package:label_storemax/models/shipping_type.dart';
|
||||
@ -31,7 +32,7 @@ class Cart {
|
||||
SharedPref sharedPref = SharedPref();
|
||||
String currentCartArrJSON = (await sharedPref.read(_keyCart) as String);
|
||||
if (currentCartArrJSON == null) {
|
||||
cartLineItems = List<CartLineItem>();
|
||||
cartLineItems = [];
|
||||
} else {
|
||||
cartLineItems = (jsonDecode(currentCartArrJSON) as List<dynamic>)
|
||||
.map((i) => CartLineItem.fromJson(i))
|
||||
@ -40,7 +41,7 @@ class Cart {
|
||||
return cartLineItems;
|
||||
}
|
||||
|
||||
void addToCart({CartLineItem cartLineItem}) async {
|
||||
void addToCart({@required CartLineItem cartLineItem}) async {
|
||||
List<CartLineItem> cartLineItems = await getCart();
|
||||
|
||||
if (cartLineItem.variationId != null) {
|
||||
@ -52,7 +53,7 @@ class Cart {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
var firstCartItem = cartLineItems.firstWhere(
|
||||
CartLineItem firstCartItem = cartLineItems.firstWhere(
|
||||
(i) => i.productId == cartLineItem.productId,
|
||||
orElse: () => null);
|
||||
if (firstCartItem != null) {
|
||||
@ -64,7 +65,7 @@ class Cart {
|
||||
saveCartToPref(cartLineItems: cartLineItems);
|
||||
}
|
||||
|
||||
Future<String> getTotal({bool withFormat}) async {
|
||||
Future<String> getTotal({bool withFormat = false}) async {
|
||||
List<CartLineItem> cartLineItems = await getCart();
|
||||
double total = 0;
|
||||
cartLineItems.forEach((cartItem) {
|
||||
@ -77,7 +78,7 @@ class Cart {
|
||||
return total.toStringAsFixed(2);
|
||||
}
|
||||
|
||||
Future<String> getSubtotal({bool withFormat}) async {
|
||||
Future<String> getSubtotal({bool withFormat = false}) async {
|
||||
List<CartLineItem> cartLineItems = await getCart();
|
||||
double subtotal = 0;
|
||||
cartLineItems.forEach((cartItem) {
|
||||
@ -90,9 +91,10 @@ class Cart {
|
||||
}
|
||||
|
||||
void updateQuantity(
|
||||
{CartLineItem cartLineItem, int incrementQuantity}) async {
|
||||
{@required CartLineItem cartLineItem,
|
||||
@required int incrementQuantity}) async {
|
||||
List<CartLineItem> cartLineItems = await getCart();
|
||||
List<CartLineItem> tmpCartItem = new List<CartLineItem>();
|
||||
List<CartLineItem> tmpCartItem = [];
|
||||
cartLineItems.forEach((cartItem) {
|
||||
if (cartItem.variationId == cartLineItem.variationId &&
|
||||
cartItem.productId == cartLineItem.productId) {
|
||||
@ -107,15 +109,14 @@ class Cart {
|
||||
|
||||
Future<String> cartShortDesc() async {
|
||||
List<CartLineItem> cartLineItems = await getCart();
|
||||
var tmpShortItemDesc = [];
|
||||
cartLineItems.forEach((cartItem) {
|
||||
tmpShortItemDesc
|
||||
.add(cartItem.quantity.toString() + " x | " + cartItem.name);
|
||||
});
|
||||
return tmpShortItemDesc.join(",");
|
||||
return cartLineItems
|
||||
.map((cartItem) =>
|
||||
"${cartItem.quantity.toString()} x | ${cartItem.name}")
|
||||
.toList()
|
||||
.join(",");
|
||||
}
|
||||
|
||||
void removeCartItemForIndex({int index}) async {
|
||||
void removeCartItemForIndex({@required int index}) async {
|
||||
List<CartLineItem> cartLineItems = await getCart();
|
||||
cartLineItems.removeAt(index);
|
||||
saveCartToPref(cartLineItems: cartLineItems);
|
||||
@ -123,13 +124,13 @@ class Cart {
|
||||
|
||||
void clear() {
|
||||
SharedPref sharedPref = SharedPref();
|
||||
List<CartLineItem> cartLineItems = new List<CartLineItem>();
|
||||
List<CartLineItem> cartLineItems = [];
|
||||
String jsonArrCartItems =
|
||||
jsonEncode(cartLineItems.map((i) => i.toJson()).toList());
|
||||
sharedPref.save(_keyCart, jsonArrCartItems);
|
||||
}
|
||||
|
||||
void saveCartToPref({List<CartLineItem> cartLineItems}) {
|
||||
void saveCartToPref({@required List<CartLineItem> cartLineItems}) {
|
||||
SharedPref sharedPref = SharedPref();
|
||||
String jsonArrCartItems =
|
||||
jsonEncode(cartLineItems.map((i) => i.toJson()).toList());
|
||||
@ -149,7 +150,7 @@ class Cart {
|
||||
cartItems.where((c) => c.taxStatus == 'taxable').toList();
|
||||
double cartSubtotal = 0;
|
||||
|
||||
if (app_products_prices_include_tax == false &&
|
||||
if (AppHelper.instance.appConfig.productPricesIncludeTax == 1 &&
|
||||
taxableCartLines.length > 0) {
|
||||
cartSubtotal = taxableCartLines
|
||||
.map<double>((m) => parseWcPrice(m.subtotal) * m.quantity)
|
||||
|
||||
@ -100,7 +100,7 @@ class CheckoutSession {
|
||||
sharedPref.remove(sfKeyShippingCheckout);
|
||||
}
|
||||
|
||||
Future<String> total({bool withFormat, TaxRate taxRate}) async {
|
||||
Future<String> total({bool withFormat = false, TaxRate taxRate}) async {
|
||||
double totalCart = parseWcPrice(await Cart.getInstance.getTotal());
|
||||
double totalShipping = 0;
|
||||
if (shippingType != null && shippingType.object != null) {
|
||||
@ -126,7 +126,7 @@ class CheckoutSession {
|
||||
total += parseWcPrice(taxAmount);
|
||||
}
|
||||
|
||||
if (withFormat != null && withFormat == true) {
|
||||
if (withFormat == true) {
|
||||
return formatDoubleCurrency(total: total);
|
||||
}
|
||||
return total.toStringAsFixed(2);
|
||||
|
||||
@ -49,7 +49,7 @@ class CustomerAddress {
|
||||
: false);
|
||||
|
||||
String addressFull() {
|
||||
List<String> tmpArrAddress = new List<String>();
|
||||
List<String> tmpArrAddress = [];
|
||||
if (addressLine != null && addressLine != "") {
|
||||
tmpArrAddress.add(addressLine);
|
||||
}
|
||||
@ -70,7 +70,7 @@ class CustomerAddress {
|
||||
}
|
||||
|
||||
String nameFull() {
|
||||
List<String> tmpArrName = new List<String>();
|
||||
List<String> tmpArrName = [];
|
||||
if (firstName != "") {
|
||||
tmpArrName.add(firstName);
|
||||
}
|
||||
|
||||
@ -29,10 +29,10 @@ class CustomerCountry {
|
||||
if (json == null) {
|
||||
return;
|
||||
}
|
||||
if (json['country_code'] != null) {
|
||||
if (json['country_code'] != null) {
|
||||
countryCode = json['country_code'];
|
||||
}
|
||||
if (json['name'] != null) {
|
||||
if (json['name'] != null) {
|
||||
name = json['name'];
|
||||
}
|
||||
if (json['state'] != null) {
|
||||
@ -40,9 +40,8 @@ class CustomerCountry {
|
||||
}
|
||||
}
|
||||
|
||||
bool hasState() {
|
||||
return this.state != null && this.state.name != null ? true : false;
|
||||
}
|
||||
bool hasState() =>
|
||||
(this.state != null && this.state.name != null ? true : false);
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
|
||||
@ -8,18 +8,21 @@
|
||||
// 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/cupertino.dart';
|
||||
|
||||
class DefaultShipping {
|
||||
String code;
|
||||
String country;
|
||||
List<DefaultShippingState> states;
|
||||
DefaultShipping({this.code, this.country, this.states});
|
||||
DefaultShipping(
|
||||
{@required this.code, @required this.country, @required this.states});
|
||||
}
|
||||
|
||||
class DefaultShippingState {
|
||||
String code;
|
||||
String name;
|
||||
|
||||
DefaultShippingState({this.code, this.name});
|
||||
DefaultShippingState({@required this.code, @required this.name});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
@ -29,9 +32,6 @@ class DefaultShippingState {
|
||||
}
|
||||
|
||||
DefaultShippingState.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) {
|
||||
return;
|
||||
}
|
||||
this.code = json['code'];
|
||||
this.name = json['name'];
|
||||
}
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
// 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/cupertino.dart';
|
||||
|
||||
class PaymentType {
|
||||
int id;
|
||||
String name;
|
||||
@ -15,5 +17,10 @@ class PaymentType {
|
||||
String assetImage;
|
||||
Function pay;
|
||||
|
||||
PaymentType({this.id, this.name, this.desc, this.assetImage, this.pay});
|
||||
PaymentType(
|
||||
{@required this.id,
|
||||
@required this.name,
|
||||
@required this.desc,
|
||||
@required this.assetImage,
|
||||
@required this.pay});
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
// 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/cupertino.dart';
|
||||
import 'package:woosignal/models/response/shipping_method.dart';
|
||||
|
||||
import '../helpers/tools.dart';
|
||||
@ -18,7 +19,11 @@ class ShippingType {
|
||||
String minimumValue;
|
||||
dynamic object;
|
||||
|
||||
ShippingType({this.methodId, this.object, this.cost, this.minimumValue});
|
||||
ShippingType(
|
||||
{@required this.methodId,
|
||||
this.object,
|
||||
@required this.cost,
|
||||
@required this.minimumValue});
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'methodId': methodId,
|
||||
@ -27,8 +32,8 @@ class ShippingType {
|
||||
'minimumValue': minimumValue
|
||||
};
|
||||
|
||||
String getTotal({bool withFormatting}) {
|
||||
if (this.methodId != null && this.object != null) {
|
||||
String getTotal({bool withFormatting = false}) {
|
||||
if (this.object != null) {
|
||||
switch (this.methodId) {
|
||||
case "flat_rate":
|
||||
FlatRate flatRate = (this.object as FlatRate);
|
||||
@ -47,14 +52,13 @@ class ShippingType {
|
||||
: localPickup.cost);
|
||||
default:
|
||||
return "0";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
String getTitle() {
|
||||
if (this.methodId != null && this.object != null) {
|
||||
if (this.object != null) {
|
||||
switch (this.methodId) {
|
||||
case "flat_rate":
|
||||
FlatRate flatRate = (this.object as FlatRate);
|
||||
@ -67,14 +71,13 @@ class ShippingType {
|
||||
return localPickup.title;
|
||||
default:
|
||||
return "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
Map<String, dynamic> toShippingLineFee() {
|
||||
if (this.methodId != null && this.object != null) {
|
||||
if (this.object != null) {
|
||||
Map<String, dynamic> tmpShippingLinesObj = {};
|
||||
|
||||
switch (this.methodId) {
|
||||
@ -98,7 +101,6 @@ class ShippingType {
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
}
|
||||
return tmpShippingLinesObj;
|
||||
}
|
||||
|
||||
@ -9,11 +9,12 @@
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
import 'package:label_storemax/labelconfig.dart';
|
||||
import 'package:label_storemax/widgets/menu_item.dart';
|
||||
import 'package:label_storemax/widgets/woosignal_ui.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:woosignal/models/response/woosignal_app.dart';
|
||||
|
||||
class AboutPage extends StatefulWidget {
|
||||
AboutPage();
|
||||
@ -25,9 +26,12 @@ class AboutPage extends StatefulWidget {
|
||||
class _AboutPageState extends State<AboutPage> {
|
||||
_AboutPageState();
|
||||
|
||||
WooSignalApp _wooSignalApp;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_wooSignalApp = AppHelper.instance.appConfig;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -48,11 +52,11 @@ class _AboutPageState extends State<AboutPage> {
|
||||
body: SafeArea(
|
||||
minimum: safeAreaDefault(),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: storeLogo(),
|
||||
Expanded(
|
||||
child: Center(child: StoreLogo()),
|
||||
flex: 2,
|
||||
),
|
||||
Flexible(
|
||||
@ -60,14 +64,12 @@ class _AboutPageState extends State<AboutPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
wsMenuItem(
|
||||
context,
|
||||
MenuItem(
|
||||
title: trans(context, "Privacy policy"),
|
||||
leading: Icon(Icons.people),
|
||||
action: _actionPrivacy,
|
||||
),
|
||||
wsMenuItem(
|
||||
context,
|
||||
MenuItem(
|
||||
title: trans(context, "Terms and conditions"),
|
||||
leading: Icon(Icons.description),
|
||||
action: _actionTerms,
|
||||
@ -106,11 +108,7 @@ class _AboutPageState extends State<AboutPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void _actionTerms() {
|
||||
openBrowserTab(url: app_terms_url);
|
||||
}
|
||||
void _actionTerms() => openBrowserTab(url: _wooSignalApp.appTermslink);
|
||||
|
||||
void _actionPrivacy() {
|
||||
openBrowserTab(url: app_privacy_url);
|
||||
}
|
||||
void _actionPrivacy() => openBrowserTab(url: _wooSignalApp.appPrivacylink);
|
||||
}
|
||||
|
||||
@ -32,31 +32,19 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
|
||||
_AccountBillingDetailsPageState();
|
||||
|
||||
// BILLING TEXT CONTROLLERS
|
||||
TextEditingController _txtShippingFirstName;
|
||||
TextEditingController _txtShippingLastName;
|
||||
TextEditingController _txtShippingAddressLine;
|
||||
TextEditingController _txtShippingCity;
|
||||
TextEditingController _txtShippingState;
|
||||
TextEditingController _txtShippingPostalCode;
|
||||
TextEditingController _txtShippingCountry;
|
||||
TextEditingController _txtShippingFirstName = TextEditingController();
|
||||
TextEditingController _txtShippingLastName = TextEditingController();
|
||||
TextEditingController _txtShippingAddressLine = TextEditingController();
|
||||
TextEditingController _txtShippingCity = TextEditingController();
|
||||
TextEditingController _txtShippingState = TextEditingController();
|
||||
TextEditingController _txtShippingPostalCode = TextEditingController();
|
||||
TextEditingController _txtShippingCountry = TextEditingController();
|
||||
|
||||
bool _isLoading, _isUpdating;
|
||||
bool _isLoading = true, _isUpdating = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_txtShippingFirstName = TextEditingController();
|
||||
_txtShippingLastName = TextEditingController();
|
||||
_txtShippingAddressLine = TextEditingController();
|
||||
_txtShippingCity = TextEditingController();
|
||||
_txtShippingState = TextEditingController();
|
||||
_txtShippingPostalCode = TextEditingController();
|
||||
_txtShippingCountry = TextEditingController();
|
||||
|
||||
_isLoading = true;
|
||||
_isUpdating = false;
|
||||
|
||||
_fetchUserDetails();
|
||||
}
|
||||
|
||||
@ -84,7 +72,7 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
title: Text(
|
||||
@ -113,16 +101,14 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "First Name"),
|
||||
controller: _txtShippingFirstName,
|
||||
shouldAutoFocus: true,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Last Name"),
|
||||
controller: _txtShippingLastName,
|
||||
),
|
||||
@ -132,21 +118,19 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
),
|
||||
wsTextEditingRow(
|
||||
context,
|
||||
TextEditingRow(
|
||||
heading: trans(context, "Address Line"),
|
||||
controller: _txtShippingAddressLine,
|
||||
),
|
||||
Row(children: <Widget>[
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "City"),
|
||||
controller: _txtShippingCity,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: wsTextEditingRow(context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "State"),
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
controller: _txtShippingState),
|
||||
@ -155,14 +139,13 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Postal code"),
|
||||
controller: _txtShippingPostalCode,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: wsTextEditingRow(context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Country"),
|
||||
keyboardType:
|
||||
TextInputType.emailAddress,
|
||||
@ -198,10 +181,10 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
wsPrimaryButton(context,
|
||||
PrimaryButton(
|
||||
title: trans(context, "UPDATE DETAILS"),
|
||||
action:
|
||||
_isUpdating ? null : _updateBillingDetails),
|
||||
_isUpdating ? () {} : _updateBillingDetails),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@ -32,12 +32,14 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
||||
RefreshController _refreshController =
|
||||
RefreshController(initialRefresh: false);
|
||||
|
||||
bool _shouldStopRequests, waitForNextRequest, _isLoading, _isLoadingOrders;
|
||||
bool _shouldStopRequests = false,
|
||||
waitForNextRequest = false,
|
||||
_isLoading = true,
|
||||
_isLoadingOrders = true;
|
||||
|
||||
int _page;
|
||||
List<Order> _orders;
|
||||
int _page = 1, _currentTabIndex = 0;
|
||||
List<Order> _orders = [];
|
||||
WCCustomerInfoResponse _wcCustomerInfoResponse;
|
||||
int _currentTabIndex = 0;
|
||||
Widget _activeBody;
|
||||
|
||||
TabController _tabController;
|
||||
@ -46,11 +48,6 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_shouldStopRequests = false;
|
||||
waitForNextRequest = false;
|
||||
|
||||
_isLoading = true;
|
||||
_isLoadingOrders = true;
|
||||
_page = 1;
|
||||
_orders = [];
|
||||
_tabs = [
|
||||
@ -117,7 +114,7 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: SafeArea(
|
||||
minimum: safeAreaDefault(),
|
||||
child: _isLoading
|
||||
@ -337,7 +334,7 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
||||
controller: _refreshController,
|
||||
onRefresh: _onRefresh,
|
||||
onLoading: _onLoading,
|
||||
child: (_orders.length != null && _orders.length > 0
|
||||
child: (_orders.length > 0
|
||||
? ListView.builder(
|
||||
itemBuilder: (cxt, i) {
|
||||
return Card(
|
||||
@ -482,12 +479,9 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
||||
}
|
||||
}
|
||||
|
||||
_viewProfileDetail(int i) {
|
||||
int orderId = _orders[i].id;
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
"/account-order-detail",
|
||||
arguments: orderId,
|
||||
);
|
||||
}
|
||||
_viewProfileDetail(int i) => Navigator.pushNamed(
|
||||
context,
|
||||
"/account-order-detail",
|
||||
arguments: _orders[i].id,
|
||||
);
|
||||
}
|
||||
|
||||
@ -10,10 +10,10 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/shared_pref/sp_auth.dart';
|
||||
import 'package:label_storemax/helpers/shared_pref/sp_user_id.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
import 'package:label_storemax/labelconfig.dart';
|
||||
import 'package:label_storemax/widgets/buttons.dart';
|
||||
import 'package:label_storemax/widgets/woosignal_ui.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@ -32,23 +32,20 @@ class AccountLandingPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AccountLandingPageState extends State<AccountLandingPage> {
|
||||
bool _hasTappedLogin;
|
||||
TextEditingController _tfEmailController, _tfPasswordController;
|
||||
bool _hasTappedLogin = false;
|
||||
TextEditingController _tfEmailController = TextEditingController(),
|
||||
_tfPasswordController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_hasTappedLogin = false;
|
||||
_tfEmailController = TextEditingController();
|
||||
_tfPasswordController = TextEditingController();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
@ -59,7 +56,7 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
storeLogo(height: 100),
|
||||
StoreLogo(height: 100),
|
||||
Flexible(
|
||||
child: Container(
|
||||
height: 70,
|
||||
@ -91,19 +88,18 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
wsTextEditingRow(context,
|
||||
TextEditingRow(
|
||||
heading: trans(context, "Email"),
|
||||
controller: _tfEmailController,
|
||||
keyboardType: TextInputType.emailAddress),
|
||||
wsTextEditingRow(context,
|
||||
TextEditingRow(
|
||||
heading: trans(context, "Password"),
|
||||
controller: _tfPasswordController,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
obscureText: true),
|
||||
wsPrimaryButton(
|
||||
context,
|
||||
PrimaryButton(
|
||||
title: trans(context, "Login"),
|
||||
action: _hasTappedLogin == true ? null : _loginUser,
|
||||
action: _hasTappedLogin == true ? () {} : _loginUser,
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -111,7 +107,7 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
FlatButton(
|
||||
TextButton(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -133,12 +129,15 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
|
||||
Navigator.pushNamed(context, "/account-register");
|
||||
},
|
||||
),
|
||||
wsLinkButton(context, title: trans(context, "Forgot Password"),
|
||||
LinkButton(
|
||||
title: trans(context, "Forgot Password"),
|
||||
action: () {
|
||||
launch(app_forgot_password_url);
|
||||
}),
|
||||
String forgotPasswordUrl =
|
||||
AppHelper.instance.appConfig.wpLoginForgotPasswordUrl;
|
||||
launch(forgotPasswordUrl);
|
||||
}),
|
||||
Divider(),
|
||||
wsLinkButton(context,
|
||||
LinkButton(
|
||||
title: trans(context, "Back"),
|
||||
action: () => Navigator.pop(context)),
|
||||
],
|
||||
@ -151,7 +150,7 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
|
||||
String email = _tfEmailController.text;
|
||||
String password = _tfPasswordController.text;
|
||||
|
||||
if (email != null) {
|
||||
if (email.isNotEmpty) {
|
||||
email = email.trim();
|
||||
}
|
||||
|
||||
|
||||
@ -19,24 +19,21 @@ import 'package:woosignal/models/response/order.dart';
|
||||
class AccountOrderDetailPage extends StatefulWidget {
|
||||
final int orderId;
|
||||
|
||||
AccountOrderDetailPage({Key key, this.orderId}) : super(key: key);
|
||||
AccountOrderDetailPage({Key key, @required this.orderId}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AccountOrderDetailPageState createState() =>
|
||||
_AccountOrderDetailPageState(this.orderId);
|
||||
_AccountOrderDetailPageState createState() => _AccountOrderDetailPageState();
|
||||
}
|
||||
|
||||
class _AccountOrderDetailPageState extends State<AccountOrderDetailPage> {
|
||||
_AccountOrderDetailPageState(this._orderId);
|
||||
_AccountOrderDetailPageState();
|
||||
|
||||
int _orderId;
|
||||
Order _order;
|
||||
bool _isLoading;
|
||||
bool _isLoading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_isLoading = true;
|
||||
_fetchOrder();
|
||||
}
|
||||
|
||||
@ -53,12 +50,12 @@ class _AccountOrderDetailPageState extends State<AccountOrderDetailPage> {
|
||||
margin: EdgeInsets.only(left: 0),
|
||||
),
|
||||
title: Text(
|
||||
"${capitalize(trans(context, "Order"))} #${_orderId.toString()}",
|
||||
"${capitalize(trans(context, "Order"))} #${widget.orderId.toString()}",
|
||||
style: Theme.of(context).primaryTextTheme.headline6,
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: SafeArea(
|
||||
minimum: safeAreaDefault(),
|
||||
child: _isLoading
|
||||
@ -173,9 +170,7 @@ class _AccountOrderDetailPageState extends State<AccountOrderDetailPage> {
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
"x" +
|
||||
_order.lineItems[i].quantity
|
||||
.toString(),
|
||||
"x${_order.lineItems[i].quantity.toString()}",
|
||||
style: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.bodyText1
|
||||
@ -209,7 +204,7 @@ class _AccountOrderDetailPageState extends State<AccountOrderDetailPage> {
|
||||
|
||||
_fetchOrder() async {
|
||||
_order = await appWooSignal((api) {
|
||||
return api.retrieveOrder(_orderId);
|
||||
return api.retrieveOrder(widget.orderId);
|
||||
});
|
||||
if (_order != null) {
|
||||
setState(() {
|
||||
|
||||
@ -30,8 +30,9 @@ class AccountProfileUpdatePage extends StatefulWidget {
|
||||
class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
|
||||
_AccountProfileUpdatePageState();
|
||||
|
||||
bool isLoading;
|
||||
TextEditingController _tfFirstName, _tfLastName;
|
||||
bool isLoading = true;
|
||||
TextEditingController _tfFirstName = TextEditingController(),
|
||||
_tfLastName = TextEditingController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@ -41,11 +42,6 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
isLoading = true;
|
||||
_tfFirstName = TextEditingController();
|
||||
_tfLastName = TextEditingController();
|
||||
|
||||
_fetchUserDetails();
|
||||
}
|
||||
|
||||
@ -91,16 +87,14 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "First Name"),
|
||||
controller: _tfFirstName,
|
||||
keyboardType: TextInputType.text,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Last Name"),
|
||||
controller: _tfLastName,
|
||||
keyboardType: TextInputType.text,
|
||||
@ -115,7 +109,7 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
),
|
||||
wsPrimaryButton(context,
|
||||
PrimaryButton(
|
||||
title: trans(context, "Update details"),
|
||||
action: _updateDetails)
|
||||
],
|
||||
|
||||
@ -9,13 +9,14 @@
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/shared_pref/sp_auth.dart';
|
||||
import 'package:label_storemax/helpers/shared_pref/sp_user_id.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
import 'package:label_storemax/labelconfig.dart';
|
||||
import 'package:label_storemax/widgets/buttons.dart';
|
||||
import 'package:label_storemax/widgets/woosignal_ui.dart';
|
||||
import 'package:woosignal/helpers/shared_pref.dart';
|
||||
import 'package:woosignal/models/response/woosignal_app.dart';
|
||||
import 'package:wp_json_api/exceptions/empty_username_exception.dart';
|
||||
import 'package:wp_json_api/exceptions/existing_user_email_exception.dart';
|
||||
import 'package:wp_json_api/exceptions/existing_user_login_exception.dart';
|
||||
@ -36,21 +37,16 @@ class AccountRegistrationPage extends StatefulWidget {
|
||||
class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
|
||||
_AccountRegistrationPageState();
|
||||
|
||||
bool _hasTappedRegister;
|
||||
TextEditingController _tfEmailAddressController;
|
||||
TextEditingController _tfPasswordController;
|
||||
TextEditingController _tfFirstNameController;
|
||||
TextEditingController _tfLastNameController;
|
||||
bool _hasTappedRegister = false;
|
||||
TextEditingController _tfEmailAddressController = TextEditingController();
|
||||
TextEditingController _tfPasswordController = TextEditingController();
|
||||
TextEditingController _tfFirstNameController = TextEditingController();
|
||||
TextEditingController _tfLastNameController = TextEditingController();
|
||||
WooSignalApp _wooSignalApp = AppHelper.instance.appConfig;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_hasTappedRegister = false;
|
||||
_tfEmailAddressController = TextEditingController();
|
||||
_tfPasswordController = TextEditingController();
|
||||
_tfFirstNameController = TextEditingController();
|
||||
_tfLastNameController = TextEditingController();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -68,7 +64,7 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: SafeArea(
|
||||
minimum: safeAreaDefault(),
|
||||
child: Column(
|
||||
@ -78,8 +74,7 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "First Name"),
|
||||
controller: _tfFirstNameController,
|
||||
shouldAutoFocus: true,
|
||||
@ -87,8 +82,7 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Last Name"),
|
||||
controller: _tfLastNameController,
|
||||
shouldAutoFocus: false,
|
||||
@ -97,24 +91,22 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
|
||||
),
|
||||
],
|
||||
)),
|
||||
wsTextEditingRow(
|
||||
context,
|
||||
TextEditingRow(
|
||||
heading: trans(context, "Email address"),
|
||||
controller: _tfEmailAddressController,
|
||||
shouldAutoFocus: false,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
),
|
||||
wsTextEditingRow(
|
||||
context,
|
||||
TextEditingRow(
|
||||
heading: trans(context, "Password"),
|
||||
controller: _tfPasswordController,
|
||||
shouldAutoFocus: true,
|
||||
obscureText: true,
|
||||
),
|
||||
Padding(
|
||||
child: wsPrimaryButton(context,
|
||||
child: PrimaryButton(
|
||||
title: trans(context, "Sign up"),
|
||||
action: _hasTappedRegister ? null : _signUpTapped),
|
||||
action: _hasTappedRegister ? () {} : _signUpTapped),
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
),
|
||||
Padding(
|
||||
@ -123,7 +115,7 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
|
||||
text: TextSpan(
|
||||
text: trans(
|
||||
context, "By tapping \"Register\" you agree to ") +
|
||||
app_name +
|
||||
AppHelper.instance.appConfig.appName +
|
||||
'\'s ',
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
@ -154,7 +146,7 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
|
||||
String firstName = _tfFirstNameController.text;
|
||||
String lastName = _tfLastNameController.text;
|
||||
|
||||
if (email != null) {
|
||||
if (email.isNotEmpty) {
|
||||
email = email.trim();
|
||||
}
|
||||
|
||||
@ -180,7 +172,7 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
|
||||
});
|
||||
|
||||
String username =
|
||||
(email.replaceAll(new RegExp(r'(@|\.)'), "")) + randomStr(4);
|
||||
(email.replaceAll(new RegExp(r'([@.])'), "")) + randomStr(4);
|
||||
|
||||
WPUserRegisterResponse wpUserRegisterResponse;
|
||||
try {
|
||||
@ -243,7 +235,7 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
|
||||
.wpUpdateUserInfo(token, firstName: firstName, lastName: lastName));
|
||||
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Hello") + " $firstName",
|
||||
title: "${trans(context, "Hello")} $firstName",
|
||||
desc: trans(context, "you're now logged in"),
|
||||
style: EdgeAlertStyle.SUCCESS,
|
||||
icon: Icons.account_circle);
|
||||
@ -254,26 +246,28 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
|
||||
}
|
||||
|
||||
_viewTOSModal() {
|
||||
showPlatformAlertDialog(context,
|
||||
title: trans(context, "Actions"),
|
||||
subtitle: trans(context, "View Terms and Conditions or Privacy policy"),
|
||||
actions: [
|
||||
dialogAction(context,
|
||||
title: trans(context, "Terms and Conditions"),
|
||||
action: _viewTermsConditions),
|
||||
dialogAction(context,
|
||||
title: trans(context, "Privacy Policy"),
|
||||
action: _viewPrivacyPolicy),
|
||||
]);
|
||||
showPlatformAlertDialog(
|
||||
context,
|
||||
title: trans(context, "Actions"),
|
||||
subtitle: trans(context, "View Terms and Conditions or Privacy policy"),
|
||||
actions: [
|
||||
dialogAction(context,
|
||||
title: trans(context, "Terms and Conditions"),
|
||||
action: _viewTermsConditions),
|
||||
dialogAction(context,
|
||||
title: trans(context, "Privacy Policy"),
|
||||
action: _viewPrivacyPolicy),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _viewTermsConditions() {
|
||||
Navigator.pop(context);
|
||||
openBrowserTab(url: app_terms_url);
|
||||
openBrowserTab(url: _wooSignalApp.appTermslink);
|
||||
}
|
||||
|
||||
void _viewPrivacyPolicy() {
|
||||
Navigator.pop(context);
|
||||
openBrowserTab(url: app_privacy_url);
|
||||
openBrowserTab(url: _wooSignalApp.appPrivacylink);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,31 +33,19 @@ class _AccountShippingDetailsPageState
|
||||
_AccountShippingDetailsPageState();
|
||||
|
||||
// BILLING TEXT CONTROLLERS
|
||||
TextEditingController _txtShippingFirstName;
|
||||
TextEditingController _txtShippingLastName;
|
||||
TextEditingController _txtShippingAddressLine;
|
||||
TextEditingController _txtShippingCity;
|
||||
TextEditingController _txtShippingPostalCode;
|
||||
TextEditingController _txtShippingState;
|
||||
TextEditingController _txtShippingCountry;
|
||||
TextEditingController _txtShippingFirstName = TextEditingController();
|
||||
TextEditingController _txtShippingLastName = TextEditingController();
|
||||
TextEditingController _txtShippingAddressLine = TextEditingController();
|
||||
TextEditingController _txtShippingCity = TextEditingController();
|
||||
TextEditingController _txtShippingPostalCode = TextEditingController();
|
||||
TextEditingController _txtShippingState = TextEditingController();
|
||||
TextEditingController _txtShippingCountry = TextEditingController();
|
||||
|
||||
bool _isLoading, _isUpdating;
|
||||
bool _isLoading = true, _isUpdating = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_txtShippingFirstName = TextEditingController();
|
||||
_txtShippingLastName = TextEditingController();
|
||||
_txtShippingAddressLine = TextEditingController();
|
||||
_txtShippingCity = TextEditingController();
|
||||
_txtShippingPostalCode = TextEditingController();
|
||||
_txtShippingState = TextEditingController();
|
||||
_txtShippingCountry = TextEditingController();
|
||||
|
||||
_isLoading = true;
|
||||
_isUpdating = false;
|
||||
|
||||
_fetchUserDetails();
|
||||
}
|
||||
|
||||
@ -100,7 +88,7 @@ class _AccountShippingDetailsPageState
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
title: Text(
|
||||
@ -131,16 +119,14 @@ class _AccountShippingDetailsPageState
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "First Name"),
|
||||
controller: _txtShippingFirstName,
|
||||
shouldAutoFocus: true,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Last Name"),
|
||||
controller: _txtShippingLastName,
|
||||
),
|
||||
@ -150,22 +136,19 @@ class _AccountShippingDetailsPageState
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
),
|
||||
wsTextEditingRow(
|
||||
context,
|
||||
TextEditingRow(
|
||||
heading: trans(context, "Address Line"),
|
||||
controller: _txtShippingAddressLine,
|
||||
),
|
||||
Row(children: <Widget>[
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "City"),
|
||||
controller: _txtShippingCity,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "State"),
|
||||
controller: _txtShippingState,
|
||||
),
|
||||
@ -174,15 +157,13 @@ class _AccountShippingDetailsPageState
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Postal code"),
|
||||
controller: _txtShippingPostalCode,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Country"),
|
||||
controller: _txtShippingCountry,
|
||||
),
|
||||
@ -218,10 +199,10 @@ class _AccountShippingDetailsPageState
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
wsPrimaryButton(context,
|
||||
PrimaryButton(
|
||||
title: trans(context, "UPDATE DETAILS"),
|
||||
action:
|
||||
_isUpdating ? null : _updateShippingDetails),
|
||||
_isUpdating ? () {} : _updateShippingDetails),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@ -25,42 +25,38 @@ class BrowseCategoryPage extends StatefulWidget {
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_BrowseCategoryPageState createState() =>
|
||||
_BrowseCategoryPageState(productCategory);
|
||||
_BrowseCategoryPageState createState() => _BrowseCategoryPageState();
|
||||
}
|
||||
|
||||
class _BrowseCategoryPageState extends State<BrowseCategoryPage> {
|
||||
_BrowseCategoryPageState(this._selectedCategory);
|
||||
_BrowseCategoryPageState();
|
||||
|
||||
List<WS.Product> _products = [];
|
||||
|
||||
RefreshController _refreshController =
|
||||
RefreshController(initialRefresh: false);
|
||||
ProductCategory _selectedCategory;
|
||||
|
||||
int _page;
|
||||
bool _shouldStopRequests, waitForNextRequest, _isLoading;
|
||||
int _page = 1;
|
||||
bool _shouldStopRequests = false,
|
||||
waitForNextRequest = false,
|
||||
_isLoading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_isLoading = true;
|
||||
|
||||
_page = 1;
|
||||
_shouldStopRequests = false;
|
||||
waitForNextRequest = false;
|
||||
_fetchMoreProducts();
|
||||
}
|
||||
|
||||
_fetchMoreProducts() async {
|
||||
waitForNextRequest = true;
|
||||
List<WS.Product> products = await appWooSignal((api) => api.getProducts(
|
||||
perPage: 50,
|
||||
category: _selectedCategory.id.toString(),
|
||||
page: _page,
|
||||
status: "publish",
|
||||
stockStatus: "instock"));
|
||||
List<WS.Product> products = await appWooSignal(
|
||||
(api) => api.getProducts(
|
||||
perPage: 50,
|
||||
category: widget.productCategory.id.toString(),
|
||||
page: _page,
|
||||
status: "publish",
|
||||
stockStatus: "instock"),
|
||||
);
|
||||
_products.addAll(products);
|
||||
waitForNextRequest = false;
|
||||
_page = _page + 1;
|
||||
@ -90,7 +86,7 @@ class _BrowseCategoryPageState extends State<BrowseCategoryPage> {
|
||||
children: <Widget>[
|
||||
Text(trans(context, "Browse"),
|
||||
style: Theme.of(context).primaryTextTheme.subtitle1),
|
||||
Text(parseHtmlString(_selectedCategory.name),
|
||||
Text(parseHtmlString(widget.productCategory.name),
|
||||
style: Theme.of(context).primaryTextTheme.headline6)
|
||||
],
|
||||
),
|
||||
@ -176,32 +172,31 @@ class _BrowseCategoryPageState extends State<BrowseCategoryPage> {
|
||||
title: trans(context, "Sort results"),
|
||||
bodyWidget: ListView(
|
||||
children: <Widget>[
|
||||
wsLinkButton(context,
|
||||
LinkButton(
|
||||
title: trans(context, "Sort: Low to high"),
|
||||
action: () => _sortProducts(by: SortByType.LowToHigh)),
|
||||
Divider(
|
||||
height: 0,
|
||||
),
|
||||
wsLinkButton(context,
|
||||
LinkButton(
|
||||
title: trans(context, "Sort: High to low"),
|
||||
action: () => _sortProducts(by: SortByType.HighToLow)),
|
||||
Divider(
|
||||
height: 0,
|
||||
),
|
||||
wsLinkButton(context,
|
||||
LinkButton(
|
||||
title: trans(context, "Sort: Name A-Z"),
|
||||
action: () => _sortProducts(by: SortByType.NameAZ)),
|
||||
Divider(
|
||||
height: 0,
|
||||
),
|
||||
wsLinkButton(context,
|
||||
LinkButton(
|
||||
title: trans(context, "Sort: Name Z-A"),
|
||||
action: () => _sortProducts(by: SortByType.NameZA)),
|
||||
Divider(
|
||||
height: 0,
|
||||
),
|
||||
wsLinkButton(context,
|
||||
title: trans(context, "Cancel"), action: _dismissModal)
|
||||
LinkButton(title: trans(context, "Cancel"), action: _dismissModal)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -30,18 +30,14 @@ class _BrowseSearchState extends State<BrowseSearchPage> {
|
||||
|
||||
List<WS.Product> _products = [];
|
||||
String _search;
|
||||
int _page;
|
||||
bool _shouldStopRequests, waitForNextRequest, _isLoading;
|
||||
int _page = 1;
|
||||
bool _shouldStopRequests = false,
|
||||
waitForNextRequest = false,
|
||||
_isLoading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_isLoading = true;
|
||||
_page = 1;
|
||||
_shouldStopRequests = false;
|
||||
waitForNextRequest = false;
|
||||
|
||||
_fetchProductsForSearch();
|
||||
}
|
||||
|
||||
@ -49,11 +45,12 @@ class _BrowseSearchState extends State<BrowseSearchPage> {
|
||||
waitForNextRequest = true;
|
||||
List<WS.Product> products = await appWooSignal(
|
||||
(api) => api.getProducts(
|
||||
perPage: 100,
|
||||
search: _search,
|
||||
page: _page,
|
||||
status: "publish",
|
||||
stockStatus: "instock"),
|
||||
perPage: 100,
|
||||
search: _search,
|
||||
page: _page,
|
||||
status: "publish",
|
||||
stockStatus: "instock",
|
||||
),
|
||||
);
|
||||
_products.addAll(products);
|
||||
waitForNextRequest = false;
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/shared_pref/sp_auth.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
import 'package:label_storemax/labelconfig.dart';
|
||||
import 'package:label_storemax/models/cart.dart';
|
||||
import 'package:label_storemax/models/cart_line_item.dart';
|
||||
import 'package:label_storemax/models/checkout_session.dart';
|
||||
@ -31,15 +31,12 @@ class CartPage extends StatefulWidget {
|
||||
class _CartPageState extends State<CartPage> {
|
||||
_CartPageState();
|
||||
|
||||
bool _isLoading = false;
|
||||
bool _isCartEmpty = false;
|
||||
List<CartLineItem> _cartLines;
|
||||
bool _isLoading = true, _isCartEmpty = false;
|
||||
List<CartLineItem> _cartLines = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_cartLines = [];
|
||||
_isLoading = true;
|
||||
_cartCheck();
|
||||
}
|
||||
|
||||
@ -115,7 +112,8 @@ class _CartPageState extends State<CartPage> {
|
||||
sfCustomerAddress;
|
||||
}
|
||||
|
||||
if (use_wp_login == true && !(await authCheck())) {
|
||||
if (AppHelper.instance.appConfig.wpLoginEnabled == 1 &&
|
||||
!(await authCheck())) {
|
||||
UserAuth.instance.redirect = "/checkout";
|
||||
Navigator.pushNamed(context, "/account-landing");
|
||||
return;
|
||||
@ -183,7 +181,7 @@ class _CartPageState extends State<CartPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
trans(context, "Shopping Cart"),
|
||||
@ -252,8 +250,7 @@ class _CartPageState extends State<CartPage> {
|
||||
itemCount: _cartLines.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
CartLineItem cartLineItem = _cartLines[index];
|
||||
return wsCardCartItem(
|
||||
context,
|
||||
return CartItemContainer(
|
||||
cartLineItem: cartLineItem,
|
||||
actionIncrementQuantity: () =>
|
||||
actionIncrementQuantity(
|
||||
@ -291,8 +288,7 @@ class _CartPageState extends State<CartPage> {
|
||||
}
|
||||
},
|
||||
),
|
||||
wsPrimaryButton(
|
||||
context,
|
||||
PrimaryButton(
|
||||
title: trans(context, "PROCEED TO CHECKOUT"),
|
||||
action: _actionProceedToCheckout,
|
||||
),
|
||||
|
||||
@ -10,8 +10,8 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:label_storemax/app_payment_methods.dart';
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
import 'package:label_storemax/labelconfig.dart';
|
||||
import 'package:label_storemax/models/cart.dart';
|
||||
import 'package:label_storemax/models/checkout_session.dart';
|
||||
import 'package:label_storemax/models/customer_address.dart';
|
||||
@ -20,6 +20,7 @@ import 'package:label_storemax/widgets/app_loader.dart';
|
||||
import 'package:label_storemax/widgets/buttons.dart';
|
||||
import 'package:label_storemax/widgets/woosignal_ui.dart';
|
||||
import 'package:woosignal/models/response/tax_rate.dart';
|
||||
import 'package:woosignal/models/response/woosignal_app.dart';
|
||||
|
||||
class CheckoutConfirmationPage extends StatefulWidget {
|
||||
CheckoutConfirmationPage({Key key}) : super(key: key);
|
||||
@ -32,17 +33,18 @@ class CheckoutConfirmationPage extends StatefulWidget {
|
||||
class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
||||
CheckoutConfirmationPageState();
|
||||
|
||||
bool _showFullLoader, _isProcessingPayment;
|
||||
bool _showFullLoader = true, _isProcessingPayment = false;
|
||||
|
||||
List<TaxRate> _taxRates;
|
||||
TaxRate _taxRate;
|
||||
WooSignalApp _wooSignalApp;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_wooSignalApp = AppHelper.instance.appConfig;
|
||||
_taxRates = [];
|
||||
_showFullLoader = true;
|
||||
_isProcessingPayment = false;
|
||||
|
||||
if (CheckoutSession.getInstance.paymentType == null) {
|
||||
CheckoutSession.getInstance.paymentType = arrPaymentMethods.first;
|
||||
}
|
||||
@ -100,29 +102,26 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
||||
|
||||
TaxRate taxRate;
|
||||
if (shippingCountry.hasState()) {
|
||||
taxRate = _taxRates.firstWhere(
|
||||
(t) {
|
||||
if (shippingCountry == null ||
|
||||
(shippingCountry?.state?.code ?? "") == "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
taxRate = _taxRates.firstWhere((t) {
|
||||
if (shippingCountry == null ||
|
||||
(shippingCountry?.state?.code ?? "") == "") {
|
||||
return false;
|
||||
},
|
||||
orElse: () => null,
|
||||
);
|
||||
}
|
||||
|
||||
List<String> stateElements = shippingCountry.state.code.split(":");
|
||||
String state = stateElements.last;
|
||||
|
||||
if (t.country == shippingCountry.countryCode &&
|
||||
t.state == state &&
|
||||
t.postcode == postalCode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t.country == shippingCountry.countryCode && t.state == state) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, orElse: () => null);
|
||||
}
|
||||
|
||||
if (taxRate == null) {
|
||||
@ -183,10 +182,10 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
title: storeLogo(height: 50),
|
||||
title: StoreLogo(height: 50),
|
||||
centerTitle: true,
|
||||
),
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: SafeArea(
|
||||
minimum: safeAreaDefault(),
|
||||
child: !_showFullLoader
|
||||
@ -260,7 +259,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
||||
context, "Select a payment method"),
|
||||
action: _actionPayWith,
|
||||
showBorderBottom: true)),
|
||||
app_disable_shipping == true
|
||||
_wooSignalApp.disableShipping == 1
|
||||
? null
|
||||
: (CheckoutSession.getInstance.shippingType !=
|
||||
null
|
||||
@ -295,7 +294,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
||||
wsCheckoutSubtotalWidgetFB(
|
||||
title: trans(context, "Subtotal"),
|
||||
),
|
||||
app_disable_shipping == true
|
||||
_wooSignalApp.disableShipping == 1
|
||||
? null
|
||||
: widgetCheckoutMeta(context,
|
||||
title: trans(context, "Shipping fee"),
|
||||
@ -316,8 +315,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
||||
),
|
||||
].where((e) => e != null).toList(),
|
||||
),
|
||||
wsPrimaryButton(
|
||||
context,
|
||||
PrimaryButton(
|
||||
title: _isProcessingPayment
|
||||
? "PROCESSING..."
|
||||
: trans(context, "CHECKOUT"),
|
||||
@ -369,7 +367,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (app_disable_shipping == false &&
|
||||
if (_wooSignalApp.disableShipping == 1 &&
|
||||
CheckoutSession.getInstance.shippingType == null) {
|
||||
showEdgeAlertWith(
|
||||
context,
|
||||
@ -392,7 +390,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (app_disable_shipping == false &&
|
||||
if (_wooSignalApp.disableShipping != 1 &&
|
||||
CheckoutSession.getInstance.shippingType.minimumValue != null) {
|
||||
String total = await Cart.getInstance.getTotal();
|
||||
if (total == null) {
|
||||
@ -413,6 +411,17 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
|
||||
}
|
||||
}
|
||||
|
||||
bool appStatus = await appWooSignal((api) => api.checkAppStatus());
|
||||
|
||||
if (!appStatus) {
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Sorry"),
|
||||
desc: "${trans(context, "Retry later")}",
|
||||
style: EdgeAlertStyle.INFO,
|
||||
duration: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_isProcessingPayment == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -29,29 +29,28 @@ class CheckoutDetailsPage extends StatefulWidget {
|
||||
class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
||||
_CheckoutDetailsPageState();
|
||||
|
||||
bool _hasDifferentShippingAddress = false;
|
||||
bool _hasDifferentShippingAddress = false, valRememberDetails = true;
|
||||
int activeTabIndex = 0;
|
||||
|
||||
// TEXT CONTROLLERS
|
||||
TextEditingController
|
||||
// billing
|
||||
_txtBillingFirstName,
|
||||
_txtBillingLastName,
|
||||
_txtBillingAddressLine,
|
||||
_txtBillingCity,
|
||||
_txtBillingPostalCode,
|
||||
_txtBillingEmailAddress,
|
||||
_txtBillingFirstName = TextEditingController(),
|
||||
_txtBillingLastName = TextEditingController(),
|
||||
_txtBillingAddressLine = TextEditingController(),
|
||||
_txtBillingCity = TextEditingController(),
|
||||
_txtBillingPostalCode = TextEditingController(),
|
||||
_txtBillingEmailAddress = TextEditingController(),
|
||||
// shipping
|
||||
_txtShippingFirstName,
|
||||
_txtShippingLastName,
|
||||
_txtShippingAddressLine,
|
||||
_txtShippingCity,
|
||||
_txtShippingPostalCode,
|
||||
_txtShippingEmailAddress;
|
||||
_txtShippingFirstName = TextEditingController(),
|
||||
_txtShippingLastName = TextEditingController(),
|
||||
_txtShippingAddressLine = TextEditingController(),
|
||||
_txtShippingCity = TextEditingController(),
|
||||
_txtShippingPostalCode = TextEditingController(),
|
||||
_txtShippingEmailAddress = TextEditingController();
|
||||
|
||||
CustomerCountry _billingCountry, _shippingCountry;
|
||||
|
||||
var valRememberDetails = true;
|
||||
Widget activeTab;
|
||||
|
||||
Widget tabShippingDetails() => CustomerAddressInput(
|
||||
@ -80,22 +79,6 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// SHIPPING
|
||||
_txtShippingFirstName = TextEditingController();
|
||||
_txtShippingLastName = TextEditingController();
|
||||
_txtShippingAddressLine = TextEditingController();
|
||||
_txtShippingCity = TextEditingController();
|
||||
_txtShippingPostalCode = TextEditingController();
|
||||
_txtShippingEmailAddress = TextEditingController();
|
||||
|
||||
// BILLING
|
||||
_txtBillingFirstName = TextEditingController();
|
||||
_txtBillingLastName = TextEditingController();
|
||||
_txtBillingAddressLine = TextEditingController();
|
||||
_txtBillingCity = TextEditingController();
|
||||
_txtBillingPostalCode = TextEditingController();
|
||||
_txtBillingEmailAddress = TextEditingController();
|
||||
|
||||
if (CheckoutSession.getInstance.billingDetails.billingAddress == null) {
|
||||
CheckoutSession.getInstance.billingDetails.initSession();
|
||||
CheckoutSession.getInstance.billingDetails.shippingAddress.initAddress();
|
||||
@ -130,14 +113,15 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
||||
return;
|
||||
}
|
||||
_setFields(
|
||||
firstName: customerAddress.firstName,
|
||||
lastName: customerAddress.lastName,
|
||||
addressLine: customerAddress.addressLine,
|
||||
city: customerAddress.city,
|
||||
postalCode: customerAddress.postalCode,
|
||||
emailAddress: customerAddress.emailAddress,
|
||||
customerCountry: customerAddress.customerCountry,
|
||||
type: type);
|
||||
firstName: customerAddress.firstName,
|
||||
lastName: customerAddress.lastName,
|
||||
addressLine: customerAddress.addressLine,
|
||||
city: customerAddress.city,
|
||||
postalCode: customerAddress.postalCode,
|
||||
emailAddress: customerAddress.emailAddress,
|
||||
customerCountry: customerAddress.customerCountry,
|
||||
type: type,
|
||||
);
|
||||
}
|
||||
|
||||
_setFields(
|
||||
@ -171,7 +155,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
title: Text(
|
||||
@ -286,7 +270,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
||||
)
|
||||
],
|
||||
),
|
||||
wsPrimaryButton(context,
|
||||
PrimaryButton(
|
||||
title: trans(context, "USE DETAILS"),
|
||||
action: () => _useDetailsTapped()),
|
||||
],
|
||||
@ -398,9 +382,9 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
|
||||
return customerShippingAddress;
|
||||
}
|
||||
|
||||
_navigateToSelectCountry({String type}) {
|
||||
_navigateToSelectCountry({@required String type}) {
|
||||
Navigator.pushNamed(context, "/customer-countries").then((value) {
|
||||
if (value == null || type == null) {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
if (type == "billing") {
|
||||
|
||||
@ -39,7 +39,7 @@ class _CheckoutPaymentTypePageState extends State<CheckoutPaymentTypePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
title: Text(trans(context, "Payment Method"),
|
||||
@ -106,8 +106,7 @@ class _CheckoutPaymentTypePageState extends State<CheckoutPaymentTypePage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
wsLinkButton(
|
||||
context,
|
||||
LinkButton(
|
||||
title: trans(context, "CANCEL"),
|
||||
action: () => Navigator.pop(context),
|
||||
),
|
||||
|
||||
@ -238,7 +238,7 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
title: Text(
|
||||
@ -383,9 +383,9 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
||||
style: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.headline6,
|
||||
textAlign: TextAlign.center))),
|
||||
wsLinkButton(
|
||||
context,
|
||||
textAlign: TextAlign.center,
|
||||
))),
|
||||
LinkButton(
|
||||
title: trans(context, "CANCEL"),
|
||||
action: () => Navigator.pop(context),
|
||||
),
|
||||
@ -409,13 +409,16 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
|
||||
}
|
||||
|
||||
_handleCheckoutTapped(int index) async {
|
||||
ShippingType shippingType = ShippingType();
|
||||
shippingType.object = _wsShippingOptions[index]['object'];
|
||||
shippingType.methodId = _wsShippingOptions[index]['method_id'];
|
||||
Map<String, dynamic> shippingOptions = _wsShippingOptions[index];
|
||||
ShippingType shippingType = ShippingType(
|
||||
methodId: shippingOptions['method_id'],
|
||||
object: shippingOptions['object'],
|
||||
cost: (await _getShippingPrice(index)),
|
||||
minimumValue: null);
|
||||
|
||||
if (_wsShippingOptions[index]['min_amount'] != null) {
|
||||
shippingType.minimumValue = _wsShippingOptions[index]['min_amount'];
|
||||
}
|
||||
shippingType.cost = await _getShippingPrice(index);
|
||||
|
||||
CheckoutSession.getInstance.shippingType = shippingType;
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ class _CheckoutStatusState extends State<CheckoutStatusPage> {
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0.0,
|
||||
title: storeLogo(height: 60),
|
||||
title: StoreLogo(height: 60),
|
||||
automaticallyImplyLeading: false,
|
||||
centerTitle: true,
|
||||
),
|
||||
|
||||
@ -42,7 +42,7 @@ class _CustomerCountriesPageState extends State<CustomerCountriesPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomPadding: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
title: Text(
|
||||
|
||||
@ -50,7 +50,7 @@ class _ErrorPageState extends State<ErrorPage> {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
wsLinkButton(context,
|
||||
LinkButton(
|
||||
title: trans(context, "Back"),
|
||||
action: () => Navigator.pop(context)),
|
||||
],
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
import 'package:label_storemax/widgets/app_loader.dart';
|
||||
import 'package:label_storemax/widgets/cart_icon.dart';
|
||||
@ -34,15 +34,12 @@ class _HomePageState extends State<HomePage> {
|
||||
List<WS.ProductCategory> _categories = [];
|
||||
final GlobalKey _key = GlobalKey();
|
||||
|
||||
int _page;
|
||||
bool _shouldStopRequests, waitForNextRequest, _isLoading;
|
||||
int _page = 1;
|
||||
bool _shouldStopRequests, waitForNextRequest, _isLoading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_isLoading = true;
|
||||
_page = 1;
|
||||
_home();
|
||||
}
|
||||
|
||||
@ -86,7 +83,7 @@ class _HomePageState extends State<HomePage> {
|
||||
});
|
||||
}
|
||||
|
||||
void _modalBottomSheetMenu() {
|
||||
_modalBottomSheetMenu() {
|
||||
_key.currentState.setState(() {});
|
||||
wsModalBottom(
|
||||
context,
|
||||
@ -94,23 +91,22 @@ class _HomePageState extends State<HomePage> {
|
||||
bodyWidget: ListView.separated(
|
||||
itemCount: _categories.length,
|
||||
separatorBuilder: (cxt, i) => Divider(),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ListTile(
|
||||
title: Text(parseHtmlString(_categories[index].name)),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pushNamed(context, "/browse-category",
|
||||
arguments: _categories[index])
|
||||
.then((value) => setState(() {}));
|
||||
},
|
||||
);
|
||||
},
|
||||
itemBuilder: (BuildContext context, int index) => ListTile(
|
||||
title: Text(parseHtmlString(_categories[index].name)),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pushNamed(context, "/browse-category",
|
||||
arguments: _categories[index])
|
||||
.then((value) => setState(() {}));
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String> bannerImages = AppHelper.instance.appConfig.bannerImages;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
@ -121,7 +117,7 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
margin: EdgeInsets.only(left: 0),
|
||||
),
|
||||
title: storeLogo(height: 50),
|
||||
title: StoreLogo(height: 55),
|
||||
centerTitle: true,
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
@ -144,50 +140,18 @@ class _HomePageState extends State<HomePage> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
capitalize(trans(context, "Shop")) + " / ",
|
||||
style: Theme.of(context).primaryTextTheme.subtitle1,
|
||||
maxLines: 1,
|
||||
),
|
||||
AutoSizeText(
|
||||
trans(context, "Newest"),
|
||||
style: Theme.of(context).primaryTextTheme.bodyText2,
|
||||
maxLines: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
Flexible(
|
||||
child: MaterialButton(
|
||||
minWidth: 100,
|
||||
height: 60,
|
||||
child: AutoSizeText(
|
||||
trans(context, "Browse categories"),
|
||||
style: Theme.of(context).primaryTextTheme.bodyText1,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
onPressed: _modalBottomSheetMenu,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
(_isLoading
|
||||
? Expanded(child: showAppLoader())
|
||||
: Expanded(
|
||||
child: refreshableScroll(
|
||||
context,
|
||||
refreshController: _refreshController,
|
||||
child: RefreshableScrollContainer(
|
||||
controller: _refreshController,
|
||||
onRefresh: _onRefresh,
|
||||
onLoading: _onLoading,
|
||||
products: _products,
|
||||
onTap: _showProduct,
|
||||
bannerHeight: MediaQuery.of(context).size.height / 3.5,
|
||||
bannerImages: bannerImages,
|
||||
modalBottomSheetMenu: _modalBottomSheetMenu,
|
||||
),
|
||||
flex: 1,
|
||||
)),
|
||||
@ -206,7 +170,7 @@ class _HomePageState extends State<HomePage> {
|
||||
_refreshController.refreshCompleted();
|
||||
}
|
||||
|
||||
void _onLoading() async {
|
||||
_onLoading() async {
|
||||
await _fetchMoreProducts();
|
||||
|
||||
if (mounted) {
|
||||
@ -219,8 +183,7 @@ class _HomePageState extends State<HomePage> {
|
||||
}
|
||||
}
|
||||
|
||||
_showProduct(WSProduct.Product product) {
|
||||
Navigator.pushNamed(context, "/product-detail", arguments: product)
|
||||
.then((value) => _key.currentState.setState(() {}));
|
||||
}
|
||||
_showProduct(WSProduct.Product product) =>
|
||||
Navigator.pushNamed(context, "/product-detail", arguments: product)
|
||||
.then((value) => _key.currentState.setState(() {}));
|
||||
}
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/shared_pref/sp_auth.dart';
|
||||
import 'package:label_storemax/labelconfig.dart';
|
||||
import 'package:label_storemax/widgets/menu_item.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
|
||||
@ -53,28 +53,25 @@ class _HomeMenuPageState extends State<HomeMenuPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
storeLogo(height: 100),
|
||||
StoreLogo(height: 100),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
(use_wp_login
|
||||
? wsMenuItem(
|
||||
context,
|
||||
(AppHelper.instance.appConfig.wpLoginEnabled == 1
|
||||
? MenuItem(
|
||||
title: trans(context, "Profile"),
|
||||
leading: Icon(Icons.account_circle),
|
||||
action: _actionProfile,
|
||||
)
|
||||
: Container()),
|
||||
wsMenuItem(
|
||||
context,
|
||||
MenuItem(
|
||||
title: trans(context, "Cart"),
|
||||
leading: Icon(Icons.shopping_cart),
|
||||
action: _actionCart,
|
||||
),
|
||||
wsMenuItem(
|
||||
context,
|
||||
MenuItem(
|
||||
title: trans(context, "About Us"),
|
||||
leading: Icon(Icons.account_balance),
|
||||
action: _actionAboutUs,
|
||||
@ -97,7 +94,8 @@ class _HomeMenuPageState extends State<HomeMenuPage> {
|
||||
}
|
||||
|
||||
void _actionProfile() async {
|
||||
if (use_wp_login == true && !(await authCheck())) {
|
||||
if (AppHelper.instance.appConfig.wpLoginEnabled == 1 &&
|
||||
!(await authCheck())) {
|
||||
UserAuth.instance.redirect = "/account-detail";
|
||||
Navigator.pushNamed(context, "/account-landing");
|
||||
return;
|
||||
|
||||
@ -46,7 +46,7 @@ class _HomeSearchPageState extends State<HomeSearchPage> {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
title: storeLogo(height: 60),
|
||||
title: StoreLogo(height: 55),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: SafeArea(
|
||||
@ -69,8 +69,7 @@ class _HomeSearchPageState extends State<HomeSearchPage> {
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: wsPrimaryButton(
|
||||
context,
|
||||
child: PrimaryButton(
|
||||
title: trans(context, "Search"),
|
||||
action: _actionSearch,
|
||||
),
|
||||
|
||||
73
LabelStoreMax/lib/pages/no_connection_page.dart
Normal file
73
LabelStoreMax/lib/pages/no_connection_page.dart
Normal file
@ -0,0 +1,73 @@
|
||||
// StoreMob
|
||||
//
|
||||
// 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/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
import 'package:label_storemax/widgets/buttons.dart';
|
||||
|
||||
class NoConnectionPage extends StatefulWidget {
|
||||
NoConnectionPage();
|
||||
|
||||
@override
|
||||
_NoConnectionPageState createState() => _NoConnectionPageState();
|
||||
}
|
||||
|
||||
class _NoConnectionPageState extends State<NoConnectionPage> {
|
||||
_NoConnectionPageState();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
print('WooCommerce site is not connected');
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
minimum: safeAreaDefault(),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.error_outline,
|
||||
size: 100,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
trans(context, "Oops, something went wrong"),
|
||||
style: Theme.of(context).primaryTextTheme.bodyText2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
LinkButton(title: trans(context, "Retry"), action: _retry),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_retry() async {
|
||||
AppHelper.instance.appConfig = await appWooSignal((api) => api.getApp());
|
||||
|
||||
if (AppHelper.instance.appConfig != null) {
|
||||
Navigator.pushNamed(context, "/home");
|
||||
return;
|
||||
}
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Oops"), desc: trans(context, "Retry later"));
|
||||
}
|
||||
}
|
||||
@ -17,7 +17,6 @@ import 'package:label_storemax/models/cart_line_item.dart';
|
||||
import 'package:label_storemax/widgets/app_loader.dart';
|
||||
import 'package:label_storemax/widgets/buttons.dart';
|
||||
import 'package:label_storemax/widgets/cart_icon.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:woosignal/models/response/product_variation.dart' as WS;
|
||||
import 'package:woosignal/models/response/products.dart' as WSProduct;
|
||||
import 'package:flutter_swiper/flutter_swiper.dart';
|
||||
@ -201,63 +200,67 @@ class _ProductDetailState extends State<ProductDetailPage> {
|
||||
: ""),
|
||||
style: Theme.of(context).primaryTextTheme.subtitle1,
|
||||
),
|
||||
wsPrimaryButton(context, title: trans(context, "Add to cart"),
|
||||
PrimaryButton(
|
||||
title: trans(context, "Add to cart"),
|
||||
action: () {
|
||||
if (_product.attributes.length !=
|
||||
_tmpAttributeObj.values.length) {
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Oops"),
|
||||
desc: trans(context, "Please select valid options first"),
|
||||
style: EdgeAlertStyle.WARNING);
|
||||
return;
|
||||
}
|
||||
if (_product.attributes.length !=
|
||||
_tmpAttributeObj.values.length) {
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Oops"),
|
||||
desc:
|
||||
trans(context, "Please select valid options first"),
|
||||
style: EdgeAlertStyle.WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
WS.ProductVariation productVariation = findProductVariation();
|
||||
if (productVariation == null) {
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Oops"),
|
||||
desc: trans(context, "Product variation does not exist"),
|
||||
style: EdgeAlertStyle.WARNING);
|
||||
return;
|
||||
}
|
||||
WS.ProductVariation productVariation = findProductVariation();
|
||||
if (productVariation == null) {
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Oops"),
|
||||
desc:
|
||||
trans(context, "Product variation does not exist"),
|
||||
style: EdgeAlertStyle.WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (productVariation.stockStatus != "instock") {
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Sorry"),
|
||||
desc: trans(context, "This item is not in stock"),
|
||||
style: EdgeAlertStyle.WARNING);
|
||||
return;
|
||||
}
|
||||
if (productVariation.stockStatus != "instock") {
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Sorry"),
|
||||
desc: trans(context, "This item is not in stock"),
|
||||
style: EdgeAlertStyle.WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> options = [];
|
||||
_tmpAttributeObj.forEach((k, v) {
|
||||
options.add("${v["name"]}: ${v["value"]}");
|
||||
});
|
||||
List<String> options = [];
|
||||
_tmpAttributeObj.forEach((k, v) {
|
||||
options.add("${v["name"]}: ${v["value"]}");
|
||||
});
|
||||
|
||||
CartLineItem cartLineItem = CartLineItem(
|
||||
name: _product.name,
|
||||
productId: _product.id,
|
||||
variationId: productVariation.id,
|
||||
quantity: 1,
|
||||
taxStatus: productVariation.taxStatus,
|
||||
shippingClassId: productVariation.shippingClassId.toString(),
|
||||
subtotal: productVariation.price,
|
||||
stockQuantity: productVariation.stockQuantity,
|
||||
isManagedStock: productVariation.manageStock,
|
||||
taxClass: productVariation.taxClass,
|
||||
imageSrc: (productVariation.image != null
|
||||
? productVariation.image.src
|
||||
: _product.images.length == 0
|
||||
? app_product_placeholder_image
|
||||
: _product.images.first.src),
|
||||
shippingIsTaxable: _product.shippingTaxable,
|
||||
variationOptions: options.join(", "),
|
||||
total: productVariation.price,
|
||||
);
|
||||
CartLineItem cartLineItem = CartLineItem(
|
||||
name: _product.name,
|
||||
productId: _product.id,
|
||||
variationId: productVariation.id,
|
||||
quantity: 1,
|
||||
taxStatus: productVariation.taxStatus,
|
||||
shippingClassId:
|
||||
productVariation.shippingClassId.toString(),
|
||||
subtotal: productVariation.price,
|
||||
stockQuantity: productVariation.stockQuantity,
|
||||
isManagedStock: productVariation.manageStock,
|
||||
taxClass: productVariation.taxClass,
|
||||
imageSrc: (productVariation.image != null
|
||||
? productVariation.image.src
|
||||
: _product.images.length == 0
|
||||
? app_product_placeholder_image
|
||||
: _product.images.first.src),
|
||||
shippingIsTaxable: _product.shippingTaxable,
|
||||
variationOptions: options.join(", "),
|
||||
total: productVariation.price,
|
||||
);
|
||||
|
||||
_itemAddToCart(cartLineItem: cartLineItem);
|
||||
Navigator.of(context).pop();
|
||||
}),
|
||||
_itemAddToCart(cartLineItem: cartLineItem);
|
||||
Navigator.of(context).pop();
|
||||
}),
|
||||
],
|
||||
),
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
@ -285,7 +288,7 @@ class _ProductDetailState extends State<ProductDetailPage> {
|
||||
actions: <Widget>[
|
||||
wsCartIcon(context),
|
||||
],
|
||||
title: storeLogo(height: 55),
|
||||
title: StoreLogo(height: 55),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: SafeArea(
|
||||
@ -522,15 +525,13 @@ class _ProductDetailState extends State<ProductDetailPage> {
|
||||
)),
|
||||
_product.type == "external"
|
||||
? Flexible(
|
||||
child: wsPrimaryButton(
|
||||
context,
|
||||
child: PrimaryButton(
|
||||
title: trans(context, "Buy Product"),
|
||||
action: () => _viewExternalProduct(),
|
||||
),
|
||||
)
|
||||
: Flexible(
|
||||
child: wsPrimaryButton(
|
||||
context,
|
||||
child: PrimaryButton(
|
||||
title: trans(context, "Add to cart"),
|
||||
action: () => _addItemToCart(),
|
||||
),
|
||||
|
||||
@ -12,11 +12,10 @@
|
||||
//
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:label_storemax/helpers/app_helper.dart';
|
||||
import 'package:label_storemax/helpers/data/order_wc.dart';
|
||||
import 'package:label_storemax/helpers/tools.dart';
|
||||
import 'package:label_storemax/labelconfig.dart';
|
||||
import 'package:label_storemax/models/cart.dart';
|
||||
import 'package:label_storemax/models/checkout_session.dart';
|
||||
import 'package:label_storemax/pages/checkout_confirmation.dart';
|
||||
import 'package:razorpay_flutter/razorpay_flutter.dart';
|
||||
import 'package:woosignal/models/response/tax_rate.dart';
|
||||
@ -25,16 +24,16 @@ import 'package:woosignal/models/response/order.dart';
|
||||
|
||||
razorPay(context,
|
||||
{@required CheckoutConfirmationPageState state, TaxRate taxRate}) async {
|
||||
Razorpay _razorpay = Razorpay();
|
||||
Razorpay razorPay = Razorpay();
|
||||
|
||||
_razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS,
|
||||
razorPay.on(Razorpay.EVENT_PAYMENT_SUCCESS,
|
||||
(PaymentSuccessResponse response) async {
|
||||
OrderWC orderWC = await buildOrderWC(taxRate: taxRate);
|
||||
|
||||
Order order = await appWooSignal((api) => api.createOrder(orderWC));
|
||||
|
||||
if (order != null) {
|
||||
_razorpay.clear();
|
||||
razorPay.clear();
|
||||
Navigator.pushNamed(context, "/checkout-status", arguments: order);
|
||||
} else {
|
||||
showEdgeAlertWith(context,
|
||||
@ -44,27 +43,27 @@ razorPay(context,
|
||||
trans(context, "Something went wrong, please contact our store"),
|
||||
),
|
||||
style: EdgeAlertStyle.WARNING);
|
||||
_razorpay.clear();
|
||||
razorPay.clear();
|
||||
state.reloadState(showLoader: false);
|
||||
}
|
||||
});
|
||||
|
||||
_razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, (PaymentFailureResponse response) {
|
||||
razorPay.on(Razorpay.EVENT_PAYMENT_ERROR, (PaymentFailureResponse response) {
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Error"),
|
||||
desc: response.message,
|
||||
style: EdgeAlertStyle.WARNING);
|
||||
_razorpay.clear();
|
||||
razorPay.clear();
|
||||
state.reloadState(showLoader: false);
|
||||
});
|
||||
|
||||
_razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET,
|
||||
razorPay.on(Razorpay.EVENT_EXTERNAL_WALLET,
|
||||
(ExternalWalletResponse response) {
|
||||
showEdgeAlertWith(context,
|
||||
title: trans(context, "Error"),
|
||||
desc: trans(context, "Not supported, try a card payment"),
|
||||
style: EdgeAlertStyle.WARNING);
|
||||
_razorpay.clear();
|
||||
razorPay.clear();
|
||||
state.reloadState(showLoader: false);
|
||||
});
|
||||
|
||||
@ -73,7 +72,7 @@ razorPay(context,
|
||||
var options = {
|
||||
'key': app_razor_id,
|
||||
'amount': (parseWcPrice(total) * 100).toInt(),
|
||||
'name': app_name,
|
||||
'name': AppHelper.instance.appConfig.appName,
|
||||
'description': await cart.cartShortDesc(),
|
||||
'prefill': {
|
||||
"name": [
|
||||
@ -87,6 +86,6 @@ razorPay(context,
|
||||
|
||||
state.reloadState(showLoader: true);
|
||||
|
||||
_razorpay.open(options);
|
||||
razorPay.open(options);
|
||||
});
|
||||
}
|
||||
|
||||
@ -11,64 +11,110 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
import 'package:label_storemax/widgets/woosignal_ui.dart';
|
||||
|
||||
Widget wsPrimaryButton(BuildContext context,
|
||||
{@required String title, void Function() action}) {
|
||||
return Container(
|
||||
height: 55,
|
||||
child: RaisedButton(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).primaryTextTheme.button.copyWith(fontSize: 16),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
onPressed: action ?? null,
|
||||
elevation: 0,
|
||||
),
|
||||
);
|
||||
class PrimaryButton extends StatelessWidget {
|
||||
const PrimaryButton({
|
||||
Key key,
|
||||
this.title,
|
||||
this.action,
|
||||
}) : super(key: key);
|
||||
|
||||
final String title;
|
||||
final void Function() action;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => WooSignalButton(
|
||||
key: key,
|
||||
title: title,
|
||||
action: action,
|
||||
textStyle:
|
||||
Theme.of(context).primaryTextTheme.button.copyWith(fontSize: 16),
|
||||
bgColor: HexColor("#529cda"),
|
||||
);
|
||||
}
|
||||
|
||||
Widget wsSecondaryButton(BuildContext context,
|
||||
{String title, void Function() action}) {
|
||||
return Container(
|
||||
height: 60,
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: RaisedButton(
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).primaryTextTheme.bodyText1.copyWith(
|
||||
class SecondaryButton extends StatelessWidget {
|
||||
const SecondaryButton({
|
||||
Key key,
|
||||
this.title,
|
||||
this.action,
|
||||
}) : super(key: key);
|
||||
|
||||
final String title;
|
||||
final void Function() action;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => WooSignalButton(
|
||||
key: key,
|
||||
title: title,
|
||||
action: action,
|
||||
textStyle: Theme.of(context).primaryTextTheme.bodyText1.copyWith(
|
||||
color: Colors.black87,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
onPressed: action,
|
||||
color: HexColor("#f6f6f9"),
|
||||
elevation: 1,
|
||||
),
|
||||
);
|
||||
bgColor: HexColor("#f6f6f9"),
|
||||
);
|
||||
}
|
||||
|
||||
Widget wsLinkButton(BuildContext context,
|
||||
{String title, void Function() action}) {
|
||||
return Container(
|
||||
height: 60,
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: MaterialButton(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).primaryTextTheme.bodyText1,
|
||||
textAlign: TextAlign.left,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
onPressed: action,
|
||||
elevation: 0,
|
||||
),
|
||||
);
|
||||
class LinkButton extends StatelessWidget {
|
||||
const LinkButton({
|
||||
Key key,
|
||||
this.title,
|
||||
this.action,
|
||||
}) : super(key: key);
|
||||
|
||||
final String title;
|
||||
final void Function() action;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => WooSignalButton(
|
||||
key: key,
|
||||
title: title,
|
||||
action: action,
|
||||
textStyle: Theme.of(context).primaryTextTheme.bodyText1,
|
||||
bgColor: Colors.transparent,
|
||||
);
|
||||
}
|
||||
|
||||
class WooSignalButton extends StatelessWidget {
|
||||
const WooSignalButton({
|
||||
Key key,
|
||||
this.title,
|
||||
this.action,
|
||||
this.textStyle,
|
||||
this.bgColor,
|
||||
}) : super(key: key);
|
||||
|
||||
final String title;
|
||||
final void Function() action;
|
||||
final TextStyle textStyle;
|
||||
final Color bgColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 55,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.0)),
|
||||
padding: EdgeInsets.all(8),
|
||||
elevation: 0,
|
||||
primary: bgColor,
|
||||
shadowColor: Colors.transparent),
|
||||
child: Text(
|
||||
title,
|
||||
style: textStyle,
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
onPressed: action ?? null,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,16 +37,14 @@ class CustomerAddressInput extends StatelessWidget {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "First Name"),
|
||||
controller: txtControllerFirstName,
|
||||
shouldAutoFocus: true,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Last Name"),
|
||||
controller: txtControllerLastName,
|
||||
),
|
||||
@ -60,15 +58,13 @@ class CustomerAddressInput extends StatelessWidget {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Address Line"),
|
||||
controller: txtControllerAddressLine,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "City"),
|
||||
controller: txtControllerCity,
|
||||
),
|
||||
@ -80,14 +76,13 @@ class CustomerAddressInput extends StatelessWidget {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: wsTextEditingRow(
|
||||
context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Postal code"),
|
||||
controller: txtControllerPostalCode,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: wsTextEditingRow(context,
|
||||
child: TextEditingRow(
|
||||
heading: trans(context, "Email address"),
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
controller: txtControllerEmailAddress),
|
||||
@ -96,38 +91,62 @@ class CustomerAddressInput extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
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")),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
if (customerCountry.hasState())
|
||||
Flexible(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
trans(context, "State"),
|
||||
style: Theme.of(context).primaryTextTheme.bodyText1,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
width: double.infinity,
|
||||
),
|
||||
Padding(
|
||||
child: SecondaryButton(
|
||||
title: (customerCountry.state != null
|
||||
? "${trans(context, "Selected")}\n${customerCountry?.state?.name ?? ""}"
|
||||
: trans(context, "Select state")),
|
||||
action: onTapCountry,
|
||||
),
|
||||
padding: EdgeInsets.all(8),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
trans(context, "Country"),
|
||||
style: Theme.of(context).primaryTextTheme.bodyText1,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
width: double.infinity,
|
||||
),
|
||||
Padding(
|
||||
child: SecondaryButton(
|
||||
title: (customerCountry != null &&
|
||||
(customerCountry?.name ?? "").isNotEmpty
|
||||
? "${trans(context, "Selected")}\n${customerCountry.name}"
|
||||
: trans(context, "Select country")),
|
||||
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((element) => element != null).toList(),
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
),
|
||||
),
|
||||
),
|
||||
].where((e) => e != null).toList(),
|
||||
|
||||
@ -10,30 +10,41 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Widget wsMenuItem(BuildContext context,
|
||||
{String title, Widget leading, void Function() action}) {
|
||||
return Flexible(
|
||||
child: InkWell(
|
||||
child: Card(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(top: 15, bottom: 15),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
leading,
|
||||
Text(
|
||||
" " + title,
|
||||
style: Theme.of(context).primaryTextTheme.bodyText2,
|
||||
class MenuItem extends StatelessWidget {
|
||||
const MenuItem({
|
||||
Key key,
|
||||
this.title,
|
||||
this.leading,
|
||||
this.action,
|
||||
}) : super(key: key);
|
||||
|
||||
final String title;
|
||||
final Widget leading;
|
||||
final void Function() action;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Flexible(
|
||||
child: InkWell(
|
||||
child: Card(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(top: 15, bottom: 15),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
leading,
|
||||
Text(
|
||||
" " + title,
|
||||
style: Theme.of(context).primaryTextTheme.bodyText2,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
elevation: 1,
|
||||
margin: EdgeInsets.only(top: 8, bottom: 8, left: 8, right: 8),
|
||||
),
|
||||
onTap: action,
|
||||
),
|
||||
elevation: 1,
|
||||
margin: EdgeInsets.only(top: 8, bottom: 8, left: 8, right: 8),
|
||||
),
|
||||
onTap: action,
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,7 @@ packages:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.0-nullsafety.1"
|
||||
version: "2.5.0"
|
||||
auto_size_text:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -35,7 +35,7 @@ packages:
|
||||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.1"
|
||||
version: "2.1.0"
|
||||
bubble_tab_indicator:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -56,28 +56,28 @@ packages:
|
||||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.3"
|
||||
version: "1.1.0"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
version: "1.2.0"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.1"
|
||||
version: "1.1.0"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0-nullsafety.3"
|
||||
version: "1.15.0"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -154,7 +154,7 @@ packages:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
version: "1.2.0"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -314,14 +314,21 @@ packages:
|
||||
name: intl
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.1"
|
||||
version: "0.17.0"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.3"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.10-nullsafety.1"
|
||||
version: "0.12.10"
|
||||
math_expressions:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -335,7 +342,7 @@ packages:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.3"
|
||||
version: "1.3.0"
|
||||
octo_image:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -363,7 +370,7 @@ packages:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety.1"
|
||||
version: "1.8.0"
|
||||
path_provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -447,7 +454,7 @@ packages:
|
||||
name: pull_to_refresh
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.3"
|
||||
version: "1.6.4"
|
||||
razorpay_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -515,7 +522,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety.2"
|
||||
version: "1.8.0"
|
||||
sqflite:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -536,7 +543,7 @@ packages:
|
||||
name: stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.0-nullsafety.1"
|
||||
version: "1.10.0"
|
||||
status_alert:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -550,14 +557,14 @@ packages:
|
||||
name: stream_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.1"
|
||||
version: "2.1.0"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.1"
|
||||
version: "1.1.0"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -571,14 +578,14 @@ packages:
|
||||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
version: "1.2.0"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.19-nullsafety.2"
|
||||
version: "0.2.19"
|
||||
transformer_page_view:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -592,7 +599,7 @@ packages:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.3"
|
||||
version: "1.3.0"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -648,7 +655,7 @@ packages:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.3"
|
||||
version: "2.1.0"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -662,7 +669,7 @@ packages:
|
||||
name: woosignal
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
version: "1.4.0"
|
||||
woosignal_stripe:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -699,5 +706,5 @@ packages:
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
sdks:
|
||||
dart: ">=2.10.0 <2.11.0"
|
||||
flutter: ">=1.22.0 <2.0.0"
|
||||
dart: ">=2.12.0-0.0 <3.0.0"
|
||||
flutter: ">=1.22.0"
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
# Official WooSignal App Template for WooCommerce
|
||||
|
||||
# Label StoreMax
|
||||
# Version 2.6.0
|
||||
# Version 3.0.0
|
||||
# Homepage: https://woosignal.com
|
||||
# Author: Anthony Gordon <agordon@woosignal.com>
|
||||
# Documentation: https://woosignal.com/docs/app/ios/label-storemax
|
||||
|
||||
### Change App Icon
|
||||
# 1 Replace: assets/icon/appicon.png (1024px1024px icon size)
|
||||
# 2 Run this command from terminal: "flutter pub run flutter_launcher_icons:main"
|
||||
# 2 Run this command from the terminal: "flutter pub run flutter_launcher_icons:main"
|
||||
|
||||
### Uploading the IOS/Android app
|
||||
# IOS https://flutter.dev/docs/deployment/ios
|
||||
@ -19,11 +19,13 @@ description: LabelStoreMAX
|
||||
|
||||
version: 1.0.0+1
|
||||
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: ">=2.1.0 <3.0.0"
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
woosignal: ^1.3.1
|
||||
woosignal: ^1.4.0
|
||||
woosignal_stripe: ^0.1.0
|
||||
razorpay_flutter: 1.2.3
|
||||
wp_json_api: ^2.0.0
|
||||
@ -35,8 +37,8 @@ dependencies:
|
||||
flutter_money_formatter: ^0.8.3
|
||||
platform_alert_dialog: ^1.0.0+2
|
||||
flutter_web_browser: ^0.13.1
|
||||
pull_to_refresh: 1.6.3
|
||||
intl: ^0.16.1
|
||||
pull_to_refresh: 1.6.4
|
||||
intl: ^0.17.0
|
||||
flutter_swiper: ^1.1.6
|
||||
edge_alert: ^0.0.1
|
||||
bubble_tab_indicator: ^0.1.4
|
||||
@ -67,7 +69,7 @@ flutter_icons:
|
||||
image_path: "assets/icon/appicon.png"
|
||||
|
||||
dependency_overrides:
|
||||
intl:
|
||||
intl: ^0.17.0-nullsafety.2
|
||||
|
||||
flutter:
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
# WooCommerce App: Label StoreMax
|
||||
|
||||
### Label StoreMax - v2.6.0
|
||||
### Label StoreMax - v3.0.0
|
||||
|
||||
|
||||
[Official WooSignal WooCommerce App](https://woosignal.com)
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
Label StoreMax is a WooCommerce Flutter App template, built exclusively for online shopping and it offers a great variety of options to customise the look and feel of the App. Label StoreMax supports product views, multi-variation products, category searches + more.
|
||||
|
||||
1. Supports the latest WooCommerce (3.0+)
|
||||
1. Supports the latest WooCommerce (3.5+)
|
||||
2. [Documentation available](https://woosignal.com/docs/app/ios/label-storemax)
|
||||
|
||||
## Some features integrated
|
||||
|
||||
Loading…
Reference in New Issue
Block a user