Skip to content

Commit 236643b

Browse files
committed
feat(headlines-feed): pass theme to feed events
- Pass theme to HeadlinesFeedFetchRequested, HeadlinesFeedRefreshRequested, and HeadlinesFeedFiltersCleared events - Update ad feed item widget import path - Improve code consistency and maintainability by passing theme information
1 parent 78b2266 commit 236643b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/headlines-feed/view/headlines_feed_page.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import 'package:flutter/material.dart';
66
import 'package:flutter_bloc/flutter_bloc.dart';
77
import 'package:flutter_news_app_mobile_client_full_source_code/account/bloc/account_bloc.dart';
88
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_feed_item.dart';
9+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/widgets.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/bloc/headlines_feed_bloc.dart';
1112
import 'package:flutter_news_app_mobile_client_full_source_code/l10n/l10n.dart';
1213
import 'package:flutter_news_app_mobile_client_full_source_code/router/routes.dart';
13-
import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/ads/ad_feed_item_widget.dart';
1414
import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/feed_core/feed_core.dart';
1515
import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/feed_decorators/call_to_action_decorator_widget.dart';
1616
import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/feed_decorators/content_collection_decorator_widget.dart';
@@ -64,7 +64,7 @@ class _HeadlinesFeedPageState extends State<HeadlinesFeedPage> {
6464
state.hasMore &&
6565
state.status != HeadlinesFeedStatus.loadingMore) {
6666
context.read<HeadlinesFeedBloc>().add(
67-
const HeadlinesFeedFetchRequested(),
67+
HeadlinesFeedFetchRequested(theme: Theme.of(context)),
6868
);
6969
}
7070
}
@@ -184,7 +184,7 @@ class _HeadlinesFeedPageState extends State<HeadlinesFeedPage> {
184184
return FailureStateWidget(
185185
exception: state.error!,
186186
onRetry: () => context.read<HeadlinesFeedBloc>().add(
187-
HeadlinesFeedRefreshRequested(),
187+
HeadlinesFeedRefreshRequested(theme: Theme.of(context)),
188188
),
189189
);
190190
}
@@ -203,7 +203,7 @@ class _HeadlinesFeedPageState extends State<HeadlinesFeedPage> {
203203
const SizedBox(height: AppSpacing.lg),
204204
ElevatedButton(
205205
onPressed: () => context.read<HeadlinesFeedBloc>().add(
206-
HeadlinesFeedFiltersCleared(),
206+
HeadlinesFeedFiltersCleared(theme: Theme.of(context)),
207207
),
208208
child: Text(l10n.headlinesFeedClearFiltersButton),
209209
),
@@ -215,7 +215,7 @@ class _HeadlinesFeedPageState extends State<HeadlinesFeedPage> {
215215
return RefreshIndicator(
216216
onRefresh: () async {
217217
context.read<HeadlinesFeedBloc>().add(
218-
HeadlinesFeedRefreshRequested(),
218+
HeadlinesFeedRefreshRequested(theme: Theme.of(context)),
219219
);
220220
},
221221
child: ListView.separated(

0 commit comments

Comments
 (0)