mirror of
https://github.com/flutter/packages.git
synced 2025-06-27 13:19:06 +08:00
[two_dimensional_scrollables] Fix repaint boundary override in builder delegate (#4814)
Fixes https://github.com/flutter/flutter/issues/133582 This fixes a small bug where we accidentally overwrote the default of addRepaintBoundaries Because of this, I had to refactor a test here that used keys to identify children, but now that an additional render object widget is inserted through the RepaintBoundary, the look-ups broke.
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
## 0.0.2
|
||||
|
||||
* Fixes override of default TwoDimensionalChildBuilderDelegate.addRepaintBoundaries.
|
||||
|
||||
## 0.0.1+1
|
||||
|
||||
* Adds pub topics to package metadata.
|
||||
|
@ -124,7 +124,7 @@ class TableCellBuilderDelegate extends TwoDimensionalChildBuilderDelegate
|
||||
required int rowCount,
|
||||
int pinnedColumnCount = 0,
|
||||
int pinnedRowCount = 0,
|
||||
super.addRepaintBoundaries = false,
|
||||
super.addRepaintBoundaries,
|
||||
required TableViewCellBuilder cellBuilder,
|
||||
required TableSpanBuilder columnBuilder,
|
||||
required TableSpanBuilder rowBuilder,
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: two_dimensional_scrollables
|
||||
description: Widgets that scroll using the two dimensional scrolling foundation.
|
||||
version: 0.0.1+1
|
||||
version: 0.0.2
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/two_dimensional_scrollables
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+two_dimensional_scrollables%22+
|
||||
|
||||
|
@ -146,6 +146,17 @@ void main() {
|
||||
expect(delegate.maxXIndex, 4); // columns
|
||||
});
|
||||
|
||||
test('Respects super class default for addRepaintBoundaries', () {
|
||||
final TableCellBuilderDelegate delegate = TableCellBuilderDelegate(
|
||||
cellBuilder: (_, __) => cell,
|
||||
columnBuilder: (_) => span,
|
||||
rowBuilder: (_) => span,
|
||||
columnCount: 5,
|
||||
rowCount: 6,
|
||||
);
|
||||
expect(delegate.addRepaintBoundaries, isTrue);
|
||||
});
|
||||
|
||||
test('Notifies listeners & rebuilds', () {
|
||||
int notified = 0;
|
||||
TableCellBuilderDelegate oldDelegate;
|
||||
|
@ -287,24 +287,17 @@ void main() {
|
||||
expect(viewport.mainAxis, Axis.vertical);
|
||||
// first child
|
||||
TableVicinity vicinity = const TableVicinity(column: 0, row: 0);
|
||||
expect(
|
||||
parentDataOf(viewport.firstChild!).vicinity,
|
||||
vicinity,
|
||||
);
|
||||
TableViewParentData parentData = parentDataOf(
|
||||
tester.renderObject<RenderBox>(find.byKey(childKeys[vicinity]!)),
|
||||
viewport.firstChild!,
|
||||
);
|
||||
expect(parentData.vicinity, vicinity);
|
||||
expect(parentData.layoutOffset, Offset.zero);
|
||||
expect(parentData.isVisible, isTrue);
|
||||
// after first child
|
||||
vicinity = const TableVicinity(column: 1, row: 0);
|
||||
expect(
|
||||
parentDataOf(viewport.childAfter(viewport.firstChild!)!).vicinity,
|
||||
vicinity,
|
||||
);
|
||||
|
||||
parentData = parentDataOf(
|
||||
tester.renderObject<RenderBox>(find.byKey(childKeys[vicinity]!)),
|
||||
viewport.childAfter(viewport.firstChild!)!,
|
||||
);
|
||||
expect(parentData.vicinity, vicinity);
|
||||
expect(parentData.layoutOffset, const Offset(200, 0.0));
|
||||
@ -317,13 +310,7 @@ void main() {
|
||||
|
||||
// last child
|
||||
vicinity = const TableVicinity(column: 4, row: 4);
|
||||
expect(
|
||||
parentDataOf(viewport.lastChild!).vicinity,
|
||||
vicinity,
|
||||
);
|
||||
parentData = parentDataOf(
|
||||
tester.renderObject<RenderBox>(find.byKey(childKeys[vicinity]!)),
|
||||
);
|
||||
parentData = parentDataOf(viewport.lastChild!);
|
||||
expect(parentData.vicinity, vicinity);
|
||||
expect(parentData.layoutOffset, const Offset(800.0, 800.0));
|
||||
expect(parentData.isVisible, isFalse);
|
||||
@ -334,12 +321,8 @@ void main() {
|
||||
);
|
||||
// before last child
|
||||
vicinity = const TableVicinity(column: 3, row: 4);
|
||||
expect(
|
||||
parentDataOf(viewport.childBefore(viewport.lastChild!)!).vicinity,
|
||||
vicinity,
|
||||
);
|
||||
parentData = parentDataOf(
|
||||
tester.renderObject<RenderBox>(find.byKey(childKeys[vicinity]!)),
|
||||
viewport.childBefore(viewport.lastChild!)!,
|
||||
);
|
||||
expect(parentData.vicinity, vicinity);
|
||||
expect(parentData.layoutOffset, const Offset(600.0, 800.0));
|
||||
|
Reference in New Issue
Block a user