-
Notifications
You must be signed in to change notification settings - Fork 333
adds search icon to inbox and combined feed pages #1864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Need your review on this. Do let me know if tests are also required for this. |
Thanks! Yeah, let's have a few quick test cases for this: just checking that
|
Sure, will add the tests and update the PR. |
Thanks for the detailed screenshots! The placement looks good to me. |
Hey, @gnprice , @chrisbobbe . I have added the following tests for the search icon button in this PR : Positive Cases - Search Button Should Appear
Negative Cases - Search Button Should NOT Appear
|
Hey Guys, just a sincere remainder. This PR needs a review. Thanks. cc : @gnprice , @chrisbobbe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks helpful! Comments below, and please organize the commits (and write their commit messages) according to our project style.
lib/widgets/message_list.dart
Outdated
actions.add(IconButton( | ||
icon: const Icon(ZulipIcons.search), | ||
onPressed: () => Navigator.push(context, | ||
MessageListPage.buildRoute(context: context, | ||
narrow: KeywordSearchNarrow(''))), | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a tooltip:
here, like on the "Channel feed" button for topic narrows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, let's add this in a separate commit from the commit that changes the inbox page. Please ask in #git help
in the development community if you need help doing that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the tooltip: zulipLocalizations.searchMessagesPageTitle, because this same tooltip was being used for the search button (_SearchButton) inside the main menu.
lib/widgets/message_list.dart
Outdated
narrow: KeywordSearchNarrow(''))), | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also nit:
narrow: KeywordSearchNarrow(''))), | |
)); | |
narrow: KeywordSearchNarrow(''))))); |
(like in similar code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
lib/widgets/home.dart
Outdated
actions: _tab.value == _HomePageTab.inbox ? [ | ||
IconButton( | ||
icon: const Icon(ZulipIcons.search), | ||
onPressed: () => Navigator.of(context).push(MessageListPage.buildRoute( | ||
context: context, narrow: KeywordSearchNarrow(''))), | ||
), | ||
] : null), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the value we pass as actions
, I think it would be neater as _currentTabAppBarActions
, on the pattern of _currentTabTitle
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added _currentTabAppBarActions
, following the pattern of _currentTabTitle
test/widgets/home_test.dart
Outdated
// to an ancient server: | ||
// https://github.com/zulip/zulip-flutter/pull/1410#discussion_r1999991512 | ||
|
||
group('search button', () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a neater way to cover the inbox page in tests would be:
- Don't add this new 'search button' group. (The search button isn't really a feature of the whole home page, just the inbox.)
- To test that the button is present on the "Inbox" tab and not the other tabs, update and rename the existing test 'update app bar title when switching between views' in the 'bottom nav navigation' group.
- In test/widgets/inbox_test.dart, add a test that the button does the correct thing when tapped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the changes you suggested.
Thanks for pointing out, made me go through tests again which helped me understand the structures of these tests even more.
test/widgets/message_list_test.dart
Outdated
group('app bar search button', () { | ||
// Tests for the search icon button that should appear in the app bar | ||
// on the combined feed screen but not on other message list screens. | ||
// We check the app bar's actions list directly to avoid confusion with | ||
// the search icon that appears in the search input field. | ||
|
||
testWidgets('search icon button appears on CombinedFeedNarrow', (tester) async { | ||
// Set up the combined feed (all messages) view | ||
await setupMessageListPage(tester, narrow: const CombinedFeedNarrow(), messages: []); | ||
|
||
// Verify that the search button is present in the app bar actions | ||
final appBar = tester.widget<ZulipAppBar>(find.byType(ZulipAppBar)); | ||
final actions = appBar.actions ?? []; | ||
final hasSearchButton = actions.any((widget) => | ||
widget is IconButton && | ||
widget.icon is Icon && | ||
(widget.icon as Icon).icon == ZulipIcons.search); | ||
check(hasSearchButton).isTrue(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need tests to check that the button is absent for various narrows. I think there's almost no risk that we'll accidentally create a bug that such tests would catch, which means the tests aren't very useful. Here's a helpful talk by Greg covering that kind of advice and more: #learning > Greg's talk at FlutterCon USA 2025 @ 💬
I think we just need one test that looks for the search button in "Combined feed" and checks that it does the correct thing when tapped. That test should go in the existing "app bar" group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds a search icon and tooltip to the icon in the home page app bar that appears on the inbox tab. Uses the same localized 'Search' text for consistency with the message list search button. Also refactors the app bar actions logic by extracting it into a _currentTabAppBarActions getter. Updates the existing bottom nav navigation test inside home_test to verify search button presence across different tabs: present on inbox, absent on channels and direct messages tabs. Also updates the existing InboxPage tests to verify the search button navigates to search page when tapped
Adds a search icon button in the message list app bar that appears on the combined feed narrow. Uses the same localized 'Search' text for consistency with the message list search button. Also adds a focused test in the existing 'app bar' group inside message_list_test that verifies the search button appears on combined feed and navigates correctly to the search page when tapped.
3453701
to
3608a3e
Compare
@chrisbobbe , just a heads up! Thank you so much for the valuable feedback!! |
Added a search icon on inbox and the combined feed screen which opens up the usual search page.
Fixes : #1854
Screen.Recording.2025-09-20.at.2.11.43.PM.mov
Screen.Recording.2025-09-20.at.2.17.36.PM.mov