This PR changes the material date picker behavior when changing the year so that it matches the native picker and the material component guideline. (#81547)
See material component guideline for the date picker: [Material component date-picker behavior](https://m3.material.io/components/date-pickers/guidelines#1531a81f-4052-4a75-a20d-228c7e110156)
See also: [Material components android discussion](https://github.com/material-components/material-components-android/issues/1723)
When selecting another year in the native picker, the same day will be selected (by respecting the boundaries of the date picker). The current material date picker does not select any day when changing the year. This will lead to confusion if the user presses OK and the year does not get updated.
So here is my suggestion:
It will try to preselect the day like the native picker:
- respecting the boundaries of the date picker (firstDate, lastDate)
- changing from leapyear 29th february will set 28th february if not a leapyear is selected
- only set the day if it is selectable (selectableDayPredicate)
The calendar shown in the recording was setup with this parameters:
```
firstDate: DateTime(2016, DateTime.june, 9),
initialDate: DateTime(2018, DateTime.may, 4),
lastDate: DateTime(2021, DateTime.january, 15),
```
https://github.com/flutter/flutter/assets/13588771/3041c296-b9d0-4078-88cd-d1135fc343b3Fixes#81547
The change in [0] has propagated now everywhere, so we can use
`utf8.encode()` instead of the longer `const Utf8Encoder.convert()`.
Also it cleans up code like
```
TypedData bytes;
bytes.buffer.asByteData();
```
as that is not guaranteed to be correct, the correct version would be
```
TypedData bytes;
bytes.buffer.asByteData(bytes.offsetInBytes, bytes.lengthInBytes);
```
a shorter hand for that is:
```
TypedData bytes;
ByteData.sublistView(bytes);
```
[0] https://github.com/dart-lang/sdk/issues/52801
## Description
This modifies the `MenuAnchor` `onPressed` activation to delay until after the current frame is built, and resolve any focus changes before it invokes the `onPressed`, so that actions that operate on the `primaryFocus` can have a chance of working on the focused item they were meant to work on.
## Related Issues
- Fixes https://github.com/flutter/flutter/issues/118731
## Tests
- No tests yet (hence draft still)
This PR updates unit tests from autocomplete_test.dart for M3 migration.
More info in https://github.com/flutter/flutter/issues/127064
I replaced magic numbers (64.0 and 187.0) and found ways to compute them without relying on the Material version.
This PR updates unit tests in `about_test.dart` for M3 migration.
More info in https://github.com/flutter/flutter/issues/127064
- Two tests were failing in M3 due to a memory leak. As the memory leak is now fixed, see https://github.com/flutter/flutter/pull/130720, this two tests does not depend anymore on the Material version.
- Created several M3 tests related to typography and rendering changes.
## Description
This PR adds a call to dispose the internal `MaterialStatesController` instantiated by `_SelectableIconButtonState`.
I found this memory leak while working on M2/M3 test update for `about_test.dart`. This memory leak only happens when using M3 because `IconButton` relies on `_SelectableIconButton` only when useMaterial3 is true:
3a1190a5a8/packages/flutter/lib/src/material/icon_button.dart (L671-L721)
## Related Issue
Fixes https://github.com/flutter/flutter/issues/130708
## Tests
Adds 1 test.
## Description
Modifies the semantic label for popup and context menus to be "Dismiss menu" instead of just "Dismiss".
## Related Issues
- Fixes https://github.com/flutter/flutter/issues/118994
## Tests
- Updated tests
Fixes#115525.
On [AbstractNode.detach] and its two progeny [RenderNode.detach]
and [Layer.detach], the docs said both to call the inherited method
before detaching children, and to end by doing so. The former
advice is what's enforced by an assertion in the base implementation,
so cut out the other.
The corresponding [attach] methods redundantly said twice to
call the inherited method first, so cut the redundancy.
Leave in place the version more recently added (in #76021), because
that PR shows the old version must have been easy to overlook.
This PR updates unit tests from app_builder_test.dart for M3 migration.
More info in https://github.com/flutter/flutter/issues/127064
In this particular case, I choose to make the tests Material-agnostic by removing the color theming which was not meaningful to what is tested here.
To preserve backward compatibility with the old parser which would
ignore syntax errors, this PR introduces a way to treat the special
characters `{` and `}` in the following way:
1. If we encounter a `{` which searching for a string token and this `{`
is not followed by a valid placeholder, then we treat the `{` as a
string and continue lexing for strings.
2. If we encounter a `}` while not within some expression (i.e.
placeholders, arguments, plurals, or selects), then we treat the `}` as
a string and continue lexing for strings.
This makes it so that
```
"helloWorld": "{ } { placeholder }",
"@@helloWorld": {
"placeholders": {
"placeholder" {}
}
}
```
treats the `{ }` as a string while `{ placeholder } ` is treated as a
placeholder.
Fixes https://github.com/flutter/flutter/issues/122404.
This PR updates unit tests from `app_test.dart` for M3 migration.
More info in https://github.com/flutter/flutter/issues/127064
The diff is somewhat misleading because third test in the original code is now the fourth in the updated one, but because they were very similar git diff does not reflect this swap.
And also, first test is M2 only and last one M3 only.