0

This is my code. Here, I have used Listview.builder due to which whole data is displayed in 1 tablecell. What should I use at place of listview to display the data properly in different cells. Or Any other way to display data dynamically from backend?

TableRow(children: [

              TableCell(
                child: FutureBuilder(
                  future: fetchProducts(),
                  builder: (context, snapshot){
                    if(snapshot.hasData) {
                      return ListView.builder(
                        itemCount: snapshot.data.length,
                        shrinkWrap: true,
                        itemBuilder: (BuildContext context, index){
                          Products product = snapshot.data[index];
                          return Text(//"Name      :- "
                    '${product.pname}', style: TextStyle(fontSize: 15));    
                  });
                }},
              )),]),

1 Answers1

0

In place of tablerow use DataTable, it will automatically size itself, it has column and row children so its probably the best way to display your data, check this youtube vide out https://www.youtube.com/watch?v=ktTajqbhIcY&vl=en

Ferdinand
  • 513
  • 1
  • 3
  • 9