Commit graph

22917 commits

Author SHA1 Message Date
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
Gray Mackall d5896d5ede
Manually roll pub packages (#145005)
Manual takeover of https://github.com/flutter/flutter/pull/145003, to include some gradle lockfile changes.
2024-03-12 19:53:57 +00:00
Michael Goderbauer 77651bc496
Reland "Fail tests on exceptions raised after test completed (#144706)" (#144980)
Reverts flutter/flutter#144970

No changes in this PR compared to the original. The test failure was fixed by adding missing awaits in https://github.com/flutter/flutter/pull/144978.

Fixes https://github.com/flutter/flutter/issues/144353.
2024-03-12 18:17:10 +00:00
Michael Goderbauer e277549751
add missing awaits (#144978)
This was uncovered as part of https://github.com/flutter/flutter/pull/144706.
2024-03-12 16:51:51 +00:00
Nate 61812ca3eb
Add platform check to FocusManager app lifecycle listener (#144718)
This PR implements a temporary fix for the mobile device keyboard bug reported in [this comment](https://github.com/flutter/flutter/pull/142930#issuecomment-1981750069).

CC @gspencergoog
2024-03-12 15:43:06 +00:00
godofredoc 1ca88730a0
Update integration tests regexes. (#144847)
Some tests are assuming the flutter sdk code is being checked out to flutter and checking the code to a different repository makes them fail.

Bug: https://github.com/flutter/flutter/issues/144487
2024-03-12 01:31:25 +00:00
auto-submit[bot] 49f45d2095
Reverts "Fail tests on exceptions raised after test completed (#144706)" (#144970)
Reverts: flutter/flutter#144706
Initiated by: gspencergoog
Reason for reverting: This has broken the tree because some tests are still failing post completion. This particular one looks like it might have to do with a gold image not existing.
Original PR Author: goderbauer

Reviewed By: {Piinks}

This change reverts the following previous change:
A test was failing silently because of this (see https://github.com/flutter/flutter/issues/144353 and fixed in https://github.com/flutter/flutter/pull/144709). The failure went undetected for months. Ideally, this should have been a regular non-silent failure. This change makes that so. `package:test` can properly handle reported exceptions outside of test cases. With this change, the test fails as follows:

```
00:03 +82: Smoke test material/color_scheme/dynamic_content_color.0.dart
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test (but after the test had completed):
setState() called after dispose(): _DynamicColorExampleState#1cd37(lifecycle state: defunct, not
mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in
the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error
can occur when code calls setState() from a timer or an animation callback.
The preferred solution is to cancel the timer or stop listening to the animation in the dispose()
callback. Another solution is to check the "mounted" property of this object before calling
setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is
retaining a reference to this State object after it has been removed from the tree. To avoid memory
leaks, consider breaking the reference to this object during dispose().

When the exception was thrown, this was the stack:
#0      State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1167:9)
#1      State.setState (package:flutter/src/widgets/framework.dart:1202:6)
#2      _DynamicColorExampleState._updateImage (package:flutter_api_samples/material/color_scheme/dynamic_content_color.0.dart:191:5)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════════════════════════
00:03 +81 -1: Smoke test material/context_menu/context_menu_controller.0.dart
00:03 +81 -1: Smoke test material/color_scheme/dynamic_content_color.0.dart [E]
  Test failed. See exception logs above.
  The test description was: Smoke test material/color_scheme/dynamic_content_color.0.dart
  
  This test failed after it had already completed.
  Make sure to use a matching library which informs the test runner
  of pending async work.
```
2024-03-11 23:31:18 +00:00
Polina Cherkasova e66811ae04
Make TabController communicating creation in constructor. (#144912)
Contributes to https://github.com/flutter/flutter/issues/144910
2024-03-11 23:13:47 +00:00
Michael Goderbauer 91cccc8e6b
Fail tests on exceptions raised after test completed (#144706)
A test was failing silently because of this (see
https://github.com/flutter/flutter/issues/144353 and fixed in
https://github.com/flutter/flutter/pull/144709). The failure went
undetected for months. Ideally, this should have been a regular
non-silent failure. This change makes that so. `package:test` can
properly handle reported exceptions outside of test cases. With this
change, the test fails as follows:

```
00:03 +82: Smoke test material/color_scheme/dynamic_content_color.0.dart
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test (but after the test had completed):
setState() called after dispose(): _DynamicColorExampleState#1cd37(lifecycle state: defunct, not
mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in
the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error
can occur when code calls setState() from a timer or an animation callback.
The preferred solution is to cancel the timer or stop listening to the animation in the dispose()
callback. Another solution is to check the "mounted" property of this object before calling
setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is
retaining a reference to this State object after it has been removed from the tree. To avoid memory
leaks, consider breaking the reference to this object during dispose().

When the exception was thrown, this was the stack:
#0      State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1167:9)
#1      State.setState (package:flutter/src/widgets/framework.dart:1202:6)
#2      _DynamicColorExampleState._updateImage (package:flutter_api_samples/material/color_scheme/dynamic_content_color.0.dart:191:5)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════════════════════════
00:03 +81 -1: Smoke test material/context_menu/context_menu_controller.0.dart
00:03 +81 -1: Smoke test material/color_scheme/dynamic_content_color.0.dart [E]
  Test failed. See exception logs above.
  The test description was: Smoke test material/color_scheme/dynamic_content_color.0.dart
  
  This test failed after it had already completed.
  Make sure to use a matching library which informs the test runner
  of pending async work.
```
2024-03-11 16:05:24 -07:00
Nate 26e379e0fc
Refactoring if chains into switch statements (#144905)
Based on issue #144903, this PR aims to bring the codebase more in line with the [Flutter repo style guide](https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#avoid-using-if-chains-or--or--with-enum-values):

> #### Avoid using `if` chains or `?:` or `==` with enum values

<br>

This change unfortunately increases the total line length, but it also improves readability.
2024-03-11 23:04:57 +00:00
auto-submit[bot] 187ec75eb5
Reverts "Expose build mode in environment of asset transformer processes (#144752)" (#144957)
Reverts: flutter/flutter#144752
Initiated by: andrewkolos
Reason for reverting: compilation issue has turned the tree red
Original PR Author: andrewkolos

Reviewed By: {christopherfujino}

This change reverts the following previous change:
In service of https://github.com/flutter/flutter/issues/143348

When invoking a package to transform an asset, we set `FLUTTER_BUILD_MODE` to the CLI name of the build mode being used. Inspired by https://github.com/flutter/flutter/issues/101077#issuecomment-1890379501:

> Do transformers know whether they get executed in debug or release mode? I kinda imagine that being useful. Ex: There's a transformer that optimizes the file size of images. Depending on the amount and size of the images, that could take a significant amount of time. Therefore, I might want to only execute it in release builds.

Note for the reviewer: the interesting part of this change can be found in the commit [set environment variable to build mode when running asset transformer…](579912d470). The rest of the change is updating call sites with a new argument.
2024-03-11 21:00:17 +00:00
Andrew Kolos 83fad74535
Expose build mode in environment of asset transformer processes (#144752)
In service of https://github.com/flutter/flutter/issues/143348

When invoking a package to transform an asset, we set `FLUTTER_BUILD_MODE` to the CLI name of the build mode being used. Inspired by https://github.com/flutter/flutter/issues/101077#issuecomment-1890379501:

> Do transformers know whether they get executed in debug or release mode? I kinda imagine that being useful. Ex: There's a transformer that optimizes the file size of images. Depending on the amount and size of the images, that could take a significant amount of time. Therefore, I might want to only execute it in release builds.

Note for the reviewer: the interesting part of this change can be found in the commit [set environment variable to build mode when running asset transformer…](579912d470). The rest of the change is updating call sites with a new argument.
2024-03-11 20:39:31 +00:00
victorgalo b9afa60fdd
Skip test temporarily until headingLevel is added in engine (issue 41… (#135077)
The purpose of this PR is to temporarily skip one integration test that is blocking the changes indicated below:

(This change adds a new property in Semantics widget that would take an integer corresponding to the heading levels defined by the ARIA heading role. This is necessary in order to get proper accessibility and usability in a website for users who rely on screen readers and other assistive technologies.)

Issue fixed by this PR:
https://github.com/flutter/flutter/issues/97894

Engine part:
https://github.com/flutter/engine/pull/41435 

Framework part:
https://github.com/flutter/flutter/pull/125771
2024-03-11 16:31:21 +00:00
Ian Hickson dbcce277f3
Rename isAvailableForEnvironment to isForEnvironment (#143176) (#144858)
This is part 4 of a broken down version of the #140101 refactor.

This PR renames isAvailableForEnvironment to isForEnvironment and replaces a regular expression with a simple function. (The latter will change the behaviour for people with branch names like `mainly_refactors` or `chess_master_experiment` or whatever, but I'm pretty sure the old behaviour was not intended.)

----

This is a reland of https://github.com/flutter/flutter/pull/143176 which was speculatively reverted in https://github.com/flutter/flutter/pull/144855 but turned out not to be the cause of the tree redness.
2024-03-10 06:20:38 +00:00
yim f733e3a441
Fix multiple calls to Slider's onChanged. (#143680)
Fixes #143524
2024-03-09 07:50:23 +00:00
Polina Cherkasova a04fe3169a
Upgrade vm_service. (#144845) 2024-03-08 17:09:07 -08:00
Percival cab4a0fb88
Replace dead links (#144827)
I have found that some Apple-related links are no longer accessible, and they have been replaced
2024-03-09 01:08:06 +00:00
auto-submit[bot] 0432a6941d
Reverts "Rename isAvailableForEnvironment to isForEnvironment (#143176)" (#144855)
Reverts: flutter/flutter#143176
Initiated by: QuncCccccc
Reason for reverting: made tree red.
Original PR Author: Hixie

Reviewed By: {Piinks}

This change reverts the following previous change:
This is part 4 of a broken down version of the #140101 refactor.

This PR renames isAvailableForEnvironment to isForEnvironment and replaces a regular expression with a simple function. (The latter will change the behaviour for people with branch names like `mainly_refactors` or `chess_master_experiment` or whatever, but I'm pretty sure the old behaviour was not intended.)
2024-03-08 23:19:15 +00:00
Ian Hickson 5bd34ef541
Rename isAvailableForEnvironment to isForEnvironment (#143176)
This is part 4 of a broken down version of the #140101 refactor.

This PR renames isAvailableForEnvironment to isForEnvironment and replaces a regular expression with a simple function. (The latter will change the behaviour for people with branch names like `mainly_refactors` or `chess_master_experiment` or whatever, but I'm pretty sure the old behaviour was not intended.)
2024-03-08 20:20:13 +00:00
Mitchell Goodwin 2be5084b26
Fixes the transition builder changing the Cupertino transition on Android. (#134790)
Fixes #124850.

Changes the fallback for the builder on Android. Before the error was from the platform being changed mid Cupertino transition to iOS. If a default builder wasn't set for iOS (which a developer developing only for Android might not), then it defaulted to the Zoom transition. Which changing the transition while on the fly caused issues.
2024-03-08 19:00:16 +00:00
Jackson Gardner 074114b85a
Copy over source maps from dart2js target when they are enabled. (#144832)
This fixes https://github.com/flutter/flutter/issues/143703

We need to make sure that when source maps are enabled for the dart2js target, it advertises the sourcemap file as one of its outputs so that the web release bundle can copy it over.
2024-03-08 18:56:18 +00:00
Martin Kustermann 7c89ec8bbc
Remove toString() overrides in dart:ui/package:flutter in profile/release mode on wasm/vm targets (#144763)
The flutter engine & framework can opt out of this optimization for
individual classes / class hierarchies via:

  * `@pragma(flutter:keep-to-string)`
  * `@pragma(flutter:keep-to-string-in-subtypes)`

Or by using the convenience constant `@keepToString` from `dart:ui`.

=> This aligns the build process more with g3 (which already does this)

Closes https://github.com/flutter/flutter/issues/52759
2024-03-08 09:55:02 +01:00
Loïc de Porcaro dde616dbe1
Update documentation of AlertDialog's default TextStyle for Material 3 (#144697)
## Update `AlertDialog` Documentation for Material 3 Defaults

This pull request updates the documentation for `AlertDialog` to accurately reflect the default text styles (`titleTextStyle` and `contentTextStyle`) when using Material 3.
Previously, the documentation suggested default styles (`TextTheme.titleLarge` for titles and `TextTheme.titleMedium` for content) that do not align with Material 3 implementation, which uses `TextTheme.headlineSmall` and `TextTheme.bodyMedium` respectively.

Fixes #144489
2024-03-08 00:21:35 +00:00
Andrew Kolos 06ac042271
Enable asset transformation for flutter run -d <browser> and flutter test (#144734)
Partial implementation of https://github.com/flutter/flutter/issues/143348.

The title says it all. Feel free to experiment with the feature using this project: https://github.com/andrewkolos/asset_transformers_test.
2024-03-07 23:38:40 +00:00
August dc6f94a878
refactor: Remove throwOnPluginPubspecError flag for plugin validation (#144214)
Part of #137040 and #80374

The flag `throwOnPluginPubspecError` never actually was enabled during production in #79669, but only in some dart plugin tests. And in the tests the case of the error when enabling the flag was not explicitly tested. The only thing tested was, that it is not thrown when disabled.

As explained [here](https://github.com/flutter/flutter/pull/142035#discussion_r1484237904) the only case, where this error could be thrown is, when a dart implementation and a native inline implementation are provided simultaneously. But throwing an exception there is a wrong behavior, as both can coexist in a plugin package, thus in the pubspec file.

Disabling the flag means, that the error is not thrown and not shown to the user. This is the case in production (contrary to the dart plugin tests), which acts like these plugin cases of implementations are just skipped. And this is what actually should be done.

In conclusion, I think the case of coexisting dart and native implementation in pubspec was just overlooked and therefore this error validation was introduced, which is not necessary or even valid.

For more discussion, see: https://discord.com/channels/608014603317936148/608022056616853515/1200194937791205436

  - This is tricky: I already added a test in #142035, which finally complies with the other tests, by removing the flag. So I think it falls in the category of "remove dead code".
  - Theoretically this is a breaking change, as removing / altering some tests. But the flag actually was never valid or used, so IDK. But this may not does fall in the category of "contributed tests".
2024-03-07 23:04:08 +00:00
Faisal Ansari 874804e511
Fixed -> DropdownMenu throws exception when it is in any scrollable l… (#140566)
Fixed -> DropdownMenu throws exception when it is in any scrollable list view and scrolls quickly #139871
2024-03-07 20:46:03 +00:00
Christopher Fujino 2dd06d10c9
[flutter_tools] add custom tool analysis to analyze.dart, lint Future.catchError (#140122)
Ensure tool code does not use Future.catchError or Future.onError, because it is not statically safe: https://github.com/dart-lang/sdk/issues/51248.

This was proposed upstream in dart-lang/linter in https://github.com/dart-lang/linter/issues/4071 and https://github.com/dart-lang/linter/pull/4068, but not accepted.
2024-03-07 18:10:07 +00:00
Bruno Leroux 471a82856d
[flutter_test] Use defaultTargetPlatform for key events simulation (#143579)
## Description

This PRs changes the default value for the `platform` parameter used to simulate key events.

With this PR, the default value is "web" on web, otherwise it is the operating system name retrieved from `defaultTargetPlatform`.

Previously, for methods in `WidgetController`, it defaulted to “web” on web, and “android” everywhere else. And for methods in `KeyEventSimulator` it defaulted to “web” on web, and the operating system that the test was running on everywhere else. Because the operating system was based on `Platform.operatingSystem`, it usually differed from the target platform the test was running on.

AFAIK, the `platform` parameter is only meaningful for simulating `RawKeyEvent`. Once `RawKeyboard` will be fully removed, the `platform` parameter won’t be needed. 
@gspencergoog  In the meantime, do you think it is worth merging this fix?

## Related Issue

Fixes to https://github.com/flutter/flutter/issues/133955

## Tests

Adds one test.
2024-03-07 16:08:20 +00:00
Matej Knopp de72832079
Fix frameworks added to bundle multiple times instead of lipo (#144688)
*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-07 15:09:15 +00:00
Bruno Leroux 8ade81fb20
[flutter_test] Change KeyEventSimulator default transit mode (#143847)
## Description

This PRs changes the default value transit mode for key event simulation.

The default transit mode for key event simulation is currently `KeyDataTransitMode.rawKeyData` while on the framework side `KeyDataTransitMode.keyDataThenRawKeyData` is the preferred transit mode.

`KeyDataTransitMode.keyDataThenRawKeyData` is more accurate and can help detect issues.

For instance the following test will fail with `KeyDataTransitMode.rawKeyData` because raw keyboard logic for modifier keys is less accurate:

```dart
  testWidgets('Press control left once', (WidgetTester tester) async {
    debugKeyEventSimulatorTransitModeOverride = KeyDataTransitMode.keyDataThenRawKeyData;

    final List<KeyEvent> events = <KeyEvent>[];
    final FocusNode focusNode = FocusNode();
    addTearDown(focusNode.dispose);

    await tester.pumpWidget(
      Focus(
        focusNode: focusNode,
        autofocus: true,
        onKeyEvent: (_, KeyEvent event) {
          events.add(event);
          return KeyEventResult.handled;
        },
        child: Container(),
      ),
    );

    await simulateKeyDownEvent(LogicalKeyboardKey.controlLeft);

    // This will fail when transit mode is KeyDataTransitMode.rawKeyData
    // because a down event for controlRight is synthesized.
    expect(events.length, 1);

    debugKeyEventSimulatorTransitModeOverride = null;
  });
```

And the following this test is ok with `KeyDataTransitMode.rawKeyData` but rightly fails with `KeyDataTransitMode.keyDataThenRawKeyData`:

```dart
  testWidgets('Simulates consecutive key down events', (WidgetTester tester) async {
    debugKeyEventSimulatorTransitModeOverride = KeyDataTransitMode.rawKeyData;

    // Simulating several key down events without key up in between is tolerated
    // when transit mode is KeyDataTransitMode.rawKeyData, it will trigger an
    // assert on KeyDataTransitMode.keyDataThenRawKeyData.
    await simulateKeyDownEvent(LogicalKeyboardKey.arrowDown);
    await simulateKeyDownEvent(LogicalKeyboardKey.arrowDown);

    debugKeyEventSimulatorTransitModeOverride = null;
  });
```

## Related Issue

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

## Tests

Adds two tests.
2024-03-07 07:19:26 +00:00
Valentin Vignal 96dd1984ec
Fix memory leak in editable_gesture_test.dart (#144691) 2024-03-06 17:51:54 -08:00