-
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.
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.
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)
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
.
// 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.
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.
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