Commit graph

23093 commits

Author SHA1 Message Date
Taha Tesser 9436b3c1c8
Fix out of sync templates files and add a check (#145747)
### Description
- Add a check to verify template code in the Material library is synced with `gen_defaults`
- Sync the changes to pass the new check.
2024-04-11 13:40:36 +00:00
Daco Harkes ac5be2d821
[tools] Fix --template=plugin_ffi formatting (#146269)
It looks like the formatter was updated.

We have a test running on the FFIgen repo that checks that rerunning the generated bindings with FFIgen generates identical bindings.

Closes:

* https://github.com/dart-lang/native/issues/1072
2024-04-11 10:24:09 +00:00
Taha Tesser 831226aada
Fix IconButton theming in the InputDecorator (#146567)
fixes [DropdownMenu TrailingIcon can't be styled through providing an IconButtonTheme](https://github.com/flutter/flutter/issues/145081) (second PR)

### Description
 This PR replaces `IconButton.style`  with `ButtonStyle` when merging parent `IconButtonTheme`  as `styleFrom` returns defaults for some properties.
2024-04-11 07:15:24 +00:00
Jason Simmons c9d4c749b5
Disable single character mode in the terminal when exiting flutter_tools (#146534) 2024-04-10 23:54:42 +00:00
flutter-pub-roller-bot aff5477dad
Roll pub packages (#146606)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-04-10 23:02:54 +00:00
Gray Mackall 286c73c0eb
Remove additional references to engine v1 android embedding (#146523)
https://github.com/flutter/engine/pull/51229 blocked [the roll](https://github.com/flutter/flutter/pull/146522) and had to be reverted, which is a shame, but on the bright side it made it possible to point the framework at my removal pr, at the point of its merging the first time 

This fixes all errors that are fixable in the framework that would have blocked the roll. There are some that aren't fixable here (they need to be fixed in the engine)*, so I'll fix those in the engine but unfortunately I can't pick up another version here to re-test until I try to roll again 😢 

*This category is: uses of plugins that in turn have a `registerWith`, that references the v1 embedding. The plan to fix these cases is to leave the interface that that method relies on around for now. See https://github.com/flutter/packages/pull/6494#issuecomment-2046010323 for details
2024-04-10 21:58:05 +00:00
Victoria Ashworth 0f6756d750
Convert ProjectMigration and ProjectMigrator to be async (#146537)
Convert `ProjectMigration.run()` and `ProjectMigrator.migrate()` to be async.

Needed for Swift Package Manager migration, which requires some async processes: https://github.com/flutter/flutter/pull/146256
2024-04-10 16:26:19 +00:00
Michael Goderbauer 511ccf46db
Correct doc for AnimationMin (#146531)
Fixes https://github.com/flutter/flutter/issues/146485
2024-04-09 23:14:23 +00:00
Bruno Leroux 906ce36b8d
Fix InputDecorator label position ignore visual density (#146488)
## Description

This PRs makes the label vertical position depend on visual density for filled text field.
Previously, for M2 and M3, the label vertical offset was always the same (12 on M2, 8 and M3) despite different visual density configuration.
This was noticable on desktop and can lead to weird rendering especially on M3 where line height makes the cursor taller.

Screenshots for a filled text field:

| | Before | After |
|--------|--------|--------|
|M3 macOs| ![image](https://github.com/flutter/flutter/assets/840911/bd9bdb6e-477c-4db0-ae8f-74e18d19f29e) | ![image](https://github.com/flutter/flutter/assets/840911/25e59c44-0139-4813-be28-472302d6970e) | 
|M2 macOs| ![image](https://github.com/flutter/flutter/assets/840911/1c52493b-b17b-407b-93cc-69120207b716) | ![image](https://github.com/flutter/flutter/assets/840911/1fc4a8b6-429b-476c-b5bf-ff2934bf5293) | 

</details> 

## Related Issue

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

## Tests

Adds 2 tests, updates 2 tests.
2024-04-09 21:11:08 +00:00
Lau Ching Jun 80042124ad
Support mdns when attaching to proxied devices. (#146021)
Also move the vm service discovery logic into platform-specific implementation of `Device`s. This is to avoid having platform-specific code in attach.dart.
2024-04-09 20:00:21 +00:00
Jackson Gardner 51e70fa16b
Fix skwasm tests (#145570)
Skwasm tests are now running as `bringup: true` in postsubmit, but failing. Let's get them fixed.
2024-04-09 19:35:07 +00:00
Justin McCandless 1cd946ee31
Text editing inside of Transformed.scale (#146019)
Fixes bugs in the text selection positioning calculations so that they work even when the field is scaled. In many cases, we were simply translating things around without applying the proper localToGlobal (or vice versa) transform.

| Before | After |
| --- | --- |
| <img src="https://github.com/flutter/flutter/assets/389558/a5a45472-98c5-4cdf-b382-218971fd9404" /> | <img src="https://github.com/flutter/flutter/assets/389558/f396a1af-2546-4e38-a9d9-6c6edfa38d94" /> |

Partial fix for: https://github.com/flutter/flutter/issues/144685
It looks like there are other problems where transforms aren't applied properly. Putting a transform at the root of the application, above MaterialApp, will expose more problems.

<details>

<summary>Sample code</summary>

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

void main() => runApp(const _App());

class _App extends StatelessWidget {
  const _App();

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: _Home());
  }
}

class _Home extends StatefulWidget {
  const _Home();

  @override
  State<_Home> createState() => _HomeState();
}

class _HomeState extends State<_Home> {
  final _controller = WebViewController();
  final TextEditingController textEditingController = TextEditingController(
    text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
  );
  final OverlayPortalController overlayPortalController = OverlayPortalController();

  @override
  void initState() {
    super.initState();
    _controller
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..loadRequest(Uri.https('api.flutter.dev'));
  }

  @override
  Widget build(BuildContext context) {
    overlayPortalController.show();
    return Scaffold(
      appBar: AppBar(
        title: const Text('Scaled WebView Tester'),
      ),
      body: Stack(
        children: <Widget>[
          Transform.scale(
            alignment: Alignment.topLeft,
            scale: 0.5,
            child: TextField(
              controller: textEditingController,
              maxLines: null,
            ),
          ),
          OverlayPortal(
            controller: overlayPortalController,
            overlayChildBuilder: (BuildContext context) {
              return Positioned(
                top: 0.0,
                left: 0.0,
                child: SizedBox(
                  height: 1000,
                  width: 1000,
                  child: Stack(
                    children: <Widget>[
                      Positioned(
                        top: 90.0,
                        left: 0.0,
                        child: Container(
                          height: 1.0,
                          width: 1000,
                          color: Colors.blue,
                        ),
                      ),
                      Positioned(
                        top: 102.0,
                        left: 0.0,
                        child: Container(
                          height: 1.0,
                          width: 1000,
                          color: Colors.blue,
                        ),
                      ),
                    ],
                  ),
                ),
              );
            },
          ),
        ],
      ),
    );
  }
}
```

</details>
2024-04-08 22:01:05 +00:00
Bruno Leroux f45741bc51
Fix DropdownButtonFormField throws when onChange is null (#146342)
## Description

This PRs fixes a null pointer exception thrown when reset is called on a `DropdownButtonFormField` whose `onChange` callback is null.

## Related Issue

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

## Tests

Adds 1 tests.
2024-04-08 20:47:13 +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
Michael Goderbauer 5b5dff05b7
Remove double heading (#146441)
The heading is already included in the macro.

## Old:
![Screenshot 2024-04-08 at 10 03 12 AM](https://github.com/flutter/flutter/assets/1227763/30108439-59e7-43b3-9ba5-fe57e04e7f10)
2024-04-08 17:48:08 +00:00
Jenn Magder a5fea8c795
Increase the recommended Xcode version to Xcode 15 (#146367)
Xcode 15 will be required for iOS App Store submission 
> Please note that as of April 2024 all iOS and iPadOS apps submitted to the App Store must be built with a minimum of Xcode 15 and the iOS 17 SDK.

https://developer.apple.com/ios/submit/

And will also be required for Swift Package Manager support https://github.com/flutter/flutter/pull/146256.

We could swap to "required" but macOS developers don't technically need to upgrade.  We can let the Store itself enforce its policies.  And we can swap to Xcode 15 "required" when SPM adoption is further along.

Part of https://github.com/flutter/flutter/issues/144582
2024-04-08 16:56:06 +00:00
LongCatIsLooong 98d23f709f
Prepare for RenderDecorator.computeBaseline changes. (#146363)
Minor changes to make the `RenderDecorator.computeBaseline` change a bit easier to make. No semantic changes.
2024-04-06 21:51:23 +00:00
Ian Hickson 3748b59e44
Make FileSystem dependency explicit througout. (#146008)
This is part 8 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 particular change attempts to be minimal. A future change will apply some formatting cleanup (newlines, reordering parameters and arguments) for clarity.
2024-04-05 23:57:21 +00:00
Jackson Gardner 75ae44df77
Copy part files and sourcemaps when building with dart2js. (#146356)
This fixes https://github.com/flutter/flutter/issues/145653

When dart2js emits deferred part files, they need to be copied from the build folder to the output folder.
2024-04-05 19:43:15 +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
Bruno Leroux a5ea2ef1d4
Fix cursor is not centered when cursorHeight is set (non-Apple platforms). (#145829)
## Description

This PRs fixes the cursor vertical position when a custom cursor height is set on non-Apple platforms (on Apple platforms the cursor is already centered) .

| Before | After |
|--------|--------|
| ![image](https://github.com/flutter/flutter/assets/840911/2d1b855d-d36c-4941-85be-5044ea0e9bb2) | ![image](https://github.com/flutter/flutter/assets/840911/306510c8-42ca-45c7-8c25-ddfa2e22c7f3) | 

<details><summary>Code sample used for the screenshots (cursorHeight 18, font size 16, line height 2)</summary>

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

void main() async {
  runApp(
    const MaterialApp(
      title: 'Flutter Demo',
      home: MyApp(),
    ),
  );
}

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

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: Center(
        child: TextField(
          cursorHeight: 18,
          style: TextStyle(fontSize: 16, height: 2),
        ),
      ),
    );
  }
}
``` 

</details> 

## Related Issue

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

## Tests

Adds 2 tests, updates 1.
2024-04-05 04:01:35 +00:00
August 9c6fcdac6f
refactor: Perform plugin resolution per platform (#144506)
Part of #137040 and #80374

`possibleResolutions` and `possibleResolutions` used a key containing the platform and the plugin name via `getResolutionKey`. The global list is not necessary and also confusing. It can be avoided by handling the resolution of plugins per platform. This helps to have a more self-contained plugin resolution. This also is necessary to reuse the plugin resolution logic (per platform) for #137040.
2024-04-05 00:19:12 +00:00
Igor Hnízdo 8d928947ca
ExpansionTile Unable to remove right padding from title (#145271)
This PR makes it possible to remove the hard-coded 32.0 unit padding coming from ListTile when trailing is not null. Which it always it as `ExpansionTile` always provides a widget there. Currently there is no way to remove it and people have to hack around it: e.g. 
https://stackoverflow.com/questions/54714836/how-to-remove-default-padding-from-expansiontiles-header

The issue is quite old and I came across it today and decided to put together a quick fix.

Fixes #145268

The change should be non-breaking as the default stays the same. But I have no issue with changing something if requested. (naming-wise, functionality-wise etc...)
2024-04-04 22:55:20 +00:00
Jenn Magder d754a371d9
Remove dead compareIosVersions function (#146298)
Dead all the back in #10780
2024-04-04 21:19:46 +00:00
philipfranchi 77201fdf71
Adds semanticsLabel to MenuItemButton (#145846)
This PR adds a `semanticsLabel` field to the MenuItemButton, letting users pass in a Semantics Label if they have issues with the way a ScreenReader reads the generated text.

fixes: [142939: Screen Readers won't read punctuation characters in Shortcuts](https://github.com/flutter/flutter/issues/142939)
2024-04-04 21:19:45 +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
Taha Tesser 7c72a089e1
Fix InputDecorator suffix and prefix IconButtons ignore IconButtonTheme (#145473)
fixes [DropdownMenu TrailingIcon can't be styled through providing an IconButtonTheme](https://github.com/flutter/flutter/issues/145081)

### 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(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: IconButtonTheme(
            data: IconButtonThemeData(
              style: IconButton.styleFrom(
                foregroundColor: const Color(0xffff0000),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(10.0),
                ),
              ),
            ),
            child: SizedBox(
              width: 300,
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  const Text('IconButton'),
                  IconButton(onPressed: () {}, icon: const Icon(Icons.search)),
                  const Text('TextField'),
                  TextField(
                    decoration: InputDecoration(
                      prefixIcon: IconButton(
                        onPressed: () {},
                        icon: const Icon(Icons.search),
                      ),
                      suffixIcon: IconButton(
                        onPressed: () {},
                        icon: const Icon(Icons.search),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
```

</details>

| Before | After |
| --------------- | --------------- |
| <img src="https://github.com/flutter/flutter/assets/48603081/69b5966b-c95d-4934-b867-3262d1377f70"  /> | <img src="https://github.com/flutter/flutter/assets/48603081/0064db2b-0379-4424-a5bf-39bdc5441fe8" /> |
2024-04-04 19:20:30 +00:00
Victor Sanni 226546b640
Update documentation to discourage using the TextEditingController.text setter (#146151)
Fixes #129272 

## 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.
- [ ] 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-04 10:51:56 -07:00
Daco Harkes ef826ec50b
Flutter templates example app Gradle memory settings (#146275)
Tries to address: https://github.com/flutter/flutter/issues/146236
2024-04-04 15:43:52 +00:00
flutter-pub-roller-bot 7db25fe30f
Roll pub packages (#146245)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-04-04 00:27:34 +00:00
Ian Hickson 13bec286bd
Magnifier cleanup (#143558)
- Introduces the ability to control whether RawMagnifier uses a clip on
its decoration. (It still has to use a clip for its magnified image.)
- Uses `BlurStyle.outer` to remove the clip for CupertinoMagnifier.
- Many changes to the documentation around magnifiers and shadows.
- Implements `BoxShadow.copyWith` which somehow we had never needed
before.
- Makes `debugDisableShadows` handle `BlurStyle.outer` correctly.
- Adds `MagnifierInfo.toString`.
- Aligns various `operator ==`s with the style guide.
- Makes MagnifierDecoration a separate concept from Decoration, since
it's not actually compatible anywhere.
- Removes some dead code and makes other minor code simplifications.
- Uses double syntax rather than integer syntax for various double
literals for clarity.

I expect one minor golden image change (antialiasing change on
Cupertino's magnifier test).
2024-04-03 15:49:38 -07:00
LongCatIsLooong ef7019e801
computeDryBaseline for rendering / widgets RenderBoxes (#146143)
RenderWrap, Table, Overlay / Stack are not included
2024-04-03 18:36:19 +00:00
Leo Farias 2759ec2563
Fix TextStyle.lerp() to properly interpolate text shadows (#145666)
Currently, `TextStyle.lerp()` does not properly interpolate the shadows property between two TextStyle instances. This PR addresses the issue by using ui.Shadow.lerpList() to interpolate the shadow lists, ensuring that the individual shadow properties (blur radius, color, and offset) are correctly lerped.

The changes include:
- Updating the `TextStyle.lerp()` method to use `ui.Shadow.lerpList()` for the shadows property.
- Adding a new test case in `text_style_test.dart` to verify the correct interpolation of text shadows.

Here is a snippet showing the comparison, when using `ui.Shadow.lerpList()`
https://dartpad.dev/?id=799c4bec8b791b74580193174759b93d

Closes #145665
2024-04-03 17:49:58 +00:00
LongCatIsLooong a81729c68e
Renderflex cross intrinsic size with baseline alignment (#146185) 2024-04-03 17:41:50 +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
Furkan Acar e868e2b383
Add SegmentedButton expand feature (#142804)
fix #139486

The `expandedInsets` property enhancement for the `SegmentedButton` widget introduces flexibility in button layout design within Flutter applications. When `expandedInsets` is not null, this property allows the `SegmentedButton` to expand, filling the available horizontal space of its parent container and also have the specified insets, thus ensuring a uniform distribution of segment widths across the button. Conversely, with `expandedInsets` is null, the widget sizes itself based on the intrinsic sizes of its segments, preserving the natural width of each segment. This addition enhances the adaptability of the `SegmentedButton` to various UI designs, enabling developers to achieve both expansive and compact button layouts seamlessly.

### Setting expandedInsets = null
<img width="724" alt="image" src="https://github.com/flutter/flutter/assets/65075121/f173b327-a34b-49f0-a7b1-a212a376c5e3">

### Setting expandedInsets = EdgeInsets.zero
<img width="724" alt="image" src="https://github.com/flutter/flutter/assets/36861262/f141a3d3-80e3-4aeb-b7c8-d56ca77ca049">
2024-04-03 16:16:52 +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
Bruno Leroux 1326c8ee53
Fix typos in bottom_sheet.dart (#146188)
This PR fixes some typos in material/bottom_sheet.dart file.
2024-04-03 15:18:06 +00:00
LongCatIsLooong 3295a48f17
Avoid calling TextPainter.plainText for simple static text (#146084)
`InlineSpan.toPlainText` is surprisingly expensive even for a simple `TextSpan` like `TextSpan(text: 'AAA', children: [TextSpan(text: char * 10), TextSpan(text: char * 20)])` 

![image](https://github.com/flutter/flutter/assets/31859944/60014acb-78bd-4dbb-a48d-74295aeb612c)
2024-04-03 05:22:56 +00:00
LongCatIsLooong bb7977e3be
Fix chip baseline implementation (#146162)
It didn't include the label's Y offset. Also fixes the nullability of the slotted children: it seems `avatar`, `label`, `deleteIcon` can't be null when `_RenderChip` is in the render tree. We were using 
```dart
    _boxParentData(avatar!).offset = theme.padding.topLeft + avatarOffset;
    _boxParentData(label!).offset = theme.padding.topLeft + labelOffset + theme.labelPadding.topLeft;
    _boxParentData(deleteIcon!).offset = theme.padding.topLeft + deleteIconOffset;
```
in `performLayout` anyway.
2024-04-03 03:11:04 +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
Polina Cherkasova 96a491ceef
Dispose FocusNode in tests. (#146161) 2024-04-02 16:51:16 -07:00
Kallen Tu 972725332f
Add none language strings to code blocks. (#146154)
Part 2 from https://github.com/flutter/flutter/pull/146085
In preparation to add the lint
`missing_code_block_language_in_doc_comment`, added `none` info strings
to a bunch of fenced code blocks that have miscellaneous text or output
text.

Related to issue: https://github.com/dart-lang/linter/issues/4904

## 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-02 16:42:25 -07: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
Bruno Leroux 0ed26dc81d
Fix border color is wrong for a focused and hovered TextField (#146127)
## Description

This PRs fixes the active indicator color for a filled text field and the border color for an outlined text field.
Previously, when a text field was focused and hovered, the hover color was used. With this PR the focus color is used.

Screenshots for a focused and hovered text field:

| Before | After |
|--------|--------|
| ![image](https://github.com/flutter/flutter/assets/840911/aeca2b25-e28b-4609-bd47-9d72b3cfb80d) | ![image](https://github.com/flutter/flutter/assets/840911/f4331178-8f1e-4cb8-a93f-7052a6770af7)| 

</details> 

## Related Issue

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

## Tests

Adds 4 tests.
2024-04-02 20:08:11 +00:00
LongCatIsLooong fd98a2f70b
Implements RenderBox.computeDryBaseline for material render boxes (#146027)
`RenderChip` and `RenderInputDecorator` changes are larger so they are not included.
2024-04-02 18:37:05 +00:00
Taha Tesser 8d9dcc48ec
Fix MenuItemButton overflow (#143932)
fixes [MenuItemButton does not constrain its child](https://github.com/flutter/flutter/issues/129439)
fixes [DropdownMenuEntry Text Overflow when width of DropdownMenu is not specified](https://github.com/flutter/flutter/issues/140596)

### Description

- This PR continues the fix from https://github.com/flutter/flutter/pull/141314#issuecomment-1945804640 and adds controlled widths for the `MenuBar` children to fix the unbounded width issue which blocked the PR earlier. (Widgets  with non-zero flex value cannot be laid out in a horizontal scroll view which is created by `MenuBar` widget)
- Added tests coverage.
- Added documentation.

### 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 StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  MenuController menuController = MenuController();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              DropdownMenu<int>(
                expandedInsets: EdgeInsets.zero,
                dropdownMenuEntries: <DropdownMenuEntry<int>>[
                  DropdownMenuEntry<int>(
                    value: 0,
                    label:
                        'This is a long text that is multiplied by 10. ' * 10,
                    style: const ButtonStyle(
                      textStyle: MaterialStatePropertyAll(
                        TextStyle(overflow: TextOverflow.ellipsis),
                      ),
                    ),
                  ),
                ],
              ),
              SizedBox(
                width: 200,
                child: MenuItemButton(
                  onPressed: () {},
                  leadingIcon: const Icon(Icons.menu),
                  trailingIcon: const Icon(Icons.arrow_forward_ios),
                  child: const Text(
                    'This is a very long text that will wrap to the multiple lines.',
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                  ),
                ),
              ),
              // MenuBar(
              //   children: [
              //     MenuItemButton(
              //       onPressed: () {

              //       },
              //       child: Text('Short Text Menu'),
              //     ),
              //     MenuItemButton(
              //       onPressed: () {},
              //       child: Text('Very very very very very long text menu'),
              //     ),
              //   ],
              // ),
            ],
          ),
        ),
      ),
    );
  }
}

```

</details>

### Before

![before](https://github.com/flutter/flutter/assets/48603081/27879cf6-4567-442d-a355-7f8492612fa4)

### After
![after](https://github.com/flutter/flutter/assets/48603081/25e5ab90-e2a1-4080-a7e1-51cd98ff0a77)
2024-04-02 17:27:26 +00:00
Kallen Tu 9fd9f042fc
Add info strings to code blocks. (#146085)
In preparation to add the lint
`missing_code_block_language_in_doc_comment`, added info strings to a
bunch of fenced code blocks.

Related to issue: https://github.com/dart-lang/linter/issues/4904

## 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-01 14:05:16 -07:00
Kate Lovett 6d7922f3f5
Fix SliverMainAxisGroup layout in reverse (#145572)
Fixes https://github.com/flutter/flutter/issues/145068

The original tests for SliverMainAxisGroup did not actually check where the child was painted (#126596).

Followed the same pattern in RenderSliverMultiBoxAdaptor:

11c034f037/packages/flutter/lib/src/rendering/sliver_multi_box_adaptor.dart (L666)
2024-04-01 19:06:07 +00:00
Dimil Kalathiya a187cc7255
Fixes some gesture recognizers are not disposed. (#146072) 2024-04-01 09:50:59 -07: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
Taha Tesser e85340e1e4
Deprecate ButtonBar, ButtonBarThemeData, and ThemeData.buttonBarTheme (#145523)
fixes [Deprecate `ButtonBar`](https://github.com/flutter/flutter/issues/127955)

### 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(
        buttonBarTheme: const ButtonBarThemeData(
          alignment: MainAxisAlignment.spaceEvenly,
        ),
      ),
      home: Scaffold(
        body: ButtonBar(
          alignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            TextButton(
              onPressed: () {},
              child: const Text('Button 1'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 2'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 3'),
            ),
          ],
        ),
      ),
    );
  }
}
```

</details>

## Data driven fix

### Before executing `dart fix --apply`
```dart
  return MaterialApp(
      theme: ThemeData(
        buttonBarTheme: const ButtonBarThemeData(
          alignment: MainAxisAlignment.spaceEvenly,
        ),
      ),
      home: Scaffold(
        body: ButtonBar(
          alignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            TextButton(
              onPressed: () {},
              child: const Text('Button 1'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 2'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 3'),
            ),
          ],
        ),
      ),
    );
```

### After executing `dart fix --apply`
```dart
    return MaterialApp(
      theme: ThemeData(

      ),
      home: Scaffold(
        body: OverflowBar(
          alignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            TextButton(
              onPressed: () {},
              child: const Text('Button 1'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 2'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 3'),
            ),
          ],
        ),
      ),
    );
```
2024-04-01 11:39:48 +00:00
Taha Tesser 40dda2b4bb
Add DataColumn.headingRowAlignment for DataTable (#144006)
fixes [[`DataTable`]  Unable to center the label of a DataColumn without side effects](https://github.com/flutter/flutter/issues/143340)

### 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(
      debugShowCheckedModeBanner: false,
      home: MaterialApp(
        home: Material(
          child: DataTable(
            columns: <DataColumn>[
              DataColumn(
                headingRowAlignment: MainAxisAlignment.center,
                onSort: (int columnIndex, bool ascending) {},
                label: const Text('Header'),
              ),
            ],
            sortColumnIndex: 0,
            rows: const <DataRow>[
              DataRow(
                cells: <DataCell>[
                  DataCell(Center(child: Text('Data'))),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}
```

</details>

### Center `DataColumn.mainAxisAlignment` without sort arrow
![Screenshot 2024-03-25 at 17 13 05](https://github.com/flutter/flutter/assets/48603081/0c91d279-23e8-40d9-ab86-c08013c73666)

### Center `DataColumn.mainAxisAlignment` with sort arrow

![Screenshot 2024-03-25 at 17 11 54](https://github.com/flutter/flutter/assets/48603081/d042d02a-e7be-4f47-a90c-8a1ee0f7f5f3)
2024-04-01 09:42:51 +00:00
LongCatIsLooong ff284c51bd
Implement computeDryBaseline for cupertino RenderBoxes (#145951)
The `_debugVerifyDryBaselines` method verifies that dry baseline implementation is consistent with the wet baseline method at the current constraints.
2024-03-30 21:38:24 +00:00
Nate a17d4b34f0
Implementing switch expressions in flutter_tools/ (#145632)
This pull request is step 12 in the journey to make this entire repository more readable.

(previous PRs: #139048, #139882, #141591, #142279, #142634, #142793, #143293, #143496, #143634, #143812, #144580)

We're getting close to the end! 😄
2024-03-29 22:31:19 +00:00
Ian Hickson 887bdcfb6b
Add flutter_goldens README (#145278)
This is part 5 of a broken down version of the #140101 refactor.

This PR adds a README to flutter_goldens with breadcrumbs to other sources of documentation.
2024-03-29 21:20:58 +00:00
Ian Hickson 16ec1a8434
Remove state shared across tests (#145281)
This is part 6 of a broken down version of the #140101 refactor.

This change tries to be as minimal as possible to make review as easy as possible. We can further simplify this file in future PRs. This change allows us to re-enable test order randomization for these tests.
2024-03-29 21:19:47 +00:00
Bruno Leroux 49183c256c
InputDecorator M3 tests migration - Step7 - container (#145583)
## Description

This PRs adds a test group for the input decorator container, this group is organised similarly to the M3 spec, see https://m3.material.io/components/text-fields/specs.

It is step 7 for the M3 test migration for `InputDecorator`.
Step 1: https://github.com/flutter/flutter/pull/142981
Step 2: https://github.com/flutter/flutter/pull/143369
Step 3: https://github.com/flutter/flutter/pull/143520
Step 4: https://github.com/flutter/flutter/pull/144169
Step 5: https://github.com/flutter/flutter/pull/144932
Step 6: https://github.com/flutter/flutter/pull/145213

## Related Issue

Related to https://github.com/flutter/flutter/issues/139076

@justinmc The diff is not very readable. The tests added by this PR are from line 298 to line 975. Other changes are due to moving some existing tests to this new 'container' group.
2024-03-29 20:48:49 +00:00
Polina Cherkasova bca1d6ad1f
Upgrade leak_tracker. (#145997) 2024-03-29 12:31:52 -07:00
Gray Mackall 85288818b5
Remove trailing commas in android dependency version checking gradle plugin (#145718)
Apparently old versions of kotlin (pre 1.4) don't allow trailing commas.

Example logs: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8752506486861217537/+/u/Run_package_tests/build_all_packages_for_Android_-_legacy_version/stdout
2024-03-29 16:31:06 +00:00
Polina Cherkasova 1a2f34ab5b
Upgrade leak_tracker. (#145940) 2024-03-29 02:39:17 +00:00
Gray Mackall 0984a7f04b
Point kotlin message in gradle_errors.dart towards new place where templates define the kotlin version (#145936)
Fixes https://github.com/flutter/flutter/issues/144454

For reference, after formatting it looks like:
```
┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin.                                 │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update the  │
│ version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of            │
│ /Users/mackall/development/BugTesting/ELIMINATEME/blah/android/settings.gradle.                        │
│                                                                                                        │
│ Alternatively (if your project was created before Flutter 3.19), update                                │
│ /Users/mackall/development/BugTesting/ELIMINATEME/blah/android/build.gradle                            │
│ ext.kotlin_version = '<latest-version>'                                                                │
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```
2024-03-29 00:31:01 +00:00
LongCatIsLooong 460a5e22bd
RenderFlex baseline intrinsics (#145483)
Implements `RenderFlex` intrinsics calculation when children are baseline aligned in the cross axis.
2024-03-28 23:07:06 +00:00
Qun Cheng ea1268a78d
Update tokens to v2.3.5 (#145356)
* Updated the Material Design tokens to v2.3.5
* Linear and circular progress indicator token sets are deprecated in v0.207. The `md.com.progress-indicator` token set was created and should be used instead.
* tokens is now using [semantic versioning](https://semver.org/) (Thanks @guidezpl for reminding:) )
* ~Fixes #128877. The default text style is updated to `bodyLarge` now:)~ Added TODOs for the label text style of `PopupMenuButton`. Will create a separate PR because this change breaks Google testing.
2024-03-28 22:22:20 +00:00
Taha Tesser 0bcd228e67
Update TabBar and TabBar.secondary to use indicator height/color M3 tokens (#145753)
fixes [Secondary `TabBar` indicator height token is missing ](https://github.com/flutter/flutter/issues/124965)

### 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(
      debugShowCheckedModeBanner: false,
      home: DefaultTabController(
        length: 2,
        child: Scaffold(
          appBar: AppBar(
            title: const Text('Sample'),
            bottom: const TabBar.secondary(
              tabs: <Widget>[
                Tab(icon: Icon(Icons.directions_car)),
                Tab(icon: Icon(Icons.directions_transit)),
              ],
            ),
          ),
          floatingActionButton: FloatingActionButton(
            onPressed: () {},
            child: const Icon(Icons.add),
          ),
        ),
      ),
    );
  }
}
```

</details>
2024-03-28 17:56:09 +00:00
Mouad Debbar 42988d1b0d
Add viewId to TextInputConfiguration (#145708)
In order for text fields to work correctly in multi-view on the web, we need to have the `viewId` information sent to the engine (`TextInput.setClient`). And while the text field is active, if it somehow moves to a new `View`, we need to inform the engine about such change (`TextInput.updateConfig`).

Engine PR: https://github.com/flutter/engine/pull/51099
Fixes https://github.com/flutter/flutter/issues/137344
2024-03-28 17:09:53 +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
maRci002 2079f34962
[WIP] Predictive back support for routes (#141373)
A new page transition, PredictiveBackPageTransitionsBuilder, which handles predictive back gestures on Android (where supported).
2024-03-27 16:43:10 -07:00
godofredoc 1c8b378ffb
Update localization files. (#145780)
Update the localization files to be used in the upcoming stable release.
2024-03-27 02:33:05 +00:00
David Iglesias 9786682492
[web] Add BackgroundIsolateBinaryMessenger.ensureInitialized to web. (#145786)
This PR makes the static API of the `BackgroundIsolateBinaryMessenger` consistent between its web and IO implementations.

This way, multi-platform applications will compile for the web when using the `ensureInitialized` method (even though it'll throw at runtime, like the `instance` getter, because isolates are not supported on the web).

### Issues

* Fixes: https://github.com/flutter/flutter/issues/145260
2024-03-26 23:51:23 +00:00
Christopher Fujino 385bec0abb
Roll pub packages and regenerate gradle lockfiles (#145727)
Example failing devicelab build https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20platform_views_scroll_perf__timeline_summary/2980/overview

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

Supercedes https://github.com/flutter/flutter/pull/145564
2024-03-26 22:07:06 +00:00
Lipu e5e70b069a
Correct typo: "Free" to "Three" in comments (#145689)
*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.*

*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-03-26 20:25:00 +00:00
Taha Tesser d2c8552944
Fix disabled DropdownMenu doesn't defer the mouse cursor (#145686)
fixes [DropdownMenu cursor in disabled state](https://github.com/flutter/flutter/issues/144611)

This was added in https://github.com/flutter/flutter/pull/121353

### 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(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              const Spacer(),
              const Text('enabled: true,\nrequestFocusOnTap: true,'),
              const SizedBox(height: 16),
              DropdownMenu<String>(
                enabled: true,
                initialSelection: 'First',
                requestFocusOnTap: true,
                width: 200,
                dropdownMenuEntries: ['First', 'Second', 'Third']
                    .map((e) => DropdownMenuEntry(value: e, label: e))
                    .toList(),
              ),
              const Text('Expected: text cursor'),
              const Spacer(),
              const Text('enabled: true,\nrequestFocusOnTap: false,'),
              const SizedBox(height: 16),
              DropdownMenu<String>(
                enabled: true,
                initialSelection: 'First',
                requestFocusOnTap: false,
                width: 200,
                dropdownMenuEntries: ['First', 'Second', 'Third']
                    .map((e) => DropdownMenuEntry(value: e, label: e))
                    .toList(),
                // label: const Text('requestFocusOnTap: false'),
              ),
              const Text('Expected: clickable cursor'),
              const Spacer(),
              const Text('enabled: false,\nrequestFocusOnTap: true,'),
              const SizedBox(height: 16),
              DropdownMenu<String>(
                enabled: false,
                initialSelection: 'First',
                requestFocusOnTap: true,
                width: 200,
                dropdownMenuEntries: ['First', 'Second', 'Third']
                    .map((e) => DropdownMenuEntry(value: e, label: e))
                    .toList(),
              ),
              const Text('Expected: deferred cursor'),
              const Spacer(),
              const Text('enabled: false,\nrequestFocusOnTap: false,'),
              const SizedBox(height: 16),
              DropdownMenu<String>(
                enabled: false,
                initialSelection: 'First',
                requestFocusOnTap: false,
                width: 200,
                dropdownMenuEntries: ['First', 'Second', 'Third']
                    .map((e) => DropdownMenuEntry(value: e, label: e))
                    .toList(),
              ),
              const Text('Expected: deferred cursor'),
              const Spacer(),
            ],
          ),
        ),
      ),
    );
  }
}
```

</details>

### Preview
![Screenshot 2024-03-25 at 14 52 31](https://github.com/flutter/flutter/assets/48603081/cf4361a5-d3bb-4635-9825-5eefa4efe6cc)
2024-03-26 20:15:48 +00:00
Kostia Sokolovskyi 94c63f825f
Memory leaks clean up 2 (#145757) 2024-03-26 12:22:57 -07:00
Kostia Sokolovskyi 8953ba658f
Fix memory leak in Overlay.wrap. (#145744) 2024-03-26 12:21:21 -07:00
Jackson Gardner 158328921d
Be tolerant of backticks around directory name in pub output. (#145768)
This fixes https://github.com/flutter/flutter/issues/145766

The output of the pub command changed slightly with this change: https://dart.googlesource.com/pub/+/2179b765aa9071386be02d408b3c3caa82af98f5

Update the tests to be tolerant of the directory path being surrounded by backticks (or not) so that we are compatible with the current and upcoming implementation.
2024-03-26 19:04:52 +00:00
Taha Tesser 81f969e807
Fix ExpansionTile Expanded/Collapsed announcement is interrupted by VoiceOver (#143936)
fixes [`ExpansionTile` accessibility information doesn't read Expanded/Collapsed (iOS)](https://github.com/flutter/flutter/issues/132264)

### 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(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('ExpansionTile'),
        ),
        body: const ExpansionTile(
          title: Text("Title"),
          children: <Widget>[
            Placeholder(),
          ],
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {},
          child: const Icon(Icons.add),
        ),
      ),
    );
  }
}
```

</details>

### Before

https://github.com/flutter/flutter/assets/48603081/542d8392-52dc-4319-92ba-215a7164db49

### After

https://github.com/flutter/flutter/assets/48603081/c9225144-4c12-4e92-bc41-4ff82b370ad7
2024-03-26 18:36:09 +00:00
Kevin Moore 388f3217e4
[flutter_tools] Enable WebAssembly compilation everywhere, remove feature flag (#145562) 2024-03-26 18:23:49 +00:00
Taha Tesser 8363e78280
Fix SearchAnchor triggers unnecessary suggestions builder calls (#143443)
fixes [`SearchAnchor` triggers extra search operations](https://github.com/flutter/flutter/issues/139880)

### Code sample

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

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

Future<List<String>> createFuture() async {
  return List.generate(1000, (index) => "Hello World!");
}

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final SearchController controller = SearchController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            SearchAnchor(
              searchController: controller,
              suggestionsBuilder: (suggestionsContext, controller) {
                final resultFuture = createFuture();
                return [
                  FutureBuilder(
                    future: resultFuture,
                    builder: ((context, snapshot) {
                      if (snapshot.connectionState != ConnectionState.done) {
                        return const LinearProgressIndicator();
                      }
                      final result = snapshot.data;
                      if (result == null) {
                        return const LinearProgressIndicator();
                      }
                      return ListView.builder(
                        shrinkWrap: true,
                        physics: const NeverScrollableScrollPhysics(),
                        itemCount: result.length,
                        itemBuilder: (BuildContext context, int index) {
                          final root = result[index];
                          return ListTile(
                            leading: const Icon(Icons.article),
                            title: Text(root),
                            subtitle: Text(
                              root,
                              overflow: TextOverflow.ellipsis,
                              style: TextStyle(
                                color: Theme.of(suggestionsContext)
                                    .colorScheme
                                    .onSurfaceVariant,
                              ),
                            ),
                            onTap: () {},
                          );
                        },
                      );
                    }),
                  ),
                ];
              },
              builder: (BuildContext context, SearchController controller) {
                return IconButton(
                  onPressed: () {
                    controller.openView();
                  },
                  icon: const Icon(Icons.search),
                );
              },
            ),
          ],
        ),
      ),
    );
  }
}

```

</details>

### Before

https://github.com/flutter/flutter/assets/48603081/69f6dfdc-9f92-4d2e-8a3e-984fce25f9e4

### After

https://github.com/flutter/flutter/assets/48603081/be105e2c-51d8-4cb0-a75b-f5f41d948e5e
2024-03-25 22:58:11 +00:00
Taha Tesser 5e19b33534
Fix vertical Stepper draws connector on the last step (#145703)
fixes [Vertical stepper shows line after last step](https://github.com/flutter/flutter/issues/144376)

### 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(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: Stepper(
            currentStep: 1,
            steps: const <Step>[
              Step(
                title: Text("Step 1"),
                content: Text("Content 1"),
              ),
              Step(
                title: Text("Step 2"),
                content: Text("Content 2"),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
```

</details>

### Before

![Screenshot 2024-03-25 at 18 36 32](https://github.com/flutter/flutter/assets/48603081/af859a88-7ec8-4432-8eec-f8eb72706b57)

### After
![Screenshot 2024-03-25 at 18 36 24](https://github.com/flutter/flutter/assets/48603081/994325b2-4bd4-44ef-9473-245d3492faf7)
2024-03-25 21:47:05 +00:00
Kenzie Davisson 31f4f2b6c0
Add a --print-dtd flag to print the DTD address served by DevTools server (#144272) 2024-03-25 13:04:18 -07:00
Ikko Eltociear Ashimine 9fa731ddf8
Update semantics.dart (#145683)
loosing -> losing
2024-03-25 18:17:54 +00:00
Kostia Sokolovskyi 453a04d9f3
TwoDimensionalChildDelegate should dispatch creation and disposal events (#145684) 2024-03-25 10:45:02 -07:00
Kostia Sokolovskyi 47bfa827ba
Memory leaks clean up 1 (#145691) 2024-03-25 10:36:42 -07:00
Sahil Kachhap a9f18b803b
[Fix]: Searchbar doesn't lose focus when tapped outside (#145232)
Added a Fix to search bar that allows it be unfocused when tapped anywhere outside the search bar.

I have attached below the app flow after implementing the fix.

https://github.com/flutter/flutter/assets/54017876/70915c47-9b77-4a43-a128-8706107f921f

Issue that gets resolved by this fix: #145096

*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-03-25 17:02:07 +00:00
Kostia Sokolovskyi 2851ed3202
Fix typo in hitTest docs (#145677)
This PR fixes the typo in the `hitTest` method documentation.
2024-03-25 17:00:06 +00:00
Daco Harkes baa54fdd76
[deps] Bump native assets dependencies (#145612)
Roll of a bunch of breaking changes from the native_assets_builder and
native_assets_cli upstream. Most notably:

* https://github.com/dart-lang/native/pull/946
* https://github.com/dart-lang/native/pull/1018
* https://github.com/dart-lang/native/pull/1019

This PR also updates the template in `flutter create
--template=package_ffi` to use the rewritten API.

This PR does not change any functionality in Flutter.

For reference, the same roll in the Dart SDK:

* https://dart-review.googlesource.com/c/sdk/+/357605
* https://dart-review.googlesource.com/c/sdk/+/357623

## 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] All existing and new tests are passing.

<!-- 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
2024-03-25 15:02:49 +01: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
Andrew Kolos cd785544fa
make hot reload reflect changes to asset transformer configurations (#144660)
In service of https://github.com/flutter/flutter/issues/143348

This PR makes hot reloads reflect changes to transformer configurations under the `assets` section in pubspec.yaml.
This PR is optimized for ease of implementation, and should not be merged as-is. If it is merged as-is, seriously consider creating a tech debt issue and assigning it to someone to make sure it gets resolved.
2024-03-25 04:13:11 +00:00
Polina Cherkasova 9fee27b244
Leak clean up. (#144803)
Fix some leaks and mark others.

[Known leaks](https://github.com/issues?q=is%3Aopen+is%3Aissue+label%3A%22a%3A+leak+tracking%22+-label%3A%22c%3A+new+feature%22+)
2024-03-24 18:01:17 +00:00
Pierre-Louis 9ae8a6b7d5
Reland #128236 "Improve build output for all platforms" (#145495)
Reland #128236, reverted in https://github.com/flutter/flutter/pull/143125, https://github.com/flutter/flutter/pull/145261, and https://github.com/flutter/flutter/pull/145487.

The errors were raised in post-submit tests on Windows. I have finally obtained a Windows machine to reproduce the errors locally and adjust the test (remove size expectation and rename output `.exe`).

## Original description

Improves the build output:

1. Gives confirmation that the build succeeded, in green
1. Gives the path to the built executable, without a trailing period to make it slightly easier to cmd/ctrl+open
1. Gives the size of the built executable (when the built executable is self contained) 

### `apk`, `appbundle` 

<img width="607" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ecc52abe-cd2e-4116-b22a-8385ae3e980d">

<img width="634" alt="image" src="https://github.com/flutter/flutter/assets/6655696/8af8bd33-c0bd-4215-9a06-9652ee019436">

### `macos`, `ios`, `ipa`
Build executables are self-contained and use a newly introduced `OperatingSystemUtils.getDirectorySize`.

<img width="514" alt="image" src="https://github.com/flutter/flutter/assets/6655696/b5918a69-3959-4417-9205-4f501d185257">

<img width="581" alt="image" src="https://github.com/flutter/flutter/assets/6655696/d72fd420-18cf-4470-9e4b-b6ac10fbcd50">

<img width="616" alt="image" src="https://github.com/flutter/flutter/assets/6655696/5f235ce1-252a-4c13-898f-139f6c7bc698">

### `windows`, `linux`, and `web`
Build executables aren't self-contained, and folder size can sometimes overestimate distribution size, therefore their size isn't mentioned (see discussion below).

<img width="647" alt="image" src="https://github.com/flutter/flutter/assets/6655696/7179e771-1eb7-48f6-b770-975bc073437b">

<img width="658" alt="image" src="https://github.com/flutter/flutter/assets/6655696/a6801cab-7b5a-4975-a406-f4c9fa44d7a2">

<img width="608" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ee7c4125-a273-4a65-95d7-ab441edf8ac5">

### Size reporting
When applicable, the printed size matches the OS reported size.

- macOS
    <img width="391" alt="image" src="https://github.com/flutter/flutter/assets/6655696/881cbfb1-d355-444b-ab44-c1a6343190ce">
- Windows
    <img width="338" alt="image" src="https://github.com/flutter/flutter/assets/6655696/3b806def-3d15-48a9-8a25-df200d6feef7">
- Linux   
    <img width="320" alt="image" src="https://github.com/flutter/flutter/assets/6655696/89a4aa3d-2148-4f3b-b231-f93a057fee2b">

## Related issues
Part of #120127
Fixes https://github.com/flutter/flutter/issues/121401
2024-03-23 12:05:21 +00:00
David Iglesias df75d249b2
[web][docs] Improve HtmlElementView widget docs. (#145192)
This PR expands the `HtmlElementView` widget DartDocs, with the following sections:

* Usage: How to use the widget, two ways:
  * The `HtmlElementView.fromTagName` constructor
  * The `PlatformViewRegistry` way
* Lifecycle: There's an `onCreated` callback on the widget. When does it get called?
* HTML Lifecycle: How to listen to events coming from the DOM.
* Visibility: what is the `isVisible` property for?

Small additional tweaks here and there to mention common pitfalls of using HtmlElementView on the web, and mentions to workarounds, like `package:pointer_interceptor`.

## Issues

* Fixes: https://github.com/flutter/flutter/issues/143922
* Fixes: https://github.com/flutter/flutter/issues/49634
* Related: https://github.com/flutter/website/issues/5063
2024-03-23 00:53:26 +00:00
Kate Lovett 4820e0cd9f
Fix skipping golden comparator for CI environments (#145619)
Fixes https://github.com/flutter/flutter/issues/145618

The local file comparator was being used in post submit for the Linux coverage shard. This corrects it to choose the skipping comparator.
2024-03-22 20:45:35 +00:00
Kate Lovett c5047e0ada
2DScrollView - Fix drag when one axis does not have enough content (#145566)
Fixes https://github.com/flutter/flutter/issues/144982
For reference, may have to do with #138442 when we reworked the gesture handling. The adjustments to the comments here were certainly from #138442 not updating them. Confused myself for a minute or two. 🙃
2024-03-22 16:42:19 +00:00
Nate 7fb35db62f
Intensive if chain refactoring (#145194)
This pull request refactors if-statements into switch expressions, as part of the effort to solve issue #144903.

Making changes beyond just swapping syntax is more difficult (and also more difficult to review, I apologize), but much more satisfying too.
2024-03-22 13:55:06 +00:00
Bruno Leroux 859eb2eda9
Adds numpad navigation shortcuts for Linux (#145464)
## Description

This PR adds shortcuts related to numpad keys on Linux.

## Related Issue

Linux side for https://github.com/flutter/flutter/issues/144936

## Tests

Adds 2 tests.
2024-03-22 06:22:09 +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