## 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.
<!-- 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
Fixes#169119
## Details
The error caused by drag is due to the reference to
`ServicesBinding.instance.restorationManager` in the
`ScrollableState.saveOffset` method.
018897e3f1/packages/flutter/lib/src/widgets/scrollable.dart (L648-L656)
The TestWidgetsFlutterBinding now only cleans up the
`restorationManager` when `reset` is called. Therefore, we need to find
an appropriate place to clean up the `restorationManager`.
018897e3f1/packages/flutter_test/lib/src/binding.dart (L239-L263)018897e3f1/packages/flutter_test/lib/src/widget_tester.dart (L188-L193)
## 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.
- [ ] 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].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
---------
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
<!-- start_original_pr_link -->
Reverts: flutter/flutter#177570
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: chingjun
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Broke internal tests.
<!-- 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:
Fix premature dialog dismissal on Flutter Web when semantics are enabled
by correctly propagating hitTestBehavior through the semantics pipeline
and declaring modal routes as opaque to pointer events.
Before change
https://dialog-dismiss-before.web.app/
Click on the "Show Dialog" button.
Click anywhere inside the dialog that is not a form field.
Observe the dialog being dismissed.
After change
https://dialog-dimiss-after.web.app/
Click on the "Show Dialog" button.
Click anywhere inside the dialog that is not a form field.
Observe the dialog not dismissed.
Fixes: #149001
Engine work: #176974
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
Fix premature dialog dismissal on Flutter Web when semantics are enabled
by correctly propagating hitTestBehavior through the semantics pipeline
and declaring modal routes as opaque to pointer events.
Before change
https://dialog-dismiss-before.web.app/
Click on the "Show Dialog" button.
Click anywhere inside the dialog that is not a form field.
Observe the dialog being dismissed.
After change
https://dialog-dimiss-after.web.app/
Click on the "Show Dialog" button.
Click anywhere inside the dialog that is not a form field.
Observe the dialog not dismissed.
Fixes: #149001
Engine work: #176974
<!-- start_original_pr_link -->
Reverts: flutter/flutter#165173
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: chingjun
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: The PR did not finish "Google Testing", and
actually caused several failures in Google
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: rkishan516
<!-- end_original_pr_author -->
<!-- start_reviewers -->
Reviewed By: {chunhtai, flutter-zl}
<!-- end_reviewers -->
<!-- start_revert_body -->
This change reverts the following previous change:
Feat: Add a11y for loading indicators
fixes: #161631
## 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.
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
Original PR/Discussion: https://github.com/flutter/flutter/pull/172915
# Framework:
* `EditableText`/`SelectableText`, applies
`lineHeightScaleFactorOverride`, `wordSpacingOverride`, and
`letterSpacingOverride` to it's `TextStyle` similarly to how we already
do for bold platform overrides. Note `SelectableText` is built on
`EditableText` so it also applies these overrides.
* `Text`, applies `lineHeightScaleFactorOverride`,
`wordSpacingOverride`, and `letterSpacingOverride` to it's `TextStyle`
similarly to how we already do for bold platform overrides.
* Exposes line height override through
`MediaQueryData.lineHeightScaleFactorOverride` and
`maybeLineHeightScaleFactorOverrideOf(context)`.
* Exposes letter spacing override through
`MediaQueryData.letterSpacingOverride` and
`maybeLetterSpacingOverrideOf(context)`.
* Exposes word spacing override through
`MediaQueryData.wordSpacingOverride` and
`maybeWordSpacingOverrideOf(context)`.
* Exposes paragraph spacing override through
`MediaQueryData.paragraphSpacingOverride` and
`maybeParagraphSpacingOverrideOf(context)`.
* `MediaQuery.applyTextStyleOverrides()` \
`MediaQueryData.applyTextStyleOverrides()` to be able to reset/override
the text spacing settings on `MediaQueryData`.
# Engine:
* Introduces new members on `PlatformDispatcher` API that hold the text
spacing properties that are overridden on the web.
* We provide the `lineHeightScaleFactorOverride`,
`letterSpacingOverride`, `wordSpacingOverride`, and
`paragraphSpacingOverride` on the web by attaching a `ResizeObserver` to
an off-screen hidden element, when its size changes we capture its text
spacing CSS properties, and notify the framework through
`onMetricsChanged`.
Fixes#142712https://github.com/user-attachments/assets/aaaa3e74-c232-4956-acd2-ae1a4487e415
## 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>
Feat: Add a11y for loading indicators
fixes: #161631
## 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 reverts commit ccf6466b14e144971a7d65983bdd16459d65a62a.
~This is a test PR for investigation, the commit seems to be breaking a
customer app.~
The original PR caused b/457553134
Fixes https://github.com/flutter/flutter/issues/163576
Fixes https://github.com/flutter/flutter/issues/175184
This PR refactored the grafting part on `OverlayPortal`. Originally, the
semantics tree of `OverlayPortal` was constructed/grafted in render
object phase to make sure the correctness of the traversal order.
However this resulted wrong hit-test order and the issue surfaced on
web. With the fact that on web we are not able to graft/correct hit-test
order tree, this PR:
* Reverts the original grafting of the `OverlayPortal` so the hit-test
order is always correct.
* Then, we adds the grafting and updates the traversal order when we
send `childrenInTraversalOrder` to engine.
* Updating `childrenInTraversalOrder` causes it have different length
from the length of `childrenInHitTestOrder` and wrong hit-test transform
of the `OverlayPortal` children because when the transform is
calculated, it assumes a correct traversal order. To fix these issues,
this PR also:
* recalculates the transform for `OverlayPortal` children.
* adds `hitTestTransform` property and pass it to Android engine.
* skip grafting for web because it assumes the same length of
`childrenInTraversalOrder` and `childrenInHitTestOrder`.
* added grafting by using `ARIA-owns` in web engine to fix the traversal
order.
## 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?
- Implement and test `_window_win32.dart`, the Win32 implementation of
`_window.dart` 🎉
- Wrote a bunch of tests in `window_win32_test.dart` which uses a mock
API barrier to mock the native Win32 layer
- Update `BaseWindowController` to extend `ChangeNotifier` and use it to
inform the `WindowScope` of when things change
- Made `RegularWindowController.empty()` a non-internal constructor, as
it is needed by implementations
- Added a _large_ example application for windowing where users can test
out different windowing concepts and see how they work!
To test, simply run the tests or try out the example app!
## 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.
<!-- start_original_pr_link -->
Reverts: flutter/flutter#174365
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: chunhtai
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: outdated g3fix
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: mattkae
<!-- end_original_pr_author -->
<!-- start_reviewers -->
Reviewed By: {chunhtai}
<!-- end_reviewers -->
<!-- start_revert_body -->
This change reverts the following previous change:
…o… (#174223)
This reverts commit 86327198ff0678f46cbdfb3e12f1759d03aa768d.
Reverts the revert: https://github.com/flutter/flutter/pull/174223
## 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.
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
…o… (#174223)
This reverts commit 86327198ff0678f46cbdfb3e12f1759d03aa768d.
Reverts the revert: https://github.com/flutter/flutter/pull/174223
## 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?
- The accessibility "announce" method now takes a `view_id`
- The `view_id` is used to lookup the corresponding `FlutterView` in the
win32 embedder
- Updated the associated 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.
---------
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
We need a robust way to get the duration of a route transition in tests,
so that tests can remain independent of the type of route transition and
its duration.
With this PR, this will be the canonical way to pump until a page
transition has finished:
```dart
testWidgets('example', (WidgetTester tester) async {
final TransitionDurationObserver observer = TransitionDurationObserver();
await tester.pumpWidget(
MaterialApp(
navigatorObservers: <NavigatorObserver>[observer],
onGenerateRoute: (RouteSettings settings) { ... },
),
);
expect(find.text('Page 1'), findsOneWidget);
expect(find.text('Page 2'), findsNothing);
// Pump through the whole transition.
await tester.tap(find.text('Next'));
await observer.pumpPastTransition(tester);
expect(find.text('Page 1'), findsNothing);
expect(find.text('Page 2'), findsOneWidget);
// Or, pump through part of a transition with the duration.
await tester.tap(find.text('Back'));
await tester.pump(observer.transitionDuration ~/ 2);
expect(find.text('Page 1'), findsOneWidget);
expect(find.text('Page 2'), findsOneWidget);
});
```
This was spun out of https://github.com/flutter/flutter/pull/165832,
where updating the default route transition and its duration broke tests
in the framework, in customer tests, and in Google tests.
FYI @chrisbobbe
---------
Co-authored-by: Jing Shao <87506348+jingshao-code@users.noreply.github.com>
There's today a single boolean `debugEmulateFlutterTesterEnvironment`
that determines certain behaviors in the engine to emulate how the
Flutter Tester runs (more details at
https://github.com/flutter/flutter/issues/145779).
With this PR:
- Run all engine unit tests in production mode by default.
- Give tests more granular control over which test behaviors to
enable/disable (e.g. Ahem font).
- Keep it easy for framework tests to enable all emulation behaviors.
Fixes https://github.com/flutter/flutter/issues/145779
Enhance Text Contrast for WCAG AAA Compliance #170697
- [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: chunhtai <47866232+chunhtai@users.noreply.github.com>
I could see the argument in keeping this around longer for API
compatibility, but we no longer use it, it's no longer tested, and only
really existed for the HTML-backend, which was removed, so I'm saying
remove it.
Closes https://github.com/flutter/flutter/issues/160261.