Commit graph

23976 commits

Author SHA1 Message Date
Mairramer 29dd03c56b
Fixes column text width calculation in CupertinoDatePicker (#151128)
Fixes #138305, #110319
2024-09-28 20:21:48 +00:00
RamonFarizel 1290ab42d1
Add magnificationScale to CupertinoMagnifier for Zoom Effect (#155276)
Add  `magnificationScale `to `CupertinoMagnifier` for Zoom Effect

The CupertinoMagnifier widget is not displaying the expected zoom effect.
This issue arises because the widget internally wraps the RawMagnifier, which has its magnificationScale attribute set to the default value of 1. As a result, no magnification is applied, and the zoom effect is absent.

Fixes #155275
2024-09-27 23:13:19 +00:00
Jonathan Steele 96291fc0c4
Fix typo on theme_data (#155644)
Fix one typo on theme_data

## 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].
- [ ] 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].
- [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/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-09-27 14:33:09 -07:00
Martin Kustermann ead6b0d17c
Remove left-over traces of "link-dry-run" - which isn't used anywhere in flutter (#155820)
The "link-dry-run" functionality was never used in flutter (even before
the recent refactoring).
I think we can remove this "link-dry-run" concept everywhere.

PR to remove this in dart-lang/native:
https://github.com/dart-lang/native/pull/1613
2024-09-27 16:45:35 +02:00
Bruno Leroux 9ee3fb813f
Fix DropdownMenu rendered behind AppBar (#155539)
## Description

This PR changes the `MenuAnchor` implementation in order to always show the menu on the root overlay. Doing so menus can't be hidden by other widgets especially when using go_router.

See [[go_router] DropdownMenu behind NavigationBar](https://github.com/flutter/flutter/issues/155034) where the DropdownMenu menu was displayed behind the navigation bar.

I did not make this configurable for the moment to avoid introducing a new parameter until there is a clear use case for it.

## Related Issue

Fixes [[go_router] DropdownMenu behind NavigationBar](https://github.com/flutter/flutter/issues/155034).

## Tests

Adds 1 test.
2024-09-27 07:18:35 +00:00
David Iglesias f9a76aea87
Throw StateError when implicitView is null on wrapWithDefaultView. (#155734)
This PR tweaks `wrapWithDefaultView` (used by `runApp`) to raise a StateError with a legible error message when the `platformDispatcher.implicitView` is missing (for example, when enabling multi-view embedding on the web), instead of crashing with an unexpected `nullCheck` a few lines below.

* Before:
  <img width="619" alt="Screenshot 2024-09-25 at 7 33 47 PM" src="https://github.com/user-attachments/assets/4897dd3c-bdd0-4217-9f23-7eee9fab4999">

* After:
  <img width="613" alt="Screenshot 2024-09-26 at 5 01 49 PM" src="https://github.com/user-attachments/assets/3febb91d-a8c3-41b6-bf34-c2c8743b637c">

## Issues

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

## Tests

Added a test to ensure the assertion is thrown when the `implicitView` is missing. Had to hack a little because I couldn't find any clean way of overriding the `implicitView`. The problem is that the flutter_test bindings [use `runApp` internally](8925e1ffdf/packages/flutter_test/lib/src/binding.dart (L1020)) a couple of times, so I can only disable the implicitView inside the test body (and must re-enable it before returning). Not sure if it's the best way, but it seems to do the trick for this simple test case!
2024-09-27 00:55:31 +00:00
Gray Mackall cad7418f0a
Roll packages manually (#155786)
*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-09-27 00:49:08 +00:00
Renzo Olivares 799cf16aeb
fix: SelectableText should handle focus changes (#155771)
This change updates the behavior of `SelectableText`, to clear its selection when it loses focus and the application is currently running. This fixes the behavior where you may have multiple active highlights if you have `SelectableText` along with other "selectable" widgets such as `TextField`, or `Text` widgets under a `SelectionArea`.

If the application is in the background, for example when another window is focused, the selection should be retained so when a user returns to the application it is still there.

This change also updates the behavior of selection on macOS, single tap up, previously it was selecting the word edge closest to the tapped position, the correct behavior on native is to select the precise position. This was causing `onSelectionChanged` to be called twice, once for tap down (sets the precise tapped position, handled by logic in `TextSelectionGestureDetector`), and a second time for single tap up (moves the cursor to closest word edge, handled by logic in `_SelectableTextSelectionGestureDetectorBuilder`). This type of selection inconsistency is related to this issue https://github.com/flutter/flutter/issues/129726, I plan to look into this further in a separate PR.

Fixes #117573
Fixes #103725
2024-09-27 00:17:05 +00:00
Renzo Olivares 9a64920bb9
RenderParagraph should invalidate its _SelectableFragments cached rects on window size updates (#155719)
Fixes #155143
Fixes #120578
2024-09-26 22:51:59 +00:00
zhengzeqin 7f663fc1d8
Fix broken text field with set hint and min and max lines(#153183) (#153235)
Fix https://github.com/flutter/flutter/issues/153183
Fix https://github.com/flutter/flutter/issues/52008

Pre-launch Checklist
2024-09-26 22:08:05 +00:00
Ian Hickson 20bc0a9cb8
Fix line-wrapping in flutter create error message. (#150325) 2024-09-26 17:04:03 +00:00
Martin Kustermann abcba1fa7e
Reland "[flutter_tools] Cleanup of native asset related code (removes around 50% of the native asset related code) (#155430)" (#155745)
Changes to original CL: The code that issues an error on unsupported
operating system in the dry-run case was missing a case for iOS and
Android

Original CL description

  tl;dr Removes 50% (>1650 locs) of native asset related code in
  `packages/flutter_tools`

Before this PR the invocation of dart build/link/dry-run was implemented
  per OS. This lead to very large code duplication of almost identical,
  but slightly different code. It also led to similarly duplicated test
  code.

  Almost the entire dart build/link/dry-run implementation is identical
  across OSes. There's small variations:

- configuration of the build (e.g. android/macos/ios version, ios sdk,
...)
  - determining target locations & copying the final shared libraries

This PR unifies the implementation by reducing the code to basically two
  main functions:

    * `runFlutterSpecificDartBuild` which is responsible for
      - obtain flutter configuration
      - perform dart build (& link)
      - determine target location & install binaries

  * `runFlutterSpecificDartDryRunOnPlatforms` which is responsible for a
  similar (but not same):
      - obtain flutter configuration
      - perform dart dry run
      - determine target location

  these two functions will call out to helpers for the OS specific
  functionality:

* `_assetTargetLocationsForOS` for determining the location of the code
  assets

* `_copyNativeCodeAssetsForOS` for copying the code assets (and possibly
  overriting the install name, etc)

=> Since we get rid of the code duplication across OSes and have only a
  single code path for the build/link/dry-run, we can also remove the
  duplicated tests that were pretty much identical across OSes.

  We also harden the building code by adding asserts, e.g.

    * the dry fun functionality should never be used by `flutter test`

* the `build/native_assets/<os>/native_assets.yaml` should only be used
       by `flutter test` and the dry-run of `flutter run`

  => We change the tests to also comply with these invariants (so the
  tests are not testing things that cannot happen in reality)

  We also rename `{,Flutter}NativeAssetsBuildRunner` to disambiguate it
  from the `package:native_asset_builder`'s `NativeAssetsBuildRunner`.
2024-09-26 12:21:29 +02:00
Sikandar Sadaqat cc0ca11ee4
added ability to configure shadow in banner (#155296)
Added ability to configure shadow in banner

Issues:  https://github.com/flutter/flutter/issues/154505

Before: 
![before](https://github.com/user-attachments/assets/d8b8e826-bab4-462a-a7ac-191e1597c3c6)

After:
![after](https://github.com/user-attachments/assets/3c4b57e7-182a-4749-af72-b82fdaf25013)
2024-09-26 04:04:24 +00:00
Robert Ancell 8925e1ffdf
Move the Linux runner into a subdirectory (#153812)
Fixes https://github.com/flutter/flutter/issues/60213
2024-09-26 11:52:53 +12:00
auto-submit[bot] 4dfa688ec4
Reverts "[flutter_tools] Cleanup of native asset related code (removes around 50% of the native asset related code) (#155430)" (#155713)
Reverts: flutter/flutter#155430
Initiated by: eyebrowsoffire
Reason for reverting: Postsubmit failures closing the tree. See the following examples:

https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_ios%20native_assets_ios/5738/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_arm64_mokey%20native_assets_android/583/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20native_assets_android/4075/overview
https://ci.chromium.org/u
Original PR Author: mkustermann

Reviewed By: {bkonyi, dcharkes}

This change reverts the following previous change:
tl;dr Removes 50% (>1650 locs) of native asset related code in `packages/flutter_tools`

Before this PR the invocation of dart build/link/dry-run was implemented per OS. This lead to very large code duplication of almost identical, but sligthly different code. It also led to similarly duplicated test code.

Almost the entire dart build/link/dry-run implementation is identical across OSes. There's small variations:

  - configuration of the build (e.g. android/macos/ios version, ios sdk, ...)
  - determining target locations & copying the final shared libraries

This PR unifies the implementation by reducing the code to basically two main functions:

  * `runFlutterSpecificDartBuild` which is responsible for
    - obtain flutter configuration
    - perform dart build (& link)
    - determine target location & install binaries

  * `runFlutterSpecificDartDryRunOnPlatforms` which is responsible for a similar (but not same):
    - obtain flutter configuration
    - perform dart dry run
    - determine target location

these two functions will call out to helpers for the OS specific functionality:

  * `_assetTargetLocationsForOS` for determining the location of the code assets

  * `_copyNativeCodeAssetsForOS` for copying the code assets (and possibly overriting the install name, etc)

=> Since we get rid of the code duplication across OSes and have only a single code path for the build/link/dry-run, we can also remove the duplicated tests that were pretty much identical across OSes.

We also harden the building code by adding asserts, e.g.

  * the dry fun functionality should never be used by `flutter test`

  * the `build/native_assets/<os>/native_assets.yaml` should only be used by `flutter test` and the dry-run of `flutter run`

=> We change the tests to also comply with these invariants (so the tests are not testing things that cannot happen in reality)

We also rename `{,Flutter}NativeAssetsBuildRunner` to disambiguate it from the `package:native_asset_builder`'s `NativeAssetsBuildRunner`.

We also reorganize the main code to make it readable from top-down and make members private where they can be.
2024-09-25 21:46:22 +00:00
Martin Kustermann 621e7ef951
[flutter_tools] Cleanup of native asset related code (removes around 50% of the native asset related code) (#155430)
tl;dr Removes 50% (>1650 locs) of native asset related code in
`packages/flutter_tools`

Before this PR the invocation of dart build/link/dry-run was implemented
per OS. This lead to very large code duplication of almost identical,
but slightly different code. It also led to similarly duplicated test
code.

Almost the entire dart build/link/dry-run implementation is identical
across OSes. There's small variations:

- configuration of the build (e.g. android/macos/ios version, ios sdk, ...)
- determining target locations & copying the final shared libraries

This PR unifies the implementation by reducing the code to basically two
main functions:

  * `runFlutterSpecificDartBuild` which is responsible for
    - obtain flutter configuration
    - perform dart build (& link)
    - determine target location & install binaries

* `runFlutterSpecificDartDryRunOnPlatforms` which is responsible for a
similar (but not same):
    - obtain flutter configuration
    - perform dart dry run
    - determine target location

these two functions will call out to helpers for the OS specific
functionality:

* `_assetTargetLocationsForOS` for determining the location of the code
assets

* `_copyNativeCodeAssetsForOS` for copying the code assets (and possibly
overriting the install name, etc)

=> Since we get rid of the code duplication across OSes and have only a
single code path for the build/link/dry-run, we can also remove the
duplicated tests that were pretty much identical across OSes.

We also harden the building code by adding asserts, e.g.

  * the dry fun functionality should never be used by `flutter test`

  * the `build/native_assets/<os>/native_assets.yaml` should only be used
     by `flutter test` and the dry-run of `flutter run`

=> We change the tests to also comply with these invariants (so the
tests are not testing things that cannot happen in reality)

We also rename `{,Flutter}NativeAssetsBuildRunner` to disambiguate it
from the `package:native_asset_builder`'s `NativeAssetsBuildRunner`.
2024-09-25 22:50:43 +02:00
Mohellebi abdessalem 936cfb8edc
reduce warnings inside flutter.groovy file #2 (#155628)
follow up for : [#152073](https://github.com/flutter/flutter/pull/152073)
2024-09-25 19:41:20 +00:00
Camille Simon 146ea07abd
[Android] Update SystemUiMode and setSystemChromeEnabledSystemUIMode docs to note targeting Android 15+ change (#153466)
Updates `SystemUiMode` and `setSystemChromeEnabledSystemUIMode` documentation to reflect that edge-to-edge mode is used by default if the Flutter app targets Android 15.

Part of https://github.com/flutter/flutter/issues/150367 and framework counterpart to https://github.com/flutter/engine/pull/54560.
2024-09-25 19:41:18 +00:00
auto-submit[bot] 1c9607fc9c
Reverts "Normalize TabBarTheme (#155476)" (#155698)
Reverts: flutter/flutter#155476
Initiated by: eyebrowsoffire
Reason for reverting: The newly added tests are failing in postsubmit. See https://ci.chromium.org/ui/p/flutter/builders/prod/Windows%20framework_tests_libraries/19062/overview
Original PR Author: QuncCccccc

Reviewed By: {TahaTesser}

This change reverts the following previous change:
This PR is to make preparations to make `TabBarTheme` conform to Flutter's conventions for component themes:

* Added a `TabBarThemeData` class which defines overrides for the defaults for `TabBar` properties.
* Added 2 `TabBarTheme` constructor parameters: `TabBarThemeData? data` and `Widget? child`. This is now the preferred way to configure a `TabBarTheme`:
```
TabBarTheme(
  data: TabBarThemeData(labelColor: xxx, indicatorColor: xxx, ...),
  child: TabBar(...)
)
```
  These two properties are made nullable to not break existing apps which has customized `ThemeData.tabBarTheme`.

* Changed the type of component theme defaults from `TabBarTheme` to `TabBarThemeData`.

TODO:

* Fix internal failures.
* Change the type of `ThemeData.tabBarTheme` from `TabBarTheme` to `TabBarThemeData`. This may cause breaking changes, a migration guide will be created.

Addresses the "theme normalization" sub project within https://github.com/flutter/flutter/issues/91772
2024-09-25 17:50:18 +00:00
Qun Cheng f310625bc6
Normalize TabBarTheme (#155476)
This PR is to make preparations to make `TabBarTheme` conform to Flutter's conventions for component themes:

* Added a `TabBarThemeData` class which defines overrides for the defaults for `TabBar` properties.
* Added 2 `TabBarTheme` constructor parameters: `TabBarThemeData? data` and `Widget? child`. This is now the preferred way to configure a `TabBarTheme`:
```
TabBarTheme(
  data: TabBarThemeData(labelColor: xxx, indicatorColor: xxx, ...),
  child: TabBar(...)
)
```
  These two properties are made nullable to not break existing apps which has customized `ThemeData.tabBarTheme`.

* Changed the type of component theme defaults from `TabBarTheme` to `TabBarThemeData`.

TODO:

* Fix internal failures.
* Change the type of `ThemeData.tabBarTheme` from `TabBarTheme` to `TabBarThemeData`. This may cause breaking changes, a migration guide will be created.

Addresses the "theme normalization" sub project within https://github.com/flutter/flutter/issues/91772
2024-09-25 17:19:00 +00:00
Kostia Sokolovskyi ce24dd6a76
Add WidgetStateBorderSide example and tests for it. (#155559)
Fixes https://github.com/flutter/flutter/issues/155557

### Description
- Adds example for `WidgetStateBorderSide`
- Adds tests for `examples/api/lib/widgets/widget_state/widget_state_border_side.0.dart`
2024-09-25 15:53:28 +00:00
Jenn Magder 9d42f826d7
Add PrivacyInfo.xcprivacy to macOS plugin template (#155570)
macOS version of https://github.com/flutter/flutter/pull/148485 without NSPrivacyAccessedAPITypes.

Fixes https://github.com/flutter/flutter/issues/155563
2024-09-25 05:30:53 +00:00
PurplePolyhedron 7677aac8e8
fix SearchAnchor disposing SearchController while it is still used (#155219)
fixes https://github.com/flutter/flutter/issues/155180
New behaviour: SearchAnchor now closes the menu when itself is disposed while the menu is still open. This is the behaviour of `MenuAnchor`/`OverlayPortal`.
2024-09-25 04:13:37 +00:00
flutter-pub-roller-bot db76401cd8
Roll pub packages (#155640)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-09-25 00:03:57 +00:00
Hugh Hou 27ec9ab982
Preserve transform when using *Gradient:withOpacity (#154908)
i don't think it was intentional to lose it?

- [] All existing and new tests are passing.
2024-09-24 22:14:59 +00:00
nick9822 d95821c1d1
fixed keyboardDismissBehavior on scroll without a drag (#154675)
fixes #154515, #150048 and other similar issues where user non-draggable scrolls (mouse wheel, two-fingers) should behave same as draggable ones.

In this PR, scrollUpdateNotification.dragDetails check is removed and it has a supporting test which simulates a scroll which does not produce a drag.
2024-09-24 22:12:32 +00:00
Parker Lougheed 22570daa18
Misc docs cleanup and fixes (#155501) 2024-09-24 20:03:08 +00:00
Danny Tuppeny 9fcbcd4357
Fix some broken links in DAP readme (#155600)
The location of the DAP readme in the Dart SDK repo moved. Some of the links here got updated, but apparently not all.
2024-09-24 14:47:24 +00:00
Danny Tuppeny 3f038aea0b
[flutter_tools] Fix encoded stderr in "dart.log" from debug adapter to client (#155249)
To aid debugging, debug adapter (DAP) clients can ask the debug adapters
to send verbose logs back to the client (so they can capture them in a
client-side log along with other things happening on the client).
Included in this log is the `stderr` output of the `flutter run` process
spawned by the debug adapter.

This output was not decoded correctly for these logs, so showed up like:

```
[Flutter] [stderr] [91, 32, 32, 43, 49, 52, 32, 109, 115, 93, 32, 67, 111, 117, 108, 100, 32, 110, 111, 116, 32, 102, 105, 110, 100, 32, 97, 110, 32, 111, 112, 116, 105, 111, 110, 32, 110, 97, 109, 101, 100, 32, 34, 105, 110, 118, 97, 108, 105, 100, 34, 46, 10, 10, 91, 32, 32, 32, 32, 32, 32, 32, 32, 93, 32, 82, 117, 110, 32, 39, 102, 108, 117, 116, 116, 101, 114, 32, 45, 104, 39, 32, 40, 111, 114, 32, 39, 102, 108, 117, 116, 116, 101, 114, 32, 60, 99, 111, 109, 109, 97, 110, 100, 62, 32, 45, 104, 39, 41, 32, 102, 111, 114, 32, 97, 118, 97, 105, 108, 97, 98, 108, 101, 32, 102, 108, 117, 116, 116, 101, 114, 32, 99, 111, 109, 109, 97, 110, 100, 115, 32, 97, 110, 100, 32, 111, 112, 116, 105, 111, 110, 115, 46, 10]
```

This change decodes the output before processing.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5268

## 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/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-09-24 12:30:06 +01:00
Daco Harkes aef2758716
[native assets] Roll dependencies (#155432)
Rolls native deps to the latest version, and cleans up deprecated field from template.

Tests:

* All the unit and integration tests for native assets. The template and dependencies are exercised in the integration test.

Since `package:native_assets_builder` already checks for having no static libraries as output, the custom check in flutter_tools is removed. The tests stubbing out the native assets builder exercising the custom check are also removed. (The integration tests now check for the error message from the native assets builder.)
2024-09-24 07:19:09 +00:00
Kostia Sokolovskyi 96ba3c555a
Add WidgetStateProperty example and tests for it. (#155315)
This PR contributes to https://github.com/flutter/flutter/issues/155313

### Description
- Adds example for `WidgetStateProperty`
- Adds tests for `examples/api/lib/widgets/widget_state/widget_state_property.0.dart`
2024-09-24 00:31:07 +00:00
Jenn Magder 8a07265a88
Assert macOS framework artifact contains xcprivacy manifest (#155189)
Add tool test to validate a built macOS app contains the FlutterMacOS framework xcprivacy manifest.

Blocked on https://github.com/flutter/engine/pull/55078 rolling in.
2024-09-23 17:12:31 +00:00
Taha Tesser d5e843eca3
Fix missing icon props in button styleFrom methods (#154821)
Fixes [Add missing icon props in button `styleFrom`  methods.](https://github.com/flutter/flutter/issues/154798)

### Description

Add missing icon propers in the following widgets:

- `ElevatedButton.styleFrom` (missing `iconSize`)
- `FilledButton.styleFrom` (missing `iconSize`)
- `OutlinedButton.styleFrom` (missing `iconSize`)
- `TextButton.styleFrom` (missing `iconSize`)
- `MenuItemButton.styleFrom` (missing `iconSize` and `disabledIconColor`)
- `SubmenuButton.styleFrom` (missing `iconSize` and `disabledIconColor`)
- `SegmentedButton.styleFrom` (missing `iconSize`, `iconColor`, and `disabledIconColor`)

### Code sample

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

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

enum Calendar { day, week, month, year }

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

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

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

class _MyAppState extends State<MyApp> {
  Calendar calendarView = Calendar.week;
  bool isEnabled = true;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: Column(
            spacing: 10.0,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              ElevatedButton.icon(
                style: ElevatedButton.styleFrom(
                  iconSize: 30,
                  iconColor: Colors.red,
                  disabledIconColor: Colors.red.withValues(alpha: 0.5),
                ),
                onPressed: isEnabled ? () {} : null,
                icon: const Icon(Icons.add),
                label: const Text('ElevatedButton'),
              ),
              FilledButton.icon(
                style: ElevatedButton.styleFrom(
                  iconSize: 30,
                  iconColor: Colors.red,
                  disabledIconColor: Colors.red.withValues(alpha: 0.5),
                ),
                onPressed: isEnabled ? () {} : null,
                icon: const Icon(Icons.add),
                label: const Text('FilledButton'),
              ),
              FilledButton.tonalIcon(
                style: ElevatedButton.styleFrom(
                  iconSize: 30,
                  iconColor: Colors.red,
                  disabledIconColor: Colors.red.withValues(alpha: 0.5),
                ),
                onPressed: isEnabled ? () {} : null,
                icon: const Icon(Icons.add),
                label: const Text('Add'),
              ),
              OutlinedButton.icon(
                style: ElevatedButton.styleFrom(
                  iconSize: 30,
                  iconColor: Colors.red,
                  disabledIconColor: Colors.red.withValues(alpha: 0.5),
                ),
                onPressed: isEnabled ? () {} : null,
                icon: const Icon(Icons.add),
                label: const Text('OutlinedButton'),
              ),
              TextButton.icon(
                style: ElevatedButton.styleFrom(
                  iconSize: 30,
                  iconColor: Colors.red,
                  disabledIconColor: Colors.red.withValues(alpha: 0.5),
                ),
                onPressed: isEnabled ? () {} : null,
                icon: const Icon(Icons.add),
                label: const Text('TextButton'),
              ),
              SizedBox(
                width: 200,
                child: MenuItemButton(
                  style: MenuItemButton.styleFrom(
                    iconSize: 30,
                    iconColor: Colors.red,
                    disabledIconColor: Colors.red.withValues(alpha: 0.5),
                  ),
                  trailingIcon: const Icon(Icons.arrow_forward_ios),
                  onPressed: isEnabled ? () {} : null,
                  child: const Text('MenuItemButton'),
                ),
              ),
              SizedBox(
                width: 200,
                child: SubmenuButton(
                  style: SubmenuButton.styleFrom(
                    iconSize: 30,
                    iconColor: Colors.red,
                    disabledIconColor: Colors.red.withValues(alpha: 0.5),
                  ),
                  trailingIcon: const Icon(Icons.arrow_forward_ios),
                  menuChildren: <Widget>[
                    if (isEnabled) const Text('Item'),
                  ],
                  child: const Text('SubmenuButton'),
                ),
              ),
              SegmentedButton<Calendar>(
                style: SegmentedButton.styleFrom(
                  iconColor: Colors.red,
                  iconSize: 30,
                  disabledIconColor: Colors.red.withValues(alpha: 0.5),
                ),
                segments: const <ButtonSegment<Calendar>>[
                  ButtonSegment<Calendar>(
                      value: Calendar.day,
                      label: Text('Day'),
                      icon: Icon(Icons.calendar_view_day)),
                  ButtonSegment<Calendar>(
                      value: Calendar.week,
                      label: Text('Week'),
                      icon: Icon(Icons.calendar_view_week)),
                  ButtonSegment<Calendar>(
                      value: Calendar.month,
                      label: Text('Month'),
                      icon: Icon(Icons.calendar_view_month)),
                  ButtonSegment<Calendar>(
                      value: Calendar.year,
                      label: Text('Year'),
                      icon: Icon(Icons.calendar_today)),
                ],
                selected: <Calendar>{calendarView},
                onSelectionChanged:
                    isEnabled ? (Set<Calendar> newSelection) {} : null,
              )
            ],
          ),
        ),
        floatingActionButton: FloatingActionButton.extended(
          onPressed: () {
            setState(() {
              isEnabled = !isEnabled;
            });
          },
          label: Text(isEnabled ? 'Enabled' : 'Disabled'),
        ),
      ),
    );
  }
}
```

</details>

### Preview (Customized using icon props in `styleFrom`  methods)

<img width="838" alt="Screenshot 2024-09-09 at 16 27 19" src="https://github.com/user-attachments/assets/551d328b-307f-4f63-b0e8-1358a12877f9">
2024-09-18 00:19:40 +00:00
Tong Mu c57f99e419
[CupertinoAlertDialog] Add tap-slide gesture (#154853)
This PR adds "sliding tap" to `CupertinoAlertDialog` and fixes https://github.com/flutter/flutter/issues/19786. 

Much of the needed infrastructure has been implemented in https://github.com/flutter/flutter/pull/150219, but this time with a new challenge to support disabled buttons, i.e. the button should not show tap highlight when pressed (https://github.com/flutter/flutter/issues/107371).
* Why? Because whether a button is disabled is assigned to `CupertinoDialogAction`, while the background is rendered by a private class that wraps the action widget and built by the dialog body. We need a way to pass the boolean "enabled" from the child to the parent when the action is pressed. After much experimentation, I think the best way is to propagate this boolean using the custom gesture callback.
* An alternative way is to make the wrapper widget use an inherited widget, which allows the child `CupertinoDialogAction` to place a `ValueGetter<bool> getEnabled` to the parent as soon as it's mounted. However, this is pretty ugly...

This PR also fixes https://github.com/flutter/flutter/issues/107371, i.e. disabled `CupertinoDialogAction` no longer triggers the pressing highlight. However, while legacy buttons (custom button classes that are implemented by `GestureDetector.onTap`) still functions (their `onPressed` continues to work), disabled legacy buttons will still show pressing highlight, and there's no plan (actually, no way) to fix it. 

All tests related to sliding taps in `CupertinoActionSheet` has been copied to `CupertinoAlertDialog`, with additional tests for disabled buttons.
2024-09-17 20:16:18 +00:00
zijiehe@ a4f45471bc
Delete packages/flutter_tools/lib/src/fuchsia directory (#154880)
It's not being actively used, and fuchsia team does not have bandwidth
to maintain it.

Bug: https://b.corp.google.com/issues/353729557

## 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/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-09-17 09:10:02 -07:00
gaaclarke 1db9a61348
Adds ColorSwatch matcher (#155272)
https://github.com/flutter/flutter/issues/155113

## 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/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-09-17 09:08:22 -07:00
gaaclarke af21d9f5b3
Added .keys to ColorSwatch (#155262)
This addresses the issue that ColorSwatch has operator[], but no way to know what are valid inputs.

issue: https://github.com/flutter/flutter/issues/155113
2024-09-16 21:20:32 +00:00
Tess Strickland c50b3fea32
Extend 'flutter symbolize' to handle deferred loading units. (#149315)
Adds `-u`/`--unit-id-debug-info` arguments to `flutter symbolize` to pass paths to DWARF information for deferred loading units. The argument passed via `-u` should be of the form `N:P`, where `N` is the loading unit ID (an integer) and `P` is the path to the debug information for loading unit `N`. The DWARF information for the root loading unit can either be passed by `-d`/`--debug-info` as before or by `--unit-id-debug-info 1:<path>`.

Partial fix for https://github.com/flutter/flutter/issues/137527. Additional work is needed to adjust tools built on top of `flutter symbolize` to store and pass along this additional information appropriately when there are deferred loading units.
2024-09-16 17:55:05 +00:00
Christopher Fujino b565379812
Catch unable to start app exception (#154970)
Fixes https://github.com/flutter/flutter/issues/153433
2024-09-16 17:32:49 +00:00
Jenn Magder 0a400f8cd8
Assert iOS framework artifact contains xcprivacy manifest (#155187)
Add tool test to validate a built iOS app contains the Flutter framework xcprivacy manifest.

Follow up to https://github.com/flutter/engine/pull/48951.
2024-09-16 13:13:30 +00:00
Kishan Rathore bbc17fae3a
Fix: Flicker when reorderable list doesn't change its position (#151026)
Fix: Flicker when no update in index of dragged item

Resolves #150843

This PR ensures that even if we move dragged item anywhere in list and comeback to initial position, we smoothly adjust to that position.
2024-09-13 16:58:00 +00:00
Sigurd Meldgaard 2812d4685c
Stop reading .packages from flutter_tools. (#154912) 2024-09-13 13:53:05 +02:00
Bruno Leroux 2277e05550
Fix TextField content should be selected on desktop when gaining focus (#154916)
## Description

This PR fixes the default selection on desktop when a text field is gaining focus.

Before this PR, when a text field is focused, the selection was collapsed at the end for all platforms except on Web where the entire content was selected.

After this PR, when a text field is focused, the entire content is selected on desktop and Web, and the selection is collapsed at the end on mobile platforms.

The implementation extends the work done in https://github.com/flutter/flutter/pull/119583 which implemented this feature for web.

## Related Issue

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

## Tests

Updates 1 test.
Fixes 2 tests.
2024-09-13 08:09:13 +00:00
LongCatIsLooong f513a69838
Mark _LayoutBuilderElement as always clean (#154694)
Fixes https://github.com/flutter/flutter/issues/154060

The error message doesn't make sense to me since one can call `setState` during the idle phase, and I'm not sure what this is guarding against without the right error message.

In the case of #154060 the layout builder was never laid out:
```
├─child 1: _RenderLayoutBuilder#7c319 NEEDS-LAYOUT NEEDS-PAINT
│   creator: LayoutBuilder ← _BodyBuilder ← MediaQuery ←
│     LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ←
│     _ActionsScope ← Actions ← AnimatedBuilder ← DefaultTextStyle ←
│     AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#1f6eb ink
│     renderer] ← NotificationListener<LayoutChangedNotification> ← ⋯
│   parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body
│   constraints: MISSING
│   size: MISSING
```
So https://github.com/flutter/flutter/pull/154681 doesn't really fix #154060 since the layout callback cannot be run without a set of valid constraints. 

Before the `BuildScope` change all `_inDirtyList` flags were unset after the `BuildOwner` finishes rebuilding the widget tree, so `LayoutBuilder._inDirtyLst` is always set to false after a frame even for layout builders that were never laid out.
With the `BuildScope` change, `LayoutBuilder` has its own `BuildScope` which is only flushed after LayoutBuilder gets its constraints.
2024-09-13 01:24:11 +00:00
zijiehe@ fc9220c981
Disable fuchsia in flutter_tools (#155111)
This change disables fuchsia in flutter_tools, most of the fuchsia logic becomes no-op, so the test cases need to be removed altogether.

This change needs to go first to avoid breaking dependencies.

Bug: b/353729557
2024-09-12 23:40:06 +00:00
John McDole b755641559
Address frame policy benchmark flakes (#155130)
Recently the microbenchmarks were flakey, but from an older bug. Turns out, `LiveTestWidgetsFlutterBindingFramePolicy` is defaulted to `fadePointers` with this fun note:

> This can result in additional frames being pumped beyond those that
the test itself requests, which can cause differences in behavior

Both `text_intrinsic_bench` and `build_bench` use a similar pattern:
* Load stocks app
* Open the menu
* Switch to `benchmark` frame policy

What happens, rarely, is that
`LiveTestWidgetsFlutterBinding.pumpBenchmark()` will call (async) `handleBeginFrame` and `handleDrawFrame`. `handleDrawFrame` juggles a tri-state boolean (null, false, true). This boolean is only reset to `null` when handleDrawFrame is called back to back, say, from an extra frame that was scheduled.

1. Switch tri-state boolean to an enum, its easier to read
2. remove asserts that compile away in benchmarks (`--profile`)
3. use `Error.throwWithStackTrace` to keep stack traces.

I've been running this test on device lab hardware for hundreds of runs and have not hit a failure yet.

Fixes #150542
Fixes #150543 - throw stack!
2024-09-12 23:19:15 +00:00
LongCatIsLooong dbb588b6e8
Prevent the keyboard from reshowing on iOS (#154584)
Fixes https://github.com/flutter/flutter/issues/154156

Some iOS keyboard implementations change the selection in the text field if dismissed with active composing regions. The framework should not call `requestKeyboard` in such cases since that would bring up the keyboard again. 
In general the `TextInput.show` call is not needed for selection only changes. For working around https://github.com/flutter/flutter/issues/68571 the show call is needed only if we restarted the input on Android (and we don't restart on selection-only changes any way).
2024-09-12 21:29:13 +00:00
Kristen McWilliam ea3c3e719e
fix(Linux): specify application id (#154522)
This change sets the program name to the application ID, which helps various
systems like GTK and desktop environments map this running application to its
corresponding .desktop file. This ensures better integration by allowing the
application to be recognized beyond its binary name.

Notably, this is necessary on Wayland to map the running application window to
the desktop file, and therefore apply the correct icon.

I've tested that this works in both GNOME & KDE Wayland sessions.

Partially addresses https://github.com/flutter/flutter/issues/53229

Resolves https://github.com/flutter/flutter/issues/154521

## Icon Association

### Task switcher

The task switcher shows the application's icon in the bottom-middle. Before it only showed a generic Wayland icon.

| Before 	| After 	|
|--------	|-------	|
| ![before1](https://github.com/user-attachments/assets/6f9392f3-c6ff-4ea4-b71b-7186949e2afd) |![after1](https://github.com/user-attachments/assets/e70d394a-a880-42c9-8409-6b975fb59ce1) |

### Window Decorations

KDE shows the application's icon on the window decorations, at the top-left.  Before it only showed a generic Wayland icon.

| Before 	| After 	|
|--------	|-------	|
| ![before2](https://github.com/user-attachments/assets/8076ccf8-79c7-4a60-b12b-2fe1ccf9c393) | ![after2](https://github.com/user-attachments/assets/7a96def2-030c-45c4-9c3f-403256b5da07) |
2024-09-12 20:52:50 +00:00
Gray Mackall 303f222e17
Manual roll to 48ddaf578fb0c8326d5b4b680b0f49ea72e33216 (#155070)
Manual roll, because https://github.com/flutter/engine/pull/55095 updates dependencies, and so it needs gradle lockfiles re generated.
2024-09-12 17:58:12 +00:00
Andrew Kolos d8f8613a5b
when setting up the log reader for a device during flutter run, discard any RPCError thrown due to the device being disconnected (#155049)
Fixes https://github.com/flutter/flutter/issues/154903

This PR contains some refactoring. To make the actual change easier to figure out, I've tried to separate parts of the change into multiple commits for easier reviewing 🙂.

**I plan on cherry-picking this change to stable.**
2024-09-12 15:42:15 +00:00