Skip to content

fix:taping on text field margin does'nt hide the keyboard #337

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mostafaemara
Copy link

@mostafaemara mostafaemara commented May 31, 2025

Description

This Pull Request allow user to hide keyboard when click on the margin of the text field.

Dependency addition:

nothing

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #332

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables dismissing the keyboard when the user taps on the margin around the text field.

  • Wraps the text field container in a GestureDetector with onTap to unfocus the field.
  • Applies textFieldConfig?.margin to the container.
  • Adjusts indentation for readability.
Comments suppressed due to low confidence (1)

lib/src/widgets/chatui_textfield.dart:136

  • No tests are provided to verify that tapping outside the TextField dismisses the keyboard. Consider adding a widget test that simulates a tap on the margin and asserts that the keyboard is hidden (e.g., FocusScope.of(context).hasPrimaryFocus is false).
onTap: () {

fontWeight: FontWeight.w400,
color: Colors.grey.shade600,
letterSpacing: 0.25,
return GestureDetector(
Copy link
Preview

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

[nitpick] Wrapping the entire text field container with GestureDetector and HitTestBehavior.opaque may intercept taps intended for the TextField, causing focus to be lost immediately when interacting with the field. Consider limiting the tap detection to only the margin area or placing the detector at a higher level (e.g., Scaffold) to avoid interfering with child input.

Copilot uses AI. Check for mistakes.

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.

Hide Keyboard on tap outside. Text field bottom gap access.
1 participant