Skip to content

Commit 6bfd99d

Browse files
committed
fix(entity-details): pass adThemeStyle directly in LoadHeadlines event
- Remove default AdThemeStyle creation in EntityDetailsBloc - Use AdThemeStyle passed directly from the UI via LoadHeadlines event - This ensures consistent ad styling and prevents visual discrepancies
1 parent 78d4925 commit 6bfd99d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/entity_details/bloc/entity_details_bloc.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,18 +226,16 @@ class EntityDetailsBloc extends Bloc<EntityDetailsEvent, EntityDetailsState> {
226226
// This method injects stateless `AdPlaceholder` markers into the feed.
227227
// The full ad loading and lifecycle is managed by the UI layer.
228228
// See `FeedDecoratorService` for a detailed explanation.
229-
final newProcessedFeedItems = await _feedDecoratorService.injectAdPlaceholders(
229+
final newProcessedFeedItems =
230+
await _feedDecoratorService.injectAdPlaceholders(
230231
feedItems: headlineResponse.items,
231232
user: currentUser,
232233
adConfig: remoteConfig.adConfig,
233234
imageStyle: _appBloc.state.settings.feedPreferences.headlineImageStyle,
234-
adThemeStyle: AdThemeStyle.fromTheme(
235-
ThemeData(
236-
brightness: _appBloc.state.themeMode == ThemeMode.dark
237-
? Brightness.dark
238-
: Brightness.light,
239-
),
240-
), // Use a default AdThemeStyle for pagination if not passed
235+
// Use the AdThemeStyle passed directly from the UI via the event.
236+
// This ensures that ads are styled consistently with the current,
237+
// fully-resolved theme of the widget, preventing visual discrepancies.
238+
adThemeStyle: event.adThemeStyle,
241239
// Calculate the count of actual content items (headlines) already in the
242240
// feed. This is crucial for the FeedDecoratorService to correctly apply
243241
// ad placement rules across paginated loads.

0 commit comments

Comments
 (0)