Skip to content

Commit

Permalink
[two_dimensional_scrollables] Expose addAutomaticKeepAlives in Table …
Browse files Browse the repository at this point in the history
…delegates (#5597)

Fixes flutter/flutter#133583

This was waiting on the stable release that add keep alive support. Now it is available in the tableView delegates.
  • Loading branch information
Piinks authored Dec 7, 2023
1 parent 073bea4 commit 0b78be3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/two_dimensional_scrollables/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.0.5

* Exposes addAutomaticKeepAlives in TableCellBuilderDelegate and TableCellListDelegate
* Fixes bug where having one reversed axis caused incorrect painting of a pinned row.
* Adds support for BorderRadius in TableSpanDecorations.

Expand Down
4 changes: 2 additions & 2 deletions packages/two_dimensional_scrollables/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ publish_to: 'none'
version: 1.0.0+1

environment:
sdk: '>=3.1.0 <4.0.0'
flutter: ">=3.13.0"
sdk: '>=3.2.0 <4.0.0'
flutter: ">=3.16.0"

dependencies:
flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class TableCellBuilderDelegate extends TwoDimensionalChildBuilderDelegate
int pinnedColumnCount = 0,
int pinnedRowCount = 0,
super.addRepaintBoundaries,
super.addAutomaticKeepAlives,
required TableViewCellBuilder cellBuilder,
required TableSpanBuilder columnBuilder,
required TableSpanBuilder rowBuilder,
Expand Down Expand Up @@ -219,6 +220,7 @@ class TableCellListDelegate extends TwoDimensionalChildListDelegate
int pinnedColumnCount = 0,
int pinnedRowCount = 0,
super.addRepaintBoundaries,
super.addAutomaticKeepAlives,
required List<List<Widget>> cells,
required TableSpanBuilder columnBuilder,
required TableSpanBuilder rowBuilder,
Expand Down
6 changes: 3 additions & 3 deletions packages/two_dimensional_scrollables/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: two_dimensional_scrollables
description: Widgets that scroll using the two dimensional scrolling foundation.
version: 0.0.4
version: 0.0.5
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+

environment:
sdk: '>=3.1.0 <4.0.0'
flutter: ">=3.13.0"
sdk: '>=3.2.0 <4.0.0'
flutter: ">=3.16.0"

dependencies:
flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ const Widget cell = SizedBox.shrink();

void main() {
group('TableCellBuilderDelegate', () {
test('exposes addAutomaticKeepAlives from super class', () {
final TableCellBuilderDelegate delegate = TableCellBuilderDelegate(
cellBuilder: (_, __) => cell,
columnBuilder: (_) => span,
rowBuilder: (_) => span,
columnCount: 5,
rowCount: 6,
addAutomaticKeepAlives: false,
);
expect(delegate.addAutomaticKeepAlives, isFalse);
});

test('asserts valid counts for rows and columns', () {
TableCellBuilderDelegate? delegate;
expect(
Expand Down Expand Up @@ -205,6 +217,16 @@ void main() {
});

group('TableCellListDelegate', () {
test('exposes addAutomaticKeepAlives from super class', () {
final TableCellListDelegate delegate = TableCellListDelegate(
cells: <List<Widget>>[<Widget>[]],
columnBuilder: (_) => span,
rowBuilder: (_) => span,
addAutomaticKeepAlives: false,
);
expect(delegate.addAutomaticKeepAlives, isFalse);
});

test('asserts valid counts for rows and columns', () {
TableCellListDelegate? delegate;
expect(
Expand Down

0 comments on commit 0b78be3

Please sign in to comment.