I have a simple custom widget trans()
(short for transaction) that just takes a number and a Boolean and displays a row, and I have a list:
List<trans> transactions=[
trans(false, 20),
trans(true, -50),
trans(false, 110),
trans(false, 35.5),
];
and display it using a ListView
:
ListView.builder(
itemCount: transactions.length,
itemBuilder: (context, index){
return(
transactions[index]
);
},
),
But how can I add a new widget to the list using a button
and update the screen dynamically ?
You may try the following code :