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.
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user