Commit graph

23296 commits

Author SHA1 Message Date
Nate f419177057
Reland "Update FocusManager platform check to include iOS" (#148984)
It looks like removing `kIsWeb` from the `FocusManager._appLifecycleListener` platform check is causing [memory leaks](https://github.com/flutter/flutter/issues/148985) and test failures.

This pull request fixes #148475 and prevents the test failures shown in #148978.
2024-05-23 23:13:18 +00:00
Taha Tesser ec69f001fc
Fix SnackBar action text button overlay color (#148961)
fixes [`SnackBar` action hover state background too hard to see](https://github.com/flutter/flutter/issues/141343)

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Center(
          child: ScaffoldButton(),
        ),
      ),
    );
  }
}

class ScaffoldButton extends StatelessWidget {
  const ScaffoldButton({super.key});

  @override
  Widget build(BuildContext context) {
    return TextButton(
      onPressed: () {
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(
            behavior: SnackBarBehavior.floating,
            width: 320,
            content: const Text('This is a snackbar!'),
            action: SnackBarAction(
              label: 'Close',
              onPressed: () {},
            ),
          ),
        );
      },
      child: const Text('Launch snackbar'),
    );
  }
}

```

</details>

### Before
<img src="https://github.com/flutter/flutter/assets/48603081/88b53c92-6184-4faf-88e1-ac70f78993b3"/> 

### After
 <img src="https://github.com/flutter/flutter/assets/48603081/3e03c903-90c0-4da4-b49a-0070208d56d1"  />
2024-05-23 22:42:52 +00:00
wangyognqi 881e29f94a
Fix the second TextFormField to trigger onTapOutside (#148930)
This PR attempts to fix https://github.com/flutter/flutter/issues/127597
2024-05-23 22:25:51 +00:00
Ian Hickson 2025ebe767
Remove hidden dependencies on HttpClient (#148773)
This is part 16 of a broken down version of the #140101 refactor.

This only makes one dependency explicit. Further PRs will do the same for other dependencies, until these APIs have no hidden dependencies.

This PR makes no effort to keep the order of parameters reasonable. There is an existing TODO to do a refactor sweep later that does nothing but reorder arguments/parameters/fields to be consistent.
2024-05-23 18:20:50 +00:00
Renzo Olivares 84fe3b6e53
Revert "Update FocusManager platform check to include iOS" (#148978) 2024-05-23 10:46:10 -07:00
Nate 8d955cdd64
Update FocusManager platform check to include iOS (#148612)
Both iOS and Android run into issues when the FocusManager starts responding to app lifecycle changes.

Fortunately, this feature is primarily meant for desktop platforms, so the problem can be resolved with a platform check.

fixes https://github.com/flutter/flutter/issues/148475
2024-05-23 16:40:45 +00:00
Matej Knopp 02d5286e02
[iOS] fix hot restart with native assets (#148752)
Fixes https://github.com/flutter/flutter/issues/148687

Adds support for running the hot restart and reload integration test on
iOS simulator.

## 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 `///`).
- [ ] 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-05-23 18:30:55 +02:00
LongCatIsLooong a766945bdd
Allow RenderObject.getTransformTo to take an arbitrary RenderObject in the same tree (#148897)
This is https://github.com/flutter/flutter/pull/130192 but without the additional parameter.

Fixes https://github.com/flutter/flutter/issues/146764, https://github.com/flutter/flutter/issues/148410
2024-05-22 23:32:24 +00:00
Helin Shiah edf312d506
Add frame number and widget location map service extension (#148702)
This helps us add widget rebuild counts to the DevTools performance page: https://github.com/flutter/devtools/issues/4564
2024-05-22 21:29:27 +00:00
LongCatIsLooong d57ea48ca1
Remove an assert with false positives (#148795)
Fixes https://github.com/flutter/flutter/issues/110343.

This is not an important piece of guardrail and the iOS embedder only expects best-effort results anyways.
2024-05-22 21:25:31 +00:00
Renzo Olivares b2eda0624a
Revert "Fix the second TextFormField to trigger onTapOutside" (#148909) 2024-05-22 13:40:59 -07:00
wangyognqi 9acbc1d4a2
Fix the second TextFormField to trigger onTapOutside (#148206)
This PR attempts to fix https://github.com/flutter/flutter/issues/127597
2024-05-22 18:33:14 +00:00
Gray Mackall eba7b97bb9
Try removing robolectric from integration_test tests (#148803)
May fix https://github.com/flutter/flutter/issues/148393.

There are reports on the robolectric issue tracker of >`4.10.3` causing the error we are seeing
https://github.com/robolectric/robolectric/issues/8158
The test doesn't actually need robolectric (and didn't originally use it, or flake before using it), but it was added in https://github.com/flutter/flutter/pull/144348. We can safely remove it by mocking the call to `View.generateViewId()`, so try removing it and see if flakes go away.
2024-05-22 18:29:19 +00:00
Victor Eronmosele 4c929f0f44
Prevent test folder deletion on running flutter create --empty on an existing app project (#147160)
This PR modifies the `flutter create --empty` command to not delete the `test/` folder when run on an existing app project. 

Before:
```bash
flutter create my_app --empty
mkdir my_app/test
if test -d my_app/test; then echo "test exists"; else echo "test does not exist"; fi # test exists
flutter create my_app --empty  
if test -d my_app/test; then echo "test exists"; else echo "test does not exist"; fi # test does not exist
```

After:
```bash
flutter create my_app --empty
mkdir my_app/test
if test -d my_app/test; then echo "test exists"; else echo "test does not exist"; fi # test exists
flutter create my_app --empty  
if test -d my_app/test; then echo "test exists"; else echo "test does not exist"; fi # test exists
```
Fixes https://github.com/flutter/flutter/issues/134928
2024-05-22 17:37:05 +00:00
Daco Harkes 1f16d9121c
[native_assets] Add support for link hooks (#148474)
This PR adds support invoking `link.dart` hooks.

Link hooks can add new assets. Link hooks can transform assets sent to link hook from build hooks.

This PR does not yet add support for getting tree-shake information in the link hooks. This is pending on defining the `resources.json` format (https://github.com/dart-lang/sdk/issues/55494).

Issue:

* https://github.com/flutter/flutter/issues/146263

## Implementation considerations

The build hooks could be run before Dart compilation and the link hooks after Dart compilation. (This is how it's done in Dart standalone.) However, due to the way the `Target`s are set up, this would require two targets and serializing and deserializing the `BuildResult` in between these. This would lead to more code but no benefits. Currently there is nothing that mandates running build hooks before Dart compilation.

## Testing

* The unit tests verify that the native_assets_builder `link` and `linkDryRun` would be invoked with help of the existing fake.
* The native assets integration test now also invokes an FFI call of a package that adds the asset during the link hook instead of the build hook.
  * In order to keep coverage of the `flutter create --template=package_ffi`, `flutter create` is still run and the extra dependency is added and an extra ffi call is added. (Open to alternative suggestions.)
2024-05-22 16:02:00 +00:00
Dimil Kalathiya 73bf206f35
CupertinoDialogRoute leak fix (#148774) 2024-05-22 07:43:33 -07:00
Taha Tesser ea7cf54b42
Introduce WidgetStateBorderSide.lerp (#148122)
fixes [Consolidate `_LerpSides` classes with `WigetStateProperty<BorderSide?>` type  into a new `WidgetStateBorderSide.lerp`](https://github.com/flutter/flutter/issues/148057)
2024-05-22 07:11:07 +00:00
holzgeist 43548359c9
add default-flavor field to flutter pubspec, which will be used as the flavor in flutter build/run if --flavor is not provided (#147968)
This PR adds a new flag `default-flavor` in the `flutter` section of `pubspec.yaml`. It allows developers of multi-flavor android apps to specify a default flavor to be used for `flutter run`, `flutter build` etc.
Using `flutter run` on flavored apps already works without specifying `--flavor` already works on iOS (it defaults to the `runner` schema), so I (and others in #22856) figured this would be nice to have.

fixes #22856
2024-05-22 05:11:24 +00:00
Victor Sanni 81f962de40
Make hover tests functional and cleanup mouse pointers in Material toggleables (#148808)
Tests in Material toggleables (`Radio`, `Switch`, `Checkbox`) which require hovering using a mouse pointer do not include `addTearDown(gesture.removePointer)` to remove the mouse pointer once the test concludes.

Also, hovering tests in Material `Checkbox` currently have no functionality (i.e what is painted before hovering = what is painted while hovering). For example:

357bd65749/packages/flutter/test/material/checkbox_test.dart (L880-L896)

This PR adds `addTearDown(gesture.removePointer)` to `Radio`, `Switch`, and `Checkbox` tests, and functionality for `Checkbox` hover tests.

Fixes #148809.
2024-05-22 04:58:01 +00:00
Amir Panahandeh 7d529a7521
Fix two dimensional viewport unexpected null exception when no child is laid out (#148256)
- Fixes #148255
2024-05-21 22:54:34 +00:00
Polina Cherkasova 87aa8423a2
Fix test that leaks images. (#148494)
Contributes to https://github.com/flutter/flutter/issues/145599

Repro:
`flutter test test/cupertino/tab_scaffold_test.dart  --dart-define LEAK_TRACKING=true --plain-name "Adding new tabs does not crash the app"`

What is going on: 
1. ImageCache.putIfAbsent, in case the image already existed in the cache, invokes ImageCache._trackLiveImage, that creates _LiveImage and passes the image's completer as parameter `completer`
3. _LiveImage constructor invokes super constructor (of _CachedImageBase) that initializes the member `handle`
4. `handle` is disposed [using scheduler](c698e694c8/packages/flutter/lib/src/painting/image_cache.dart (L633)), and disposal does not happen in time of test completion.

Adding delay to the test increases number of not disposed objects from 30 to 120.
Should we force schedule at the end of the widget tests somehow to make scheduler switched to right state?

Creation call stack:

```
#9______new_ImageStreamCompleterHandle.__(package:flutter/src/painting/image_stream.dart:465:41)
#10_____ImageStreamCompleter.keepAlive_(package:flutter/src/painting/image_stream.dart:655:39)
#11_____new__CachedImageBase_(package:flutter/src/painting/image_cache.dart:609:27)
#12_____new__LiveImage_(package:flutter/src/painting/image_cache.dart:647:9)
#13_____ImageCache._trackLiveImage.<anonymous_closure>_(package:flutter/src/painting/image_cache.dart:302:14)
#14______LinkedHashMapMixin.putIfAbsent_(dart:collection-patch/compact_hash.dart:543:23)
#15_____ImageCache._trackLiveImage_(package:flutter/src/painting/image_cache.dart:296:17)
#16_____ImageCache.putIfAbsent_(package:flutter/src/painting/image_cache.dart:378:7)
#17_____ImageProvider.resolveStreamForKey_(package:flutter/src/painting/image_provider.dart:517:81)
                      #18_____ScrollAwareImageProvider.resolveStreamForKey_(package:flutter/src/widgets/scroll_aware_image_provider.dart:104:19)
#19_____ImageProvider.resolve.<anonymous_closure>_(package:flutter/src/painting/image_provider.dart:366:9)
#20_____ImageProvider._createErrorHandlerAndKey.<anonymous_closure>_(package:flutter/src/painting/image_provider.dart:479:24)
#21_____SynchronousFuture.then_(package:flutter/src/foundation/synchronous_future.dart:43:39)
                      #22_____ImageProvider._createErrorHandlerAndKey_(package:flutter/src/painting/image_provider.dart:476:9)
#23_____ImageProvider.resolve_(package:flutter/src/painting/image_provider.dart:363:5)
#24______ImageState._resolveImage_(package:flutter/src/widgets/image.dart:1111:16)
#25______ImageState.didChangeDependencies_(package:flutter/src/widgets/image.dart:1061:5)
#26_____StatefulElement._firstBuild_(package:flutter/src/widgets/framework.dart:5630:11)
#27_____ComponentElement.mount_(package:flutter/src/widgets/framework.dart:5457:5)
#28_____Element.inflateWidget_(package:flutter/src/widgets/framework.dart:4334:16)
#29_____Element.updateChild_(package:flutter/src/widgets/framework.dart:3843:18)
#30_____SingleChildRenderObjectElement.mount_(package:flutter/src/widgets/framework.dart:6763:14)
```
2024-05-21 21:33:20 +00:00
Gray Mackall 24979ab2c5
Fix warnings in dependency_version_checker.gradle.kts (#148699)
Newer Gradle/AGP versions include the following warnings:
```
w: file:///Users/goderbauer/dev/flutter/packages/flutter_tools/gradle/src/main/kotlin/dependency_version_checker.gradle.kts:107:40: Variable 'agpVersion' initializer is redundant
w: file:///Users/goderbauer/dev/flutter/packages/flutter_tools/gradle/src/main/kotlin/dependency_version_checker.gradle.kts:108:40: Variable 'kgpVersion' initializer is redundant
w: file:///Users/goderbauer/dev/flutter/packages/flutter_tools/gradle/src/main/kotlin/dependency_version_checker.gradle.kts:143:28: Parameter 'project' is never used
w: file:///Users/goderbauer/dev/flutter/packages/flutter_tools/gradle/src/main/kotlin/dependency_version_checker.gradle.kts:152:40: Variable 'agpVersion' initializer is redundant
w: file:///Users/goderbauer/dev/flutter/packages/flutter_tools/gradle/src/main/kotlin/dependency_version_checker.gradle.kts:167:55: 'Version' is deprecated. Deprecated in Java
w: file:///Users/goderbauer/dev/flutter/packages/flutter_tools/gradle/src/main/kotlin/dependency_version_checker.gradle.kts:195:56: Unnecessary non-null assertion (!!) on a non-null receiver of type Any
w: file:///Users/goderbauer/dev/flutter/packages/flutter_tools/gradle/src/main/kotlin/dependency_version_checker.gradle.kts:344:28: The corresponding parameter in the supertype 'Comparable' is named 'other'. This may cause problems when calling this function with named arguments.
```

These also get printed out to the CLI, so they are somewhat annoying.

Fixes all of the warnings, except for `'Version' is deprecated. Deprecated in Java`, which gets suppressed (we are intentionally using the deprecated `Version`, to help support older versions of AGP that use that deprecated class).
2024-05-21 20:56:50 +00:00
Polina Cherkasova 654a5b3773
Fix leaky test. (#148788) 2024-05-21 12:17:26 -07:00
Bruno Leroux 7727ff46cc
Add DropdownButton.menuWidth (#148125)
## Description

This PRs add a new parameter to `DropdownButton` which allows to set the menu width.
This can be useful when `DropdownButton.selectedItemBuilder` is provided and builds small items, see https://github.com/flutter/flutter/issues/133267.

I’m not fond of adding new property, especially for a widget which is supposed to be replaced on M3, but in this case it might makes sense because it is a way to not break existing code while addressing a legitimate issue.

## Related Issue

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

## Tests

Adds 1 test.
2024-05-21 19:15:21 +00:00
Gray Mackall 7a3baded76
Add a migrator to remove FlutterMultiDexApplication.java (#148515)
Fixes https://github.com/flutter/flutter/issues/148368.

See [my comment](https://github.com/flutter/flutter/issues/148368#issuecomment-2116133180) for the specific context.
2024-05-21 18:53:53 +00:00
Ian Hickson 450b072a21
Remove hidden dependencies on LocalProcessManager (#148096)
This is part 15 of a broken down version of the #140101 refactor.

This only makes one dependency explicit. Further PRs will do the same for other dependencies, until these APIs have no hidden dependencies.

This PR makes no effort to keep the order of parameters reasonable. There is an existing TODO to do a refactor sweep later that does nothing but reorder arguments/parameters/fields to be consistent.
2024-05-21 16:59:16 +00:00
Tirth 059189e756
Adds Missing onHover & onFocusChange for OutlinedButton.icon (#144374)
Adds Missing `onHover` & `onFocusChange` for `OutlinedButton.icon`.

I've copy-pasted the tests of OutlinedButton for OutlinedButton.icon.

Also, `onHover` & `onFocusChange` are already there in ElevatedButton.icon, FilledButton.icon & TextButton.icon, but tests files for these 3 doesn't test for icon variants.

Fixes #144256
2024-05-21 16:44:05 +00:00
Nate 870c5541c3
switch expressions: finale (#148711)
### fixes #136139

<br>

<details open> <summary><b>getting sentimental in the PR description</b> (click to collapse)<br><br></summary>

The past 7 months have been quite the journey—I made some huge blunders and some huge accomplishments—a very fun time overall.

I really appreciate the people who took the time to perform code review for my refactoring shenanigans: **christopherfujino**, **andrewkolos**, **LongCatIsLooong**, **gspencergoog**, **loic-sharma**, **Piinks**, **bernaferrari**, **bartekpacia**, **bleroux**, **kevmoo**, **rakudrama**, **XilaiZhang**, **QuncCccccc**, **MominRaza**, and **victorsanni**.

And a huge shoutout to 2 individuals:
- @justinmc, for offering to sponsor me for commit access (words could not describe my excitement)
- @goderbauer, for being super duper proactive and consistent with code review

<br>

</details>

This pull request makes 13 "switch statements → switch expressions" PRs in total, reducing the LOC in this repo by **1,974**!

From now on, I'll make sure to request a test exemption for each refactoring PR 🙂
2024-05-21 16:18:05 +00:00
Matej Knopp 454dd7e29c
[iOS] specify minimum os version for native asset frameworks (#148504)
Fixes https://github.com/flutter/flutter/issues/148501
2024-05-21 16:16:08 +00:00
davidhicks980 e6fa865581
Removed brand references from MenuAnchor.dart (#148760)
Rephrases identifier from _isApple to _isCupertino.

@gspencergoog and @victorsanni
2024-05-21 16:12:05 +00:00
Zachary Anderson b6bed5aaf2
Skip flaky test in expression_evaluation_test.dart (#148737)
Skipping for https://github.com/flutter/flutter/issues/148704
2024-05-21 08:35:40 -07:00
Ian Hickson d02292dbc4
Make FileSystem dependency explicit througout (more). (#148095)
This is part 14 of a broken down version of the #140101 refactor.

This is an extension of part 8 (#146008), which had omitted removing the filesystem dependency in the SkiaGoldClient class.

This only makes one dependency explicit. Further PRs will do the same for other dependencies, until these APIs have no hidden dependencies.

This particular change attempts to be minimal. I made no effort to keep the order of parameters reasonable here. I have a TODO to do a refactor sweep later that does nothing but reorder arguments/parameters/fields to be consistent.
2024-05-21 04:25:37 +00:00
Jenn Magder 165e535474
Remove add-to-app bitcode warning (#148587)
Flutter deprecated bitcode in 2022 https://github.com/flutter/flutter/pull/112828, and introduced a warning in #112900 to let add-to-app devs know.

Apps should be migrated by now, remove the outdated warning.
2024-05-20 23:52:15 +00:00
Renzo Olivares 5890a2fc73
SelectionArea's selection should not be cleared on loss of window focus (#148067)
This change fixes an issue where SelectionArea would clear its selection when the application window lost focus by first checking if the application is running. This is needed because `FocusManager` is aware of the application lifecycle as of https://github.com/flutter/flutter/pull/142930 , and triggers a focus lost if the application is not active.

Also fixes an issue where the `FocusManager` was not being reset on tests at the right time, causing it always to build with `TargetPlatform.android` as its context.
2024-05-20 23:45:08 +00:00
LouiseHsu 185f526ddf
Fixes incorrect read/write permissions on Flutter.framework and FlutterMacOS.framework (#148580)
Fixes https://github.com/flutter/flutter/issues/148354

Fixes https://github.com/flutter/flutter/issues/147142
Closes https://github.com/flutter/flutter/pull/147144

## 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.
2024-05-20 14:41:52 -07:00
Jason Simmons a45cde5998
Remove the no-shuffle tag on the flutter_tools create_test suite (#148688)
The issue was fixed by https://github.com/flutter/flutter/pull/148616
2024-05-20 18:58:59 +00:00
Andrew Kolos 04cd1619a3
log incoming vm service messages in FlutterVMService::runInView (#148596)
In service of https://github.com/flutter/flutter/issues/146879. Please see https://github.com/flutter/flutter/issues/146879#issuecomment-2118629953.

In summary, when the test flakes, `onRunnable` is not completing despite the VmService object receiving an `IsolateRunnable` event. 

This PR adds some logging code to print all events received inside of `FlutterVmService::runInView`.
2024-05-20 18:55:24 +00:00
Dimil Kalathiya e2de8d80f6
fixes CupertinoModalPopupRoute (#147823) 2024-05-20 10:43:18 -07:00
Nate 76a07a1646
Implement new AnimationStatus getters (#148570)
PR #147801 introduced some convenient `AnimationStatus` getters, but I just realized that `AnimationController` now has 2 getters for the same thing: `isAnimating` and `isRunning`.

The intent of this pull request is to correct that mistake, and implement the getters in the appropriate places.
2024-05-20 17:43:03 +00:00
Nate 73ecc8a9b2
Reland "if chains → switch expressions" (#148634)
I did a goof a while back:

![late initialization error](https://github.com/flutter/flutter/assets/10457200/47dc423f-0dd0-4869-9a11-59cb7d1ea46e)

Now that [the bug is fixed](e9d403541f), I think we're good to re-implement the if-chains cleanup!

Related:

- https://github.com/flutter/flutter/pull/147793
- https://github.com/flutter/flutter/pull/148556
- https://github.com/flutter/flutter/issues/148548
2024-05-20 17:43:00 +00:00
Greg Spencer 333c076e53
Factor out RawView, make View listen to engine generated view focus events (#143259)
## Description

This factors out a separate `RawView` that doesn't add a `MediaQuery` or a `FocusScope`. This PR also adds a new method `WidgetsBindingObserver.didChangeViewFocus` which allows the observer to know when the `FlutterView` that has focus has changed.

It also makes the `View` widget a stateful widget that contains a `FocusScope` and ` FocusTraversalGroup` so that it can respond to changes in the focus of the view.

I've also added a new function to `FocusScopeNode` that will allow the scope node itself to be focused, without looking for descendants that could take the focus. This lets the focus be "parked" at the `FocusManager.instance.rootScope` so that nothing else appears to have focus.

## Tests
 - Added tests for the new functionality.
2024-05-20 17:17:55 +00:00
Nate adf279f308
Fix template manifest test (#148616)
`'flutter create should tool exit if the template manifest cannot be read'` fails consistently, as shown by #148614.

The test expects a `ToolExit` with the message "Unable to read the template manifest", but depending on how the test is being run, a different exception ("Cannot create a project within the Flutter SDK") is sometimes thrown first.

This pull request relocates the test project to `dev/` to prevent the extraneous error.
2024-05-18 23:42:22 +00:00
Jason Simmons 791a782a8f
Disable shuffling in the flutter_tools create_test suite (#148619)
This suite is failing when run with --test-randomize-ordering-seed=20240518

This is currently blocking the engine->framework roller
2024-05-18 23:02:23 +00:00
Victor Sanni f7012db828
Move Feedback to widgets layer (#148523)
Currently, `Feedback` exists in the Material layer. However, not only is
`Feedback` not material-opinionated, but it is an abstract class that
defines its functionality depending on the user's platform.

It makes sense that `Feedback` should exist in the widgets layer
instead. This makes it easier to incorporate platform specific
`Feedback` updates as they arrive, fixing issues like #148391.

## 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].
- [ ] 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-05-18 10:41:56 -07:00
Andrew Kolos ac6409b311
Swap crash reporting with unified analytics (#148525)
Fixes: https://github.com/flutter/flutter/issues/147260

(this is a remake of https://github.com/flutter/flutter/pull/147296; in hindsight I could have force-pushed there instead but 🤷)
2024-05-18 01:30:13 +00:00
Zachary Anderson 597462a3c4
Revert "if chains → switch expressions" (#148556)
Reverts flutter/flutter#147793

Introduced https://github.com/flutter/flutter/issues/148548.
2024-05-17 10:27:02 -07:00
Nate fa9992eff6
switch statement cleanup (#148382)
This PR is step 12 in the journey to solve issue #136139 and make the
entire Flutter repo more readable.

Most of it involves implementing switch expressions, and there's also a
few other random things that I wanted to clean up a bit.
2024-05-16 17:16:06 -07:00
stuartmorgan b98ffdc467
Add PrivacyInfo.xcprivacy to plugin template (#148485)
Adds an empty privacy manifest, and commented out code to include it in the build, to the plugin template. This will make it much easier to explain how to add a privacy manifest in plugin docs, since instead of explaining the format of the file from scratch and providing example code to inculde it, we can just instruct people to add entries to an exisitng file and then uncomment a line or two. This will also make it much easier to figure out from the template output itself how to add support for people who don't find the documentation.

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

Fixes https://github.com/flutter/flutter/issues/140013
2024-05-16 19:58:11 +00:00
stuartmorgan 3a27301013
Fix iOS reference in macOS Cocoapods error (#148506)
Fixes a Cocoapods error message that was hard-coded to reference iOS to instead reference iOS or macOS as appropriate.

Fixes https://github.com/flutter/flutter/issues/146744
2024-05-16 19:58:08 +00:00
Nate 6b383615c6
Enhanced enum features for AnimationStatus (#147801)
Based on issue #147799, this pull request adds two `AnimationStatus` getters.

```dart
bool get isRunning => switch (this) {
  forward   || reverse   => true,
  completed || dismissed => false,
};

bool get aimedForward => switch (this) {
  forward || completed => true,
  reverse || dismissed => false,
};
```

I also added a `.toggle()` method for animation controllers that makes use of `aimedForward`.
2024-05-16 17:57:53 +00:00