23688 Commits

Author SHA1 Message Date
David Iglesias
111b4fe6d1
[web] Set COEP:credentialless on flutter run/drive. (#152413)
This PR changes the value of the `COEP` response header from `require-corp` to `credentialless` in the Flutter tool, when running `flutter run`/`drive` for Web projects.

This enables running tests compiled to wasm, that access 3P resources (like Google Maps) without blocking those resources.

Docs:

* https://developer.chrome.com/blog/coep-credentialless-origin-trial#credentialless_to_the_rescue

## Issue

* https://github.com/flutter/flutter/issues/152411
2024-07-30 23:14:06 +00:00
hangyu
dc6a15995e
Reland #151599 (Add button semantics in list tile ) with a flag to control behavior. (#152526)
https://github.com/flutter/flutter/pull/151599 was reverted because it was a breaking change to g3

Will reland 151599 in 5 steps 
1. Make changes with an additional parameter ( bool internalAddSemanticForOnTap = false)  
2. Send regular CLs in google3 to pass internalAddSemanticForOnTap: true, and update the tests / text goldens accordingly.
3. Send a PR to flip the default value to true.
4. Send CLs internally to remove internalAddSemanticForOnTap: true.
5. Send another PR to remove the now-redundant internalAddSemanticForOnTap flag.

 (<----This PR is step 1)
2024-07-30 20:38:06 +00:00
Taha Tesser
cd60efc618
Fix default avatar icon theme size for Material 2 (#152307)
fixes [ActionChip avatar still does not respect padding](https://github.com/flutter/flutter/issues/116508)

### 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 MaterialApp(
      theme: ThemeData(brightness: Brightness.dark, useMaterial3: false),
      home: Scaffold(
        body: Center(
          child: Builder(
            builder: (BuildContext context) {
              return Chip(
                padding: const EdgeInsets.all(16.0),
                avatar: const Icon(Icons.favorite),
                label: const Text('Chip A'),
                onDeleted: () {},
              );
            },
          ),
        ),
      ),
    );
  }
}
```

</details>

### Before

<img width="490" alt="Screenshot 2024-07-25 at 16 24 08" src="https://github.com/user-attachments/assets/45408aa2-b3ab-4ff9-ae72-53a91c87c76a">

### After

<img width="490" alt="Screenshot 2024-07-25 at 16 23 56" src="https://github.com/user-attachments/assets/07ba367d-9ca3-46cc-8122-d1155dd2f32b">
2024-07-30 16:44:08 +00:00
engine-flutter-autoroll
61848a448b
Roll Flutter Engine from c58d87d62c20 to 31bb9f98472a (8 revisions) (#152555)
c58d87d62c...31bb9f9847

2024-07-30 skia-flutter-autoroll@skia.org Roll Skia from 1339015537a3 to 2cb7f5443a48 (4 revisions) (flutter/engine#54212)
2024-07-30 skia-flutter-autoroll@skia.org Roll Dart SDK from 6ab9452297e0 to ad4d2e8b2c65 (1 revision) (flutter/engine#54211)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com Bump ossf/scorecard-action from 2.3.3 to 2.4.0 (flutter/engine#54208)
2024-07-30 skia-flutter-autoroll@skia.org Roll Skia from 20e4dfabb6b2 to 1339015537a3 (1 revision) (flutter/engine#54207)
2024-07-30 skia-flutter-autoroll@skia.org Roll Dart SDK from e8eca6f05494 to 6ab9452297e0 (1 revision) (flutter/engine#54206)
2024-07-30 skia-flutter-autoroll@skia.org Roll Skia from 56de22c39d0e to 20e4dfabb6b2 (1 revision) (flutter/engine#54205)
2024-07-30 skia-flutter-autoroll@skia.org Roll Skia from 946ca24d03ab to 56de22c39d0e (1 revision) (flutter/engine#54204)
2024-07-30 skia-flutter-autoroll@skia.org Roll Skia from 8167ff71af2c to 946ca24d03ab (2 revisions) (flutter/engine#54202)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
2024-07-30 16:42:10 +00:00
Bruno Leroux
85960d24b9
Fix Shortcut label for CharacterActivator does not include modifiers (#152233)
## Description

This PR fixes the shortcut label for CharacterActivator with modifiers keys.

**Before**:

![image](https://github.com/user-attachments/assets/1cb8defe-2600-45ef-878d-fbdde5aaf2ad)

**After**:

![image](https://github.com/user-attachments/assets/cd3b1c79-2f23-40fd-b0b9-934fa182fff3)

## Related Issue

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

## Tests

Adds 1 test.
2024-07-30 07:03:00 +00:00
Greg Spencer
b05c2fad0c
Add find.backButton finder and StandardComponentType enum to find components in tests. (#149349)
## Description

This adds `find.backButton()` in the Common Finders to allow finding different types of standard UI elements. It works by attaching a key made from an enum value in a new enum called `StandardComponentType` to all of the standard widgets that perform the associated function.

I also substituted the finder in several places where it is useful in tests.

This allows writing tests that want to find the "back" button without having to know exactly which icon the back button uses under what circumstances.  To do it correctly is actually quite complicated, since there are several adaptations that occur (based on platform, and whether it is web or not).

## Tests
 - Added tests.
2024-07-30 01:29:31 +00:00
Victor Sanni
e33eb5b46e
Stop CupertinoScrollbar's track from paging the scroll view on tap (#152197)
Fixes https://github.com/flutter/flutter/issues/120429
2024-07-29 23:02:02 +00:00
Jonah Williams
102cd01693
[flutter_tools] remove raster stats CLI option. (#152501)
The raster stats feature is being removed from devtools and the engine. Remove the CLI option as well.

Fixes https://github.com/flutter/flutter/issues/144191
Fixes https://github.com/flutter/flutter/issues/132169
2024-07-29 20:30:54 +00:00
Qun Cheng
2e7fa83f67
Normalize Card theme (#151914)
This PR is to make preparations to make `CardTheme` conform to Flutter's conventions for component themes:
* Added a `CardThemeData` class which defines overrides for the defaults for `Card` properties.
* Added 2 `CardTheme` constructor parameters: `CardThemeData? data` and `Widget? child`. This is now the preferred way to configure a `CardTheme`:
```dart
CardTheme(
  data: CardThemeData(color: xxx, elevation: xxx, ...),
  child: Card(...)
)
```

These two properties are made nullable to not break existing apps which has customized `ThemeData.cardTheme`.
* Changed the type of theme defaults from `CardTheme` to `CardThemeData`.

TODO: 
* Fix internal failures that may have breakages.
* Change the type of `ThemeData.cardTheme` from `CardTheme` to `CardThemeData`. This may cause breaking changes, a migration guide will be created.

Addresses the "theme normalization" sub project within https://github.com/flutter/flutter/issues/91772
2024-07-29 16:48:06 +00:00
auto-submit[bot]
e8d4c98b07
Reverts "Add button semantics in list tile (#151599)" (#152425)
Reverts: flutter/flutter#151599
Initiated by: chingjun
Reason for reverting: broke an internal test.
Original PR Author: hangyujin

Reviewed By: {chunhtai}

This change reverts the following previous change:
fixes: https://github.com/flutter/flutter/issues/111960
2024-07-27 04:40:17 +00:00
Matan Lurey
40d9fcf767
Document that flutter drive --test-arguments can opt-in to dart test (#152410)
Closes https://github.com/flutter/flutter/issues/51135.
Closes https://github.com/flutter/flutter/issues/145499.

Making this the _default_, or better discoverable, is tracked in
https://github.com/flutter/flutter/issues/152409.

You'll notice I also removed `-rexpanded`; @jonahwilliams believes that
was accidentally copied over from else-where, and never did anything
(someone I guess could have parsed it in `void main(...)`, but given
https://github.com/flutter/flutter/issues/51135 &
https://github.com/flutter/flutter/issues/145499 that seems unlikely.
2024-07-26 18:25:58 -07:00
hangyu
37dff27324
Add button semantics in list tile (#151599)
fixes: https://github.com/flutter/flutter/issues/111960 

## 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/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#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/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-07-26 16:34:53 -07:00
Jenn Magder
e36d9234e8
Change flutter_build_with_compilation_error_test to check stdout or stderr (#152404)
On Xcode 16 beta 3 stderr is:
```
** BUILD FAILED **
```
stdout is:
```
Writing result bundle at path:
	/var/folders/fm/wjzsj_z95ydgn4khxqgbtqx000mfq2/T/flutter_tools.PeJZlH/flutter_ios_build_temp_dirqmiKld/temporary_xcresult_bundle

error: lib/main.dart:13:11: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
  int x = 'String';
          ^
Target kernel_snapshot_program failed: Exception
Failed to package /Users/m/Projects/test_create.
note: Disabling previews because SWIFT_VERSION is set and SWIFT_OPTIMIZATION_LEVEL=-O, expected -Onone (in target 'Runner' from project 'Runner')
note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
```

The tool output of `flutter build ios` shows both:
```
Building com.example.testCreate for device (ios-release)...
Automatically signing iOS for device deployment using specified development team
in Xcode project: S8QB4VV633
Running Xcode build...
Xcode build done.                                           10.1s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    Writing result bundle at path:
    	/var/folders/fm/wjzsj_z95ydgn4khxqgbtqx000mfq2/T/flutter_tools.Dgnlxc/flutt
    	er_ios_build_temp_dirpKTDdk/temporary_xcresult_bundle

    error: lib/main.dart:13:11: Error: A value of type 'String' can't be
    assigned to a variable of type 'int'.
      int x = 'String';
              ^
    Target kernel_snapshot_program failed: Exception
    Failed to package /Users/magder/Projects/test_create.
    note: Disabling previews because SWIFT_VERSION is set and
    SWIFT_OPTIMIZATION_LEVEL=-O, expected -Onone (in target 'Runner' from
    project 'Runner')
    note: Run script build phase 'Run Script' will be run during every build
    because the option to run the script phase "Based on dependency analysis" is
    unchecked. (in target 'Runner' from project 'Runner')
    note: Run script build phase 'Thin Binary' will be run during every build
    because the option to run the script phase "Based on dependency analysis" is
    unchecked. (in target 'Runner' from project 'Runner')

Encountered error while building for device.
```

The point of this test is that you can see the error `int x = 'String';` error in the tool output. https://github.com/flutter/flutter/issues/72608#issuecomment-797473109

I think just updating the test to check stderr or stdout is sufficient without touching the tool behavior.

Fixes https://github.com/flutter/flutter/issues/151553
2024-07-26 23:12:14 +00:00
Victor Sanni
058a45da1f
[cupertino/icons.dart] Replace ligature references with characters corresponding to codepoints (#152387)
Part of #148075
2024-07-26 22:20:01 +00:00
Loïc Sharma
40843e3e61
Update minimum macOS version as needed in Swift package (#152347)
If Swift Package Manager is enabled, the tool generates a Swift package at `<ios/macos>/Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage/`. This Swift package is how the tool adds plugins to the Flutter project.

SwiftPM is strictly enforces platform versions: you cannot depend on a Swift package if its supported version is higher than your own.

On iOS, we use the project's minimum deployment version for the generated Swift package. If a plugin has a higher requirement, you'll need to update your project's minimum deployment version. The generated Swift package is automatically updated the next time you run the tool.

This updates macOS to do the same thing.

Fixes https://github.com/flutter/flutter/issues/146204
2024-07-26 22:02:08 +00:00
LongCatIsLooong
39643a8c9b
Update text_painter.dart (#152398)
Reuse `RegExp`s in `TextPainter`.
2024-07-26 21:36:04 +00:00
Loïc Sharma
f2b182f54e
Fix some tests that fail with Swift Package Manager enabled (#152267)
https://github.com/flutter/flutter/pull/152049 was reverted as it broke several post-submit tests. This relands the test fixes in https://github.com/flutter/flutter/pull/152049 without enabling Swift Package Manager on the master channel. 

This change is split into two commits:

1. dd1762abb9 - The changes in https://github.com/flutter/flutter/pull/152049
1. 00fdcfb7bb - Undoes the changes that enabled Swift Package Manager on the master channel

Part of https://github.com/flutter/flutter/issues/151567
2024-07-26 21:08:32 +00:00
Ben Konyi
33b402d24c
Reland "Launch DDS from Dart SDK and prepare to serve DevTools from DDS (#146593)" (#152386)
This reverts commit 7cdc23b3e1bae2bc7bc2d1f34773eaa3629d4fcc.

The failure in the `native_assets_test` integration test on Windows was caused by the DevTools process not being shutdown by the `ColdRunner` when running the profile mode portion of the test. This resulted in the test being unable to clean up the project created by the test as DevTools was still holding onto a handle within the directory. This PR adds back the mistakenly removed DevTools shutdown logic in the `ColdRunner`.
2024-07-26 20:51:19 +00:00
Angelo Silvestre
3a737c9a56
Make DragGestureRecognizer abstract methods public (#151627)
Resolves #151446

`DragGestureRecognizer` defines several private abstract methods that are implemented by its subclasses.
In the **super_editor** package, we'd like to extend `PanGestureRecognizer` to make it more aggressive, so it can win the gesture arena when placed inside a `CustomScrollview`. However, since we can't override private methods, tweaking this single function would involve copying the entire `DragGestureRecognizer` interface and its `PanGestureRecognizer` implementation.

<br>

Methods that were updated in this PR:

| Method | Rationale |
|---|---|
| `_hasSufficientGlobalDistanceToAccept` | This is the most important method for us. Overriding this method allows tweaking the PanGestureRecognizer to be more aggressive. |
| `_considerFling` | In **super_editor** we use the PanGestureRecognizer, but we want the fling gesture to behave as if it was a VerticalDragRecognizer. We'll use the fling gesture just to scroll vertically. |
| `_finalPosition` | I added a getter to be able to access it inside `_considerFling`. |
| `_globalDistanceMoved` | I added a getter to be able to access it inside `_hasSufficientGlobalDistanceToAccept`. |
2024-07-26 20:01:56 +00:00
Koji Wakamiya
112e4087e8
Fix cursor position when Unicode Zs category is entered in TextField (#152215)
Changed the cursor position to be the same as before flutter 3.22.0 when 17 character codes in the Unicode Zs category are entered into a TextField.

Extend the support for https://github.com/flutter/flutter/pull/149698. As a result, https://github.com/flutter/flutter/issues/149099 is resolved.

The code for the Unicode-Zs category is based on the following page.
https://www.compart.com/en/unicode/category/Zs

Fixes https://github.com/flutter/flutter/issues/149099
2024-07-26 19:55:49 +00:00
John Ryan
af431b38d2
Use more CORS headers for flutter run server (#152249)
Also update tests

Attempt #2 of #152048

cc: @cbracken
2024-07-26 18:01:41 +00:00
Kishan Rathore
f6144f0c25
feat: Add drag handle size to be configurable based on given size (#152085)
Feat: Drag handle size can now be changed to any given size.
So, In previous behaviour drag handle size was not able to extends beyond 48x48. But some user might want to change it.
In current behaviour,  drag handle size is default to same 48x48 but if drag handle size grows beyond that, we don't restrict it.

Fixes #149170
2024-07-26 16:15:36 +00:00
Matan Lurey
7f8ad8a4cb
Add and use an integration test with native(ADB) screenshots (#152326)
Closes https://github.com/flutter/flutter/issues/152325.

This PR is large due to generate `flutter create --platforms android`. A quick summary:

- Moves the integration test from `packages/flutter_driver/test` to `dev/integration_tests`
- Created a sample Flutter app that draws a blue rectangle
- Forked a subset of `package:flutter_goldens` that will work on the standalone Dart VM
- Forked a subset of `goldens.dart` (from `flutter_test`) to `src/native/goldens.dart` (i.e. `matchesGoldenFile`)

This ... works locally, but as usual I have no idea if it will work on Skia Gold so let's roll some dice.
2024-07-26 16:09:29 +00:00
Taha Tesser
bba6ea9a2d
Introduce TabBar.indicatorAnimation to customize tab indicator animation (#151746)
fixes [Add ability to customize `TabBar` indicator animation](https://github.com/flutter/flutter/issues/150508)

Similar option exist on Android
https://developer.android.com/reference/com/google/android/material/tabs/TabLayout#setTabIndicatorAnimationMode(int)

### Dartpad Example Preview
<img width="874" alt="Screenshot 2024-07-12 at 17 36 08" src="https://github.com/user-attachments/assets/e349c5aa-ee5d-46ce-9e44-4f02346603bd">

### Linear vs Elastic tab indicator animation

https://github.com/user-attachments/assets/d7ae3ae4-ae52-4ccd-89b1-75908bf8a34d
2024-07-26 11:54:28 +00:00
Greg Spencer
0f16a0e5e3
Adds a call to the PlatformDispatcher whenever the focus changes (#151268)
## Description

This adds a call to the `PlatformDispatcher` whenever the focus changes, so that the engine can decide what to do about view focus.  This lets widgets use autofocus, and when they are focused their view will also receive focus.

## Related Issues
 - Fixes https://github.com/flutter/flutter/issues/151251

## Tests
 - Added a test and some methods to the `TestPlatformDispatcher` to allow introspection of the values sent.
2024-07-26 00:27:37 +00:00
LongCatIsLooong
7b5462cc34
docImports for the widgets library (#152339)
https://github.com/flutter/flutter/issues/150800. The 2nd batch of `widgets` library `@docImport`s.

After this patch, in the `widgets` library:
```
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/scroll_view.dart: (TargetPlatformVariant.mobile)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/_platform_selectable_region_context_menu_web.dart: (ui_web.platformViewRegistry.registerViewFactory)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/primary_scroll_controller.dart: (TargetPlatformVariant.mobile)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/selectable_region.dart: (material, WidgetTester.dragFrom)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/basic.dart: (ui.Gradient.linear)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/framework.dart: (Finder)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart: (WidgetTester.pumpAndSettle)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/binding.dart: (WidgetTester.restartAndRestore, WidgetTester.pumpWidget, TestWidgetsFlutterBinding, testWidgets, TestWidgetsFlutterBinding.ensureInitialized)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/localizations.dart: (GlobalWidgetsLocalizations)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/scroll_controller.dart: (WidgetTester.pumpAndSettle)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/scrollbar.dart: (TargetPlatformVariant.desktop)
21 out-of-scope references in 11 files, 16 unique symbols were left unresolved.
```
2024-07-25 22:22:05 +00:00
Jackson Gardner
8f0e77696f
Set dart defines properly while in debug mode. (#152262)
Turns out just supporting the right value for `kDebugMode` was a lot simpler than I thought. Debug builds used to never go through the build system code path when using `flutter run`, but now that we have wasm this can occur with the run command.

This should address https://github.com/flutter/flutter/issues/148850
2024-07-25 22:00:50 +00:00
Bruno Leroux
d8ef702714
Cleanup InputDecoration.collapsed constructor (#152165)
## Description

This PR attemps to clarify the `InputDecoration.collapsed` documentation by explaining that it is not meant to be use with helper, label, counter, icons, prefixes and suffixes.

It also adds some parameters that make sense for a collapsed decoration (`hintMaxLines`, `hintFadeDuration`, `constraints`).

Removing parameters that should not have been added (`floatingLabelBehavior` and `floatingLabelAlignment`) will be part of another PR as it will require deprecations.

## Related Issue

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

## Tests

Adds 3 tests.
2024-07-25 20:51:00 +00:00
LongCatIsLooong
43b653e93f
Add a more typical / concrete example to IntrinsicHeight / IntrinsicWidth (#152246)
The current example:
> for example, when unlimited width is available and
/// you would like a child that would otherwise attempt to expand infinitely to
/// instead size itself to a more reasonable width.

doesn't seem to be the most useful example because most leaf widgets will just size themselves to their intrinsic size if the incoming constraints are not tight, so when 
I was reading the doc I wasn't able to come up with any concrete widget combination that would require the use of `IntrinsicHeight`.
2024-07-25 17:21:06 +00:00
Nate Biggs
8cf2161845
Modify stepping integration test to accommodate new DDC async semantics. (#152204)
Updates the expected steps in the async function defined within `stepping_project.dart`. 

The Dart web team is updating the async semantics of DDC to bring them in line with the other backends. Currently, the DDC async semantics don't adhere to the Dart spec and this can lead to inconsistent and surprising results.

However, the step-over operation doesn't work well yet with the new DDC async semantics. In the long run we intend to improve this but until then the debug stepper will have sporadic results that we can't model well with this test. When we are able to fix the stepper functionality, we will return this test to cover more of the async function being stepped over.
2024-07-25 03:22:29 +00:00
Nate Biggs
30cce4dcd2
Update fake_codec.dart to use Future.value instead of SynchronousFuture (#152182)
Upcoming changes to DDC change the async semantics of code produced by the compiler. The changes will bring the semantics more in line with those of dart2js and fix several bugs in the old semantics. However in landing those changes I experienced a test failure in [obscured_animated_image_test](https://github.com/flutter/flutter/blob/master/packages/flutter/test/widgets/obscured_animated_image_test.dart).

Some debugging uncovered that this is due to the use of `SynchronousFuture` in this `FakeCodec`. The old DDC async semantics forced an async gap when that future was [awaited](https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/painting/image_stream.dart#L1064). The new async semantics do not create an async gap here. This changes the render ordering of the widget tree created in the test leading to the test failure.

`Future.value` should be a reasonable substitute here and should achieve what the test was trying to achieve while also preserving the correct render ordering given the new DDC semantics.
2024-07-25 01:23:05 +00:00
Tong Mu
748afd9775
[CupertinoAlertDialog] Rewrite (#150410)
This PR rewrites `CupertinoAlertDialog` in a cleaner logic, mostly its layout.

There are two major difficulties to lay out `CupertinoAlertDialog`:
* Laying out the actions section, which switches between a horizontal mode (two buttons in a row) and a vertical mode (several buttons in a column). This PR rewrites it in a special layout widget, `_CupertinoAlertActionSection`.
* Allocating vertical space between the content section and the actions section. This reuses `_PriorityColumn`, which was created for the action sheet.

In a similar fashion to the action sheet, the management and configuration for dividers and background (overscrolls) were rewritten as well.

This PR tries to keep as much original code and behavior as possible since this PR is already very large. As a result, almost no tests are broken. Further improvement will be done in future PRs.
* The test that verifies painting overscrolls is replaced by a golden test, since the original test assumes that the background is painted in one rectangle.
2024-07-24 23:18:02 +00:00
Victor Sanni
373efb0764
Revert "Make CupertinoRadio's mouseCursor a WidgetStateProperty" (#152254)
Reverts flutter/flutter#151910, awaiting further discussion on `WidgetStateProperty`.
2024-07-24 22:47:55 +00:00
Renzo Olivares
00eeabf584
Fix: A selectable's selection under the active selection should not be cleared on right-click (#151851)
Fixes #150268

The issue was related to the check for selection geometry here: 22a5c6cb0a/packages/flutter/lib/src/widgets/selectable_region.dart (L2469-L2476) . Since `otherList == myList` is a reference check this would fail even if the selection rects inside the list contained in SelectionGeometry where the same causing the selectables inside the selection but outside the selectable containing the tapped position to have their selection cleared, use `listEquals` instead.
2024-07-24 22:46:22 +00:00
Byeongjin Kang
6fdcb0a511
feat: Add alignmentOffset to DropdownMenu (#151731)
Changes:
- Introduced `alignmentOffset` property to `DropdownMenu` to allow adjustment of menu alignment.
- Updated the `MenuAnchor` widget to utilize the new `alignmentOffset` property.
- Default value for `alignmentOffset` is `Offset.zero`, meaning no additional spacing by default.

Motivation: 
- This PR closes #151524 
- @nate-thegrate, please let me know if I need to make changes in order for this PR to be merged

The motivation behind this change is to provide developers with more control over the spacing between the `MenuAnchor` and `dropdownMenuEntries` in the `DropdownMenu` widget. This enhancement allows for better alignment and customization of the dropdown menu appearance.
| before | after |
| :---: | :---: |
| <img width="372" alt="Screenshot 2024-07-14 at 8 03 14 PM" src="https://github.com/user-attachments/assets/4a45b843-7fa4-44fd-843c-c7209c6f57ae">      |      <img width="364" alt="Screenshot 2024-07-14 at 8 03 27 PM" src="https://github.com/user-attachments/assets/12e8b857-aefb-4aaf-a310-4a002abcbc2f">   |

Initially, it was suggested to use a `SizedBox` to introduce spacing. However, upon further examination of the source code, it was discovered that the `DropdownMenuEntries` are rendered on the screen via an `OverlayPortal`. This necessitated leveraging the existing `alignmentOffset` property within the `MenuAnchor` for a more seamless and effective alignment adjustment.
2024-07-24 21:17:06 +00:00
Matan Lurey
09461925a3
Scaffolding for NativeDriver and AndroidNativeDriver for taking screenshots using adb. (#152194)
Closes https://github.com/flutter/flutter/issues/152189.

I have next to no clue how to configure this to run on CI, so bear with me as I rediscover the wheel.
2024-07-24 20:12:19 +00:00
LongCatIsLooong
00257e8c62
widgets docImport (#152146)
https://github.com/flutter/flutter/issues/150800

> 2172 out-of-scope references in 138 files, 27 unique symbols were left unresolved.  

Only did the most straightforward ones. There will be a part 2.
2024-07-24 19:51:53 +00:00
auto-submit[bot]
f64190aacb
Reverts "Use more CORS headers for flutter run server (#152048)" (#152248)
Reverts: flutter/flutter#152048
Initiated by: cbracken
Reason for reverting: breaks tool tests.

Example:
```
00:06 +762 ~2 -1: test/general.shard/web/web_asset_server_test.dart: release asset server serves correct mime type and content length for png [E]
  Expected: {'Content-Type': 'image/png', 'content-length': '64'}
    Actual: {
              'Content-Type': 'image/png',
              'Cross-Origin-Resource-Policy': 'cross-origin',
              'Access-Contr
Original PR Author: johnpryan

Reviewed By: {eyebrowsoffire}

This change reverts the following previous change:
@eyebrowsoffire
2024-07-24 17:44:26 +00:00
John Ryan
11d81f2709
Use more CORS headers for flutter run server (#152048)
@eyebrowsoffire
2024-07-24 09:54:22 -07:00
auto-submit[bot]
f55ab0e77e
Reverts "Enable Swift Package Manager by default on master channel (#152049)" (#152243)
Reverts: flutter/flutter#152049
Initiated by: cbracken
Reason for reverting: iOS builds failing in post-submit
Original PR Author: loic-sharma

Reviewed By: {jmagman}

This change reverts the following previous change:
Changes:

1. Enables Swift Package Manager by default on the main/master channel
2. Fixes tests that fail if Swift Package Manager is enabled

Corresponding docs change: https://github.com/flutter/website/pull/10938

Addresses https://github.com/flutter/flutter/issues/151567
2024-07-24 16:49:25 +00:00
Loïc Sharma
08d8a7fa81
Enable Swift Package Manager by default on master channel (#152049)
Changes:

1. Enables Swift Package Manager by default on the main/master channel
2. Fixes tests that fail if Swift Package Manager is enabled

Corresponding docs change: https://github.com/flutter/website/pull/10938

Addresses https://github.com/flutter/flutter/issues/151567
2024-07-24 16:24:31 +00:00
chunhtai
7912e6d27e
Updates mark needs semantics update logic for overlay portal (#151688)
OverlayPortal attaches its overlaychild's renderobject to overlay directly while keeps its semantics tree under overlayportal.

This become a problem when the `overlaychild` markNeedsSemanticsUpdate that it propagate upward the rendering tree.

This means instead of marking dirty upward to the OverlayPortal, it directly mark Overlay dirty instead and skip `OverlayPortal`.

Currently this does not pose an issue other than unnecessary rebuilds, but it become a problem when I try to optimize the semantics tree compilation https://github.com/flutter/flutter/pull/150394.

After the optimization it won't rebuild semantics node unless it is marked dirty. Since the OverlayPortal widget does not get marked dirty, it won't update the subtree.
2024-07-24 00:30:19 +00:00
Amir Panahandeh
770c13bcff
Fix typo in clipboard.dart (#151844)
Fixes a typo in `clipboard.dart`
2024-07-23 22:52:32 +00:00
Eric Seidel
dc0ab7f3eb
Add more docs to DragTraget.builder (#151447)
Clarifications and changing a reference to a deprecated member.
2024-07-23 15:29:48 -07:00
Lasse R.H. Nielsen
6574484fc2
Fix the type of RenderTable.get rowDecorations. (#151886)
This changes the return type from `List<Decoration>` to `List<Decoration?>`, matching the corresponding setter.
As such it is a breaking change.
I believe the current type is a *bug*, and this is the correct fix.

The underlying value has a nullable element type, and the setter accepts a list which can contain `null`, but the getter tries to create a list with non-nullable elements from the stored value.
Calling this getter while the list contains `null` will throw.

(If this fix is too simplistic, I'll file a bug for the issue instead.)
2024-07-23 22:14:13 +00:00
Andrew Kolos
91813060c0
[tool] Guard more write/writeln calls on Process.stdin (#151146)
Contributes to fixing https://github.com/flutter/flutter/issues/137184.

This PR guards write calls in non-test files. This PR excludes
* packages/flutter_tools/lib/src/dart/analysis.dart due to a test timeout I would like to figure out in a separate PR and
* packages/flutter_tools/lib/src/compile.dart due to https://github.com/flutter/flutter/issues/151255
2024-07-23 19:27:52 +00:00
LongCatIsLooong
ed587e6da0
More material docImports (#152144)
https://github.com/flutter/flutter/issues/150800.

After applying the patch:
```
Can not fully resolve ../../flutter/packages/flutter/lib/src/material/material_state.dart: (MaterialState.pressed, MaterialState.focused, MaterialState.hovered, ..., value, update)
Can not fully resolve ../../flutter/packages/flutter/lib/src/material/material_state_mixin.dart: (MaterialStateProperty.resolve, MaterialState.disabled, MaterialState.dragged, ..., MaterialState.scrolledUnder, MaterialState.selected)
Can not fully resolve ../../flutter/packages/flutter/lib/src/material/reorderable_list.dart: (TargetPlatformVariant.desktop, TargetPlatformVariant.mobile)
Can not fully resolve ../../flutter/packages/flutter/lib/src/material/app.dart: (GlobalMaterialLocalizations)
Can not fully resolve ../../flutter/packages/flutter/lib/src/material/material_localizations.dart: (GlobalMaterialLocalizations)
57 out-of-scope references in 5 files, 22 unique symbols were left unresolved.
```

I'm going to leave `material_state` stuff alone because of https://github.com/flutter/flutter/issues/150800#issuecomment-2243923869, 
`TargetPlatformVariant.desktop` requires `flutter_test` and `GlobalMaterialLocalizations` requires `package:flutter_localizations/flutter_localizations.dart`.
2024-07-23 19:23:07 +00:00
davidhicks980
f9dc7526fd
[widgets/shortcuts] Add includeSemantics property to the Shortcuts widget. (#152077)
Adds an `includeSemantics` property to the Shortcuts widget.

@gspencergoog and I discussed this change to make introducing Shortcuts easier on the MenuAnchor widget. This change should also make testing semantics trees slightly less onerous (assuming this doesn't harm accessibility, that is).

On the point of accessibility, I'm not sure what useful semantic information is exposed by the Shortcuts widget's semantic node, since it's basically just an unfocusable keyboard listener. However, I kept the `includeSemantics` defaulting to true so as to not break semantics tests in the Flutter repo.

Fixes https://github.com/flutter/flutter/issues/152076
2024-07-23 15:46:08 +00:00
Brandon DeRosier
ed470fd101
[native_assets] Fix macOS host build failure when there are no frameworks to sign. (#150742)
When the `"${native_assets_path}"*.framework` glob doesn't resolve anything, the bash will run the loop once with the original unglobbed value: `/path/to/native/assets/*.framework`. Skip this case to prevent the build from failing when there are no frameworks to sign.

To reproduce this build failure:
1. Enable native assets in the Flutter tool: `flutter config --enable-native-assets`
2. Create a Flutter project with the default template: `flutter create test_native_assets`
3. Add a build hook that does nothing (`hook/build.dart`).
4. Try to build/run the app: `flutter run --debug -d macos`
2024-07-23 07:37:30 +00:00
Jenn Magder
f33ffc00ea
Use Xcode build setting PRODUCT_NAME to find app and archive paths (#140242)
1. Instead of getting the `FULL_PRODUCT_NAME` Xcode build setting (`Runner.app`) instead use `PRODUCT_NAME` since most places really want the product name, and the extension stripping wasn't correct when the name contained periods.
2. Don't instruct the user to open the `xcarchive` in Xcode if it doesn't exist.

Fixes https://github.com/flutter/flutter/issues/140212
2024-07-22 23:54:24 +00:00