reland of https://github.com/flutter/flutter/pull/171927
towards https://github.com/flutter/flutter/issues/171790
Use the content aware hash when downloading engine artifacts. These are
currently produced when changes to DEPs, engine/, or the release file
are changed in a not-seen-before way.
We can eventually remove engine.version being tracked in release
branches as an optimization.
FLUTTER_PREBUILT_ENGINE_VERSION will stay for overriding the
engine.version for testing. Though Cocoon does not need to actually set
it for framework only PRs anymore.
fxies post submit tests for content_hash download:
SHARD=framework_tests SUBSHARD=misc dart --enable-asserts
dev/bots/test.dart
SHARD=tool_host_cross_arch_tests dart --enable-asserts
dev/bots/test.dart
```
╔═╡ERROR https://github.com/flutter/flutter/pull/1╞════════════════════════════════════════════════════════════════════
║ Expected "Flutter Engine Version: 45b085ab2118f30441ae6e2daab4b8eb3e4a063c", but found "Flutter Engine Version: 407c051ec9".
╚═══════════════════════════════════════════════════════════════════════════════
```
```
Expected: contains '45b085ab2118f30441ae6e2daab4b8eb3e4a063c'
Which: does not contain '45b085ab2118f30441ae6e2daab4b8eb3e4a063c'
```
## Description
Enable specifying a custom statesController to the IconButton widget.
This increase consistency since other widgets expose this property as
well.
## Related Issues
- Closes https://github.com/flutter/flutter/issues/139372
## 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#171927
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Broke the tree, due to naughty tests but too
intensive to fix forward.
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: jtmcdole
<!-- end_original_pr_author -->
<!-- start_reviewers -->
Reviewed By: {matanlurey, chingjun}
<!-- end_reviewers -->
<!-- start_revert_body -->
This change reverts the following previous change:
towards #171790
Use the content aware hash when downloading engine artifacts. These are
currently produced when changes to DEPs, engine/, or the release file
are changed in a not-seen-before way.
We can eventually remove `engine.version` being tracked in release
branches as an optimization.
`FLUTTER_PREBUILT_ENGINE_VERSION` will stay for overriding the
engine.version for testing. Though Cocoon does not need to actually set
it for framework only PRs anymore.
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
This PR introduces a new boolean flag, `isMomentary`, to the
`CupertinoSlidingSegmentedControl` widget.
When `isMomentary` is set to `true`, the segmented control behaves like
a momentary switch. Selecting a segment triggers its associated action
(e.g., via `onValueChanged`), but the segment doesn't stay visually
selected after the interaction ends. The control visually returns to its
previous state or a default state (often no segment selected).
When `isMomentary` is `false` (the default behavior), the control
maintains the selection state visually, highlighting the last chosen
segment.
**Motivation**
Currently, `CupertinoSlidingSegmentedControl` always maintains a
selected state. There are use cases where developers might want to use
the segmented control purely for triggering actions without persisting a
visual selection state, similar to how a `UISegmentedControl` can be
configured on iOS with `isMomentary = true`. This provides more
flexibility and aligns the Flutter widget closer to its native
counterpart's capabilities.
For example, this could be useful for triggering sorting actions, view
changes, or other immediate operations where maintaining a persistent
"selected" state isn't desired or meaningful.
**Related Issues**
fixes: #164077
**Videos**
UISegmentedControl behaviour when `isMomentary` flag is set to true.
https://github.com/user-attachments/assets/84d00312-4530-4b7a-9696-142f60ad89c0
CupertinoSlidingSegmentedControl behaviour when `isMomentary` flag is
set to true.
https://github.com/user-attachments/assets/b308b4fa-e641-417a-a518-4e0908876eed
## 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.
We already use the baseUri when computing hot reload sources metadata as
it can never be null. The member is changed to be non-nullable to
reflect that.
To be consistent, we also use the baseUri (full url) for a hot restart
when running with the DDC library bundle format.
Related PR: https://github.com/dart-lang/webdev/pull/2650
## 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].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] 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].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
towards #171790
Use the content aware hash when downloading engine artifacts. These are
currently produced when changes to DEPs, engine/, or the release file
are changed in a not-seen-before way.
We can eventually remove `engine.version` being tracked in release
branches as an optimization.
`FLUTTER_PREBUILT_ENGINE_VERSION` will stay for overriding the
engine.version for testing. Though Cocoon does not need to actually set
it for framework only PRs anymore.
The version of flutter_lints used by newly created projects should match
the version used by flutter_tools. This ensures that "pub get --offline"
will work on a project that was generated by "flutter create".
Also restore the Mac tool_tests_commands that were temporarily disabled
in https://github.com/flutter/flutter/pull/172388
Fixes https://github.com/flutter/flutter/issues/172375
Closes https://github.com/flutter/flutter/issues/61246.
I open to doing this behind a flag, but given we decided already 5 years
ago to do this, I'm leaning limiting this to an announcement
(`flutter-announce@`) and just landing this cleanup.
Open to suggestions.
This PR makes platform views ignore pointer events when they're not laid
out.
Platform views register themselves for global pointer events when their
RenderBox attaches:
9c626d9f9a/packages/flutter/lib/src/rendering/platform_view.dart (L370-L380)
But a RenderBox that is attached is not necessarily laid out. The
problem in the issue seemed to be that a page was created offscreen
(attached and not laid out), but it still received pointer events, and
this caused errors with using `size` before layout.
This PR simply ignores pointer events when not laid out.
Fixes https://github.com/flutter/flutter/issues/83481
feat: Add `maxCount` parameter to `Badge.count` constructor
This enhancement provides the ability to specify a **dynamic maximum
limit** for the badge count, offering greater flexibility and
eliminating the reliance on hardcoded values within the widget. This
allows developers to, for example, display "99+" instead of "100" or
"9+" instead of "10", improving UI consistency and preventing overly
large numbers on badges.
---
## Description of Changes
This PR introduces a new optional parameter, `maxCount`, to the
`Badge.count` constructor. This provides a flexible way to define a
numerical upper bound for the badge display.
Key aspects of this change:
* **Dynamic Limits:** Developers can now set custom maximum values
(e.g., 9, 99, 999) that, when exceeded, will display the `maxCount`
value followed by a `+` symbol (e.g., "9+", "99+").
* **Improved UI/UX:** Prevents large, potentially overflowing numbers
from appearing on badges, maintaining visual integrity and a cleaner
user interface.
* **Reduced Hardcoding:** Centralizes the logic for maximum badge values
within the `Badge` widget itself, reducing the need for manual checks
and conditional rendering outside the widget.
* **Comprehensive Documentation:** Includes updated API documentation
for the `maxCount` parameter, clarifying its usage, behavior, and the
visual outcome when the maximum is reached.
This change aligns with Flutter's principles of providing highly
customizable and intuitive widgets.
---
## 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. (Assuming no breaking changes)
- [X] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
[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
The `frameworkVersion` string written to the version files wasn't
actually parsable by `GitTagVersion` as it didn't match the format
output by `git`.
This change updates the `frameworkVersion` format to use a `-` instead
of a `.` before the commit count and adds support to the version parsing
regex to handle both `.` and `-` separators before the commit count.
Fixes https://github.com/flutter/flutter/issues/172091
Issues have been solved, we can now have the tests back
## 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].
- [ ] 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.
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>
Adds support for a subset of the DTD `Editor` service registered by IDEs
for use by the widget preview scaffold. Currently, this feature subset
includes support for listening for:
- Source file selection events
- Editor theme change events
This change does not introduce any new functionality that makes use of
these new DTD `Editor` events.
Description
This PR fixes an accessibility issue where CheckedPopupMenuItem was not
properly announcing its checked state to screen readers.
Before
https://github.com/user-attachments/assets/b1785522-eea4-4fc3-9a9a-1872615838c0
After
Demo app: https://checked-0707.web.app/https://github.com/user-attachments/assets/a8083c0b-11c8-4e93-bd71-842dfe5fa344
Issues Fixed
This PR fixes https://github.com/flutter/flutter/issues/171463.
Breaking Changes
None.
## 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.