@@ -5,11 +5,13 @@ import 'package:core/core.dart';
55import 'package:flutter/material.dart' ;
66import 'package:flutter_bloc/flutter_bloc.dart' ;
77import 'package:flutter_news_app_mobile_client_full_source_code/account/bloc/account_bloc.dart' ;
8+ import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_feed_item.dart' ;
89import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart' ;
910import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/bloc/headlines_feed_bloc.dart' ;
1011import 'package:flutter_news_app_mobile_client_full_source_code/l10n/l10n.dart' ;
1112import 'package:flutter_news_app_mobile_client_full_source_code/router/routes.dart' ;
12- import 'package:flutter_news_app_mobile_client_full_source_code/shared/shared.dart' ;
13+ import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/ads/ad_feed_item_widget.dart' ;
14+ import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/feed_core/feed_core.dart' ;
1315import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/feed_decorators/call_to_action_decorator_widget.dart' ;
1416import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/feed_decorators/content_collection_decorator_widget.dart' ;
1517import 'package:go_router/go_router.dart' ;
@@ -287,43 +289,16 @@ class _HeadlinesFeedPageState extends State<HeadlinesFeedPage> {
287289 );
288290 }
289291 return tile;
290- } else if (item is Ad ) {
291- return Card (
292- margin: const EdgeInsets .symmetric (
293- horizontal: AppSpacing .paddingMedium,
294- vertical: AppSpacing .xs,
295- ),
296- color: colorScheme.surfaceContainerHighest,
297- child: Padding (
298- padding: const EdgeInsets .all (AppSpacing .md),
299- child: Column (
300- children: [
301- if (item.imageUrl.isNotEmpty)
302- Image .network (
303- item.imageUrl,
304- height: 100 ,
305- errorBuilder: (ctx, err, st) =>
306- const Icon (Icons .broken_image, size: 50 ),
307- ),
308- const SizedBox (height: AppSpacing .sm),
309- Text (
310- 'Placeholder Ad: ${item .adType }' ,
311- style: textTheme.titleSmall,
312- ),
313- Text (
314- 'Placement: ${item .placement }' ,
315- style: textTheme.bodySmall,
316- ),
317- if (item.targetUrl.isNotEmpty)
318- TextButton (
319- onPressed: () {
320- // TODO(fulleni): Launch URL
321- },
322- child: const Text ('Visit Advertiser' ),
323- ),
324- ],
325- ),
326- ),
292+ } else if (item is AdFeedItem ) {
293+ final imageStyle = context
294+ .watch <AppBloc >()
295+ .state
296+ .settings
297+ .feedPreferences
298+ .headlineImageStyle;
299+ return AdFeedItemWidget (
300+ adFeedItem: item,
301+ headlineImageStyle: imageStyle,
327302 );
328303 } else if (item is CallToActionItem ) {
329304 return CallToActionDecoratorWidget (
0 commit comments