I have a problem with flutter. I need to fill a DataTable in the height of screen.
I tried to add the dataTable inside a Flex widget, but I don't get changes.
When I set the heigh of the Container, that's work let me a white space at the button of the screen
Thank you! and i'm sorry for mi poor english
This my code:
products.addAll(Product.getExampleList());
var table =
Container(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child:SizedBox(
child:
Column(
children: <Widget>[
DataTable(
columns: <DataColumn>[
DataColumn(
label: Text("Código")
),
DataColumn(
label: Text("Precio"),
numeric: true,
),
DataColumn(
label: Text("Grupo")
),
DataColumn(
label: Text("Descripción")
),
],
rows:
products.map<DataRow>((Product element) {
return DataRow(
key: Key(element.idProduct.toString()),
cells: <DataCell>[
DataCell(Text(element.code)),
DataCell(Text("\$ " + element.price.toStringAsFixed(2))),
DataCell(Text(element.group)),
DataCell(Text(element.description))
],
);
}).toList()
),
],
)
),
),
);
return Container(
color: Colors.white24,
child:
Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(10),
child: Row(
children: <Widget>[
Text("Código: "),
Flexible(
child: TextField(
controller: tController,
decoration: InputDecoration(
hintText: "Ingrese Código"
) ,
),
),
RaisedButton(
onPressed: onPressedSearch,
child: Text("Buscar"),
)
],
),
),
Flex(
direction: Axis.vertical,
children: <Widget>[
table
],
),
],
)
);