23199 Commits

Author SHA1 Message Date
Danny Tuppeny
cea1d6f055
Unpin DDS and roll pub packages (#147925)
DDS was temporarily pinned to 4.1.0 because 4.2.0 triggered some test
failures (see https://github.com/flutter/flutter/pull/147250). Those
failures should be fixed by vm_service 14.2.2, so this unpins DDS and
rolls both of these packages (along with devtools_shared, which is a DDS
dependency).

(If the bot updates vm_service before this is done, I can rebase over
that will reduce the size of this PR to just a few files)
2024-05-08 10:35:28 +01:00
Bruno Leroux
86a2613cee
Fix floating SnackBar is not centered when RTL and Material 2 (#147861)
## Description

This PR fixes floating `SnackBar` positioning when the text direction is RTL and the theme uses Material 2.

In https://github.com/flutter/flutter/pull/140215, I fixed the `SnackBar` position for M3/RTL, but while doing so I broke the positioning for M2/RTL... Unfortunately, there was no existing test for this case.
The solution is to not rely on `TextDirection` to compute the `SnackBar` position: the `SnackBar` is centered in both cases so the text direction has no impact on its positioning (it had some impact in the `SnackBar` content, but this is managed correctly).

## Related Issue

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

## Tests

Adds 1 test.
2024-05-08 07:34:05 +00:00
Valentin Vignal
ab8b2f7e53
Fix more memory leaks in cupertino page transition (#147907) 2024-05-07 19:07:04 -07:00
LongCatIsLooong
e37b29daa9
Implement computeDryBaseline for RenderChip (#146224)
Also, use `getDryLayout` for the first pass of the `label` layout.  

The computeDryBaseline stuff doesn't have a test because there're asserts making sure it returns the same result as `computeDistanceToActualBaseline`. I have tried adding `+1` to the return expression and `flutter test` fails.
2024-05-08 00:27:59 +00:00
Dimil Kalathiya
4abd7352f8
fixes RawDialogRoute memory leak (#147817)
part of #141198 

- Fixes memory leak on `RawDialogRoute`
- Adds opt-in test
2024-05-07 23:39:56 +00:00
Elliott Brooks
b487b8c19a
[flutter web] Listen for service extension registration events to determine hot-restart method name (#147897)
### Some background:

* Flutter registers the hot-restart service extension for all devices **except** web devices. For web devices, DWDS registers the service extensions.
* When a user is debugging their code via VS Code, the VS Code Dart extension [sends a hot-restart](94cb81c552/src/debug/run_daemon_base.ts (L100)) request via stdin/out to flutter_tools
* flutter_tools then [calls the "hotRestart" service extension](f3978c7a46/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart (L447)) (which, again, has been registered by DWDS)

### Why is this change necessary?

In DWDS, we are changing how we register the "hotRestart" service extension (here is the PR for that: https://github.com/dart-lang/webdev/pull/2388). Previously, we registered the "hotRestart" service extension on a client that was directly connected to the VmService. With https://github.com/dart-lang/webdev/pull/2388, we will be registering the "hotRestart" service extension on a client that is connected to DDS. 

When a service extension is registered against DDS, DDS adds a prefix to the service extension method name (e.g. "hotRestart" becomes "s0.hotRestart"). It informs clients of the service extension name via `kServiceRegistered` events sent to the `Service` stream. 

Therefore, this change simply listens to those service extension registered events, and uses them to determine the "hotRestart" service extension's method name.
2024-05-07 23:06:59 +00:00
David Iglesias
d7656f2fcf
[web] Use platform detection from Flutter web engine. (#147346)
> [!IMPORTANT]
> Requires the following engine PR:
> * https://github.com/flutter/engine/pull/52380
> ----

This PR refactors Flutter `foundation`'s library `platform` for the web with the same code we use to detect platforms in the engine.

## Issues

* Fixes: https://github.com/flutter/flutter/issues/128943

## Testing

Demo app deployed here:

* https://dit-browser-detect.web.app
2024-05-07 22:44:56 +00:00
LongCatIsLooong
f20c853d20
Implement RenderEditable.computeDryBaseline (#147911)
Missed `RenderEditable` so https://github.com/flutter/flutter/pull/146224 is failing in google3
2024-05-07 21:26:48 +00:00
Taha Tesser
74356f30dd
Introduce TabBar.textScaler for tab label upper text scale limit (#147232)
fixes [Tab is hardcoding the height of the icons and the text ](https://github.com/flutter/flutter/issues/13322)

### Description

This PR introduces `TabBar.textScaler` to provide upper text scale limit for tab label.

### 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: MediaQuery(
        data: const MediaQueryData(textScaler: TextScaler.linear(3.0)),
        child: DefaultTabController(
          length: 3,
          child: Scaffold(
            appBar: AppBar(
              title: const Text('Sample'),
              bottom: const TabBar(
                textScaler: TextScaler.linear(2.0),
                tabs: <Widget>[
                  Tab(text: 'Tab 1'),
                  Tab(text: 'Tab 2'),
                  Tab(text: 'Tab 3'),
                ],
              ),
            ),
            floatingActionButton: Builder(builder: (BuildContext context) {
              return FloatingActionButton(
                onPressed: () {
                  print(MediaQuery.textScalerOf(context));
                },
                child: const Icon(Icons.add),
              );
            }),
          ),
        ),
      ),
    );
  }
}
```

</details>

### Without `TabBar.textScaler`
![Screenshot 2024-04-30 at 13 46 10](https://github.com/flutter/flutter/assets/48603081/99db889a-b717-4ddf-b99e-89fdf7edb3ac)

### With `TabBar.textScaler`

```dart
              bottom: const TabBar(
                textScaler: TextScaler.linear(2.0),
                tabs: <Widget>[
                  Tab(text: 'Tab 1'),
                  Tab(text: 'Tab 2'),
                  Tab(text: 'Tab 3'),
                ],
              ),
```

![Screenshot 2024-04-30 at 14 04 22](https://github.com/flutter/flutter/assets/48603081/92216cbb-eb89-4c0a-b2f2-feb6a33a3337)
2024-05-07 20:54:09 +00:00
August
be3e916443
feat: Rework getting plugin implementation candidates and plugin resolution (#145258)
Part of #137040 and #80374

- Extracted getting plugin implementation candidates and the default implementation to its own method
- Extracted resolving the plugin implementation to its own method
- Simplify candidate selection algorithm
- Support overriding inline dart implementation for an app-facing plugin
- Throw error, if a federated plugin implements an app-facing plugin, but also references a default implementation
- Throw error, if a plugin provides an inline implementation, but also references a default implementation
2024-05-07 20:03:27 +00:00
Mitchell Goodwin
e67e951388
Change dialog font family (#141295)
Fixes #139434.

Changes the font from "Text" to "Display". We should only be using the "Display" font for fonts of size 20 and above. Previously "Display" was not showing correctly so this font being wrong was flying under the radar.

Before:
<img width="315" alt="Screenshot 2024-01-10 at 10 49 26 AM" src="https://github.com/flutter/flutter/assets/58190796/c8beba30-04d2-4c22-86ae-85c0576136ee">

After:
<img width="289" alt="Screenshot 2024-01-10 at 10 52 11 AM" src="https://github.com/flutter/flutter/assets/58190796/c6b33aaf-791c-460e-a640-37d8ddf3f713">
2024-05-07 19:32:47 +00:00
Daco Harkes
6967ae551e
Fix dep tracking (#147709)
Fix dependency tracking in the build.

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

## Testing

It's not clear to me where to test the caching behavior of specific targets.

* test/general.shard/build_system/targets/common_test.dart
   * This doesn't test the caching behavior of any targets
* test/general.shard/build_system/build_system_test.dart
* test/general.shard/cache_test.dart
   * Both of these don't test specific `Target`s, these have `TestTarget`s.
* test/integration.shard/isolated/native_assets_test.dart
   * This could work, but it's an integration test that already takes long to run.
2024-05-07 17:44:12 +00:00
Gray Mackall
d04edd1d7f
Add kotlinOptions jvmTarget to templates (#147326)
Adds jvmTarget to gradle templates. 

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

Interestingly, we already had this in many of our examples/tests, see search results here https://github.com/search?q=repo%3Aflutter%2Fflutter%20jvmTarget&type=code.
2024-05-07 17:32:10 +00:00
chunhtai
007faa980d
Reapply new PopScope API (#147607)
same as previous but with soft transition on modalroute

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Data Driven Fixes]:
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
2024-05-07 09:04:49 -07:00
Bartek Pacia
7cf1969ad4
Improve Android SDK and NDK mistmatch warning message (#147809)
This PR resolves #147806

- List plugin that want to be compiled against a higher Android SDK version
- List plugins that depend on a different NDK version (we don't have a way to compare them)
- Small formatting and wording improvements
- Update syntax to work for both Groovy and Kotlin
- If project uses `build.gradle.kts`, then it is mentioned in the warning message (previously always `build.gradle` was mentioned)

<img width="1209" alt="demo" src="https://github.com/flutter/flutter/assets/40357511/be3522b5-d1b4-4983-9fed-8aaa0f0bc7f7">
2024-05-07 15:11:00 +00:00
Bruno Leroux
986c5a9d7f
DropdownMenu cleanup (#147860)
## Description

This PR cleans up some typos and formatting issues in `DropdownMenu` implementation.

## Tests

No semantic change.
2024-05-07 07:57:21 +00:00
zhengzeqin
23ae246a2e
fix MenuItemButton if child is null (#147485)
Fix https://github.com/flutter/flutter/issues/147479

Pre-launch Checklist
2024-05-07 02:39:09 +00:00
flutter-pub-roller-bot
c0ed9f6ff4
Roll pub packages (#147896)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-05-06 23:36:21 +00:00
davidhicks980
d5f70135fe
MultiSelectableSelectionContainerDelegate documentation fixes. (#147843)
Minor grammatical fixes to MultiSelectableSelectionContainerDelegate:

* Removed plural words describing a singular subject.
* Removed redundant language. 
* Elaborated on the behavior of `ensureChildUpdated`.

No issue was filed this was a minor rewording.
2024-05-06 23:14:52 +00:00
flutter-pub-roller-bot
d4b2e5d705
Roll pub packages (#147891)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-05-06 22:39:58 +00:00
Valentin Vignal
f3978c7a46
Fix janks and memory leaks in CupertinoPageTransition and CupertinoFullscreenDialogTransition (#146999) 2024-05-06 14:26:00 -07:00
Polina Cherkasova
5bac0de9e3
Fix leak in a test. (#147846) 2024-05-06 17:47:37 +00:00
Karel Klíč
f94b1e1fc8
Fix Tooltip.decoration comment (#147858)
Tooltip decoration's comment had the backgrounds for Brightness.dark and Brightness.light swapped.
2024-05-06 13:13:19 +00:00
Polina Cherkasova
865de0f3ef
Fix test. (#147813) 2024-05-04 20:01:33 -07:00
Valentin Vignal
459df3c62d
Fix memory leaks in CupertinoSwitch (#147821) 2024-05-04 18:33:42 -07:00
Valentin Vignal
02d239a098
Reland fix memory leaks for tab selector (#147689) 2024-05-04 18:23:39 -07:00
Kostia Sokolovskyi
145e94018c
Fix memory leak in ExpansionTile. (#147596) 2024-05-04 18:19:29 -07:00
Dimil Kalathiya
c1cafcce12
fixes SearchAnchor leak (#147652) 2024-05-03 09:34:11 -07:00
Bruno Leroux
99876ba2ce
Always relies on floatingLabelStyle when FloatingLabelBehavior.always (#147374)
## Description

With this PR, when `InputDecorator.floatingLabelBehavior` is set to `FloatingLabelBehavior.always` the label style is always set to `InputDecorator.floatingLabelStyle`, previously `InputDecorator.labelStyle` was used when the field was not focused or was empty.  

## Related Issue

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

## Tests

Adds 1 test for this particular issue and several missing tests.
2024-05-03 15:16:05 +00:00
drown0315
cfeb76e0e6
Improved documentation for SpringSimulation (#146674)
Add a code snippet demonstrating the usage of SpringSimulation in the docs.
Improve the descriptions of each argument in SpringDescription.
2024-05-03 08:48:18 +00:00
flutter-pub-roller-bot
69edf4d7a7
Roll pub packages (#147741)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-05-03 00:37:06 +00:00
Nate
5d1bfdcb87
Control flow collections: flutter_tools/ (#147450)
This pull request aims for improved readability, based on issue #146600.

```dart
// before
List<SupportedPlatform> getSupportedPlatforms({bool includeRoot = false}) {
  final List<SupportedPlatform> platforms = includeRoot
      ? <SupportedPlatform>[SupportedPlatform.root]
      : <SupportedPlatform>[];
  if (android.existsSync()) {
    platforms.add(SupportedPlatform.android);
  }
  if (ios.exists) {
    platforms.add(SupportedPlatform.ios);
  }
  if (web.existsSync()) {
    platforms.add(SupportedPlatform.web);
  }
  if (macos.existsSync()) {
    platforms.add(SupportedPlatform.macos);
  }
  if (linux.existsSync()) {
    platforms.add(SupportedPlatform.linux);
  }
  if (windows.existsSync()) {
    platforms.add(SupportedPlatform.windows);
  }
  if (fuchsia.existsSync()) {
    platforms.add(SupportedPlatform.fuchsia);
  }
  return platforms;
}

// after
List<SupportedPlatform> getSupportedPlatforms({bool includeRoot = false}) {
  return <SupportedPlatform>[
    if (includeRoot)          SupportedPlatform.root,
    if (android.existsSync()) SupportedPlatform.android,
    if (ios.exists)           SupportedPlatform.ios,
    if (web.existsSync())     SupportedPlatform.web,
    if (macos.existsSync())   SupportedPlatform.macos,
    if (linux.existsSync())   SupportedPlatform.linux,
    if (windows.existsSync()) SupportedPlatform.windows,
    if (fuchsia.existsSync()) SupportedPlatform.fuchsia,
  ];
}
```
2024-05-02 22:19:18 +00:00
Nate
7436cc25eb
Add default arguments to AnimatedPhysicalModel (#147424)
Currently, `PhysicalModel` has [default arguments](2e806700b9/packages/flutter/lib/src/widgets/basic.dart (L1093)) for `shape` and `elevation`, but `AnimatedPhysicalModel` [does not](2e806700b9/packages/flutter/lib/src/widgets/implicit_animations.dart (L1998)).

This pull request makes both classes consistent.
2024-05-02 21:59:07 +00:00
LongCatIsLooong
f76eda1e7f
_RenderDecorator.computeDryBaseline (#146365)
Depends on https://github.com/flutter/flutter/pull/146363

No test because the consistency of the `computeDryBaseline` implementations is checked at paint time.
2024-05-02 20:56:11 +00:00
Andrew Kolos
13beab1ecc
add verbose logging to select hot reload/hot restart tests (#147673)
In service of https://github.com/flutter/flutter/issues/146879 and https://github.com/flutter/flutter/issues/145812. In these issues, we see what appears to be the flutter tool getting stuck somewhere during hot reload. It may help if we knew were exactly where we are getting stuck (preparing assets, writing them to device, etc.).

This PR adds a new parameter to `FlutterTestDriver::run`, `verbose`. When verbose is set, `FlutterTestDriver` will run `flutter` with `--verbose` in its tests. Keep in mind that `FlutterTestDriver` only prints logs from `flutter` when a test fails, so this shouldn't spam the logs of passing tests.

This PR sets the parameter when invoking the flaky tests from https://github.com/flutter/flutter/issues/146879 and #145812, so we should see more detailed logs in future flakes.

While this is a low risk PR, you can verify the change by intentionally breaking hot reload code, clearing the cached tool binaries, and then running either of these tests.
2024-05-02 04:03:32 +00:00
auto-submit[bot]
706f39b0a0
Reverts "Implement computeDryBaseline for RenderWrap (#146260)" (#147692)
Reverts: flutter/flutter#146260
Initiated by: chingjun
Reason for reverting: Broke internal tests. See b/338308016
Original PR Author: LongCatIsLooong

Reviewed By: {goderbauer}

This change reverts the following previous change:
2024-05-02 02:26:28 +00:00
Greg Spencer
2e78ed0ff9
Allow explicit exclusion of packages from pinned packages in flutter update-packages --force-update (#147679)
## Description

This introduces a list of packages that we will explicitly not pin.  It is to be used for things where the package isn't actually published, but is a transitive dependency of another package included in the SDK.  This happens with the `macros` package, for instance, which depends on the private, unpublished, `_macros` package where the SDK does some tricky things to depend on it (it depends on "any", but ships it as part of the SDK).

Also ran `flutter update-packages --force-update` to update all of the pubspec files.

## Related Issues
 - Fixes #147656

## Tests
 - Added a test that makes sure that explicitly unpinned packages don't show up in the pinned list.
2024-05-02 01:16:54 +00:00
LongCatIsLooong
ab8ecd5e74
Implement getDryBaseline for Stack and Overlay (#146253) 2024-05-02 00:31:12 +00:00
Polina Cherkasova
5eb1807464
Update selectable_text_test.dart (#147677)
Fix leak introduced by https://github.com/flutter/flutter/pull/147341
2024-05-02 00:03:15 +00:00
LongCatIsLooong
88ffd89685
Implement computeDryBaseline for RenderWrap (#146260) 2024-05-01 22:39:08 +00:00
Ian Hickson
db4dfa0dde
Remove obsolete performance analysis tools. (#147663)
We're unlikely to support these reliably going forward.
2024-05-01 22:05:02 +00:00
PurplePolyhedron
68f8b536e2
fix DropdownMenu overflow (#147233)
fix `DropdownMenu` overflow issue in  https://github.com/flutter/flutter/issues/147076 and https://github.com/flutter/flutter/issues/147173
However I believe the the menu placement issue in https://github.com/flutter/flutter/issues/147076 is a separate issue. It is not fixed here.

fixes https://github.com/flutter/flutter/issues/147173
2024-05-01 21:24:58 +00:00
Renzo Olivares
5181086fac
Fix TextField horizontal drag conflicts (#147341)
Currently on iOS `TextField` horizontal drag gestures will have precedence over parent horizontal drag gestures when competing with each other because the default `touchSlop` value used by `TextField` to calculate whether the threshold for a drag has been met is the same as the one used by parent horizontal drag gestures like `PageView`, and other `Scrollable`s. The default value is `18.0`, and because the `TextField` receives the `PointerEvent` first in this scenario, it always declares victory before any parent horizontal drag gestures has the chance to.

Native iOS behavior: The parent horizontal drag gestures will always win unless the drag originated on the cursor (collapsed selection), in that case the TextField cursor drag gestures will win.

This change:
* Introduces `BaseTapAndDragGestureRecognizer.eagerVictoryOnDrag` which can be used to configure the recognizer to declare victory immediately when it detects a drag, or when disabled it will wait until it is the last recognizer in the arena before declaring victory. The default behavior is that it declares victory immediately when the drag is detected.
* Eliminates the iOS cursor drag logic from `TextSelectionGestureDetector`, this logic is now delegated to the selection handle overlay which already had this logic in place.
* Enables iOS cursor to always beat other drag gestures by setting the touch slop lower.
* Disables `eagerVictoryOnDrag` for iOS to allow for parent drag gestures to win and match native behavior.

Fixes #124421, Fixes #130198, Fixes #142624, Fixes #142447, Fixes #127017
2024-05-01 20:51:54 +00:00
Nate
586e1fce1b
flutter/lib/src/: refactoring if-chains into switch expressions (#147472)
Cleans up some code by porting if chains to switch statements.
2024-05-01 12:58:35 -07:00
auto-submit[bot]
5a41e1edac
Reverts "Draggable feedback positioning (#145647)" (#147658)
Reverts: flutter/flutter#145647
Initiated by: jmagman
Reason for reverting: Failing draggable_test in post-submit.
Original PR Author: timcreatedit

Reviewed By: {justinmc, goderbauer}

This change reverts the following previous change:
We changed the coordinates used to position the `Draggable` feedback by transforming them into the `Overlay`s coordinate space. This has no influence on any untransformed `Overlay`, most Flutter apps should be not affected. 
This PR fixes the positioning of the feedback in transformed context (see #145639 for before video):

https://github.com/flutter/flutter/assets/42270125/df34e198-0667-453d-a27a-a79b2e2825a1

- fixes #145639
2024-05-01 18:26:27 +00:00
Tim Lehmann
5f9e069111
Draggable feedback positioning (#145647)
Fixes a calculation in Draggable that was previously wrong when the target was transformed.
2024-05-01 09:56:23 -07:00
Ellet
8bf614f181
Update reorderable_list.dart to use Dart 3 return switch statement for consistency (#147505)
*Update `reorderable_list.dart` from `widgets` to use Dart 3 return switch statement syntax for consistency.*

This just a syntax change to match the rest of the functions in this file
2024-05-01 16:03:08 +00:00
Kostia Sokolovskyi
d33bb8fa5e
Add tests for single_activator.0.dart API example. (#147426)
This PR contributes to https://github.com/flutter/flutter/issues/130459

### Description
- Fixes name of the `examples/api/lib/widgets/shortcuts/single_activator.single_activator.0.dart`
- Adds tests for `examples/api/lib/widgets/shortcuts/single_activator.0.dart`
2024-05-01 14:52:57 +00:00
Kishan Dhankecha
2867ac7885
Added missing code block language in docs (#147481)
- added language for all code blocks
- replaced `bash` or `shell` with `sh` for consistency.
- added `sh` and `console` in the GitHub template link generator.
- updated test for GitHub template.
2024-05-01 14:44:27 +00:00
auto-submit[bot]
abbaaea8a1
Reverts "Fix memory leak in TabPageSelector (#147403)" (#147622)
Reverts: flutter/flutter#147403
Initiated by: chingjun
Reason for reverting: Causing an internal test to fail, see b/338159496 for details
Original PR Author: ValentinVignal

Reviewed By: {polina-c}

This change reverts the following previous change:
Part of https://github.com/flutter/flutter/issues/141198
2024-05-01 05:32:19 +00:00