diff --git a/LabelStoreMax/.env b/LabelStoreMax/.env
index cb9ba47..dc68393 100644
--- a/LabelStoreMax/.env
+++ b/LabelStoreMax/.env
@@ -23,14 +23,12 @@ APP_KEY="your app key"
STRIPE_ACCOUNT="Stripe account key from WooSignal"
# Stripe account key from WooSignal https://woosignal.com/dashboard
+STRIPE_COUNTRY_CODE="GB"
+# Alpha-2 country code list: https://www.iban.com/country-codes
+
STRIPE_LIVE_MODE=null
# Change to 'true' for live payments and update the "Environment for Stripe" here https://woosignal.com/dashboard
-# **
-
-RAZORPAY_ID=""
-# Razorpay ID from https://razorpay.com
-
# **
PAYPAL_ACCOUNT_EMAIL="mystore@business.com"
diff --git a/LabelStoreMax/CHANGELOG.md b/LabelStoreMax/CHANGELOG.md
index 401ee70..55af273 100644
--- a/LabelStoreMax/CHANGELOG.md
+++ b/LabelStoreMax/CHANGELOG.md
@@ -1,3 +1,12 @@
+## [5.2.0] - 2020-10-11
+
+* Migrate to Nylo 2.1.0
+* Use flutter_stripe library for payments
+* Remove RazorPay for build fails
+* Pubspec.yaml dependency updates
+* Android compileSdkVersion 30
+* Bug fixes
+
## [5.1.0] - 2020-07-19
* Add support for simplified Chinese locale (zh)
diff --git a/LabelStoreMax/README.md b/LabelStoreMax/README.md
index bdbfa77..f096f5e 100644
--- a/LabelStoreMax/README.md
+++ b/LabelStoreMax/README.md
@@ -4,7 +4,7 @@
# WooCommerce App: Label StoreMax
-### Label StoreMax - v5.1.0
+### Label StoreMax - v5.2.0
[Official WooSignal WooCommerce App](https://woosignal.com)
@@ -44,7 +44,7 @@ Full documentation this available [here](https://woosignal.com/docs/app/ios/labe
- Browse products, make orders, customer login (via WordPress)
- Change app name, logo, customize default language, currency + more
- Light and dark mode
-- Stripe, Cash On Delivery, RazorPay, PayPal
+- Stripe, Cash On Delivery, PayPal
- Localized for en, es, pt, it, hi, fr, zh
- Orders show as normal in WooCommerce
diff --git a/LabelStoreMax/android/app/build.gradle b/LabelStoreMax/android/app/build.gradle
index 3ff0139..7adc310 100644
--- a/LabelStoreMax/android/app/build.gradle
+++ b/LabelStoreMax/android/app/build.gradle
@@ -26,7 +26,19 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 28
+ packagingOptions {
+ exclude 'META-INF/DEPENDENCIES'
+ exclude 'META-INF/LICENSE'
+ exclude 'META-INF/LICENSE.txt'
+ exclude 'META-INF/license.txt'
+ exclude 'META-INF/NOTICE'
+ exclude 'META-INF/NOTICE.txt'
+ exclude 'META-INF/notice.txt'
+ exclude 'META-INF/ASL2.0'
+ exclude("META-INF/*.kotlin_module")
+ }
+
+ compileSdkVersion 30
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -39,8 +51,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.woosignal.android"
- minSdkVersion 19
- targetSdkVersion 29
+ minSdkVersion 21
+ targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
diff --git a/LabelStoreMax/android/app/src/main/kotlin/com/woosignal/android/MainActivity.kt b/LabelStoreMax/android/app/src/main/kotlin/com/woosignal/android/MainActivity.kt
index 20500a3..9691152 100644
--- a/LabelStoreMax/android/app/src/main/kotlin/com/woosignal/android/MainActivity.kt
+++ b/LabelStoreMax/android/app/src/main/kotlin/com/woosignal/android/MainActivity.kt
@@ -1,6 +1,7 @@
package com.woosignal.android
import io.flutter.embedding.android.FlutterActivity
+import io.flutter.embedding.android.FlutterFragmentActivity
-class MainActivity: FlutterActivity() {
+class MainActivity: FlutterFragmentActivity() {
}
diff --git a/LabelStoreMax/android/build.gradle b/LabelStoreMax/android/build.gradle
index 3100ad2..0b891c9 100644
--- a/LabelStoreMax/android/build.gradle
+++ b/LabelStoreMax/android/build.gradle
@@ -1,12 +1,12 @@
buildscript {
- ext.kotlin_version = '1.3.50'
+ ext.kotlin_version = '1.5.0'
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.5.0'
+ classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
diff --git a/LabelStoreMax/android/gradle/wrapper/gradle-wrapper.properties b/LabelStoreMax/android/gradle/wrapper/gradle-wrapper.properties
index 296b146..bc6a58a 100644
--- a/LabelStoreMax/android/gradle/wrapper/gradle-wrapper.properties
+++ b/LabelStoreMax/android/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
diff --git a/LabelStoreMax/ios/Flutter/AppFrameworkInfo.plist b/LabelStoreMax/ios/Flutter/AppFrameworkInfo.plist
index 6b4c0f7..f2872cf 100644
--- a/LabelStoreMax/ios/Flutter/AppFrameworkInfo.plist
+++ b/LabelStoreMax/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 8.0
+ 9.0
diff --git a/LabelStoreMax/ios/Runner/Info.plist b/LabelStoreMax/ios/Runner/Info.plist
index 8dd22ee..8707779 100644
--- a/LabelStoreMax/ios/Runner/Info.plist
+++ b/LabelStoreMax/ios/Runner/Info.plist
@@ -17,7 +17,7 @@
CFBundleShortVersionString
$(FLUTTER_BUILD_NAME)
NSCameraUsageDescription
- $(PRODUCT_NAME) photo use
+ You can take photos of your payment details.
CFBundleSignature
????
MinimumOSVersion
diff --git a/LabelStoreMax/lang/de.json b/LabelStoreMax/lang/de.json
index ad7b08c..8612163 100644
--- a/LabelStoreMax/lang/de.json
+++ b/LabelStoreMax/lang/de.json
@@ -184,5 +184,6 @@
"Payment Cancelled": "Zahlung storniert",
"The payment has been cancelled": "Die Zahlung wurde storniert",
"Must have": "Haben müssen",
- "Our selection of new items": "Unsere Auswahl an Neuheiten"
+ "Our selection of new items": "Unsere Auswahl an Neuheiten",
+ "Register": "Registrieren"
}
\ No newline at end of file
diff --git a/LabelStoreMax/lang/en.json b/LabelStoreMax/lang/en.json
index c4a646b..79a77da 100644
--- a/LabelStoreMax/lang/en.json
+++ b/LabelStoreMax/lang/en.json
@@ -184,5 +184,6 @@
"Payment Cancelled": "Payment Cancelled",
"The payment has been cancelled": "The payment has been cancelled",
"Must have": "Must have",
- "Our selection of new items": "Our selection of new items"
+ "Our selection of new items": "Our selection of new items",
+ "Register": "Register"
}
\ No newline at end of file
diff --git a/LabelStoreMax/lang/es.json b/LabelStoreMax/lang/es.json
index ed9c20e..11fff15 100644
--- a/LabelStoreMax/lang/es.json
+++ b/LabelStoreMax/lang/es.json
@@ -184,5 +184,6 @@
"Payment Cancelled": "Pago cancelado",
"The payment has been cancelled": "El pago ha sido cancelado",
"Must have": "Debe tener",
- "Our selection of new items": "Nuestra selección de novedades"
+ "Our selection of new items": "Nuestra selección de novedades",
+ "Register": "Registrarse"
}
\ No newline at end of file
diff --git a/LabelStoreMax/lang/fr.json b/LabelStoreMax/lang/fr.json
index d4f552a..e64e1e7 100644
--- a/LabelStoreMax/lang/fr.json
+++ b/LabelStoreMax/lang/fr.json
@@ -184,5 +184,6 @@
"Payment Cancelled": "Paiement annulé",
"The payment has been cancelled": "Le paiement a été annulé",
"Must have": "Doit avoir",
- "Our selection of new items": "Notre sélection de nouveautés"
+ "Our selection of new items": "Notre sélection de nouveautés",
+ "Register": "S'inscrire"
}
\ No newline at end of file
diff --git a/LabelStoreMax/lang/hi.json b/LabelStoreMax/lang/hi.json
index 929d10a..95f91d3 100644
--- a/LabelStoreMax/lang/hi.json
+++ b/LabelStoreMax/lang/hi.json
@@ -184,5 +184,6 @@
"Payment Cancelled": "bhugataan radd kiya gaya",
"The payment has been cancelled": "bhugataan radd kar diya gaya hai",
"Must have": "hona aavashyak hai",
- "Our selection of new items": "naee vastuon ka hamaara chayan"
+ "Our selection of new items": "naee vastuon ka hamaara chayan",
+ "Register": "rajistar karen"
}
\ No newline at end of file
diff --git a/LabelStoreMax/lang/it.json b/LabelStoreMax/lang/it.json
index e1be4bb..317bfc1 100644
--- a/LabelStoreMax/lang/it.json
+++ b/LabelStoreMax/lang/it.json
@@ -184,5 +184,6 @@
"Payment Cancelled": "Pagamento annullato",
"The payment has been cancelled": "Il pagamento è stato annullato",
"Must have": "Deve avere",
- "Our selection of new items": "La nostra selezione di nuovi articoli"
+ "Our selection of new items": "La nostra selezione di nuovi articoli",
+ "Register": "Registrati"
}
\ No newline at end of file
diff --git a/LabelStoreMax/lang/pt.json b/LabelStoreMax/lang/pt.json
index 877f449..ba1ef19 100644
--- a/LabelStoreMax/lang/pt.json
+++ b/LabelStoreMax/lang/pt.json
@@ -184,5 +184,6 @@
"Payment Cancelled": "Pagamento Cancelado",
"The payment has been cancelled": "O pagamento foi cancelado",
"Must have": "Deve ter",
- "Our selection of new items": "Nossa seleção de novos itens"
+ "Our selection of new items": "Nossa seleção de novos itens",
+ "Register": "Registro"
}
\ No newline at end of file
diff --git a/LabelStoreMax/lang/zh.json b/LabelStoreMax/lang/zh.json
index 41d20db..bdb70f5 100644
--- a/LabelStoreMax/lang/zh.json
+++ b/LabelStoreMax/lang/zh.json
@@ -184,5 +184,6 @@
"Payment Cancelled": "付款已取消",
"The payment has been cancelled": "付款已取消",
"Must have": "一定有",
- "Our selection of new items": "我们精选的新品"
+ "Our selection of new items": "我们精选的新品",
+ "Register": "登记"
}
\ No newline at end of file
diff --git a/LabelStoreMax/lib/app/providers/paypal_pay.dart b/LabelStoreMax/lib/app/providers/paypal_pay.dart
index 56bb01f..a237ffa 100644
--- a/LabelStoreMax/lib/app/providers/paypal_pay.dart
+++ b/LabelStoreMax/lib/app/providers/paypal_pay.dart
@@ -46,7 +46,7 @@ payPalPay(context,
state.reloadState(showLoader: false);
return;
}
-
+print(value);
state.reloadState(showLoader: true);
if (value.containsKey("status") && value["status"] == "success") {
OrderWC orderWC =
diff --git a/LabelStoreMax/lib/app/providers/razor_pay.dart b/LabelStoreMax/lib/app/providers/razor_pay.dart
deleted file mode 100644
index 02b71b8..0000000
--- a/LabelStoreMax/lib/app/providers/razor_pay.dart
+++ /dev/null
@@ -1,88 +0,0 @@
-//
-// LabelCore
-// Label StoreMax
-//
-// Created by Anthony Gordon.
-// 2021, WooSignal Ltd. All rights reserved.
-//
-
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//
-
-import 'package:flutter/widgets.dart';
-import 'package:flutter_app/bootstrap/app_helper.dart';
-import 'package:flutter_app/bootstrap/data/order_wc.dart';
-import 'package:flutter_app/bootstrap/helpers.dart';
-import 'package:flutter_app/resources/pages/checkout_confirmation.dart';
-import 'package:nylo_support/helpers/helper.dart';
-import 'package:razorpay_flutter/razorpay_flutter.dart';
-import 'package:woosignal/models/response/tax_rate.dart';
-import 'package:woosignal/models/payload/order_wc.dart';
-import 'package:woosignal/models/response/order.dart';
-
-razorPay(context,
- {@required CheckoutConfirmationPageState state, TaxRate taxRate}) async {
- Razorpay razorPay = Razorpay();
-
- 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();
- Navigator.pushNamed(context, "/checkout-status", arguments: order);
- } else {
- showToastNotification(context,
- title: trans(context, "Error"),
- description: trans(context, "Something went wrong, please contact our store"),
- style: ToastNotificationStyleType.WARNING);
- razorPay.clear();
- state.reloadState(showLoader: false);
- }
- });
-
- razorPay.on(Razorpay.EVENT_PAYMENT_ERROR, (PaymentFailureResponse response) {
- showToastNotification(context,
- title: trans(context, "Error"),
- description: response.message,
- style: ToastNotificationStyleType.WARNING);
- razorPay.clear();
- state.reloadState(showLoader: false);
- });
-
- razorPay.on(Razorpay.EVENT_EXTERNAL_WALLET,
- (ExternalWalletResponse response) {
- showToastNotification(context,
- title: trans(context, "Error"),
- description: trans(context, "Not supported, try a card payment"),
- style: ToastNotificationStyleType.WARNING);
- razorPay.clear();
- state.reloadState(showLoader: false);
- });
-
- // CHECKOUT HELPER
- await checkout(taxRate, (total, billingDetails, cart) async {
- var options = {
- 'key': getEnv('RAZORPAY_ID'),
- 'amount': (parseWcPrice(total) * 100).toInt(),
- 'name': AppHelper.instance.appConfig.appName,
- 'description': await cart.cartShortDesc(),
- 'prefill': {
- "name": [
- billingDetails.billingAddress.firstName,
- billingDetails.billingAddress.lastName
- ].where((t) => t != null || t != "").toList().join(" "),
- "method": "card",
- 'email': billingDetails.billingAddress.emailAddress
- }
- };
-
- state.reloadState(showLoader: true);
-
- razorPay.open(options);
- });
-}
diff --git a/LabelStoreMax/lib/app/providers/stripe_pay.dart b/LabelStoreMax/lib/app/providers/stripe_pay.dart
index f19db8d..d2ad5b3 100644
--- a/LabelStoreMax/lib/app/providers/stripe_pay.dart
+++ b/LabelStoreMax/lib/app/providers/stripe_pay.dart
@@ -17,103 +17,105 @@ import 'package:flutter_app/bootstrap/app_helper.dart';
import 'package:flutter_app/bootstrap/data/order_wc.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/resources/pages/checkout_confirmation.dart';
+import 'package:flutter_stripe/flutter_stripe.dart';
+import 'package:nylo_framework/nylo_framework.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:woosignal/models/payload/order_wc.dart';
import 'package:woosignal/models/response/order.dart';
import 'package:woosignal/models/response/tax_rate.dart';
import 'package:woosignal/models/response/woosignal_app.dart';
-import 'package:woosignal_stripe/woosignal_stripe.dart';
stripePay(context,
{@required CheckoutConfirmationPageState state, TaxRate taxRate}) async {
+ WooSignalApp wooSignalApp = AppHelper.instance.appConfig;
+
+ bool liveMode = getEnv('STRIPE_LIVE_MODE') == null
+ ? !wooSignalApp.stripeLiveMode
+ : getEnv('STRIPE_LIVE_MODE', defaultValue: false);
+
+ // CONFIGURE STRIPE
+ Stripe.stripeAccountId = getEnv('STRIPE_ACCOUNT');
+ Stripe.publishableKey = liveMode ? "pk_live_IyS4Vt86L49jITSfaUShumzi" : "pk_test_0jMmpBntJ6UkizPkfiB8ZJxH"; // Don't change this value
+
try {
- WooSignalApp wooSignalApp = AppHelper.instance.appConfig;
- bool liveMode = getEnv('STRIPE_LIVE_MODE') == null
- ? wooSignalApp.stripeLiveMode
- : getEnv('STRIPE_LIVE_MODE', defaultValue: false);
+ dynamic rsp = {};
+ // // CHECKOUT HELPER
+ await checkout(taxRate, (total, billingDetails, cart) async {
+ Map address = {
+ "name": billingDetails.billingAddress.nameFull(),
+ "line1": billingDetails.shippingAddress.addressLine,
+ "city": billingDetails.shippingAddress.city,
+ "postal_code": billingDetails.shippingAddress.postalCode,
+ "country":
+ (billingDetails.shippingAddress?.customerCountry?.name ?? "")
+ };
- // CONFIGURE STRIPE
- FlutterStripePayment.setStripeSettings(
- stripeAccount: getEnv('STRIPE_ACCOUNT'), liveMode: liveMode);
+ String cartShortDesc = await cart.cartShortDesc();
- PaymentResponse paymentResponse =
- await FlutterStripePayment.addPaymentMethod();
+ rsp = await appWooSignal((api) =>
+ api.stripePaymentIntent(
+ amount: total,
+ email: billingDetails.billingAddress.emailAddress,
+ desc: cartShortDesc,
+ shipping: address,
+ ));
+ });
- // CHECK STATUS FROM STRIPE
- if (paymentResponse.status == PaymentResponseStatus.succeeded) {
- state.reloadState(showLoader: true);
-
- // CHECKOUT HELPER
- await checkout(taxRate, (total, billingDetails, cart) async {
- Map address = {
- "name": billingDetails.billingAddress.nameFull(),
- "line1": billingDetails.shippingAddress.addressLine,
- "city": billingDetails.shippingAddress.city,
- "postal_code": billingDetails.shippingAddress.postalCode,
- "country":
- (billingDetails.shippingAddress?.customerCountry?.name ?? "")
- };
-
- String cartShortDesc = await cart.cartShortDesc();
-
- dynamic rsp = await appWooSignal((api) => api.stripePaymentIntent(
- amount: total,
- email: billingDetails.billingAddress.emailAddress,
- desc: cartShortDesc,
- shipping: address,
- ));
-
- if (rsp == null) {
- showToastNotification(context,
- title: trans(context, "Oops!"),
- description:
- trans(context, "Something went wrong, please try again."),
- icon: Icons.payment,
- style: ToastNotificationStyleType.WARNING);
- state.reloadState(showLoader: false);
- return;
- }
-
- String clientSecret = rsp["client_secret"];
- var intentResponse = await FlutterStripePayment.confirmPaymentIntent(
- clientSecret,
- paymentResponse.paymentMethodId,
- (double.parse(total) * 100),
- );
-
- if (intentResponse.status == PaymentResponseStatus.succeeded) {
- OrderWC orderWC = await buildOrderWC(taxRate: taxRate);
- Order order = await appWooSignal((api) => api.createOrder(orderWC));
-
- if (order != null) {
- Navigator.pushNamed(context, "/checkout-status", arguments: order);
- } else {
- showToastNotification(
- context,
- title: trans(context, "Error"),
- description: trans(context,
- "Something went wrong, please contact our store"),
- );
- state.reloadState(showLoader: false);
- }
- } else if (intentResponse.status == PaymentResponseStatus.failed) {
- if (getEnv('APP_DEBUG', defaultValue: true)) {
- NyLogger.error(intentResponse.errorMessage);
- }
- showToastNotification(
- context,
- title: trans(context, "Error"),
- description: intentResponse.errorMessage,
- );
- state.reloadState(showLoader: false);
- } else {
- state.reloadState(showLoader: false);
- }
- });
- } else {
+ if (rsp == null) {
+ showToastNotification(context,
+ title: trans(context, "Oops!"),
+ description:
+ trans(context, "Something went wrong, please try again."),
+ icon: Icons.payment,
+ style: ToastNotificationStyleType.WARNING);
state.reloadState(showLoader: false);
+ return;
}
+
+ Stripe.instance.initPaymentSheet(paymentSheetParameters: SetupPaymentSheetParameters(
+ applePay: false,
+ googlePay: false,
+ style: Theme.of(state.context).brightness == Brightness.light ? ThemeMode.light : ThemeMode.dark,
+ testEnv: liveMode,
+ merchantCountryCode: getEnv('STRIPE_COUNTRY_CODE', defaultValue: 'GB'),
+ merchantDisplayName: getEnv('APP_NAME'),
+ paymentIntentClientSecret: rsp['client_secret'],
+ ));
+
+ await Stripe.instance.presentPaymentSheet();
+
+ state.reloadState(showLoader: true);
+
+ OrderWC orderWC = await buildOrderWC(taxRate: taxRate);
+ Order order = await appWooSignal((api) => api.createOrder(orderWC));
+
+ if (order == null) {
+ showToastNotification(
+ context,
+ title: trans(context, "Error"),
+ description: trans(context,
+ "Something went wrong, please contact our store"),
+ );
+ state.reloadState(showLoader: false);
+ return;
+ }
+
+ Navigator.pushNamed(context, "/checkout-status", arguments: order);
+
+ }
+ on StripeException catch(e) {
+ showToastNotification(
+ context,
+ title: trans(context, "Oops!"),
+ description: e.error.localizedMessage,
+ icon: Icons.payment,
+ style: ToastNotificationStyleType.WARNING,
+ );
+ state.reloadState(showLoader: false);
} catch (ex) {
+ if (getEnv('APP_DEBUG', defaultValue: true)) {
+ NyLogger.error(ex.toString());
+ }
showToastNotification(
context,
title: trans(context, "Oops!"),
diff --git a/LabelStoreMax/lib/bootstrap/app.dart b/LabelStoreMax/lib/bootstrap/app.dart
index b6242ea..5adcd26 100644
--- a/LabelStoreMax/lib/bootstrap/app.dart
+++ b/LabelStoreMax/lib/bootstrap/app.dart
@@ -1,25 +1,13 @@
-// Label StoreMax
-//
-// Created by Anthony Gordon.
-// 2021, WooSignal Ltd. All rights reserved.
-//
-
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-
-import 'package:adaptive_theme/adaptive_theme.dart';
import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
-import 'package:nylo_support/localization/app_localization.dart';
+import 'package:nylo_framework/nylo_framework.dart';
// ignore: must_be_immutable
class AppBuild extends StatelessWidget {
- final String initialRoute;
- Brightness defaultBrightness;
+ String initialRoute;
ThemeData themeData;
ThemeData darkTheme;
+ ThemeData lightTheme;
Locale locale;
String title;
bool debugShowCheckedModeBanner;
@@ -40,16 +28,15 @@ class AppBuild extends StatelessWidget {
InitialRouteListFactory onGenerateInitialRoutes;
GlobalKey navigatorKey;
- final Route Function(RouteSettings settings) onGenerateRoute;
+ Route Function(RouteSettings settings) onGenerateRoute;
AppBuild({
Key key,
this.initialRoute,
this.title,
- this.defaultBrightness,
- this.locale,
+ @required this.locale,
this.themeData,
- this.onGenerateRoute,
+ @required this.onGenerateRoute,
this.navigatorKey,
this.onGenerateInitialRoutes,
this.onUnknownRoute,
@@ -57,6 +44,7 @@ class AppBuild extends StatelessWidget {
this.builder,
this.onGenerateTitle,
this.color,
+ this.lightTheme,
this.darkTheme,
this.themeMode = ThemeMode.system,
this.supportedLocales = const [Locale('en', 'US')],
@@ -72,45 +60,56 @@ class AppBuild extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return AdaptiveTheme(
- light: themeData,
- dark: darkTheme,
- initial: AdaptiveThemeMode.light,
- builder: (theme, darkTheme) => ValueListenableBuilder(
- valueListenable: ValueNotifier(locale),
- builder: (context, Locale locale, _) => MaterialApp(
- navigatorKey: navigatorKey,
- themeMode: themeMode,
- onGenerateTitle: onGenerateTitle,
- onGenerateInitialRoutes: onGenerateInitialRoutes,
- onUnknownRoute: onUnknownRoute,
- builder: builder,
- navigatorObservers: navigatorObservers,
- color: color,
- supportedLocales: supportedLocales,
- debugShowMaterialGrid: debugShowMaterialGrid,
- showPerformanceOverlay: showPerformanceOverlay,
- checkerboardRasterCacheImages: checkerboardRasterCacheImages,
- checkerboardOffscreenLayers: checkerboardOffscreenLayers,
- showSemanticsDebugger: showSemanticsDebugger,
- debugShowCheckedModeBanner: debugShowCheckedModeBanner,
- shortcuts: shortcuts,
- actions: actions,
- title: title ?? "",
- darkTheme: darkTheme,
- initialRoute: initialRoute,
- onGenerateRoute: this.onGenerateRoute,
- locale: locale,
- theme: theme,
- localizationsDelegates: [
- AppLocalizations.delegate,
- GlobalWidgetsLocalizations.delegate,
- GlobalMaterialLocalizations.delegate
- ],
- localeResolutionCallback:
- (Locale locale, Iterable supportedLocales) {
- return locale;
- },
+ return ThemeProvider(
+ themes: [
+ AppTheme(
+ id: "default_light_theme",
+ data: this.lightTheme ?? ThemeData.fallback(),
+ description: 'Light theme'),
+ AppTheme(
+ id: "default_dark_theme",
+ data: this.darkTheme ?? ThemeData.fallback(),
+ description: 'Dark theme'),
+ ],
+ child: ThemeConsumer(
+ child: Builder(
+ builder: (themeContext) => ValueListenableBuilder(
+ valueListenable: ValueNotifier(locale),
+ builder: (context, Locale locale, _) => MaterialApp(
+ navigatorKey: navigatorKey,
+ themeMode: themeMode,
+ onGenerateTitle: onGenerateTitle,
+ onGenerateInitialRoutes: onGenerateInitialRoutes,
+ onUnknownRoute: onUnknownRoute,
+ builder: builder,
+ navigatorObservers: navigatorObservers,
+ color: color,
+ supportedLocales: supportedLocales,
+ debugShowMaterialGrid: debugShowMaterialGrid,
+ showPerformanceOverlay: showPerformanceOverlay,
+ checkerboardRasterCacheImages: checkerboardRasterCacheImages,
+ checkerboardOffscreenLayers: checkerboardOffscreenLayers,
+ showSemanticsDebugger: showSemanticsDebugger,
+ debugShowCheckedModeBanner: debugShowCheckedModeBanner,
+ shortcuts: shortcuts,
+ actions: actions,
+ title: title ?? "",
+ darkTheme: darkTheme,
+ initialRoute: initialRoute,
+ onGenerateRoute: this.onGenerateRoute,
+ locale: locale,
+ theme: themeData ?? ThemeProvider.themeOf(themeContext).data,
+ localizationsDelegates: [
+ AppLocalizations.delegate,
+ GlobalWidgetsLocalizations.delegate,
+ GlobalMaterialLocalizations.delegate
+ ],
+ localeResolutionCallback:
+ (Locale locale, Iterable supportedLocales) {
+ return locale;
+ },
+ ),
+ ),
),
),
);
diff --git a/LabelStoreMax/lib/config/app_payment_gateways.dart b/LabelStoreMax/lib/config/app_payment_gateways.dart
index c926995..146f328 100644
--- a/LabelStoreMax/lib/config/app_payment_gateways.dart
+++ b/LabelStoreMax/lib/config/app_payment_gateways.dart
@@ -1,7 +1,6 @@
import 'package:flutter_app/app/models/payment_type.dart';
import 'package:flutter_app/app/providers/cash_on_delivery.dart';
import 'package:flutter_app/app/providers/paypal_pay.dart';
-import 'package:flutter_app/app/providers/razor_pay.dart';
import 'package:flutter_app/app/providers/stripe_pay.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
@@ -14,8 +13,8 @@ import 'package:flutter_app/bootstrap/helpers.dart';
|--------------------------------------------------------------------------
*/
-const app_payment_gateways = ["Stripe"];
-// Available: "Stripe", "CashOnDelivery", "RazorPay", "PayPal"
+const app_payment_gateways = ["Stripe", "CashOnDelivery", "PayPal"];
+// Available: "Stripe", "CashOnDelivery", "PayPal"
// e.g. app_payment_gateways = ["Stripe", "CashOnDelivery"]; will only use Stripe and Cash on Delivery.
List paymentTypeList = [
@@ -35,14 +34,6 @@ List paymentTypeList = [
pay: cashOnDeliveryPay,
),
- addPayment(
- id: 3,
- name: "RazorPay",
- desc: "Debit or Credit Card",
- assetImage: "razorpay.png",
- pay: razorPay,
- ),
-
addPayment(
id: 4,
name: "PayPal",
diff --git a/LabelStoreMax/lib/config/app_theme.dart b/LabelStoreMax/lib/config/app_theme.dart
index 7341c78..8340c67 100644
--- a/LabelStoreMax/lib/config/app_theme.dart
+++ b/LabelStoreMax/lib/config/app_theme.dart
@@ -1,62 +1,43 @@
import 'package:flutter/material.dart';
+import 'package:flutter_app/resources/themes/styles/dark_theme_colors.dart';
+import 'package:flutter_app/resources/themes/styles/light_theme_colors.dart';
+import 'package:flutter_app/resources/themes/styles/theme_styles.dart';
import 'package:google_fonts/google_fonts.dart';
/*
|--------------------------------------------------------------------------
-| APP THEME
+| Theme Font
|
-| Change the font and colors for your themes.
+| Uses Google Fonts - https://pub.dev/packages/google_fonts
+|
+| e.g. updating the font from "montserrat" to "lato"
+| before: final TextStyle appThemeFont = GoogleFonts.montserrat();
+| after: final TextStyle appThemeFont = GoogleFonts.lato();
|--------------------------------------------------------------------------
*/
-// Theme main font
final TextStyle appThemeFont = GoogleFonts.overpass();
-// Theme colors
-class AppColors {
- // MAIN
- Color _mainLightColor = Color(0xFF232c33);
- Color _mainDarkColor = Color(0xFFFAFAFA);
+// e.g. custom font in pubspec.yaml - https://flutter.dev/docs/cookbook/design/fonts
+// final TextStyle appThemeFont = TextStyle(fontFamily: "ZenTokyoZoo");
- // SECONDARY
- Color _secondLightColor = Color(0xFF232c33);
- Color _secondDarkColor = Color(0xFFF1F1F1);
+/*
+|--------------------------------------------------------------------------
+| Theme Colors
+|
+| Customize your theme's light and dark themes: /lib/config/styles/
+|--------------------------------------------------------------------------
+*/
- // ACCENT
- Color _accentLightColor = Color(0xFF465f81);
- Color _accentDarkColor = Color(0xFF4a4a4a);
+class NyColors {
+ // Light Colors
+ static LightThemeColors light = LightThemeColors();
- // SCAFFOLD
- Color _scaffoldDarkColor = Color(0xFF2C2C2C);
- Color _scaffoldLightColor = Color(0xFFFAFAFA);
-}
+ // Dark Colors
+ static DarkThemeColors dark = DarkThemeColors();
-class AppTheme extends AppColors {
- Color mainColor(
- {double opacity = 1, Brightness brightness = Brightness.light}) {
- return (brightness == Brightness.light
- ? _mainLightColor.withOpacity(opacity)
- : _mainDarkColor.withOpacity(opacity));
+ /// helper to find correct theme from the [context].
+ static BaseStyles of(BuildContext context) {
+ return ((Theme.of(context).brightness == Brightness.dark) ? dark : light);
}
-
- Color secondColor(
- {double opacity = 1, Brightness brightness = Brightness.light}) {
- return (brightness == Brightness.light
- ? _secondLightColor.withOpacity(opacity)
- : _secondDarkColor.withOpacity(opacity));
- }
-
- Color accentColor(
- {double opacity = 1, Brightness brightness = Brightness.light}) {
- return (brightness == Brightness.light
- ? _accentLightColor.withOpacity(opacity)
- : _accentDarkColor.withOpacity(opacity));
- }
-
- Color scaffoldColor(
- {double opacity = 1, Brightness brightness = Brightness.light}) {
- return (brightness == Brightness.light
- ? _scaffoldLightColor.withOpacity(opacity)
- : _scaffoldDarkColor.withOpacity(opacity));
- }
-}
+}
\ No newline at end of file
diff --git a/LabelStoreMax/lib/main.dart b/LabelStoreMax/lib/main.dart
index 92c7096..b394c8a 100644
--- a/LabelStoreMax/lib/main.dart
+++ b/LabelStoreMax/lib/main.dart
@@ -5,22 +5,17 @@ import 'package:flutter_app/bootstrap/app_helper.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/config/app_locale.dart';
import 'package:flutter_app/resources/themes/dark_theme.dart';
-import 'package:flutter_app/resources/themes/default_theme.dart';
-import 'package:flutter_app/config/app_theme.dart';
+import 'package:flutter_app/resources/themes/light_theme.dart';
import 'package:flutter_app/routes/router.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_support/nylo.dart';
import 'package:nylo_framework/nylo_framework.dart';
-import 'package:nylo_framework/theme/helper/theme_helper.dart';
import 'package:woosignal/models/response/woosignal_app.dart';
import 'package:wp_json_api/wp_json_api.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
- AppTheme appTheme = AppTheme();
-
- Nylo nylo =
- await initNylo(theme: defaultTheme(appTheme), router: buildRouter());
+ Nylo nylo = await Nylo.init(router: appRouter());
await SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
@@ -43,12 +38,10 @@ void main() async {
);
}
- if (locale == null) {
- if (wooSignalApp.locale != null) {
- locale = Locale(wooSignalApp.locale);
- } else {
- locale = Locale(getEnv('DEFAULT_LOCALE', defaultValue: 'en'));
- }
+ if (locale == null && wooSignalApp.locale != null) {
+ locale = Locale(wooSignalApp.locale);
+ } else {
+ locale = Locale(getEnv('DEFAULT_LOCALE', defaultValue: 'en'));
}
}
@@ -56,8 +49,8 @@ void main() async {
AppBuild(
navigatorKey: nylo.router.navigatorKey,
onGenerateRoute: nylo.router.generator(),
- themeData: CurrentTheme.instance.theme,
- darkTheme: darkTheme(appTheme),
+ lightTheme: lightTheme(),
+ darkTheme: darkTheme(),
locale: locale,
initialRoute: initialRoute,
supportedLocales: app_locales_supported,
diff --git a/LabelStoreMax/lib/resources/pages/account_billing_details.dart b/LabelStoreMax/lib/resources/pages/account_billing_details.dart
index 98bd2e4..bea7861 100644
--- a/LabelStoreMax/lib/resources/pages/account_billing_details.dart
+++ b/LabelStoreMax/lib/resources/pages/account_billing_details.dart
@@ -8,7 +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:adaptive_theme/adaptive_theme.dart';
+
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
@@ -33,8 +33,6 @@ class AccountBillingDetailsPage extends StatefulWidget {
class _AccountBillingDetailsPageState extends State {
_AccountBillingDetailsPageState();
- AppTheme _appTheme = AppTheme();
-
// BILLING TEXT CONTROLLERS
TextEditingController _txtShippingFirstName = TextEditingController(),
_txtShippingLastName = TextEditingController(),
@@ -75,14 +73,12 @@ class _AccountBillingDetailsPageState extends State {
@override
Widget build(BuildContext context) {
- AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode;
+
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
- backgroundColor: Colors.transparent,
title: Text(
- trans(context, "Billing Details"),
- style: Theme.of(context).textTheme.headline6,
+ trans(context, "Billing Details")
),
centerTitle: true,
),
@@ -165,13 +161,12 @@ class _AccountBillingDetailsPageState extends State {
],
),
decoration: BoxDecoration(
- color: adaptiveTheme.isLight
- ? Colors.white
- : _appTheme.accentColor(
- brightness: Brightness.dark),
+ color: (Theme.of(context).brightness == Brightness.light)
+ ? NyColors.light.background
+ : NyColors.dark.primaryAccent,
borderRadius: BorderRadius.circular(10),
boxShadow:
- adaptiveTheme.isLight ? wsBoxShadow() : null,
+ (Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
),
padding: EdgeInsets.all(8),
),
diff --git a/LabelStoreMax/lib/resources/pages/account_detail.dart b/LabelStoreMax/lib/resources/pages/account_detail.dart
index 5f7debd..bc997e2 100644
--- a/LabelStoreMax/lib/resources/pages/account_detail.dart
+++ b/LabelStoreMax/lib/resources/pages/account_detail.dart
@@ -8,12 +8,13 @@
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-import 'package:adaptive_theme/adaptive_theme.dart';
+
import 'package:bubble_tab_indicator/bubble_tab_indicator.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/bootstrap/shared_pref/sp_auth.dart';
+import 'package:flutter_app/config/app_theme.dart';
import 'package:flutter_app/resources/widgets/app_loader_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:hexcolor/hexcolor.dart';
@@ -100,10 +101,9 @@ class _AccountDetailPageState extends State
new Tab(text: trans(context, "Orders")),
new Tab(text: trans(context, "Settings")),
];
- AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode;
+
return Scaffold(
appBar: AppBar(
- backgroundColor: Colors.transparent,
leading: widget.showLeadingBackButton ? Container(
child: IconButton(
icon: Icon(Icons.arrow_back_ios),
@@ -112,8 +112,7 @@ class _AccountDetailPageState extends State
margin: EdgeInsets.only(left: 0),
) : Container(),
title: Text(
- trans(context, "Account"),
- style: Theme.of(context).textTheme.headline6,
+ trans(context, "Account")
),
centerTitle: true,
),
@@ -206,9 +205,8 @@ class _AccountDetailPageState extends State
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
- boxShadow: adaptiveTheme.isLight ? wsBoxShadow() : null,
- color:
- adaptiveTheme.isLight ? Colors.white : Colors.white70,
+ boxShadow: (Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
+ color: NyColors.of(context).backgroundContainer,
),
),
Expanded(child: _activeBody),
diff --git a/LabelStoreMax/lib/resources/pages/account_landing.dart b/LabelStoreMax/lib/resources/pages/account_landing.dart
index 06cedcc..46dbe57 100644
--- a/LabelStoreMax/lib/resources/pages/account_landing.dart
+++ b/LabelStoreMax/lib/resources/pages/account_landing.dart
@@ -8,7 +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:adaptive_theme/adaptive_theme.dart';
+
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/app/models/user.dart';
@@ -27,7 +27,8 @@ import 'package:wp_json_api/models/responses/wp_user_login_response.dart';
import 'package:wp_json_api/wp_json_api.dart';
class AccountLandingPage extends StatefulWidget {
- AccountLandingPage();
+ final bool showBackButton;
+ AccountLandingPage({this.showBackButton = true});
@override
_AccountLandingPageState createState() => _AccountLandingPageState();
@@ -37,7 +38,6 @@ class _AccountLandingPageState extends State {
bool _hasTappedLogin = false;
TextEditingController _tfEmailController = TextEditingController(),
_tfPasswordController = TextEditingController();
- AppTheme _appTheme = AppTheme();
@override
void initState() {
@@ -46,7 +46,6 @@ class _AccountLandingPageState extends State {
@override
Widget build(BuildContext context) {
- AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode;
return Scaffold(
resizeToAvoidBottomInset: false,
body: SafeArea(
@@ -79,10 +78,8 @@ class _AccountLandingPageState extends State {
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
- boxShadow: adaptiveTheme.isLight ? wsBoxShadow() : null,
- color: adaptiveTheme.isLight
- ? Colors.white
- : _appTheme.accentColor(brightness: Brightness.dark),
+ boxShadow: (Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
+ color: NyColors.of(context).backgroundContainer,
),
padding: EdgeInsets.symmetric(vertical: 18, horizontal: 8),
margin: EdgeInsets.symmetric(horizontal: 16),
@@ -117,7 +114,7 @@ class _AccountLandingPageState extends State {
Icon(
Icons.account_circle,
color:
- adaptiveTheme.isLight ? Colors.black38 : Colors.white70,
+ (Theme.of(context).brightness == Brightness.light) ? Colors.black38 : Colors.white70,
),
Padding(
child: Text(
@@ -143,12 +140,17 @@ class _AccountLandingPageState extends State {
"No URL found for \"forgot password\".\nAdd your forgot password URL here https://woosignal.com/dashboard/apps");
}
}),
- Divider(),
- LinkButton(
- title: trans(context, "Back"),
- action: () => Navigator.pop(context),
- ),
- ],
+ widget.showBackButton ? Column(
+ children: [
+ Divider(),
+ LinkButton(
+ title: trans(context, "Back"),
+ action: () => Navigator.pop(context),
+ ),
+ ],
+ ) : Padding(padding: EdgeInsets.only(bottom: 20),)
+
+ ].where((element) => element != null).toList(),
),
),
);
diff --git a/LabelStoreMax/lib/resources/pages/account_order_detail.dart b/LabelStoreMax/lib/resources/pages/account_order_detail.dart
index f535835..a2c5f25 100644
--- a/LabelStoreMax/lib/resources/pages/account_order_detail.dart
+++ b/LabelStoreMax/lib/resources/pages/account_order_detail.dart
@@ -8,7 +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:adaptive_theme/adaptive_theme.dart';
+
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/app/controllers/account_order_detail_controller.dart';
@@ -44,10 +44,9 @@ class _AccountOrderDetailPageState extends NyState {
@override
Widget build(BuildContext context) {
- AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode;
+
return Scaffold(
appBar: AppBar(
- backgroundColor: Colors.transparent,
leading: Container(
child: IconButton(
icon: Icon(Icons.arrow_back_ios),
@@ -56,8 +55,7 @@ class _AccountOrderDetailPageState extends NyState {
margin: EdgeInsets.only(left: 0),
),
title: Text(
- "${trans(context, "Order").capitalize()} #${_orderId.toString()}",
- style: Theme.of(context).textTheme.headline6,
+ "${trans(context, "Order").capitalize()} #${_orderId.toString()}"
),
centerTitle: true,
),
@@ -110,8 +108,8 @@ class _AccountOrderDetailPageState extends NyState {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
boxShadow:
- adaptiveThemeMode.isLight ? wsBoxShadow() : null,
- color: adaptiveThemeMode.isLight
+ (Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
+ color: (Theme.of(context).brightness == Brightness.light)
? Colors.white
: Color(0xFF2C2C2C),
),
diff --git a/LabelStoreMax/lib/resources/pages/account_register.dart b/LabelStoreMax/lib/resources/pages/account_register.dart
index c305104..3245c4b 100644
--- a/LabelStoreMax/lib/resources/pages/account_register.dart
+++ b/LabelStoreMax/lib/resources/pages/account_register.dart
@@ -8,7 +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:adaptive_theme/adaptive_theme.dart';
+
import 'package:flutter/material.dart';
import 'package:flutter_app/app/models/user.dart';
import 'package:flutter_app/bootstrap/app_helper.dart';
@@ -54,17 +54,15 @@ class _AccountRegistrationPageState extends State {
@override
Widget build(BuildContext context) {
- AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode;
+
return Scaffold(
appBar: AppBar(
- backgroundColor: Colors.transparent,
leading: IconButton(
icon: Icon(Icons.close),
onPressed: () => Navigator.pop(context),
),
title: Text(
- "Register",
- style: Theme.of(context).textTheme.headline6,
+ trans(context, "Register")
),
centerTitle: true,
),
@@ -131,7 +129,7 @@ class _AccountRegistrationPageState extends State {
style: TextStyle(fontWeight: FontWeight.bold)),
],
style: TextStyle(
- color: adaptiveTheme.isLight
+ color: (Theme.of(context).brightness == Brightness.light)
? Colors.black45
: Colors.white70),
),
diff --git a/LabelStoreMax/lib/resources/pages/account_shipping_details.dart b/LabelStoreMax/lib/resources/pages/account_shipping_details.dart
index f85d82b..6cfd887 100644
--- a/LabelStoreMax/lib/resources/pages/account_shipping_details.dart
+++ b/LabelStoreMax/lib/resources/pages/account_shipping_details.dart
@@ -8,7 +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:adaptive_theme/adaptive_theme.dart';
+
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
@@ -34,8 +34,6 @@ class _AccountShippingDetailsPageState
extends State {
_AccountShippingDetailsPageState();
- AppTheme _appTheme = AppTheme();
-
// BILLING TEXT CONTROLLERS
TextEditingController _txtShippingFirstName = TextEditingController(),
_txtShippingLastName = TextEditingController(),
@@ -91,14 +89,12 @@ class _AccountShippingDetailsPageState
@override
Widget build(BuildContext context) {
- AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode;
+
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
- backgroundColor: Colors.transparent,
title: Text(
- trans(context, "Shipping Details"),
- style: Theme.of(context).textTheme.headline6,
+ trans(context, "Shipping Details")
),
centerTitle: true,
),
@@ -182,13 +178,12 @@ class _AccountShippingDetailsPageState
],
),
decoration: BoxDecoration(
- color: adaptiveTheme.isLight
- ? Colors.white
- : _appTheme.accentColor(
- brightness: Brightness.dark),
+ color: (Theme.of(context).brightness == Brightness.light)
+ ? NyColors.light.background
+ : NyColors.dark.primaryAccent,
borderRadius: BorderRadius.circular(10),
boxShadow:
- adaptiveTheme.isLight ? wsBoxShadow() : null,
+ (Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
),
padding: EdgeInsets.all(8),
),
diff --git a/LabelStoreMax/lib/resources/pages/browse_category.dart b/LabelStoreMax/lib/resources/pages/browse_category.dart
index 79acbfc..2a4957d 100644
--- a/LabelStoreMax/lib/resources/pages/browse_category.dart
+++ b/LabelStoreMax/lib/resources/pages/browse_category.dart
@@ -83,15 +83,13 @@ class _BrowseCategoryPageState extends NyState {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
- backgroundColor: Colors.transparent,
title: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(trans(context, "Browse"),
style: Theme.of(context).textTheme.subtitle1),
- Text(parseHtmlString(productCategory.name),
- style: Theme.of(context).textTheme.headline6)
+ Text(parseHtmlString(productCategory.name))
],
),
centerTitle: true,
diff --git a/LabelStoreMax/lib/resources/pages/browse_search.dart b/LabelStoreMax/lib/resources/pages/browse_search.dart
index 97ffd6b..90eb3d7 100644
--- a/LabelStoreMax/lib/resources/pages/browse_search.dart
+++ b/LabelStoreMax/lib/resources/pages/browse_search.dart
@@ -77,15 +77,13 @@ class _BrowseSearchState extends NyState {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
- backgroundColor: Colors.transparent,
title: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(trans(context, "Search results for"),
style: Theme.of(context).textTheme.subtitle1),
- Text("\"" + _search + "\"",
- style: Theme.of(context).textTheme.headline6)
+ Text("\"" + _search + "\"")
],
),
centerTitle: true,
diff --git a/LabelStoreMax/lib/resources/pages/cart.dart b/LabelStoreMax/lib/resources/pages/cart.dart
index 2de6472..cb47109 100644
--- a/LabelStoreMax/lib/resources/pages/cart.dart
+++ b/LabelStoreMax/lib/resources/pages/cart.dart
@@ -187,9 +187,7 @@ class _CartPageState extends State {
appBar: AppBar(
title: Text(
trans(context, "Shopping Cart"),
- style: Theme.of(context).appBarTheme.textTheme.headline6,
),
- textTheme: Theme.of(context).textTheme,
elevation: 1,
actions: [
InkWell(
@@ -199,7 +197,7 @@ class _CartPageState extends State {
child: Padding(
child: Text(
trans(context, "Clear Cart"),
- style: Theme.of(context).textTheme.bodyText1,
+ style: Theme.of(context).textTheme.bodyText2,
),
padding: EdgeInsets.only(right: 8),
),
diff --git a/LabelStoreMax/lib/resources/pages/checkout_confirmation.dart b/LabelStoreMax/lib/resources/pages/checkout_confirmation.dart
index c0cb649..40c4216 100644
--- a/LabelStoreMax/lib/resources/pages/checkout_confirmation.dart
+++ b/LabelStoreMax/lib/resources/pages/checkout_confirmation.dart
@@ -8,7 +8,6 @@
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-import 'package:adaptive_theme/adaptive_theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/app/models/cart.dart';
import 'package:flutter_app/app/models/checkout_session.dart';
@@ -16,6 +15,7 @@ import 'package:flutter_app/app/models/customer_address.dart';
import 'package:flutter_app/app/models/customer_country.dart';
import 'package:flutter_app/bootstrap/app_helper.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
+import 'package:flutter_app/config/app_theme.dart';
import 'package:flutter_app/resources/widgets/app_loader_widget.dart';
import 'package:flutter_app/resources/widgets/buttons.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
@@ -178,16 +178,10 @@ class CheckoutConfirmationPageState extends State {
@override
Widget build(BuildContext context) {
- AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode;
return Scaffold(
appBar: AppBar(
- backgroundColor: Colors.transparent,
title: Text(
- trans(context, "Checkout"),
- style: Theme.of(context)
- .textTheme
- .subtitle1
- .copyWith(fontWeight: FontWeight.bold),
+ trans(context, "Checkout")
),
centerTitle: true,
),
@@ -203,12 +197,10 @@ class CheckoutConfirmationPageState extends State {
child: Container(
padding: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
- color: adaptiveThemeMode.isLight
- ? Colors.white
- : Colors.white54,
+ color: NyColors.of(context).backgroundContainer,
borderRadius: BorderRadius.circular(10),
boxShadow:
- adaptiveThemeMode.isLight ? wsBoxShadow() : null,
+ (Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
),
margin: EdgeInsets.only(top: 5, bottom: 5),
child: Column(
@@ -217,7 +209,7 @@ class CheckoutConfirmationPageState extends State {
children: [
Container(
decoration: BoxDecoration(
- boxShadow: adaptiveThemeMode.isLight
+ boxShadow: (Theme.of(context).brightness == Brightness.light)
? wsBoxShadow(blurRadius: 10)
: null,
color: Colors.transparent,
@@ -258,13 +250,13 @@ class CheckoutConfirmationPageState extends State {
(CheckoutSession.getInstance.paymentType != null
? wsCheckoutRow(context,
heading: trans(context, "Payment method"),
- leadImage: Image.asset(
- getImageAsset(CheckoutSession
- .getInstance.paymentType.assetImage),
- width: 70,
- color: adaptiveThemeMode.isLight
- ? null
- : Colors.white,
+ leadImage: Container(
+ color: Colors.white,
+ child: Image.asset(
+ getImageAsset(CheckoutSession
+ .getInstance.paymentType.assetImage),
+ width: 70,
+ ),
),
leadTitle: CheckoutSession
.getInstance.paymentType.desc,
@@ -386,7 +378,7 @@ class CheckoutConfirmationPageState extends State {
return;
}
- if (_wooSignalApp.disableShipping == 1 &&
+ if (_wooSignalApp.disableShipping == 0 &&
CheckoutSession.getInstance.shippingType == null) {
showToastNotification(
context,
@@ -411,7 +403,7 @@ class CheckoutConfirmationPageState extends State {
return;
}
- if (_wooSignalApp.disableShipping != 1 &&
+ if (_wooSignalApp.disableShipping == 0 &&
CheckoutSession.getInstance.shippingType?.minimumValue != null) {
String total = await Cart.getInstance.getTotal();
if (total == null) {
diff --git a/LabelStoreMax/lib/resources/pages/checkout_details.dart b/LabelStoreMax/lib/resources/pages/checkout_details.dart
index 4b50f79..8d38ae6 100644
--- a/LabelStoreMax/lib/resources/pages/checkout_details.dart
+++ b/LabelStoreMax/lib/resources/pages/checkout_details.dart
@@ -8,7 +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:adaptive_theme/adaptive_theme.dart';
+
import 'package:flutter/material.dart';
import 'package:flutter_app/app/models/billing_details.dart';
import 'package:flutter_app/app/models/checkout_session.dart';
@@ -34,7 +34,6 @@ class _CheckoutDetailsPageState extends State {
bool _hasDifferentShippingAddress = false, valRememberDetails = true;
int activeTabIndex = 0;
- AppTheme _appTheme = AppTheme();
// TEXT CONTROLLERS
TextEditingController
@@ -158,14 +157,11 @@ class _CheckoutDetailsPageState extends State {
@override
Widget build(BuildContext context) {
- AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode;
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
- backgroundColor: Colors.transparent,
title: Text(
trans(context, "Billing & Shipping Details"),
- style: Theme.of(context).textTheme.headline6,
),
centerTitle: true,
),
@@ -229,13 +225,10 @@ class _CheckoutDetailsPageState extends State {
fit: FlexFit.tight,
child: Container(
decoration: BoxDecoration(
- color: adaptiveThemeMode.isLight
- ? Colors.white
- : _appTheme.accentColor(
- brightness: Brightness.dark),
+ color: NyColors.of(context).backgroundContainer,
borderRadius: BorderRadius.circular(10),
boxShadow:
- adaptiveThemeMode.isLight ? wsBoxShadow() : null,
+ (Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
),
padding: EdgeInsets.only(left: 8, right: 8, top: 8),
child: (activeTab ?? tabBillingDetails()),
diff --git a/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart b/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart
index 6a685f1..5470ae0 100644
--- a/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart
+++ b/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart
@@ -8,7 +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:adaptive_theme/adaptive_theme.dart';
+
import 'package:flutter/material.dart';
import 'package:flutter_app/app/models/checkout_session.dart';
import 'package:flutter_app/app/models/payment_type.dart';
@@ -29,8 +29,6 @@ class CheckoutPaymentTypePage extends StatefulWidget {
class _CheckoutPaymentTypePageState extends State {
_CheckoutPaymentTypePageState();
- AppTheme _appTheme = AppTheme();
-
@override
void initState() {
super.initState();
@@ -44,14 +42,12 @@ class _CheckoutPaymentTypePageState extends State {
@override
Widget build(BuildContext context) {
- AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode;
+
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
- backgroundColor: Colors.transparent,
title: Text(
- trans(context, "Payment Method"),
- style: Theme.of(context).textTheme.headline6,
+ trans(context, "Payment Method")
),
automaticallyImplyLeading: false,
centerTitle: true,
@@ -91,14 +87,18 @@ class _CheckoutPaymentTypePageState extends State {
left: 8,
right: 8,
),
- leading: Image.asset(
- getImageAsset(paymentType.assetImage),
- width: 60,
- color: adaptiveThemeMode.isLight
- ? null
- : Colors.white,
- fit: BoxFit.contain,
- alignment: Alignment.center),
+ leading: Container(
+ decoration: BoxDecoration(
+ color: Colors.white
+ ),
+ padding: EdgeInsets.all(4),
+ child: Image.asset(
+ getImageAsset(paymentType.assetImage),
+ width: 60,
+ fit: BoxFit.contain,
+ alignment: Alignment.center,
+ ),
+ ),
title: Text(paymentType.desc,
style:
Theme.of(context).textTheme.subtitle1),
@@ -127,12 +127,10 @@ class _CheckoutPaymentTypePageState extends State {
],
),
decoration: BoxDecoration(
- color: adaptiveThemeMode.isLight
- ? Colors.white
- : _appTheme.accentColor(brightness: Brightness.dark),
+ color: NyColors.of(context).backgroundContainer,
borderRadius: BorderRadius.circular(10),
boxShadow:
- adaptiveThemeMode.isLight ? wsBoxShadow() : null,
+ (Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
),
padding: EdgeInsets.all(8),
),
diff --git a/LabelStoreMax/lib/resources/pages/checkout_shipping_type.dart b/LabelStoreMax/lib/resources/pages/checkout_shipping_type.dart
index 1b03aed..ffa14ec 100644
--- a/LabelStoreMax/lib/resources/pages/checkout_shipping_type.dart
+++ b/LabelStoreMax/lib/resources/pages/checkout_shipping_type.dart
@@ -8,7 +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:adaptive_theme/adaptive_theme.dart';
+
import 'package:flutter/material.dart';
import 'package:flutter_app/app/models/cart.dart';
import 'package:flutter_app/app/models/cart_line_item.dart';
@@ -35,7 +35,6 @@ class CheckoutShippingTypePage extends StatefulWidget {
class _CheckoutShippingTypePageState extends State {
_CheckoutShippingTypePageState();
- AppTheme _appTheme = AppTheme();
bool _isShippingSupported = true, _isLoading = true;
List