1
1
part of 'app_bloc.dart' ;
2
2
3
+ import 'package:ht_main/app/config/config.dart' as local_config;
4
+ import 'package:ht_shared/ht_shared.dart' show AppConfig, UserAppSettings; // For AppConfig
5
+
3
6
/// Represents the application's authentication status.
4
7
enum AppStatus {
5
8
/// The application is initializing and the status is unknown.
@@ -34,7 +37,8 @@ class AppState extends Equatable {
34
37
this .status = AppStatus .initial,
35
38
this .user, // User is now nullable and defaults to null
36
39
this .locale, // Added locale
37
- this .appConfig, // Added AppConfig
40
+ this .appConfig,
41
+ this .environment,
38
42
});
39
43
40
44
/// The index of the currently selected item in the bottom navigation bar.
@@ -66,7 +70,10 @@ class AppState extends Equatable {
66
70
final Locale ? locale; // Added locale
67
71
68
72
/// The global application configuration (remote config).
69
- final AppConfig ? appConfig; // Added AppConfig
73
+ final AppConfig ? appConfig;
74
+
75
+ /// The current application environment (e.g., production, development, demo).
76
+ final local_config.AppEnvironment ? environment;
70
77
71
78
/// Creates a copy of the current state with updated values.
72
79
AppState copyWith ({
@@ -79,10 +86,12 @@ class AppState extends Equatable {
79
86
User ? user,
80
87
UserAppSettings ? settings, // Add settings to copyWith
81
88
Locale ? locale, // Added locale
82
- AppConfig ? appConfig, // Added AppConfig
89
+ AppConfig ? appConfig,
90
+ local_config.AppEnvironment ? environment, // Added AppEnvironment
83
91
bool clearFontFamily = false ,
84
92
bool clearLocale = false , // Added to allow clearing locale
85
93
bool clearAppConfig = false , // Added to allow clearing appConfig
94
+ bool clearEnvironment = false , // Added to allow clearing environment
86
95
}) {
87
96
return AppState (
88
97
selectedBottomNavigationIndex:
@@ -95,7 +104,9 @@ class AppState extends Equatable {
95
104
user: user ?? this .user,
96
105
settings: settings ?? this .settings, // Copy settings
97
106
locale: clearLocale ? null : locale ?? this .locale, // Added locale
98
- appConfig: clearAppConfig ? null : appConfig ?? this .appConfig, // Added
107
+ appConfig: clearAppConfig ? null : appConfig ?? this .appConfig,
108
+ environment:
109
+ clearEnvironment ? null : environment ?? this .environment, // Added
99
110
);
100
111
}
101
112
@@ -110,6 +121,7 @@ class AppState extends Equatable {
110
121
user,
111
122
settings, // Include settings in props
112
123
locale, // Added locale to props
113
- appConfig, // Added AppConfig to props
124
+ appConfig,
125
+ environment,
114
126
];
115
127
}
0 commit comments