@@ -70,10 +70,12 @@ class _HeadlinesFilterPageState extends State<HeadlinesFilterPage> {
70
70
final currentFilter = headlinesFeedState.filter;
71
71
_tempSelectedCategories = List .from (currentFilter.categories ?? []);
72
72
_tempSelectedSources = List .from (currentFilter.sources ?? []);
73
- _tempSelectedSourceCountryIsoCodes =
74
- Set .from (currentFilter.selectedSourceCountryIsoCodes ?? {});
75
- _tempSelectedSourceSourceTypes =
76
- Set .from (currentFilter.selectedSourceSourceTypes ?? {});
73
+ _tempSelectedSourceCountryIsoCodes = Set .from (
74
+ currentFilter.selectedSourceCountryIsoCodes ?? {},
75
+ );
76
+ _tempSelectedSourceSourceTypes = Set .from (
77
+ currentFilter.selectedSourceSourceTypes ?? {},
78
+ );
77
79
78
80
// Use the new flag from the filter to set the checkbox state
79
81
initialUseFollowedFilters = currentFilter.isFromFollowedItems;
@@ -161,12 +163,14 @@ class _HeadlinesFilterPageState extends State<HeadlinesFilterPage> {
161
163
}
162
164
} on NotFoundException {
163
165
setState (() {
164
- _currentUserPreferences =
165
- UserContentPreferences (id: currentUser.id); // Empty prefs
166
+ _currentUserPreferences = UserContentPreferences (
167
+ id: currentUser.id,
168
+ ); // Empty prefs
166
169
_tempSelectedCategories = [];
167
170
_tempSelectedSources = [];
168
171
_isLoadingFollowedFilters = false ;
169
- _useFollowedFilters = false ; // Uncheck as no prefs found (implies no followed)
172
+ _useFollowedFilters =
173
+ false ; // Uncheck as no prefs found (implies no followed)
170
174
});
171
175
if (mounted) {
172
176
ScaffoldMessenger .of (context)
@@ -182,8 +186,7 @@ class _HeadlinesFilterPageState extends State<HeadlinesFilterPage> {
182
186
setState (() {
183
187
_isLoadingFollowedFilters = false ;
184
188
_useFollowedFilters = false ; // Uncheck the box
185
- _loadFollowedFiltersError =
186
- e.message; // Or a generic "Failed to load"
189
+ _loadFollowedFiltersError = e.message; // Or a generic "Failed to load"
187
190
});
188
191
} catch (e) {
189
192
setState (() {
@@ -238,17 +241,18 @@ class _HeadlinesFilterPageState extends State<HeadlinesFilterPage> {
238
241
subtitle: Text (subtitle),
239
242
trailing: const Icon (Icons .chevron_right),
240
243
enabled: enabled, // Use the enabled parameter
241
- onTap: enabled // Only allow tap if enabled
242
- ? () async {
243
- final result = await context.pushNamed <dynamic >(
244
- routeName,
245
- extra: currentSelectionData, // Pass the map or list
246
- );
247
- if (result != null && onResult != null ) {
248
- onResult (result);
244
+ onTap:
245
+ enabled // Only allow tap if enabled
246
+ ? () async {
247
+ final result = await context.pushNamed <dynamic >(
248
+ routeName,
249
+ extra: currentSelectionData, // Pass the map or list
250
+ );
251
+ if (result != null && onResult != null ) {
252
+ onResult (result);
253
+ }
249
254
}
250
- }
251
- : null ,
255
+ : null ,
252
256
);
253
257
}
254
258
@@ -271,8 +275,8 @@ class _HeadlinesFilterPageState extends State<HeadlinesFilterPage> {
271
275
tooltip: l10n.headlinesFeedFilterResetButton,
272
276
onPressed: () {
273
277
context.read <HeadlinesFeedBloc >().add (
274
- HeadlinesFeedFiltersCleared (),
275
- );
278
+ HeadlinesFeedFiltersCleared (),
279
+ );
276
280
// Also reset local state for the checkbox
277
281
setState (() {
278
282
_useFollowedFilters = false ;
@@ -288,12 +292,14 @@ class _HeadlinesFilterPageState extends State<HeadlinesFilterPage> {
288
292
tooltip: l10n.headlinesFeedFilterApplyButton,
289
293
onPressed: () {
290
294
final newFilter = HeadlineFilter (
291
- categories: _tempSelectedCategories.isNotEmpty
292
- ? _tempSelectedCategories
293
- : null ,
294
- sources: _tempSelectedSources.isNotEmpty
295
- ? _tempSelectedSources
296
- : null ,
295
+ categories:
296
+ _tempSelectedCategories.isNotEmpty
297
+ ? _tempSelectedCategories
298
+ : null ,
299
+ sources:
300
+ _tempSelectedSources.isNotEmpty
301
+ ? _tempSelectedSources
302
+ : null ,
297
303
selectedSourceCountryIsoCodes:
298
304
_tempSelectedSourceCountryIsoCodes.isNotEmpty
299
305
? _tempSelectedSourceCountryIsoCodes
@@ -302,12 +308,11 @@ class _HeadlinesFilterPageState extends State<HeadlinesFilterPage> {
302
308
_tempSelectedSourceSourceTypes.isNotEmpty
303
309
? _tempSelectedSourceSourceTypes
304
310
: null ,
305
- isFromFollowedItems:
306
- _useFollowedFilters, // Set the new flag
311
+ isFromFollowedItems: _useFollowedFilters, // Set the new flag
307
312
);
308
313
context.read <HeadlinesFeedBloc >().add (
309
- HeadlinesFeedFiltersApplied (filter: newFilter),
310
- );
314
+ HeadlinesFeedFiltersApplied (filter: newFilter),
315
+ );
311
316
context.pop ();
312
317
},
313
318
),
@@ -335,13 +340,14 @@ class _HeadlinesFilterPageState extends State<HeadlinesFilterPage> {
335
340
}
336
341
});
337
342
},
338
- secondary: _isLoadingFollowedFilters
339
- ? const SizedBox (
340
- width: 24 ,
341
- height: 24 ,
342
- child: CircularProgressIndicator (strokeWidth: 2 ),
343
- )
344
- : null ,
343
+ secondary:
344
+ _isLoadingFollowedFilters
345
+ ? const SizedBox (
346
+ width: 24 ,
347
+ height: 24 ,
348
+ child: CircularProgressIndicator (strokeWidth: 2 ),
349
+ )
350
+ : null ,
345
351
controlAffinity: ListTileControlAffinity .leading,
346
352
),
347
353
),
0 commit comments