Home > Blockchain >  Flutter - create a Container under a Row of container
Flutter - create a Container under a Row of container

Time:04-09

I have a Wrap with different containers inside with a GestureDetector and a text as child (each container has a different text inside than the others), I would like onTap for each container to create a Container at the bottom of the screen with the same text as the Container inside.

Can anyone explain to me how I could do it?

Hope someone can help me. Thank you :)

CodePudding user response:

The widget that has all these can have an onTextChanged function that does setState to save the text to a variable, which is used in the build function to put that text at the bottom of the screen. Then you can call that onTextChanged from each GestureDetector to put its own text on the bottom.

You can improve it a bit by creating a widget for those Containers and pass that onTextChanged function to that widget.

  • Related