v5.4.0 - updates

This commit is contained in:
Anthony 2021-12-10 08:50:23 +00:00
parent 1d7b0287c5
commit 6bc9dcd09a
66 changed files with 821 additions and 800 deletions

View File

@ -1,3 +1,10 @@
## [5.4.0] - 2021-12-10
* New localization keys added
* Refactor as per Dart Analysis
* Upgrade to latest Nylo version
* Pubspec.yaml dependency updates
## [5.3.1] - 2021-11-17
* Fix shipping method not handling async call

View File

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

View File

@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -186,5 +186,9 @@
"Must have": "Haben müssen",
"Our selection of new items": "Unsere Auswahl an Neuheiten",
"Register": "Registrieren",
"No payment methods are available": "Es sind keine Zahlungsmethoden verfügbar"
"No payment methods are available": "Es sind keine Zahlungsmethoden verfügbar",
"Please enter a valid billing email": "Bitte geben Sie eine gültige Rechnungs-E-Mail-Adresse ein",
"Please enter a valid shipping email": "Bitte geben Sie eine gültige Versand-E-Mail ein",
"Free postage": "Portofrei",
"PROCESSING": "WIRD BEARBEITET"
}

View File

@ -186,5 +186,9 @@
"Must have": "Must have",
"Our selection of new items": "Our selection of new items",
"Register": "Register",
"No payment methods are available": "No payment methods are available"
"No payment methods are available": "No payment methods are available",
"Please enter a valid billing email": "Please enter a valid billing email",
"Please enter a valid shipping email": "Please enter a valid shipping email",
"Free postage": "Free postage",
"PROCESSING": "PROCESSING"
}

View File

@ -186,5 +186,9 @@
"Must have": "Debe tener",
"Our selection of new items": "Nuestra selección de novedades",
"Register": "Registrarse",
"No payment methods are available": "No hay métodos de pago disponibles."
"No payment methods are available": "No hay métodos de pago disponibles.",
"Please enter a valid billing email": "Ingrese un correo electrónico de facturación válido",
"Please enter a valid shipping email": "Ingrese un correo electrónico de envío válido",
"Free postage": "Gastos de envío gratis",
"PROCESSING": "PROCESANDO"
}

View File

@ -186,5 +186,9 @@
"Must have": "Doit avoir",
"Our selection of new items": "Notre sélection de nouveautés",
"Register": "S'inscrire",
"No payment methods are available": "Aucun mode de paiement n'est disponible"
"No payment methods are available": "Aucun mode de paiement n'est disponible",
"Please enter a valid billing email": "Veuillez saisir une adresse e-mail de facturation valide",
"Please enter a valid shipping email": "Veuillez saisir un e-mail de livraison valide",
"Free postage": "Sans frais de port",
"PROCESSING": "EN TRAITEMENT"
}

View File

@ -186,5 +186,9 @@
"Must have": "hona aavashyak hai",
"Our selection of new items": "naee vastuon ka hamaara chayan",
"Register": "rajistar karen",
"No payment methods are available": "koee bhugataan vidhiyaan upalabdh nahin hain"
"No payment methods are available": "koee bhugataan vidhiyaan upalabdh nahin hain",
"Please enter a valid billing email": "krpaya ek maany biling eemel darj karen",
"Please enter a valid shipping email": "krpaya ek maany shiping eemel darj karen",
"Free postage": "mupht daak",
"PROCESSING": "prasanskaran"
}

View File

@ -186,5 +186,9 @@
"Must have": "Deve avere",
"Our selection of new items": "La nostra selezione di nuovi articoli",
"Register": "Registrati",
"No payment methods are available": "Non sono disponibili metodi di pagamento"
"No payment methods are available": "Non sono disponibili metodi di pagamento",
"Please enter a valid billing email": "Si prega di inserire un'e-mail di fatturazione valida",
"Please enter a valid shipping email": "Si prega di inserire un'e-mail di spedizione valida",
"Free postage": "Spedizione gratuita",
"PROCESSING": "IN LAVORAZIONE"
}

View File

@ -186,5 +186,9 @@
"Must have": "Deve ter",
"Our selection of new items": "Nossa seleção de novos itens",
"Register": "Registro",
"No payment methods are available": "Nenhum método de pagamento disponível"
"No payment methods are available": "Nenhum método de pagamento disponível",
"Please enter a valid billing email": "Por favor, insira um e-mail de faturamento válido",
"Please enter a valid shipping email": "Por favor, insira um e-mail de envio válido",
"Free postage": "Postagem grátis",
"PROCESSING": "EM PROCESSAMENTO"
}

View File

@ -186,5 +186,9 @@
"Must have": "一定有",
"Our selection of new items": "我们精选的新品",
"Register": "登记",
"No payment methods are available": "没有可用的付款方式"
"No payment methods are available": "没有可用的付款方式",
"Please enter a valid billing email": "请输入有效的结算电子邮件",
"Please enter a valid shipping email": "请输入有效的送货电子邮件",
"Free postage": "免邮费",
"PROCESSING": "加工"
}

View File

@ -15,7 +15,7 @@ import 'package:flutter/widgets.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:nylo_framework/nylo_framework.dart';
import 'package:woosignal/models/payload/order_wc.dart';
import 'package:woosignal/models/response/order.dart';
import 'package:woosignal/models/response/tax_rate.dart';
@ -32,16 +32,16 @@ cashOnDeliveryPay(context,
} else {
showToastNotification(
context,
title: trans(context, "Error"),
description: trans(context, "Something went wrong, please contact our store"),
title: trans("Error"),
description: trans("Something went wrong, please contact our store"),
);
state.reloadState(showLoader: false);
}
} catch (_) {
showToastNotification(
context,
title: trans(context, "Error"),
description: trans(context, "Something went wrong, please contact our store"),
title: trans("Error"),
description: trans("Something went wrong, please contact our store"),
);
state.reloadState(showLoader: false);
}

View File

@ -15,7 +15,7 @@ import 'package:flutter/widgets.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:nylo_framework/nylo_framework.dart';
import 'package:woosignal/models/payload/order_wc.dart';
import 'package:woosignal/models/response/order.dart';
import 'package:woosignal/models/response/tax_rate.dart';
@ -52,8 +52,8 @@ examplePay(context,
} else {
showToastNotification(
context,
title: trans(context, "Error"),
description: trans(context, "Something went wrong, please contact our store"),
title: trans("Error"),
description: trans("Something went wrong, please contact our store"),
);
state.reloadState(showLoader: false);
}

View File

@ -12,13 +12,12 @@
//
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_app/app/models/cart_line_item.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_app/resources/widgets/checkout_paypal.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:woosignal/models/payload/order_wc.dart';
import 'package:woosignal/models/response/order.dart';
import 'package:woosignal/models/response/tax_rate.dart';
@ -39,9 +38,9 @@ payPalPay(context,
if (!(value is Map<String, dynamic>)) {
showToastNotification(
context,
title: trans(context, "Payment Cancelled"),
title: trans("Payment Cancelled"),
description:
trans(context, "The payment has been cancelled"),
trans("The payment has been cancelled"),
);
state.reloadState(showLoader: false);
return;
@ -56,9 +55,8 @@ payPalPay(context,
if (order == null) {
showToastNotification(
context,
title: trans(context, "Error"),
description: trans(context,
"Something went wrong, please contact our store"),
title: trans("Error"),
description: trans("Something went wrong, please contact our store"),
);
return;
}
@ -67,8 +65,8 @@ payPalPay(context,
} else {
showToastNotification(
context,
title: trans(context, "Payment Cancelled"),
description: trans(context, "The payment has been cancelled"),
title: trans("Payment Cancelled"),
description: trans("The payment has been cancelled"),
);
}
}

View File

@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/bootstrap/app_helper.dart';
import 'package:flutter_app/bootstrap/data/order_wc.dart';
@ -19,7 +18,6 @@ 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';
@ -70,9 +68,9 @@ stripePay(context,
if (rsp == null) {
showToastNotification(context,
title: trans(context, "Oops!"),
title: trans("Oops!"),
description:
trans(context, "Something went wrong, please try again."),
trans("Something went wrong, please try again."),
icon: Icons.payment,
style: ToastNotificationStyleType.WARNING);
state.reloadState(showLoader: false);
@ -99,9 +97,8 @@ stripePay(context,
if (order == null) {
showToastNotification(
context,
title: trans(context, "Error"),
description: trans(context,
"Something went wrong, please contact our store"),
title: trans("Error"),
description: trans("Something went wrong, please contact our store"),
);
state.reloadState(showLoader: false);
return;
@ -115,7 +112,7 @@ stripePay(context,
}
showToastNotification(
context,
title: trans(context, "Oops!"),
title: trans("Oops!"),
description: e.error.localizedMessage,
icon: Icons.payment,
style: ToastNotificationStyleType.WARNING,
@ -127,8 +124,8 @@ stripePay(context,
}
showToastNotification(
context,
title: trans(context, "Oops!"),
description: trans(context, "Something went wrong, please try again."),
title: trans("Oops!"),
description: trans("Something went wrong, please try again."),
icon: Icons.payment,
style: ToastNotificationStyleType.WARNING,
);

View File

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_app/config/app_theme.dart';
import 'package:nylo_framework/nylo_framework.dart';
// ignore: must_be_immutable
@ -60,54 +60,43 @@ class AppBuild extends StatelessWidget {
@override
Widget build(BuildContext context) {
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<Locale> supportedLocales) {
return locale;
},
return LocalizedApp(
child: ThemeProvider(
themes: appThemes.map((appTheme) => appTheme.toAppTheme(defaultTheme: appTheme.theme.brightness == Brightness.light ? lightTheme : darkTheme)).toList(),
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,
debugShowMaterialGrid: debugShowMaterialGrid,
showPerformanceOverlay: showPerformanceOverlay,
checkerboardRasterCacheImages: checkerboardRasterCacheImages,
checkerboardOffscreenLayers: checkerboardOffscreenLayers,
showSemanticsDebugger: showSemanticsDebugger,
debugShowCheckedModeBanner: debugShowCheckedModeBanner,
shortcuts: shortcuts,
actions: actions,
title: title ?? "",
initialRoute: initialRoute,
onGenerateRoute: this.onGenerateRoute,
darkTheme: this.darkTheme == null ? ThemeConfig.dark().theme : this.darkTheme,
theme: themeData ?? ThemeProvider.themeOf(context).data,
localeResolutionCallback:
(Locale locale, Iterable<Locale> supportedLocales) {
return locale;
},
localizationsDelegates: NyLocalization.instance.delegates,
locale: NyLocalization.instance.locale,
supportedLocales: supportedLocales ?? NyLocalization.instance.locals(),
),
),
),
),

View File

@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter_app/resources/themes/styles/base_styles.dart';
import 'package:nylo_framework/nylo_framework.dart';
class BaseThemeConfig {
final String id;
final String description;
final ThemeData theme;
final BaseColorStyles colors;
final dynamic meta;
BaseThemeConfig({this.id, this.description, this.theme, this.colors, this.meta = const {}});
AppTheme toAppTheme({ThemeData defaultTheme}) => AppTheme(
id: this.id,
data: defaultTheme == null ? this.theme : defaultTheme,
description: this.description,
);
}

View File

@ -9,7 +9,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import 'dart:convert';
import 'package:animate_do/animate_do.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_app/app/models/billing_details.dart';
import 'package:flutter_app/app/models/cart.dart';
@ -23,17 +22,18 @@ import 'package:flutter_app/bootstrap/enums/symbol_position_enums.dart';
import 'package:flutter_app/bootstrap/shared_pref/shared_key.dart';
import 'package:flutter_app/config/app_currency.dart';
import 'package:flutter_app/config/app_payment_gateways.dart';
import 'package:flutter_app/config/app_theme.dart';
import 'package:flutter_app/resources/themes/styles/base_styles.dart';
import 'package:flutter_app/resources/widgets/no_results_for_products_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
import 'package:intl/intl.dart';
import 'package:flutter/material.dart';
import 'package:html/parser.dart';
import 'package:flutter_web_browser/flutter_web_browser.dart';
import 'package:math_expressions/math_expressions.dart';
import 'package:money_formatter/money_formatter.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:platform_alert_dialog/platform_alert_dialog.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:status_alert/status_alert.dart';
@ -52,6 +52,20 @@ appWooSignal(Function(WooSignal) api) async {
return await api(wooSignal);
}
/// helper to find correct color from the [context].
class ThemeColor {
static BaseColorStyles get(BuildContext context) {
return ((Theme.of(context).brightness == Brightness.light) ? ThemeConfig.light().colors : ThemeConfig.dark().colors);
}
}
/// helper to set colors on TextStyle
extension ColorsHelper on TextStyle {
TextStyle setColor(BuildContext context, Color Function(BaseColorStyles color) newColor) {
return this.copyWith(color: newColor(ThemeColor.get(context)));
}
}
List<PaymentType> getPaymentTypes() {
List<PaymentType> paymentTypes = [];
app_payment_gateways.forEach((element) {
@ -99,168 +113,6 @@ showStatusAlert(context,
);
}
enum ToastNotificationStyleType {
SUCCESS,
WARNING,
INFO,
DANGER,
}
class ToastNotificationStyleMetaHelper {
static ToastMeta getValue(ToastNotificationStyleType style) {
switch (style) {
case ToastNotificationStyleType.SUCCESS:
return ToastMeta.success(action: () {
ToastManager().dismissAll(showAnim: true);
});
case ToastNotificationStyleType.WARNING:
return ToastMeta.warning(action: () {
ToastManager().dismissAll(showAnim: true);
});
case ToastNotificationStyleType.INFO:
return ToastMeta.info(action: () {
ToastManager().dismissAll(showAnim: true);
});
case ToastNotificationStyleType.DANGER:
return ToastMeta.danger(action: () {
ToastManager().dismissAll(showAnim: true);
});
default:
return ToastMeta.success(action: () {
ToastManager().dismissAll(showAnim: true);
});
}
}
}
class ToastMeta {
Widget icon;
String title;
String description;
Color color;
Function action;
Duration duration;
ToastMeta(
{this.icon,
this.title,
this.description,
this.color,
this.action,
this.duration = const Duration(seconds: 2)});
ToastMeta.success(
{this.icon = const Icon(Icons.check, color: Colors.white, size: 30),
this.title = "Success",
this.description = "",
this.color = Colors.green,
this.action,
this.duration = const Duration(seconds: 5)});
ToastMeta.info(
{this.icon = const Icon(Icons.info, color: Colors.white, size: 30),
this.title = "",
this.description = "",
this.color = Colors.teal,
this.action,
this.duration = const Duration(seconds: 5)});
ToastMeta.warning(
{this.icon =
const Icon(Icons.error_outline, color: Colors.white, size: 30),
this.title = "Oops!",
this.description = "",
this.color = Colors.orange,
this.action,
this.duration = const Duration(seconds: 6)});
ToastMeta.danger(
{this.icon = const Icon(Icons.warning, color: Colors.white, size: 30),
this.title = "Oops!",
this.description = "",
this.color = Colors.redAccent,
this.action,
this.duration = const Duration(seconds: 7)});
}
showToastNotification(BuildContext context,
{ToastNotificationStyleType style,
String title,
IconData icon,
String description = "",
Duration duration}) {
ToastMeta toastMeta = ToastNotificationStyleMetaHelper.getValue(style);
toastMeta.title = trans(context, toastMeta.title);
if (title != null) {
toastMeta.title = title;
}
toastMeta.description = description;
Widget _icon = toastMeta.icon;
if (icon != null) {
_icon = Icon(icon, color: Colors.white);
}
showToastWidget(
InkWell(
onTap: () => ToastManager().dismissAll(showAnim: true),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 18.0),
margin: EdgeInsets.symmetric(horizontal: 8.0),
height: 100,
decoration: ShapeDecoration(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
color: toastMeta.color,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Pulse(
child: Container(
child: Center(
child: IconButton(
onPressed: () {},
icon: _icon,
padding: EdgeInsets.only(right: 16),
),
),
),
infinite: true,
duration: Duration(milliseconds: 1500),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
toastMeta.title,
style: Theme.of(context)
.textTheme
.headline5
.copyWith(color: Colors.white),
),
Text(
toastMeta.description,
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Colors.white),
),
],
),
),
],
),
),
),
context: context,
isIgnoring: false,
position: StyledToastPosition.top,
animation: StyledToastAnimation.slideFromTopFade,
duration: duration ?? toastMeta.duration,
);
}
String parseHtmlString(String htmlString) {
var document = parse(htmlString);
return parse(document.body.text).documentElement.text;
@ -307,8 +159,6 @@ openBrowserTab({@required String url}) async {
customTabsOptions: CustomTabsOptions(toolbarColor: Colors.white70));
}
EdgeInsets safeAreaDefault() => EdgeInsets.only(left: 16, right: 16, bottom: 8);
bool isNumeric(String str) {
if (str == null) {
return false;
@ -546,7 +396,7 @@ showPlatformAlertDialog(BuildContext context,
bool showDoneAction = true}) {
if (showDoneAction) {
actions
.add(dialogAction(context, title: trans(context, "Done"), action: () {
.add(dialogAction(context, title: trans("Done"), action: () {
Navigator.of(context).pop();
}));
}
@ -602,7 +452,7 @@ String formatForDateTime(FormatType formatType) {
}
}
double parseWcPrice(String price) => (double.tryParse(price) ?? 0);
double parseWcPrice(String price) => (double.tryParse(price ?? "0") ?? 0);
void appLogOutput(dynamic message) =>
(getEnv('APP_DEBUG', defaultValue: true) ? NyLogger.debug(message) : null);
@ -621,15 +471,15 @@ Widget refreshableScroll(context,
builder: (BuildContext context, LoadStatus mode) {
Widget body;
if (mode == LoadStatus.idle) {
body = Text(trans(context, "pull up load"));
body = Text(trans("pull up load"));
} else if (mode == LoadStatus.loading) {
body = CupertinoActivityIndicator();
} else if (mode == LoadStatus.failed) {
body = Text(trans(context, "Load Failed! Click retry!"));
body = Text(trans("Load Failed! Click retry!"));
} else if (mode == LoadStatus.canLoading) {
body = Text(trans(context, "release to load more"));
body = Text(trans("release to load more"));
} else {
body = Text(trans(context, "No more products"));
body = Text(trans("No more products"));
}
return Container(
height: 55.0,

View File

@ -0,0 +1,10 @@
import 'package:flutter/services.dart';
/// boot application
Future<void> boot() async {
await SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
}

View File

@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
/*
|--------------------------------------------------------------------------
| Font
|
| 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();
|--------------------------------------------------------------------------
*/
final TextStyle appFont = GoogleFonts.poppins();
// e.g. custom font in pubspec.yaml - https://flutter.dev/docs/cookbook/design/fonts
// final TextStyle appThemeFont = TextStyle(fontFamily: "ZenTokyoZoo");

View File

@ -1,20 +0,0 @@
import 'package:flutter/cupertino.dart';
/*
|--------------------------------------------------------------------------
| APP LOCALE
|
| Configure the language by setting the locale.
| You can only use one of the supported locales below in app_locales_supported.
|--------------------------------------------------------------------------
*/
const List<Locale> app_locales_supported = [
Locale('en'),
Locale('es'),
Locale('fr'),
Locale('hi'),
Locale('it'),
Locale('pt'),
Locale('zh'),
];

View File

@ -0,0 +1,57 @@
import 'package:nylo_framework/nylo_framework.dart';
/*
|--------------------------------------------------------------------------
| localeType
| -------------------------------------------------------------------------
| Define if you want the application to read the locale from the users
| device settings or as you've defined in the [languageCode].
|--------------------------------------------------------------------------
*/
final LocaleType localeType = LocaleType.asDefined; // device, asDefined
/*
|--------------------------------------------------------------------------
| languageCode
| -------------------------------------------------------------------------
| Define the language code you want to use. E.g. en, es, ar.
| The language code should match the name of the file i.e /lang/es.json
|--------------------------------------------------------------------------
*/
final String languageCode = getEnv('DEFAULT_LOCALE', defaultValue: "en");
/*
|--------------------------------------------------------------------------
| languagesList
| -------------------------------------------------------------------------
| Add a list of supported languages.
|--------------------------------------------------------------------------
*/
final List<String> languagesList = const [
'en',
'es',
'fr',
'hi',
'it',
'pt',
'zh'
];
/*
|--------------------------------------------------------------------------
| assetsDirectory
| -------------------------------------------------------------------------
| Asset directory for your languages.
|--------------------------------------------------------------------------
*/
final String assetsDirectory = 'lang/';
/*
|--------------------------------------------------------------------------
| valuesAsMap
| -------------------------------------------------------------------------
| If you want to define your own language map in code rather than using
| the asset json files.
|--------------------------------------------------------------------------
*/
final Map<String, String> valuesAsMap = {};

View File

@ -1,43 +1,84 @@
import 'package:flutter/material.dart';
import 'package:flutter_app/bootstrap/base_theme_config.dart';
import 'package:flutter_app/resources/themes/dark_theme.dart';
import 'package:flutter_app/resources/themes/light_theme.dart';
import 'package:flutter_app/resources/themes/styles/base_styles.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';
/*
|--------------------------------------------------------------------------
| Theme Font
|
| 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 Config
|--------------------------------------------------------------------------
*/
final TextStyle appThemeFont = GoogleFonts.poppins();
// App Themes
final appThemes = [
// e.g. custom font in pubspec.yaml - https://flutter.dev/docs/cookbook/design/fonts
// final TextStyle appThemeFont = TextStyle(fontFamily: "ZenTokyoZoo");
ThemeConfig.light(),
ThemeConfig.dark(),
];
/*
|--------------------------------------------------------------------------
| Theme Colors
|
| Customize your theme's light and dark themes: /lib/config/styles/
|--------------------------------------------------------------------------
*/
class NyColors {
// Light Colors
static LightThemeColors light = LightThemeColors();
// Light Colors
BaseColorStyles lightColors = LightThemeColors();
// Dark Colors
static DarkThemeColors dark = DarkThemeColors();
// Dark Colors
BaseColorStyles darkColors = DarkThemeColors();
/// helper to find correct theme from the [context].
static BaseStyles of(BuildContext context) {
return ((Theme.of(context).brightness == Brightness.dark) ? dark : light);
}
/*
|--------------------------------------------------------------------------
| Themes
|--------------------------------------------------------------------------
*/
// Preset Themes
class ThemeConfig {
// LIGHT
static BaseThemeConfig light() => BaseThemeConfig(
id: "default_light_theme",
description: "Light theme",
theme: lightTheme(lightColors),
colors: lightColors,
);
// DARK
static BaseThemeConfig dark() => BaseThemeConfig(
id: "default_dark_theme",
description: "Dark theme",
theme: darkTheme(darkColors),
colors: darkColors,
);
// E.G. CUSTOM THEME
/// Run: "flutter pub run nylo_framework:main make:theme bright_theme" // example bright_theme
// Creates a basic theme in /resources/themes/bright_theme.dart
// Creates the themes colors in /resources/themes/styles/bright_theme_colors.dart
// First add the colors which was created into the above section like the following:
// Bright Colors
/// BaseColorStyles brightColors = BrightThemeColors();
// Next, uncomment the below:
/// static BaseThemeConfig bright() => BaseThemeConfig(
/// id: "default_bright_theme",
/// description: "Bright theme",
/// theme: brightTheme(brightColors),
/// colors: brightColors,
/// );
// To then use this theme, add it to the [appThemes] above like the following:
// final appThemes = [
/// ThemeConfig.bright(), // new theme
//
// ThemeConfig.light(),
//
// ThemeConfig.dark(),
// ];
}

View File

@ -1,25 +1,17 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app/bootstrap/app.dart';
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/light_theme.dart';
import 'package:flutter_app/bootstrap/setup.dart';
import 'package:flutter_app/config/app_localization.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:woosignal/models/response/woosignal_app.dart';
import 'package:wp_json_api/wp_json_api.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
Nylo nylo = await Nylo.init(router: appRouter());
await SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
Nylo nylo = await Nylo.init(router: appRouter(), setup: boot);
String initialRoute = '/no-connection';
WooSignalApp wooSignalApp = await appWooSignal((api) => api.getApp());
@ -41,15 +33,21 @@ void main() async {
locale = Locale((getEnv('DEFAULT_LOCALE', defaultValue: null) == null && wooSignalApp.locale != null) ? wooSignalApp.locale : envVal('DEFAULT_LOCALE', defaultValue: 'en'));
}
/// NyLocalization
await NyLocalization.instance.init(
localeType: localeType,
languageCode: locale != null ? locale.languageCode : Locale(getEnv('DEFAULT_LOCALE', defaultValue: 'en')),
languagesList: languagesList,
assetsDirectory: assetsDirectory,
valuesAsMap: valuesAsMap
);
runApp(
AppBuild(
navigatorKey: nylo.router.navigatorKey,
onGenerateRoute: nylo.router.generator(),
lightTheme: lightTheme(),
darkTheme: darkTheme(),
locale: locale,
initialRoute: initialRoute,
supportedLocales: app_locales_supported,
debugShowCheckedModeBanner: false,
),
);

View File

@ -8,16 +8,14 @@
// 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: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/buttons.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:wp_json_api/models/responses/wc_customer_info_response.dart';
import 'package:wp_json_api/models/responses/wc_customer_updated_response.dart';
import 'package:wp_json_api/wp_json_api.dart';
@ -78,12 +76,11 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text(
trans(context, "Billing Details")
trans("Billing Details")
),
centerTitle: true,
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: GestureDetector(
onTap: () => FocusScope.of(context).requestFocus(new FocusNode()),
child: _isLoading
@ -104,14 +101,14 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans(context, "First Name"),
heading: trans("First Name"),
controller: _txtShippingFirstName,
shouldAutoFocus: true,
),
),
Flexible(
child: TextEditingRow(
heading: trans(context, "Last Name"),
heading: trans("Last Name"),
controller: _txtShippingLastName,
),
),
@ -121,19 +118,19 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
MainAxisAlignment.spaceEvenly,
),
TextEditingRow(
heading: trans(context, "Address Line"),
heading: trans("Address Line"),
controller: _txtShippingAddressLine,
),
Row(children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans(context, "City"),
heading: trans("City"),
controller: _txtShippingCity,
),
),
Flexible(
child: TextEditingRow(
heading: trans(context, "State"),
heading: trans("State"),
keyboardType: TextInputType.emailAddress,
controller: _txtShippingState),
),
@ -142,13 +139,13 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans(context, "Postal code"),
heading: trans("Postal code"),
controller: _txtShippingPostalCode,
),
),
Flexible(
child: TextEditingRow(
heading: trans(context, "Country"),
heading: trans("Country"),
keyboardType: TextInputType.emailAddress,
controller: _txtShippingCountry,
),
@ -161,9 +158,7 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
],
),
decoration: BoxDecoration(
color: (Theme.of(context).brightness == Brightness.light)
? NyColors.light.background
: NyColors.dark.primaryAccent,
color: ThemeColor.get(context).surfaceBackground,
borderRadius: BorderRadius.circular(10),
boxShadow:
(Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
@ -177,7 +172,7 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
Column(
children: <Widget>[
PrimaryButton(
title: trans(context, "UPDATE DETAILS"),
title: trans("UPDATE DETAILS"),
action:
_isUpdating ? () {} : _updateBillingDetails),
],
@ -218,8 +213,8 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
billingCountry: country));
} on Exception catch (_) {
showToastNotification(context,
title: trans(context, "Oops!"),
description: trans(context, "Something went wrong"),
title: trans("Oops!"),
description: trans("Something went wrong"),
style: ToastNotificationStyleType.DANGER);
} finally {
setState(() {
@ -230,8 +225,8 @@ class _AccountBillingDetailsPageState extends State<AccountBillingDetailsPage> {
if (wcCustomerUpdatedResponse != null &&
wcCustomerUpdatedResponse.status == 200) {
showToastNotification(context,
title: trans(context, "Success"),
description: trans(context, "Account updated"),
title: trans("Success"),
description: trans("Account updated"),
style: ToastNotificationStyleType.SUCCESS);
Navigator.pop(context);
}

View File

@ -14,11 +14,11 @@ 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/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:woosignal/models/response/order.dart';
import 'package:wp_json_api/models/responses/wc_customer_info_response.dart';
@ -77,8 +77,8 @@ class _AccountDetailPageState extends State<AccountDetailPage>
} on Exception catch (_) {
showToastNotification(
context,
title: trans(context, "Oops!"),
description: trans(context, "Something went wrong"),
title: trans("Oops!"),
description: trans("Something went wrong"),
style: ToastNotificationStyleType.DANGER,
);
} finally {
@ -98,8 +98,8 @@ class _AccountDetailPageState extends State<AccountDetailPage>
@override
Widget build(BuildContext context) {
_tabs = [
new Tab(text: trans(context, "Orders")),
new Tab(text: trans(context, "Settings")),
new Tab(text: trans("Orders")),
new Tab(text: trans("Settings")),
];
return Scaffold(
@ -112,13 +112,12 @@ class _AccountDetailPageState extends State<AccountDetailPage>
margin: EdgeInsets.only(left: 0),
) : Container(),
title: Text(
trans(context, "Account")
trans("Account")
),
centerTitle: true,
),
resizeToAvoidBottomInset: false,
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: _isLoading
? AppLoaderWidget()
: Column(
@ -206,7 +205,7 @@ class _AccountDetailPageState extends State<AccountDetailPage>
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
boxShadow: (Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
color: NyColors.of(context).backgroundContainer,
color: ThemeColor.get(context).backgroundContainer,
),
),
Expanded(child: _activeBody),
@ -239,7 +238,7 @@ class _AccountDetailPageState extends State<AccountDetailPage>
Card(
child: ListTile(
leading: Icon(Icons.account_circle),
title: Text(trans(context, "Update details")),
title: Text(trans("Update details")),
onTap: () =>
Navigator.pushNamed(context, "/account-update").then((onValue) {
setState(() {
@ -252,7 +251,7 @@ class _AccountDetailPageState extends State<AccountDetailPage>
Card(
child: ListTile(
leading: Icon(Icons.local_shipping),
title: Text(trans(context, "Shipping Details")),
title: Text(trans("Shipping Details")),
onTap: () =>
Navigator.pushNamed(context, "/account-shipping-details"),
),
@ -260,7 +259,7 @@ class _AccountDetailPageState extends State<AccountDetailPage>
Card(
child: ListTile(
leading: Icon(Icons.credit_card),
title: Text(trans(context, "Billing Details")),
title: Text(trans("Billing Details")),
onTap: () =>
Navigator.pushNamed(context, "/account-billing-details"),
),
@ -268,7 +267,7 @@ class _AccountDetailPageState extends State<AccountDetailPage>
Card(
child: ListTile(
leading: Icon(Icons.exit_to_app),
title: Text(trans(context, "Logout")),
title: Text(trans("Logout")),
onTap: () => authLogout(context),
),
),
@ -317,15 +316,15 @@ class _AccountDetailPageState extends State<AccountDetailPage>
builder: (BuildContext context, LoadStatus mode) {
Widget body;
if (mode == LoadStatus.idle) {
body = Text(trans(context, "pull up load"));
body = Text(trans("pull up load"));
} else if (mode == LoadStatus.loading) {
body = CupertinoActivityIndicator();
} else if (mode == LoadStatus.failed) {
body = Text(trans(context, "Load Failed! Click retry!"));
body = Text(trans("Load Failed! Click retry!"));
} else if (mode == LoadStatus.canLoading) {
body = Text(trans(context, "release to load more"));
body = Text(trans("release to load more"));
} else {
body = Text(trans(context, "No more orders"));
body = Text(trans("No more orders"));
}
return Container(
height: 55.0,
@ -392,7 +391,7 @@ class _AccountDetailPageState extends State<AccountDetailPage>
Text(
_orders[i].lineItems.length.toString() +
" " +
trans(context, "items"),
trans("items"),
style: Theme.of(context)
.textTheme
.bodyText1
@ -448,7 +447,7 @@ class _AccountDetailPageState extends State<AccountDetailPage>
size: 40,
),
Text(
trans(context, "No orders found"),
trans("No orders found"),
),
],
),

View File

@ -8,17 +8,14 @@
// 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:flutter/material.dart';
import 'package:flutter_app/app/models/user.dart';
import 'package:flutter_app/bootstrap/app_helper.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/bootstrap/shared_pref/shared_key.dart';
import 'package:flutter_app/config/app_theme.dart';
import 'package:flutter_app/resources/widgets/buttons.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:wp_json_api/exceptions/incorrect_password_exception.dart';
import 'package:wp_json_api/exceptions/invalid_email_exception.dart';
import 'package:wp_json_api/exceptions/invalid_nonce_exception.dart';
@ -66,7 +63,7 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
margin: EdgeInsets.symmetric(horizontal: 20),
alignment: Alignment.bottomLeft,
child: Text(
trans(context, "Login"),
trans("Login"),
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.headline4.copyWith(
fontSize: 24,
@ -79,7 +76,7 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
boxShadow: (Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
color: NyColors.of(context).backgroundContainer,
color: ThemeColor.get(context).backgroundContainer,
),
padding: EdgeInsets.symmetric(vertical: 18, horizontal: 8),
margin: EdgeInsets.symmetric(horizontal: 16),
@ -88,16 +85,16 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
TextEditingRow(
heading: trans(context, "Email"),
heading: trans("Email"),
controller: _tfEmailController,
keyboardType: TextInputType.emailAddress),
TextEditingRow(
heading: trans(context, "Password"),
heading: trans("Password"),
controller: _tfPasswordController,
keyboardType: TextInputType.visiblePassword,
obscureText: true),
PrimaryButton(
title: trans(context, "Login"),
title: trans("Login"),
action: _hasTappedLogin == true ? () {} : _loginUser,
),
],
@ -118,7 +115,7 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
),
Padding(
child: Text(
trans(context, "Create an account"),
trans("Create an account"),
style: Theme.of(context).textTheme.bodyText1,
),
padding: EdgeInsets.only(left: 8),
@ -129,7 +126,7 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
Navigator.pushNamed(context, "/account-register"),
),
LinkButton(
title: trans(context, "Forgot Password"),
title: trans("Forgot Password"),
action: () {
String forgotPasswordUrl =
AppHelper.instance.appConfig.wpLoginForgotPasswordUrl;
@ -144,7 +141,7 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
children: [
Divider(),
LinkButton(
title: trans(context, "Back"),
title: trans("Back"),
action: () => Navigator.pop(context),
),
],
@ -166,17 +163,17 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
if (email == "" || password == "") {
showToastNotification(context,
title: trans(context, "Invalid details"),
title: trans("Invalid details"),
description:
trans(context, "The email and password field cannot be empty"),
trans("The email and password field cannot be empty"),
style: ToastNotificationStyleType.DANGER);
return;
}
if (!isEmail(email)) {
showToastNotification(context,
title: trans(context, "Oops"),
description: trans(context, "That email address is not valid"),
title: trans("Oops"),
description: trans("That email address is not valid"),
style: ToastNotificationStyleType.DANGER);
return;
}
@ -192,32 +189,31 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
(request) => request.wpLogin(email: email, password: password));
} on InvalidNonceException catch (_) {
showToastNotification(context,
title: trans(context, "Invalid details"),
description: trans(
context, "Something went wrong, please contact our store"),
title: trans("Invalid details"),
description: trans("Something went wrong, please contact our store"),
style: ToastNotificationStyleType.DANGER);
} on InvalidEmailException catch (_) {
showToastNotification(context,
title: trans(context, "Invalid details"),
title: trans("Invalid details"),
description:
trans(context, "That email does not match our records"),
trans("That email does not match our records"),
style: ToastNotificationStyleType.DANGER);
} on InvalidUsernameException catch (_) {
showToastNotification(context,
title: trans(context, "Invalid details"),
title: trans("Invalid details"),
description:
trans(context, "That username does not match our records"),
trans("That username does not match our records"),
style: ToastNotificationStyleType.DANGER);
} on IncorrectPasswordException catch (_) {
showToastNotification(context,
title: trans(context, "Invalid details"),
title: trans("Invalid details"),
description:
trans(context, "That password does not match our records"),
trans("That password does not match our records"),
style: ToastNotificationStyleType.DANGER);
} on Exception catch (_) {
showToastNotification(context,
title: trans(context, "Oops!"),
description: trans(context, "Invalid login credentials"),
title: trans("Oops!"),
description: trans("Invalid login credentials"),
style: ToastNotificationStyleType.DANGER,
icon: Icons.account_circle);
} finally {
@ -233,8 +229,8 @@ class _AccountLandingPageState extends State<AccountLandingPage> {
user.save(SharedKey.authUser);
showToastNotification(context,
title: trans(context, "Hello"),
description: trans(context, "Welcome back"),
title: trans("Hello"),
description: trans("Welcome back"),
style: ToastNotificationStyleType.SUCCESS,
icon: Icons.account_circle);
navigatorPush(context,

View File

@ -8,12 +8,11 @@
// 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:flutter/material.dart';
import 'package:flutter_app/app/controllers/account_order_detail_controller.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/resources/widgets/app_loader_widget.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:nylo_support/helpers/helper.dart';
@ -55,20 +54,19 @@ class _AccountOrderDetailPageState extends NyState<AccountOrderDetailPage> {
margin: EdgeInsets.only(left: 0),
),
title: Text(
"${trans(context, "Order").capitalize()} #${_orderId.toString()}"
"${trans("Order").capitalize()} #${_orderId.toString()}"
),
centerTitle: true,
),
resizeToAvoidBottomInset: false,
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: _isLoading
? AppLoaderWidget()
: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text("${trans(context, "Date Ordered").capitalize()}: " +
Text("${trans("Date Ordered").capitalize()}: " +
dateFormatted(
date: _order.dateCreated,
formatType: formatForDateTime(FormatType.Date))),
@ -81,7 +79,7 @@ class _AccountOrderDetailPageState extends NyState<AccountOrderDetailPage> {
children: <Widget>[
Flexible(
child: Text(
"${trans(context, "Ships to").capitalize()}:"),
"${trans("Ships to").capitalize()}:"),
),
Flexible(
child: Text(

View File

@ -8,14 +8,12 @@
// 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:flutter/material.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/bootstrap/shared_pref/sp_auth.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';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:wp_json_api/models/responses/wp_user_info_response.dart';
import 'package:wp_json_api/models/responses/wp_user_info_updated_response.dart';
import 'package:wp_json_api/wp_json_api.dart';
@ -64,7 +62,7 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
return Scaffold(
appBar: AppBar(
title: Text(
trans(context, "Update Details"),
trans("Update Details"),
style: TextStyle(
fontSize: 20,
),
@ -88,14 +86,14 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans(context, "First Name"),
heading: trans("First Name"),
controller: _tfFirstName,
keyboardType: TextInputType.text,
),
),
Flexible(
child: TextEditingRow(
heading: trans(context, "Last Name"),
heading: trans("Last Name"),
controller: _tfLastName,
keyboardType: TextInputType.text,
),
@ -110,7 +108,7 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
padding: EdgeInsets.only(top: 10),
),
PrimaryButton(
title: trans(context, "Update details"),
title: trans("Update details"),
action: _updateDetails)
],
),
@ -141,8 +139,8 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
firstName: firstName, lastName: lastName));
} on Exception catch (_) {
showToastNotification(context,
title: trans(context, "Invalid details"),
description: trans(context, "Please check your email and password"),
title: trans("Invalid details"),
description: trans("Please check your email and password"),
style: ToastNotificationStyleType.DANGER);
} finally {
setState(() {
@ -153,8 +151,8 @@ class _AccountProfileUpdatePageState extends State<AccountProfileUpdatePage> {
if (wpUserInfoUpdatedResponse != null &&
wpUserInfoUpdatedResponse.status == 200) {
showToastNotification(context,
title: trans(context, "Success"),
description: trans(context, "Account updated"),
title: trans("Success"),
description: trans("Account updated"),
style: ToastNotificationStyleType.SUCCESS);
Navigator.pop(context);
}

View File

@ -15,8 +15,9 @@ import 'package:flutter_app/bootstrap/app_helper.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/bootstrap/shared_pref/shared_key.dart';
import 'package:flutter_app/resources/widgets/buttons.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_framework/nylo_framework.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';
@ -62,13 +63,12 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
onPressed: () => Navigator.pop(context),
),
title: Text(
trans(context, "Register")
trans("Register")
),
centerTitle: true,
),
resizeToAvoidBottomInset: false,
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: Column(
children: <Widget>[
Container(
@ -77,7 +77,7 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans(context, "First Name"),
heading: trans("First Name"),
controller: _tfFirstNameController,
shouldAutoFocus: true,
keyboardType: TextInputType.text,
@ -85,7 +85,7 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
),
Flexible(
child: TextEditingRow(
heading: trans(context, "Last Name"),
heading: trans("Last Name"),
controller: _tfLastNameController,
shouldAutoFocus: false,
keyboardType: TextInputType.text,
@ -94,20 +94,20 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
],
)),
TextEditingRow(
heading: trans(context, "Email address"),
heading: trans("Email address"),
controller: _tfEmailAddressController,
shouldAutoFocus: false,
keyboardType: TextInputType.emailAddress,
),
TextEditingRow(
heading: trans(context, "Password"),
heading: trans("Password"),
controller: _tfPasswordController,
shouldAutoFocus: true,
obscureText: true,
),
Padding(
child: PrimaryButton(
title: trans(context, "Sign up"),
title: trans("Sign up"),
action: _hasTappedRegister ? () {} : _signUpTapped),
padding: EdgeInsets.only(top: 10),
),
@ -115,17 +115,16 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
child: InkWell(
child: RichText(
text: TextSpan(
text: trans(
context, "By tapping \"Register\" you agree to ") +
text: trans("By tapping \"Register\" you agree to ") +
AppHelper.instance.appConfig.appName +
'\'s ',
children: <TextSpan>[
TextSpan(
text: trans(context, "terms and conditions"),
text: trans("terms and conditions"),
style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(text: ' ' + trans(context, "and") + ' '),
TextSpan(text: ' ' + trans("and") + ' '),
TextSpan(
text: trans(context, "privacy policy"),
text: trans("privacy policy"),
style: TextStyle(fontWeight: FontWeight.bold)),
],
style: TextStyle(
@ -157,16 +156,16 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
if (!isEmail(email)) {
showToastNotification(context,
title: trans(context, "Oops"),
description: trans(context, "That email address is not valid"),
title: trans("Oops"),
description: trans("That email address is not valid"),
style: ToastNotificationStyleType.DANGER);
return;
}
if (password.length <= 5) {
showToastNotification(context,
title: trans(context, "Oops"),
description: trans(context, "Password must be a min 6 characters"),
title: trans("Oops"),
description: trans("Password must be a min 6 characters"),
style: ToastNotificationStyleType.DANGER);
return;
}
@ -190,39 +189,38 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
);
} on UsernameTakenException catch (e) {
showToastNotification(context,
title: trans(context, "Oops!"),
description: trans(context, e.message),
title: trans("Oops!"),
description: trans(e.message),
style: ToastNotificationStyleType.DANGER);
} on InvalidNonceException catch (_) {
showToastNotification(context,
title: trans(context, "Invalid details"),
description: trans(
context, "Something went wrong, please contact our store"),
title: trans("Invalid details"),
description: trans("Something went wrong, please contact our store"),
style: ToastNotificationStyleType.DANGER);
} on ExistingUserLoginException catch (_) {
showToastNotification(context,
title: trans(context, "Oops!"),
description: trans(context, "A user already exists"),
title: trans("Oops!"),
description: trans("A user already exists"),
style: ToastNotificationStyleType.DANGER);
} on ExistingUserEmailException catch (_) {
showToastNotification(context,
title: trans(context, "Oops!"),
description: trans(context, "That email is taken, try another"),
title: trans("Oops!"),
description: trans("That email is taken, try another"),
style: ToastNotificationStyleType.DANGER);
} on UserAlreadyExistException catch (_) {
showToastNotification(context,
title: trans(context, "Oops!"),
description: trans(context, "A user already exists"),
title: trans("Oops!"),
description: trans("A user already exists"),
style: ToastNotificationStyleType.DANGER);
} on EmptyUsernameException catch (e) {
showToastNotification(context,
title: trans(context, "Oops!"),
description: trans(context, e.message),
title: trans("Oops!"),
description: trans(e.message),
style: ToastNotificationStyleType.DANGER);
} on Exception catch (_) {
showToastNotification(context,
title: trans(context, "Oops!"),
description: trans(context, "Something went wrong"),
title: trans("Oops!"),
description: trans("Something went wrong"),
style: ToastNotificationStyleType.DANGER);
} finally {
setState(() {
@ -241,8 +239,8 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
.wpUpdateUserInfo(token, firstName: firstName, lastName: lastName));
showToastNotification(context,
title: "${trans(context, "Hello")} $firstName",
description: trans(context, "you're now logged in"),
title: "${trans("Hello")} $firstName",
description: trans("you're now logged in"),
style: ToastNotificationStyleType.SUCCESS,
icon: Icons.account_circle);
navigatorPush(context,
@ -254,14 +252,14 @@ class _AccountRegistrationPageState extends State<AccountRegistrationPage> {
_viewTOSModal() {
showPlatformAlertDialog(
context,
title: trans(context, "Actions"),
subtitle: trans(context, "View Terms and Conditions or Privacy policy"),
title: trans("Actions"),
subtitle: trans("View Terms and Conditions or Privacy policy"),
actions: [
dialogAction(context,
title: trans(context, "Terms and Conditions"),
title: trans("Terms and Conditions"),
action: _viewTermsConditions),
dialogAction(context,
title: trans(context, "Privacy Policy"),
title: trans("Privacy Policy"),
action: _viewPrivacyPolicy),
],
);

View File

@ -8,16 +8,14 @@
// 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: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/buttons.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:wp_json_api/models/responses/wc_customer_info_response.dart';
import 'package:wp_json_api/models/responses/wc_customer_updated_response.dart';
import 'package:wp_json_api/wp_json_api.dart';
@ -61,8 +59,8 @@ class _AccountShippingDetailsPageState
} on Exception catch (_) {
showToastNotification(
context,
title: trans(context, "Oops!"),
description: trans(context, "Something went wrong"),
title: trans("Oops!"),
description: trans("Something went wrong"),
style: ToastNotificationStyleType.DANGER,
);
Navigator.pop(context);
@ -94,12 +92,11 @@ class _AccountShippingDetailsPageState
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text(
trans(context, "Shipping Details")
trans("Shipping Details")
),
centerTitle: true,
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
@ -122,14 +119,14 @@ class _AccountShippingDetailsPageState
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans(context, "First Name"),
heading: trans("First Name"),
controller: _txtShippingFirstName,
shouldAutoFocus: true,
),
),
Flexible(
child: TextEditingRow(
heading: trans(context, "Last Name"),
heading: trans("Last Name"),
controller: _txtShippingLastName,
),
),
@ -139,19 +136,19 @@ class _AccountShippingDetailsPageState
MainAxisAlignment.spaceEvenly,
),
TextEditingRow(
heading: trans(context, "Address Line"),
heading: trans("Address Line"),
controller: _txtShippingAddressLine,
),
Row(children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans(context, "City"),
heading: trans("City"),
controller: _txtShippingCity,
),
),
Flexible(
child: TextEditingRow(
heading: trans(context, "State"),
heading: trans("State"),
controller: _txtShippingState,
),
),
@ -160,13 +157,13 @@ class _AccountShippingDetailsPageState
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans(context, "Postal code"),
heading: trans("Postal code"),
controller: _txtShippingPostalCode,
),
),
Flexible(
child: TextEditingRow(
heading: trans(context, "Country"),
heading: trans("Country"),
controller: _txtShippingCountry,
),
),
@ -178,9 +175,10 @@ class _AccountShippingDetailsPageState
],
),
decoration: BoxDecoration(
color: (Theme.of(context).brightness == Brightness.light)
? NyColors.light.background
: NyColors.dark.primaryAccent,
color: ThemeColor.get(context).surfaceBackground,
// (Theme.of(context).brightness == Brightness.light)
// ? NyColors.light.background
// : NyColors.dark.primaryAccent,
borderRadius: BorderRadius.circular(10),
boxShadow:
(Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
@ -194,7 +192,7 @@ class _AccountShippingDetailsPageState
Column(
children: <Widget>[
PrimaryButton(
title: trans(context, "UPDATE DETAILS"),
title: trans("UPDATE DETAILS"),
action:
_isUpdating ? () {} : _updateShippingDetails),
],
@ -242,8 +240,8 @@ class _AccountShippingDetailsPageState
);
} on Exception catch (_) {
showToastNotification(context,
title: trans(context, "Oops!"),
description: trans(context, "Something went wrong"),
title: trans("Oops!"),
description: trans("Something went wrong"),
style: ToastNotificationStyleType.DANGER);
} finally {
setState(() {
@ -254,8 +252,8 @@ class _AccountShippingDetailsPageState
if (wcCustomerUpdatedResponse != null &&
wcCustomerUpdatedResponse.status == 200) {
showToastNotification(context,
title: trans(context, "Success"),
description: trans(context, "Account updated"),
title: trans("Success"),
description: trans("Account updated"),
style: ToastNotificationStyleType.SUCCESS);
Navigator.pop(context);
}

View File

@ -8,13 +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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/app/controllers/browse_category_controller.dart';
import 'package:flutter_app/bootstrap/enums/sort_enums.dart';
import 'package:flutter_app/bootstrap/helpers.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/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_support/widgets/ny_state.dart';
@ -87,7 +87,7 @@ class _BrowseCategoryPageState extends NyState<BrowseCategoryPage> {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(trans(context, "Browse"),
Text(trans("Browse"),
style: Theme.of(context).textTheme.subtitle1),
Text(parseHtmlString(productCategory.name))
],
@ -100,8 +100,7 @@ class _BrowseCategoryPageState extends NyState<BrowseCategoryPage> {
)
],
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: _isLoading
? Center(
child: AppLoaderWidget(),
@ -171,38 +170,38 @@ class _BrowseCategoryPageState extends NyState<BrowseCategoryPage> {
_modalSheetTune() {
wsModalBottom(
context,
title: trans(context, "Sort results"),
title: trans("Sort results"),
bodyWidget: ListView(
children: <Widget>[
LinkButton(
title: trans(context, "Sort: Low to high"),
title: trans("Sort: Low to high"),
action: () => _sortProducts(by: SortByType.LowToHigh),
),
Divider(
height: 0,
),
LinkButton(
title: trans(context, "Sort: High to low"),
title: trans("Sort: High to low"),
action: () => _sortProducts(by: SortByType.HighToLow),
),
Divider(
height: 0,
),
LinkButton(
title: trans(context, "Sort: Name A-Z"),
title: trans("Sort: Name A-Z"),
action: () => _sortProducts(by: SortByType.NameAZ),
),
Divider(
height: 0,
),
LinkButton(
title: trans(context, "Sort: Name Z-A"),
title: trans("Sort: Name Z-A"),
action: () => _sortProducts(by: SortByType.NameZA),
),
Divider(
height: 0,
),
LinkButton(title: trans(context, "Cancel"), action: _dismissModal)
LinkButton(title: trans("Cancel"), action: _dismissModal)
],
),
);

View File

@ -12,6 +12,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_app/app/controllers/browse_search_controller.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/resources/widgets/app_loader_widget.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_support/widgets/ny_state.dart';
import 'package:nylo_support/widgets/ny_stateful_widget.dart';
@ -81,15 +82,14 @@ class _BrowseSearchState extends NyState<BrowseSearchPage> {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(trans(context, "Search results for"),
Text(trans("Search results for"),
style: Theme.of(context).textTheme.subtitle1),
Text("\"" + _search + "\"")
],
),
centerTitle: true,
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: _isLoading
? Center(
child: AppLoaderWidget(),

View File

@ -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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/app/models/cart.dart';
import 'package:flutter_app/app/models/cart_line_item.dart';
@ -19,9 +18,10 @@ import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/bootstrap/shared_pref/sp_auth.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/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/text_row_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_framework/nylo_framework.dart';
class CartPage extends StatefulWidget {
CartPage();
@ -83,8 +83,8 @@ class _CartPageState extends State<CartPage> {
if (cartLineItems.length == 0) {
showToastNotification(
context,
title: trans(context, "Cart"),
description: trans(context, "You need items in your cart to checkout"),
title: trans("Cart"),
description: trans("You need items in your cart to checkout"),
style: ToastNotificationStyleType.WARNING,
icon: Icons.shopping_cart,
);
@ -95,8 +95,8 @@ class _CartPageState extends State<CartPage> {
(c) => c.stockStatus == 'instock' || c.stockStatus == 'onbackorder')) {
showToastNotification(
context,
title: trans(context, "Cart"),
description: trans(context, "There is an item out of stock"),
title: trans("Cart"),
description: trans("There is an item out of stock"),
style: ToastNotificationStyleType.WARNING,
icon: Icons.shopping_cart,
);
@ -129,8 +129,8 @@ class _CartPageState extends State<CartPage> {
cartLineItem.quantity + 1 > cartLineItem.stockQuantity) {
showToastNotification(
context,
title: trans(context, "Cart"),
description: trans(context, "Maximum stock reached"),
title: trans("Cart"),
description: trans("Maximum stock reached"),
style: ToastNotificationStyleType.WARNING,
icon: Icons.shopping_cart,
);
@ -157,8 +157,8 @@ class _CartPageState extends State<CartPage> {
_cartLines.removeAt(index);
showToastNotification(
context,
title: trans(context, "Updated"),
description: trans(context, "Item removed"),
title: trans("Updated"),
description: trans("Item removed"),
style: ToastNotificationStyleType.WARNING,
icon: Icons.remove_shopping_cart,
);
@ -172,8 +172,8 @@ class _CartPageState extends State<CartPage> {
Cart.getInstance.clear();
_cartLines = [];
showToastNotification(context,
title: trans(context, "Success"),
description: trans(context, "Cart cleared"),
title: trans("Success"),
description: trans("Cart cleared"),
style: ToastNotificationStyleType.SUCCESS,
icon: Icons.delete_outline);
_isCartEmpty = true;
@ -186,7 +186,7 @@ class _CartPageState extends State<CartPage> {
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text(
trans(context, "Shopping Cart"),
trans("Shopping Cart"),
),
elevation: 1,
actions: <Widget>[
@ -196,7 +196,7 @@ class _CartPageState extends State<CartPage> {
child: Align(
child: Padding(
child: Text(
trans(context, "Clear Cart"),
trans("Clear Cart"),
style: Theme.of(context).textTheme.bodyText2,
),
padding: EdgeInsets.only(right: 8),
@ -208,8 +208,7 @@ class _CartPageState extends State<CartPage> {
],
centerTitle: true,
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
@ -228,7 +227,7 @@ class _CartPageState extends State<CartPage> {
),
Padding(
child: Text(
trans(context, "Empty Basket"),
trans("Empty Basket"),
style: Theme.of(context).textTheme.bodyText2,
),
padding: EdgeInsets.only(top: 10),
@ -278,7 +277,7 @@ class _CartPageState extends State<CartPage> {
else
return new Padding(
child: TextRowWidget(
title: trans(context, "Total"),
title: trans("Total"),
text: (_isLoading ? "" : snapshot.data),
),
padding: EdgeInsets.only(bottom: 15, top: 15),
@ -287,7 +286,7 @@ class _CartPageState extends State<CartPage> {
},
),
PrimaryButton(
title: trans(context, "PROCEED TO CHECKOUT"),
title: trans("PROCEED TO CHECKOUT"),
action: _actionProceedToCheckout,
),
],

View File

@ -15,11 +15,11 @@ 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/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:woosignal/models/response/tax_rate.dart';
import 'package:woosignal/models/response/woosignal_app.dart';
@ -166,8 +166,8 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
CheckoutSession.getInstance.billingDetails.shippingAddress;
if (shippingAddress == null || shippingAddress.customerCountry == null) {
showToastNotification(context,
title: trans(context, "Oops"),
description: trans(context, "Add your shipping details first"),
title: trans("Oops"),
description: trans("Add your shipping details first"),
icon: Icons.local_shipping);
return;
}
@ -181,13 +181,12 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
return Scaffold(
appBar: AppBar(
title: Text(
trans(context, "Checkout")
trans("Checkout")
),
centerTitle: true,
),
resizeToAvoidBottomInset: false,
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: !_showFullLoader
? Column(
mainAxisAlignment: MainAxisAlignment.start,
@ -197,7 +196,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
child: Container(
padding: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
color: NyColors.of(context).backgroundContainer,
color: ThemeColor.get(context).backgroundContainer,
borderRadius: BorderRadius.circular(10),
boxShadow:
(Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
@ -225,16 +224,14 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
.billingAddress !=
null)
? wsCheckoutRow(context,
heading: trans(
context, "Billing/shipping details"),
heading: trans("Billing/shipping details"),
leadImage: Icon(Icons.home),
leadTitle:
(CheckoutSession.getInstance.billingDetails == null ||
CheckoutSession.getInstance
.billingDetails.billingAddress
.hasMissingFields()
? trans(
context, "Billing address is incomplete")
? trans("Billing address is incomplete")
: CheckoutSession.getInstance
.billingDetails.billingAddress
.addressFull()),
@ -242,14 +239,14 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
showBorderBottom: true)
: wsCheckoutRow(context,
heading:
trans(context, "Billing/shipping details"),
trans("Billing/shipping details"),
leadImage: Icon(Icons.home),
leadTitle: trans(context, "Add billing & shipping details"),
leadTitle: trans("Add billing & shipping details"),
action: _actionCheckoutDetails,
showBorderBottom: true)),
(CheckoutSession.getInstance.paymentType != null
? wsCheckoutRow(context,
heading: trans(context, "Payment method"),
heading: trans("Payment method"),
leadImage: Container(
color: Colors.white,
child: Image.asset(
@ -263,10 +260,9 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
action: _actionPayWith,
showBorderBottom: true)
: wsCheckoutRow(context,
heading: trans(context, "Pay with"),
heading: trans("Pay with"),
leadImage: Icon(Icons.payment),
leadTitle: trans(
context, "Select a payment method"),
leadTitle: trans("Select a payment method"),
action: _actionPayWith,
showBorderBottom: true)),
_wooSignalApp.disableShipping == 1
@ -275,7 +271,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
null
? wsCheckoutRow(context,
heading:
trans(context, "Shipping selected"),
trans("Shipping selected"),
leadImage: Icon(Icons.local_shipping),
leadTitle: CheckoutSession
.getInstance.shippingType
@ -284,10 +280,9 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
: wsCheckoutRow(
context,
heading:
trans(context, "Select shipping"),
trans("Select shipping"),
leadImage: Icon(Icons.local_shipping),
leadTitle: trans(context,
"Select a shipping option"),
leadTitle: trans("Select a shipping option"),
action: _actionSelectShipping,
)),
].where((e) => e != null).toList()),
@ -302,23 +297,23 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
thickness: 1,
),
wsCheckoutSubtotalWidgetFB(
title: trans(context, "Subtotal"),
title: trans("Subtotal"),
),
_wooSignalApp.disableShipping == 1
? null
: widgetCheckoutMeta(context,
title: trans(context, "Shipping fee"),
title: trans("Shipping fee"),
amount:
CheckoutSession.getInstance.shippingType ==
null
? trans(context, "Select shipping")
? trans("Select shipping")
: CheckoutSession.getInstance.shippingType
.getTotal(withFormatting: true)),
(_taxRate != null
? wsCheckoutTaxAmountWidgetFB(taxRate: _taxRate)
: null),
wsCheckoutTotalWidgetFB(
title: trans(context, "Total"), taxRate: _taxRate),
title: trans("Total"), taxRate: _taxRate),
Divider(
color: Colors.black12,
thickness: 1,
@ -327,8 +322,8 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
),
PrimaryButton(
title: _isProcessingPayment
? "PROCESSING..."
: trans(context, "CHECKOUT"),
? "${trans("PROCESSING")}..."
: trans("CHECKOUT"),
action: _isProcessingPayment ? null : _handleCheckout,
),
],
@ -341,7 +336,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
Padding(
padding: const EdgeInsets.only(top: 15),
child: Text(
"${trans(context, "One moment")}...",
"${trans("One moment")}...",
style: Theme.of(context).textTheme.subtitle1,
),
)
@ -356,9 +351,8 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
if (CheckoutSession.getInstance.billingDetails.billingAddress == null) {
showToastNotification(
context,
title: trans(context, "Oops"),
description: trans(context,
"Please select add your billing/shipping address to proceed"),
title: trans("Oops"),
description: trans("Please select add your billing/shipping address to proceed"),
style: ToastNotificationStyleType.WARNING,
icon: Icons.local_shipping,
);
@ -369,9 +363,9 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
.hasMissingFields()) {
showToastNotification(
context,
title: trans(context, "Oops"),
title: trans("Oops"),
description:
trans(context, "Your billing/shipping details are incomplete"),
trans("Your billing/shipping details are incomplete"),
style: ToastNotificationStyleType.WARNING,
icon: Icons.local_shipping,
);
@ -382,9 +376,9 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
CheckoutSession.getInstance.shippingType == null) {
showToastNotification(
context,
title: trans(context, "Oops"),
title: trans("Oops"),
description:
trans(context, "Please select a shipping method to proceed"),
trans("Please select a shipping method to proceed"),
style: ToastNotificationStyleType.WARNING,
icon: Icons.local_shipping,
);
@ -394,9 +388,9 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
if (CheckoutSession.getInstance.paymentType == null) {
showToastNotification(
context,
title: trans(context, "Oops"),
title: trans("Oops"),
description:
trans(context, "Please select a payment method to proceed"),
trans("Please select a payment method to proceed"),
style: ToastNotificationStyleType.WARNING,
icon: Icons.payment,
);
@ -415,9 +409,9 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
if (doubleTotal < doubleMinimumValue) {
showToastNotification(context,
title: trans(context, "Sorry"),
title: trans("Sorry"),
description:
"${trans(context, "Spend a minimum of")} ${formatDoubleCurrency(total: doubleMinimumValue)} ${trans(context, "for")} ${CheckoutSession.getInstance.shippingType.getTitle()}",
"${trans("Spend a minimum of")} ${formatDoubleCurrency(total: doubleMinimumValue)} ${trans("for")} ${CheckoutSession.getInstance.shippingType.getTitle()}",
style: ToastNotificationStyleType.INFO,
duration: Duration(seconds: 3));
return;
@ -428,8 +422,8 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
if (!appStatus) {
showToastNotification(context,
title: trans(context, "Sorry"),
description: "${trans(context, "Retry later")}",
title: trans("Sorry"),
description: "${trans("Retry later")}",
style: ToastNotificationStyleType.INFO,
duration: Duration(seconds: 3));
return;

View File

@ -15,12 +15,13 @@ import 'package:flutter_app/app/models/checkout_session.dart';
import 'package:flutter_app/app/models/customer_address.dart';
import 'package:flutter_app/app/models/customer_country.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/config/app_theme.dart';
import 'package:flutter_app/resources/widgets/buttons.dart';
import 'package:flutter_app/resources/widgets/customer_address_input.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/switch_address_tab.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:validated/validated.dart' as validate;
class CheckoutDetailsPage extends StatefulWidget {
CheckoutDetailsPage();
@ -161,12 +162,11 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text(
trans(context, "Billing & Shipping Details"),
trans("Billing & Shipping Details"),
),
centerTitle: true,
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: GestureDetector(
onTap: () => FocusScope.of(context).requestFocus(new FocusNode()),
child: Column(
@ -195,7 +195,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
children: <Widget>[
SwitchAddressTab(
title:
trans(context, "Billing Details"),
trans("Billing Details"),
currentTabIndex: activeTabIndex,
type: "billing",
onTapAction: () => setState(() {
@ -203,8 +203,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
activeTab = tabBillingDetails();
})),
SwitchAddressTab(
title: trans(
context, "Shipping Address"),
title: trans("Shipping Address"),
currentTabIndex: activeTabIndex,
type: "shipping",
onTapAction: () => setState(() {
@ -225,7 +224,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
fit: FlexFit.tight,
child: Container(
decoration: BoxDecoration(
color: NyColors.of(context).backgroundContainer,
color: ThemeColor.get(context).backgroundContainer,
borderRadius: BorderRadius.circular(10),
boxShadow:
(Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
@ -246,7 +245,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
trans(context, "Ship to a different address?"),
trans("Ship to a different address?"),
style: Theme.of(context).textTheme.bodyText2,
),
Checkbox(
@ -260,7 +259,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
trans(context, "Remember my details"),
trans("Remember my details"),
style: Theme.of(context).textTheme.bodyText2,
),
Checkbox(
@ -274,7 +273,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
],
),
PrimaryButton(
title: trans(context, "USE DETAILS"),
title: trans("USE DETAILS"),
action: () => _useDetailsTapped(),
),
],
@ -315,9 +314,31 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
if (customerShippingAddress.hasMissingFields()) {
showToastNotification(
context,
title: trans(context, "Oops"),
description: trans(context,
"Invalid shipping address, please check your shipping details"),
title: trans("Oops"),
description: trans("Invalid shipping address, please check your shipping details"),
style: ToastNotificationStyleType.WARNING,
);
return;
}
// Email validation
String billingEmail = _txtBillingEmailAddress.text;
String shippingEmail = _txtShippingEmailAddress.text;
if (billingEmail.length > 0 && !validate.isEmail(billingEmail)) {
showToastNotification(
context,
title: trans("Oops"),
description: trans("Please enter a valid billing email"),
style: ToastNotificationStyleType.WARNING,
);
return;
}
if (shippingEmail.length > 0 && !validate.isEmail(shippingEmail)) {
showToastNotification(
context,
title: trans("Oops"),
description: trans("Please enter a valid shipping email"),
style: ToastNotificationStyleType.WARNING,
);
return;

View File

@ -13,8 +13,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_app/app/models/checkout_session.dart';
import 'package:flutter_app/app/models/payment_type.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/config/app_theme.dart';
import 'package:flutter_app/resources/widgets/buttons.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:nylo_support/helpers/helper.dart';
@ -51,13 +51,12 @@ class _CheckoutPaymentTypePageState extends State<CheckoutPaymentTypePage> {
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text(
trans(context, "Payment Method")
trans("Payment Method")
),
automaticallyImplyLeading: false,
centerTitle: true,
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: GestureDetector(
onTap: () => FocusScope.of(context).requestFocus(new FocusNode()),
child: LayoutBuilder(
@ -81,7 +80,7 @@ class _CheckoutPaymentTypePageState extends State<CheckoutPaymentTypePage> {
Expanded(
child: paymentTypes.length == 0 ? Container(
padding: EdgeInsets.only(top: 20),
child: Text(trans(context, "No payment methods are available"), style: Theme.of(context).textTheme.bodyText1,),
child: Text(trans("No payment methods are available"), style: Theme.of(context).textTheme.bodyText1,),
) : ListView.separated(
itemCount: paymentTypes.length,
itemBuilder: (BuildContext context, int index) {
@ -128,13 +127,13 @@ class _CheckoutPaymentTypePageState extends State<CheckoutPaymentTypePage> {
),
),
LinkButton(
title: trans(context, "CANCEL"),
title: trans("CANCEL"),
action: () => Navigator.pop(context),
),
],
),
decoration: BoxDecoration(
color: NyColors.of(context).backgroundContainer,
color: ThemeColor.get(context).backgroundContainer,
borderRadius: BorderRadius.circular(10),
boxShadow:
(Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,

View File

@ -17,9 +17,9 @@ import 'package:flutter_app/app/models/customer_address.dart';
import 'package:flutter_app/app/models/customer_country.dart';
import 'package:flutter_app/app/models/shipping_type.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/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:woosignal/models/response/shipping_method.dart';
@ -238,13 +238,12 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text(
trans(context, "Shipping Methods")
trans("Shipping Methods")
),
automaticallyImplyLeading: false,
centerTitle: true,
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: GestureDetector(
onTap: () => FocusScope.of(context).requestFocus(new FocusNode()),
child: LayoutBuilder(
@ -254,8 +253,7 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
children: <Widget>[
Padding(
child: Center(
child: Image.asset(
getImageAsset('shipping_icon.png'),
child: Image.asset(getImageAsset('shipping_icon.png'),
height: 100,
color: (Theme.of(context).brightness == Brightness.light) ? null : Colors.white,
fit: BoxFit.fitHeight,
@ -328,17 +326,17 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
is FreeShipping
? TextSpan(
text:
"Free postage",
trans("Free postage"),
)
: TextSpan(
text:
"${trans(context, "Price")}: ${formatStringCurrency(total: snapshot.data)}",
"${trans("Price")}: ${formatStringCurrency(total: snapshot.data)}",
)),
if (shippingOption[
"min_amount"] !=
null)
TextSpan(
text: "\nSpend a minimum of " +
text: "\n${trans("Spend a minimum of")} " +
formatStringCurrency(
total: shippingOption[
"min_amount"]),
@ -378,20 +376,19 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
),
)
: Text(
trans(context,
"Shipping is not supported for your country, sorry"),
trans("Shipping is not supported for your country, sorry"),
style:
Theme.of(context).textTheme.headline6,
textAlign: TextAlign.center,
))),
LinkButton(
title: trans(context, "CANCEL"),
title: trans("CANCEL"),
action: () => Navigator.pop(context),
),
],
),
decoration: BoxDecoration(
color: NyColors.of(context).backgroundContainer,
color: ThemeColor.get(context).backgroundContainer,
borderRadius: BorderRadius.circular(10),
boxShadow:
(Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,

View File

@ -67,23 +67,23 @@ class _CheckoutStatusState extends NyState<CheckoutStatusPage> {
children: <Widget>[
Padding(
child: Text(
trans(context, "Order Status"),
trans("Order Status"),
style: Theme.of(context).textTheme.subtitle1,
),
padding: EdgeInsets.only(bottom: 15),
),
Text(
trans(context, "Thank You!"),
trans("Thank You!"),
style: Theme.of(context).textTheme.headline6,
textAlign: TextAlign.left,
),
Text(
trans(context, "Your transaction details"),
trans("Your transaction details"),
style: Theme.of(context).textTheme.bodyText2,
textAlign: TextAlign.left,
),
Text(
"${trans(context, "Order Ref")}. #${_order.id.toString()}",
"${trans("Order Ref")}. #${_order.id.toString()}",
style: Theme.of(context).textTheme.bodyText1,
textAlign: TextAlign.left,
),
@ -112,7 +112,7 @@ class _CheckoutStatusState extends NyState<CheckoutStatusPage> {
Align(
child: Padding(
child: Text(
trans(context, "Items"),
trans("Items"),
style: Theme.of(context).textTheme.subtitle1,
textAlign: TextAlign.left,
),
@ -169,7 +169,7 @@ class _CheckoutStatusState extends NyState<CheckoutStatusPage> {
),
Align(
child: LinkButton(
title: trans(context, "Back to Home"),
title: trans("Back to Home"),
action: () => Navigator.pushNamed(context, "/home"),
),
alignment: Alignment.bottomCenter,

View File

@ -11,7 +11,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_app/app/models/default_shipping.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/config/app_theme.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
@ -46,12 +46,11 @@ class _CustomerCountriesPageState extends State<CustomerCountriesPage> {
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text(
trans(context, "Select a country")
trans("Select a country")
),
centerTitle: true,
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: Column(
children: [
Container(
@ -67,7 +66,7 @@ class _CustomerCountriesPageState extends State<CustomerCountriesPage> {
offset: Offset(0, 2),
),
],
color: NyColors.of(context).background
color: ThemeColor.get(context).background
),
height: 60,
child: Row(
@ -146,7 +145,7 @@ class _CustomerCountriesPageState extends State<CustomerCountriesPage> {
FocusScope.of(context).unfocus();
wsModalBottom(
context,
title: trans(context, "Select a state"),
title: trans("Select a state"),
bodyWidget: ListView.separated(
itemCount: defaultShipping.states.length,
itemBuilder: (BuildContext context, int index) {

View File

@ -10,8 +10,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_app/bootstrap/app_helper.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/resources/widgets/buttons.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:nylo_support/helpers/helper.dart';
import '../widgets/woosignal_ui.dart';
@ -50,8 +50,7 @@ class _HomeSearchPageState extends State<HomeSearchPage> {
title: StoreLogo(height: 55),
centerTitle: true,
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
@ -71,7 +70,7 @@ class _HomeSearchPageState extends State<HomeSearchPage> {
Padding(
padding: const EdgeInsets.only(top: 10),
child: PrimaryButton(
title: trans(context, "Search"),
title: trans("Search"),
action: _actionSearch,
),
)

View File

@ -12,7 +12,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_app/bootstrap/app_helper.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/resources/widgets/buttons.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:woosignal/models/response/woosignal_app.dart';
class NoConnectionPage extends StatefulWidget {
@ -34,8 +35,7 @@ class _NoConnectionPageState extends State<NoConnectionPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@ -49,12 +49,12 @@ class _NoConnectionPageState extends State<NoConnectionPage> {
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
trans(context, "Oops, something went wrong"),
trans("Oops, something went wrong"),
style: Theme.of(context).textTheme.bodyText2,
textAlign: TextAlign.center,
),
),
LinkButton(title: trans(context, "Retry"), action: _retry),
LinkButton(title: trans("Retry"), action: _retry),
],
),
),
@ -67,8 +67,8 @@ class _NoConnectionPageState extends State<NoConnectionPage> {
if (wooSignalApp == null) {
showToastNotification(context,
title: trans(context, "Oops"),
description: trans(context, "Retry later"));
title: trans("Oops"),
description: trans("Retry later"));
return;
}

View File

@ -10,20 +10,16 @@
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter_app/app/controllers/product_detail_controller.dart';
import 'package:flutter_app/app/models/cart.dart';
import 'package:flutter_app/app/models/cart_line_item.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/cached_image_widget.dart';
import 'package:flutter_app/resources/widgets/cart_icon_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_support/widgets/ny_state.dart';
import 'package:nylo_support/widgets/ny_stateful_widget.dart';
import 'package:nylo_framework/nylo_framework.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';
@ -106,7 +102,7 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
wsModalBottom(
context,
title:
"${trans(context, "Select a")} ${_product.attributes[attributeIndex].name}",
"${trans("Select a")} ${_product.attributes[attributeIndex].name}",
bodyWidget: ListView.separated(
itemCount: _product.attributes[attributeIndex].options.length,
separatorBuilder: (BuildContext context, int index) => Divider(),
@ -140,8 +136,8 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
_itemAddToCart({CartLineItem cartLineItem}) async {
await Cart.getInstance.addToCart(cartLineItem: cartLineItem);
showStatusAlert(context,
title: trans(context, "Success"),
subtitle: trans(context, "Added to cart"),
title: trans("Success"),
subtitle: trans("Added to cart"),
duration: 1,
icon: Icons.add_shopping_cart);
setState(() {});
@ -151,7 +147,7 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
WS.ProductVariation productVariation = findProductVariation();
wsModalBottom(
context,
title: trans(context, "Options"),
title: trans("Options"),
bodyWidget: ListView.separated(
itemCount: _product.attributes.length,
separatorBuilder: (BuildContext context, int index) => Divider(
@ -167,7 +163,7 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
? Text(_tmpAttributeObj[index]["value"],
style: Theme.of(context).textTheme.bodyText1)
: Text(
"${trans(context, "Select a")} ${_product.attributes[index].name}"),
"${trans("Select a")} ${_product.attributes[index].name}"),
trailing: (_tmpAttributeObj.isNotEmpty &&
_tmpAttributeObj.containsKey(index))
? Icon(Icons.check, color: Colors.blueAccent)
@ -184,49 +180,49 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
children: <Widget>[
Text(
(productVariation != null
? "${trans(context, "Price")}: ${formatStringCurrency(total: productVariation.price)}"
? "${trans("Price")}: ${formatStringCurrency(total: productVariation.price)}"
: (((_product.attributes.length ==
_tmpAttributeObj.values.length) &&
productVariation == null)
? trans(context, "This variation is unavailable")
: trans(context, "Choose your options"))),
? trans("This variation is unavailable")
: trans("Choose your options"))),
style: Theme.of(context).textTheme.subtitle1,
),
Text(
(productVariation != null
? productVariation.stockStatus != "instock"
? trans(context, "Out of stock")
? trans("Out of stock")
: ""
: ""),
style: Theme.of(context).textTheme.subtitle1,
),
PrimaryButton(
title: trans(context, "Add to cart"),
title: trans("Add to cart"),
action: () {
if (_product.attributes.length !=
_tmpAttributeObj.values.length) {
showToastNotification(context,
title: trans(context, "Oops"),
title: trans("Oops"),
description:
trans(context, "Please select valid options first"),
trans("Please select valid options first"),
style: ToastNotificationStyleType.WARNING);
return;
}
if (productVariation == null) {
showToastNotification(context,
title: trans(context, "Oops"),
title: trans("Oops"),
description:
trans(context, "Product variation does not exist"),
trans("Product variation does not exist"),
style: ToastNotificationStyleType.WARNING);
return;
}
if (productVariation.stockStatus != "instock") {
showToastNotification(context,
title: trans(context, "Sorry"),
title: trans("Sorry"),
description:
trans(context, "This item is not in stock"),
trans("This item is not in stock"),
style: ToastNotificationStyleType.WARNING);
return;
}
@ -271,7 +267,7 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
_modalBottomSheetMenu() {
wsModalBottom(
context,
title: trans(context, "Description"),
title: trans("Description"),
bodyWidget: SingleChildScrollView(
child: Text(
parseHtmlString(_product.description),
@ -378,7 +374,7 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
),
Container(
decoration: BoxDecoration(
color: NyColors.of(context).background,
color: ThemeColor.get(context).background,
// boxShadow: wsBoxShadow(),
borderRadius: BorderRadius.circular(4),
),
@ -395,7 +391,7 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
trans(context, "Description"),
trans("Description"),
style: Theme.of(context)
.textTheme
.caption
@ -404,7 +400,7 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
),
MaterialButton(
child: Text(
trans(context, "Full description"),
trans("Full description"),
style: Theme.of(context)
.textTheme
.bodyText2
@ -439,7 +435,7 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
Container(
padding: EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: NyColors.of(context).background,
color: ThemeColor.get(context).background,
boxShadow: [
BoxShadow(
color: Colors.black12,
@ -463,7 +459,7 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
trans(context, "Quantity"),
trans("Quantity"),
style: Theme.of(context)
.textTheme
.bodyText1
@ -515,14 +511,14 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
_product.type == "external"
? Flexible(
child: PrimaryButton(
title: trans(context, "Buy Product"),
title: trans("Buy Product"),
action: () => widget.controller
.viewExternalProduct(_product),
),
)
: Flexible(
child: PrimaryButton(
title: trans(context, "Add to cart"),
title: trans("Add to cart"),
action: () => _addItemToCart(),
),
),
@ -545,8 +541,8 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
}
if (_product.stockStatus != "instock") {
showToastNotification(context,
title: trans(context, "Sorry"),
description: trans(context, "This item is out of stock"),
title: trans("Sorry"),
description: trans("This item is out of stock"),
style: ToastNotificationStyleType.WARNING,
icon: Icons.local_shipping);
return;
@ -574,9 +570,9 @@ class _ProductDetailState extends NyState<ProductDetailPage> {
if (_product.manageStock != null && _product.manageStock == true) {
if (_quantityIndicator >= _product.stockQuantity) {
showToastNotification(context,
title: trans(context, "Maximum quantity reached"),
title: trans("Maximum quantity reached"),
description:
"${trans(context, "Sorry, only")} ${_product.stockQuantity} ${trans(context, "left")}",
"${trans("Sorry, only")} ${_product.stockQuantity} ${trans("left")}",
style: ToastNotificationStyleType.INFO);
return;
}

View File

@ -8,11 +8,10 @@
// 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:flutter/material.dart';
import 'package:flutter_app/app/controllers/product_image_viewer_controller.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/resources/widgets/cached_image_widget.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_support/widgets/ny_state.dart';
@ -33,16 +32,16 @@ class _ProductImageViewerPageState extends NyState<ProductImageViewerPage> {
@override
void initState() {
this._initialIndex = widget.controller.data()['index'];
this._arrImageSrc = widget.controller.data()['images'];
Map<String, dynamic> imageData = widget.controller.data();
this._initialIndex = imageData['index'];
this._arrImageSrc = imageData['images'];
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: Column(
children: <Widget>[
Expanded(

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app/config/app_theme.dart';
import 'package:flutter_app/config/app_font.dart';
import 'package:flutter_app/resources/themes/styles/base_styles.dart';
import 'package:flutter_app/resources/themes/text_theme/default_text_theme.dart';
import 'package:nylo_framework/nylo_framework.dart';
@ -12,56 +13,48 @@ import 'package:nylo_framework/nylo_framework.dart';
|--------------------------------------------------------------------------
*/
ThemeData darkTheme() {
ThemeData darkTheme(BaseColorStyles darkColors) {
TextTheme darkTheme =
getAppTextTheme(appThemeFont, defaultTextTheme.merge(_darkTextTheme()));
getAppTextTheme(appFont, defaultTextTheme.merge(_darkTextTheme(darkColors)));
return ThemeData(
primaryColor: NyColors.light.primaryContent,
backgroundColor: NyColors.dark.background,
primaryColor: darkColors.primaryContent,
backgroundColor: darkColors.background,
colorScheme: ColorScheme.dark(),
primaryColorLight: NyColors.light.primaryAccent,
primaryColorDark: NyColors.dark.primaryContent,
focusColor: NyColors.dark.primaryContent,
scaffoldBackgroundColor: NyColors.dark.background,
hintColor: NyColors.light.primaryAccent,
primaryColorDark: darkColors.primaryContent,
focusColor: darkColors.primaryContent,
scaffoldBackgroundColor: darkColors.background,
appBarTheme: AppBarTheme(
backgroundColor: NyColors.dark.appBarBackground,
backgroundColor: darkColors.appBarBackground,
titleTextStyle: darkTheme.headline6
.copyWith(color: NyColors.dark.appBarPrimaryContent),
iconTheme: IconThemeData(color: NyColors.dark.appBarPrimaryContent),
.copyWith(color: darkColors.appBarPrimaryContent),
iconTheme: IconThemeData(color: darkColors.appBarPrimaryContent),
elevation: 1.0,
systemOverlayStyle: SystemUiOverlayStyle.light),
buttonTheme: ButtonThemeData(
buttonColor: NyColors.dark.primaryAccent,
colorScheme: ColorScheme.light(primary: NyColors.dark.buttonBackground),
buttonColor: darkColors.primaryAccent,
colorScheme: ColorScheme.light(primary: darkColors.buttonBackground),
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(primary: NyColors.dark.primaryContent),
style: TextButton.styleFrom(primary: darkColors.primaryContent),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: TextButton.styleFrom(
primary: NyColors.dark.buttonPrimaryContent,
backgroundColor: NyColors.dark.buttonBackground),
),
inputDecorationTheme: InputDecorationTheme(
focusedBorder:UnderlineInputBorder(
borderSide:BorderSide(color: Colors.black)
),
primary: darkColors.buttonPrimaryContent,
backgroundColor: darkColors.buttonBackground),
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: NyColors.dark.bottomTabBarBackground,
backgroundColor: darkColors.bottomTabBarBackground,
unselectedIconTheme:
IconThemeData(color: NyColors.dark.bottomTabBarIconUnselected),
IconThemeData(color: darkColors.bottomTabBarIconUnselected),
selectedIconTheme:
IconThemeData(color: NyColors.dark.bottomTabBarIconSelected),
IconThemeData(color: darkColors.bottomTabBarIconSelected),
unselectedLabelStyle:
TextStyle(color: NyColors.dark.bottomTabBarLabelUnselected),
TextStyle(color: darkColors.bottomTabBarLabelUnselected),
selectedLabelStyle:
TextStyle(color: NyColors.dark.bottomTabBarLabelSelected),
selectedItemColor: NyColors.dark.bottomTabBarLabelSelected,
TextStyle(color: darkColors.bottomTabBarLabelSelected),
selectedItemColor: darkColors.bottomTabBarLabelSelected,
),
textTheme: darkTheme,
textSelectionTheme: TextSelectionThemeData(cursorColor: NyColors.dark.inputPrimaryContent),
);
}
@ -71,8 +64,8 @@ ThemeData darkTheme() {
|--------------------------------------------------------------------------
*/
TextTheme _darkTextTheme() {
final Color darkPrimaryContent = NyColors.dark.primaryContent;
TextTheme _darkTextTheme(BaseColorStyles dark) {
final Color darkPrimaryContent = dark.primaryContent;
return TextTheme(
headline6: TextStyle(
color: darkPrimaryContent.withOpacity(0.8),
@ -108,10 +101,10 @@ TextTheme _darkTextTheme() {
color: darkPrimaryContent.withOpacity(0.8),
),
bodyText1: TextStyle(
color: NyColors.dark.primaryContent,
color: darkPrimaryContent,
),
caption: TextStyle(
color: darkPrimaryContent.withOpacity(0.8),
),
);
}
}

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app/config/app_theme.dart';
import 'package:flutter_app/config/app_font.dart';
import 'package:flutter_app/resources/themes/styles/base_styles.dart';
import 'package:flutter_app/resources/themes/text_theme/default_text_theme.dart';
import 'package:nylo_framework/nylo_framework.dart';
@ -12,60 +13,51 @@ import 'package:nylo_framework/nylo_framework.dart';
|--------------------------------------------------------------------------
*/
ThemeData lightTheme() {
ThemeData lightTheme(BaseColorStyles lightColors) {
TextTheme lightTheme =
getAppTextTheme(appThemeFont, defaultTextTheme.merge(_lightTextTheme()));
final Color lightPrimaryContent = NyColors.light.primaryContent;
final Color darkPrimaryContent = NyColors.dark.primaryContent;
getAppTextTheme(appFont, defaultTextTheme.merge(_lightTextTheme(lightColors)));
return ThemeData(
primaryColor: lightPrimaryContent,
backgroundColor: NyColors.light.background,
primaryColor: lightColors.primaryContent,
backgroundColor: lightColors.background,
colorScheme: ColorScheme.light(),
primaryColorLight: NyColors.light.primaryAccent,
primaryColorDark: darkPrimaryContent,
focusColor: lightPrimaryContent,
scaffoldBackgroundColor: NyColors.light.background,
hintColor: NyColors.light.primaryAccent,
primaryColorLight: lightColors.primaryAccent,
focusColor: lightColors.primaryContent,
scaffoldBackgroundColor: lightColors.background,
hintColor: lightColors.primaryAccent,
appBarTheme: AppBarTheme(
backgroundColor: NyColors.light.appBarBackground,
backgroundColor: lightColors.appBarBackground,
titleTextStyle: lightTheme.headline6
.copyWith(color: NyColors.light.appBarPrimaryContent),
iconTheme: IconThemeData(color: NyColors.light.appBarPrimaryContent),
.copyWith(color: lightColors.appBarPrimaryContent),
iconTheme: IconThemeData(color: lightColors.appBarPrimaryContent),
elevation: 1.0,
systemOverlayStyle: SystemUiOverlayStyle.dark,
),
buttonTheme: ButtonThemeData(
buttonColor: NyColors.light.buttonPrimaryContent,
colorScheme: ColorScheme.light(primary: NyColors.light.buttonBackground),
buttonColor: lightColors.buttonPrimaryContent,
colorScheme: ColorScheme.light(primary: lightColors.buttonBackground),
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(primary: lightPrimaryContent),
style: TextButton.styleFrom(primary: lightColors.primaryContent),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: TextButton.styleFrom(
primary: NyColors.light.buttonPrimaryContent,
backgroundColor: NyColors.light.buttonBackground),
primary: lightColors.buttonPrimaryContent,
backgroundColor: lightColors.buttonBackground),
),
inputDecorationTheme: InputDecorationTheme(
focusedBorder:UnderlineInputBorder(
borderSide:BorderSide(color: Colors.black)
),
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: NyColors.light.bottomTabBarBackground,
backgroundColor: lightColors.bottomTabBarBackground,
unselectedIconTheme:
IconThemeData(color: NyColors.light.bottomTabBarIconUnselected),
IconThemeData(color: lightColors.bottomTabBarIconUnselected),
selectedIconTheme:
IconThemeData(color: NyColors.light.bottomTabBarIconSelected),
IconThemeData(color: lightColors.bottomTabBarIconSelected),
unselectedLabelStyle:
TextStyle(color: NyColors.light.bottomTabBarLabelUnselected),
TextStyle(color: lightColors.bottomTabBarLabelUnselected),
selectedLabelStyle:
TextStyle(color: NyColors.light.bottomTabBarLabelSelected),
selectedItemColor: NyColors.light.bottomTabBarLabelSelected,
TextStyle(color: lightColors.bottomTabBarLabelSelected),
selectedItemColor: lightColors.bottomTabBarLabelSelected,
),
textTheme: lightTheme,
textSelectionTheme: TextSelectionThemeData(cursorColor: NyColors.light.inputPrimaryContent)
);
}
@ -75,8 +67,8 @@ ThemeData lightTheme() {
|--------------------------------------------------------------------------
*/
TextTheme _lightTextTheme() {
final Color lightPrimaryContent = NyColors.light.primaryContent;
TextTheme _lightTextTheme(BaseColorStyles lightColors) {
Color lightPrimaryContent = lightColors.primaryContent;
return TextTheme(
headline6: TextStyle(
color: lightPrimaryContent,
@ -118,4 +110,4 @@ TextTheme _lightTextTheme() {
color: lightPrimaryContent,
),
);
}
}

View File

@ -3,13 +3,16 @@ import 'package:flutter/material.dart';
/// Interface for your base styles.
/// Add more styles here and then implement in
/// light_theme_colors.dart and dark_theme_colors.dart.
abstract class BaseStyles {
abstract class BaseColorStyles {
// general
Color get background;
Color get backgroundContainer;
Color get primaryContent;
Color get primaryAccent;
Color get surfaceBackground;
Color get surfaceContent;
// app bar
Color get appBarBackground;
Color get appBarPrimaryContent;

View File

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_app/resources/themes/styles/theme_styles.dart';
import 'package:flutter_app/resources/themes/styles/base_styles.dart';
/*
|--------------------------------------------------------------------------
@ -7,7 +7,7 @@ import 'package:flutter_app/resources/themes/styles/theme_styles.dart';
|--------------------------------------------------------------------------
*/
class DarkThemeColors implements BaseStyles {
class DarkThemeColors implements BaseColorStyles {
// general
Color get background => const Color(0xFF212121);
Color get backgroundContainer => const Color(0xFF4a4a4a);
@ -15,6 +15,9 @@ class DarkThemeColors implements BaseStyles {
Color get primaryContent => const Color(0xFFE1E1E1);
Color get primaryAccent => const Color(0xFF818181);
Color get surfaceBackground => Color(0xFF818181);
Color get surfaceContent => Colors.black;
// app bar
Color get appBarBackground => const Color(0xFF2C2C2C);
Color get appBarPrimaryContent => Colors.white;

View File

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_app/resources/themes/styles/theme_styles.dart';
import 'package:flutter_app/resources/themes/styles/base_styles.dart';
/*
|--------------------------------------------------------------------------
@ -7,13 +7,16 @@ import 'package:flutter_app/resources/themes/styles/theme_styles.dart';
|--------------------------------------------------------------------------
*/
class LightThemeColors implements BaseStyles {
class LightThemeColors implements BaseColorStyles {
// general
Color get background => const Color(0xFFFFFFFF);
Color get backgroundContainer => Colors.white;
Color get primaryContent => const Color(0xFF000000);
Color get primaryAccent => const Color(0xFF87c694);
Color get surfaceBackground => Colors.white;
Color get surfaceContent => Colors.black;
// app bar
Color get appBarBackground => Colors.white;
Color get appBarPrimaryContent => const Color(0xFF3a3d40);

View File

@ -30,7 +30,7 @@ class AppVersionWidget extends StatelessWidget {
if (snapshot.hasError) return Text("");
return Padding(
child: Text(
"${trans(context, "Version")}: ${snapshot.data.version}",
"${trans("Version")}: ${snapshot.data.version}",
style: Theme.of(context)
.textTheme
.bodyText2

View File

@ -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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';

View File

@ -8,8 +8,6 @@ import 'package:flutter_app/bootstrap/app_helper.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'dart:async';
import 'package:nylo_support/helpers/helper.dart';
import 'package:nylo_support/widgets/ny_state.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:woosignal/models/response/woosignal_app.dart';
@ -101,9 +99,9 @@ class WebViewState extends NyState<PayPalCheckout> {
}
String _loadHTML() {
final String strProcessingPayment = trans(context, "Processing Payment");
final String strPleaseWait = trans(context, "Please wait, your order is being processed and you will be redirected to the PayPal website.");
final String strRedirectMessage = trans(context, "If you are not automatically redirected to PayPal within 5 seconds");
final String strProcessingPayment = trans("Processing Payment");
final String strPleaseWait = trans("Please wait, your order is being processed and you will be redirected to the PayPal website.");
final String strRedirectMessage = trans("If you are not automatically redirected to PayPal within 5 seconds");
return '''
<html><head><title>$strProcessingPayment...</title></head>

View File

@ -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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/app/models/customer_country.dart';
import 'package:flutter_app/resources/widgets/buttons.dart';
@ -49,14 +48,14 @@ class CustomerAddressInput extends StatelessWidget {
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans(context, "First Name"),
heading: trans("First Name"),
controller: txtControllerFirstName,
shouldAutoFocus: true,
),
),
Flexible(
child: TextEditingRow(
heading: trans(context, "Last Name"),
heading: trans("Last Name"),
controller: txtControllerLastName,
),
),
@ -70,13 +69,13 @@ class CustomerAddressInput extends StatelessWidget {
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans(context, "Address Line"),
heading: trans("Address Line"),
controller: txtControllerAddressLine,
),
),
Flexible(
child: TextEditingRow(
heading: trans(context, "City"),
heading: trans("City"),
controller: txtControllerCity,
),
),
@ -88,13 +87,13 @@ class CustomerAddressInput extends StatelessWidget {
children: <Widget>[
Flexible(
child: TextEditingRow(
heading: trans(context, "Postal code"),
heading: trans("Postal code"),
controller: txtControllerPostalCode,
),
),
Flexible(
child: TextEditingRow(
heading: trans(context, "Email address"),
heading: trans("Email address"),
keyboardType: TextInputType.emailAddress,
controller: txtControllerEmailAddress),
),
@ -113,7 +112,7 @@ class CustomerAddressInput extends StatelessWidget {
Container(
height: 23,
child: Text(
trans(context, "State"),
trans("State"),
style: Theme.of(context).textTheme.bodyText1,
textAlign: TextAlign.left,
),
@ -123,7 +122,7 @@ class CustomerAddressInput extends StatelessWidget {
child: SecondaryButton(
title: (customerCountry.state != null
? (customerCountry?.state?.name ?? "")
: trans(context, "Select state")),
: trans("Select state")),
action: onTapCountry,
),
padding: EdgeInsets.all(8),
@ -137,7 +136,7 @@ class CustomerAddressInput extends StatelessWidget {
Container(
height: 23,
child: Text(
trans(context, "Country"),
trans("Country"),
style: Theme.of(context).textTheme.bodyText1,
textAlign: TextAlign.left,
),
@ -148,7 +147,7 @@ class CustomerAddressInput extends StatelessWidget {
title: (customerCountry != null &&
(customerCountry?.name ?? "").isNotEmpty
? customerCountry.name
: trans(context, "Select country")),
: trans("Select country")),
action: onTapCountry,
),
padding: EdgeInsets.all(8),

View File

@ -12,7 +12,6 @@
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_version_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_framework/theme/helper/ny_theme.dart';
@ -35,33 +34,33 @@ class _HomeDrawerWidgetState extends State<HomeDrawerWidget> {
bool isDark = (Theme.of(context).brightness == Brightness.dark);
return Drawer(
child: Container(
color: NyColors.of(context).background,
color: ThemeColor.get(context).background,
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
child: Center(child: StoreLogo()),
decoration: BoxDecoration(
color: NyColors.of(context).background,
color: ThemeColor.get(context).background,
),
),
Padding(
child: Text(
trans(context, "Menu"),
trans("Menu"),
style: Theme.of(context).textTheme.subtitle2,
),
padding: EdgeInsets.only(left: 16, top: 8, bottom: 8),
),
if (widget.wooSignalApp.wpLoginEnabled == 1)
ListTile(
title: Text(trans(context, "Profile"), style: Theme.of(context).textTheme.bodyText2.copyWith(
title: Text(trans("Profile"), style: Theme.of(context).textTheme.bodyText2.copyWith(
fontSize: 16
),),
leading: Icon(Icons.account_circle),
onTap: _actionProfile,
),
ListTile(
title: Text(trans(context, "Cart"), style: Theme.of(context).textTheme.bodyText2.copyWith(
title: Text(trans("Cart"), style: Theme.of(context).textTheme.bodyText2.copyWith(
fontSize: 16
),),
leading: Icon(Icons.shopping_cart),
@ -70,7 +69,7 @@ class _HomeDrawerWidgetState extends State<HomeDrawerWidget> {
if (widget.wooSignalApp.appTermslink != null && widget.wooSignalApp.appPrivacylink != null)
Padding(
child: Text(
trans(context, "About Us"),
trans("About Us"),
style: Theme.of(context).textTheme.subtitle2,
),
padding: EdgeInsets.only(left: 16, top: 8, bottom: 8),
@ -78,7 +77,7 @@ class _HomeDrawerWidgetState extends State<HomeDrawerWidget> {
if (widget.wooSignalApp.appTermslink != null &&
widget.wooSignalApp.appTermslink.isNotEmpty)
ListTile(
title: Text(trans(context, "Terms and conditions"),
title: Text(trans("Terms and conditions"),
style: Theme.of(context).textTheme.bodyText2.copyWith(
fontSize: 16
),),
@ -89,7 +88,7 @@ class _HomeDrawerWidgetState extends State<HomeDrawerWidget> {
if (widget.wooSignalApp.appPrivacylink != null &&
widget.wooSignalApp.appPrivacylink.isNotEmpty)
ListTile(
title: Text(trans(context, "Privacy policy"), style: Theme.of(context).textTheme.bodyText2.copyWith(
title: Text(trans("Privacy policy"), style: Theme.of(context).textTheme.bodyText2.copyWith(
fontSize: 16
),),
trailing: Icon(Icons.keyboard_arrow_right_rounded),
@ -98,7 +97,7 @@ class _HomeDrawerWidgetState extends State<HomeDrawerWidget> {
),
ListTile(
title: Text(
trans(context, (isDark ? "Light Mode" : "Dark Mode")),
trans((isDark ? "Light Mode" : "Dark Mode")),
style: Theme.of(context).textTheme.bodyText2.copyWith(
fontSize: 16
)

View File

@ -3,6 +3,7 @@ import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/resources/widgets/app_loader_widget.dart';
import 'package:flutter_app/resources/widgets/cart_icon_widget.dart';
import 'package:flutter_app/resources/widgets/home_drawer_widget.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_support/helpers/helper.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -81,7 +82,7 @@ class _MelloThemeWidgetState extends State<MelloThemeWidget> {
widget.globalKey.currentState.setState(() {});
wsModalBottom(
context,
title: trans(context, "Categories"),
title: trans("Categories"),
bodyWidget: ListView.separated(
itemCount: _categories.length,
separatorBuilder: (cxt, i) => Divider(),
@ -119,8 +120,7 @@ class _MelloThemeWidgetState extends State<MelloThemeWidget> {
CartIconWidget(key: widget.globalKey),
],
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,

View File

@ -18,7 +18,7 @@ class NoResultsForProductsWidget extends StatelessWidget {
Widget build(BuildContext context) => Column(
children: <Widget>[
Text(
trans(context, "No results"),
trans("No results"),
style: Theme.of(context).textTheme.bodyText2,
),
],

View File

@ -5,6 +5,7 @@ import 'package:flutter_app/resources/widgets/app_loader_widget.dart';
import 'package:flutter_app/resources/widgets/cached_image_widget.dart';
import 'package:flutter_app/resources/widgets/home_drawer_widget.dart';
import 'package:flutter_app/resources/widgets/no_results_for_products_widget.dart';
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
@ -83,7 +84,7 @@ class _NoticHomeWidgetState extends State<NoticHomeWidget> {
_modalBottomSheetMenu() {
wsModalBottom(
context,
title: trans(context, "Categories"),
title: trans("Categories"),
bodyWidget: ListView.separated(
itemCount: _categories.length,
separatorBuilder: (cxt, i) => Divider(),
@ -116,7 +117,7 @@ class _NoticHomeWidgetState extends State<NoticHomeWidget> {
highlightColor: Colors.transparent,
onTap: _modalBottomSheetMenu,
child: Text(
trans(context, "Categories"),
trans("Categories"),
style: Theme.of(context).textTheme.bodyText2,
),
),
@ -124,8 +125,7 @@ class _NoticHomeWidgetState extends State<NoticHomeWidget> {
),
],
),
body: SafeArea(
minimum: safeAreaDefault(),
body: SafeAreaWidget(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
@ -156,10 +156,10 @@ class _NoticHomeWidgetState extends State<NoticHomeWidget> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(trans(context, "Must have")),
Text(trans("Must have")),
Flexible(
child: Text(
trans(context, "Our selection of new items"),
trans("Our selection of new items"),
style: Theme.of(context).textTheme.headline4,
maxLines: 2, overflow: TextOverflow.ellipsis,
),
@ -176,18 +176,17 @@ class _NoticHomeWidgetState extends State<NoticHomeWidget> {
builder: (BuildContext context, LoadStatus mode) {
Widget body;
if (mode == LoadStatus.idle) {
body = Text(trans(context, "pull up load"));
body = Text(trans("pull up load"));
} else if (mode == LoadStatus.loading) {
body = CupertinoActivityIndicator();
} else if (mode == LoadStatus.failed) {
body = Text(trans(
context, "Load Failed! Click retry!"));
body = Text(trans("Load Failed! Click retry!"));
} else if (mode == LoadStatus.canLoading) {
body = Text(
trans(context, "release to load more"));
trans("release to load more"));
} else {
body =
Text(trans(context, "No more products"));
Text(trans("No more products"));
}
return Container(
height: 55.0,

View File

@ -1,4 +1,16 @@
import 'package:flutter/cupertino.dart';
//
// 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/material.dart';
import 'package:flutter_app/bootstrap/app_helper.dart';
import 'package:flutter_app/bootstrap/shared_pref/sp_auth.dart';

View File

@ -17,7 +17,7 @@ class SafeAreaWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SafeArea(
minimum: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
minimum: EdgeInsets.only(left: 16, right: 16, bottom: 8),
child: child,
);
}

View File

@ -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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class SwitchAddressTab extends StatelessWidget {

View File

@ -26,7 +26,7 @@ class TopNavWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
"${(trans(context, "Shop").capitalize())} / ",
"${(trans("Shop").capitalize())} / ",
style: Theme.of(context)
.textTheme
.subtitle1
@ -34,7 +34,7 @@ class TopNavWidget extends StatelessWidget {
maxLines: 1,
),
AutoSizeText(
trans(context, "Newest"),
trans("Newest"),
style: Theme.of(context)
.textTheme
.bodyText2
@ -48,7 +48,7 @@ class TopNavWidget extends StatelessWidget {
minWidth: 100,
height: 60,
child: AutoSizeText(
trans(context, "Browse categories"),
trans("Browse categories"),
style: Theme.of(context).textTheme.bodyText1,
maxLines: 1,
textAlign: TextAlign.right,

View File

@ -12,13 +12,11 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_app/app/models/cart.dart';
import 'package:flutter_app/app/models/cart_line_item.dart';
import 'package:flutter_app/app/models/checkout_session.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/cached_image_widget.dart';
import 'package:flutter_app/resources/widgets/no_results_for_products_widget.dart';
@ -62,15 +60,15 @@ class RefreshableScrollContainer extends StatelessWidget {
builder: (BuildContext context, LoadStatus mode) {
Widget body;
if (mode == LoadStatus.idle) {
body = Text(trans(context, "pull up load"));
body = Text(trans("pull up load"));
} else if (mode == LoadStatus.loading) {
body = CupertinoActivityIndicator();
} else if (mode == LoadStatus.failed) {
body = Text(trans(context, "Load Failed! Click retry!"));
body = Text(trans("Load Failed! Click retry!"));
} else if (mode == LoadStatus.canLoading) {
body = Text(trans(context, "release to load more"));
body = Text(trans("release to load more"));
} else {
body = Text(trans(context, "No more products"));
body = Text(trans("No more products"));
}
return Container(
height: 55.0,
@ -239,7 +237,7 @@ class TextEditingRow extends StatelessWidget {
child: Text(
heading,
style: Theme.of(context).textTheme.bodyText1.copyWith(
color: NyColors.of(context).primaryContent
color: ThemeColor.get(context).primaryContent
),
),
padding: EdgeInsets.only(bottom: 2),
@ -356,7 +354,7 @@ class ProductItemContainer extends StatelessWidget {
children: <TextSpan>[
TextSpan(
text:
"${workoutSaleDiscount(salePrice: product.salePrice, priceBefore: product.regularPrice)}% ${trans(context, "off")}",
"${workoutSaleDiscount(salePrice: product.salePrice, priceBefore: product.regularPrice)}% ${trans("off")}",
style: Theme.of(context)
.textTheme
.bodyText1
@ -404,7 +402,7 @@ class ProductItemContainer extends StatelessWidget {
? RichText(
text: TextSpan(children: [
TextSpan(
text: '${trans(context, "Was")}: ',
text: '${trans("Was")}: ',
style: Theme.of(context)
.textTheme
.bodyText1
@ -456,7 +454,7 @@ wsModalBottom(BuildContext context,
child: new Container(
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: new BoxDecoration(
color: NyColors.of(context).background,
color: ThemeColor.get(context).background,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(10.0),
topRight: const Radius.circular(10.0),
@ -480,7 +478,7 @@ wsModalBottom(BuildContext context,
decoration: BoxDecoration(
boxShadow:
(Theme.of(context).brightness == Brightness.light) ? wsBoxShadow() : null,
color: NyColors.of(context).background,
color: ThemeColor.get(context).background,
borderRadius: BorderRadius.circular(8),
),
child: bodyWidget,
@ -508,7 +506,7 @@ FutureBuilder getTotalWidget() => FutureBuilder<String>(
else
return new Padding(
child: TextRowWidget(
title: trans(context, "Total"),
title: trans("Total"),
text: snapshot.data,
),
padding: EdgeInsets.only(bottom: 15, top: 15),
@ -555,7 +553,7 @@ FutureBuilder wsCheckoutTaxAmountWidgetFB({TaxRate taxRate}) {
: Padding(
child: widgetCheckoutMeta(
context,
title: trans(context, "Tax"),
title: trans("Tax"),
amount: formatStringCurrency(total: snapshot.data),
),
padding: EdgeInsets.only(bottom: 0, top: 0),
@ -688,8 +686,8 @@ class CartItemContainer extends StatelessWidget {
children: <Widget>[
Text(
(cartLineItem.stockStatus == "outofstock"
? trans(context, "Out of stock")
: trans(context, "In Stock")),
? trans("Out of stock")
: trans("In Stock")),
style: (cartLineItem.stockStatus == "outofstock"
? Theme.of(context).textTheme.caption
: Theme.of(context).textTheme.bodyText2),

View File

@ -35,14 +35,14 @@ packages:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "2.3.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.1"
version: "2.8.2"
auto_size_text:
dependency: "direct main"
description:
@ -91,7 +91,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
charcode:
dependency: transitive
description:
@ -255,7 +255,42 @@ packages:
name: flutter_secure_storage
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.1"
version: "5.0.2"
flutter_secure_storage_linux:
dependency: transitive
description:
name: flutter_secure_storage_linux
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
flutter_secure_storage_macos:
dependency: transitive
description:
name: flutter_secure_storage_macos
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
flutter_secure_storage_platform_interface:
dependency: transitive
description:
name: flutter_secure_storage_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
flutter_secure_storage_web:
dependency: transitive
description:
name: flutter_secure_storage_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
flutter_secure_storage_windows:
dependency: transitive
description:
name: flutter_secure_storage_windows
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
flutter_spinkit:
dependency: "direct main"
description:
@ -398,7 +433,7 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
version: "0.12.11"
math_expressions:
dependency: "direct main"
description:
@ -426,14 +461,14 @@ packages:
name: nylo_framework
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
version: "2.1.1"
nylo_support:
dependency: transitive
description:
name: nylo_support
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.2.1"
octo_image:
dependency: transitive
description:
@ -560,6 +595,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
recase:
dependency: transitive
description:
name: recase
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
rxdart:
dependency: transitive
description:
@ -704,7 +746,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.2"
version: "0.4.3"
theme_provider:
dependency: transitive
description:
@ -733,13 +775,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.5"
validated:
dependency: "direct main"
description:
name: validated
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
watcher:
dependency: transitive
description:
@ -818,5 +867,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.14.4 <3.0.0"
dart: ">=2.15.0 <3.0.0"
flutter: ">=2.5.0"

View File

@ -1,7 +1,7 @@
# Official WooSignal App Template for WooCommerce
# Label StoreMax
# Version: 5.3.1
# Version: 5.4.0
# Author: Anthony Gordon
# Homepage: https://woosignal.com
# Documentation: https://woosignal.com/docs/app/label-storemax
@ -29,7 +29,7 @@ dependencies:
analyzer: ^1.5.0
intl: ^0.17.0
page_transition: ^2.0.4
nylo_framework: ^2.0.4
nylo_framework: ^2.1.1
woosignal: ^2.2.1
flutter_stripe: ^2.0.2
wp_json_api: ^3.1.3
@ -46,6 +46,7 @@ dependencies:
bubble_tab_indicator: ^0.1.5
status_alert: ^0.1.3
math_expressions: ^2.2.0
validated: ^2.0.0
hexcolor: ^2.0.5
flutter_spinkit: ^5.1.0
auto_size_text: ^3.0.0
@ -91,12 +92,5 @@ flutter:
- public/assets/images/razorpay.png
- public/assets/images/paypal_logo.png
- public/assets/json/default_shipping.json
- lang/en.json
- lang/es.json
- lang/fr.json
- lang/it.json
- lang/de.json
- lang/hi.json
- lang/pt.json
- lang/zh.json
- lang/
- .env

View File

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