Commit Graph

21347 Commits

Author SHA1 Message Date
Polina Cherkasova
e608a697c6 Upgrade leak_tracker to 7.0.6. (#130346) 2023-07-11 11:19:19 -07:00
Qun Cheng
12acff81c7 DropdownMenu can be expanded to its parent size (#129753)
Fixes #125199

This PR is to add a new property `expandedInsets` so that the `DropdownMenu` can be expandable and has some margins around.

<details><summary>Example: Setting `expandedInsets` to `EdgeInsets.zero`</summary>

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

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

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

  @override
  State<DropdownMenuExample> createState() => _DropdownMenuExampleState();
}

class _DropdownMenuExampleState extends State<DropdownMenuExample> {
  final TextEditingController colorController = TextEditingController();
  ColorLabel? selectedColor;

  @override
  Widget build(BuildContext context) {
    final List<DropdownMenuEntry<ColorLabel>> colorEntries = <DropdownMenuEntry<ColorLabel>>[];
    for (final ColorLabel color in ColorLabel.values) {
      colorEntries.add(
        DropdownMenuEntry<ColorLabel>(value: color, label: color.label, enabled: color.label != 'Grey'),
      );
    }

    return MaterialApp(
      theme: ThemeData(
        useMaterial3: true,
        colorSchemeSeed: Colors.green,
      ),
      home: Scaffold(
        body: Center(
          child: Container(
            width: 500,
            height: 500,
            color: Colors.orange,
            child: DropdownMenu<ColorLabel>(
              expandedInsets: EdgeInsets.zero,
              inputDecorationTheme: const InputDecorationTheme(
                filled: true,
                fillColor: Colors.white,
                border: OutlineInputBorder(),
              ),
              controller: colorController,
              dropdownMenuEntries: colorEntries,
              onSelected: (ColorLabel? color) {
                setState(() {
                  selectedColor = color;
                });
              },
              // expandedInsets: EdgeInsets.only(left: 35.0, right: 20.0, top: 80),
            ),
          ),
        ),
      ),
    );
  }
}

enum ColorLabel {
  blue('Blue', Colors.blue),
  pink('Pink', Colors.pink),
  green('Green', Colors.green),
  yellow('Yellow', Colors.yellow),
  grey('Grey', Colors.grey);

  const ColorLabel(this.label, this.color);
  final String label;
  final Color color;
}
```

<img width="500" alt="Screenshot 2023-06-28 at 11 33 20 PM" src="https://github.com/flutter/flutter/assets/36861262/e703f8a2-6e7c-45a0-86cf-d96da6dc157a">

</details>
2023-07-11 17:08:07 +00:00
Darshan Rander
af2e28230f fix: ExpansionTileTheme.shape assignment in ExpansionTile (#127749)
The ExpansionTile was not following `shape` from ExpansionTileTheme as it was assigning wrong parameter to the tween.

fixes #129785
2023-07-11 08:47:11 +00:00
Ian Hickson
d71bbfb490 Implement preferPaintInterior correctly for _CompoundBorder (#129851) 2023-07-11 06:44:33 +00:00
Tae Hyung Kim
dabd7b3bb5 Throw error on unexpected positional arguments (#130274)
This PR fixes ignoring when random positional arguments added to the
`flutter gen-l10n`.

So we are no longer able to call `flutter gen-l10n hello world` or
`flutter gen-l10n --format false`.

Fixes https://github.com/flutter/flutter/issues/118203
2023-07-10 12:12:23 -07:00
Victoria Ashworth
6c2023162f Change resultBundlePath representation from File to Directory (#130156)
`resultBundlePath` is meant to be a directory. In the `xcodebuild --help`, it describes it as a directory: 
```
-resultBundlePath PATH     specifies the directory where a result bundle describing what occurred will be placed
```

This PR changes our usage of it from a file to a directory so that it gets deleted correctly between reruns.

Fixes https://github.com/flutter/flutter/issues/129954.
2023-07-10 17:47:51 +00:00
Rydmike
b828846fb9 Fix default icon color constants reversed brightness documentation (#130231)
Fixes the reversed default icon color constants brightness documentation for `kDefaultIconLightColor` and `kDefaultIconDarkColor`.

FIX: https://github.com/flutter/flutter/issues/130230
2023-07-10 15:43:00 +00:00
Chuan-Yen Chiang
0cb6a03d92 fix: duplicated Intellij IDE message when running flutter doctor (#129030)
This PR fixes the duplicated message from `flutter doctor` when install `Intellij IDE` from `JetBrains Toolbox`. 

The solution is based on the #98276. Add a function to skip the creation of the validator for `Mac` when the key word `JetBrainsToolboxApp` is in the `info.plist`.

Before: 
<img width="918" alt="Screenshot 2023-06-16 at 21 04 43" src="https://github.com/flutter/flutter/assets/3291319/2f5ef0c6-0d29-4d02-97ed-257f29965a1a">

After: 
<img width="924" alt="Screenshot 2023-06-16 at 21 13 15" src="https://github.com/flutter/flutter/assets/3291319/dcdca845-41a1-4896-a5ac-5bca724af676">

fix #98276
2023-07-08 00:35:53 +00:00
hangyu
b80bbd5500 Add a threshold when comparing screen order for selectables. (#130043)
Add a threshold when comparing screen order for selectables. So when the vertical position diff is within the threshold, will compare the horizontal position.

This fixes https://github.com/flutter/flutter/issues/111021 and https://github.com/flutter/flutter/issues/127942
2023-07-07 22:19:09 +00:00
Alexander Aprelev
3b8f6c4020 Upgrade framework pub dependencies, roll engine with rolled dart sdk (#130163)
Manual roll is needed because incoming dart sdk requires updated version
vm_snapshot_analysis (>=0.7.4).


5ae09b8b4f...7c83ea3e85

```
7c83ea3e85 Reland "Manual roll Dart SDK from 2d98d9e27dae to 0b07debd5862 (21 revisions) (#43457)" (#43472)
9ef3e8d533 Roll Skia from 5eba922297bb to 93c92f97f5ab (2 revisions) (#43471)
```

Remove implementation of SuitePlatform from the test as well. Remove use
of fake cwd from SuitePlatform as it can't be properly faked.
2023-07-07 13:55:35 -07:00
Jesús S Guerrero
acb0855432 Revert "[a11y] CupertinoSwitch On/Off labels" (#130166)
Reverts flutter/flutter#127776
Currently breaking google testing
2023-07-07 20:04:00 +00:00
Polina Cherkasova
ce50828669 Test that inspector does not hold objects. (#130102) 2023-07-07 12:33:08 -07:00
Caique Ribeiro de Oliveira
3f2d798bd6 Fix XCode download link (#129795)
<img width="919" alt="image" src="https://github.com/flutter/flutter/assets/42003129/4bc8c3b8-29af-4b98-9232-47a583523e3c">
I was installing Flutter and noticed that the download link for Xcode is incorrect. They might have changed it, but the current link doesn't exist.
2023-07-07 18:09:57 +00:00
Chris Bobbe
8ab46bbce4 (Raw)Autocomplete: Add optional [optionsViewOpenDirection] param (#129802)
Allows positioning Autocomplete options above the field (previously hardcoded to under the field).
2023-07-07 10:25:35 -07:00
fzyzcjy
61ebf755d7 Tiny one space formatting fix (#130053)
You know, I like to see beautiful code, so really hope we have auto formatter, such that all these (at least such formatting error) can be done automatically!
2023-07-07 17:11:49 +00:00
Victoria Ashworth
6683468f0b Add debugging for iOS startup test flakes (#130099)
Adding debugging for https://github.com/flutter/flutter/issues/129836.

Takes a screenshot when startup test takes too long (10 minutes).

Also, removes some old debugging and add new debugging message.
2023-07-07 16:49:00 +00:00
Hans Muller
d55a7d89e0 Revert "fix a bug when android uses CupertinoPageTransitionsBuilder..." (#130144)
Reverts flutter/flutter#114303

The breaking API change in flutter/flutter#114303 broke internal tests/apps (Google internal link b/290154304) as well as external dependents: https://github.com/flutter/flutter/issues/130062. 

Fixes https://github.com/flutter/flutter/issues/130062
2023-07-07 16:39:08 +00:00
fzyzcjy
bf72b63536 Super tiny code optimization: No need to redundantly check whether value has changed (#130050)
Removed two unnecessary `if` conditions.
2023-07-06 16:30:01 -07:00
Polina Cherkasova
bff6b93683 Next attempt to make inspector weakly referencing the inspected objects. (#129962) 2023-07-06 12:19:18 -07:00
Gil Nobrega
4f6c887751 [a11y] CupertinoSwitch On/Off labels (#127776)
Adds optional visual labels to Cupertino's on/off switch for accessibility.
2023-07-06 11:18:13 -07:00
Henrique Nascimento
eebb1d6ddf Add option for flexible space on material SearchDelegate (#128132)
This pull request introduces the `buildFlexibleSpace` method to the `SearchDelegate` class in the material library. 
It allows users to add a flexible space widget to the `AppBar` in a `_SearchPage`, providing more customization options.

This PR does not fix any specific issue as there are no open issues related to this feature.
2023-07-06 17:52:58 +00:00
luckysmg
e0ad12969f [framework] Add textField OCR support for framework side (#96637)
iOS OCR keyboard input support.
2023-07-06 08:51:06 -07:00
fabiancrx
2f7614a818 [flutter_tools] modify Skeleton template to use ListenableBuilder instead of AnimatedBuilder (#128810)
Replaces AnimatedBuilder for ListenableBuilder in the skeleton template

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

No tests needed
2023-07-06 15:14:51 +00:00
Ian Hickson
bc49cd1bca Allow long-press gestures to continue even if buttons change. (#127877)
Previously, if you changed buttons during a long-press gesture, if it was before the gesture was accepted we would discard it, and if it was after the gesture was accepted we would silently end it without firing any of the relevant events.

This silent cancelation behavior is terrible because it means there's no way for consumers to know what state they're in, so you end up with widgets that thing they're still being long-pressed even though nothing is happening.

We could change the behavior in three ways, as far as I can tell:

- we could send a cancel event when you change buttons. This would introduce a new kind of transition (start->cancel) which I don't think we currently require people to support. This would therefore not fix existing code and would make future code more complicated to handle a really obscure user action that it seems unlikely anyone cares about.

- we could send an end event when you change buttons. This would mean the action commits, even though the user is still holding the mouse button down. This seems slightly better than the previous option but still not ideal as it means nudging the mouse button commits you even though you're still holding the button down.

- we could ignore button changes after the long-press has been accepted.

I implemented the last one in this PR.
2023-07-06 00:42:57 +00:00
Michael Goderbauer
55b6f049a6 Enable unreachable_from_main lint - it is stable now!!1 (#129854)
PLUS: clean-up of all the unreachable stuff.
2023-07-06 00:09:01 +00:00
Snonky
e0a9ad15b9 MergeableMaterial: Fix adding a slice and separating it (#128804) 2023-07-05 16:58:28 -07:00
Hans Muller
14f1e13edb Reland Fix AnimatedList & AnimatedGrid doesn't apply MediaQuery padding #129556 (#129860)
Reland https://github.com/flutter/flutter/pull/129556/ which had failed
an internal test (see Google internal link b/288993600) and was reverted
in https://github.com/flutter/flutter/pull/129645.

This PR must be landed with G3 Fix cl/543755631
2023-07-05 15:41:13 -07:00
pdblasi-google
e1702a96f6 Removes deprecated APIs from v2.6 in binding.dart and widget_tester.dart (#129663)
Removes deprecated APIs from v2.6 in `binding.dart` and `widget_tester.dart`

Resolves #129654
2023-07-05 19:26:24 +00:00
Helin Shiah
0b44577f16 Add new hot reload case string (#130008)
This change is for an internal IDE client to send a custom hot reload
request, as custom requests from the client must start with `$/`.

## 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. (this PR is linked internally)
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.

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
2023-07-05 15:16:33 -04:00
Myles Moylan
ec72610378 Add simple unit tests for annotations.dart file (#128902)
This PR is adding a file of two simple unit tests in order to improve code coverage (covering two simple classes within the annotations.dart file).

The issue this is fixing is the lack of complete test coverage for the annotations.dart file.
2023-07-05 17:21:28 +00:00
ipcjs
aaaea51dd2 fix a bug when android uses CupertinoPageTransitionsBuilder... (#114303)
When android uses iOS style `PageTransitionsBuilder` and iOS uses android style `PageTransitionsBuilder`, on android, swipe from the left edge of the screen doesn't work. This PR solves that problem.

#99919 introduced a breaking change, the pr re-implemented it <del>without introducing a breaking change.**</del>
2023-07-05 16:41:32 +00:00
Piotr FLEURY
168d807734 Add .env file support for option --dart-define-from-file (#128668)
# Proposal

I suggest to make possible to specify .env files to the --dart-define-from-file in addition to the Json format.

# Issue

Close #128667
2023-07-05 16:35:08 +00:00
Pierre-Louis
35085c394d Improve documentation for ColorSheme.fromImageProvider (#129952)
Sample code is added, documentation condensed, and links to guidelines updated.

For b/258360306
2023-07-05 15:47:57 +00:00
Polina Cherkasova
5b12b7467f Cleanup: stop accepting DiagnosticsNode as input from DevTools. (#129302) 2023-07-04 10:12:49 -07:00
Parker Lougheed
63a8298d4b Update links to old linter site to dart.dev (#129866)
Removes the remaining links to the old linter site, to the guaranteed dart.dev/lints redirect.

Contributes to https://github.com/dart-lang/linter/issues/4460 and https://github.com/dart-lang/site-www/issues/4499
2023-07-01 18:36:10 +00:00
Qun Cheng
9249dcc283 Update SwitchTheme tests for M2/M3 (#129811) 2023-06-30 16:29:02 -07:00
Greg Price
1153371a56 Fix NetworkImage causing spurious warning in tests (#129537)
Fixes #129532.

This ensures that when a test properly uses `debugNetworkImageHttpClientProvider` to tell `NetworkImage` to use a fake `HttpClient`, we don't go ahead and try to instantiate `HttpClient` anyway and generate a misleading warning.
2023-06-30 22:25:52 +00:00
Hans Muller
26ad4a4a79 Updated some golden image tests for M2/M3 (#129794)
Updated some of the golden image tests that were temporarily changed in https://github.com/flutter/flutter/pull/128914 to have M2 and M3 versions. 

Updated the linear_gradient_0 example to M3 (which will require updating its golden image as well).

More info in https://github.com/flutter/flutter/issues/127064
2023-06-30 18:09:56 +00:00
Nate Bosch
34c092f2b3 Remove an unnecessary assert (#129796)
The type variable `T`, when used as an expression, will always be a
`Type`. The type test `T is! List` is always true (as is `T is Type`).

This expression will become a warning in the analyzer in some upcoming
release of the Dart SDK.

This `assert` was added in a PR which reapplied an earlier PR, however
the earlier PR did not include this assert. I do not see any discussion
indicating the intent of this assert.

The impact of testing this `T` in any way is low - this is a private
class so we can see all the uses and know that the only type bound to
`T` is `Uri`. Avoid the upcoming diagnostic and remove the assert
entirely. This maintains existing behavior but ignores the potential
intent for the check.
2023-06-30 18:07:54 +00:00
Qun Cheng
1ed54f8ec0 Update Radio tests for M2/M3 (#129814)
Updated unit tests for `Radio` to have M2 and M3 versions.

More info in https://github.com/flutter/flutter/issues/127064
2023-06-30 18:06:25 +00:00
Qun Cheng
0bb9409fd0 Update Switch tests for M2/M3 (#129810)
Updated and reorganized unit tests for `Switch` to have M2 and M3 versions.

More info in https://github.com/flutter/flutter/issues/127064
2023-06-30 18:06:23 +00:00
Qun Cheng
2e4122cc61 Update SwitchListTile tests for M2/M3 (#129809)
Updated and reorganized unit tests for `SwitchListTile` to have M2 and M3 versions.

More info in https://github.com/flutter/flutter/issues/127064
2023-06-30 09:05:48 +00:00
Taha Tesser
7cef966147 Fix NavigationDrawer selected item has wrong icon color (#129625)
fixes [NavigationDrawer selected item has wrong icon color [Material3 spec]](https://github.com/flutter/flutter/issues/129572)

### Description
This PR fixes a mistake in the `NavigationDrawer` defaults, where generated token value returns a `null`. 
This issue can be detected when you want to customize the selected icon color for `NavigationDrawerDestination` using a custom color scheme.

### Code sample

<details> 
<summary>expanded 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,
      themeMode: ThemeMode.light,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue).copyWith(
          onSecondaryContainer: Colors.red,
        ),
        useMaterial3: true,
      ),
      home: const Example(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('NavigationDrawer Sample'),
      ),
      drawer: const NavigationDrawer(
        children: <Widget>[
          NavigationDrawerDestination(
            icon: Icon(Icons.favorite_outline_rounded),
            label: Text('Favorite'),
            selectedIcon: Icon(Icons.favorite_rounded),
          ),
          NavigationDrawerDestination(
            icon: Icon(Icons.favorite_outline_rounded),
            label: Text('Favorite'),
          ),
        ],
      ),
    );
  }
}
``` 
	
</details>

### Before
 
<img width="1053" alt="Screenshot 2023-06-27 at 13 24 38" src="https://github.com/flutter/flutter/assets/48603081/18c13a73-688f-4586-bb60-bddef45d173f">

### After

<img width="1053" alt="Screenshot 2023-06-27 at 13 24 25" src="https://github.com/flutter/flutter/assets/48603081/8a1427c6-517f-424a-b0bd-24bad7c5fbb0">
2023-06-30 08:58:14 +00:00
Bruno Leroux
3a6d661587 Update basic_test.dart for M3 compliance (#129714)
## Description

This PR fixes two test failures in `basic_test.dart` which surfaced when switching to M3 (see https://github.com/flutter/flutter/pull/127501)

Those failures are related to M3 typography which sets line height to 1.43.

Forcing line height to 1.0 seems reasonable for these particular tests. With this change these two test are successful for both M2 and M3.

## Related Issue

fixes https://github.com/flutter/flutter/issues/129713

## Tests

Updates 2 tests.
2023-06-30 08:56:16 +00:00
Qun Cheng
91cb2618c3 Make DropdownMenu be able to scroll to the highlighted item when searching. (#129740)
Fixes #120349

This PR enables `DropdownMenu` to automatically scroll to the first matching item when `enableSearch` is true.

<details><summary>video example</summary>

https://github.com/flutter/flutter/assets/36861262/1a7a956c-c186-44ca-9a52-d94dc21cac8a

</details>
2023-06-30 01:48:05 +00:00
fzyzcjy
92969ba8ca Remove @NonNull to avoid warning (#129472)
Otherwise android studio complains:

> Do not use @NonNull in Kotlin; the nullability is already implied by the Kotlin type MethodCall not ending with ?

![image](https://github.com/flutter/flutter/assets/5236035/0cc2e838-dbf9-409f-8fd8-d4e006f58be6)
2023-06-29 21:34:31 +00:00
Martin Kustermann
7068a2088e Prepare for utf8.encode() to return more precise Uint8List type (#129769)
To avoid analyzer warnings when utf8.encode() will return the more
precise Uint8List type, we use const Utf8Encoder().convert() which
already returns Uint8List

See https://github.com/dart-lang/sdk/issues/52801
2023-06-29 22:44:57 +02:00
Tae Hyung Kim
ff838bca89 Add locale-specific DateTime formatting syntax (#129573)
Based on the [message format
syntax](https://unicode-org.github.io/icu/userguide/format_parse/messages/#examples)
for
[ICU4J](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/MessageFormat.html).
This adds new syntax to the current Flutter messageFormat parser which
should allow developers to add locale-specific date formatting.

## Usage example
```
  "datetimeTest": "Today is {today, date, ::yMd}",
  "@datetimeTest": {
    "placeholders": {
      "today": {
        "description": "The date placeholder",
        "type": "DateTime"
      }
    }
  }
```
compiles to
```
  String datetimeTest(DateTime today) {
    String _temp0 = intl.DateFormat.yMd(localeName).format(today);
    return 'Today is $_temp0';
  }
```

Fixes https://github.com/flutter/flutter/issues/127304.
2023-06-29 09:23:34 -07:00
Taha Tesser
f3a7485b2c Update RadioListTile tests to M3 (#129718)
This updates the `RadioListTile` test which was modified in https://github.com/flutter/flutter/pull/128839

### Description
- Update the layout to the proper order `MaterialApp` -> `Material` -> `RadioListTile`
- Add M3 overlay test. (fixed problem faced in https://github.com/flutter/flutter/pull/128839)
- Separate the M2  overlay test.
2023-06-29 15:55:15 +00:00
Justin McCandless
c7511664e2 RTL InputDecoration fix (#129661)
Fixes InputDecoration (TextField) layout when 1. RTL 2. prefixIcon and 3. left/right contentPadding is asymmetric.
2023-06-28 16:31:51 -07:00