Fix DraggableScrollableSheet and ListView has tiny scroll of one pixel (#109081)

This commit is contained in:
xubaolin 2022-08-10 02:15:07 +08:00 committed by GitHub
parent e527dcea4a
commit c262126c41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 15 deletions

View File

@ -538,8 +538,6 @@ class _DraggableSheetExtent {
double get currentSize => _currentSize.value; double get currentSize => _currentSize.value;
double get currentPixels => sizeToPixels(_currentSize.value); double get currentPixels => sizeToPixels(_currentSize.value);
double get additionalMinSize => isAtMin ? 0.0 : 1.0;
double get additionalMaxSize => isAtMax ? 0.0 : 1.0;
List<double> get pixelSnapSizes => snapSizes.map(sizeToPixels).toList(); List<double> get pixelSnapSizes => snapSizes.map(sizeToPixels).toList();
/// Start an activity that affects the sheet and register a cancel call back /// Start an activity that affects the sheet and register a cancel call back
@ -795,7 +793,7 @@ class _DraggableScrollableSheetScrollController extends ScrollController {
ScrollPosition? oldPosition, ScrollPosition? oldPosition,
) { ) {
return _DraggableScrollableSheetScrollPosition( return _DraggableScrollableSheetScrollPosition(
physics: physics, physics: const AlwaysScrollableScrollPhysics().applyTo(physics),
context: context, context: context,
oldPosition: oldPosition, oldPosition: oldPosition,
getExtent: () => extent, getExtent: () => extent,
@ -887,17 +885,6 @@ class _DraggableScrollableSheetScrollPosition extends ScrollPositionWithSingleCo
super.beginActivity(newActivity); super.beginActivity(newActivity);
} }
@override
bool applyContentDimensions(double minScrollSize, double maxScrollSize) {
// We need to provide some extra size if we haven't yet reached the max or
// min sizes. Otherwise, a list with fewer children than the size of
// the available space will get stuck.
return super.applyContentDimensions(
minScrollSize - extent.additionalMinSize,
maxScrollSize + extent.additionalMaxSize,
);
}
@override @override
void applyUserOffset(double delta) { void applyUserOffset(double delta) {
if (!listShouldScroll && if (!listShouldScroll &&

View File

@ -879,7 +879,6 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling], flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling],
actions: <SemanticsAction>[SemanticsAction.scrollDown, SemanticsAction.scrollUp],
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
label: 'BottomSheet', label: 'BottomSheet',