I have a listview which displays cards on but whenever I add a new card, the title of all the cards is updated to the new title but I need just the current added one to change
final taskName = TextEditingController();
TextField(
controller: taskName,
decoration: const InputDecoration(hintText: 'Task Name'),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () {
counter++;
Navigator.pop(context);
},
child: const Text(
'Add',
style: TextStyle(fontSize: 15),
),
),
Expanded(
child: ListView.builder(
itemCount: counter,
itemBuilder: (BuildContext context, index) {
return TodoContainer(
cardTitle: taskName.text.toString(),
);
}),
)
ScreenShot to show how my cards look like after adding a new card with name of TODO
