1- import 'package:flutter_app/resources/themes/dark_theme.dart' ;
2- import 'package:flutter_app/resources/themes/light_theme.dart' ;
3- import 'package:flutter_app/resources/themes/styles/color_styles.dart' ;
4- import 'package:flutter_app/resources/themes/styles/dark_theme_colors.dart' ;
5- import 'package:flutter_app/resources/themes/styles/light_theme_colors.dart' ;
61import 'package:nylo_framework/nylo_framework.dart' ;
72
3+ import '/resources/themes/dark_theme.dart' ;
4+ import '/resources/themes/light_theme.dart' ;
5+ import '/resources/themes/styles/color_styles.dart' ;
6+ import '/resources/themes/styles/dark_theme_colors.dart' ;
7+ import '/resources/themes/styles/light_theme_colors.dart' ;
8+
89/*
910|--------------------------------------------------------------------------
10- | Theme Config
11+ | Flutter Themes
12+ | Run the below in the terminal to add a new theme.
13+ | "dart run nylo_framework:main make:theme bright_theme"
14+ |
15+ | Learn more: https://nylo.dev/docs/5.x/themes-and-styling
1116|--------------------------------------------------------------------------
1217*/
1318
1419// App Themes
1520final List <BaseThemeConfig <ColorStyles >> appThemes = [
16- ThemeConfig .light (),
17- ThemeConfig .dark (),
18- ];
19-
20- /*
21- |--------------------------------------------------------------------------
22- | Theme Colors
23- |--------------------------------------------------------------------------
24- */
25-
26- // Light Colors
27- ColorStyles lightColors = LightThemeColors ();
28-
29- // Dark Colors
30- ColorStyles darkColors = DarkThemeColors ();
31-
32- /*
33- |--------------------------------------------------------------------------
34- | Themes
35- |--------------------------------------------------------------------------
36- */
37-
38- // Preset Themes
39- class ThemeConfig {
40- // LIGHT
41- static BaseThemeConfig <ColorStyles > light () => BaseThemeConfig <ColorStyles >(
42- id: "default_light_theme" ,
43- description: "Light theme" ,
44- theme: lightTheme (lightColors),
45- colors: lightColors,
46- );
47-
48- // DARK
49- static BaseThemeConfig <ColorStyles > dark () => BaseThemeConfig <ColorStyles >(
50- id: "default_dark_theme" ,
51- description: "Dark theme" ,
52- theme: darkTheme (darkColors),
53- colors: darkColors,
54- );
55-
56- // E.G. CUSTOM THEME
57- /// Run: "flutter pub run nylo_framework:main make:theme bright_theme" // example bright_theme
58- // Creates a basic theme in /resources/themes/bright_theme.dart
59- // Creates the themes colors in /resources/themes/styles/bright_theme_colors.dart
60-
61- // First add the colors which was created into the above section like the following:
62- // Bright Colors
63- /// ColorStyles brightColors = BrightThemeColors();
64-
65- // Next, uncomment the below:
66- /// static BaseThemeConfig<ColorStyles> bright() => BaseThemeConfig<ColorStyles>(
67- /// id: "default_bright_theme",
68- /// description: "Bright theme",
69- /// theme: brightTheme(brightColors),
70- /// colors: brightColors,
71- /// );
72-
73- // To then use this theme, add it to the [appThemes] above like the following:
74- // final appThemes = [
75- /// ThemeConfig.bright(), // new theme
76- //
77- // ThemeConfig.light(),
78- //
79- // ThemeConfig.dark(),
80- // ];
81- }
21+ BaseThemeConfig <ColorStyles >(
22+ id: getEnv ('LIGHT_THEME_ID' ),
23+ description: "Light theme" ,
24+ theme: lightTheme,
25+ colors: LightThemeColors (),
26+ ),
27+ BaseThemeConfig <ColorStyles >(
28+ id: getEnv ('DARK_THEME_ID' ),
29+ description: "Dark theme" ,
30+ theme: darkTheme,
31+ colors: DarkThemeColors (),
32+ ),
33+ ];
0 commit comments