Hi Nguyen,
Greetings from syncfusion.
SfDatagrid gets the height from the parent widget. If the parent widget or Sfdatagrid have infinite size (Width , Height), then the Datagrid will be rendered with the 300*300(width and height).
To overcome this issue, you can set the proper width and height to the Datagrid parent widget. So, please wrap the DataGrid inside the Container and set the height based on the rows count.
Please refer the following code snippet.
|
double defaultRowHeight = 49.0;
double defaultHeaderRowHeight = 56.0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Syncfusion Flutter DataGrid'),
),
body: Column(
children: [
Container(
height: employees.length * defaultRowHeight + defaultHeaderRowHeight,
child: _buildDataGrid()),
],
),
);
} |
Please let us know if you need further assistance.
Regards,
Renugadevi