Dn-a / flutter_tags

With flutter tags you can create selectable or input tags that automatically adapt to the screen width
https://pub.dartlang.org/packages/flutter_tags
MIT License
507 stars 127 forks source link

How to create multiple global keys for the flutter-tags? #65

Closed Lix-ai closed 3 years ago

Lix-ai commented 3 years ago

How to create multiple global keys for the flutter-tags? If i try to create i get: " I/flutter (16281): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ I/flutter (16281): The following assertion was thrown while finalizing the widget tree: I/flutter (16281): Duplicate GlobalKey detected in widget tree. I/flutter (16281): The following GlobalKey was specified multiple times in the widget tree. This will lead to parts of I/flutter (16281): the widget tree being truncated unexpectedly, because the second time a key is seen, the previous I/flutter (16281): instance is moved to the new location. The key was: I/flutter (16281): - [LabeledGlobalKey#f8617] I/flutter (16281): This was determined by noticing that after the widget with the above global key was moved out of its I/flutter (16281): previous parent, that previous parent never updated during this frame, meaning that it either did I/flutter (16281): not update at all or updated before the widget was moved, in either case implying that it still I/flutter (16281): thinks that it should have a child with that global key. I/flutter (16281): The specific parent that did not update after having one or more children forcibly removed due to I/flutter (16281): GlobalKey reparenting is: I/flutter (16281): - Column(direction: vertical, mainAxisAlignment: start, crossAxisAlignment: center, renderObject: I/flutter (16281): RenderFlex#0d732 relayoutBoundary=up1 NEEDS-PAINT) I/flutter (16281): A GlobalKey can only be specified on one widget at a time in the widget tree. "

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════ The following assertion was thrown while finalizing the widget tree: Multiple widgets used the same GlobalKey.

The key [LabeledGlobalKey#f8617] was used by multiple widgets. The parents of those widgets were:

Lix-ai commented 3 years ago

OR instead use the in a localkey

Dn-a commented 3 years ago

hi @Lix-ai, could you please share the code?