-
Notifications
You must be signed in to change notification settings - Fork 27.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed 33347 fill the gap during performLayout in SliverGrid and Slive… #33467
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cirrus seems to be unhappy.
Implementation looks good to me with some nits in the tests.
Text('item1', key: Key('1')), | ||
] | ||
)); | ||
expect(find.text('item0'), findsOneWidget); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also assert that the children are in the right position after the re-arrange?
Text('item2', key: Key('2')), | ||
] | ||
)); | ||
expect(find.text('item0'), findsOneWidget); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
}, | ||
); | ||
|
||
testWidgets('SliverGrid Correctly layout children after rearranging', (WidgetTester tester) async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SliverGrid -> SliverFixedExtentList ?
) | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a line break at the end of files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once cirrus is happy.
…rFixedExtentList
Description
Rearrange sliver children will result in gap in the middle of children list, those gap supposed be filled out during the perform layout. SliverList does fill out the gap while SliverGrid and SliverFixExtentList does not which cause crashes. This PR fixes it
Related Issues
#33347
Tests
I added the following tests:
https://github.com/chunhtai/flutter/blob/1f7ee0e65b86eda45b39a7fd8a3a0908793c337d/packages/flutter/test/widgets/slivers_test.dart#L199
https://github.com/chunhtai/flutter/blob/1f7ee0e65b86eda45b39a7fd8a3a0908793c337d/packages/flutter/test/widgets/slivers_test.dart#L221
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?