buildDataRow method
DataRow
buildDataRow(
- BuildContext context,
- int idx,
- List<
Map> selectionList, - bool multiSelect,
- Function? selectFunction,
- StateSetter setState,
Implementation
DataRow buildDataRow(BuildContext context, int idx, List<Map> selectionList,
bool multiSelect, Function? selectFunction, StateSetter setState) {
final entry = mutable.lastState.fullData[idx];
final rowColor = tryParseColor(props["rowColor"]);
final rowOddColor = tryParseColor(props["rowOddColor"]) ?? rowColor;
final color = idx.isEven ? rowColor : rowOddColor;
return DataRow(
color: color != null
? WidgetStateColor.resolveWith((states) => color)
: null,
selected: selectionList.contains(entry),
cells: buildDataCells(context, idx),
onSelectChanged: (val) => setState(() {
if (!multiSelect) {
selectionList.clear();
}
if (val == true) {
selectionList.add(entry);
} else {
selectionList.remove(entry);
}
if (selectFunction != null) {
selectFunction(entry);
}
}),
);
}