From 6bc9dcd09a82f6d463afd88629c823ac8bcd424e Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 10 Dec 2021 08:50:23 +0000 Subject: [PATCH] v5.4.0 - updates --- LabelStoreMax/CHANGELOG.md | 7 + LabelStoreMax/README.md | 2 +- .../ios/Runner.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- LabelStoreMax/lang/de.json | 6 +- LabelStoreMax/lang/en.json | 6 +- LabelStoreMax/lang/es.json | 6 +- LabelStoreMax/lang/fr.json | 6 +- LabelStoreMax/lang/hi.json | 6 +- LabelStoreMax/lang/it.json | 6 +- LabelStoreMax/lang/pt.json | 6 +- LabelStoreMax/lang/zh.json | 6 +- .../lib/app/providers/cash_on_delivery.dart | 10 +- .../lib/app/providers/example_pay.dart | 6 +- .../lib/app/providers/paypal_pay.dart | 16 +- .../lib/app/providers/stripe_pay.dart | 17 +- LabelStoreMax/lib/bootstrap/app.dart | 87 ++++---- .../lib/bootstrap/base_theme_config.dart | 19 ++ LabelStoreMax/lib/bootstrap/helpers.dart | 196 ++---------------- LabelStoreMax/lib/bootstrap/setup.dart | 10 + LabelStoreMax/lib/config/app_font.dart | 19 ++ LabelStoreMax/lib/config/app_locale.dart | 20 -- .../lib/config/app_localization.dart | 57 +++++ LabelStoreMax/lib/config/app_theme.dart | 89 +++++--- LabelStoreMax/lib/main.dart | 26 ++- .../pages/account_billing_details.dart | 39 ++-- .../lib/resources/pages/account_detail.dart | 39 ++-- .../lib/resources/pages/account_landing.dart | 54 +++-- .../resources/pages/account_order_detail.dart | 12 +- .../pages/account_profile_update.dart | 20 +- .../lib/resources/pages/account_register.dart | 76 ++++--- .../pages/account_shipping_details.dart | 46 ++-- .../lib/resources/pages/browse_category.dart | 19 +- .../lib/resources/pages/browse_search.dart | 6 +- LabelStoreMax/lib/resources/pages/cart.dart | 37 ++-- .../pages/checkout_confirmation.dart | 78 ++++--- .../lib/resources/pages/checkout_details.dart | 51 +++-- .../pages/checkout_payment_type.dart | 13 +- .../pages/checkout_shipping_type.dart | 23 +- .../lib/resources/pages/checkout_status.dart | 12 +- .../resources/pages/customer_countries.dart | 11 +- .../lib/resources/pages/home_search.dart | 7 +- .../resources/pages/no_connection_page.dart | 14 +- .../lib/resources/pages/product_detail.dart | 62 +++--- .../pages/product_image_viewer_page.dart | 11 +- .../lib/resources/themes/dark_theme.dart | 61 +++--- .../lib/resources/themes/light_theme.dart | 62 +++--- .../{theme_styles.dart => base_styles.dart} | 5 +- .../themes/styles/dark_theme_colors.dart | 7 +- .../themes/styles/light_theme_colors.dart | 7 +- .../resources/widgets/app_version_widget.dart | 2 +- .../lib/resources/widgets/buttons.dart | 1 - .../resources/widgets/checkout_paypal.dart | 8 +- .../widgets/customer_address_input.dart | 21 +- .../resources/widgets/home_drawer_widget.dart | 19 +- .../resources/widgets/mello_theme_widget.dart | 6 +- .../no_results_for_products_widget.dart | 2 +- .../resources/widgets/notic_home_widget.dart | 21 +- .../resources/widgets/notic_theme_widget.dart | 14 +- .../resources/widgets/safearea_widget.dart | 2 +- .../resources/widgets/switch_address_tab.dart | 1 - .../lib/resources/widgets/top_nav_widget.dart | 6 +- .../lib/resources/widgets/woosignal_ui.dart | 28 ++- LabelStoreMax/pubspec.lock | 69 +++++- LabelStoreMax/pubspec.yaml | 14 +- README.md | 2 +- 66 files changed, 821 insertions(+), 800 deletions(-) create mode 100644 LabelStoreMax/lib/bootstrap/base_theme_config.dart create mode 100644 LabelStoreMax/lib/bootstrap/setup.dart create mode 100644 LabelStoreMax/lib/config/app_font.dart delete mode 100644 LabelStoreMax/lib/config/app_locale.dart create mode 100644 LabelStoreMax/lib/config/app_localization.dart rename LabelStoreMax/lib/resources/themes/styles/{theme_styles.dart => base_styles.dart} (89%) diff --git a/LabelStoreMax/CHANGELOG.md b/LabelStoreMax/CHANGELOG.md index ce562ac..12240aa 100644 --- a/LabelStoreMax/CHANGELOG.md +++ b/LabelStoreMax/CHANGELOG.md @@ -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 diff --git a/LabelStoreMax/README.md b/LabelStoreMax/README.md index 24e120f..43d0df4 100644 --- a/LabelStoreMax/README.md +++ b/LabelStoreMax/README.md @@ -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) diff --git a/LabelStoreMax/ios/Runner.xcodeproj/project.pbxproj b/LabelStoreMax/ios/Runner.xcodeproj/project.pbxproj index 66a031e..ca0c3e0 100644 --- a/LabelStoreMax/ios/Runner.xcodeproj/project.pbxproj +++ b/LabelStoreMax/ios/Runner.xcodeproj/project.pbxproj @@ -155,7 +155,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { diff --git a/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140c..3db53b6 100644 --- a/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ )) { 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"), ); } } diff --git a/LabelStoreMax/lib/app/providers/stripe_pay.dart b/LabelStoreMax/lib/app/providers/stripe_pay.dart index 557d3da..7c1a6fc 100644 --- a/LabelStoreMax/lib/app/providers/stripe_pay.dart +++ b/LabelStoreMax/lib/app/providers/stripe_pay.dart @@ -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, ); diff --git a/LabelStoreMax/lib/bootstrap/app.dart b/LabelStoreMax/lib/bootstrap/app.dart index 5adcd26..7bcc0f3 100644 --- a/LabelStoreMax/lib/bootstrap/app.dart +++ b/LabelStoreMax/lib/bootstrap/app.dart @@ -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 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 supportedLocales) { + return locale; + }, + localizationsDelegates: NyLocalization.instance.delegates, + locale: NyLocalization.instance.locale, + supportedLocales: supportedLocales ?? NyLocalization.instance.locals(), + ), ), ), ), diff --git a/LabelStoreMax/lib/bootstrap/base_theme_config.dart b/LabelStoreMax/lib/bootstrap/base_theme_config.dart new file mode 100644 index 0000000..0ece194 --- /dev/null +++ b/LabelStoreMax/lib/bootstrap/base_theme_config.dart @@ -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, + ); +} \ No newline at end of file diff --git a/LabelStoreMax/lib/bootstrap/helpers.dart b/LabelStoreMax/lib/bootstrap/helpers.dart index a6038ed..5e5a1b1 100644 --- a/LabelStoreMax/lib/bootstrap/helpers.dart +++ b/LabelStoreMax/lib/bootstrap/helpers.dart @@ -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 getPaymentTypes() { List 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, diff --git a/LabelStoreMax/lib/bootstrap/setup.dart b/LabelStoreMax/lib/bootstrap/setup.dart new file mode 100644 index 0000000..eed7323 --- /dev/null +++ b/LabelStoreMax/lib/bootstrap/setup.dart @@ -0,0 +1,10 @@ +import 'package:flutter/services.dart'; + +/// boot application +Future boot() async { + + await SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + ]); + +} \ No newline at end of file diff --git a/LabelStoreMax/lib/config/app_font.dart b/LabelStoreMax/lib/config/app_font.dart new file mode 100644 index 0000000..f7288d1 --- /dev/null +++ b/LabelStoreMax/lib/config/app_font.dart @@ -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"); \ No newline at end of file diff --git a/LabelStoreMax/lib/config/app_locale.dart b/LabelStoreMax/lib/config/app_locale.dart deleted file mode 100644 index 5c60901..0000000 --- a/LabelStoreMax/lib/config/app_locale.dart +++ /dev/null @@ -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 app_locales_supported = [ - Locale('en'), - Locale('es'), - Locale('fr'), - Locale('hi'), - Locale('it'), - Locale('pt'), - Locale('zh'), -]; diff --git a/LabelStoreMax/lib/config/app_localization.dart b/LabelStoreMax/lib/config/app_localization.dart new file mode 100644 index 0000000..f2158b3 --- /dev/null +++ b/LabelStoreMax/lib/config/app_localization.dart @@ -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 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 valuesAsMap = {}; \ No newline at end of file diff --git a/LabelStoreMax/lib/config/app_theme.dart b/LabelStoreMax/lib/config/app_theme.dart index 550d2f1..1324f2b 100644 --- a/LabelStoreMax/lib/config/app_theme.dart +++ b/LabelStoreMax/lib/config/app_theme.dart @@ -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(), +// ]; } \ No newline at end of file diff --git a/LabelStoreMax/lib/main.dart b/LabelStoreMax/lib/main.dart index 4d446bf..4d7f6a7 100644 --- a/LabelStoreMax/lib/main.dart +++ b/LabelStoreMax/lib/main.dart @@ -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, ), ); diff --git a/LabelStoreMax/lib/resources/pages/account_billing_details.dart b/LabelStoreMax/lib/resources/pages/account_billing_details.dart index bea7861..e03fad2 100644 --- a/LabelStoreMax/lib/resources/pages/account_billing_details.dart +++ b/LabelStoreMax/lib/resources/pages/account_billing_details.dart @@ -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 { 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 { children: [ 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 { MainAxisAlignment.spaceEvenly, ), TextEditingRow( - heading: trans(context, "Address Line"), + heading: trans("Address Line"), controller: _txtShippingAddressLine, ), Row(children: [ 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 { children: [ 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 { ], ), 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 { Column( children: [ PrimaryButton( - title: trans(context, "UPDATE DETAILS"), + title: trans("UPDATE DETAILS"), action: _isUpdating ? () {} : _updateBillingDetails), ], @@ -218,8 +213,8 @@ class _AccountBillingDetailsPageState extends State { 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 { 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); } diff --git a/LabelStoreMax/lib/resources/pages/account_detail.dart b/LabelStoreMax/lib/resources/pages/account_detail.dart index bc997e2..2f1784f 100644 --- a/LabelStoreMax/lib/resources/pages/account_detail.dart +++ b/LabelStoreMax/lib/resources/pages/account_detail.dart @@ -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 } 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 @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 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 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 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 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 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 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 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 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 size: 40, ), Text( - trans(context, "No orders found"), + trans("No orders found"), ), ], ), diff --git a/LabelStoreMax/lib/resources/pages/account_landing.dart b/LabelStoreMax/lib/resources/pages/account_landing.dart index 46dbe57..33fb283 100644 --- a/LabelStoreMax/lib/resources/pages/account_landing.dart +++ b/LabelStoreMax/lib/resources/pages/account_landing.dart @@ -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 { 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 { 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 { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ 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 { ), 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 { 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 { children: [ Divider(), LinkButton( - title: trans(context, "Back"), + title: trans("Back"), action: () => Navigator.pop(context), ), ], @@ -166,17 +163,17 @@ class _AccountLandingPageState extends State { 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 { (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 { 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, diff --git a/LabelStoreMax/lib/resources/pages/account_order_detail.dart b/LabelStoreMax/lib/resources/pages/account_order_detail.dart index a2c5f25..2c3cf6a 100644 --- a/LabelStoreMax/lib/resources/pages/account_order_detail.dart +++ b/LabelStoreMax/lib/resources/pages/account_order_detail.dart @@ -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 { 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: [ - 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 { children: [ Flexible( child: Text( - "${trans(context, "Ships to").capitalize()}:"), + "${trans("Ships to").capitalize()}:"), ), Flexible( child: Text( diff --git a/LabelStoreMax/lib/resources/pages/account_profile_update.dart b/LabelStoreMax/lib/resources/pages/account_profile_update.dart index 1beff3d..b89daf2 100644 --- a/LabelStoreMax/lib/resources/pages/account_profile_update.dart +++ b/LabelStoreMax/lib/resources/pages/account_profile_update.dart @@ -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 { 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 { children: [ 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 { 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 { 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 { 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); } diff --git a/LabelStoreMax/lib/resources/pages/account_register.dart b/LabelStoreMax/lib/resources/pages/account_register.dart index 3245c4b..f6c9b1e 100644 --- a/LabelStoreMax/lib/resources/pages/account_register.dart +++ b/LabelStoreMax/lib/resources/pages/account_register.dart @@ -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 { onPressed: () => Navigator.pop(context), ), title: Text( - trans(context, "Register") + trans("Register") ), centerTitle: true, ), resizeToAvoidBottomInset: false, - body: SafeArea( - minimum: safeAreaDefault(), + body: SafeAreaWidget( child: Column( children: [ Container( @@ -77,7 +77,7 @@ class _AccountRegistrationPageState extends State { children: [ 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 { ), 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 { ], )), 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 { 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( - 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 { 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 { ); } 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 { .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 { _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), ], ); diff --git a/LabelStoreMax/lib/resources/pages/account_shipping_details.dart b/LabelStoreMax/lib/resources/pages/account_shipping_details.dart index 6cfd887..1cbf6dd 100644 --- a/LabelStoreMax/lib/resources/pages/account_shipping_details.dart +++ b/LabelStoreMax/lib/resources/pages/account_shipping_details.dart @@ -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: [ 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: [ 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: [ 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: [ 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); } diff --git a/LabelStoreMax/lib/resources/pages/browse_category.dart b/LabelStoreMax/lib/resources/pages/browse_category.dart index 2a4957d..c340c83 100644 --- a/LabelStoreMax/lib/resources/pages/browse_category.dart +++ b/LabelStoreMax/lib/resources/pages/browse_category.dart @@ -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 { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ - 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 { ) ], ), - body: SafeArea( - minimum: safeAreaDefault(), + body: SafeAreaWidget( child: _isLoading ? Center( child: AppLoaderWidget(), @@ -171,38 +170,38 @@ class _BrowseCategoryPageState extends NyState { _modalSheetTune() { wsModalBottom( context, - title: trans(context, "Sort results"), + title: trans("Sort results"), bodyWidget: ListView( children: [ 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) ], ), ); diff --git a/LabelStoreMax/lib/resources/pages/browse_search.dart b/LabelStoreMax/lib/resources/pages/browse_search.dart index 90eb3d7..23d718b 100644 --- a/LabelStoreMax/lib/resources/pages/browse_search.dart +++ b/LabelStoreMax/lib/resources/pages/browse_search.dart @@ -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 { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ - 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(), diff --git a/LabelStoreMax/lib/resources/pages/cart.dart b/LabelStoreMax/lib/resources/pages/cart.dart index bcac3d8..e2edd07 100644 --- a/LabelStoreMax/lib/resources/pages/cart.dart +++ b/LabelStoreMax/lib/resources/pages/cart.dart @@ -8,7 +8,6 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -import 'package: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 { 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 { (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 { 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 { _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 { 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 { resizeToAvoidBottomInset: false, appBar: AppBar( title: Text( - trans(context, "Shopping Cart"), + trans("Shopping Cart"), ), elevation: 1, actions: [ @@ -196,7 +196,7 @@ class _CartPageState extends State { 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 { ], centerTitle: true, ), - body: SafeArea( - minimum: safeAreaDefault(), + body: SafeAreaWidget( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, @@ -228,7 +227,7 @@ class _CartPageState extends State { ), 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 { 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 { }, ), PrimaryButton( - title: trans(context, "PROCEED TO CHECKOUT"), + title: trans("PROCEED TO CHECKOUT"), action: _actionProceedToCheckout, ), ], diff --git a/LabelStoreMax/lib/resources/pages/checkout_confirmation.dart b/LabelStoreMax/lib/resources/pages/checkout_confirmation.dart index a766818..fbaaf11 100644 --- a/LabelStoreMax/lib/resources/pages/checkout_confirmation.dart +++ b/LabelStoreMax/lib/resources/pages/checkout_confirmation.dart @@ -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 { 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 { 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 { 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 { .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 { 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 { 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 { 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 { : 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 { 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 { ), PrimaryButton( title: _isProcessingPayment - ? "PROCESSING..." - : trans(context, "CHECKOUT"), + ? "${trans("PROCESSING")}..." + : trans("CHECKOUT"), action: _isProcessingPayment ? null : _handleCheckout, ), ], @@ -341,7 +336,7 @@ class CheckoutConfirmationPageState extends State { 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 { 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 { .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 { 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 { 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 { 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 { 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; diff --git a/LabelStoreMax/lib/resources/pages/checkout_details.dart b/LabelStoreMax/lib/resources/pages/checkout_details.dart index 8d38ae6..7524053 100644 --- a/LabelStoreMax/lib/resources/pages/checkout_details.dart +++ b/LabelStoreMax/lib/resources/pages/checkout_details.dart @@ -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 { 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 { children: [ SwitchAddressTab( title: - trans(context, "Billing Details"), + trans("Billing Details"), currentTabIndex: activeTabIndex, type: "billing", onTapAction: () => setState(() { @@ -203,8 +203,7 @@ class _CheckoutDetailsPageState extends State { 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 { 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 { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ 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 { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ 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 { ], ), PrimaryButton( - title: trans(context, "USE DETAILS"), + title: trans("USE DETAILS"), action: () => _useDetailsTapped(), ), ], @@ -315,9 +314,31 @@ class _CheckoutDetailsPageState extends State { 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; diff --git a/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart b/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart index d65f094..646a5f4 100644 --- a/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart +++ b/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart @@ -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 { 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 { 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 { ), ), 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, diff --git a/LabelStoreMax/lib/resources/pages/checkout_shipping_type.dart b/LabelStoreMax/lib/resources/pages/checkout_shipping_type.dart index baf5e68..a126f05 100644 --- a/LabelStoreMax/lib/resources/pages/checkout_shipping_type.dart +++ b/LabelStoreMax/lib/resources/pages/checkout_shipping_type.dart @@ -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 { 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 { children: [ 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 { 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 { ), ) : 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, diff --git a/LabelStoreMax/lib/resources/pages/checkout_status.dart b/LabelStoreMax/lib/resources/pages/checkout_status.dart index 254f2fd..8ee30d1 100644 --- a/LabelStoreMax/lib/resources/pages/checkout_status.dart +++ b/LabelStoreMax/lib/resources/pages/checkout_status.dart @@ -67,23 +67,23 @@ class _CheckoutStatusState extends NyState { children: [ 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 { 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 { ), Align( child: LinkButton( - title: trans(context, "Back to Home"), + title: trans("Back to Home"), action: () => Navigator.pushNamed(context, "/home"), ), alignment: Alignment.bottomCenter, diff --git a/LabelStoreMax/lib/resources/pages/customer_countries.dart b/LabelStoreMax/lib/resources/pages/customer_countries.dart index 83f3bfc..713db89 100644 --- a/LabelStoreMax/lib/resources/pages/customer_countries.dart +++ b/LabelStoreMax/lib/resources/pages/customer_countries.dart @@ -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 { 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 { 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 { 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) { diff --git a/LabelStoreMax/lib/resources/pages/home_search.dart b/LabelStoreMax/lib/resources/pages/home_search.dart index 2fb443c..2e30653 100644 --- a/LabelStoreMax/lib/resources/pages/home_search.dart +++ b/LabelStoreMax/lib/resources/pages/home_search.dart @@ -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 { 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 { Padding( padding: const EdgeInsets.only(top: 10), child: PrimaryButton( - title: trans(context, "Search"), + title: trans("Search"), action: _actionSearch, ), ) diff --git a/LabelStoreMax/lib/resources/pages/no_connection_page.dart b/LabelStoreMax/lib/resources/pages/no_connection_page.dart index 8b62c10..de55fd5 100644 --- a/LabelStoreMax/lib/resources/pages/no_connection_page.dart +++ b/LabelStoreMax/lib/resources/pages/no_connection_page.dart @@ -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 { @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 { 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 { if (wooSignalApp == null) { showToastNotification(context, - title: trans(context, "Oops"), - description: trans(context, "Retry later")); + title: trans("Oops"), + description: trans("Retry later")); return; } diff --git a/LabelStoreMax/lib/resources/pages/product_detail.dart b/LabelStoreMax/lib/resources/pages/product_detail.dart index 8384d65..fca05da 100644 --- a/LabelStoreMax/lib/resources/pages/product_detail.dart +++ b/LabelStoreMax/lib/resources/pages/product_detail.dart @@ -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 { 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 { _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 { 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 { ? 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 { children: [ 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 { _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 { ), 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 { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - trans(context, "Description"), + trans("Description"), style: Theme.of(context) .textTheme .caption @@ -404,7 +400,7 @@ class _ProductDetailState extends NyState { ), MaterialButton( child: Text( - trans(context, "Full description"), + trans("Full description"), style: Theme.of(context) .textTheme .bodyText2 @@ -439,7 +435,7 @@ class _ProductDetailState extends NyState { 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 { MainAxisAlignment.spaceBetween, children: [ Text( - trans(context, "Quantity"), + trans("Quantity"), style: Theme.of(context) .textTheme .bodyText1 @@ -515,14 +511,14 @@ class _ProductDetailState extends NyState { _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 { } 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 { 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; } diff --git a/LabelStoreMax/lib/resources/pages/product_image_viewer_page.dart b/LabelStoreMax/lib/resources/pages/product_image_viewer_page.dart index a5ad05c..18f32cd 100644 --- a/LabelStoreMax/lib/resources/pages/product_image_viewer_page.dart +++ b/LabelStoreMax/lib/resources/pages/product_image_viewer_page.dart @@ -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 { @override void initState() { - this._initialIndex = widget.controller.data()['index']; - this._arrImageSrc = widget.controller.data()['images']; + Map 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: [ Expanded( diff --git a/LabelStoreMax/lib/resources/themes/dark_theme.dart b/LabelStoreMax/lib/resources/themes/dark_theme.dart index fa1cdae..5aaae1f 100644 --- a/LabelStoreMax/lib/resources/themes/dark_theme.dart +++ b/LabelStoreMax/lib/resources/themes/dark_theme.dart @@ -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), ), ); -} \ No newline at end of file +} diff --git a/LabelStoreMax/lib/resources/themes/light_theme.dart b/LabelStoreMax/lib/resources/themes/light_theme.dart index d25203b..7c92f4f 100644 --- a/LabelStoreMax/lib/resources/themes/light_theme.dart +++ b/LabelStoreMax/lib/resources/themes/light_theme.dart @@ -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, ), ); -} \ No newline at end of file +} diff --git a/LabelStoreMax/lib/resources/themes/styles/theme_styles.dart b/LabelStoreMax/lib/resources/themes/styles/base_styles.dart similarity index 89% rename from LabelStoreMax/lib/resources/themes/styles/theme_styles.dart rename to LabelStoreMax/lib/resources/themes/styles/base_styles.dart index 907f2c3..3d91476 100644 --- a/LabelStoreMax/lib/resources/themes/styles/theme_styles.dart +++ b/LabelStoreMax/lib/resources/themes/styles/base_styles.dart @@ -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; diff --git a/LabelStoreMax/lib/resources/themes/styles/dark_theme_colors.dart b/LabelStoreMax/lib/resources/themes/styles/dark_theme_colors.dart index 4d498db..1419a16 100644 --- a/LabelStoreMax/lib/resources/themes/styles/dark_theme_colors.dart +++ b/LabelStoreMax/lib/resources/themes/styles/dark_theme_colors.dart @@ -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; diff --git a/LabelStoreMax/lib/resources/themes/styles/light_theme_colors.dart b/LabelStoreMax/lib/resources/themes/styles/light_theme_colors.dart index ca556a9..c021c24 100644 --- a/LabelStoreMax/lib/resources/themes/styles/light_theme_colors.dart +++ b/LabelStoreMax/lib/resources/themes/styles/light_theme_colors.dart @@ -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); diff --git a/LabelStoreMax/lib/resources/widgets/app_version_widget.dart b/LabelStoreMax/lib/resources/widgets/app_version_widget.dart index 86f4549..c2252ae 100644 --- a/LabelStoreMax/lib/resources/widgets/app_version_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/app_version_widget.dart @@ -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 diff --git a/LabelStoreMax/lib/resources/widgets/buttons.dart b/LabelStoreMax/lib/resources/widgets/buttons.dart index 5ebbb13..2895a6e 100644 --- a/LabelStoreMax/lib/resources/widgets/buttons.dart +++ b/LabelStoreMax/lib/resources/widgets/buttons.dart @@ -8,7 +8,6 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; diff --git a/LabelStoreMax/lib/resources/widgets/checkout_paypal.dart b/LabelStoreMax/lib/resources/widgets/checkout_paypal.dart index 01022cc..7fb6978 100644 --- a/LabelStoreMax/lib/resources/widgets/checkout_paypal.dart +++ b/LabelStoreMax/lib/resources/widgets/checkout_paypal.dart @@ -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 { } 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 ''' $strProcessingPayment... diff --git a/LabelStoreMax/lib/resources/widgets/customer_address_input.dart b/LabelStoreMax/lib/resources/widgets/customer_address_input.dart index d573df5..edbc674 100644 --- a/LabelStoreMax/lib/resources/widgets/customer_address_input.dart +++ b/LabelStoreMax/lib/resources/widgets/customer_address_input.dart @@ -8,7 +8,6 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -import 'package: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: [ 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: [ 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: [ 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), diff --git a/LabelStoreMax/lib/resources/widgets/home_drawer_widget.dart b/LabelStoreMax/lib/resources/widgets/home_drawer_widget.dart index e2e8b95..e061988 100644 --- a/LabelStoreMax/lib/resources/widgets/home_drawer_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/home_drawer_widget.dart @@ -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 { 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: [ 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 { 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 { 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 { 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 { ), 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 ) diff --git a/LabelStoreMax/lib/resources/widgets/mello_theme_widget.dart b/LabelStoreMax/lib/resources/widgets/mello_theme_widget.dart index 0f942bb..5bff237 100644 --- a/LabelStoreMax/lib/resources/widgets/mello_theme_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/mello_theme_widget.dart @@ -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 { 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 { CartIconWidget(key: widget.globalKey), ], ), - body: SafeArea( - minimum: safeAreaDefault(), + body: SafeAreaWidget( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/LabelStoreMax/lib/resources/widgets/no_results_for_products_widget.dart b/LabelStoreMax/lib/resources/widgets/no_results_for_products_widget.dart index 9a0708a..b67d394 100644 --- a/LabelStoreMax/lib/resources/widgets/no_results_for_products_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/no_results_for_products_widget.dart @@ -18,7 +18,7 @@ class NoResultsForProductsWidget extends StatelessWidget { Widget build(BuildContext context) => Column( children: [ Text( - trans(context, "No results"), + trans("No results"), style: Theme.of(context).textTheme.bodyText2, ), ], diff --git a/LabelStoreMax/lib/resources/widgets/notic_home_widget.dart b/LabelStoreMax/lib/resources/widgets/notic_home_widget.dart index b98e0ff..39a62ce 100644 --- a/LabelStoreMax/lib/resources/widgets/notic_home_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/notic_home_widget.dart @@ -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 { _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 { 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 { ), ], ), - body: SafeArea( - minimum: safeAreaDefault(), + body: SafeAreaWidget( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, @@ -156,10 +156,10 @@ class _NoticHomeWidgetState extends State { 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 { 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, diff --git a/LabelStoreMax/lib/resources/widgets/notic_theme_widget.dart b/LabelStoreMax/lib/resources/widgets/notic_theme_widget.dart index 99f6b38..2dbf97b 100644 --- a/LabelStoreMax/lib/resources/widgets/notic_theme_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/notic_theme_widget.dart @@ -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'; diff --git a/LabelStoreMax/lib/resources/widgets/safearea_widget.dart b/LabelStoreMax/lib/resources/widgets/safearea_widget.dart index 42cc862..8c6801f 100644 --- a/LabelStoreMax/lib/resources/widgets/safearea_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/safearea_widget.dart @@ -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, ); } diff --git a/LabelStoreMax/lib/resources/widgets/switch_address_tab.dart b/LabelStoreMax/lib/resources/widgets/switch_address_tab.dart index 9f489a1..ba714df 100644 --- a/LabelStoreMax/lib/resources/widgets/switch_address_tab.dart +++ b/LabelStoreMax/lib/resources/widgets/switch_address_tab.dart @@ -8,7 +8,6 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class SwitchAddressTab extends StatelessWidget { diff --git a/LabelStoreMax/lib/resources/widgets/top_nav_widget.dart b/LabelStoreMax/lib/resources/widgets/top_nav_widget.dart index 4fae548..66e499e 100644 --- a/LabelStoreMax/lib/resources/widgets/top_nav_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/top_nav_widget.dart @@ -26,7 +26,7 @@ class TopNavWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ 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, diff --git a/LabelStoreMax/lib/resources/widgets/woosignal_ui.dart b/LabelStoreMax/lib/resources/widgets/woosignal_ui.dart index 6a0cdc5..c61e2a8 100644 --- a/LabelStoreMax/lib/resources/widgets/woosignal_ui.dart +++ b/LabelStoreMax/lib/resources/widgets/woosignal_ui.dart @@ -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( 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( 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: [ 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), diff --git a/LabelStoreMax/pubspec.lock b/LabelStoreMax/pubspec.lock index f6e72f5..d2e887a 100644 --- a/LabelStoreMax/pubspec.lock +++ b/LabelStoreMax/pubspec.lock @@ -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" diff --git a/LabelStoreMax/pubspec.yaml b/LabelStoreMax/pubspec.yaml index bf8d042..c194a93 100644 --- a/LabelStoreMax/pubspec.yaml +++ b/LabelStoreMax/pubspec.yaml @@ -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 diff --git a/README.md b/README.md index 0485d5a..0873a36 100644 --- a/README.md +++ b/README.md @@ -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)