jaumard / sms_autofill

Flutter plugin to provide SMS code autofill support
MIT License
293 stars 187 forks source link

Error when use autoFocus in PinFieldAutoFill widget #237

Open tigading opened 3 months ago

tigading commented 3 months ago

Please help me fix this issue

The following StateError was thrown while dispatching notifications for FocusNode:
Bad state: No element

When the exception was thrown, this was the stack: 
#0      List.single (dart:core-patch/growable_array.dart:353:22)
#1      TextPainter.getFullHeightForCaret (package:flutter/src/painting/text_painter.dart:1356:122)
#2      RenderEditable.getLocalRectForCaret (package:flutter/src/rendering/editable.dart:1801:48)
#3      EditableTextState._updateComposingRectIfNeeded (package:flutter/src/widgets/editable_text.dart:4487:38)
#4      EditableTextState._schedulePeriodicPostFrameCallbacks (package:flutter/src/widgets/editable_text.dart:4393:5)
#5      EditableTextState._openInputConnection (package:flutter/src/widgets/editable_text.dart:3594:7)
#6      EditableTextState._openOrCloseInputConnectionIfNeeded (package:flutter/src/widgets/editable_text.dart:3628:7)
#7      EditableTextState._handleFocusChanged (package:flutter/src/widgets/editable_text.dart:4329:5)
#8      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:433:24)
#9      FocusNode._notify (package:flutter/src/widgets/focus_manager.dart:1090:5)
#10     FocusManager.applyFocusChangesIfNeeded (package:flutter/src/widgets/focus_manager.dart:1850:12)
(elided 2 frames from dart:async)
The FocusNode sending notification was: FocusNode#511d0([PRIMARY FOCUS])
  context: Focus
  PRIMARY FOCUS
joknjokn commented 2 months ago

@jaumard Would it be possible to treat this with high priority? Autofocus for the pin input field is not working, and it's really affecting UX. On top of that, our error logging is flooded with the error tigading mentions.

joknjokn commented 2 months ago

I believe this is related, btw: https://github.com/jaumard/sms_autofill/issues/239#issue-2454951531

MrSonyDeveloper commented 2 months ago

Is there any work underway to resolve this issue?

RedUp1024 commented 2 months ago

Is there any work underway to resolve this issue?

Hello, got same issue. Fix: you need to upgrade package version to latest and then spell "flutter pub upgrade" for upgrade depended package "pin_input_text_field: " to 4.5.2, cause error inside depended package