@@ -25,8 +25,6 @@ import 'package:flutter_app/config/currency.dart';
2525import 'package:flutter_app/config/decoders.dart' ;
2626import 'package:flutter_app/config/events.dart' ;
2727import 'package:flutter_app/config/payment_gateways.dart' ;
28- import 'package:flutter_app/config/theme.dart' ;
29- import 'package:flutter_app/resources/themes/styles/base_styles.dart' ;
3028import 'package:flutter_app/resources/widgets/no_results_for_products_widget.dart' ;
3129import 'package:flutter_app/resources/widgets/woosignal_ui.dart' ;
3230import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart' ;
@@ -42,6 +40,7 @@ import 'package:status_alert/status_alert.dart';
4240import 'package:woosignal/models/response/products.dart' ;
4341import 'package:woosignal/models/response/tax_rate.dart' ;
4442import 'package:woosignal/woosignal.dart' ;
43+ import '../resources/themes/styles/color_styles.dart' ;
4544
4645Future <User ?> getUser () async =>
4746 (await (NyStorage .read <User >(SharedKey .authUser, model: User ())));
@@ -52,10 +51,22 @@ Future appWooSignal(Function(WooSignal) api) async {
5251
5352/// helper to find correct color from the [context] .
5453class ThemeColor {
55- static BaseColorStyles ? get (BuildContext context) {
56- return ((Theme .of (context).brightness == Brightness .light)
57- ? ThemeConfig .light ().colors
58- : ThemeConfig .dark ().colors);
54+ static ColorStyles get (BuildContext context, {String ? themeId}) {
55+
56+ Nylo nylo = Backpack .instance.read ('nylo' );
57+ List <BaseThemeConfig > appThemes = nylo.appThemes;
58+
59+ if (themeId == null ) {
60+ dynamic themeFound = appThemes
61+ .firstWhere (
62+ (theme) => theme.id == getEnv (Theme .of (context).brightness == Brightness .light ? 'LIGHT_THEME_ID' : 'DARK_THEME_ID' ),
63+ orElse: () => appThemes.first
64+ );
65+ return themeFound.colors;
66+ }
67+
68+ dynamic baseThemeConfig = appThemes.firstWhere ((theme) => theme.id == themeId, orElse: () => appThemes.first);
69+ return baseThemeConfig.colors;
5970 }
6071}
6172
0 commit comments