@@ -27,6 +27,7 @@ class AppState extends Equatable {
27
27
this .fontFamily,
28
28
this .status = AppStatus .initial,
29
29
this .user, // User is now nullable and defaults to null
30
+ this .locale, // Added locale
30
31
});
31
32
32
33
/// The index of the currently selected item in the bottom navigation bar.
@@ -54,6 +55,9 @@ class AppState extends Equatable {
54
55
/// User-specific application settings.
55
56
final UserAppSettings settings; // Add settings property
56
57
58
+ /// The current application locale.
59
+ final Locale ? locale; // Added locale
60
+
57
61
/// Creates a copy of the current state with updated values.
58
62
AppState copyWith ({
59
63
int ? selectedBottomNavigationIndex,
@@ -64,7 +68,9 @@ class AppState extends Equatable {
64
68
AppStatus ? status,
65
69
User ? user,
66
70
UserAppSettings ? settings, // Add settings to copyWith
71
+ Locale ? locale, // Added locale
67
72
bool clearFontFamily = false ,
73
+ bool clearLocale = false , // Added to allow clearing locale
68
74
}) {
69
75
return AppState (
70
76
selectedBottomNavigationIndex:
@@ -76,6 +82,7 @@ class AppState extends Equatable {
76
82
status: status ?? this .status,
77
83
user: user ?? this .user,
78
84
settings: settings ?? this .settings, // Copy settings
85
+ locale: clearLocale ? null : locale ?? this .locale, // Added locale
79
86
);
80
87
}
81
88
@@ -89,5 +96,6 @@ class AppState extends Equatable {
89
96
status,
90
97
user,
91
98
settings, // Include settings in props
99
+ locale, // Added locale to props
92
100
];
93
101
}
0 commit comments