@@ -23,8 +23,6 @@ import 'package:flutter_app/bootstrap/enums/symbol_position_enums.dart';
2323import 'package:flutter_app/bootstrap/extensions.dart' ;
2424import 'package:flutter_app/bootstrap/shared_pref/shared_key.dart' ;
2525import 'package:flutter_app/config/currency.dart' ;
26- import 'package:flutter_app/config/decoders.dart' ;
27- import 'package:flutter_app/config/events.dart' ;
2826import 'package:flutter_app/config/payment_gateways.dart' ;
2927import 'package:flutter_app/resources/widgets/no_results_for_products_widget.dart' ;
3028import 'package:flutter_app/resources/widgets/woosignal_ui.dart' ;
@@ -54,27 +52,10 @@ Future appWooSignal(Function(WooSignal api) api) async {
5452
5553/// helper to find correct color from the [context] .
5654class ThemeColor {
57- static ColorStyles get (BuildContext context, {String ? themeId}) {
58- Nylo nylo = Backpack .instance.read ('nylo' );
59- List <BaseThemeConfig <ColorStyles >> appThemes =
60- nylo.appThemes as List <BaseThemeConfig <ColorStyles >>;
61-
62- if (themeId == null ) {
63- BaseThemeConfig <ColorStyles > themeFound = appThemes.firstWhere (
64- (theme) =>
65- theme.id ==
66- getEnv (Theme .of (context).brightness == Brightness .light
67- ? 'LIGHT_THEME_ID'
68- : 'DARK_THEME_ID' ),
69- orElse: () => appThemes.first);
70- return themeFound.colors;
71- }
55+ static ColorStyles get (BuildContext context, {String ? themeId}) =>
56+ nyColorStyle <ColorStyles >(context, themeId: themeId);
7257
73- BaseThemeConfig <ColorStyles > baseThemeConfig = appThemes.firstWhere (
74- (theme) => theme.id == themeId,
75- orElse: () => appThemes.first);
76- return baseThemeConfig.colors;
77- }
58+ static Color fromHex (String hexColor) => nyHexColor (hexColor);
7859}
7960
8061/// helper to set colors on TextStyle
@@ -649,34 +630,6 @@ Future<BillingDetails> billingDetailsFromWpUserInfoResponse(
649630 return billingDetails;
650631}
651632
652- /// API helper
653- api <T >(dynamic Function (T request) request,
654- {BuildContext ? context,
655- Map <String , dynamic > headers = const {},
656- String ? bearerToken,
657- String ? baseUrl,
658- int ? page,
659- String ? queryNamePage,
660- String ? queryNamePerPage,
661- int ? perPage,
662- List <Type > events = const []}) async =>
663- await nyApi <T >(
664- request: request,
665- apiDecoders: apiDecoders,
666- context: context,
667- headers: headers,
668- bearerToken: bearerToken,
669- baseUrl: baseUrl,
670- events: events,
671- page: page,
672- perPage: perPage,
673- queryParamPage: queryNamePage ?? "page" ,
674- queryParamPerPage: queryNamePerPage
675- );
676-
677- /// Event helper
678- event <T >({Map ? data}) async => nyEvent <T >(params: data, events: events);
679-
680633/// Check if the [Product] is new.
681634bool isProductNew (Product ? product) {
682635 if (product? .dateCreatedGMT == null ) false ;
0 commit comments