|
2 | 2 |
|
3 | 3 | import 'package:core/core.dart'; |
4 | 4 | import 'package:flutter/material.dart'; |
5 | | -import 'package:flutter_bloc/flutter_bloc.dart'; |
| 5 | +import 'package:flutter_bloc/flutter_bloc.dart'; |
6 | 6 | import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_placeholder.dart'; |
7 | 7 | import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart'; |
8 | | -import 'package:flutter_news_app_mobile_client_full_source_code/ads/services/interstitial_ad_manager.dart'; |
9 | 8 | import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/feed_ad_loader_widget.dart'; |
10 | 9 | import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart'; |
11 | 10 | import 'package:flutter_news_app_mobile_client_full_source_code/entity_details/bloc/entity_details_bloc.dart'; |
12 | 11 | import 'package:flutter_news_app_mobile_client_full_source_code/l10n/app_localizations.dart'; |
13 | 12 | import 'package:flutter_news_app_mobile_client_full_source_code/l10n/l10n.dart'; |
14 | | -import 'package:flutter_news_app_mobile_client_full_source_code/router/routes.dart'; |
15 | 13 | import 'package:flutter_news_app_mobile_client_full_source_code/shared/services/content_limitation_service.dart'; |
16 | 14 | import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/content_limitation_bottom_sheet.dart'; |
17 | 15 | import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/feed_core/feed_core.dart'; |
@@ -248,18 +246,6 @@ class _EntityDetailsViewState extends State<EntityDetailsView> { |
248 | 246 | ], |
249 | 247 | ); |
250 | 248 |
|
251 | | - Future<void> onHeadlineTap(Headline headline) async { |
252 | | - await context.read<InterstitialAdManager>().onPotentialAdTrigger(); |
253 | | - |
254 | | - if (!context.mounted) return; |
255 | | - |
256 | | - await context.pushNamed( |
257 | | - Routes.globalArticleDetailsName, |
258 | | - pathParameters: {'id': headline.id}, |
259 | | - extra: headline, |
260 | | - ); |
261 | | - } |
262 | | - |
263 | 249 | return CustomScrollView( |
264 | 250 | controller: _scrollController, |
265 | 251 | slivers: [ |
@@ -331,17 +317,23 @@ class _EntityDetailsViewState extends State<EntityDetailsView> { |
331 | 317 | case FeedItemImageStyle.hidden: |
332 | 318 | tile = HeadlineTileTextOnly( |
333 | 319 | headline: item, |
334 | | - onHeadlineTap: () => onHeadlineTap(item), |
| 320 | + onHeadlineTap: () => |
| 321 | + HeadlineTapHandler.handleHeadlineTap( |
| 322 | + context, item), |
335 | 323 | ); |
336 | 324 | case FeedItemImageStyle.smallThumbnail: |
337 | 325 | tile = HeadlineTileImageStart( |
338 | 326 | headline: item, |
339 | | - onHeadlineTap: () => onHeadlineTap(item), |
| 327 | + onHeadlineTap: () => |
| 328 | + HeadlineTapHandler.handleHeadlineTap( |
| 329 | + context, item), |
340 | 330 | ); |
341 | 331 | case FeedItemImageStyle.largeThumbnail: |
342 | 332 | tile = HeadlineTileImageTop( |
343 | 333 | headline: item, |
344 | | - onHeadlineTap: () => onHeadlineTap(item), |
| 334 | + onHeadlineTap: () => |
| 335 | + HeadlineTapHandler.handleHeadlineTap( |
| 336 | + context, item), |
345 | 337 | ); |
346 | 338 | } |
347 | 339 | return tile; |
|
0 commit comments