22150 Commits

Author SHA1 Message Date
Kostia Sokolovskyi
e8d9d9bfd5
HeroController should dispatch creation and disposal events. (#137835) 2023-11-03 20:42:47 -07:00
Alex Isaienko
b5fb6652d6
InheritedElement.removeDependent() (#129210)
Call the `dependency.removeDependent(this)` instead of `dependency._dependents.remove(this)` inside the `Element.deactivate()`. This allows `InheritedElements` to know when they can release resources associated with a given dependent `Element`.

Fixes #129207
2023-11-03 23:27:21 +00:00
Michael Goderbauer
8a0f9118ea
Remove unused generic type from BottomSheet (#137791)
Fixes https://github.com/flutter/flutter/issues/137424.

The generic type argument was unused.
2023-11-03 22:25:37 +00:00
Daco Harkes
7634609062
Pin dart-lang/native dependencies (#137601)
Pin the dependencies from dart-lang/native to a specific version during testing (rather than having them auto-upgrade during pub resolution). This will prevent tests using the template to start failing if a bad version is published to pub.

Closes: https://github.com/flutter/flutter/issues/137418

Also bumps dep in flutter_tools.
2023-11-03 22:16:04 +00:00
Chris Bracken
4455e86d90
Send caret rect to embedder on selection update (#137863)
Background: In the framework, the position of the caret rect is updated on each cursor position change such that if the user initiates composing input, the current cursor position can be used for the first character until the composing rect can be sent.

Previously, no update was sent on selection changes, on the assumption that the most recent cursor position will remain the correct position for the duration of the selection. While this is the case for forward selections, it is an incorrect assumption for reversed selections, where selection.base > selection.extent.

We now update the cursor position during selection changes such that the cursor position sent to the embedder is always the position at which next text input would occur. This is the start position of the selection or min(selection.baseOffset, selection.extentOffset).

Issue: https://github.com/flutter/flutter/issues/137677
2023-11-03 22:09:09 +00:00
Chris Bobbe
e7f99821cc
Tooltip docs: Recommend setting preferBelow to false in theme (#135879)
As discussed at https://github.com/flutter/flutter/pull/133007#issuecomment-1743916183, this is a docs change meant to help people in the absence of a fix for #133006, which is being closed as WONTFIX.
2023-11-03 20:18:36 +00:00
auto-submit[bot]
c4ce9479bb
Reverts "[Android] Support Android 34" (#137865)
Reverts flutter/flutter#137191
Initiated by: camsim99
This change reverts the following previous change:
Original Description:
Adds support for Android 34 in the following ways:

- Bumps integration tests compile SDK versions 33 --> 34
- Bumps template compile SDK version 33 --> 34
- Also changes deprecated `compileSdkVersion` to `compileSdk`

Part of https://github.com/flutter/flutter/issues/134220
2023-11-03 20:14:19 +00:00
Kostia Sokolovskyi
a52f030cda
InkFeature should dispatch creation and disposal events. (#137793) 2023-11-03 12:34:16 -07:00
Kostia Sokolovskyi
2369897f09
AppLifecycleListener should dispatch creation and disposal events. (#137840) 2023-11-03 12:31:46 -07:00
Hans Muller
3479aaba75
Updated the nested navigation NavigationBar example (#137788)
Updated the NavigationBar API doc that describes
examples/api/lib/material/navigation_bar/navigation_bar.2.dart and made
some cosmetic changes to the example to improve its appearance in
Material 3. Also did a little gratuitous reformatting.

Fixes #136125
2023-11-03 10:46:09 -07:00
Binni Goel
8e7fce9813
[leak-tracking] Add more leak tracking in test/painting #3 (#136170) 2023-11-03 06:24:38 -07:00
Polina Cherkasova
e1b420cd5b
Upgrade leak_tracker and remove some deps in allow list. (#137806) 2023-11-03 06:20:47 -07:00
Christopher Fujino
b0bc023f24
[flutter_tools] do not try to build tool from dart.sh (#129186)
Fixes https://github.com/flutter/flutter/issues/121894
2023-11-03 00:42:25 +00:00
Camille Simon
675fec805a
[Android] Support Android 34 (#137191)
Adds support for Android 34 in the following ways:

- Bumps integration tests compile SDK versions 33 --> 34
- Bumps template compile SDK version 33 --> 34
- Also changes deprecated `compileSdkVersion` to `compileSdk`

Part of https://github.com/flutter/flutter/issues/134220
2023-11-02 22:18:11 +00:00
Reid Baker
4d21a026e5
Protect flutter analyze --suggestions from erroring on missing AGP value. (#137719)
Fixes #137600 
Protect flutter analyze --suggestions from null error when AGP value is missing
Update template with a reference to new agp definition location 
Look for AGP version being set in settings.gradle (change to templates happened in dbe0ccd885 (diff-20537fb84ee37894a3f3d9723a06bcf2674290ee25aa83332c2524a1f7546a6d)
2023-11-02 21:14:58 +00:00
Gray Mackall
969a8750a5
Provide more information in 'unsupported class file' gradle error (#136756)
Fixes https://github.com/flutter/flutter/issues/130808. Short context is that the migration guide doesn't help when a user has a newer java version than 17, and this tells them how to fix the error in that situation.

This is an alternative to https://github.com/flutter/flutter/pull/131354, because I think it is a bad idea to introduce branching in how we handle this error with some specialized regexp.
2023-11-02 21:14:56 +00:00
Sam Rawlins
d796b013b2
Avoid passing a nullable value to potentially non-nullable parameters (#137359)
Also ignore one case where it is hard to fix.

The code with out the null assertion is legal as per the type signature,
but will throw a runtime exception if the nullable value is null. To
make this exception more explicit, the value must be null-checked before
completing the completer with the value.

The analyzer will soon enforce such checks. See
https://github.com/dart-lang/sdk/issues/53253.

Fixes https://github.com/flutter/flutter/issues/137294

## 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 `///`).
- [ ] 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.

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
2023-11-02 12:59:23 -07:00
Bartek Pacia
3bc64e8fcf
Chore/gradle remove redundant apply (#135348)
I'm removing an unneded block of configuration from the `settings.gradle` template. It was introduced by me in #123511. At that time, I did not know that it's unnecessary, and did not test removing it – sorry about that.

I learned that it's unnecessary recently, when [I asked a question on StackOverflow](https://stackoverflow.com/questions/77073596/whats-the-difference-between-plugins-and-pluginmanagement-plugins-in). More context there.
2023-11-02 19:48:54 +00:00
Valentin Vignal
f15f2313b9
Fixes DragTarget crash if Draggable.data is null (#133136)
Makes the `data` parameter of `Draggable` non-nullable.

Fixes https://github.com/flutter/flutter/issues/84816

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-11-02 17:59:16 +00:00
derdilla
7646430c25
Cupertino date picker should dispose scroll controllers it created. (#135355) 2023-11-02 10:36:57 -07:00
Qun Cheng
615dd968e7
Update IconButton.iconSize documentation (#137741)
fixes https://github.com/flutter/flutter/issues/137580

---

This PR is just to add two sentences for `IconButton.iconSize`'s documentation.
2023-11-02 17:24:08 +00:00
Jasper van Riet
55eb5e11db
Remove duplicate padding on CupertinoFormSection (#137039)
Fixes #128419, removes the duplicate padding that exists around the header and footer on `CupertinoFormSection`. This PR takes the implementation in #129065 and adds tests. I added the ones suggested in the PR review, as well as one more to test that `margin` is passed correctly from `CupertinoFormSection` to `CupertinoListSection`.

Note: I can't quite figure out if this is also a fix to #121543.

Potential review questions:

- Is the use of `offsetMoreOrLessEquals` here correct? I used it because of the vertical positioning. The horizontal positioning is always exact.

### Screenshots
<details>
  <summary>Before</summary>
  
![image](https://github.com/flutter/flutter/assets/5138348/1bce10c9-706a-40c8-a581-2dcb574ed937)
</details>
<details>
  <summary>After</summary>
  
![image](https://github.com/flutter/flutter/assets/5138348/cd1d529b-7be5-45df-af31-0f7760dc3fe9)
</details>
2023-11-02 16:40:59 +00:00
Binni Goel
39f2974192
Instrument ImageStreamCompleterHandle for LeakTracking (#137482) 2023-11-02 07:49:21 -07:00
Binni Goel
e2d5e8fdce
Instrumented PipelineOwner for leak tracking (#137494) 2023-11-02 07:48:22 -07:00
Qun Cheng
4a0f261b4e
Add Card.filled and Card.outlined factory methods (#136229)
Fixes #119401

This PR is to:
* add `Card.filled` and `Card.outlined` factory methods so that we can use tokens for these two types of cards to generate default theme instead of providing hard-corded values in example.
* update card.2.dart example.
* add test file for card.2.dart example.
* fix some mismatch caused by editing the auto-generated defaults by hand in navigation_bar.dart and navigation_drawer.dart.
2023-11-01 23:29:49 +00:00
auto-submit[bot]
b47e4c4acb
Reverts "Update framework_test.dart to remove ButtonBar usage and remove references from other clases" (#137731)
Reverts flutter/flutter#137550
Initiated by: Piinks
This change reverts the following previous change:
Original Description:
This PR removes `ButtonBar` usage from `framework_test.dart` class and update other references in preparation for `ButtonBar` deprecation

related to https://github.com/flutter/flutter/issues/127955
2023-11-01 22:58:19 +00:00
Tirth
43dc3fcfcc
Added EdgeInsetsDirectional.copyWith (#137559)
Added `EdgeInsetsDirectional.copyWith` named constructor.

Fixes #137475
2023-11-01 22:30:15 +00:00
Taha Tesser
b1f5d96a82
Update framework_test.dart to remove ButtonBar usage and remove references from other clases (#137550)
This PR removes `ButtonBar` usage from `framework_test.dart` class and update other references in preparation for `ButtonBar` deprecation

related to https://github.com/flutter/flutter/issues/127955
2023-11-01 22:03:54 +00:00
Dan Field
d843863c4a
reset state of CustomSemanticsAction before running tests (#137697)
Fixes https://github.com/flutter/flutter/issues/137696

This will get the tree green again.

The problem is that `CustomSemanticsAction` has static state in it, and todays test seed order makes things unhappy.
2023-11-01 20:09:41 +00:00
Elias Yishak
70456f5b2d
Unified analytics events migration for BuildEvent (#137562)
Related to tracker issue:
- https://github.com/flutter/flutter/issues/128251
2023-11-01 19:56:50 +00:00
Binni Goel
01b8854011
Fix. typos (#137479)
## Description

This PR fixes typos in 
- `editable_text_show_on_screen_test.dart`
- `form_test.dart`
- `framework.dart`
2023-11-01 19:56:47 +00:00
Zachary Anderson
2630047680
Add no-shuffle to reorderable_list_test.dart (#137698)
For https://github.com/flutter/flutter/issues/137696
2023-11-01 08:47:52 -07:00
Polina Cherkasova
d50f1fa9c9
Add dependency on leak_tracker and leak_tracker_testing to flutter_test. (#137646) 2023-10-31 19:19:12 -07:00
Kostia Sokolovskyi
cdcacd06e4
PerformanceModeRequestHandle should dispatch creation and disposal events. (#137642) 2023-10-31 16:53:53 -07:00
Hrishikesh Kadam
64d3937090
Fix minor typo in doc of window.dart (#137483) 2023-10-31 23:27:06 +00:00
Binni Goel
e7726ea6f2
fix. typos (#137178)
## Description

This PR fixes typos in 
- `checkbox.dart`
- `chip_test.dart`
- `color_scheme.dart`
- `color_scheme_test.dart`
- `curves.dart`
2023-10-31 23:27:03 +00:00
Todd Volkert
5160c5e184
Document the scale argument to NetworkImage (#137456)
Add docs to NetworkImage constructor
2023-10-31 23:15:07 +00:00
Polina Cherkasova
bcf267359c
Move dependency on leak_tracker from dependencies to dev_dependencies in flutter_test. (#137633)
Analyzer's dependency on autosnapshotting causes issues.

Because every version of integration_test from sdk depends on leak_tracker from hosted and autosnapshotting depends on leak_tracker from path, integration_test from sdk is forbidden.
So, because autosnapshotting depends on integration_test from sdk, version solving failed.
2023-10-31 21:12:52 +00:00
Taha Tesser
b547e0e4be
Update ColorScheme.light, ColorScheme.dark, ColorScheme.highContrastLight, & ColorScheme.highContrastDark constructors docs for Material 3 (#137149)
fixes [Clarify ColorScheme fromSwatch/fromSeed usage](https://github.com/flutter/flutter/issues/132584)

"This explains how to use `ColorScheme.fromSeed` as a substitute for each `ColorScheme` constructor."

| `ColorScheme.light` (left) to `ColorScheme.fromSeed` (right) | 
| --------------- | 
| ![light](https://github.com/flutter/flutter/assets/48603081/e056e723-5640-4b05-8feb-ca6b517c8682)	|

| `ColorScheme.dark` (left) to `ColorScheme.fromSeed` (right) | 
| --------------- | 
| ![dark](https://github.com/flutter/flutter/assets/48603081/5ff32611-bfb6-49ee-a34e-f935f580e84e)	|

| `ColorScheme.highContrastLight` (left) to `ColorScheme.fromSeed` (right) | 
| --------------- | 
| ![highContrastLight](https://github.com/flutter/flutter/assets/48603081/4b47f2e3-ea8e-4148-85cc-69690e9082c7) |

| `ColorScheme.highContrastDark` (left) to `ColorScheme.fromSeed` (right) | 
| --------------- | 
| ![highContrastDark](https://github.com/flutter/flutter/assets/48603081/3dbd7ec4-c78e-4228-a8ed-673832681563) |
2023-10-31 19:03:03 +00:00
Binni Goel
231bfac8d3
Fix. typos (#137465)
## Description

This PR fixes typos in 
- `date_picker.dart`
- `date_picker_theme.dart`
- `dropdown.dart`
2023-10-31 17:36:10 +00:00
Daco Harkes
4f606f790a
Fix formatting (#137613)
Badly formatted code causes distraction when reading, and costs people energy when understanding code.
2023-10-31 13:27:26 +00:00
Pavel Mazhnik
0d52630ef1
[web] cache the base URL as root index.html (#136594)
Fixes https://github.com/flutter/flutter/issues/136593

Caching of the base url was introduced in https://github.com/flutter/flutter/pull/53666 but resources can contain multiple `index.html` files, and currently hash of the **latest** asset will be assigned to the base url, which is not necessarily the root index.html
2023-10-30 20:53:16 +00:00
Christopher Fujino
f830e4be4d
[flutter_tools] ensure processUtils reports exit code in ProcessExceptions (#136672)
Help to debug situations like: https://github.com/flutter/flutter/issues/135982
2023-10-30 19:51:26 +00:00
Christopher Fujino
2c102175f2
[flutter_tool] change print when selecting developer identity for code signing (#136978)
Fixes https://github.com/flutter/flutter/issues/136984
2023-10-30 19:03:18 +00:00
Liam Appelbe
e12d1a798c
Reland coverableLineCache optimisation (#136851) (#137385)
Relands #136851, which was rolled back in #137121

package:coverage has been rolled, so the breakages should be fixed.
Also, in this reland I've changed the `coverableLineCache` parameter to
be optional, which is safer.
2023-10-30 11:00:30 +13:00
Kostia Sokolovskyi
f05bb9a182
Instrument RestorationBucket, _RouteEntry and DisposableBuildContext for leak tracking. (#137477) 2023-10-28 13:27:00 -07:00
Kostia Sokolovskyi
50ecd5700f
BannerPainter should dispatch creation and disposal events. (#137472) 2023-10-28 13:23:32 -07:00
Polina Cherkasova
65c71d4294
Instrument more disposables. (#137309) 2023-10-27 21:30:04 -07:00
Kostia Sokolovskyi
fea561301b
TextPainter should dispatch creation and disposal events. (#137416) 2023-10-27 21:29:02 -07:00
David Iglesias
15ccf24d79
[web] Add 'nonce' prop to flutter.js loadEntrypoint (#137204)
## Description

This PR adds a `nonce` parameter to flutter.js' `loadEntrypoint` method.

When set, loadEntrypoint will add a `nonce` attribute to the `main.dart.js` script tag, which allows Flutter to run in environments slightly more restricted by CSP; those that don't add `'self'` as a valid source for `script-src`.

----

### CSP directive

After this change, the CSP directive for a Flutter Web index.html can be:

```
script-src 'nonce-YOUR_NONCE_VALUE' 'wasm-unsafe-eval';
font-src https://fonts.gstatic.com;
style-src 'nonce-YOUR_NONCE_VALUE';
```

When CSP is set via a `meta` tag (like in the test accompanying this change), and to use a service worker, the CSP needs an additional directive: [`worker-src 'self';`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/worker-src)

When CSP set via response headers, the CSP that applies to `flutter_service_worker.js` is determined by its response headers. See **Web Workers API > [Content security policy](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#content_security_policy)** in MDN.)

----

### Initialization

If the CSP is set to disallow `script-src 'self'`, a nonce needs to also be passed to `loadEntrypoint`:

```javascript
  _flutter.loader.loadEntrypoint({
    nonce: 'SOME_NONCE',
    onEntrypointLoaded: (engineInitializer) async {
      const appRunner = await engineInitializer.initializeEngine({
        nonce: 'SOME_NONCE',
      });
      appRunner.runApp();
    },
  });
```

(`nonce` shows twice for now, because the entrypoint loader script doesn't have direct access to the `initializeEngine` call.)

----

## Tests

* Added a smoke test to ensure an app configured as described above starts.

## Issues

* Fixes https://github.com/flutter/flutter/issues/126977
2023-10-27 21:05:06 +00:00