Skip to content

Commit 6ee7536

Browse files
committed
refactor: Use lists for filter properties
- Updated to use lists for filters - Categories, sources, countries
1 parent 442feb8 commit 6ee7536

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed
Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,41 @@
11
import 'package:equatable/equatable.dart';
2+
import 'package:ht_categories_client/ht_categories_client.dart';
3+
import 'package:ht_countries_client/ht_countries_client.dart';
4+
import 'package:ht_sources_client/ht_sources_client.dart';
25

36
/// {@template headline_filter}
47
/// A model representing the filter parameters for headlines.
58
/// {@endtemplate}
69
class HeadlineFilter extends Equatable {
710
/// {@macro headline_filter}
8-
const HeadlineFilter({this.category, this.source, this.eventCountry});
11+
const HeadlineFilter({this.categories, this.sources, this.eventCountries});
912

10-
/// The selected category filter.
11-
final String? category;
13+
/// The list of selected category filters.
14+
/// Headlines matching *any* of these categories will be included (OR logic).
15+
final List<Category>? categories;
1216

13-
/// The selected source filter.
14-
final String? source;
17+
/// The list of selected source filters.
18+
/// Headlines matching *any* of these sources will be included (OR logic).
19+
final List<Source>? sources;
1520

16-
/// The selected event country filter.
17-
final String? eventCountry;
21+
/// The list of selected event country filters.
22+
/// Headlines matching *any* of these countries will be included (OR logic).
23+
final List<Country>? eventCountries;
1824

1925
@override
20-
List<Object?> get props => [category, source, eventCountry];
26+
List<Object?> get props => [categories, sources, eventCountries];
2127

2228
/// Creates a copy of this [HeadlineFilter] with the given fields
2329
/// replaced with the new values.
2430
HeadlineFilter copyWith({
25-
String? category,
26-
String? source,
27-
String? eventCountry,
31+
List<Category>? categories,
32+
List<Source>? sources,
33+
List<Country>? eventCountries,
2834
}) {
2935
return HeadlineFilter(
30-
category: category ?? this.category,
31-
source: source ?? this.source,
32-
eventCountry: eventCountry ?? this.eventCountry,
36+
categories: categories ?? this.categories,
37+
sources: sources ?? this.sources,
38+
eventCountries: eventCountries ?? this.eventCountries,
3339
);
3440
}
3541
}

0 commit comments

Comments
 (0)