Skip to content

Commit 3cbccf7

Browse files
committed
refactor(headlines-feed): update HeadlinesFeedEvent to use AdThemeStyle
- Replace ThemeData with AdThemeStyle in HeadlinesFeedEvent subclasses - Update property names and types accordingly - Adjust overridden props list in each subclass
1 parent 585c079 commit 3cbccf7

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

lib/headlines-feed/bloc/headlines_feed_bloc.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:core/core.dart';
66
import 'package:data_repository/data_repository.dart';
77
import 'package:equatable/equatable.dart';
88
import 'package:flutter/material.dart';
9+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
910
import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart';
1011
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/models/headline_filter.dart';
1112
import 'package:flutter_news_app_mobile_client_full_source_code/shared/services/feed_decorator_service.dart';

lib/headlines-feed/bloc/headlines_feed_event.dart

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ sealed class HeadlinesFeedEvent extends Equatable {
1818
final class HeadlinesFeedFetchRequested extends HeadlinesFeedEvent {
1919
/// {@macro headlines_feed_fetch_requested}
2020
///
21-
/// Optionally includes a [cursor] to fetch the next page. If [cursor] is null,
22-
/// it typically indicates an initial fetch request.
23-
const HeadlinesFeedFetchRequested({required this.theme, this.cursor});
21+
/// Optionally includes a [cursor] to fetch the next page. If [cursor] is null,
22+
/// it typically indicates an initial fetch request.
23+
const HeadlinesFeedFetchRequested({required this.adThemeStyle, this.cursor});
2424

2525
/// The cursor indicating the starting point for the next page of headlines.
2626
/// If null, fetches the first page.
2727
final String? cursor;
2828

29-
/// The current theme data of the application.
30-
final ThemeData theme;
29+
/// The current ad theme style of the application.
30+
final AdThemeStyle adThemeStyle;
3131

3232
@override
33-
List<Object?> get props => [cursor, theme];
33+
List<Object?> get props => [cursor, adThemeStyle];
3434
}
3535

3636
/// {@template headlines_feed_refresh_requested}
@@ -39,13 +39,13 @@ final class HeadlinesFeedFetchRequested extends HeadlinesFeedEvent {
3939
/// currently active filters.
4040
/// {@endtemplate}
4141
final class HeadlinesFeedRefreshRequested extends HeadlinesFeedEvent {
42-
const HeadlinesFeedRefreshRequested({required this.theme});
42+
const HeadlinesFeedRefreshRequested({required this.adThemeStyle});
4343

44-
/// The current theme data of the application.
45-
final ThemeData theme;
44+
/// The current ad theme style of the application.
45+
final AdThemeStyle adThemeStyle;
4646

4747
@override
48-
List<Object> get props => [theme];
48+
List<Object> get props => [adThemeStyle];
4949
}
5050

5151
/// {@template headlines_feed_filters_applied}
@@ -58,32 +58,32 @@ final class HeadlinesFeedFiltersApplied extends HeadlinesFeedEvent {
5858
/// Contains the complete [HeadlineFilter] configuration to be applied.
5959
const HeadlinesFeedFiltersApplied({
6060
required this.filter,
61-
required this.theme,
61+
required this.adThemeStyle,
6262
});
6363

6464
/// The [HeadlineFilter] containing the selected categories, sources,
6565
/// and/or countries.
6666
final HeadlineFilter filter;
6767

68-
/// The current theme data of the application.
69-
final ThemeData theme;
68+
/// The current ad theme style of the application.
69+
final AdThemeStyle adThemeStyle;
7070

7171
@override
72-
List<Object?> get props => [filter, theme];
72+
List<Object?> get props => [filter, adThemeStyle];
7373
}
7474

7575
/// {@template headlines_feed_filters_cleared}
7676
/// Event triggered when the user requests to clear all active filters
7777
/// and view the unfiltered headlines feed.
7878
/// {@endtemplate}
7979
final class HeadlinesFeedFiltersCleared extends HeadlinesFeedEvent {
80-
const HeadlinesFeedFiltersCleared({required this.theme});
80+
const HeadlinesFeedFiltersCleared({required this.adThemeStyle});
8181

82-
/// The current theme data of the application.
83-
final ThemeData theme;
82+
/// The current ad theme style of the application.
83+
final AdThemeStyle adThemeStyle;
8484

8585
@override
86-
List<Object> get props => [theme];
86+
List<Object> get props => [adThemeStyle];
8787
}
8888

8989
/// {@template feed_decorator_dismissed}

0 commit comments

Comments
 (0)