I have a DataTable where I need to edit quantities. I am detecting which row was selected with the code below which works fine but I'd like to hide the CheckBox Column
Any suggestion on how to keep the current behaviour without the checkbox column?
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Sample",
style: TextStyle(color: Colors.white),
),
body: Column(children: <Widget>[
DataTable(
sortAscending: true,
columns: <DataColumn>[
DataColumn(
label: Text('Product name'),
),
DataColumn(
label: Text('Product Quantity'),
),
],
rows: items
.map(
(itemRow) => DataRow(
onSelectChanged: (bool selected) {
if (selected) {
//'row-selected: ${itemRow.index}'
}
},
cells: [
DataCell(
Text(itemRow.itemName),
showEditIcon: false,
placeholder: false,
),
DataCell(
Text(itemRow.itemQuantity),
showEditIcon: true,
placeholder: false,
//onTap: _getSelectedRowInfo,
),
],
),
)
.toList(),
)
]),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: Text('Home'),
),
],
currentIndex: _selectedIndex,
selectedItemColor: Colors.amber[800],
onTap: _onItemTapped,
));
}
}