Commit graph

3653 commits

Author SHA1 Message Date
Lam Thanh Nhan bd651347e1
Update examples/api for android platform (#147102)
In the `examples/api`, the Android platform missed this step while migrating to the declarative plugins {} block described in [flutter-gradle-plugin-apply](https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply), so all examples of `examples/api` cannot run.

Fixes #147100

*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-04-22 20:14:13 +00:00
Anis Alibegić 140edb9883
Fixed few typos (#147087)
Here's another PR with a couple of typos fixed. As you can see there was a typo in _fileReferenceI**n**dentifiers_, in class _ParsedProjectInfo._ Maybe we should do some check on that since I'm not sure if that property is used somewhere outside Flutter?
2024-04-22 16:49:19 +00:00
Kostia Sokolovskyi 142e247fab
Add tests for gesture_detector.0.dart and gesture_detector.1.dart API examples. (#146724)
This PR contributes to https://github.com/flutter/flutter/issues/130459

### Description
- Adds `examples/api/test/widgets/gesture_detector/gesture_detector.0_test.dart` test
- Adds `examples/api/test/widgets/gesture_detector/gesture_detector.1_test.dart` test
2024-04-19 23:08:04 +00:00
Kostia Sokolovskyi a4e9026589
Add test for animated_padding.0.dart API example. (#146718)
This PR contributes to https://github.com/flutter/flutter/issues/130459

### Description
- Adds `examples/api/test/widgets/implicit_animations/animated_padding.0_test.dart` test
2024-04-19 20:16:56 +00:00
Kostia Sokolovskyi cb3e689167
Add test for dismissible.0.dart API example. (#146723)
This PR contributes to https://github.com/flutter/flutter/issues/130459

### Description
- Adds `examples/api/test/widgets/dismissible/dismissible.0_test.dart` test
2024-04-19 19:21:08 +00:00
Kostia Sokolovskyi e09ee6be9b
Add test for preferred_size.0.dart API example. (#146725)
This PR contributes to https://github.com/flutter/flutter/issues/130459

### Description
- Adds `examples/api/test/widgets/preferred_size/preferred_size.0_test.dart` test
2024-04-19 19:08:07 +00:00
auto-submit[bot] bb4c9b381e
Reverts "Add generic type for result in PopScope (#139164)" (#147015)
Reverts: flutter/flutter#139164
Initiated by: chunhtai
Reason for reverting: hard breaking change
Original PR Author: chunhtai

Reviewed By: {justinmc}

This change reverts the following previous change:
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 22:36:26 +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
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
Derek Xu cf26b1150f
Unpin frontend_server_client and roll packages (#146650) 2024-04-17 12:43:20 -04: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
Matt Carroll 4daad32a01
Added missing tests for OverflowBar example. (#146780)
Added missing tests for OverflowBar example. Issue #130459
2024-04-16 22:10:56 +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
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
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
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
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
flutter-pub-roller-bot 84c7298ba1
Roll pub packages (#146444)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-04-08 18:48:19 +00:00
Taha Tesser cba689cbf8
Add a custom shape example for AppBar.shape (#146421)
fixes [AppBar shape disappears on AppBar elevation change when scrolling](https://github.com/flutter/flutter/issues/145945)

### Description
This PR adds an example for complete custom app bar for the  `AppBar.shape` property.

### Preview

![Screenshot 2024-04-08 at 14 21 04](https://github.com/flutter/flutter/assets/48603081/ae3eda2b-b709-4652-9f2c-dd7b7dcfeb5c)
2024-04-08 18:42:07 +00:00
Gray Mackall 22e0c89f0a
Reland "Bump to AGP 8.1/Gradle 8.3 (almost) everywhere" (#146307)
Relands https://github.com/flutter/flutter/pull/146181.

Just 3 commits:
1. a revert of the revert
2. the fix described in https://github.com/flutter/flutter/pull/146181#issuecomment-2038238869
3. updating two postsubmit tests from Java 11 to 17, as that is required for this new AGP version.

I've verified that `flutter build apk --flavor paid --debug` fails in `dev/integration_tests/flavors/` with the error in ci without (2), and succeeds with it. 

I've also verified that the `dev/benchmarks/complex_layout` app builds successfully with Java 17.

That covers all the postsubmits that failed according [to the dashboard](https://flutter-dashboard.appspot.com/#/build).
2024-04-05 19:09:20 +00:00
auto-submit[bot] 23ecc37ed2
Reverts "Bump to AGP 8.1/Gradle 8.3 (almost) everywhere (#146181)" (#146305)
Reverts: flutter/flutter#146181
Initiated by: LongCatIsLooong
Reason for reverting: https://ci.chromium.org/ui/p/flutter/builders/prod/Windows_android%20flavors_test_win/11086/overview
Original PR Author: gmackall

Reviewed By: {reidbaker, christopherfujino}

This change reverts the following previous change:
Bump almost all tests to AGP 8.1 and Gradle 8.3

Flutter gallery is excluded, because it uses discontinued plugins that in turn use old Gradle versions, and that prevents upgrading. Will take some extra work to figure out what to do there.

Should bump templates next

Entire PR generated with the lockfile generation script, except for:
1. changes within `dev/integration_tests/gradle_deprecated_settings/android/`, which must be done manually (and exclusion of the gallery for reason mentioned above).
2. Changes to many `AndroidManifest.xml` files to remove the `package` attribute and instead set that same value in the `build.gradle`, in the `namespace` attribute of the `android` closure (corresponds to an AGP behavior change, see  https://d.android.com/r/tools/upgrade-assistant/set-namespace).
3. Removes the use of the `battery` plugin in `android_embedding_v2_smoke_test` because the plugin is discontinued, unused, and blocks upgrading the AGP version for that app because the discontinued plugin itself uses a very old AGP version.
2024-04-04 21:07:17 +00:00
Gray Mackall ab520c9849
Bump to AGP 8.1/Gradle 8.3 (almost) everywhere (#146181)
Bump almost all tests to AGP 8.1 and Gradle 8.3

Flutter gallery is excluded, because it uses discontinued plugins that in turn use old Gradle versions, and that prevents upgrading. Will take some extra work to figure out what to do there.

Should bump templates next

Entire PR generated with the lockfile generation script, except for:
1. changes within `dev/integration_tests/gradle_deprecated_settings/android/`, which must be done manually (and exclusion of the gallery for reason mentioned above).
2. Changes to many `AndroidManifest.xml` files to remove the `package` attribute and instead set that same value in the `build.gradle`, in the `namespace` attribute of the `android` closure (corresponds to an AGP behavior change, see  https://d.android.com/r/tools/upgrade-assistant/set-namespace).
3. Removes the use of the `battery` plugin in `android_embedding_v2_smoke_test` because the plugin is discontinued, unused, and blocks upgrading the AGP version for that app because the discontinued plugin itself uses a very old AGP version.
2024-04-04 20:11:09 +00:00
Kostia Sokolovskyi 8101f13a35
Add tests for theme_extension.1.dart API example. (#145819)
This PR contributes to https://github.com/flutter/flutter/issues/130459

### Description
- Adds tests for `examples/api/lib/material/theme/theme_extension.1.dart`
2024-04-03 23:39:17 +00:00
Taha Tesser 80d774d8dc
Add DropdownMenu cursor behavior sample (#146133)
fixes [Add `DropdownMenu` cursor behavior sample to  `DropdownMenu.enabled` & `DropdownMenu.requestFocusOnTap`  docs](https://github.com/flutter/flutter/issues/146131)

### Preview
![Screenshot 2024-04-02 at 17 12 43](https://github.com/flutter/flutter/assets/48603081/33865ca0-d48d-4651-9c83-9bdcd6369cb8)
2024-04-03 16:31:06 +00:00
Ian Hickson 950ec1c405
Enhance ColorScheme.fromSeed with a new variant parameter (#144805)
Fixes #144649

This PR is to add an enhancement for `ColorScheme.fromSeed()`.  When we input a brighter color with a high chroma and we want the resulting `ColorScheme` respects the source color, we can achieve this by setting

```dart
ColorScheme.fromSeed(
  seedColor: sourceColor,
  variant: Variant.fidelity,
  ...
)
```

Here is a demo for `ColorScheme` constructed by all 9 variants:
![Screenshot 2024-03-13 at 4 33 02 PM](https://github.com/flutter/flutter/assets/36861262/2cdbe559-67ff-4f8b-bd48-ccff5131b949)
![Screenshot 2024-03-13 at 4 33 07 PM](https://github.com/flutter/flutter/assets/36861262/e6af2362-c501-499b-8880-06a321de91e6)
2024-04-03 15:54:34 +00:00
Kostia Sokolovskyi e6f078fff5
Add tests for material_state_mouse_cursor.0.dart API example. (#145987)
This PR contributes to https://github.com/flutter/flutter/issues/130459

### Description
- Updates `examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart` to allow enable/disable `ListTile` in tests;
- Adds tests for `examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart`.
2024-04-03 02:39:46 +00:00
Qun Cheng 69db714fbb
Update material_color_utilities package version to latest 0.11.1 (#145959)
This PR is to update material_color_utilities package version to the latest. `material_color_utilities/scheme/scheme_fruit_salad.dart` and `material_color_utilities/scheme/scheme_rainbow.dart` are exported after version 0.9.0.

Once this PR is merged, we don't need to explicitly import these two files like the change in PR #144805, which breaks some dependencies in `Google testing`.
2024-04-03 02:16:13 +00:00
Renzo Olivares 2a37c6f307
Implement SelectionArea triple click gestures (#144563)
This change adds support for triple click to select a paragraph at the clicked position and triple click + drag to extend the selection paragraph-by-paragraph when using the SelectionArea widget.

This PR also:
* Makes `Text` widgets a `SelectionContainer` if a parent `SelectionRegistrar` exists.
* Fixes issues with selectable ordering involving `WidgetSpan`s.

Fixes: https://github.com/flutter/flutter/issues/104552
2024-04-02 21:10:52 +00:00
Kostia Sokolovskyi 5850651d60
Add test for animated_container.0.dart API example. (#145995)
This PR contributes to https://github.com/flutter/flutter/issues/130459

### Description
- Adds test for `examples/api/test/widgets/implicit_animations/animated_container.0_test.dart`
2024-04-01 20:25:40 +00:00
Bartek Pacia ec82f0d895
Flutter Gradle Plugin: add versionName and versionCode to FlutterExtension (#146044)
This PR is a follow-up of a previous PR of mine:
https://github.com/flutter/flutter/pull/141417. It was unfinished, i.e.
I only implemented it and used it in `examples/hello_world`. No "flutter
create" templates were modified.

This change is theoretically breaking, but in practice, I am pretty sure
nobody uses this. It was not accounced anywhere, the only app using it
is `examples/hello_world`. I did not do that (that=update docs and
templates) because I wanted a solution that is idiomatic in both Gradle
and Kotlin, and only now I found time to do this.

### Without this change

```groovy
defaultConfig {
    applicationId = "io.flutter.examples.hello_world"
    minSdk = flutter.minSdkVersion
    targetSdk = flutter.targetSdkVersion
    versionCode = flutter.versionCode()
    versionName = flutter.versionName()
}
```

### With this change

```groovy
defaultConfig {
    applicationId = "io.flutter.examples.hello_world"
    minSdk = flutter.minSdkVersion
    targetSdk = flutter.targetSdkVersion
    versionCode = flutter.versionCode
    versionName = flutter.versionName
}
```

Idiomatic getter - yay! It's consistent between assignment of all four
props.

### Issue

fixes https://github.com/flutter/flutter/issues/146067

## 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.

---------

Co-authored-by: Reid Baker <reidbaker@google.com>
2024-04-01 18:09:13 +02:00
Polina Cherkasova bca1d6ad1f
Upgrade leak_tracker. (#145997) 2024-03-29 12:31:52 -07:00
Polina Cherkasova 1a2f34ab5b
Upgrade leak_tracker. (#145940) 2024-03-29 02:39:17 +00:00
Renzo Olivares f5b65bad0f
Remove deprecated TextTheme members (#139255)
Part of: https://github.com/flutter/flutter/issues/143956
2024-03-28 01:20:55 +00:00
Taha Tesser 23687c5260
Add AnimationStyle to showBottomSheet and showModalBottomSheet (#145536)
fixes [Introduce animation customizable with `AnimationStyle` to `BottomSheet`](https://github.com/flutter/flutter/issues/145532)

### Default bottom sheet animation
![00-ezgif com-video-to-gif-converter](https://github.com/flutter/flutter/assets/48603081/a295b002-b310-4dea-8bc4-23b1d299748c)

### Custom bottom sheet animation
![01-ezgif com-video-to-gif-converter](https://github.com/flutter/flutter/assets/48603081/8c5c3d5f-e67d-4ed5-880d-f17d262087e1)

### No bottom sheet animation
![02-ezgif com-video-to-gif-converter](https://github.com/flutter/flutter/assets/48603081/872409d8-8a8d-4db9-b95b-7f96a62cdffc)
2024-03-25 08:39:05 +00:00
LongCatIsLooong d755bc222b
Replace RenderBox.compute* with RenderBox.get* and add @visibleForOverriding (#145503)
`@visibleForOverriding` + `@protected` unfortunately does not catch the case where a `compute*` method was overridden in a subtype and the overide was called in that same type's implementation.

I did not add a `flutter_ignore` for this because it doesn't seem there will be false positives.
2024-03-22 02:44:55 +00:00
Greg Spencer 0f685f88c6
Add some cross references in the docs, move an example to a dartpad example (#145571)
## Description

This adds some "See also" links to some docs for `TweenAnimationBuilder` and `ValueListenableBuilder`.

Also, moved a "snippet" example in `ValueListenableBuilder` into the examples directory as a Dartpad example.

## Tests
 - Added test for the example.
2024-03-22 02:35:11 +00:00
Jackson Gardner 31209d04ff
flutter test --wasm support (#145347)
* Adds support for `flutter test --wasm`.
  * The test compilation flow is a bit different now, so that it supports compilers other than DDC. Specifically, when we run a set of unit tests, we generate a "switchboard" main function that imports each unit test and runs the main function for a specific one based off of a value set by the JS bootstrapping code. This way, there is one compile step and the same compile output is invoked for each unit test file.
* Also, removes all references to `dart:html` from flutter/flutter.
* Adds CI steps for running the framework unit tests with dart2wasm+skwasm
  * These steps are marked as `bringup: true`, so we don't know what kind of failures they will result in. Any failures they have will not block the tree at all yet while we're still in `bringup: true`. Once this PR is merged, I plan on looking at any failures and either fixing them or disabling them so we can get these CI steps running on presubmit.

This fixes https://github.com/flutter/flutter/issues/126692
2024-03-21 20:08:07 +00:00
flutter-pub-roller-bot 61b3f975a0
Roll pub packages (#145476)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-03-21 00:09:24 +00:00
Vatsal Bhesaniya 01fc13d9f9
Add helper widget parameter to InputDecoration (#145157)
This pull request introduces a new field named `helper` to the InputDecoration class. This field allows for specifying a widget containing contextual information about the InputDecorator.child's value. Unlike `helperText`, which accepts a plain string, `helper` supports widgets, enabling functionalities like tappable links for further explanation. This change aligns with the established pattern of `error`, `label`, `prefix`, and `suffix`.

fixes [#145163](https://github.com/flutter/flutter/issues/145163)
2024-03-20 20:48:05 +00:00
Mitchell Goodwin 6190c5eea1
Widget state properties (#142151)
Fixes #138270.

Moves the majority of the logic of MaterialStateProperties down to the widgets layer, then has the existing Material classes pull from the widgets versions.
2024-03-19 17:58:13 +00:00
goodmost 3236957f02
chore: fix some comments (#145397)
fix some comments
2024-03-19 17:00:24 +00: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 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
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
Elias Elfarri 46cb2d7b01
Write unit tests for API Examples of checkbox.0, checkbox.1 (#144888)
Write unit tests for API Examples of checkbox.0, checkbox.1

Part of  #130459
2024-03-12 16:25:58 +00: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
Polina Cherkasova a04fe3169a
Upgrade vm_service. (#144845) 2024-03-08 17:09:07 -08:00
Michael Goderbauer 9e46c67e9a
Fix code sample failing in smoke test (#144709)
This fixes the silent failure reported in https://github.com/flutter/flutter/issues/144353. I am experimenting in https://github.com/flutter/flutter/pull/144706 with whether the failure should have been non-silent.
2024-03-06 20:51:52 +00:00
Hans Muller 52961f761f
Updated the smiley TextButton example again (#144630)
Improved the smiley image TextButton example a little. Handling the case where the `Future.delayed` object that represents the button's one second long action is superseded by a second button press that triggers a new one-second action. This does complicate the example - just a little - but it's a little more robust. In case someone copy-and-pastes the code.

The TextButton example was recently updated: https://github.com/flutter/flutter/pull/144583
2024-03-05 20:57:02 +00:00