From 7d4afc15d3a3996cc0ccccc170535ec635bccd3c Mon Sep 17 00:00:00 2001 From: dom Date: Wed, 22 Jul 2026 14:25:52 +0800 Subject: [PATCH] opt fab anim Signed-off-by: dom --- lib/scripts/patch.ps1 | 4 +++- lib/scripts/scroll_position.patch | 17 +++++++++++++++++ pubspec.lock | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 lib/scripts/scroll_position.patch diff --git a/lib/scripts/patch.ps1 b/lib/scripts/patch.ps1 index 8afdfa5e3..0dd44b613 100644 --- a/lib/scripts/patch.ps1 +++ b/lib/scripts/patch.ps1 @@ -43,6 +43,8 @@ $EditableTextPatch = "lib/scripts/editable_text.patch" $TextFieldPatch = "lib/scripts/text_field.patch" +$ScrollPositionPatch = "lib/scripts/scroll_position.patch" + # TODO: remove # https://github.com/flutter/flutter/pull/183261 $SelectableRegionPatch = "lib/scripts/null_safety_for_selectable_region.patch" @@ -75,7 +77,7 @@ $reverts = @() $patches = @($ModalBarrierPatch, $TextSelectionPatch, $MouseCursorPatch, $ImageAnimPatch, $LayoutBuilderPatch, $NavigationDrawerPatch, $PopupMenuPatch, $FABPatch, $SelectableRegionPatch, $SelectableRegionSelectionPatch, - $EditableTextPatch, $TextFieldPatch) + $EditableTextPatch, $TextFieldPatch, $ScrollPositionPatch) switch ($platform.ToLower()) { "android" { diff --git a/lib/scripts/scroll_position.patch b/lib/scripts/scroll_position.patch new file mode 100644 index 000000000..ab2a34d1a --- /dev/null +++ b/lib/scripts/scroll_position.patch @@ -0,0 +1,17 @@ +diff --git a/packages/flutter/lib/src/widgets/scroll_position_with_single_context.dart b/packages/flutter/lib/src/widgets/scroll_position_with_single_context.dart +index 96d77f67008..533fa0eecaf 100644 +--- a/packages/flutter/lib/src/widgets/scroll_position_with_single_context.dart ++++ b/packages/flutter/lib/src/widgets/scroll_position_with_single_context.dart +@@ -127,8 +127,10 @@ class ScrollPositionWithSingleContext extends ScrollPosition implements ScrollAc + + @override + void applyUserOffset(double delta) { +- updateUserScrollDirection(delta > 0.0 ? ScrollDirection.forward : ScrollDirection.reverse); +- setPixels(pixels - physics.applyPhysicsToUserOffset(this, delta)); ++ final newPixels = pixels - physics.applyPhysicsToUserOffset(this, delta); ++ if (newPixels != setPixels(newPixels) || _userScrollDirection == ScrollDirection.idle) { ++ updateUserScrollDirection(delta > 0.0 ? ScrollDirection.forward : ScrollDirection.reverse); ++ } + } + + @override diff --git a/pubspec.lock b/pubspec.lock index 3151ee9fe..1a45d520c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -477,7 +477,7 @@ packages: description: path: "." ref: dev - resolved-ref: "7cd9461210185bd9e67368b8081195384dc8b919" + resolved-ref: de88c222852c33b3203b868794ac45734c8bcec2 url: "https://github.com/bggRGjQaUbCoE/extended_nested_scroll_view.git" source: git version: "6.2.1"