Commit a5dd074b authored by champeauxr's avatar champeauxr Committed by Dan Field

Fixed Table flex column layout error #30437 (#30470)

RenderTable._computeColumnWidths() had a logic error that caused flex columns to be collapsed to their minimum widths in certain situations dependent on the layout width constraint and the number of flex columns.
parent 054e8870
......@@ -958,8 +958,8 @@ class RenderTable extends RenderBox {
deficit -= widths[x] - minWidths[x];
widths[x] = minWidths[x];
} else {
deficit -= availableDelta;
widths[x] -= availableDelta;
deficit -= delta;
widths[x] -= delta;
newAvailableColumns += 1;
}
}
......
......@@ -47,6 +47,19 @@ void main() {
expect(table.size, equals(const Size(0.0, 0.0)));
});
test('Table control test: constrained flex columns', () {
final RenderTable table = RenderTable(textDirection: TextDirection.ltr);
final List<RenderBox> children = List<RenderBox>.generate(6, (_) => RenderPositionedBox());
table.setFlatChildren(6, children);
layout(table, constraints: const BoxConstraints.tightFor(width: 100.0));
const double expectedWidth = 100.0 / 6;
for (RenderBox child in children) {
expect(child.size.width, moreOrLessEquals(expectedWidth));
}
});
test('Table test: combinations', () {
RenderTable table;
layout(RenderPositionedBox(child: table = RenderTable(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment