Commit graph

23093 commits

Author SHA1 Message Date
Zayd Krunz e8fc89e690
Redundant message fix (#143978)
Saying that the commands only work on macOS is redundant because the command is only shown on macOS hosts.
2024-04-18 22:33:10 +00:00
Victoria Ashworth 6d19fa3bfa
Add Swift Package Manager as new opt-in feature for iOS and macOS (#146256)
This PR adds initial support for Swift Package Manager (SPM). Users must opt in. Only compatible with Xcode 15+.

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

## Included Features

This PR includes the following features:
* Enabling SPM via config 
`flutter config --enable-swift-package-manager`
* Disabling SPM via config (will disable for all projects) 
`flutter config --no-enable-swift-package-manager`
* Disabling SPM via pubspec.yaml (will disable for the specific project)
```
flutter:
  disable-swift-package-manager: true
```
* Migrating existing apps to add SPM integration if using a Flutter plugin with a Package.swift
  * Generates a Swift Package (named `FlutterGeneratedPluginSwiftPackage`) that handles Flutter SPM-compatible plugin dependencies. Generated package is added to the Xcode project.
* Error parsing of common errors that may occur due to using CocoaPods and Swift Package Manager together
* Tool will print warnings when using all Swift Package plugins and encourage you to remove CocoaPods

This PR also converts `integration_test` and `integration_test_macos` plugins to be both Swift Packages and CocoaPod Pods.

## How it Works
The Flutter CLI will generate a Swift Package called `FlutterGeneratedPluginSwiftPackage`, which will have local dependencies on all Swift Package compatible Flutter plugins.  

The `FlutterGeneratedPluginSwiftPackage` package will be added to the Xcode project via altering of the `project.pbxproj`. 

In addition, a "Pre-action" script will be added via altering of the `Runner.xcscheme`. This script will invoke the flutter tool to copy the Flutter/FlutterMacOS framework to the `BUILT_PRODUCTS_DIR` directory before the build starts. This is needed because plugins need to be linked to the Flutter framework and fortunately Swift Package Manager automatically uses `BUILT_PRODUCTS_DIR` as a framework search path.

CocoaPods will continue to run and be used to support non-Swift Package compatible Flutter plugins.

## Not Included Features

It does not include the following (will be added in future PRs):
* Create plugin template
* Create app template
* Add-to-App integration
2024-04-18 21:12:36 +00:00
Jackson Gardner fd25493f60
Changing the renderer on the web target should change its build key. (#147003)
Changing the web renderer doesn't directly modify the environment's dart defines, and so doesn't do a full build invalidation. We need to include the web renderer in the build key for the compiler configuration. This information is used directly by the web targets to modify the dart defines that are passed into the compiler, so we need to rebuild if this information changes.
2024-04-18 21:05:06 +00:00
chunhtai 7ee05a05ff
Add generic type for result in PopScope (#139164)
Adds a generic type and pop result to popscope and its friend.

The use cases are to be able to capture the result when the pop is called.

migration guide: https://github.com/flutter/website/pull/9872
2024-04-18 19:30:10 +00:00
Chris Bracken c219bf73fc
[tools] Make SnapshotType.platform non-nullable (#146958)
When performing artifact lookups for `Artifact.genSnapshot` for macOS desktop builds, a `TargetPlatform` is used to determine the name of the tool, typically `gen_snapshot_$TARGET_ARCH`. Formerly, this tool was always named `gen_snapshot`.

The astute reader may ask "but Chris, didn't we support TWO target architectures on iOS and therefore need TWO `gen_snapshot` binaries?" Yes, we did support both armv7 and arm64 target architectures on iOS. But no, we didn't initially have two `gen_snapshot` binaries. We did *build* two `gen_snapshots`:
   * A 32-bit x86 binary that emitted armv7 AOT code
   * A 64-bit x64 binary that emitted arm64 AOT code 

At the time, the bitness of the `gen_snapshot` tool needed to match the bitness of the target architecture, and to avoid having to do a lot of work plumbing through suffixed `gen_snapshot` names, the author of that work (who, as evidenced by this patch, is still paying for his code crimes) elected to "cleverly" lipo the two together into a single multi-architecture macOS binary still named `gen_snapshot`. See: https://github.com/flutter/engine/pull/4948

This was later remediated over the course of several patches, including:
   * https://github.com/flutter/engine/pull/10430
   * https://github.com/flutter/engine/pull/22818
   * https://github.com/flutter/flutter/pull/37445 

However, there were still cases (notably `--local-engine` workflows in the tool) where we weren't computing the target platform and thus referenced the generic `gen_snapshot` tool.
See: https://github.com/flutter/flutter/issues/38933
Fixed in: https://github.com/flutter/engine/pull/28345

The test removed in this PR, which ensured that null `SnapshotType.platform` was supported was introduced in https://github.com/flutter/flutter/pull/11924 as a followup to https://github.com/flutter/flutter/pull/11820 when the snapshotting logic was originally extracted to the `GenSnapshot` class, and most invocations still passed a null target platform.

Since there are no longer any cases where `TargetPlatform` isn't passed when looking up `Artifact.genSnapshot`, we can safely make the platform non-nullable and remove the test.

This is pre-factoring towards the removal of the generic `gen_snapshot` artifact from the macOS host binaries (which are currently unused since we never pass a null `TargetPlatform`), which is pre-factoring towards the goal of building `gen_snapshot` binaries with an arm64 host architecture, and eliminate the need to use Rosetta during iOS and macOS Flutter builds.

Part of: https://github.com/flutter/flutter/issues/101138
Umbrella issue: https://github.com/flutter/flutter/issues/103386
Umbrella issue: https://github.com/flutter/flutter/issues/69157

No new tests since the behaviour is enforced by the compiler.
2024-04-18 16:34:06 +00:00
Valentin Vignal cbf35b4e85
Fix memory leaks in navigation rail (#146988) 2024-04-18 08:03:19 -07:00
Valentin Vignal fb110b98da
Fix memory leaks in MaterialBanner (#146963) 2024-04-18 07:21:18 -07:00
Valentin Vignal c83d650de4
Fix memory leak in data table (#146892) 2024-04-18 07:16:32 -07:00
Valentin Vignal 47a4c69b82
Dispose the curved animation in transition test (#146961) 2024-04-18 07:14:15 -07:00
Loïc Sharma 86135b7774
[macOS] Migrate @NSApplicationMain attribute to @main (#146848)
This migrates Flutter to use the `@main` attribute introduced in Swift 5.3. The `@NSApplicationMain` attribute is deprecated and will be removed in Swift 6. See: https://github.com/apple/swift-evolution/blob/main/proposals/0383-deprecate-uiapplicationmain-and-nsapplicationmain.md

This change is split into two commits:

1. a508d3e503 - This updates the macOS app template and adds a migration to replace `@NSApplicationMain` uses with `@main`. 
2. f43482786e - I ran `flutter run -d macos` on each Flutter macOS app in this repository to verify the app migrates and launches successfully.

Follow-up to https://github.com/flutter/flutter/pull/146707
Fixes https://github.com/flutter/flutter/issues/143044
2024-04-18 03:08:36 +00:00
Michael Goderbauer 63f917c36d
Bump meta to 1.14.0 (#146925)
Not sure why the auto-roller hasn't picked this up...
2024-04-17 15:25:51 -07:00
Ian Hickson 3fadf9e2fb
Make goldenFileComparator a field instead of a trivial property (#146800)
Removes an unnecessary abstraction.
2024-04-17 21:55:55 +00:00
Ian Hickson 05747cfa65
Assert that the goldenFileComparator is a LocalFileComparator (#146802)
This is part 9 of a broken down version of the https://github.com/flutter/flutter/pull/140101 refactor.

This is an assumption already silently made by a bunch of casts in this file.
2024-04-17 21:55:54 +00:00
Ian Hickson 1d904b641b
Remove now-redundant tests for isForEnvironment (#146804)
This is part 11 of a broken down version of the #140101 refactor.

These tests are redundant with the more comprehensive tests now in comparator_selection_test.dart.
2024-04-17 19:23:26 +00:00
flutter-pub-roller-bot 8f85c7c5b8
Roll pub packages (#146929)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-04-17 19:22:32 +00:00
Polina Cherkasova ae0a0dfc6b
Get rid of _NullElement. (#146741)
Fixes https://github.com/flutter/flutter/issues/145602
2024-04-17 19:10:42 +00:00
Valentin Vignal 51f1725261
Fix memory leak in paginated tables (#146755) 2024-04-17 11:03:48 -07:00
Derek Xu cf26b1150f
Unpin frontend_server_client and roll packages (#146650) 2024-04-17 12:43:20 -04:00
Pierre-Louis 4a65a76279
Reland: Update link branches to main (#146882)
Reland https://github.com/flutter/flutter/pull/146558, reverted in https://github.com/flutter/flutter/pull/146880 due to an outdated test result

## Original description

- Update CS and googlesource.com link branches
- Update GitHub /blob/ and /tree/ links

Tested links manually and fixes a few broken or deprecated links

Added a test that validates that `master` isn't used, except for specified repos.

Part of https://github.com/flutter/flutter/issues/121564
2024-04-17 13:16:33 +00:00
Pierre-Louis 33a9643b5d
Revert "Update link branches to main" (#146880)
Reverts flutter/flutter#146558

Causes failure
2024-04-17 13:25:18 +02:00
Taha Tesser f2be9bcad5
Fix Tab indicator image configuration doesn't inherit device pixel ratio (#146812)
fixes [The image for the indicator of the TabBar does not auto-adapt to different resolutions](https://github.com/flutter/flutter/issues/145204)

### Description
This PR provides device pixel ratio to the tab indicator painter.
2024-04-17 07:59:07 +00:00
Pierre-Louis 072b8874a0
Update link branches to main (#146558)
- Update CS and googlesource.com link branches
- Update GitHub /blob/ and /tree/ links

Tested links manually and fixes a few broken or deprecated links

Added a test that validates that `master` isn't used, except for
specified repos.

Part of https://github.com/flutter/flutter/issues/121564

## 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-04-17 09:44:23 +02:00
Ian Hickson 5a81e91507
Rewrap some lines that are about to get much longer. (#146803)
This is part 10 of a broken down version of the #140101 refactor.

This will make future PRs easier to review.
2024-04-17 06:13:01 +00:00
Dimil Kalathiya 224099872e
fix test-case for RenderView (#146825) 2024-04-16 15:20:10 -07:00
Loïc Sharma 194fefaa53
[iOS] Migrate @UIApplicationMain attribute to @main (#146707)
This migrates Flutter to use the `@main` attribute introduced in Swift 5.3. The `@UIApplicationMain` attribute is deprecated and will be removed in Swift 6. See: https://github.com/apple/swift-evolution/blob/main/proposals/0383-deprecate-uiapplicationmain-and-nsapplicationmain.md

This change is split into two commits:

1. ad18797428 - This updates the iOS app template and adds a migration to replace `@UIApplicationMain` uses with `@main`. 
2. 8ecbb2f29f - I ran `flutter run` on each Flutter iOS app in this repository to verify the app migrates and launches successfully.

Part of https://github.com/flutter/flutter/issues/143044
2024-04-16 22:13:03 +00:00
Michael Goderbauer bc88d0b9ed
Remove checked mode references (#146845)
Fixes https://github.com/flutter/flutter/issues/21066
2024-04-16 22:10:54 +00:00
flutter-pub-roller-bot 4efdf190a8
Roll pub packages (#146842)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-04-16 22:07:27 +00:00
Michael Goderbauer 16bb7faec9
Fix doc reference to RendererBinding.renderViews (#146837)
`RendererBinding.renderView` is deprecated. The doc should link to `RendererBinding.renderViews`, which also matches the context since the sentence is talking about multiple `RenderView`s and not just the legacy singleton.
2024-04-16 22:07:25 +00:00
Valentin Vignal 3882afbfa9
Fix leak memory in Tooltip and account detail (#146833) 2024-04-16 12:15:37 -07:00
Valentin Vignal c3445dc190
Fix memory leak in BottomNavigationBar (#146748) 2024-04-16 07:53:27 -07:00
flutter-pub-roller-bot c06faf49e1
Roll pub packages (#146797)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-04-16 06:44:25 +00:00
Amir Panahandeh c98d68de42
Add hitTestBehavior and rootOverlay to LongPressDraggable constructor… (#146386)
Passes through these two Draggable parameters so that they're usable in LongPressDraggable.
2024-04-15 12:20:11 -07:00
Polina Cherkasova c4a7cf202a
Update leak related TODOs. (#146743)
https://github.com/flutter/flutter/issues/146742
2024-04-15 11:46:32 -07:00
Loïc Sharma 882bcbb9aa
[Doctor] Improve CocoaPods messages (#146701)
This tweaks the Flutter doctor messages for CocoaPods.

This also switches the "unknown version" error to link to the update instructions instead of the installation instructions; the user has already installed CocoaPods in this scenario.

Example error before:

```
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
```

Example error after:

```
    ✗ CocoaPods not installed.
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      For installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation
```
2024-04-15 18:45:12 +00:00
Nate 2e748e8598
Implementing control flow collections (#146601)
This pull request aims for improved readability, based on issue #146600.

```dart
// before
Set<Color> _distinctVisibleColors() {
  final Set<Color> distinctVisibleColors = <Color>{};
  if (top.style != BorderStyle.none) {
    distinctVisibleColors.add(top.color);
  }
  if (right.style != BorderStyle.none) {
    distinctVisibleColors.add(right.color);
  }
  if (bottom.style != BorderStyle.none) {
    distinctVisibleColors.add(bottom.color);
  }
  if (left.style != BorderStyle.none) {
    distinctVisibleColors.add(left.color);
  }
  return distinctVisibleColors;
}

// after
Set<Color> _distinctVisibleColors() {
  return <Color>{
    if (top.style != BorderStyle.none) top.color,
    if (right.style != BorderStyle.none) right.color,
    if (bottom.style != BorderStyle.none) bottom.color,
    if (left.style != BorderStyle.none) left.color,
  };
}
```

Most of the repo should be covered in this PR (aside from `flutter_tools/`, since there was a lot going on in there).
2024-04-15 16:06:07 +00:00
Valentin Vignal 0099d1a96a
test: Fix memory leak in transitions test (#146747) 2024-04-15 08:52:18 -07:00
Bruno Leroux 63634c25ad
Fix filled text field active indicator overflows container bounds (#146637)
## Description

This PRs fixes the active indicator vertical position for a filled text field.
Before this PR, the active indicator overflowed of container bounds, After this PR the active indicator is painted inside the container bounds.

Screenshot of filled text field with active indicator width sets to 4.0dp:

| Before | After |
|--------|--------|
| ![image](https://github.com/flutter/flutter/assets/840911/ed2878ba-130a-4410-b170-423d00a8893d) | ![image](https://github.com/flutter/flutter/assets/840911/f78d06c0-a161-4ab6-b01f-dae297939956) | 

</details> 

## Related Issue

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

## Tests

Adds 1 tests, updates 3 tests.
2024-04-15 07:28:19 +00:00
Dimil Kalathiya 1002ce4b03
- Fixes _DropdownMenuState leaking text controller (#146571) 2024-04-14 07:59:43 -07:00
Valentin Vignal 266cdf0b1e
Fix memory leaks in FloatingActionButton (#146711) 2024-04-13 15:48:25 -07:00
Lau Ching Jun 8a9e74e8d7
Avoid forwarding the data after socket is disconnected. (#146665)
In a ProxiedDevicePortForwarder, there might be a race condition where the local socket has been disconnected, but the remote end was still sending new data. In this case, avoid forwarding new data to the socket.
2024-04-12 21:45:32 +00:00
Christopher Fujino 7a30d2b4ca
[flutter_tools] Fix conductor for package args roll (#146646)
The interface for `ArgResults` from `package:args` has added new fields. Change the implementations of these in the conductor to extend `Fake` so that these aren't analyzer errors.

This broke the pub roll here: https://github.com/flutter/flutter/pull/146642#issuecomment-2050169629
2024-04-12 21:38:03 +00:00
Kate Lovett 25a0cc7e2b
Light sliver clean up before SliverTree (#146696)
This cleans up a few sliver classes, like moving RenderSliverVariedExtentList to the rendering layer (it was in the widgets layer), and moving SliverVariedExtentList to live with its sibling subclasses, SliverFixedExtentList, SliverList, and so on.
I moved these while working on SliverTree, so figure I should break out into a separate change.

SliverTree and SliverCarousel (both inbound in separate changes) will also be subclasses of RenderSliverFixedExtentBoxAdaptor, organizing them together felt easier to work with.

Related to https://github.com/flutter/flutter/issues/114299 and https://github.com/flutter/flutter/issues/125980
2024-04-12 21:20:59 +00:00
Bruno Leroux 58ac0dc16b
Fix label text color is wrong for a focused and hovered TextField (#146572)
Before, hovering a focused TextField would incorrect change the label color. Now it does not, which is correct per the spec.
2024-04-12 14:07:03 -07:00
LongCatIsLooong 7db26b09bb
Fix getOffsetForCaret crash (#146669)
Fixes a crash in Google tests (b/333560406) related to a decomposed complex character.
2024-04-12 13:58:02 -07:00
Jackson Gardner 9973673752
Support flutter run --wasm and flutter drive --wasm. (#146231)
This adds support for adding the `--wasm` flag to `flutter run` and `flutter drive`
* Emits errors if you attempt to use the skwasm renderer without the `--wasm` flag
* Emits errors if you try to use `--wasm` when not using a web device
* Uses the skwasm renderer by default if you pass `--wasm` and no `--web-renderer`
2024-04-12 19:27:26 +00:00
Valentin Vignal e2c812155c
Fix curved animation memory leak for scrollbar (#146670) 2024-04-12 09:24:13 -07:00
Chris Bracken a34086a573
[Windows] Drop support for Windows 7/8 apps in template (#146668)
Since Flutter no longer supports Windows 7.x or 8.x, this eliminates support from the Windows app template. No tests to eliminate, since Windows 7 and 8 were "best-efforts" tier and untested.

Fixes: https://github.com/flutter/flutter/issues/140830
RFC: http://flutter.dev/go/flutter-drop-win7-2024
2024-04-12 01:07:20 +00:00
hangyu 07f3103c67
Update the gradle task to add fallback scheme and host if needed when retrieving deep links. (#146470)
This is to support feature:
https://github.com/flutter/devtools/issues/7541

before behavior: do not show this link in the dev tool if there's no
scheme or host
target behavior: show the link in the dev tool with a error text : (
missing scheme/ missing domain)



## 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-04-11 14:24:51 -07:00
Polina Cherkasova 5ebc94082e
Fix leaking curved animation. (#146644) 2024-04-11 18:47:24 +00:00
Bartek Pacia 557fbf5167
Update app Android gradle scripts to use flutter.versionName and flutter.versionCode (#146604)
Follow up of #146044 and #141417

Minor change to make Gradle buildscripts shorter.
2024-04-11 13:46:13 +00:00