Skip to content

Commit 0a1f8ed

Browse files
committed
feat: add app config and locale to AppState
- Added locale property - Added appConfig property - Updated copyWith method
1 parent 95045b2 commit 0a1f8ed

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/app/bloc/app_state.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class AppState extends Equatable {
2828
this.status = AppStatus.initial,
2929
this.user, // User is now nullable and defaults to null
3030
this.locale, // Added locale
31+
this.appConfig, // Added AppConfig
3132
});
3233

3334
/// The index of the currently selected item in the bottom navigation bar.
@@ -58,6 +59,9 @@ class AppState extends Equatable {
5859
/// The current application locale.
5960
final Locale? locale; // Added locale
6061

62+
/// The global application configuration (remote config).
63+
final AppConfig? appConfig; // Added AppConfig
64+
6165
/// Creates a copy of the current state with updated values.
6266
AppState copyWith({
6367
int? selectedBottomNavigationIndex,
@@ -69,8 +73,10 @@ class AppState extends Equatable {
6973
User? user,
7074
UserAppSettings? settings, // Add settings to copyWith
7175
Locale? locale, // Added locale
76+
AppConfig? appConfig, // Added AppConfig
7277
bool clearFontFamily = false,
7378
bool clearLocale = false, // Added to allow clearing locale
79+
bool clearAppConfig = false, // Added to allow clearing appConfig
7480
}) {
7581
return AppState(
7682
selectedBottomNavigationIndex:
@@ -83,6 +89,7 @@ class AppState extends Equatable {
8389
user: user ?? this.user,
8490
settings: settings ?? this.settings, // Copy settings
8591
locale: clearLocale ? null : locale ?? this.locale, // Added locale
92+
appConfig: clearAppConfig ? null : appConfig ?? this.appConfig, // Added
8693
);
8794
}
8895

@@ -97,5 +104,6 @@ class AppState extends Equatable {
97104
user,
98105
settings, // Include settings in props
99106
locale, // Added locale to props
107+
appConfig, // Added AppConfig to props
100108
];
101109
}

0 commit comments

Comments
 (0)