Skip to content

Commit

Permalink
Reverts "Implement computeDryBaseline for RenderWrap (#146260)" (#1…
Browse files Browse the repository at this point in the history
…47692)

Reverts: flutter/flutter#146260
Initiated by: chingjun
Reason for reverting: Broke internal tests. See b/338308016
Original PR Author: LongCatIsLooong

Reviewed By: {goderbauer}

This change reverts the following previous change:
  • Loading branch information
auto-submit[bot] authored May 2, 2024
1 parent 8025af0 commit 706f39b
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 238 deletions.
33 changes: 1 addition & 32 deletions packages/flutter/lib/src/rendering/table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,7 @@ class RenderTable extends RenderBox {
double? _baselineDistance;
@override
double? computeDistanceToActualBaseline(TextBaseline baseline) {
// returns the baseline offset of the cell in the first row with
// the lowest baseline, and uses `TableCellVerticalAlignment.baseline`.
// returns the baseline of the first cell that has a baseline in the first row
assert(!debugNeedsLayout);
return _baselineDistance;
}
Expand Down Expand Up @@ -1027,36 +1026,6 @@ class RenderTable extends RenderBox {
return Rect.fromLTRB(0.0, _rowTops[row], size.width, _rowTops[row + 1]);
}

@override
double? computeDryBaseline(covariant BoxConstraints constraints, TextBaseline baseline) {
if (rows * columns == 0) {
return null;
}
final List<double> widths = _computeColumnWidths(constraints);
double? baselineOffset;
for (int col = 0; col < columns; col += 1) {
final RenderBox? child = _children[col];
final BoxConstraints childConstraints = BoxConstraints.tightFor(width: widths[col]);
if (child == null) {
continue;
}
final TableCellParentData childParentData = child.parentData! as TableCellParentData;
final double? childBaseline = switch (childParentData.verticalAlignment ?? defaultVerticalAlignment) {
TableCellVerticalAlignment.baseline => child.getDryBaseline(childConstraints, baseline),
TableCellVerticalAlignment.baseline ||
TableCellVerticalAlignment.top ||
TableCellVerticalAlignment.middle ||
TableCellVerticalAlignment.bottom ||
TableCellVerticalAlignment.fill ||
TableCellVerticalAlignment.intrinsicHeight => null,
};
if (childBaseline != null && (baselineOffset == null || baselineOffset < childBaseline)) {
baselineOffset = childBaseline;
}
}
return baselineOffset;
}

@override
@protected
Size computeDryLayout(covariant BoxConstraints constraints) {
Expand Down
Loading

0 comments on commit 706f39b

Please sign in to comment.