mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make updateUserScrollDirection protected (#13850)
This commit is contained in:
parent
61a8132ea9
commit
ce83f4fbe2
@ -165,7 +165,7 @@ class ScrollPositionWithSingleContext extends ScrollPosition implements ScrollAc
|
||||
/// Set [userScrollDirection] to the given value.
|
||||
///
|
||||
/// If this changes the value, then a [UserScrollNotification] is dispatched.
|
||||
@visibleForTesting
|
||||
@protected
|
||||
void updateUserScrollDirection(ScrollDirection value) {
|
||||
assert(value != null);
|
||||
if (userScrollDirection == value)
|
||||
|
||||
@ -178,6 +178,10 @@ class LinkedScrollPosition extends ScrollPositionWithSingleContext {
|
||||
assert(localOverscroll == 0.0 || (beforeOverscroll == 0.0 && afterOverscroll == 0.0));
|
||||
}
|
||||
|
||||
void _userMoved(ScrollDirection direction) {
|
||||
updateUserScrollDirection(direction);
|
||||
}
|
||||
|
||||
LinkedScrollActivity link(LinkedScrollPosition driver) {
|
||||
if (this.activity is! LinkedScrollActivity)
|
||||
beginActivity(new LinkedScrollActivity(this));
|
||||
@ -239,7 +243,7 @@ class LinkedScrollActivity extends ScrollActivity {
|
||||
if (driver.userScrollDirection != commonDirection)
|
||||
commonDirection = ScrollDirection.idle;
|
||||
}
|
||||
delegate.updateUserScrollDirection(commonDirection);
|
||||
delegate._userMoved(commonDirection);
|
||||
return delegate.setPixels(delegate.pixels + delta);
|
||||
}
|
||||
|
||||
|
||||
@ -187,7 +187,7 @@ void main() {
|
||||
verifyPaintPosition(key3, const Offset(0.0, 0.0), true);
|
||||
|
||||
position.animateTo(bigHeight + delegate.maxExtent * 1.9, curve: Curves.linear, duration: const Duration(minutes: 1));
|
||||
position.updateUserScrollDirection(ScrollDirection.forward);
|
||||
position.updateUserScrollDirection(ScrollDirection.forward); // ignore: invalid_use_of_protected_member
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 1000));
|
||||
verifyPaintPosition(key1, const Offset(0.0, 0.0), false);
|
||||
verifyPaintPosition(key2, const Offset(0.0, 0.0), true);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user