Skip to content

Commit

Permalink
Fix a _WrappedScrollBehavior.shouldNotify bug (#103267)
Browse files Browse the repository at this point in the history
  • Loading branch information
xu-baolin authored May 7, 2022
1 parent c6ced84 commit 4bed767
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/widgets/scroll_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ class _WrappedScrollBehavior implements ScrollBehavior {
|| oldDelegate.overscroll != overscroll
|| oldDelegate.physics != physics
|| oldDelegate.platform != platform
|| setEquals<PointerDeviceKind>(oldDelegate.dragDevices, dragDevices)
|| !setEquals<PointerDeviceKind>(oldDelegate.dragDevices, dragDevices)
|| delegate.shouldNotify(oldDelegate.delegate);
}

Expand Down
8 changes: 8 additions & 0 deletions packages/flutter/test/widgets/scroll_behavior_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ class TestScrollBehavior extends ScrollBehavior {
}

void main() {
// Regression test for https://github.com/flutter/flutter/issues/89681
testWidgets('_WrappedScrollBehavior shouldNotify test', (WidgetTester tester) async {
final ScrollBehavior behavior1 = const ScrollBehavior().copyWith();
final ScrollBehavior behavior2 = const ScrollBehavior().copyWith();

expect(behavior1.shouldNotify(behavior2), false);
});

testWidgets('Inherited ScrollConfiguration changed', (WidgetTester tester) async {
final GlobalKey key = GlobalKey(debugLabel: 'scrollable');
TestScrollBehavior? behavior;
Expand Down

0 comments on commit 4bed767

Please sign in to comment.