Commit graph

22947 commits

Author SHA1 Message Date
Nate 7fb35db62f
Intensive if chain refactoring (#145194)
This pull request refactors if-statements into switch expressions, as part of the effort to solve issue #144903.

Making changes beyond just swapping syntax is more difficult (and also more difficult to review, I apologize), but much more satisfying too.
2024-03-22 13:55:06 +00:00
Bruno Leroux 859eb2eda9
Adds numpad navigation shortcuts for Linux (#145464)
## Description

This PR adds shortcuts related to numpad keys on Linux.

## Related Issue

Linux side for https://github.com/flutter/flutter/issues/144936

## Tests

Adds 2 tests.
2024-03-22 06:22:09 +00:00
LongCatIsLooong d755bc222b
Replace RenderBox.compute* with RenderBox.get* and add @visibleForOverriding (#145503)
`@visibleForOverriding` + `@protected` unfortunately does not catch the case where a `compute*` method was overridden in a subtype and the overide was called in that same type's implementation.

I did not add a `flutter_ignore` for this because it doesn't seem there will be false positives.
2024-03-22 02:44:55 +00:00
Greg Spencer 0f685f88c6
Add some cross references in the docs, move an example to a dartpad example (#145571)
## Description

This adds some "See also" links to some docs for `TweenAnimationBuilder` and `ValueListenableBuilder`.

Also, moved a "snippet" example in `ValueListenableBuilder` into the examples directory as a Dartpad example.

## Tests
 - Added test for the example.
2024-03-22 02:35:11 +00:00
Bernardo Ferrari 784f19c49c
Fix BorderSide.none requiring explicit transparent color for UnderlineInputBorder (#145329)
Fix could have been "paint transparent when Border none" but, following other Borders, we will just not paint anything.

Fix https://github.com/flutter/flutter/issues/143746
2024-03-22 02:31:16 +00:00
Michael Goderbauer 11c034f037
Fix nullability of getFullHeightForCaret (#145554)
Fixes https://github.com/flutter/flutter/issues/145507.

Looks like this was accidentally migrated to nullable all the way back when we switched to NNBD.
2024-03-21 23:38:16 +00:00
Lau Ching Jun c759c22e71
Fixed race condition in PollingDeviceDiscovery. (#145506)
There are two issues in the previous implementation:
1. `_populateDevices` will return the devices from `deviceNotifier` if it had been initialized, assuming that once it's initialized, it has been properly populated. That assumption is not true because calling getters like `onAdded` would initialize `deviceNotifier` without populating it.
2. `deviceNotifier` instance might be replaced in some cases, causing `onAdded` subscribers to lose any future updates.

To fix (1), this commit added the `isPopulated` field in `deviceNotifier` as a more accurate flag to determine if we need to populate it.

To fix (2), this commit made `deviceNotifier` a final member in `PolingDeviceDiscovery`.
2024-03-21 22:37:08 +00:00
Ian Hickson afe01503d8
Clarify AutomaticKeepAliveClientMixin semantics in build method (#145297)
This should help folks who trace the code before reading the documentation.
2024-03-21 21:28:07 +00:00
Michael Goderbauer eaf509aaf8
Eliminate more window singleton usages (#145560)
These usages in strings slipped through the initial clean-up.
2024-03-21 20:59:25 +00:00
Jackson Gardner 31209d04ff
flutter test --wasm support (#145347)
* Adds support for `flutter test --wasm`.
  * The test compilation flow is a bit different now, so that it supports compilers other than DDC. Specifically, when we run a set of unit tests, we generate a "switchboard" main function that imports each unit test and runs the main function for a specific one based off of a value set by the JS bootstrapping code. This way, there is one compile step and the same compile output is invoked for each unit test file.
* Also, removes all references to `dart:html` from flutter/flutter.
* Adds CI steps for running the framework unit tests with dart2wasm+skwasm
  * These steps are marked as `bringup: true`, so we don't know what kind of failures they will result in. Any failures they have will not block the tree at all yet while we're still in `bringup: true`. Once this PR is merged, I plan on looking at any failures and either fixing them or disabling them so we can get these CI steps running on presubmit.

This fixes https://github.com/flutter/flutter/issues/126692
2024-03-21 20:08:07 +00:00
Pascal Welsch 4bbe6d594d
Add WidgetsApp.debugShowWidgetInspectorOverride again (deprecated) (#145334)
`WidgetsApp.debugShowWidgetInspectorOverride` was replaced with ` WidgetsBinding.instance.debugShowWidgetInspectorOverrideNotifier` in https://github.com/flutter/flutter/pull/144029.

The old API was removed, not deprecated.

It is used by some [open-source projects](https://github.com/search?q=WidgetsApp.debugShowWidgetInspectorOverride&type=code), thus I'm making the effort of bringing the API back as deprecated.

Fixes https://github.com/flutter/flutter/issues/145333
2024-03-21 17:43:05 +00:00
flutter-pub-roller-bot 61b3f975a0
Roll pub packages (#145476)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-03-21 00:09:24 +00:00
Vatsal Bhesaniya 01fc13d9f9
Add helper widget parameter to InputDecoration (#145157)
This pull request introduces a new field named `helper` to the InputDecoration class. This field allows for specifying a widget containing contextual information about the InputDecorator.child's value. Unlike `helperText`, which accepts a plain string, `helper` supports widgets, enabling functionalities like tappable links for further explanation. This change aligns with the established pattern of `error`, `label`, `prefix`, and `suffix`.

fixes [#145163](https://github.com/flutter/flutter/issues/145163)
2024-03-20 20:48:05 +00:00
Gray Mackall 39bdff16c1
Remove embedding v1 code in framework (#144726)
Pre work for https://github.com/flutter/engine/pull/51229. Removes a lot of code referencing v1 of the android embedding, though not necessarily all of it (I may have missed some, it is hard to know).

Will hopefully make landing that PR less painful (or maybe painless?)
2024-03-20 20:34:14 +00:00
auto-submit[bot] a01eac78ee
Reverts "Reland #128236 "Improve build output for all platforms" (#145376)" (#145487)
Reverts: flutter/flutter#145376
Initiated by: loic-sharma
Reason for reverting: It caused the following post-submit failures:

1. https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8752928710548811665/+/u/run_run_release_test_windows/stdout
2. https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8752927564747697169/+/u/run_run_release_test_windows/stdout
Original PR Author: guidezpl

Reviewed By: {loic-sharma}

This change reverts the following previous change:
Reland #128236, reverted in https://github.com/flutter/flutter/pull/143125 and https://github.com/flutter/flutter/pull/145261.

This PR contains 3 additional commits, fixing post-submit tests on Android and Windows.

## Original description

Improves the build output:

1. Gives confirmation that the build succeeded, in green
1. Gives the path to the built executable, without a trailing period to make it slightly easier to cmd/ctrl+open
1. Gives the size of the built executable (when the built executable is self contained) 

### `apk`, `appbundle` 

<img width="607" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ecc52abe-cd2e-4116-b22a-8385ae3e980d">

<img width="634" alt="image" src="https://github.com/flutter/flutter/assets/6655696/8af8bd33-c0bd-4215-9a06-9652ee019436">

### `macos`, `ios`, `ipa`
Build executables are self-contained and use a newly introduced `OperatingSystemUtils.getDirectorySize`.

<img width="514" alt="image" src="https://github.com/flutter/flutter/assets/6655696/b5918a69-3959-4417-9205-4f501d185257">

<img width="581" alt="image" src="https://github.com/flutter/flutter/assets/6655696/d72fd420-18cf-4470-9e4b-b6ac10fbcd50">

<img width="616" alt="image" src="https://github.com/flutter/flutter/assets/6655696/5f235ce1-252a-4c13-898f-139f6c7bc698">

### `windows`, `linux`, and `web`
Build executables aren't self-contained, and folder size can sometimes overestimate distribution size, therefore their size isn't mentioned (see discussion below).

<img width="647" alt="image" src="https://github.com/flutter/flutter/assets/6655696/7179e771-1eb7-48f6-b770-975bc073437b">

<img width="658" alt="image" src="https://github.com/flutter/flutter/assets/6655696/a6801cab-7b5a-4975-a406-f4c9fa44d7a2">

<img width="608" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ee7c4125-a273-4a65-95d7-ab441edf8ac5">

### Size reporting
When applicable, the printed size matches the OS reported size.

- macOS
    <img width="391" alt="image" src="https://github.com/flutter/flutter/assets/6655696/881cbfb1-d355-444b-ab44-c1a6343190ce">
- Windows
    <img width="338" alt="image" src="https://github.com/flutter/flutter/assets/6655696/3b806def-3d15-48a9-8a25-df200d6feef7">
- Linux   
    <img width="320" alt="image" src="https://github.com/flutter/flutter/assets/6655696/89a4aa3d-2148-4f3b-b231-f93a057fee2b">

## Related issues
Part of #120127
Fixes https://github.com/flutter/flutter/issues/121401
2024-03-20 18:18:25 +00:00
Pierre-Louis 6b568f3943
Reland #128236 "Improve build output for all platforms" (#145376)
Reland #128236, reverted in https://github.com/flutter/flutter/pull/143125 and https://github.com/flutter/flutter/pull/145261.

This PR contains 3 additional commits, fixing post-submit tests on Android and Windows.

## Original description

Improves the build output:

1. Gives confirmation that the build succeeded, in green
1. Gives the path to the built executable, without a trailing period to make it slightly easier to cmd/ctrl+open
1. Gives the size of the built executable (when the built executable is self contained) 

### `apk`, `appbundle` 

<img width="607" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ecc52abe-cd2e-4116-b22a-8385ae3e980d">

<img width="634" alt="image" src="https://github.com/flutter/flutter/assets/6655696/8af8bd33-c0bd-4215-9a06-9652ee019436">

### `macos`, `ios`, `ipa`
Build executables are self-contained and use a newly introduced `OperatingSystemUtils.getDirectorySize`.

<img width="514" alt="image" src="https://github.com/flutter/flutter/assets/6655696/b5918a69-3959-4417-9205-4f501d185257">

<img width="581" alt="image" src="https://github.com/flutter/flutter/assets/6655696/d72fd420-18cf-4470-9e4b-b6ac10fbcd50">

<img width="616" alt="image" src="https://github.com/flutter/flutter/assets/6655696/5f235ce1-252a-4c13-898f-139f6c7bc698">

### `windows`, `linux`, and `web`
Build executables aren't self-contained, and folder size can sometimes overestimate distribution size, therefore their size isn't mentioned (see discussion below).

<img width="647" alt="image" src="https://github.com/flutter/flutter/assets/6655696/7179e771-1eb7-48f6-b770-975bc073437b">

<img width="658" alt="image" src="https://github.com/flutter/flutter/assets/6655696/a6801cab-7b5a-4975-a406-f4c9fa44d7a2">

<img width="608" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ee7c4125-a273-4a65-95d7-ab441edf8ac5">

### Size reporting
When applicable, the printed size matches the OS reported size.

- macOS
    <img width="391" alt="image" src="https://github.com/flutter/flutter/assets/6655696/881cbfb1-d355-444b-ab44-c1a6343190ce">
- Windows
    <img width="338" alt="image" src="https://github.com/flutter/flutter/assets/6655696/3b806def-3d15-48a9-8a25-df200d6feef7">
- Linux   
    <img width="320" alt="image" src="https://github.com/flutter/flutter/assets/6655696/89a4aa3d-2148-4f3b-b231-f93a057fee2b">

## Related issues
Part of #120127
Fixes https://github.com/flutter/flutter/issues/121401
2024-03-20 16:14:53 +00:00
Lau Ching Jun a80286270c
Fix remote DDS in proxied devices. (#145346)
A ProxiedDevice has two port forwarder, one to forward remote host port and another to forward remote device port. During an attach workflow, the port was forwarded by the latter. Update ProxiedDDS to make sure that it works in such case.
2024-03-19 21:36:06 +00:00
hangyu 2b317d584f
Add a minTileHeight to ListTile widget so its height can be customized to less than the default height. (#145244)
fixes: https://github.com/flutter/flutter/issues/145369
2024-03-19 17:58:16 +00:00
Mitchell Goodwin 6190c5eea1
Widget state properties (#142151)
Fixes #138270.

Moves the majority of the logic of MaterialStateProperties down to the widgets layer, then has the existing Material classes pull from the widgets versions.
2024-03-19 17:58:13 +00:00
goodmost 3236957f02
chore: fix some comments (#145397)
fix some comments
2024-03-19 17:00:24 +00:00
Bruno Leroux 6f61f6135f
Activate shortcuts based on NumLock state (#145146)
## Description

The PR updates `SingleActivator` in order to add a parameter for specifying that a shortcut depends on <kbd>NumLock</kbd> key state. 

Somewhat similarly to what is possible with common modifiers expect that a boolean is not enough in this case because: by default, a shortcut should ignore the <kbd>NumLock</kbd> state and it should be possible to define shortcuts that require <kbd>NumLock</kbd> to be locked and other that require it to be unlocked.

@gspencergoog I considered defining a new `ShortcutActivator` implementation for this, but I thinks that adding the feature directly to `SingleActivator` results in a cleaner API.

## Related Issue

Fixes https://github.com/flutter/flutter/issues/145144
Preparation for https://github.com/flutter/flutter/issues/144936

## Tests

Adds 3 tests.
2024-03-19 08:27:50 +00:00
Danny Tuppeny 89ef73e068
Roll pub packages + update DAP tests (#145349)
This manually rolls pub packages and updates some calls to use updated APIs that use `Uri` instead of file paths (since macro-generated sources don't exist as files on disk).
2024-03-18 21:39:21 +00:00
sanni prasad 993f554e4c
Fix for issue 140372 (#144947)
*Continuing work from the PR https://github.com/flutter/flutter/pull/140373*

Add the ability to set route settings on PopupMenuButton

Fixes https://github.com/flutter/flutter/issues/140372

Added UTs as requested
2024-03-18 21:35:37 +00:00
LongCatIsLooong 98369bdd50
Introduce methods for computing the baseline location of a RenderBox without affecting the current layout (#144655)
Extracted from https://github.com/flutter/flutter/pull/138369

Introduces `RenderBox.{compute,get}DryBaseline` for computing the baseline location in `RenderBox.computeDryLayout`.
2024-03-18 21:32:22 +00:00
Bruno Leroux 50e7f2b84b
InputDecorator M3 tests migration - Step6 - constraints (#145213)
## Description

This PR migrates `InputDecorator.constraints` related tests to M3 and also various regression tests.

It is the fifth step for the M3 test migration for `InputDecorator`.
Step 1: https://github.com/flutter/flutter/pull/142981
Step 2: https://github.com/flutter/flutter/pull/143369
Step 3: https://github.com/flutter/flutter/pull/143520
Step 4: https://github.com/flutter/flutter/pull/144169
Step 5: https://github.com/flutter/flutter/pull/144932

## Related Issue

Related to https://github.com/flutter/flutter/issues/139076

@justinmc A somewhat small PR, I wanted to migrate the small group related to 'InputDecoration.constraints' (starting at line 2801), it adds a test checking min interactive height and two others that shows one way to bypass the standard min interactive height.
2024-03-18 12:53:14 +00:00
Taha Tesser 06ed849cbc
Update inherited_theme_test.dart, ink_paint_test.dart, ink_splash_test.dart, opacity_test.dart for Material 3 (#144013)
Updated unit tests for `Tooltip` to have M2 and M3 versions.

More info in #139076
2024-03-18 12:45:22 +00:00
Ian Hickson c7123c96cd
Factor out use of "print" in flutter_goldens (#144846)
This is part 5 of a broken down version of the #140101 refactor.

This PR removes direct use of `print` and replaces it with a callback.
2024-03-17 01:56:19 +00:00
auto-submit[bot] 48c1c2313a
Reverts "Reland #128236 "Improve build output for all platforms" (#143166)" (#145261)
Reverts: flutter/flutter#143166
Initiated by: guidezpl
Reason for reverting: breaks devicelab windows tests
Original PR Author: guidezpl

Reviewed By: {loic-sharma}

This change reverts the following previous change:
Reland #128236, reverted in https://github.com/flutter/flutter/pull/143125.

This PR contains [one additional commit](199baea9a9), fixing the 2 failed tests.

## Original description

Improves the build output:

1. Gives confirmation that the build succeeded, in green
1. Gives the path to the built executable, without a trailing period to make it slightly easier to cmd/ctrl+open
1. Gives the size of the built executable (when the built executable is self contained) 

### `apk`, `appbundle` 

<img width="607" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ecc52abe-cd2e-4116-b22a-8385ae3e980d">

<img width="634" alt="image" src="https://github.com/flutter/flutter/assets/6655696/8af8bd33-c0bd-4215-9a06-9652ee019436">

### `macos`, `ios`, `ipa`
Build executables are self-contained and use a newly introduced `OperatingSystemUtils.getDirectorySize`.

<img width="514" alt="image" src="https://github.com/flutter/flutter/assets/6655696/b5918a69-3959-4417-9205-4f501d185257">

<img width="581" alt="image" src="https://github.com/flutter/flutter/assets/6655696/d72fd420-18cf-4470-9e4b-b6ac10fbcd50">

<img width="616" alt="image" src="https://github.com/flutter/flutter/assets/6655696/5f235ce1-252a-4c13-898f-139f6c7bc698">

### `windows`, `linux`, and `web`
Build executables aren't self-contained, and folder size can sometimes overestimate distribution size, therefore their size isn't mentioned (see discussion below).

<img width="647" alt="image" src="https://github.com/flutter/flutter/assets/6655696/7179e771-1eb7-48f6-b770-975bc073437b">

<img width="658" alt="image" src="https://github.com/flutter/flutter/assets/6655696/a6801cab-7b5a-4975-a406-f4c9fa44d7a2">

<img width="608" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ee7c4125-a273-4a65-95d7-ab441edf8ac5">

### Size reporting
When applicable, the printed size matches the OS reported size.

- macOS
    <img width="391" alt="image" src="https://github.com/flutter/flutter/assets/6655696/881cbfb1-d355-444b-ab44-c1a6343190ce">
- Windows
    <img width="338" alt="image" src="https://github.com/flutter/flutter/assets/6655696/3b806def-3d15-48a9-8a25-df200d6feef7">
- Linux   
    <img width="320" alt="image" src="https://github.com/flutter/flutter/assets/6655696/89a4aa3d-2148-4f3b-b231-f93a057fee2b">

## Related issues
Part of #120127
Fixes https://github.com/flutter/flutter/issues/121401
2024-03-16 12:40:26 +00:00
Pierre-Louis 2fc76c7896
Reland #128236 "Improve build output for all platforms" (#143166)
Reland #128236, reverted in https://github.com/flutter/flutter/pull/143125.

This PR contains [one additional commit](199baea9a9), fixing the 2 failed tests.

## Original description

Improves the build output:

1. Gives confirmation that the build succeeded, in green
1. Gives the path to the built executable, without a trailing period to make it slightly easier to cmd/ctrl+open
1. Gives the size of the built executable (when the built executable is self contained) 

### `apk`, `appbundle` 

<img width="607" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ecc52abe-cd2e-4116-b22a-8385ae3e980d">

<img width="634" alt="image" src="https://github.com/flutter/flutter/assets/6655696/8af8bd33-c0bd-4215-9a06-9652ee019436">

### `macos`, `ios`, `ipa`
Build executables are self-contained and use a newly introduced `OperatingSystemUtils.getDirectorySize`.

<img width="514" alt="image" src="https://github.com/flutter/flutter/assets/6655696/b5918a69-3959-4417-9205-4f501d185257">

<img width="581" alt="image" src="https://github.com/flutter/flutter/assets/6655696/d72fd420-18cf-4470-9e4b-b6ac10fbcd50">

<img width="616" alt="image" src="https://github.com/flutter/flutter/assets/6655696/5f235ce1-252a-4c13-898f-139f6c7bc698">

### `windows`, `linux`, and `web`
Build executables aren't self-contained, and folder size can sometimes overestimate distribution size, therefore their size isn't mentioned (see discussion below).

<img width="647" alt="image" src="https://github.com/flutter/flutter/assets/6655696/7179e771-1eb7-48f6-b770-975bc073437b">

<img width="658" alt="image" src="https://github.com/flutter/flutter/assets/6655696/a6801cab-7b5a-4975-a406-f4c9fa44d7a2">

<img width="608" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ee7c4125-a273-4a65-95d7-ab441edf8ac5">

### Size reporting
When applicable, the printed size matches the OS reported size.

- macOS
    <img width="391" alt="image" src="https://github.com/flutter/flutter/assets/6655696/881cbfb1-d355-444b-ab44-c1a6343190ce">
- Windows
    <img width="338" alt="image" src="https://github.com/flutter/flutter/assets/6655696/3b806def-3d15-48a9-8a25-df200d6feef7">
- Linux   
    <img width="320" alt="image" src="https://github.com/flutter/flutter/assets/6655696/89a4aa3d-2148-4f3b-b231-f93a057fee2b">

## Related issues
Part of #120127
Fixes https://github.com/flutter/flutter/issues/121401
2024-03-16 08:13:56 +00:00
Pierre-Louis 3109b1118e
Introduce Split curve (#143130)
`Split` is a curve that progresses according to `beginCurve` until
`split`, then according to `endCurve`.

This curve is used with bottom sheets to allow linear finger dragging
and non-linear enter/exit animations. This PR cleans up a previously
private class I introduced and replaces it with the more customisable
`Split`.

Fixes https://github.com/flutter/flutter/issues/51627

Diagram to be added with
https://github.com/flutter/assets-for-api-docs/pull/239

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-03-16 09:08:00 +01:00
LongCatIsLooong cc01701781
Use a separate TextPainter for intrinsics calculation in RenderEditable and RenderParagraph (#144577)
Use a dedicated `TextPainter` for intrinsic size calculation in `RenderEditable` and `RenderParagraph`.

This is an implementation detail so the change should be covered by existing tests.  Performance wise this shouldn't be significantly slower since SkParagraph [caches the result of slower operations across different paragraphs](9c62e7b382/modules/skparagraph/src/ParagraphCache.cpp (L254-L272)). Existing benchmarks should be able to catch potential regressions (??).

The reason for making this change is to make sure that intrinsic size computations don't destroy text layout artifacts, so I can expose the text layout as a stream of immutable `TextLayout` objects, to signify other render objects that text-layout-dependent-cache (such as caches for `getBoxesForRange` which can be relatively slow to compute) should be invalidated and  `markNeedsPaint` needs to be called if the painting logic depended on text layout.
Without this change, the intrinsics/dry layout calculations will add additional events to the text layout stream, which violates the "dry"/non-destructive contract.
2024-03-16 01:15:19 +00:00
hangyu 58eb0e8ae6
Update a11y for SliverAppBar (#144437)
1. Set cacheExtent for sliverAppBar so it's not dropped from the
semantics tree.
2. Update its toolbarOpacity in a11y mode to 1.0. When scrolling in a11y
mode and the focus is back to the sliverAppBar, the content should be
visible.
fixes: https://github.com/flutter/flutter/issues/143437


## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Data Driven Fixes]:
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
2024-03-15 10:42:02 -07:00
Loïc Sharma 8d54abfc22
Roll pub packages manually (#145170)
The automated roll failed as a test needs to be updated: https://github.com/flutter/flutter/pull/145167

Fixes: https://github.com/flutter/flutter/issues/139861
2024-03-15 14:12:22 +00:00
Nate 17a27358a6
Implementing switch expressions in flutter/test/ (#144580)
Migrates test code to new `switch` syntax.
2024-03-14 14:20:44 -07:00
auto-submit[bot] bc611f565b
Reverts "Fix TextField helper top padding on M3 (#145087)" (#145168)
Reverts: flutter/flutter#145087
Initiated by: Jasguerrero
Reason for reverting: failing on accessibility checks b/329548765
Original PR Author: bleroux

Reviewed By: {justinmc}

This change reverts the following previous change:
## Description

`InputDecorator` adds a 8.0 gap beetween the container and the helper text.
From the Material 3 specification, this gap should be 4.0.
See https://m3.material.io/components/text-fields/specs#0c5c8d6d-2169-4d42-960c-51f6ee42eb57.

This PR sets the correct values for M3 without changing the value for M2.

| Before | After | M3 Spec |
|--------|--------|--------|
| ![image](https://github.com/flutter/flutter/assets/840911/9947f334-d98f-4f7e-9da7-ca6d5c0770ac) | ![image](https://github.com/flutter/flutter/assets/840911/081dec4b-eb9f-4eee-a7dc-2538e7110ff0)| ![image](https://github.com/flutter/flutter/assets/840911/c8c8f045-3b79-43a5-a1a3-cc6d5460644f) |

If this change is accepted, a future step will be to make this value configurable, probably by `InputDecorationTheme`.

## Related Issue

Fixes https://github.com/flutter/flutter/issues/144984

## Tests

Updates a value used by several existing tests.
2024-03-14 18:00:26 +00:00
LouiseHsu 9f5fd75e54
[framework] fix incorrect chinese localizations for Search Web and Share in selection controls (#144857)
Fixes https://github.com/flutter/flutter/issues/144825

Corresponding translation suggestions:

https://tc.corp.google.com/btviewer/edittranslation?project=Flutter&msgId=7417055026368500447&language=zh-TW
(I accidentally pressed submit 3 times :( )

https://tc.corp.google.com/btviewer/edittranslation?project=Flutter&msgId=7417055026368500447&language=zh-HK

https://tc.corp.google.com/btviewer/edittranslation?project=Flutter&msgId=7417055026368500447&language=zh-CN

https://tc.corp.google.com/btviewer/edittranslation?project=Flutter&msgId=8883913494819754382&language=zh-CN

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [relevant style guides] and ran the
auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages
repo does use `dart format`.)
- [x] I signed the [CLA].
- [x] The title of the PR starts with the name of the package surrounded
by square brackets, e.g. `[shared_preferences]`
- [x] I [linked to at least one issue that this PR fixes] in the
description above.
- [x] I updated `pubspec.yaml` with an appropriate new version according
to the [pub versioning philosophy], or this PR is [exempt from version
changes].
- [x] I updated `CHANGELOG.md` to add a description of the change,
[following repository CHANGELOG style].
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.
2024-03-14 10:14:20 -07:00
LongCatIsLooong a69567a36f
Asserts if a TextPainter gets disposed more than once (#145124)
The overflow indicator was sharing the same `TextPainter`.
2024-03-14 16:43:00 +00:00
Lau Ching Jun 3dba3f2a0f
Update proxied devices to handle connection interface and diagnostics. (#145061)
Also improve the performance of daemon device discovery by parallelizing the calls.
2024-03-13 22:24:25 +00:00
Matej Knopp 19087442ce
RenderViewport max layout cycles should depend on number of slivers (#144104)
Fixes https://github.com/flutter/flutter/issues/144102

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Data Driven Fixes]:
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
2024-03-13 22:28:43 +01:00
LongCatIsLooong 4f786841f9
Revert "Add FocusNode.focusabilityListenable (#144280)" since the feature is no longer needed (#145102)
This reverts commit 726e5d28c0.

*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*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].*
2024-03-13 20:17:07 +00:00
Bruno Leroux 33fbb75a95
Fix TextField helper top padding on M3 (#145087)
## Description

`InputDecorator` adds a 8.0 gap beetween the container and the helper text.
From the Material 3 specification, this gap should be 4.0.
See https://m3.material.io/components/text-fields/specs#0c5c8d6d-2169-4d42-960c-51f6ee42eb57.

This PR sets the correct values for M3 without changing the value for M2.

| Before | After | M3 Spec |
|--------|--------|--------|
| ![image](https://github.com/flutter/flutter/assets/840911/9947f334-d98f-4f7e-9da7-ca6d5c0770ac) | ![image](https://github.com/flutter/flutter/assets/840911/081dec4b-eb9f-4eee-a7dc-2538e7110ff0)| ![image](https://github.com/flutter/flutter/assets/840911/c8c8f045-3b79-43a5-a1a3-cc6d5460644f) |

If this change is accepted, a future step will be to make this value configurable, probably by `InputDecorationTheme`.

## Related Issue

Fixes https://github.com/flutter/flutter/issues/144984

## Tests

Updates a value used by several existing tests.
2024-03-13 19:56:49 +00:00
Dhikshith f91614a4b9
Fix Cupertino Context Menu Container to Remove White Corners (#144883)
Fixes a visual glitch when CupertinoContextMenu is on a non-white background.
2024-03-13 12:38:28 -07:00
Jonah Williams e4c79841a3
[Impeller] remove unstable debug checked banner for zoom test. (#145097)
These tests have been flaky for impeller since it has rotated text.
2024-03-13 18:07:59 +00:00
Nate b9e537336f
Turning if chains into shorter switch statements (#144977)
This pull request is part of the effort to solve issue #144903.

In the past, my efforts to reduce line length involved refactoring away from switch statements, but unlike [yesterday's PR](https://github.com/flutter/flutter/pull/144905), this one is full of switch statements that make things more concise!
2024-03-13 17:16:17 +00:00
Victoria Ashworth 825e901e00
Set cacheExtent for SliverFillRemaining widget (#143612)
When a Sliver with items is outside of the Viewport, but within the Viewport's `cacheExtent`, the framework should create SemanticNodes for the items even though they are out of view. However, for this to work, the Sliver's geometry must have a `cacheExtent` (how much space the sliver took up of the Viewport's `cacheExtent`) greater than 0, otherwise it is [excluded](f01ce9f4cb/packages/flutter/lib/src/rendering/viewport.dart (L311-L315)).

`SliverFillRemaining` widgets that fall outside the viewport did not have this set and therefore were being excluded when SemanticNodes were created, even if they were within the Viewport's `cacheExtent`. This PR sets the `cacheExtent` for `SliverFillRemaining` widgets.

In addition, `RenderSliverFillRemainingWithScrollable` would get dropped from the semantic tree because it's child had a size of 0 when outside the remaining paint extent. To fix, we give the child a `maxExtent` of the sliver's `cacheExtent` if it's outside the remaining paint extent but within the viewport's cacheExtent.

Fixes https://github.com/flutter/flutter/issues/142065.

Definitions:
* `RenderViewport.cacheExtent`:
  ```dart
  /// The viewport has an area before and after the visible area to cache items
  /// that are about to become visible when the user scrolls.
  ///
  /// Items that fall in this cache area are laid out even though they are not
  /// (yet) visible on screen. The [cacheExtent] describes how many pixels
  /// the cache area extends before the leading edge and after the trailing edge
  /// of the viewport.
  ///
  /// The total extent, which the viewport will try to cover with children, is
  /// [cacheExtent] before the leading edge + extent of the main axis +
  /// [cacheExtent] after the trailing edge.
  ///
  /// The cache area is also used to implement implicit accessibility scrolling
  /// on iOS: When the accessibility focus moves from an item in the visible
  /// viewport to an invisible item in the cache area, the framework will bring
  /// that item into view with an (implicit) scroll action.
  ```
* `SliverGeometry.cacheExtent`:
  ```dart
  /// How many pixels the sliver has consumed in the
  /// [SliverConstraints.remainingCacheExtent].
  ```
* `SliverContraints.remainingCacheExtent`:
  ```dart
  /// Describes how much content the sliver should provide starting from the
  /// [cacheOrigin].
  ///
  /// Not all content in the [remainingCacheExtent] will be visible as some
  /// of it might fall into the cache area of the viewport.
  ///
  /// Each sliver should start laying out content at the [cacheOrigin] and
  /// try to provide as much content as the [remainingCacheExtent] allows.
  ```
2024-03-13 16:34:25 +00:00
Qun Cheng 1ccad1a2a7
Remove showTrackOnHover from Scrollbar and ScrollbarTheme (#144180)
This PR is to remove deprecated `Scrollbar.showTrackOnHover` and `ScrollbarThemeData.showTrackOnHover`.

These parameters are made obsolete in https://github.com/flutter/flutter/pull/111706.
Part of https://github.com/flutter/flutter/issues/143956
2024-03-13 16:31:50 +00:00
Bruno Leroux 34b454f42d
InputDecorator M3 tests migration - Step5 - Helper/Counter/Error (#144932)
## Description

This PR migrates `InputDecorator` helper/counter/error related tests to M3 and adds some missing tests.

It is the fifth step for the M3 test migration for `InputDecorator`.
Step 1: https://github.com/flutter/flutter/pull/142981
Step 2: https://github.com/flutter/flutter/pull/143369
Step 3: https://github.com/flutter/flutter/pull/143520
Step 4: https://github.com/flutter/flutter/pull/144169

## Related Issue

Related to https://github.com/flutter/flutter/issues/139076
fixes https://github.com/flutter/flutter/issues/138213
2024-03-13 07:16:18 +00:00
xubaolin c83237f37c
[New feature]Introduce iOS multi-touch drag behavior (#141355)
Fixes #38926

This patch implements the iOS behavior pointed out by @dkwingsmt at #38926 , which is also consistent with the performance of my settings application on the iPhone.

### iOS behavior (horizontal or vertical drag)

## Algorithm
When dragging: delta(combined) = max(i of n that are positive) delta(i) - max(i of n that are negative) delta(i)
It means that, if two fingers are moving +50 and +10 respectively, it will move +50; if they're moving at +50 and -10 respectively, it will move +40.

~~TODO~~
~~Write some test cases~~
2024-03-13 07:10:48 +00:00
Jackson Gardner 3c30e3cb20
Flutter Web Bootstrapping Improvements (#144434)
This makes several changes to flutter web app bootstrapping.
* The build now produces a `flutter_bootstrap.js` file.
  * By default, this file does the basic streamlined startup of a flutter app with the service worker settings and no user configuration.
  * The user can also put a `flutter_bootstrap.js` file in the `web` subdirectory in the project directory which can have whatever custom bootstrapping logic they'd like to write instead. This file is also templated, and can use any of the tokens  that can be used with the `index.html` (with the exception of `{{flutter_bootstrap_js}}`, see below).
* Introduced a few new templating tokens for `index.html`:
  * `{{flutter_js}}` => inlines the entirety of `flutter.js`
  * `{{flutter_service_worker_version}}` => replaced directly by the service worker version. This can be used instead of the script that sets the `serviceWorkerVersion` local variable that we used to have by default.
  * `{{flutter_bootstrap_js}}` => inlines the entirety of `flutter_bootstrap.js` (this token obviously doesn't apply to `flutter_bootstrap.js` itself).
* Changed `IndexHtml` to be called `WebTemplate` instead, since it is used for more than just the index.html now.
* We now emit warnings at build time for certain deprecated flows:
  * Warn on the old service worker version pattern (i.e.`(const|var) serviceWorkerVersion = null`) and recommends using `{{flutter_service_worker_version}}` token instead
  * Warn on use of `FlutterLoader.loadEntrypoint` and recommend using `FlutterLoader.load` instead
  * Warn on manual loading of `flutter_service_worker.js`.
* The default `index.html` on `flutter create` now uses an async script tag with `flutter_bootstrap.js`.
2024-03-12 22:41:26 +00:00
Kate Lovett eb74e5a497
Update gold validator to check for regression in flutter-gold check (#145008)
There were some recent change in flutter/cocoon. Check that the bot warns and holds up the PR as expected.
2024-03-12 20:20:51 +00:00