Skip to content

Commit c670fd0

Browse files
committed
feat(entity_details): add events for bloc
- Add load requested event - Add toggle follow event - Add load more headlines event
1 parent f53ed5d commit c670fd0

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
part of 'entity_details_bloc.dart';
2+
3+
abstract class EntityDetailsEvent extends Equatable {
4+
const EntityDetailsEvent();
5+
6+
@override
7+
List<Object?> get props => [];
8+
}
9+
10+
/// Event to load entity details and initial headlines.
11+
/// Can be triggered by passing an ID and type, or the full entity.
12+
class EntityDetailsLoadRequested extends EntityDetailsEvent {
13+
const EntityDetailsLoadRequested({
14+
this.entityId,
15+
this.entityType,
16+
this.entity,
17+
}) : assert(
18+
(entityId != null && entityType != null) || entity != null,
19+
'Either entityId/entityType or entity must be provided.',
20+
);
21+
22+
final String? entityId;
23+
final EntityType? entityType;
24+
final dynamic entity; // Category or Source
25+
26+
@override
27+
List<Object?> get props => [entityId, entityType, entity];
28+
}
29+
30+
/// Event to toggle the follow status of the current entity.
31+
class EntityDetailsToggleFollowRequested extends EntityDetailsEvent {
32+
const EntityDetailsToggleFollowRequested();
33+
}
34+
35+
/// Event to load more headlines for pagination.
36+
class EntityDetailsLoadMoreHeadlinesRequested extends EntityDetailsEvent {
37+
const EntityDetailsLoadMoreHeadlinesRequested();
38+
}
39+
40+
/// Internal event to notify the BLoC that user preferences have changed.
41+
class _EntityDetailsUserPreferencesChanged extends EntityDetailsEvent {
42+
const _EntityDetailsUserPreferencesChanged(this.preferences);
43+
44+
final UserContentPreferences preferences;
45+
46+
@override
47+
List<Object?> get props => [preferences];
48+
}

0 commit comments

Comments
 (0)