Fix a _WrappedScrollBehavior.shouldNotify bug (#103267)

This commit is contained in:
xubaolin
2022-05-08 02:44:08 +08:00
committed by GitHub
parent c6ced845e3
commit 4bed76757d
2 changed files with 9 additions and 1 deletions

View File

@@ -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);
}

View File

@@ -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;