felixmccuaig / flutter-autocomplete-textfield

An autocomplete Textfield for flutter
MIT License
181 stars 131 forks source link

Error when touching autocomplete field #39

Closed aleaforny closed 5 years ago

aleaforny commented 5 years ago

Hello,

I've updated flutter from 1.2.x to last stable release, 1.5.4 :

[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [version 6.3.9600], locale fr-FR)

No changes to the code at all. I just tried to build the appbundle again and I got some errors regarding to this plugin. Using debug, this is the error message I get when I touch the autocomplete field (without typing anything) :

I/flutter (12956): ══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞════════════════════════════════════════════════════════
I/flutter (12956): The following NoSuchMethodError was thrown while dispatching notifications for FocusNode:
I/flutter (12956): The method 'call' was called on null.
I/flutter (12956): Receiver: null
I/flutter (12956): Tried calling: call(true)
I/flutter (12956): 
I/flutter (12956): When the exception was thrown, this was the stack:
I/flutter (12956): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
I/flutter (12956): #1      new AutoCompleteTextFieldState.<anonymous closure> (package:autocomplete_textfield/autocomplete_textfield.dart:182:4)
I/flutter (12956): #2      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:206:21)
I/flutter (12956): #3      FocusNode._notify (package:flutter/src/widgets/focus_manager.dart:103:5)
I/flutter (12956): #4      FocusManager._update (package:flutter/src/widgets/focus_manager.dart:474:20)
I/flutter (12956): (elided 10 frames from package dart:async)
I/flutter (12956): 
I/flutter (12956): The FocusNode sending notification was:
I/flutter (12956):   FocusNode#30503(FOCUSED)
I/flutter (12956): ════════════════════════════════════════════════════════════════════════════════════════════════════

I experienced this with flutter-autocomplete-textfield 1.6.4 but I updated to last version 1.6.6 and I'm facing the same issue.

I tried to rollback to flutter v1.2.2 and this issue doesn't occur.

Has someone got the same issue?

Thanks

aleaforny commented 5 years ago

Duplicate of #35

Just added onFocusChanged: (hasFocus) {} to AutoCompleteTextField and it fixed the issue.

I still think this need to be fixed in the code as it was working before the upgrade of flutter.

renatopastor1 commented 5 years ago

Awesome thanks! @aleaforny

alconasoftware commented 4 years ago

The suggested fix does not work on SimpleAutoCompleteTextField which throws the error when you touch a suggestion from the list.

Stack:

flutter: The following NoSuchMethodError was thrown while handling a gesture: flutter: The method 'call' was called on null. flutter: Receiver: null flutter: Tried calling: call("cc : cubic centimetres") flutter: flutter: When the exception was thrown, this was the stack: flutter: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5) flutter: #1 AutoCompleteTextFieldState.updateOverlay.... (package:autocomplete_textfield/autocomplete_textfield.dart:327:41) flutter: #2 State.setState (package:flutter/src/widgets/framework.dart:1148:30) flutter: #3 AutoCompleteTextFieldState.updateOverlay... (package:autocomplete_textfield/autocomplete_textfield.dart:322:37) flutter: #4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14) flutter: #5 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:789:36) flutter: #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24) flutter: #7 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11) flutter: #8 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5) flutter: #9 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:199:7) flutter: #10 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:467:9) flutter: #11 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:76:12) flutter: #12 PointerRouter._dispatchEventToRoutes. (package:flutter/src/gestures/pointer_router.dart:117:9) flutter: #13 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8) flutter: #14 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:115:18) flutter: #15 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:7) flutter: #16 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19) flutter: #17 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22) flutter: #18 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7) flutter: #19 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7) flutter: #20 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7) flutter: #24 _invoke1 (dart:ui/hooks.dart:273:10) flutter: #25 _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5) flutter: (elided 3 frames from package dart:async) flutter: flutter: Handler: "onTap" flutter: Recognizer: flutter: TapGestureRecognizer#1f614

AbedE8 commented 4 years ago

same happens to me

═══════ Exception caught by gesture ═══════════════════════════════════════════ The following NoSuchMethodError was thrown while handling a gesture: The method 'call' was called on null. Receiver: null Tried calling: call("Teva Naot")

When the exception was thrown, this was the stack

0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)

1 AutoCompleteTextFieldState.updateOverlay....

package:autocomplete_textfield/autocomplete_textfield.dart:327

2 State.setState

package:flutter/…/widgets/framework.dart:1148

3 AutoCompleteTextFieldState.updateOverlay...

package:autocomplete_textfield/autocomplete_textfield.dart:322

4 _InkResponseState._handleTap

package:flutter/…/material/ink_well.dart:706 ... Handler: "onTap" Recognizer: TapGestureRecognizer#34e11 debugOwner: GestureDetector state: possible won arena finalPosition: Offset(243.7, 254.0) finalLocalPosition: Offset(167.7, 18.0) button: 1 sent tap down

linoqui14 commented 3 years ago

Still no fix? I have the same problem

linoqui14 commented 3 years ago

onFocusChanged: (hasFocus) {} does not fix it