<!-- 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
## Description
This PR adds `DropdownMenuFormField.decorationBuilder` and passes it to
the underlying `DropdownMenu`.
## Related Issue
Follow-up to https://github.com/flutter/flutter/pull/176264 which added
`DropdownMenu.decorationBuilder`.
## Tests
- Adds 1 test.
Flutter needs a strong story around pausing animated GIFs because it
affects accessibility via
[MediaQueryData.disableAnimations](https://main-api.flutter.dev/flutter/widgets/MediaQueryData/disableAnimations.html).
See https://github.com/flutter/flutter/issues/175516.
### Today
Currently, it's possible to pause a gif using TickerProvider. However,
if paused on initial load, the first frame will never display, and I
believe that's a bug.
```dart
TickerMode(
// Pauses the gif, but if set to false on first load, the first frame never loads.
enabled: false,
child: Image(image: myAnimatedGif),
),
```
Currently `disableAnimations` has no effect:
```dart
MediaQuery(
// Currently has no effect on the Image, until this PR.
data: MediaQueryData(disableAnimations: true),
child: Image(image: myAnimatedGif),
),
```
### With this PR
* MediaQueryData.disableAnimations can be used to pause a gif in the
same way that TickerMode can be used today.
* If either MediaQuery.disableAnimations or TickerMode cause a gif to be
paused on first load, it will show its first frame before pausing. This
is potentially a breaking change.
* The docs clearly explain this behavior and how to pause a gif.
Fixes https://github.com/flutter/flutter/issues/175516
Partial fix for https://github.com/flutter/flutter/issues/130976
Fixes Google b/419605327
This change adds opt-in, subtree-scoped frame forcing for Flutter
animations as described in
https://github.com/flutter/flutter/issues/174356#issuecomment-3287185284
Fixes https://github.com/flutter/flutter/issues/174356
This change could help fix#133533.
## 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 PR updates the `Expansible` `maintainState` documentation in the
code, current maintainState default value is set to true while the
documentation shows '`/// Defaults to false.`
**Update**
- the PR updates the documentation to reflect the maintainState default
value without updating the maintainState value which require more
investigation and test
Fixes [issues/178045](https://github.com/flutter/flutter/issues/178045)
## 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#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>
## Changes
* Add animationStyle to Exapnsible
* Mark duration, curve and reverseCurve as deprecated
* Add data driven fixes
fixes: #177799
## 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.
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 is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the RefreshIndicator
widget.
---------
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
Android touch events include updates to multiple pointers, but each
pointer data message sent from the embedder to the framework represents
a single pointer. So the Android embedder will send multiple messages
for each touch event, and the framework's AndroidViewController will
reassemble the messages and forward the resulting event to the platform
view.
The AndroidViewController tracks the number of active pointers in its
own local state. If that state is out of sync with the event handled by
the Android embedder, then the AndroidViewController may send duplicate
events to the platform view.
This PR encodes the Android touch event's pointer count in the messages
sent to the framework. This allows the AndroidViewController to reliably
determine whether it has received all of the pointer messages that
originated from an event.
Fixes https://github.com/flutter/flutter/issues/176574
Fixes https://github.com/flutter/flutter/issues/177009
### Description
- Moves `MenuButton` submit logic from `onEditingComplete` to
`onSubmitted` to allow `TextField` to handle the `textInputAction` logic
- Wraps each item into `ExcludeFocus` to enable proper
`TextInputAction.previous` handling. If we don't wrap each child in
`ExcludeFocus`, then focus will be moved to one of them, which is not
the expected behavior for `TextInputAction.previous`.
| BEFORE | AFTER |
| - | - |
| <video alt="before"
src="https://github.com/user-attachments/assets/a50d41de-7e54-409b-bf81-80dfb1db132f"
/> | <video alt="after"
src="https://github.com/user-attachments/assets/152e47e6-d774-481c-8478-af526b5f6749"
/> |
<details closed><summary>Code sample</summary>
```dart
import 'package:flutter/material.dart';
void main() {
runApp(const DropdownMenuExample());
}
class DropdownMenuExample extends StatefulWidget {
const DropdownMenuExample({super.key});
@override
State<DropdownMenuExample> createState() => _DropdownMenuExampleState();
}
class _DropdownMenuExampleState extends State<DropdownMenuExample> {
final FocusNode _previousFocusNode = FocusNode(debugLabel: 'previous');
final FocusNode _textFieldFocusNode = FocusNode(debugLabel: 'textField');
final FocusNode _nextFocusNode = FocusNode(debugLabel: 'next');
@override
void dispose() {
_previousFocusNode.dispose();
_textFieldFocusNode.dispose();
_nextFocusNode.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: Colors.green),
home: Scaffold(
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
spacing: 20,
children: [
TextField(
focusNode: _previousFocusNode,
textInputAction: TextInputAction.next,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Previous TextField',
),
),
DropdownMenu<String>(
label: Text('Dropdown with filter cannot close keyboard'),
initialSelection: 'green',
focusNode: _textFieldFocusNode,
requestFocusOnTap: true,
showTrailingIcon: false,
textInputAction: TextInputAction.next,
onSelected: (String? color) {
print('SELECTED $color');
},
dropdownMenuEntries: [
DropdownMenuEntry(value: 'red', label: 'red'),
DropdownMenuEntry(value: 'green', label: 'green'),
DropdownMenuEntry(value: 'blue', label: 'blue'),
],
),
TextField(
focusNode: _nextFocusNode,
textInputAction: TextInputAction.done,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Next TextField',
),
),
],
),
),
),
);
}
}
```
</details>
There is still one behavior I would like to discuss. When the
`showTrailingIcon: true` and `textInputAction: TextInputAction.previous`
are used, the focus moves not to the previous field but to the
`IconButton`. If we wrap the `IconButton` with `ExcludeFocus`, then this
is fixed, but I am not sure whether this is the correct way to proceed.
| TextInputAction.previous and no ExcludeFocus on IconButton |
TextInputAction.previous and ExcludeFocus on IconButton |
| - | - |
| <video alt="before"
src="https://github.com/user-attachments/assets/76c90dcf-3ea1-492f-8e67-7e987b08c2ff"
/> | <video alt="after"
src="https://github.com/user-attachments/assets/2a1600a2-e308-430e-a12f-acdc06cbf81c"
/> |
## 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].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X] All existing and new tests are passing.
<!-- 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
FindChildIndexCallback to take seperators into account for seperated
named constructor in ListView and SliverList
fixes: #174261
## Migration guide
https://github.com/flutter/website/pull/12636
## 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 function doesn't seem to serve any purpose.
Top level is not a term we are currently using in the multi window code.
If we want to track if we have open windows, this can be done in the
Flutter framework - it doesn't need to be done at the platform level.
## Description
This PR fixes escape key not closing the menu when
`DropdownMenu.requestFocusOnTap` is false.
## Related Issue
Fixes [DropdownMenu menu panel does not close when pressing ESC and
requestFocusOnTap is
false](https://github.com/flutter/flutter/issues/177993)
Part of https://github.com/flutter/flutter/issues/123797
## Tests
- Adds 3 tests.
- Updates 2 non-related tests where I spotted some nits.
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