buildTable method
Implementation
Widget buildTable(BuildContext context) {
return Theme(
data: Theme.of(context).copyWith(
scrollbarTheme: ScrollbarThemeData(
thickness: WidgetStateProperty.all(widget.scrollbarThickness),
radius: widget.scrollbarRadius,
thumbVisibility: WidgetStateProperty.all(true),
thumbColor: WidgetStatePropertyAll(
XfdnDesignSystem.settings.primaryColor.withOpacity(0.6))),
),
child: Scrollbar(
controller: scrollController,
child: SingleChildScrollView(
controller: scrollController,
scrollDirection: Axis.horizontal,
child: ConstrainedBox(
constraints: BoxConstraints(
minWidth: MediaQuery.of(context).size.width - 100,
),
child: DataTable(
dividerThickness: 0.1,
headingRowColor: WidgetStateProperty.all(
XfdnDesignSystem.settings.primaryColor.withAlpha(30),
),
dataRowColor: widget.dataRowColor ??
WidgetStateProperty.resolveWith(
(Set<WidgetState> states) {
if (states.contains(WidgetState.selected)) {
return XfdnDesignSystem.settings.primaryColor
.withOpacity(0.08);
}
return null;
},
),
showCheckboxColumn:
widget.showCheckboxColumn && hasSelectionFeature,
onSelectAll: hasSelectionFeature ? widget.onSelectAll : null,
dataRowMinHeight: widget.dataRowMinHeight,
dataRowMaxHeight: widget.dataRowMaxHeight,
showBottomBorder: widget.showBottomBorder,
sortColumnIndex: getSortColumnIndex(),
sortAscending: currentSort?.isAscending ?? true,
columns: buildColumns(context),
rows: buildRows(),
),
),
),
),
);
}