@@ -801,15 +801,41 @@ class RenderTableViewport extends RenderTwoDimensionalViewport {
801
801
// | <--------- extent of merged cell ---------> |
802
802
803
803
// Compute height and layout offset for merged rows.
804
- mergedRowOffset = - verticalOffset.pixels +
804
+ final bool rowIsInPinnedColumn = _lastPinnedColumn != null &&
805
+ vicinity.column <= _lastPinnedColumn! ;
806
+ final bool rowIsPinned =
807
+ _lastPinnedRow != null && firstRow <= _lastPinnedRow! ;
808
+ final double baseRowOffset =
809
+ switch ((rowIsInPinnedColumn, rowIsPinned)) {
810
+ // Both row and column are pinned at this cell, or just pinned row.
811
+ (true , true ) || (false , true ) => 0.0 ,
812
+ // Cell is within a pinned column
813
+ (true , false ) => _pinnedRowsExtent - verticalOffset.pixels,
814
+ // Cell is within a pinned row, or no pinned portion.
815
+ (false , false ) => - verticalOffset.pixels,
816
+ };
817
+ mergedRowOffset = baseRowOffset +
805
818
_rowMetrics[firstRow]! .leadingOffset +
806
819
_rowMetrics[firstRow]! .configuration.padding.leading;
807
820
mergedRowHeight = _rowMetrics[lastRow]! .trailingOffset -
808
821
_rowMetrics[firstRow]! .leadingOffset -
809
822
_rowMetrics[lastRow]! .configuration.padding.trailing -
810
823
_rowMetrics[firstRow]! .configuration.padding.leading;
811
824
// Compute width and layout offset for merged columns.
812
- mergedColumnOffset = - horizontalOffset.pixels +
825
+ final bool columnIsInPinnedRow =
826
+ _lastPinnedRow != null && vicinity.row <= _lastPinnedRow! ;
827
+ final bool columnIsPinned =
828
+ _lastPinnedColumn != null && firstColumn <= _lastPinnedColumn! ;
829
+ final double baseColumnOffset =
830
+ switch ((columnIsInPinnedRow, columnIsPinned)) {
831
+ // Both row and column are pinned at this cell, or just pinned column.
832
+ (true , true ) || (false , true ) => 0.0 ,
833
+ // Cell is within a pinned row.
834
+ (true , false ) => _pinnedColumnsExtent - horizontalOffset.pixels,
835
+ // No pinned portion.
836
+ (false , false ) => - horizontalOffset.pixels,
837
+ };
838
+ mergedColumnOffset = baseColumnOffset +
813
839
_columnMetrics[firstColumn]! .leadingOffset +
814
840
_columnMetrics[firstColumn]! .configuration.padding.leading;
815
841
mergedColumnWidth = _columnMetrics[lastColumn]! .trailingOffset -
0 commit comments