1. 15 Dec, 2023 1 commit
  2. 29 Nov, 2023 1 commit
    • Kate Lovett's avatar
      Update VelocityTracker (4) (#139166) · 8ba459ce
      Kate Lovett authored
      This updates the implementation to use the stopwatch from the Clock object and pipes it through to the TestWidgetsFlutterBinding so it will be kept in sync with FakeAsync.
      
      Relands https://github.com/flutter/flutter/pull/138843 attempted to reland https://github.com/flutter/flutter/pull/137381 which attempted to reland #132291
      Fixes https://github.com/flutter/flutter/issues/97761
      
      1. The original change was reverted due to flakiness it introduced in tests that use fling gestures.
        * Using a mocked clock through the test binding fixes this now
      2. It was reverted a second time because a change at tip of tree broke it, exposing memory leaks, but it was not rebased before landing. 
        * These leaks are now fixed
      3. It was reverted a third time, because we were so excellently quick to revert those other times, that we did not notice the broken benchmark that only runs in postsubmit.
        * The benchmark is now fixed
      8ba459ce
  3. 22 Nov, 2023 1 commit
  4. 21 Nov, 2023 1 commit
  5. 15 Nov, 2023 2 commits
  6. 19 Oct, 2023 1 commit
  7. 25 Sep, 2023 1 commit
    • Chip Weinberger's avatar
      [Velocity Tracker] Fix: Issue 97761: Flutter Scrolling does not match iOS;... · fffbbf27
      Chip Weinberger authored
      [Velocity Tracker] Fix: Issue 97761: Flutter Scrolling does not match iOS; inadvertent scrolling when user lifts up finger (#132291)
      
      ## Issue
      
      **Issue:** https://github.com/flutter/flutter/issues/97761
      
      https://github.com/flutter/flutter/assets/1863934/53c5e0df-b85a-483c-a17d-bddd18db3aa9
      
      ## The Cause:
      
      The bug is very simple to understand - `velocity_tracker.dart` **only adds new samples while your finger is moving**.
      
      **Therefore**, if you move your finger quickly & (important) stop suddenly with no extra movement, the last 3 samples will all be > 0 dy. Regardless of how long you wait, you will get movement when you lift up your finger.
      
      **Logs from velocity_tracker.dart:**
      Notice: all 3 `_previousVelocityAt` are `dy > 0` despite a 2 second delay since the last scroll
      ```
      // start moving finger
      flutter: addPosition dy:-464.0
      flutter: addPosition dy:-465.0
      flutter: addPosition dy:-466.0
      flutter: addPosition dy:-467.0
      flutter: addPosition dy:-468.0
      flutter: addPosition dy:-469.0
      flutter: addPosition dy:-470.0
      // stop moving finger here, keep it still for 2 seconds & lift it up
      flutter: _previousVelocityAt(-2) samples(-467.0, -468.0)) dy:-176.772140710624
      flutter: _previousVelocityAt(-1) samples(-468.0, -469.0)) dy:-375.0937734433609
      flutter: _previousVelocityAt(0) samples(-469.0, -470.0)) dy:-175.71604287471447
      flutter: primaryVelocity DragEndDetails(Velocity(0.0, -305.5)).primaryVelocity
      flutter: createBallisticSimulation pixels 464.16666666666663 velocity 305.4699824197211
      ```
      
      ## The Fix
      
      **There are 3 options to fix it:**
      A. sample uniformly *per unit time* (a larger more risky change, hurts battery life)
      B. consider elapsed time since the last sample. If greater than X, assume no more velocity. (easy & just as valid)
      C. similar to B, but instead add "ghost samples" of velocity zero, and run calculations as normal (a bit tricker, of dubious benefit imo)
      
      **For Option B I considered two approaches:**
      1. _get the current timestamp and compare to event timestamp._  This is tricky because events are documented to use an arbitrary timescale & I wasn't able to find the code that generates the timestamps. This approach could be considered more.
      2. _get a new timestamp using Stopwatch and compare now vs when the last sample was added._ This is the solution implemented here.  There is a limitation in that we don't know when addSamples is called relative to the event. But, this estimation is already on a very low latency path & still it gives us a *minimum* time bound which is sufficient for comparison. 
      
      **This PR chooses the simplest of the all solutions. Please try it our yourself, it completely solves the problem 😀** Option _B.1_ would be a nice alternative as well, if we can define and access the same timesource as the pointer tracker in a maintainable simple way.
      
      ## After Fix
      
      https://github.com/flutter/flutter/assets/1863934/be50d8e7-d5da-495a-a4af-c71bc541cbe3
      fffbbf27
  8. 27 Mar, 2023 1 commit
  9. 20 Jan, 2023 1 commit
  10. 25 May, 2022 1 commit
    • Pierre-Louis's avatar
      Use `curly_braces_in_flow_control_structures` for `foundation`, `gestures`,... · 9cc72df7
      Pierre-Louis authored
      Use `curly_braces_in_flow_control_structures` for `foundation`, `gestures`, `painting`, `physics` (#104610)
      
      * Use `curly_braces_in_flow_control_structures` for `foundation`
      
      * Use `curly_braces_in_flow_control_structures` for `gestures`
      
      * Use `curly_braces_in_flow_control_structures` for `painting`
      
      * Use `curly_braces_in_flow_control_structures` for `physics`
      
      * fix comments
      
      * remove trailing space
      
      * fix TODO style
      9cc72df7
  11. 05 Oct, 2020 1 commit
  12. 17 Sep, 2020 1 commit
    • Jonah Williams's avatar
      Deprecate VelocityTracker default constructor and added... · b1d17c91
      Jonah Williams authored
      Deprecate VelocityTracker default constructor and added VelocityTracker.withKind constructor (#66043)
      
      We've gotten feedback that the VelocityTracker change was disruptive, though it did not break any of the flutter framework or customer tests. In order to make the change non-breaking, PointerDeviceKind parameter can be made optional.
      
      Nevertheless, this parameter should be provided so that the existing touch handlers can use more accurate gestures on mouse/stylus inputs, so we can encourage this by deprecating the default constructor and pointing users towards the VelocityTracker.withKind constructor that takes a non-optional parameter
      b1d17c91
  13. 08 Sep, 2020 1 commit
    • Jonah Williams's avatar
      [framework] make hit slop based on device pointer kind for drag/pan/scale gestures (#64267) · 29898812
      Jonah Williams authored
      Currently the framework uses fairly large "hit slop" values to disambiguate taps from drags/pans. This makes sense on touch devices where the interaction is not very precise, on mice however it can feel as if the UI is lagging. This is immediately noticeable on our infra dashboard, where it takes almost half of a grid square of drag before the actual drag kicks in.
      
      One potential solution is to always use smaller constants depending on whether the interaction is mouse or touch based. The only reasonable choice is to use the pointer device kind and not target platform - same platform can have different input sources. This requires exposing the pointer device kind in a few new places in several of the gesture detectors, and using the enum to compute the correct hit slop from an expanded set of constants.
      
      This almost works, however there are a few places (notably ListViews) which uses the touch hit slop as a default value in scroll physics. It does not seem like it will be easy to disambiguate a user provided scroll physics constant from the default and/or adjust it somehow - this might require significant changes to scroll physics which I have left out of this PR.
      
      This PR does not adjust:
      
      kTouchSlop used in scroll_physics.dart's minFlingDistance
      kTouchSlop used in PrimaryPointerGestureRecognizer/LongPressGestureRecognizer
      29898812
  14. 12 Aug, 2020 1 commit
  15. 11 Jun, 2020 1 commit
  16. 07 Jan, 2020 1 commit
  17. 27 Nov, 2019 1 commit
    • Ian Hickson's avatar
      License update (#45373) · 449f4a66
      Ian Hickson authored
      * Update project.pbxproj files to say Flutter rather than Chromium
      
      Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright.
      
      * Update the copyright notice checker to require a standard notice on all files
      
      * Update copyrights on Dart files. (This was a mechanical commit.)
      
      * Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine.
      
      Some were already marked "The Flutter Authors", not clear why. Their
      dates have been normalized. Some were missing the blank line after the
      license. Some were randomly different in trivial ways for no apparent
      reason (e.g. missing the trailing period).
      
      * Clean up the copyrights in non-Dart files. (Manual edits.)
      
      Also, make sure templates don't have copyrights.
      
      * Fix some more ORGANIZATIONNAMEs
      449f4a66
  18. 12 Sep, 2018 1 commit
  19. 02 Aug, 2018 1 commit
  20. 27 Jul, 2018 1 commit
  21. 23 Jul, 2018 1 commit
  22. 16 Jul, 2018 2 commits
  23. 01 Feb, 2018 1 commit
  24. 25 Apr, 2017 1 commit
  25. 04 Mar, 2017 1 commit
  26. 17 Jan, 2017 1 commit
  27. 09 Dec, 2016 1 commit
  28. 18 Aug, 2016 1 commit
  29. 27 Jun, 2016 1 commit
  30. 14 Feb, 2016 1 commit
    • Adam Barth's avatar
      Add a Velocity class to be explicit about units · 4fb47600
      Adam Barth authored
      We were using an Offset, which represented pixels/second, but it wasn't
      clear to clients whether that was pixels/ms. Now we use a Velocity class
      that is explict about the units.
      
      Fixes #1510
      Fixes #785
      4fb47600
  31. 16 Dec, 2015 1 commit
  32. 14 Dec, 2015 1 commit
  33. 05 Dec, 2015 1 commit
    • Ian Hickson's avatar
      PointerInput refactor · f1625556
      Ian Hickson authored
      Instead of PointerInputEvent having a "type" field, we now have a
      different class for each pointer type.
      
      This has ripple effects throughout the system.
      
      I also did code cleanup in affected files while I was there.
      f1625556
  34. 17 Nov, 2015 1 commit
  35. 02 Nov, 2015 1 commit