Skip to content

Commit c336138

Browse files
committed
refactor(search): align search results with external navigation
Updates the `HeadlineSearchDelegate` to use the refactored `HeadlineTapHandler` when a search result is tapped. This ensures that articles opened from search results follow the same external navigation and ad-triggering logic as the main feed, providing a consistent user experience.
1 parent 4e7f22d commit c336138

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

lib/headlines-feed/view/headline_search_delegate.dart

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import 'package:flutter/material.dart';
33
import 'package:flutter_bloc/flutter_bloc.dart';
44
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/bloc/headlines_search_bloc.dart';
55
import 'package:flutter_news_app_mobile_client_full_source_code/l10n/l10n.dart';
6-
import 'package:flutter_news_app_mobile_client_full_source_code/router/routes.dart';
76
import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/feed_core/feed_core.dart';
8-
import 'package:go_router/go_router.dart';
97
import 'package:ui_kit/ui_kit.dart';
108

119
/// {@template headline_search_delegate}
@@ -102,17 +100,8 @@ class HeadlineSearchDelegate extends SearchDelegate<void> {
102100
final headline = state.headlines[index];
103101
return HeadlineTileImageStart(
104102
headline: headline,
105-
onHeadlineTap: () {
106-
// Navigate to the article details page.
107-
// Using `pushNamed` with the nested route name ensures
108-
// that the "Feed" tab in the bottom navigation bar
109-
// remains selected, providing a consistent UX.
110-
context.pushNamed(
111-
Routes.articleDetailsName,
112-
pathParameters: {'id': headline.id},
113-
extra: headline,
114-
);
115-
},
103+
onHeadlineTap: () =>
104+
HeadlineTapHandler.handleHeadlineTap(context, headline),
116105
);
117106
},
118107
);

0 commit comments

Comments
 (0)