calculateTotalRequiredWidth<T> static method
double
calculateTotalRequiredWidth<T>(
- List<
TTableHeader< headers,T> > - bool selectable,
- bool expandable
Implementation
static double calculateTotalRequiredWidth<T>(List<TTableHeader<T>> headers, bool selectable, bool expandable) {
double totalWidth = 0;
// Add width for expand/select columns
if (expandable) totalWidth += 40;
if (selectable) totalWidth += 40;
for (final header in headers) {
if (header.maxWidth != null && header.maxWidth != double.infinity) {
totalWidth += header.maxWidth!;
} else if (header.minWidth != null && header.minWidth! > 0) {
totalWidth += header.minWidth!;
} else {
// For flex columns, assume a minimum reasonable width
totalWidth += 100; // Default minimum width for flex columns
}
}
// Add some padding for table margins/padding
totalWidth += 32; // Account for horizontal padding
return totalWidth;
}