|
1 | 1 | 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'; |
2 | 5 |
|
3 | 6 | /// {@template headline_filter}
|
4 | 7 | /// A model representing the filter parameters for headlines.
|
5 | 8 | /// {@endtemplate}
|
6 | 9 | class HeadlineFilter extends Equatable {
|
7 | 10 | /// {@macro headline_filter}
|
8 |
| - const HeadlineFilter({this.category, this.source, this.eventCountry}); |
| 11 | + const HeadlineFilter({this.categories, this.sources, this.eventCountries}); |
9 | 12 |
|
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; |
12 | 16 |
|
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; |
15 | 20 |
|
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; |
18 | 24 |
|
19 | 25 | @override
|
20 |
| - List<Object?> get props => [category, source, eventCountry]; |
| 26 | + List<Object?> get props => [categories, sources, eventCountries]; |
21 | 27 |
|
22 | 28 | /// Creates a copy of this [HeadlineFilter] with the given fields
|
23 | 29 | /// replaced with the new values.
|
24 | 30 | HeadlineFilter copyWith({
|
25 |
| - String? category, |
26 |
| - String? source, |
27 |
| - String? eventCountry, |
| 31 | + List<Category>? categories, |
| 32 | + List<Source>? sources, |
| 33 | + List<Country>? eventCountries, |
28 | 34 | }) {
|
29 | 35 | 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, |
33 | 39 | );
|
34 | 40 | }
|
35 | 41 | }
|
0 commit comments