## What's new?
This pull request makes it so that multi window applications can be
tested via `testWidgets`. This PR implements the following:
- A `_TestWindowingOwner` that is used by the
`TestWidgetsFlutterBinding`
- A `_TestRegularWindowController` implementation
- A `_TestDialogWindowController` implementation
- A `_TestFlutterView` and `_TestDisplay` for use by the controllers
- Proper `isActivated` status across controllers
- Proper minimization, maximization, and fullscreen status
- Proper sizing (based on constraints)
- Using the new testing abilities in the multiple windows example app
I have purposefully not implemented tooltip windows yet, as they are
still awaiting an implementation in Win32 to be useful.
## 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.
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoContextMenuAction widget.
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoCheckbox
widget.
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoApp
widget.
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
## Description
This PR updates some comments in various widgets to reflect the changes
related to Theme normalization.
## Related Issue
Related to https://github.com/flutter/flutter/issues/91772
## Tests
- Documentation only
Fixed an issue #169659
This PR improves the StretchingOverscrollIndicator to better match
native Android behavior.
- Previously, the stretch effect worked well only for slow dragging, and
during fast flings it was absent or felt clipped.
- Implemented a Simulation-based animation that responds naturally to
both slow drags and high-velocity flings.
- The result closely resembles the native Android overscroll behavior
while maintaining Flutter's performance characteristics.
This change ensures that momentum-based gestures produce a more natural
and intuitive overscroll experience, especially for users accustomed to
native Android scroll views.
## Fling
[fling](https://github.com/user-attachments/assets/3944eef3-baaa-47df-82ca-9c49d4283fe4)
## Pull And Reduce
Also, a very similar animation is implemented when pulling as well.
[pull](https://github.com/user-attachments/assets/2a3025dc-0996-403d-b58b-d07f25487cda)
## 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.
---------
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
This change allows for users to open an instance of the DevTools Widget
Inspector within a web view embedded in the widget previewer. This will
allow for developers to inspect their previews without requiring IDEs to
create a special debug session for the widget previewer application.
DWDS is also rolled as part of this change to add DDS and DevTools
support for the `web-server` device.
Fixes https://github.com/flutter/flutter/issues/166423
**Demo:**
https://github.com/user-attachments/assets/3e3a1098-0526-4c7f-8087-38fb84f28335
Refactoring of code in `package:dwds` `26.2.1` changed execution
ordering enough for a race condition in the web benchmark harness to be
hit. This change updates the web benchmark harness to not rely on
waiting for console output from the spawned browser which can be missed.
Fixes https://github.com/flutter/flutter/issues/178326
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
## Description
This PR adds `DropdownMenu.selectOnly`. This property allows users to
get the DropdownMenu behave as a 'select' component.
It is meant as a future replacement for
`DropdownMenu.requestFocusOnTap`.
## Motivation
On mobile, a dropdown menu widget is usually used as a ‘select’ widget
because opening the keyboard for searching/filtering is not convenient.
In Flutter, this is currently implemented through
`DropdownMenu.requestFocusOnTap` which defaults to false on mobile and
true on desktop.
The `DropdownMenu.requestFocusOnTap` property is currently used to set
`FocusNode.canRequestFocus`. This leads do difficulties mainly related
to focus traversal:
- Keyboard traversal requires workarounds (for instance relying on the
trailing icon to be focusable).
- Keyboard shortcuts require also a workaround (currently relying on a
Focus widget in a Stack).
- The `DropdownMenu` decoration does not reflect the focus state.
This PR proposes a new property named `DropdownMenu.selectOnly` which
does not require `DropdownMenu.requestFocusOnTap` to be false to make
the `DropdownMenu` behave like a select widget.
With this property the `DropdownMenu`:
- Supports keyboard navigation on mobile and desktop.
- Has a correct decoration when focused.
- Does not rely on the trailing icon to be focusable (see
https://github.com/flutter/flutter/issues/174096).
In the future this property could be used as a replacement for
`DropdownMenu.requestFocusOnTap`. For the moment, for compatibility, it
does not replace `DropdownMenu.requestFocusOnTap`.
## Related Issue
Fixes [Allow DropdownMenu to be non-editable and focusable (select
control) ](https://github.com/flutter/flutter/issues/178009)
Also related to [Make DropdownMenu's trailing icon not focusable by
default](https://github.com/flutter/flutter/issues/174096) and
[[Material3] DropdownMenu Keyboard
Accessibility](https://github.com/flutter/flutter/issues/123797).
## Tests
- Adds 9 tests.
## Description
This PR updates [BottomNavigationBar.selectedItemColor] and
[BottomNavigationBar.unselectedItemColor] documentation to reflect the
changes related to theme normalization.
It also fixes the [BottomNavigationBar.selectedItemColor] documentation
to mention the correct default values.
## Related Issue
Related to https://github.com/flutter/flutter/issues/91772
## Tests
- Documentation only
This change fixes a crash in `EditableText` that occurs when the text
editing value changes between two scrolls, when the second scroll ends
`_dataWhenToolbarShowScheduled` will be invalidated. If the second
scroll ends before the post frame callback scheduled by the first scroll
has a chance to execute, there will be a crash because
`_dataWhenToolbarShowScheduled` is being accessed while null.
This change also invalidates a scheduled toolbar if the text editing
value has changed before the post-frame callback has a chance to run.
Fixes#179164
## 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.
---------
Co-authored-by: Renzo Olivares <roliv@google.com>
Instead of generating assembly code that is then compiled to a Mach-O
dynamic library, use the new app-aot-macho-dylib output option for
gen_snapshot to generate the Mach-O dynamic library without the assembly
step.
This is a reland of https://github.com/flutter/flutter/pull/171626, with
the necessary changes to avoid the issue found in
https://github.com/flutter/flutter/issues/174393 where DWARF information
was being retained in the final snapshot. The initial PR state are the
original commits landed in the previous PR, with a followup commit
containing the fix for that issue: the DWARF information is moved into
an associated relocatable object, so the information is still accessible
by dsymutil before the snapshot is stripped.
Related issues:
* https://github.com/dart-lang/sdk/issues/43299
* https://github.com/dart-lang/sdk/issues/60307
## 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.
## What's new?
- While coming up with a scheme for testing multi-window, I realize that
issuing taps in `testWidgets` across views was not working because the
view was always being set to `0`
- The fix is to resolve the view when we can, and provide an optional
view in the other methods
## 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.
## Description
This PR updates some comments in AppBar, Banner and BottomAppBar to
reflect the changes related to Theme normalization.
## Related Issue
Related to https://github.com/flutter/flutter/issues/91772
## Tests
- Documentation only
Before this change, there was logic in `flutter attach` that would try
and listen for a new application to attach to in the scenario the
current target application disappeared. This behavior isn't documented,
and has resulted in a `StateError` being thrown due to the VM service
URIs stream being listened to multiple times.
This change removes this behavior, which also prevents the `StateError`
from being thrown.
Fixes https://github.com/flutter/flutter/issues/156692, which is a
top-10 crasher for the tool.
This change fixes an issue where the preview command would crash if a
`pubspec.yaml` was added / deleted somewhere under the previewed
directory. It also improves testing for `PreviewManifest` in the context
of pub workspaces and ensures that `FlutterProject` instances are
refreshed based on the latest `pubspec.yaml` contents.
Fixes https://github.com/flutter/flutter/issues/179155
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
To ensure build hooks emit code assets that are compatible with the main
app, Flutter tools pass a `CCompilerConfig` toolchain configuration
object to hooks. This is generally what we want, hooks on macOS should
use the same `clang` from XCode as the one used to compile the app and
native Flutter plugins for instance.
In some cases however, we need to run hooks without necessarily
compiling a full Flutter app with native sources. A good example for
this is `flutter test`, which runs unit / widget tests in a regular Dart
VM without embedding it in a Flutter application. So since `flutter
test` wouldn't invoke a native compiler, running build hooks shouldn't
fail if the expected toolchain is missing.
Currently however, `flutter test` tries to resolve a compiler toolchain
for the host platform. Doing that on Windows already allows not passing
a `CCompilerConfig` if VSCode wasn't found, but on macOS and Linux, this
crashes. This fixes the issue by allowing those methods to return `null`
instead of throwing. They still throw by default, but for the test
target they are configured to not pass a toolchain to hooks if none
could be resolved. This means that hooks not invoking the provided
toolchain (say because they're only downloading native artifacts
instead) would now work, whereas previously `flutter test` would crash
if no toolchian was found.
This closes https://github.com/flutter/flutter/issues/178715 (but only
the part shared in the original issue description, @dcharkes suggested
fixing a similar issue in the same PR but that is _not_ done here).
<!-- start_original_pr_link -->
Reverts: flutter/flutter#178817
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: Piinks
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: change was landed during tree closure
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: flutter-zl
<!-- end_original_pr_author -->
<!-- start_reviewers -->
Reviewed By: {chunhtai}
<!-- end_reviewers -->
<!-- start_revert_body -->
This change reverts the following previous change:
This is a reland of #177570, which was reverted in #178744 due to test
failures.
The original PR introduced `hitTestBehavior` to the semantics framework
but incorrectly applied `opaque` behavior to `ModalRoute`, which blocked
platform views from receiving pointer events.
Instead of making the entire modal opaque, we:
1. Keep `ModalRoute` without explicit `hitTestBehavior` (defaults to
`defer`)
2. Make only the dialog/sheet content opaque (blocks clicks to barrier)
3. Platform views remain clickable because they're outside the opaque
content boundary
Fixes#149001
Original PR: #177570
Revert: #178744
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
This is a reland of #177570, which was reverted in #178744 due to test
failures.
The original PR introduced `hitTestBehavior` to the semantics framework
but incorrectly applied `opaque` behavior to `ModalRoute`, which blocked
platform views from receiving pointer events.
Instead of making the entire modal opaque, we:
1. Keep `ModalRoute` without explicit `hitTestBehavior` (defaults to
`defer`)
2. Make only the dialog/sheet content opaque (blocks clicks to barrier)
3. Platform views remain clickable because they're outside the opaque
content boundary
Fixes#149001
Original PR: #177570
Revert: #178744
## What's new?
- Added tooltips to the windowing API, but they have no implementation
for the time being
- Added the `WindowPostiioner` logic to the windowing API
- Wrote a lot of tests 🧪
## 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.
Fixes https://github.com/flutter/flutter/issues/173097
The semantics flush is ~200 μs slower with the shortcuircut removed +
#177477 (which reduces the time increase by ~ 100 μs, from 876 μs to 773
μs) I tried to introduce caching in [a different
patch](https://github.com/flutter/flutter/compare/master...LongCatIsLooong:semantics-geometry?expand=1)
but that patch is more risky and still needs a cleanup.
773 μs doesn't seem bad considering there were little to no geometry
updates between frames before the fix. Introducing cache currently only
improves `Semantics.ensureGeometry` by less than 100 μs and is much more
risky / harder to ensure the correctness.
### BEFORE
```
[bench_material3_scroll_semantics] name: bench_material3_scroll_semantics
SEMANTICS: (samples: 98 clean/2 outliers/100 measured/300 total)
| average: 567.0510204081633 μs
| outlier average: 799 μs
| outlier/clean ratio: 1.4090442856885785x
| noise: 13.95%
Semantics.updateChildren: (samples: 91 clean/9 outliers/100 measured/300 total)
| average: 58.9010989010989 μs
| outlier average: 199.88888888888889 μs
| outlier/clean ratio: 3.3936359867330017x
| noise: 82.78%
Semantics.ensureGeometry: (samples: 95 clean/5 outliers/100 measured/300 total)
| average: 95.46315789473684 μs
| outlier average: 299 μs
| outlier/clean ratio: 3.1320983570404675x
| noise: 64.29%
Semantics.ensureSemanticsNode: (samples: 100 clean/0 outliers/100 measured/300 total)
| average: 78.59 μs
| outlier average: 78.59 μs
| outlier/clean ratio: 1x
| noise: 80.86%
drawFrameDuration: (samples: 98 clean/2 outliers/100 measured/300 total)
| average: 1685.6938775510205 μs
| outlier average: 2000 μs
| outlier/clean ratio: 1.1864550418285935x
| noise: 7.77%```
```
### AFTER (with this and https://github.com/flutter/flutter/pull/177477)
```
[bench_material3_scroll_semantics] name: bench_material3_scroll_semantics
SEMANTICS: (samples: 91 clean/9 outliers/100 measured/300 total)
| average: 773.1098901098901 μs
| outlier average: 1000 μs
| outlier/clean ratio: 1.2934771793669069x
| noise: 10.65%
Semantics.updateChildren: (samples: 94 clean/6 outliers/100 measured/300 total)
| average: 48.648936170212764 μs
| outlier average: 200 μs
| outlier/clean ratio: 4.111086813907719x
| noise: 102.15%
Semantics.ensureGeometry: (samples: 95 clean/5 outliers/100 measured/300 total)
| average: 239.55789473684212 μs
| outlier average: 399.6 μs
| outlier/clean ratio: 1.6680727656208807x
| noise: 22.05%
Semantics.ensureSemanticsNode: (samples: 99 clean/1 outliers/100 measured/300 total)
| average: 194.5151515151515 μs
| outlier average: 400 μs
| outlier/clean ratio: 2.0563950771148156x
| noise: 31.31%
drawFrameDuration: (samples: 95 clean/5 outliers/100 measured/300 total)
| average: 1775.8315789473684 μs
| outlier average: 2099.6 μs
| outlier/clean ratio: 1.1823193285280729x
| noise: 7.56%
```
## 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].
**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#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/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md