@@ -806,7 +806,8 @@ class RenderTable extends RenderBox {
806
806
double ? _baselineDistance;
807
807
@override
808
808
double ? computeDistanceToActualBaseline (TextBaseline baseline) {
809
- // returns the baseline of the first cell that has a baseline in the first row
809
+ // returns the baseline offset of the cell in the first row with
810
+ // the lowest baseline, and uses `TableCellVerticalAlignment.baseline`.
810
811
assert (! debugNeedsLayout);
811
812
return _baselineDistance;
812
813
}
@@ -1026,6 +1027,36 @@ class RenderTable extends RenderBox {
1026
1027
return Rect .fromLTRB (0.0 , _rowTops[row], size.width, _rowTops[row + 1 ]);
1027
1028
}
1028
1029
1030
+ @override
1031
+ double ? computeDryBaseline (covariant BoxConstraints constraints, TextBaseline baseline) {
1032
+ if (rows * columns == 0 ) {
1033
+ return null ;
1034
+ }
1035
+ final List <double > widths = _computeColumnWidths (constraints);
1036
+ double ? baselineOffset;
1037
+ for (int col = 0 ; col < columns; col += 1 ) {
1038
+ final RenderBox ? child = _children[col];
1039
+ final BoxConstraints childConstraints = BoxConstraints .tightFor (width: widths[col]);
1040
+ if (child == null ) {
1041
+ continue ;
1042
+ }
1043
+ final TableCellParentData childParentData = child.parentData! as TableCellParentData ;
1044
+ final double ? childBaseline = switch (childParentData.verticalAlignment ?? defaultVerticalAlignment) {
1045
+ TableCellVerticalAlignment .baseline => child.getDryBaseline (childConstraints, baseline),
1046
+ TableCellVerticalAlignment .baseline ||
1047
+ TableCellVerticalAlignment .top ||
1048
+ TableCellVerticalAlignment .middle ||
1049
+ TableCellVerticalAlignment .bottom ||
1050
+ TableCellVerticalAlignment .fill ||
1051
+ TableCellVerticalAlignment .intrinsicHeight => null ,
1052
+ };
1053
+ if (childBaseline != null && (baselineOffset == null || baselineOffset < childBaseline)) {
1054
+ baselineOffset = childBaseline;
1055
+ }
1056
+ }
1057
+ return baselineOffset;
1058
+ }
1059
+
1029
1060
@override
1030
1061
@protected
1031
1062
Size computeDryLayout (covariant BoxConstraints constraints) {
0 commit comments