@@ -55,13 +55,11 @@ class _HeadlinesFilterPageState extends State<HeadlinesFilterPage> {
55
55
// Create copies of the lists to avoid modifying the BLoC state directly.
56
56
_tempSelectedCategories = List .from (currentState.filter.categories ?? []);
57
57
_tempSelectedSources = List .from (currentState.filter.sources ?? []);
58
- // Initialize source capsule states. These are persisted here.
59
- // For now, let's assume they start empty and are populated by SourceFilterPage's result.
60
- // Or, if HeadlineFilter could store them, we'd get them from there.
61
- // For this iteration, they start empty. SourceFilterPage will manage its own capsule
62
- // state and return it.
63
- _tempSelectedSourceCountryIsoCodes = {};
64
- _tempSelectedSourceSourceTypes = {};
58
+ // Initialize source capsule states from the BLoC's current filter
59
+ _tempSelectedSourceCountryIsoCodes =
60
+ Set .from (currentState.filter.selectedSourceCountryIsoCodes ?? {});
61
+ _tempSelectedSourceSourceTypes =
62
+ Set .from (currentState.filter.selectedSourceSourceTypes ?? {});
65
63
} else {
66
64
_tempSelectedCategories = [];
67
65
_tempSelectedSources = [];
@@ -152,11 +150,19 @@ class _HeadlinesFilterPageState extends State<HeadlinesFilterPage> {
152
150
categories:
153
151
_tempSelectedCategories.isNotEmpty
154
152
? _tempSelectedCategories
155
- : null , // Use null if empty
153
+ : null ,
156
154
sources:
157
155
_tempSelectedSources.isNotEmpty
158
156
? _tempSelectedSources
159
- : null , // Use null if empty
157
+ : null ,
158
+ selectedSourceCountryIsoCodes:
159
+ _tempSelectedSourceCountryIsoCodes.isNotEmpty
160
+ ? _tempSelectedSourceCountryIsoCodes
161
+ : null ,
162
+ selectedSourceSourceTypes:
163
+ _tempSelectedSourceSourceTypes.isNotEmpty
164
+ ? _tempSelectedSourceSourceTypes
165
+ : null ,
160
166
);
161
167
162
168
// Add an event to the main HeadlinesFeedBloc to apply the
0 commit comments