I am trying to add widgets dynamically in a stack like adding text fields on the screen. I am adding that. But on tapping a particular widget i want to rebuilt the that widget in stack. For that I want to get on which widget is tapped in stack. How can I do that.?
List<Widget> customizedShirt = [];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body:Stack(
children: customizedShirt,
),
floatingActionButton: FloatingActionButton(
onPressed: (){
customizedShirt.add(Positioned(
//New position for every new text in stack
child:Text("New Text")));
setstate((){});
},
child: const Icon(Icons.add),
),
);
}
}
This is an example code now on tapping a particular text I want to rebuilt that text (Like changing its font, size etc) without changing the other texts in stack