Skip to content

Conversation

@tnswo561412
Copy link

Summary

Fix the issue where iPhone users cannot dismiss the keyboard after searching.

Problem

  • iPad has a dismiss button at the bottom of the keyboard, but iPhone does not
  • Users had to tap the three dots (⋯) menu on a song to dismiss the keyboard

Solution

  • Wrap search results area with GestureDetector
  • Use HitTestBehavior.translucent to detect taps on empty space
  • Call FocusScope.of(context).unfocus() on tap to dismiss keyboard

Changes

  • lib/pages/search/search.dart: Wrap search results area with GestureDetector to dismiss keyboard on tap

Test plan

  • Open search page on iPhone
  • Type search query
  • Tap on search results area or empty space
  • Verify keyboard dismisses
  • Verify tapping search result items still works correctly

@tnswo561412
Copy link
Author

Hello, just checking in on this PR. I understand you might be busy, but I’d appreciate it if you could take a look when you have a moment. I'm happy to resolve any conflicts or make changes if needed.

@tnswo561412
Copy link
Author

I understand you must be busy, but I would highly appreciate it if you could spare some time to review this PR. As a part of a university course assignment, feedback or a merge is crucial for my submission deadline.

Please let me know if there are any issues I need to resolve, or if you have specific feedback on the code. Thank you for your time!

Copy link

@Alastair-L Alastair-L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there, thanks for your contribution :).

Positives:

  • You did a good job with the scope of the issue and fix
  • Thank you for contributing at all!

Improvements:

  • I would ask that if you use AI to generate the code that you should disclose this.
  • Make sure not to accidentally include extra files in the PR.
  • Don't create a PR against the master branch (in future please read the contribution guidelines file found in most open source projects, here: https://github.com/KRTirtho/spotube/blob/master/CONTRIBUTION.md)
  • Usually, it's best to include more information about the issue before submitting a fix, and creating a github issue with (ideally) screenshots/videos.

Note that the method in this PR may not be best way to achieve the overall goal. For example this may be a little cleaner and avoids a level of nesting:

FYI I'm not a native flutter dev.

@@ -0,0 +1,11 @@
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's needed or desired to commit this file. Try adding it to .gitignore instead, or stage a subset of files before committing.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file as well.

_ => const SearchPageAllTab(),
},
child: GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
child: GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
behavior: HitTestBehavior.translucent,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think translucent is what we want here (I think the default is correct). See the options here:

https://api.flutter.dev/flutter/rendering/HitTestBehavior.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants