opt fab anim

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-07-22 14:25:52 +08:00
parent be07cafb54
commit 7d4afc15d3
3 changed files with 21 additions and 2 deletions

View File

@@ -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" {

View File

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