11part of 'app_bloc.dart' ;
22
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+
36/// Represents the application's authentication status.
47enum AppStatus {
58 /// The application is initializing and the status is unknown.
@@ -34,7 +37,8 @@ class AppState extends Equatable {
3437 this .status = AppStatus .initial,
3538 this .user, // User is now nullable and defaults to null
3639 this .locale, // Added locale
37- this .appConfig, // Added AppConfig
40+ this .appConfig,
41+ this .environment,
3842 });
3943
4044 /// The index of the currently selected item in the bottom navigation bar.
@@ -66,7 +70,10 @@ class AppState extends Equatable {
6670 final Locale ? locale; // Added locale
6771
6872 /// 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;
7077
7178 /// Creates a copy of the current state with updated values.
7279 AppState copyWith ({
@@ -79,10 +86,12 @@ class AppState extends Equatable {
7986 User ? user,
8087 UserAppSettings ? settings, // Add settings to copyWith
8188 Locale ? locale, // Added locale
82- AppConfig ? appConfig, // Added AppConfig
89+ AppConfig ? appConfig,
90+ local_config.AppEnvironment ? environment, // Added AppEnvironment
8391 bool clearFontFamily = false ,
8492 bool clearLocale = false , // Added to allow clearing locale
8593 bool clearAppConfig = false , // Added to allow clearing appConfig
94+ bool clearEnvironment = false , // Added to allow clearing environment
8695 }) {
8796 return AppState (
8897 selectedBottomNavigationIndex:
@@ -95,7 +104,9 @@ class AppState extends Equatable {
95104 user: user ?? this .user,
96105 settings: settings ?? this .settings, // Copy settings
97106 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
99110 );
100111 }
101112
@@ -110,6 +121,7 @@ class AppState extends Equatable {
110121 user,
111122 settings, // Include settings in props
112123 locale, // Added locale to props
113- appConfig, // Added AppConfig to props
124+ appConfig,
125+ environment,
114126 ];
115127}
0 commit comments