Skip to content

Conversation

@meylis1998
Copy link

Summary

Root Cause

The Android CardField and CardFormField implementations lacked the Listener + Focus widget wrappers that iOS has. This prevented proper touch-to-focus coordination.

Solution

Wrap Android card field widgets with the same Listener + Focus pattern used by iOS:

  • Listener intercepts onPointerDown to request focus
  • Focus manages focus state and triggers _handleFrameworkFocusChanged
  • This invokes native requestFocusFromJS() which shows the keyboard

Changes

  • packages/stripe/lib/src/widgets/card_field.dart - Wrapped _AndroidCardField with Listener + Focus
  • packages/stripe/lib/src/widgets/card_form_field.dart - Wrapped _AndroidCardFormField with Listener + Focus

Test plan

  • Run example app on Android device
  • Tap CardField - keyboard should appear on first tap
  • Test CardFormField similarly
  • Verify iOS still works correctly
  • Test autofocus behavior
  • Test disabled state (keyboard should not appear)

…ter-stripe#2286)

Wrap Android CardField and CardFormField with Listener + Focus widgets
to match iOS implementation. This ensures touch events properly trigger
focus requests, which in turn invoke native keyboard display.
@jonasbark
Copy link
Member

Thank you, looks good!

@meylis1998 meylis1998 requested a review from jonasbark December 29, 2025 13:49
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.

The keyboard does not appear when the card number text field is tapped.

2 participants