Skip to content

Commit 7ce55d1

Browse files
committed
feat(headlines-search): enhance search results with thematic and styled content
- Inject ads with headline image style and theme in search pagination - Apply thematic and styled content to search results - Update dependencies to support new styling options
1 parent dc890ed commit 7ce55d1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/headlines-search/bloc/headlines_search_bloc.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:bloc_concurrency/bloc_concurrency.dart';
55
import 'package:core/core.dart';
66
import 'package:data_repository/data_repository.dart';
77
import 'package:equatable/equatable.dart';
8+
import 'package:flutter/material.dart';
89
import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart';
910
import 'package:flutter_news_app_mobile_client_full_source_code/shared/services/feed_decorator_service.dart';
1011

@@ -108,10 +109,13 @@ class HeadlinesSearchBloc
108109
return;
109110
}
110111
// For search pagination, only inject ads.
111-
final injectedItems = _feedDecoratorService.injectAds(
112+
final injectedItems = await _feedDecoratorService.injectAds(
112113
feedItems: headlines,
113114
user: currentUser,
114115
adConfig: appConfig.adConfig,
116+
imageStyle:
117+
_appBloc.state.settings.feedPreferences.headlineImageStyle,
118+
theme: event.theme,
115119
// Calculate the count of actual content items (headlines) already in the
116120
// feed. This is crucial for the FeedDecoratorService to correctly apply
117121
// ad placement rules across paginated loads.
@@ -213,10 +217,13 @@ class HeadlinesSearchBloc
213217
return;
214218
}
215219
// For search results, only inject ads.
216-
processedItems = _feedDecoratorService.injectAds(
220+
processedItems = await _feedDecoratorService.injectAds(
217221
feedItems: headlines,
218222
user: currentUser,
219223
adConfig: appConfig.adConfig,
224+
imageStyle:
225+
_appBloc.state.settings.feedPreferences.headlineImageStyle,
226+
theme: event.theme,
220227
);
221228
case ContentType.topic:
222229
rawResponse = await _topicRepository.readAll(

0 commit comments

Comments
 (0)