@@ -111,8 +111,11 @@ class TagflowTableBorder extends Equatable {
111111 right: BorderSide .lerp (a.right, b.right, t),
112112 top: BorderSide .lerp (a.top, b.top, t),
113113 bottom: BorderSide .lerp (a.bottom, b.bottom, t),
114- horizontalInside:
115- BorderSide .lerp (a.horizontalInside, b.horizontalInside, t),
114+ horizontalInside: BorderSide .lerp (
115+ a.horizontalInside,
116+ b.horizontalInside,
117+ t,
118+ ),
116119 verticalInside: BorderSide .lerp (a.verticalInside, b.verticalInside, t),
117120 );
118121 }
@@ -169,16 +172,8 @@ class TagflowTableBorder extends Equatable {
169172 if (treatFirstRowAsHeader && headerBackgroundColor != null && rows > 0 ) {
170173 // extending beyond the padding
171174 // TODO(devaryakjha): make this configurable
172- final headerRect = Rect .fromLTWH (
173- 0 ,
174- 0 ,
175- rect.width,
176- rowHeights[0 ],
177- );
178- canvas.drawRect (
179- headerRect,
180- Paint ()..color = headerBackgroundColor,
181- );
175+ final headerRect = Rect .fromLTWH (0 , 0 , rect.width, rowHeights[0 ]);
176+ canvas.drawRect (headerRect, Paint ()..color = headerBackgroundColor);
182177 }
183178
184179 // Paint outer borders
@@ -216,8 +211,10 @@ class TagflowTableBorder extends Equatable {
216211
217212 // Paint inner borders
218213 if (horizontalInside != BorderSide .none && rows > 1 ) {
219- _horizontalInsidePaint =
220- _getPaint (horizontalInside, _horizontalInsidePaint);
214+ _horizontalInsidePaint = _getPaint (
215+ horizontalInside,
216+ _horizontalInsidePaint,
217+ );
221218 var y = rowHeights[0 ];
222219 for (var i = 1 ; i < rows; i++ ) {
223220 // Find segments where we should draw the horizontal line
@@ -314,13 +311,13 @@ class TagflowTableBorder extends Equatable {
314311 @override
315312 // coverage:ignore-line
316313 List <Object ?> get props => [
317- left,
318- right,
319- top,
320- bottom,
321- horizontalInside,
322- verticalInside,
323- ];
314+ left,
315+ right,
316+ top,
317+ bottom,
318+ horizontalInside,
319+ verticalInside,
320+ ];
324321}
325322
326323class RenderTagflowTable extends RenderBox
@@ -410,9 +407,11 @@ class RenderTagflowTable extends RenderBox
410407
411408 // Calculate total spacing needed between columns
412409 final totalColumnSpacing = (_columnCount - 1 ) * _columnSpacing;
413-
414- // Calculate available width for columns after accounting for spacing and padding
415- final availableWidth = constraints.maxWidth - totalColumnSpacing - _padding.horizontal;
410+
411+ // Calculate available width for columns after accounting for
412+ // spacing and padding
413+ final availableWidth =
414+ constraints.maxWidth - totalColumnSpacing - _padding.horizontal;
416415
417416 // First pass: Calculate minimum and preferred column widths
418417 _columnWidths = List <double >.filled (_columnCount, 0 );
@@ -429,23 +428,29 @@ class RenderTagflowTable extends RenderBox
429428 // Update minimum widths
430429 for (var i = 0 ; i < childParentData.colSpan; i++ ) {
431430 final colIndex = childParentData.column + i;
432- _columnWidths[colIndex] = math.max (_columnWidths[colIndex], widthPerColumn);
433-
431+ _columnWidths[colIndex] = math.max (
432+ _columnWidths[colIndex],
433+ widthPerColumn,
434+ );
435+
434436 // Track how flexible each column is based on content
435437 final flexibility = (maxWidth - minWidth) / childParentData.colSpan;
436- columnFlexibility[colIndex] = math.max (columnFlexibility[colIndex], flexibility);
438+ columnFlexibility[colIndex] = math.max (
439+ columnFlexibility[colIndex],
440+ flexibility,
441+ );
437442 }
438443 }
439444 child = childParentData.nextSibling;
440445 }
441446
442447 // Calculate total current width and adjust if needed
443448 final totalColumnWidth = _columnWidths.reduce ((a, b) => a + b);
444-
449+
445450 if (totalColumnWidth > availableWidth) {
446451 // Need to shrink columns - distribute reduction proportionally
447452 final reduction = totalColumnWidth - availableWidth;
448-
453+
449454 // Calculate shrink factors based on current widths
450455 final totalWidth = _columnWidths.reduce ((a, b) => a + b);
451456 for (var i = 0 ; i < _columnCount; i++ ) {
@@ -490,9 +495,11 @@ class RenderTagflowTable extends RenderBox
490495 final childHeight =
491496 child.getMinIntrinsicHeight (cellWidth) / childParentData.rowSpan;
492497 for (var i = 0 ; i < childParentData.rowSpan; i++ ) {
493- _rowHeights[childParentData.row + i] =
494- _rowHeights[childParentData.row + i]
495- .clamp (childHeight, double .infinity);
498+ _rowHeights[childParentData.row +
499+ i] = _rowHeights[childParentData.row + i].clamp (
500+ childHeight,
501+ double .infinity,
502+ );
496503 }
497504 }
498505 child = childParentData.nextSibling;
@@ -556,11 +563,13 @@ class RenderTagflowTable extends RenderBox
556563 }
557564
558565 // Update final table size to include spacing
559- final tableWidth = _columnWidths.reduce ((a, b) => a + b) +
560- (_columnCount - 1 ) * _columnSpacing +
566+ final tableWidth =
567+ _columnWidths.reduce ((a, b) => a + b) +
568+ (_columnCount - 1 ) * _columnSpacing +
561569 _padding.horizontal;
562- final tableHeight = _rowHeights.reduce ((a, b) => a + b) +
563- (_rowCount - 1 ) * _rowSpacing +
570+ final tableHeight =
571+ _rowHeights.reduce ((a, b) => a + b) +
572+ (_rowCount - 1 ) * _rowSpacing +
564573 _padding.vertical;
565574
566575 size = constraints.constrain (Size (tableWidth, tableHeight));
@@ -571,12 +580,7 @@ class RenderTagflowTable extends RenderBox
571580 // First paint the table background and borders
572581 _border.paint (
573582 context.canvas,
574- Rect .fromLTWH (
575- offset.dx,
576- offset.dy,
577- size.width,
578- size.height,
579- ),
583+ Rect .fromLTWH (offset.dx, offset.dy, size.width, size.height),
580584 rows: _rowCount,
581585 columns: _columnCount,
582586 cellData: _buildCellDataGrid (),
@@ -732,13 +736,17 @@ class RenderTagflowTable extends RenderBox
732736 // Update minimum widths
733737 for (var i = 0 ; i < childParentData.colSpan; i++ ) {
734738 final colIndex = childParentData.column + i;
735- _columnWidths[colIndex] =
736- _columnWidths[colIndex].clamp (widthPerColumn, double .infinity);
739+ _columnWidths[colIndex] = _columnWidths[colIndex].clamp (
740+ widthPerColumn,
741+ double .infinity,
742+ );
737743
738744 // Track how flexible each column is based on content
739745 final flexibility = (maxWidth - minWidth) / childParentData.colSpan;
740- columnFlexibility[colIndex] =
741- math.max (columnFlexibility[colIndex], flexibility);
746+ columnFlexibility[colIndex] = math.max (
747+ columnFlexibility[colIndex],
748+ flexibility,
749+ );
742750 }
743751 }
744752 child = childParentData.nextSibling;
@@ -747,8 +755,10 @@ class RenderTagflowTable extends RenderBox
747755 // Calculate total minimum width and distribute extra space
748756 final totalMinWidth =
749757 _columnWidths.reduce ((a, b) => a + b) + _padding.horizontal;
750- final extraWidth =
751- (constraints.maxWidth - totalMinWidth).clamp (0.0 , double .infinity);
758+ final extraWidth = (constraints.maxWidth - totalMinWidth).clamp (
759+ 0.0 ,
760+ double .infinity,
761+ );
752762
753763 if (extraWidth > 0 ) {
754764 // Calculate total flexibility
@@ -782,16 +792,17 @@ class RenderTagflowTable extends RenderBox
782792 }
783793
784794 // Get the height needed for this width
785- final childHeight = child
795+ final childHeight =
796+ child
786797 .getDryLayout (BoxConstraints .tightFor (width: cellWidth))
787798 .height /
788799 childParentData.rowSpan;
789800 for (var i = 0 ; i < childParentData.rowSpan; i++ ) {
790- rowHeights[childParentData.row + i] =
791- rowHeights[childParentData.row + i]
792- .clamp (childHeight, double .infinity);
801+ rowHeights[childParentData.row + i] = rowHeights[childParentData.row +
802+ i]
803+ .clamp (childHeight, double .infinity);
793804 }
794- child = childParentData.nextSibling;
805+ child = childParentData.nextSibling;
795806 }
796807 child = childParentData.nextSibling;
797808 }
0 commit comments