i am making correct spelling app for kids where i need this when i click on given option it will be add in top text in order
my try
Center(
child: Text(
imageList[anu1].wrongSpell1,
),
),
i want to add this text value to another . when click on this text it would be add in variable
var mytext;
i add my text in this variable like this
mytext = mytext.add(imageList[anu1].wrongSpell1);
setState(() {});
here i show my added text
Text(
mytext.toString(),
)
Solution 1: Huthaifa Muayyad
All you have to do is "concatenate" strings.
String mytext = 'starting text';
TextButton(
onPressed: () {
setState(() {
mytext = mytext + imageList[anu1].wrongSpell1;
});
},
child: Text(imageList[anu1].wrongSpell1),
)
//// here is where you would show your text:
Text(mytext)
Solution 2: Ottoman Coder
All you need to do is:
String myname = 'ottoman';
setState(() {
myname = myname + imageList[anu1].wrongSpell1;
});