Flutter_Pinput icon indicating copy to clipboard operation
Flutter_Pinput copied to clipboard

iOS Delete Key Not Working - UI Not Updating Despite onChanged Callback Firing labels: bug, ios

Open SunnatilloShavkatov opened this issue 2 months ago • 7 comments

UI shows "89900" instead of "8990" after delete key press.

Pinput version: 5.0.2

Result of: flutter doctor --verbose

[✓] Flutter (Channel stable, 3.35.6, on macOS 26.0.1 25A362 darwin-arm64, locale en-UZ) • Flutter version 3.35.6 on channel stable at /Users/sunnatillo/src/flutter • Framework revision 9f455d2486 (9 days ago), 2025-10-08 14:55:31 -0500 • Engine revision d2913632a4 • Dart version 3.9.2 • DevTools version 2.48.0 • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging

[✓] Xcode - develop for iOS and macOS (Xcode 26.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 17A400 • CocoaPods version 1.16.2

[✓] Connected device (3 available) • iPhone 17 Pro Max (mobile) • 5CBFC9B6-8DD9-4216-84B1-E452A0C17A4F • ios • com.apple.CoreSimulator.SimRuntime.iOS-26-0 (simulator)

Smartphone (please complete the following information):

  • Device: iPhone 17 Pro Max (Simulator)
  • OS: iOS 26.0
  • Browser: N/A (Flutter app)
  • Version: N/A

Code Sample

Pinput(
  key: const Key('confirmCodeInput'),
  onCompleted: (value) {
    if (value.length == 6) {
      _checkCode();
    }
  },
  onChanged: (value) {
    print('PIN changed: $value'); // This fires correctly
    setState(() {}); // This doesn't help
  },
  length: 6,
  autofocus: true,
  focusNode: _otpFocus,
  controller: _otpController,
  inputFormatters: [FilteringTextInputFormatter.digitsOnly],
  enableInteractiveSelection: true,
  separatorBuilder: (_) => Dimensions.kGap8,
  crossAxisAlignment: CrossAxisAlignment.center,
  hapticFeedbackType: HapticFeedbackType.lightImpact,
  defaultPinTheme: defaultPinTheme,
  submittedPinTheme: defaultPinTheme,
  focusedPinTheme: defaultPinTheme.copyDecorationWith(
    border: Border.all(color: context.colorScheme.primary, width: 1.5),
  ),
  errorPinTheme: defaultPinTheme.copyDecorationWith(
    border: Border.all(color: context.colorScheme.error)
  ),
)

Additional context

  • The issue only occurs on iOS platform
  • Android works correctly
  • The onChanged callback receives the correct updated values
  • Controller is properly connected and receives updates
  • Tried various workarounds including manual controller updates and WidgetsBinding.instance.addPostFrameCallback
  • Issue persists across different iOS versions (tested on iOS 26.0 simulator)
  • This appears to be a visual synchronization issue between the controller and the UI rendering

Expected Behavior When the delete key is pressed, the UI should visually update to reflect the removed digit, matching the value received in the onChanged callback.

Actual Behavior The onChanged callback fires with the correct updated value, but the visual PIN input fields remain unchanged, showing the previous state.

SunnatilloShavkatov avatar Oct 18 '25 00:10 SunnatilloShavkatov

The same problem. I can delete only 2 right numbers.

  • sdk: ^3.9.2
  • pinput: ^5.0.2

https://github.com/user-attachments/assets/dc503999-831a-4b77-9d9c-88e16133e326

justplayd avatar Oct 23 '25 21:10 justplayd

Same here

KonstantinDubrouski avatar Nov 13 '25 10:11 KonstantinDubrouski

I’ve fixed the issue in the flutter_pinput (v ^1.0.2) package. Tagging @justplayd and @KonstantinDubrouski so you’re aware of the update.

SunnatilloShavkatov avatar Nov 14 '25 10:11 SunnatilloShavkatov

I’ve fixed the issue in the flutter_pinput (v ^1.0.2) package. Tagging @justplayd and @KonstantinDubrouski so you’re aware of the update.

thanks

justplayd avatar Nov 14 '25 13:11 justplayd

Same here

Mr-yuwei avatar Nov 17 '25 05:11 Mr-yuwei

Fixed in version 6.0.0

Tkko avatar Nov 18 '25 20:11 Tkko

Fixed in version 6.0.0

thanks

justplayd avatar Nov 18 '25 22:11 justplayd

please close this issue as it's fixed

zeeshan-dev-0201 avatar Dec 16 '25 16:12 zeeshan-dev-0201