flutterflutter-streambuilder

Flutter Row() - Align 3 widgets evenly in any amount of Columns


I need to show whole my options(Cyties) since Firebase DB in my app so I would like create somethig similar to the screenshot I posted and not quite sure how to. The only way I know to do it is with ListTile and is not the idea.app Colombia from Play Store

I just tried with a ListTile. And Im sure I need an StreamBuilder since the begining.

This is what I did


Solution

  • You just need to use GridView rather then Listview like below

    GridView.builder(  
                  itemCount: item.length,  
                  gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(  
                      crossAxisCount: 3,  
                      crossAxisSpacing: 4.0, //Adjust spacing as per yours 
                      mainAxisSpacing: 4.0  
                  ),  
                  itemBuilder: (BuildContext context, int index){  
                    return //Your Widget in which you want to display for //example Container();  
                  },  
                )),