### Issue Link
https://github.com/flutter/flutter/issues/154722
### Target
stable
### Cherry pick PR Link
https://github.com/flutter/flutter/pull/154720
### Changelog Description
The `Drawer` widget will snap completely open or shut after being dragged more than halfway.
### Impacted Users
This affects everyone who has a `Drawer` widget in their mobile app.
### Impact Description
Fortunately, the impact of this issue is limited to visual jank. But it will likely be widespread across app developers.
### Workaround
There isn't a workaround for this.
### Risk
low (This fix was merged over 2 weeks ago.)
### Test Coverage
This fix is covered by the test added in the linked pull request.
### Validation Steps
The fix can be verified by opening a mobile Flutter app and dragging a `Drawer` open or shut.
Fixes an issue where Flutter TextField may crash on iOS after a horizontal drag that does not meet the drag threshold to win the gesture arena, leaving the TextField in a weird state that does not accept tap gestures.
Fixes#153939
Cherry-pick of: https://github.com/flutter/flutter/issues/151989
Related issue: #153458
Fix a crash when deleting text in an EditableText inside CupertinoPageRoute, with a CJK keyboard on Android. CJK Keyboards on Android may send a key event instead of directly updating the text through the IME, in that case we do not hide the toolbar when text is deleted. This causes an exception when in scrollable text, because the context menu scroll listener tries to access the `RenderBox.size` while in a weird state. This change fixes that and hides the toolbar when text is deleted through a key event.
Fixes#153949
Cherry-pick of: #153822
Related issue: #153003
Context: https://github.com/flutter/flutter/issues/153472.
When the Flutter VM service is disposed while there are still outstanding requests, each request is completed with an `RPCError` that has no stack trace. This was fixed in package:vm_service v14.2.5 (these errors will now have stack traces). This PR bumps the framework repo's dependency on this package from 14.2.4 to 14.2.5. This may be handy in case we miss handling these errors from specific call sites in whatever fix(es) we put out for https://github.com/flutter/flutter/issues/153472.
`handleEventLoopCallback()` should return `true` rather than `false` when there are tasks in the queue but the highest priority task is not run because of the `schedulingStrategy`. If `false` is returned when the queue still has tasks, the event loop stops, causing existing and new tasks to never be scheduled.
For full context, see https://github.com/flutter/flutter/issues/73766#issuecomment-2202427256.
Fixes#73766 and #82016.
Adds a new ScrollNotificationEnd example that demonstrates how to trigger an auto-scroll based on an individual sliver's `SliverConstraints` and `SliverGeometry`.
Then new example auto-scrolls one special "aligned item" sliver to the top or bottom of the viewport, whenever it's partially visible (because it overlaps the top or bottom of the viewport). This example differs from the existing ScrollEndNotification example because the layout of the to-be aligned sliver is retrieved from its `RenderSliver` via a
GlobalKey. The new example does not rely on all of the list items having the same extent.
This PR addresses a bug from the previous rewrite of the `CupertinoActionSheet` height allocation algorithm.
The previous approach assigns the content section with a minimal height. As a result, if the actions section is shorter than `_kActionSheetActionsSectionMinHeight`, the remaining space will not be taken by the content section.
As far as I know, this algorithm can not be implemented by simply compositing simple layout widgets, and therefore I created a new widget `_PriorityColumn` that uses a custom layout algorithm. (The resulting code is still shorter (and cleaner) than before the rewrite!)
Some other trivial refactor is also done to clean up the code around parameters of `_ActionSheetMainSheet`.
I really like how patterns can be used for variable assignment and avoiding duplicated logic. (related: #150942)
```dart
// before
final GestureRecognizer? recognizer = info.recognizer;
if (recognizer is TapGestureRecognizer) {
if (recognizer.onTap != null) {
configuration.onTap = recognizer.onTap;
configuration.isLink = true;
}
} else if (recognizer is DoubleTapGestureRecognizer) {
if (recognizer.onDoubleTap != null) {
configuration.onTap = recognizer.onDoubleTap;
configuration.isLink = true;
}
}
// after
switch (info.recognizer) {
case TapGestureRecognizer(:final VoidCallback? onTap):
case DoubleTapGestureRecognizer(onDoubleTap: final VoidCallback? onTap):
if (onTap != null) {
configuration.onTap = onTap;
configuration.isLink = true;
}
}
```
This changes how the `IconThemeData` is passed to the child of `CupertinoButton`.
Previously, it would derive the foreground color from the current theme and create a new `IconThemeData` object.
This causes any `IconThemeData` to be overwritten.
This change uses `IconTheme.of` to get the currently applied icon theme and only overwrites the properties provided by the `CupertinoButton` instead of the whole object.
Fixes#149172.
MenuAnchor for Material 3 is great for contextual menus but there are some minor issues related to accessibility.
This PR aims to close the gap by adding `autofocus` to the menu item button so keyboard navigation is more intuitive. Otherwise, it becomes a mess to navigate through just keyboards.
Partially resolves#139395
## Additional Notes
I should mention, I have not written tests for this due to it's trivial nature. I also lack the experience of writing Flutter tests in general, so if someone feels inclined to take over this PR and add it they're welcome to.
Part of https://github.com/flutter/flutter/issues/150800.
I turned on the `comment_references` lint and looked at what needed fixing inside of the `animation` library.
There are a couple of places where for some reason adding a docImport didn't fix the `comment_references` warning:
This PR removes the usage of Material widgets from unit tests of `CupertinoAlertDialog`. Other than it being just wrong, it also introduces bad behavior, such as the scroll view can't be overscrolled so that the overscroll behavior can't be tested.
* Since there are no longer M2 or M3 variants of tests, I straight up rewrote the unit tests for "default look" with similar tests as those of `CupertinoActionSheet` ([here](https://github.com/flutter/flutter/blob/master/packages/flutter/test/cupertino/action_sheet_test.dart#L21))
This PR also replaces `showCupertinoModalPopup` with `showCupertinoDialog` in `CupertinoAlertDialog`'s example code. The former should only be used by `CupertinoActionSheet`, which has a different animation from the correct `showCupertinoDialog`.
## Description
This PR sets a minimal height for collapsed `InputDecoration`.
Before this PR the minimum height was 0. On desktop, due to visual density reducing the height by 8 pixels, it leads to a collapsed text field height being too small to fit the input text vertically.
The following screenshot shows a default collapsed M3 TextField on macOS. On M3 the font style is 16px with a 1.5 height, so the input height is 24. The decoration height is 16 because of the visual density reduction (this results in the border being misplaced, some letters overflowing and the cursor overflowing).

After this PR, the minimum height is the input height.

## Related Issue
Fixes https://github.com/flutter/flutter/issues/150763
## Tests
Adds 4 tests, updates 2.
Fixes part of #150524.
Recently I was studying RenderObject and related code to understand
how the rendering library tracks which objects need layout, and in
particular just how the concept of "relayout boundary" works.
The [RenderObject._relayoutBoundary] property itself had no docs,
and there were some other areas that I felt could be clearer;
so here's a PR where I add those docs.
In addition to docs, this makes some small pure refactors. Mostly
those are in order to make clear docs easier to write. One rename
is to fix a lone straggler from #4425 / #4483.
One key thing I learned, which this documents, is an invariant that
this code maintains on [_relayoutBoundary]. With that invariant in
mind, I found it's possible to simplify that bookkeeping, and to get a
measurable performance improvement as a bonus. To keep things simple,
though, I'll leave those for follow-up PRs.
For ease of review, the PR is broken into several commits each with
their own commit message.
fix typo
*List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.*
*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
Fix a link in the `RenderObjectWidget` doc comment. The comment recommends subclassing `SingleChildRenderObjectElement` where it means to recommend subclassing `SingleChildRenderObjectWidget`.
Fixes#150597.
This PR fixes the general layout of `CupertinoActionSheet` to match the native behavior.
This PR adjusts the height of buttons, the height of the content section, the gap between the cancel button and the main sheet, and most importantly, the maximum height of the action sheet.
The maximum height is the trickiest part. I tried to figure out a rule, and found that the top padding only depends the type of the device - notch-less, notch, capsule - but there isn't a clear rule that can unify the 3 padding numbers. This PR uses linear interpolation as a heuristic algorithm. See the in-code comment for details.
* What about iPad? Well, action sheets look completely different on iPad, more similar to a drop down menu. This might be fixed in the future.
### Tests
Among all the test changes, there are a few tests that have been converted to using `AnimationSheetRecorder` to verify the animation changes. Before the PR they were checking the height at each from, which is hard to reason whether a change makes sense, and hard to modify if anything needs changing.
### Result demo
The following images compares native(left) with Flutter after PR (right) by stacking them closely, and show that their layout really match almost pixel perfect.
<img width="455" alt="image" src="https://github.com/flutter/flutter/assets/1596656/f8be35bd-0da5-4908-92f7-7a1f4e999229">
_No notch (iPhone 13)_
<img width="405" alt="image" src="https://github.com/flutter/flutter/assets/1596656/54a37c2f-cd99-4e3b-86f0-045b1dfdbbb8">
_Notch (iPhone 13)_
<img width="385" alt="image" src="https://github.com/flutter/flutter/assets/1596656/546ab529-0b62-4e3d-9019-ef900d3552e5">
_Capsule (iPhone 15 Plus)_
<img width="1142" alt="image" src="https://github.com/flutter/flutter/assets/1596656/e06b6dac-dbcd-48f7-9dee-83700ae680e0">
_iPhone 13 landscape_
<img width="999" alt="image" src="https://github.com/flutter/flutter/assets/1596656/698cf530-51fc-4906-90a5-7a3ab626f489">
_All "capsule" devices share the same top padding in logical pixels (iPhone 15 Pro Max, iPhone 15 Pro, iPhone 15 Plus)_
This change enables double tap / triple tap support in SelectionArea for mobile platforms:
Android / Fuchsia:
- On native, these platforms allow for double tap / double tap + drag to select word-by-word.
- On web using touch, these platforms only support double tap to select word.
- On web and native using a mouse, these platforms support double click / double click + drag to select word-by-word, and triple click / triple click + drag to select paragraph-by-paragraph.
iOS:
- On native, these platforms allow for double tap / double tap + drag to select word-by-word.
- On web using touch, these platforms do not support double tap/triple tap gestures.
- On web using touch, these platforms allow support double tap + drag gestures.
- On web and native using a mouse, these platforms support double click / double click + drag to select word-by-word, and triple click / triple click + drag to select paragraph-by-paragraph.
Part of: https://github.com/flutter/flutter/issues/129583
Currently, when text is placed inside a SelectionArea widget that's nested within a Column widget, it results in misalignment, causing the text to appear centered instead of aligned as intended.
This was originally #149552 but had issues with my branch.
*List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.*
Fixes#148934Fixes#121053
*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*