1. 20 Dec, 2023 1 commit
    • LongCatIsLooong's avatar
      Make `TextSpan` hit testing precise. (#139717) · ea5b9728
      LongCatIsLooong authored
      Fixes https://github.com/flutter/flutter/issues/131435, #104594, #43400
      Needs https://github.com/flutter/engine/pull/48774 (to fix the web test failure).
      
      Currently the method we use for text span hit testing `TextPainter.getPositionForOffset` always returns the closest `TextPosition`, even when the given offset is far away from the text. 
      
      The new TextPaintes method tells you the layout bounds (`width =  letterspacing / 2 + x_advance + letterspacing / 2`, `height = font ascent + font descent`) of a character, the PR changes the hit testing implementation such that a TextSpan is only considered hit if the point-down event landed in one of it's character's layout bounds.
      
      Potential issues:
      
      1. In theory since the text is baseline aligned, we should use the max ascent and max descent of each character to calculate the height of the text span's hit-test region, in case some characters in the span have to fall back to a different font, but that will be slower and it typically doesn't make a huge difference. 
      
      This is a breaking change. It also introduces a new finder and a new method `WidgetTester.tapOnText`: `await tester.tapOnText('string to match')` for ease of migration.
      ea5b9728
  2. 19 Dec, 2023 1 commit
  3. 14 Dec, 2023 2 commits
  4. 11 Dec, 2023 3 commits
  5. 29 Nov, 2023 1 commit
  6. 28 Nov, 2023 1 commit
  7. 23 Nov, 2023 1 commit
  8. 16 Nov, 2023 1 commit
  9. 10 Nov, 2023 1 commit
  10. 06 Nov, 2023 2 commits
  11. 02 Nov, 2023 1 commit
  12. 28 Oct, 2023 1 commit
  13. 27 Oct, 2023 1 commit
  14. 25 Oct, 2023 1 commit
  15. 24 Oct, 2023 1 commit
    • cui fliter's avatar
      fix some typos (#137144) · c5e71b3e
      cui fliter authored
      *Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*
      
      fix some typos
      
      *List which issues are fixed by this PR. You must list at least one issue.*
      
      *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
      c5e71b3e
  16. 23 Oct, 2023 2 commits
  17. 22 Oct, 2023 1 commit
    • Todd Volkert's avatar
      Add timeline events for post frame callbacks (#136435) · cb9a3f69
      Todd Volkert authored
      Before this change, long-running post-frame callbacks wouldn't show up in the timeline at all.  This adds a timeline event for post-frame callbacks, with a debug flag that will add timeline events for each individual callback.
      
      #testexempt -- we have no way to test calls to the timeline.
      cb9a3f69
  18. 20 Oct, 2023 1 commit
  19. 18 Oct, 2023 1 commit
  20. 15 Oct, 2023 1 commit
  21. 13 Oct, 2023 1 commit
    • Todd Volkert's avatar
      Make constraints a covariant argument in RenderBox.computeDryLayout() (#136432) · bc688cf0
      Todd Volkert authored
      Some render box subclasses have a specific layout contract that is tightly coupled with other render box subclasses (e.g. two private classes in a local project file). In these cases, it is also possible that they use a constraints object that is a subclass of `BoxConstraints`. To allow for this, this change makes the `constraints` argument to `RenderBox.computeDryLayout()` a covariant argument.
      
      For completeness' sake, this updates the other render objects in the rendering package to also use the covariant keyword for this argument.
      bc688cf0
  22. 11 Oct, 2023 1 commit
  23. 10 Oct, 2023 1 commit
  24. 09 Oct, 2023 1 commit
    • Greg Spencer's avatar
      Update `MediaQuery` documentation to highlight asynchronous nature of size (#135719) · a5e3e785
      Greg Spencer authored
      ## Description
      
      This updates the documentation for `MediaQuery` and `Overlay` to include the following:
      
      - That `MediaQueryData.size` is set asynchronously, and doesn't necessarily reflect the size of the current frame.
      - That the specific `MediaQuery.sizeOf` and related methods are preferred over the more generic `MediaQuery.of`.
      - That the size of the `Overlay` isn't necessarily the size returned by `MediaQueryData.size`
      
      As well as adding some symbol links, and fixing some error in documentation.
      
      ## Tests
       - Documentation only
      a5e3e785
  25. 06 Oct, 2023 2 commits
  26. 29 Sep, 2023 1 commit
  27. 28 Sep, 2023 2 commits
    • Kate Lovett's avatar
      3509a1df
    • Renzo Olivares's avatar
      Implement SelectionArea single click/tap gestures (#132682) · 21ad7122
      Renzo Olivares authored
      This change collapses the selection at the clicked/tapped location on single click down for desktop platforms, and on single click/tap up for mobile platforms to match native.
      
      This is a change from how `SelectionArea` previously worked. Before this change a single click down would clear the selection. From observing a native browser it looks like when tapping on static text the selection is not cleared but collapsed. A user can still attain the selection from static text using the `window.getSelection` API.
      
      https://jsfiddle.net/juepasn3/11/ You can try this demo out here to observe this behavior yourself. When clicking on static text the selection will change.
      
      This change also allows `Paragraph.selections` to return selections that are collapsed. This for testing purposes to confirm where the selection has been collapsed.
      
      Partially fixes: #129583
      21ad7122
  28. 27 Sep, 2023 2 commits
  29. 21 Sep, 2023 1 commit
  30. 20 Sep, 2023 2 commits
    • Greg Spencer's avatar
      Remove 'must not be null' comments from various libraries. (#134984) · 8cda3bea
      Greg Spencer authored
      ## Description
      
      This removes all of the comments that are of the form "so-and-so (must not be null|can ?not be null|must be non-null)" from the cases where those values are defines as non-nullable values.
      
      This PR removes them from the animation, cupertino, foundation, gestures, semantics, and services libraries.  Each of them only had a few, so I lumped them together.
      
      This was done by hand, since it really didn't lend itself to scripting, so it needs to be more than just spot-checked, I think. I was careful to leave any comment that referred to parameters that were nullable, but I may have missed some.
      
      In addition to being no longer relevant after null safety has been made the default, these comments were largely fragile, in that it was easy for them to get out of date, and not be accurate anymore anyhow.
      
      This did create a number of constructor comments which basically say "Creates a [Foo].", but I don't really know how to avoid that in a large scale change, since there's not much you can really say in a lot of cases.  I think we might consider some leniency for constructors to the "Comment must be meaningful" style guidance (which we de facto have already, since there are a bunch of these).
      
      ## Related PRs
      - https://github.com/flutter/flutter/pull/134991
      - https://github.com/flutter/flutter/pull/134992
      - https://github.com/flutter/flutter/pull/134993
      - https://github.com/flutter/flutter/pull/134994
      
      ## Tests
       - Documentation only change.
      8cda3bea
    • Greg Spencer's avatar
      Remove 'must not be null' comments from painting and rendering libraries. (#134993) · fe9a2c54
      Greg Spencer authored
      ## Description
      
      This removes all of the comments that are of the form "so-and-so (must not be null|can ?not be null|must be non-null)" from the cases where those values are defines as non-nullable values.
      
      This PR removes them from the painting and rendering libraries.
      
      This was done by hand, since it really didn't lend itself to scripting, so it needs to be more than just spot-checked, I think. I was careful to leave any comment that referred to parameters that were nullable, but I may have missed some.
      
      In addition to being no longer relevant after null safety has been made the default, these comments were largely fragile, in that it was easy for them to get out of date, and not be accurate anymore anyhow.
      
      This did create a number of constructor comments which basically say "Creates a [Foo].", but I don't really know how to avoid that in a large scale change, since there's not much you can really say in a lot of cases.  I think we might consider some leniency for constructors to the "Comment must be meaningful" style guidance (which we de facto have already, since there are a bunch of these).
      
      ## Related PRs
      - https://github.com/flutter/flutter/pull/134984
      - https://github.com/flutter/flutter/pull/134991
      - https://github.com/flutter/flutter/pull/134992
      - https://github.com/flutter/flutter/pull/134994
      
      ## Tests
       - Documentation only change.
      fe9a2c54
  31. 19 Sep, 2023 1 commit