diff --git a/packages/flutter/lib/src/widgets/scroll_configuration.dart b/packages/flutter/lib/src/widgets/scroll_configuration.dart index fdb1b61359..46fc042f9d 100644 --- a/packages/flutter/lib/src/widgets/scroll_configuration.dart +++ b/packages/flutter/lib/src/widgets/scroll_configuration.dart @@ -348,7 +348,7 @@ class _WrappedScrollBehavior implements ScrollBehavior { || oldDelegate.overscroll != overscroll || oldDelegate.physics != physics || oldDelegate.platform != platform - || setEquals(oldDelegate.dragDevices, dragDevices) + || !setEquals(oldDelegate.dragDevices, dragDevices) || delegate.shouldNotify(oldDelegate.delegate); } diff --git a/packages/flutter/test/widgets/scroll_behavior_test.dart b/packages/flutter/test/widgets/scroll_behavior_test.dart index b45583b6fc..a6cbd6428e 100644 --- a/packages/flutter/test/widgets/scroll_behavior_test.dart +++ b/packages/flutter/test/widgets/scroll_behavior_test.dart @@ -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;