23717 Commits

Author SHA1 Message Date
Taha Tesser
48ecec16ee
Introduce double Flex.spacing parameter for Row/Column spacing (#152472)
fixes [add spacing parameter to Column and Row](https://github.com/flutter/flutter/issues/55378)

### `Column.spacing` 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(
        backgroundColor: Colors.black,
        body: Center(
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: DecoratedBox(
              decoration: BoxDecoration(
                  border: Border.all(
                color: Colors.amber,
              )),
              child: const Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  Column(
                    spacing: 40.0,
                    // ignore: avoid_redundant_argument_values
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Column(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Column(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Column(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Column(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Column(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
```

</details>

### Preview

<img width="1072" alt="Screenshot 2024-07-30 at 15 40 59" src="https://github.com/user-attachments/assets/14f21091-9e46-4a58-8552-1379f4ba9216">

### `Row.spacing` 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(
        backgroundColor: Colors.black,
        body: Center(
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: DecoratedBox(
              decoration: BoxDecoration(
                  border: Border.all(
                color: Colors.amber,
              )),
              child: const Column(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  Row(
                    spacing: 40.0,
                    // ignore: avoid_redundant_argument_values
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerRight,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Row(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerRight,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Row(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerRight,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Row(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerRight,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Row(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerRight,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Row(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}

```

</details>

### Preview

<img width="1072" alt="Screenshot 2024-07-30 at 15 39 42" src="https://github.com/user-attachments/assets/717e9f5e-a491-4853-ba74-e72ec7493363">
2024-08-05 16:52:58 +00:00
Mohellebi abdessalem
0e720e84a4
reduce warnings inside flutter.groovy file (#152073)
In the context of [issue #146036](https://github.com/flutter/flutter/issues/146036), the flutter.groovy file, considering [issue #147122](https://github.com/flutter/flutter/issues/147122), currently has only two of the buildDir instances replaced. The other two instances have issues that require more investigation.
2024-08-05 13:56:14 +00:00
Victor Sanni
6b73de27bd
Improve CupertinoRadio fidelity (#149703)
Adds the following:

*  Darkens when pressed in light mode
*  Lightens when pressed in dark mode.
* Tests that confirm `CupertinoRadio` is focusable and has correct focus
colors
* Tests that confirm `CupertinoRadio` uses correct default
active/inactive/fill colors
* Same look in disabled vs. enabled states as native macOS:

| Native macOS | Flutter Before | Flutter After | 
--- | --- | --- |
| <img width="50" alt="radio native"
src="https://github.com/flutter/flutter/assets/77553258/27c8c27e-f0dc-4ad7-a8c2-361ae8b437bb">
| <img width="50" alt="flutter radio before"
src="https://github.com/flutter/flutter/assets/77553258/580d9c4b-0f0d-457e-851f-73450738ee16">
| <img width="50" alt="flutter radio after"
src="https://github.com/flutter/flutter/assets/77553258/da6ae21b-87f8-45d8-a2d2-da70ff4853a1">
|

* Same look of an unselected radio button in dark mode as native macOS:

| Native light mode | Flutter before light mode | Flutter after light
mode | Native dark mode | Flutter before dark mode | Flutter after dark
mode
--- | --- | --- | --- | --- | --- |
| <img width="23" alt="native radio light"
src="https://github.com/flutter/flutter/assets/77553258/b52fc18b-e10d-4205-b10b-1536fbbf1ca0">
| <img width="23" alt="flutter radio after light"
src="https://github.com/flutter/flutter/assets/77553258/54294523-8254-479c-b668-77927a8295f1">
| <img width="23" alt="flutter radio light"
src="https://github.com/flutter/flutter/assets/77553258/8472deee-e5ce-4d39-9207-d788ad7f34f4">
| <img width="23" alt="native radio dark"
src="https://github.com/flutter/flutter/assets/77553258/44143099-6ab4-4fb8-8a94-ebb1386022c9">
| <img width="23" alt="flutter radio before dark"
src="https://github.com/flutter/flutter/assets/77553258/3411d9fb-fc7f-4b20-86a5-34fda167d5b9">
| <img width="23" alt="flutter radio dark"
src="https://github.com/flutter/flutter/assets/77553258/39ea3649-142e-43ad-9681-24e1216e0987">
|

## Light mode (with focus highlight)
| Native light mode | Flutter before light mode | Flutter after light
mode |
--- | --- | --- | 
| <img width="70" alt="native radio light mode"
src="https://github.com/user-attachments/assets/914b9f1f-5819-4c5b-8739-8498a72b337f">
| <img width="70" alt="radio flutter focus before"
src="https://github.com/user-attachments/assets/3129fca3-3310-4b2b-bcf3-98aa8f049911">
| <img width="70" alt="radio flutter focus after"
src="https://github.com/user-attachments/assets/7a2089d9-b2b5-4ff0-9db9-444455301146">
|

## Dark mode
| Native dark mode | Flutter before dark mode | Flutter after dark mode
|
--- | --- | --- | 
| <img width="70" alt="native radio dark mode"
src="https://github.com/user-attachments/assets/4da3c055-ce89-4f37-8fcd-d4cbbc4031a0">
| <img width="70" alt="flutter before radio dark mode"
src="https://github.com/user-attachments/assets/36b5f36a-f1d9-4c32-8493-3533a749cf5d">
| <img width="70" alt="flutter radio dark mode after"
src="https://github.com/user-attachments/assets/28828e01-bb2f-4217-9756-2766be3919a6">
|

## Disabled light mode
| Native | Flutter before | Flutter after | 
--- | --- | --- | 
| <img width="120" alt="light disabled radio native"
src="https://github.com/user-attachments/assets/bf6d2561-5dcf-4882-afac-6b639fa949b0">
| <img width="120" alt="Screenshot 2024-07-30 at 3 13 30 PM"
src="https://github.com/user-attachments/assets/3efc978c-fa58-44e8-877a-ea29778ea384">
| <img width="120" alt="light disabled radio flutter after"
src="https://github.com/user-attachments/assets/b2c2e30a-cb8d-40d0-aa6f-75a98caa4829">
|

## Disabled dark mode
| Native | Flutter before | Flutter after | 
--- | --- | --- | 
| <img width="120" alt="dark disabled radio native"
src="https://github.com/user-attachments/assets/feedccc7-9802-4b0c-8038-c9eb771b0eb0">
| <img width="120" alt="Screenshot 2024-07-30 at 3 13 30 PM"
src="https://github.com/user-attachments/assets/6d2f03f7-7216-4850-8c4f-f79ae05bb9da">
| <img width="136" alt="dark disabled radio flutter after"
src="https://github.com/user-attachments/assets/5e03d4fc-4b8e-4518-b429-6bb58f6d988d">
|

`CupertinoRadio` is missing a tristate/mixed state, but [Apple's latest
HIG specs discourages its
use](https://developer.apple.com/design/human-interface-guidelines/toggles#Radio-buttons).

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

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

---------

Co-authored-by: Kate Lovett <katelovett@google.com>
2024-08-02 18:32:17 -07:00
Greg Spencer
51ed348f3b
Fix handling of iconSize and iconColor defaults for ButtonStyleButton subclasses. (#143501)
## Description

Adds defaults that use tokens to define default `iconSize` and `iconColor` values. Previously, the Material 3 token values for button icon sizes and colors were not being used as defaults when the `ButtonStyleButton.defaultStyleOf` function returned the default values.

Adds tests to make sure appropriate `ButtonStyle` fields are populated when defaultStyle is called on buttons.

Updated documentation for `defaultStyleOf` to indicated that not _all_ fields need to be non-null, since some fields make sense to be null (e.g. `fixedSize`) because they would otherwise override the behavior of other fields in the same `ButtonStyle`.

## Tests
 - Added tests to make sure that the appropriate fields are non-null in the default button styles for each type of button.
2024-08-02 23:31:07 +00:00
Greg Price
1dcc1b1876
Write more on Animation and related docs (#150727)
A few days ago I started reading up on how animations work, in
preparation for starting to use them in a more complex way than
I'd done before.  I found it a bit difficult to get my head around;
in particular the many different classes involved, how they relate
to each other, and how to fit them together.

So once I had worked that out, I sat down to express it in the form
of documentation.

The largest change here is an expansion of the docs on [Animation]
itself, including a new section "Using animations" with several
paragraphs laying out how one typically fits together
AnimationController, TickerProvider, CurvedAnimation and/or Tween,
and AnimatedWidget subclasses.  [Animation] also gets an expanded
"See also" list, a revised conceptual intro, and a new summary line.

There are also revisions on [TickerProvider], [AnimatedController],
and elsewhere; some new exposition, some revisions for clarity, and
various small fixes.
2024-08-02 21:46:17 +00:00
Tirth
d6e4555494
Quick Grammar Fixes (#152744)
Quick Grammar Fixes
2024-08-02 21:16:24 +00:00
Anurag Roy
419f0230c4
[SliderTheme] Fix markdown links for api doc images (#152748)
Fixes incorrect syntax of image links for the api documentation of the following classes:

- [RectangularSliderTrackShape](https://main-api.flutter.dev/flutter/material/RectangularSliderTrackShape-class.html)
- [RoundedRectSliderTrackShape](https://main-api.flutter.dev/flutter/material/RoundedRectSliderTrackShape-class.html)
- [RectangularRangeSliderTrackShape](https://main-api.flutter.dev/flutter/material/RectangularRangeSliderTrackShape-class.html)
- [RoundedRectRangeSliderTrackShape](https://main-api.flutter.dev/flutter/material/RoundedRectRangeSliderTrackShape-class.html)
- [RoundSliderTickMarkShape](https://main-api.flutter.dev/flutter/material/RoundSliderTickMarkShape-class.html)
- [RoundRangeSliderTickMarkShape](https://main-api.flutter.dev/flutter/material/RoundRangeSliderTickMarkShape-class.html)
- [RoundSliderThumbShape](https://main-api.flutter.dev/flutter/material/RoundSliderThumbShape-class.html)
- [RoundRangeSliderThumbShape](https://main-api.flutter.dev/flutter/material/RoundRangeSliderThumbShape-class.html)
- [RectangularSliderValueIndicatorShape](https://main-api.flutter.dev/flutter/material/RectangularSliderValueIndicatorShape-class.html)
- [RectangularRangeSliderValueIndicatorShape](https://main-api.flutter.dev/flutter/material/RectangularRangeSliderValueIndicatorShape-class.html)
- [PaddleSliderValueIndicatorShape](https://main-api.flutter.dev/flutter/material/PaddleSliderValueIndicatorShape-class.html)
- [PaddleRangeSliderValueIndicatorShape](https://main-api.flutter.dev/flutter/material/PaddleRangeSliderValueIndicatorShape-class.html)
2024-08-02 20:44:23 +00:00
Juanjo Tugores
af834eed23
Make the App's title optional on web (#152003)
Title (in web) results in updating the [title element][1] which is  a global property. This is problematic in embedded and multiview modes as title should be managed by host apps. This PR makes the title optional, hence if not provided it won't result in the website title being updated.
2024-08-02 20:00:43 +00:00
Sam Rawlins
5c5b3c5796
Ignore both unused_element and unused_element_parameter (#152689)
Work towards https://dart-review.googlesource.com/c/sdk/+/378500
2024-08-02 19:39:03 +00:00
Justin McCandless
4b74c1a8a6
Explain that predictive back doesn't work with WillPopScope (#152116)
Clearly explains that WillPopScope will break predictive back support.

Came up in https://github.com/flutter/flutter/pull/152057#pullrequestreview-2191560087.
2024-08-01 21:33:16 +00:00
Justin McCandless
67a958568e
SearchBar.scrollPadding (#152635)
Pass through the missing scrollPadding parameter for SearchBar and SearchAnchor.bar.
2024-08-01 13:56:04 -07:00
Justin McCandless
e08b0a56f9
Quick docs grammar fixes (#152700)
Yes I spent my precious time on this.
2024-08-01 20:29:58 +00:00
Sam Rawlins
7777d67a66
Remove one set of parens that wrap a single String literal (#152031)
In order to address https://github.com/dart-lang/linter/issues/4354, we are reporting a few more cases in unnecessary_parenthesis. `('text') * 2` is one such case. This change is being made in https://dart-review.googlesource.com/c/sdk/+/376540. (These are the only newly-reported unnecessary parentheses for this change.)
2024-08-01 19:13:13 +00:00
Ben Konyi
d55a0b38e3
Fix bad pattern matching in DDS exception parsing (#152685)
Nullable types for values in map patterns require the key to be present.
Since the 'uri' key is not always present in DDS exception responses,
this was causing us to fall back to throwing a StateError.

Fixes https://github.com/flutter/flutter/issues/152684
2024-08-01 14:38:22 -04:00
Tong Mu
5edec61f0e
[CupertinoActionSheet & AlertDialog] Improve documentation and type for scrollController parameters (#152647)
This PR:
* Improves doc for `scrollController` parameters, replacing the unclear "typically unneeded" with better reasons.
* Makes `scrollController` non-nullable on private classes, since they're always provided by their parents.
* Remove a redundant parameter from a private class.
2024-08-01 17:46:40 +00:00
Matan Lurey
4ff9462be8
Fix local testing, gradle XML errors, and enable on CI. (#152383)
TIL you cannot have XML comments before the initial `<?xml` declaration.

Follow-up to https://github.com/flutter/flutter/pull/152326.
2024-08-01 09:10:45 -07:00
Tong Mu
3303973d99
[CupertinoActionSheet] Make _ActionSheetButtonBackground stateless (#152283)
This PR is a refactor that makes `_ActionSheetButtonBackground` widgets no longer record their own `pressed` state, but instead receive this state from their parent. In this way, `_ActionSheetButtonBackground` becomes a stateless widget. The children states are duplicate because the parent has to keep track of the state for rendering dividers.

An obstacle with this change is that `_ActionSheetButtonBackground` needs an object that is persistent across rebuilds to provide to `Metadata.data`. Either it is kept as a stateful widget without any actual states, or it is made stateless and its `Element` as the object. After discussion, the first option is used.

`_ActionSheetSlideTarget` is renamed to `_SlideTarget` since the alert dialog will soon use this class as well.

This refactor shouldn't need additional tests. Still, one test is added for a behavior that I broke during development and found not covered by the unit tests then.
2024-07-31 23:39:25 +00:00
Nate Wilson
788a0e3d2f
Implementing null-aware logic in /packages/flutter/ (#152294)
Hopefully soon, [flutter.dev/go/dart-patterns](https://flutter.dev/go/dart-patterns) will have lots of good feedback; in the meantime, I'll focus refactoring efforts on uncontroversial things :)

Previously, I was under the impression that I could solve issue #143803 with [just 1 PR](https://github.com/flutter/flutter/pull/143804).
It turns out that I had overlooked quite a bit!

<br>

```dart
// before
if (chunkEvents != null) {
  chunkEvents.listen((ImageChunkEvent event) {
      reportImageChunkEvent(event);
    },
  );
}

// after
chunkEvents?.listen(reportImageChunkEvent);
```
2024-07-31 23:35:24 +00:00
Andrew Kolos
535e88b092
Reintroduce verbose logging for hot reload flake (#152639)
Adds some logging to assist with troubleshooting https://github.com/flutter/flutter/issues/152220 (which is a reapperance of flake https://github.com/flutter/flutter/issues/146879) on CI.

TL;DR [the tool sometimes never receives the `IsolateRunnable` event from the vm service after calling `_flutter.runInView`](https://github.com/flutter/flutter/issues/146879#issuecomment-2118629953).
2024-07-31 23:15:17 +00:00
davidhicks980
d62069ff37
[material/menu_anchor.dart] Remove unused early key event listener (#150915)
Removes an unused block of code (I think -- I could be wrong but it does not appear to have any effect).
2024-07-31 22:47:59 +00:00
Victor Sanni
303cbb7cde
Improve CupertinoCheckbox fidelity (#151441)
**NOTE: Previous [PR](https://github.com/flutter/flutter/pull/148804)
was closed because of a bad merge leading to pollution with unrelated
commits.**

This PR improves on the look and feel of `CupertinoCheckbox` to more
closely match native iOS/macOS checkboxes.

Adds the following updates from a native macOS checkbox:
* Fill color of an unchecked checkbox is a linear gradient that goes
from darker at the top to lighter at the bottom in dark mode
* Size of box reduced from 18.0 to 14.0
* Stroke width of check reduced from 2.5 to 2.0
* Border color changed from solid black to gray black in light mode and
a transparent gray in dark mode
* In light mode, checkbox darkens when pressed
* In dark mode, checkbox lightens when pressed
* Default blue color of a checked checkbox is darker in dark mode

### Light Mode

| Native macOS | Flutter Before | Flutter After |
| ----------- | ----------- | ----------- |
| <img width="63" alt="native checkbox"
src="https://github.com/flutter/flutter/assets/77553258/d57d4c78-2e67-49fb-9491-a5acee3782a7">
| <img width="66" alt="Screenshot 2024-06-27 at 10 23 18 AM"
src="https://github.com/flutter/flutter/assets/77553258/31c913ff-d36f-4eb5-b737-3a9117bd7eff">
| <img width="66" alt="Screenshot 2024-06-27 at 10 39 22 AM"
src="https://github.com/flutter/flutter/assets/77553258/ace8ef29-efae-4049-8f78-13fd39851947">
|

### Dark Mode - Checked

| Native macOS | Flutter Before | Flutter After |
| ----------- | ----------- | ----------- |
| <img width="22" alt="native light"
src="https://github.com/user-attachments/assets/fc52d5e1-7ab0-4a5d-b0fa-5b5bee3ed39d">
| <img width="22" alt="flutter before light"
src="https://github.com/user-attachments/assets/16e033a1-d2dd-4fb2-a5a5-f730c5f7cdc7">
| <img width="22" alt="flutter after light"
src="https://github.com/user-attachments/assets/8c0cff99-930e-4f5e-8540-e64294c1b4fa">
|

### Dark Mode - Unchecked
| Native macOS | Flutter Before | Flutter After |
| ----------- | ----------- | ----------- |
| <img width="22" alt="native dark mode"
src="https://github.com/user-attachments/assets/333280a0-85db-4464-9663-03ef7eafc270">
| <img width="22" alt="flutter before dark mode"
src="https://github.com/user-attachments/assets/a46e01ec-0d0b-4bb7-8d08-4b2723424a12">
| <img width="22" alt="flutter dark mode"
src="https://github.com/user-attachments/assets/a70ae4ad-f1ad-4441-a416-350cbdc32679">
|

### Light Mode - Disabled

| Native macOS | Flutter Before | Flutter After |
| --- | --- | --- |
| <img width="121" alt="native disabled checkbox"
src="https://github.com/user-attachments/assets/ed050d14-efec-49dd-82b6-1e7ed7fa99f9">
| <img width="136" alt="flutter b4 disabled checkbox"
src="https://github.com/user-attachments/assets/564918cf-f936-448d-b975-7bf9248bbf35">
| <img width="156" alt="flutter disabled checkbox"
src="https://github.com/user-attachments/assets/82f672a7-12e8-469c-99af-9f94c959df8f">
|

### Dark Mode - Disabled

| Native macOS | Flutter Before | Flutter After |
| --- | --- | --- |
| <img width="110" alt="disabled dark checkbox native"
src="https://github.com/user-attachments/assets/02a43b3f-5619-4b05-9066-2fd43a58c956">
| <img width="136" alt="disabled dark checkbox flutter b4"
src="https://github.com/user-attachments/assets/3a3db322-2002-4808-adc0-b10a7ab42381">
| <img width="140" alt="disabled dark checkbox flutter"
src="https://github.com/user-attachments/assets/cb91955a-8302-4dc7-8050-221fa2a7045f">

Fixes #148719.

Related PR exploring these changes: #147892

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

---------

Co-authored-by: Kate Lovett <katelovett@google.com>
2024-07-31 14:43:20 -07:00
Renzo Olivares
70bda95422
Shift + click gesture support for SelectionArea on desktop platforms (#148574)
Shift + Click to move the selection end edge on desktop platforms. This is consistent with native Linux and Windows. On macOS the behavior moves the selection edge closest to the tapped position (will implement in a later PR).

Part of: #129583
2024-07-31 19:58:07 +00:00
Taha Tesser
0d154e55d1
Add ability to clip Stepper step content (#152370)
fixes [Dismissible content overlays Stepper interface while dismissing it](https://github.com/flutter/flutter/issues/66007)

### 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> {
  final List<String> items =
      List<String>.generate(20, (int i) => 'Item ${i + 1}');

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Padding(
          padding: const EdgeInsets.all(20),
          child: DecoratedBox(
            decoration: BoxDecoration(
              border: Border.all(color: Colors.amber, width: 2),
            ),
            child: Padding(
              padding: const EdgeInsets.all(2.0),
              child: Column(
                children: <Widget>[
                  const SizedBox(height: 8.0),
                  Text(
                    'Dismissible Widget - Vertical Stepper Widget',
                    style: Theme.of(context).textTheme.titleLarge,
                  ),
                  Expanded(
                    child: Stepper(
                      clipBehavior: Clip.hardEdge,
                      steps: <Step>[
                        Step(
                          isActive: true,
                          title: const Text('Step 1'),
                          content: ColoredBox(
                            color: Colors.black12,
                            child: ListView.builder(
                              itemCount: items.length,
                              shrinkWrap: true,
                              itemBuilder: (BuildContext context, int index) {
                                final String item = items[index];
                                return Dismissible(
                                  key: Key(item),
                                  onDismissed: (DismissDirection direction) {
                                    setState(() {
                                      items.removeAt(index);
                                    });
                                    ScaffoldMessenger.of(context).showSnackBar(
                                        SnackBar(
                                            content: Text('$item dismissed')));
                                  },
                                  background: Container(color: Colors.red),
                                  child: ListTile(title: Text(item)),
                                );
                              },
                            ),
                          ),
                        ),
                        const Step(
                          title: Text('Step 2'),
                          content: Text('content'),
                        ),
                      ],
                    ),
                  ),
                  const Divider(height: 1),
                  const SizedBox(height: 8.0),
                  Text(
                    'Dismissible Widget - Horizontal Stepper Widget',
                    style: Theme.of(context).textTheme.titleLarge,
                  ),
                  Expanded(
                    child: Stepper(
                      clipBehavior: Clip.hardEdge,
                      type: StepperType.horizontal,
                      elevation: 0.0,
                      steps: <Step>[
                        Step(
                          isActive: true,
                          title: const Text('Step 1'),
                          content: ColoredBox(
                            color: Colors.black12,
                            child: ListView.builder(
                              itemCount: items.length,
                              shrinkWrap: true,
                              itemBuilder: (BuildContext context, int index) {
                                final String item = items[index];
                                return Dismissible(
                                  key: Key(item),
                                  onDismissed: (DismissDirection direction) {
                                    setState(() {
                                      items.removeAt(index);
                                    });
                                    ScaffoldMessenger.of(context).showSnackBar(
                                        SnackBar(
                                            content: Text('$item dismissed')));
                                  },
                                  background: Container(color: Colors.red),
                                  child: ListTile(title: Text(item)),
                                );
                              },
                            ),
                          ),
                        ),
                        const Step(
                          title: Text('Step 2'),
                          content: Text('content'),
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
```

</details>

### Without `Stepper` step content clipping

![Group 1](https://github.com/user-attachments/assets/1814ad90-8d43-4e03-9f68-7da47e08c718)

### With `Stepper` step content clipping

![Group 2](https://github.com/user-attachments/assets/652ff597-7e9a-4d35-abc2-80d60cee03f4)
2024-07-31 19:58:04 +00:00
Mitchell Goodwin
91a3f69f11
Calendar font factor (#152341)
Increases the max text can be scaled for the date picker in calendar mode and input mode. Previously the max across the whole widget was 1.3. Due to the size of the widget, this was increased as much as possible with different values used in different places. Testing and screenshots where taken on the iPhone SE 3rd generation simulator, set at max font size, which is a value of 3.0. Android has a lower max font scale value of 2.0, and the iPhone SE is about the smallest phone with a lower pixel density ratio.

Fixes internal issues b/316958515 and b/316959677 
Also fixes #61334

Comparison for calendar mode in portrait and landscape:

| Before    | After |
| -------- | ------- |
| <img width="375" alt="Old-SE-Portrait-DayPicker" src="https://github.com/user-attachments/assets/4dd1735f-f4c7-4a0a-b8d3-e5ea84d2ba3c"> | <img width="376" alt="Screenshot 2024-07-25 at 1 25 41 PM" src="https://github.com/user-attachments/assets/a53d7d68-87ef-4b29-9479-36ef22bd6cc9"> |
| <img width="375" alt="Old-SE-Portrait-YearPicker" src="https://github.com/user-attachments/assets/37c2965d-1ec0-429b-aa4d-37396f90cb74"> | <img width="377" alt="Screenshot 2024-07-25 at 1 26 38 PM" src="https://github.com/user-attachments/assets/2a00d90f-d523-4ff5-a1d7-e1bfafb245d3"> |
| <img width="665" alt="Old-SE-Landscape-DayPicker" src="https://github.com/user-attachments/assets/1cc4cd26-d56a-4f35-88b1-1c13fa460c2f"> | <img width="665" alt="Screenshot 2024-07-25 at 1 25 52 PM" src="https://github.com/user-attachments/assets/729ac66c-d6b9-4a2a-8303-b5c9face0f62"> |
| <img width="664" alt="Old-SE-Landscape-YearPicker" src="https://github.com/user-attachments/assets/f00a9ab8-1925-4c33-bfcc-31020b2858b8"> | <img width="666" alt="Screenshot 2024-07-25 at 1 26 47 PM" src="https://github.com/user-attachments/assets/d6116c20-4862-4e07-8ab4-fb8ecb71bfa5"> |

The title text is smaller when the entry mode button is available:
<img width="374" alt="Screenshot 2024-07-25 at 1 24 52 PM" src="https://github.com/user-attachments/assets/83305c11-97d5-4986-bf51-fe0be71f653e">

Adjustments were made to input mode as well, but they are simpler

<img width="372" alt="Screenshot 2024-07-25 at 1 43 39 PM" src="https://github.com/user-attachments/assets/2440cf6f-160f-4689-978e-d0a3df2db102">
<img width="666" alt="Screenshot 2024-07-25 at 1 43 48 PM" src="https://github.com/user-attachments/assets/e8d8dbf3-c7d8-4668-9245-7b5036165e75">

Date range picker was not adjusted with this PR. It still has a max of 1.3.
2024-07-31 19:56:15 +00:00
Ian Hickson
a5609dfa5a
Remove redundant usages of zones in skia_client.dart (#149366)
The SkiaGoldHttpOverrides don't have any effect since we never build our own HttpClient, it's always passed in.

This is part 18 of a broken down version of the #140101 refactor.

This particular change is more risky than other changes in this series. While by inspection and some instrumentation testing I'm reasonably sure that my assumptions here are correct, it would behoove us to make sure Skia Gold testing still works post-commit after this lands. To this end, I've included a change to the "inconsequential" test. It should fail the tests. I recommend we land this _with this failure_ to make sure it also fails post-commit, then immediately flag the image as passing and rerun the relevant shard.
2024-07-31 19:52:08 +00:00
Gray Mackall
a1f03609f7
Set up tests that verify we can build a fresh counter app across our Gradle/AGP/Kotlin support range (#151568)
Sets up tests that verify we can build a fresh counter app across our Gradle/AGP/Kotlin support range.

Post submit only, because the suite takes ~30 minutes to run, and I expect it to be _somewhat_ rare that we break only one of these versions (and therefore it doesn't get caught by existing presubmits).
2024-07-31 19:14:46 +00:00
Aliasgar Vohra
836e794b46
: Animation controller now has ability to repeat animation 'n' no. of times. (#150764)
Right now animation controller does not have any way by which user can repeat animation with specific no. of times. Adding the changes in existing `repeat` method in which users can specific no. of times they want to repeat the animation. If not specified, it would simulate infinitely. [Existing repeat behaviour]

This PR fixes : https://github.com/flutter/flutter/issues/53262
2024-07-31 18:19:56 +00:00
Bruno Leroux
1a8e57f42e
Use decoration hint text as the default value for dropdown button hints (#152474)
## Description

This PR makes `DropdownButtonFormField` hint defaults to the provided inputDecoration hintText.

Because `DropDownButtonFormField` accepts both a `hint` parameter and a `decoration`parameter, one can expect `InputDecoration.hintText` to be valid.

Before this PR, when `InputDecoration.hintText` was specified, it is shown but the vertical position is wrong.
After this PR, when `InputDecoration.hintText` is specified, it is used as the default value for `DropDownButtonFormField.hint` and `DropDownButtonFormField.disabledHint`.

| Before | After |
|--------|--------|
| ![image](https://github.com/user-attachments/assets/a08ff75c-edd4-4e16-9cfa-98ddb349d860) | ![image](https://github.com/user-attachments/assets/55f08bee-8f88-4125-8fae-68e2be724955) |

## Related Issue

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

## Tests

Adds 5 tests.
2024-07-31 11:22:26 +00:00
Bruno Leroux
0c6b600e76
Deprecate invalid InputDecoration.collapsed parameters (#152486)
## Description

This PR is a follow up to https://github.com/flutter/flutter/pull/152165#pullrequestreview-2200072459.
It deprecates two parameters that should not have been added (`floatingLabelBehavior` and `floatingLabelAlignment`) to `InputDecoration.collapsed`. Those parameters are related to the floating label but a collapsed input decoration is not supposed to have labels.

For the dart_fix, I created a new fix file and moved some previous fixes to it.

## Tests

Adds 1 test, updates 1.
2024-07-31 07:59:41 +00:00
David Iglesias
111b4fe6d1
[web] Set COEP:credentialless on flutter run/drive. (#152413)
This PR changes the value of the `COEP` response header from `require-corp` to `credentialless` in the Flutter tool, when running `flutter run`/`drive` for Web projects.

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

Docs:

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

## Issue

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

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

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

### Code sample

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

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(brightness: Brightness.dark, useMaterial3: false),
      home: Scaffold(
        body: Center(
          child: Builder(
            builder: (BuildContext context) {
              return Chip(
                padding: const EdgeInsets.all(16.0),
                avatar: const Icon(Icons.favorite),
                label: const Text('Chip A'),
                onDeleted: () {},
              );
            },
          ),
        ),
      ),
    );
  }
}
```

</details>

### Before

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

### After

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

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

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

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

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

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

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

**Before**:

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

**After**:

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

## Related Issue

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

## Tests

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

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

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

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

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

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

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

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

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

Reviewed By: {chunhtai}

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

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

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

## Pre-launch Checklist

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

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

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

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

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

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

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

Encountered error while building for device.
```

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

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

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

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

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

This updates macOS to do the same thing.

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

This change is split into two commits:

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

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

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

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

<br>

Methods that were updated in this PR:

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

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

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

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

Attempt #2 of #152048

cc: @cbracken
2024-07-26 18:01:41 +00:00