-
Notifications
You must be signed in to change notification settings - Fork 815
feat: Added a Search bar #2702
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: flutter
Are you sure you want to change the base?
feat: Added a Search bar #2702
Conversation
Reviewer's GuideIntroduces a real-time search feature in InstrumentsScreen by adding state and filtering logic, refactoring the UI to include a search bar with clear/empty-state handling, and updating the list rendering to reflect the filtered results. Sequence Diagram: Instrument FilteringsequenceDiagram
actor User
participant TextField
participant ISS as _InstrumentsScreenState
User->>TextField: Types search query
TextField->>ISS: onChanged(query)
ISS->>ISS: _filterInstruments(query)
ISS->>ISS: setState()
Sequence Diagram: Clearing Search InputsequenceDiagram
actor User
participant CB as ClearButton
participant ISS as _InstrumentsScreenState
participant SC as _searchController
User->>CB: Taps clear icon
CB->>ISS: onPressed()
ISS->>SC: clear()
ISS->>ISS: _filterInstruments('')
ISS->>ISS: setState()
Class Diagram: Changes to _InstrumentsScreenStateclassDiagram
class _InstrumentsScreenState {
+TextEditingController _searchController
+List<int> _filteredIndices
+void initState()
+void dispose()
+void _filterInstruments(String query)
+Widget build(BuildContext context)
+void _onItemTapped(int index)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Looks like a good addition. The build is failing for deprecated libraries. |
Replaced deprecated libraries with their latest supported alternatives to fix the build issues. |
Build successful. APKs to test: https://github.com/fossasia/pslab-android/actions/runs/15270582634/artifacts/3202117329 |
lib/view/instruments_screen.dart
Outdated
child: Column( | ||
children: <Widget>[ | ||
Padding( | ||
padding: const EdgeInsets.all(16.0), |
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.
This seems a bit too wide. Can you check what is the average padding between a search bar and a similar looking list item in other established Flutter apps?
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 have checked a few Flutter apps, and it seems that 16px is commonly used for horizontal padding, while vertical padding ranges from 8px to 16px. I will make the changes based on your suggestion sir.
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.
fc3adb2
to
8cf509b
Compare
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.
Looks like a good addition!
Closes #2704
Since the PSLab has many instruments , it becomes hard for users to scroll down to search a specific instrument . So i have added a search bar that filters the instruments based on the instrument name.
Changes
Screenshots / Recordings
Screen.Recording.2025-05-25.185557.mp4
Checklist:
strings.xml
,dimens.xml
andcolors.xml
without hard coding any value.strings.xml
,dimens.xml
orcolors.xml
.Summary by Sourcery
Add a search bar to the Instruments screen to allow users to filter the list of instruments by name.
New Features: