I am learning flutter and I am new , can you help me to tell how to add dynamic widgets on screen , these widgets are different from each other e.g one dynamic widget having container which contain 4 buttons and other dynamic widget container contain 6 buttons , If user want to add container having 6 buttons , he can add As well as if he want to add 4 button container that can also added in it, This containers are in either horizontal sequence or vertical sequence

I have done with single type of container but unable to add other type container !! Please help !!


Solution 1: jo3ght

You can do it by using List.generate


Solution 2: Ardeshir ojan

you have a listWidget, you have to add your blue Containers to that list and then setState for example, you have a button to add to this list

 onTap: () {
listWidge.add(BLUECONTAINER);
setState((){});

}