Giter Site home page Giter Site logo

Comments (5)

felixmccuaig avatar felixmccuaig commented on May 30, 2024

Umm yeah, this should most definitely be possible. Just give each autocomplete text field its own global key and you'll be fine.

GlobalKey<AutoCompleteTextFieldState<String>> key1 = new GlobalKey(); //Key for textfield one GlobalKey<AutoCompleteTextFieldState<String>> key2 = new GlobalKey(); //Key for textfield two

from flutter-autocomplete-textfield.

pranayairan avatar pranayairan commented on May 30, 2024

I tried this but it throws an exception

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter: The following assertion was thrown building
2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter: FancyAutoCompleteTextField-[LabeledGlobalKey<AutoCompleteTextFieldState<String>>#809e7](state:
2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter: _FancyAutoCompleteTextFieldState#47758):
2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter: Multiple widgets used the same GlobalKey.
2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter: The key [LabeledGlobalKey<AutoCompleteTextFieldState<String>>#809e7] was used by multiple widgets.
2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter: The parents of those widgets were:
2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter: - Semantics(container: false, properties: SemanticsProperties, label: null, value: null, hint: null,
2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter:   hintOverrides: null, renderObject: RenderSemanticsAnnotations#d5887 NEEDS-LAYOUT NEEDS-PAINT)
2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter: - Padding(padding: EdgeInsets(4.0, 0.0, 4.0, 0.0), renderObject: RenderPadding#e4d36 NEEDS-LAYOUT
2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter:   NEEDS-PAINT)
2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter: A GlobalKey can only be specified on one widget at a time in the widget tree.

from flutter-autocomplete-textfield.

felixmccuaig avatar felixmccuaig commented on May 30, 2024

2018-10-22 07:30:43.149 28048-28064/dexterapps.bankifscflutter I/flutter: Multiple widgets used the same GlobalKey.
This line states multiple widgets are using the same key. here seems like a good overview of how globalkey works in Flutter.

from flutter-autocomplete-textfield.

pranayairan avatar pranayairan commented on May 30, 2024

thanks,
I am actually using it in a diff way, i created another widget on top of autoComplete widget, due to this i am not able to pass multiple global keys, since doing GlobalKey<AutoCompleteTextFieldState> key1 = new GlobalKey() 2 times also create same instance of Globalkey.

from flutter-autocomplete-textfield.

felixmccuaig avatar felixmccuaig commented on May 30, 2024

If you're subclassing the AutoCompleteTextField, you'll need to implement the necessary implementations.

from flutter-autocomplete-textfield.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.