21228 Commits

Author SHA1 Message Date
Justin McCandless
9d882983ff
Autocomplete async examples (#126283)
Added examples clarifying how to fetch Autocomplete options asynchronously.
2023-05-17 09:46:26 -07:00
JellyO1
561169ec67
Expose callback that allows focus traversal customization (#120235)
This PR exposes a requestFocusCallback on `FocusTraversalPolicy` and it's inheritors.

Fixes #83175.
2023-05-17 16:43:50 +00:00
Taha Tesser
160618b103
Add missing Switch.onFocusChange test (#126685) 2023-05-17 08:36:24 -07:00
Ian Hickson
027bb84444
Make SlottedMultiChildRenderObjectWidgetMixin a concrete class (#126108)
This is a proof of concept for renaming SlottedMultiChildRenderObjectWidgetMixin to SlottedMultiChildRenderObjectWidget and making it a concrete class.

I also made SlottedContainerRenderObjectMixin generic instead of being specialized to RenderBox.

I don't think this is something we can easily automigrate, but we may not need to, I don't know how common this is...
2023-05-16 22:28:54 +00:00
Ian Hickson
5235a0f092
Add ScrollMetrics.extentTotal for completeness (#126607)
When implementing scrollbars, I found that it would be useful and idiomatic to be able to do `m.extentInside / m.extentTotal` to get the scrollbar thumb size.
2023-05-16 22:24:03 +00:00
Mitchell Goodwin
678f40cf04
Add checkmark style to CupertinoRadio (#126480)
Fixes: #102813

Adds a checkmark style to the Cupertino Radio. Also allows the Radio.adaptive and RadioListTile.adaptive widgets to control whether they use the checkmark style for their Cupertino widgets or not.

This is how it looks in action:

https://github.com/flutter/flutter/assets/58190796/b409b270-42dd-404a-9350-d2c3e1d7fa4e
2023-05-16 21:54:20 +00:00
Jason Simmons
e24c64d8ee
Fix DataTableThemeData.copyWith handling of dataRowHeight (#126943)
Fixes https://github.com/flutter/flutter/issues/126676
2023-05-16 21:44:24 +00:00
Mushaheed Syed
60751ca519
Fix copyWith method of ActionIconThemeData (#126763)
Fixes copyWith method of ActionIconThemeData, now using blank copyWith on [ActionIconThemeData] object that isn't `const ActionIconThemeData()` returns object with same values.

*List which issues are fixed by this PR.*
Fixes https://github.com/flutter/flutter/issues/126762
2023-05-16 21:38:23 +00:00
Michael Goderbauer
1ca183d55b
Remove outdated comment (#126927)
Follow-up to https://github.com/flutter/flutter/pull/126647#discussion_r1195417860.
2023-05-16 17:39:12 +00:00
yaakovschectman
130944e785
Alert engine upon registering ServiceBinding (#126075)
Send a platform message to the engine when the `ServiceBinding` is
registered. Framework side of
https://github.com/flutter/engine/pull/41733

Addresses https://github.com/flutter/flutter/issues/126033

## 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].
- [ ] 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 `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] 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

---------

Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
2023-05-16 13:37:12 -04:00
Victoria Ashworth
2b3cd7f4d9
Replace rsync when unzipping artifacts on a Mac (#126703)
Instead of using rsync, which has caused errors in the past (https://github.com/flutter/flutter/issues/99785), delete the file/directory/link prior to moving it.

Hopefully should let us stop double zipping the FlutterMacOS.framework in the engine: https://github.com/flutter/engine/pull/41306/files

Part of https://github.com/flutter/flutter/issues/126016.
2023-05-16 16:58:06 +00:00
Jason Simmons
a3b38aa8f3
Update SemanticsUpdateBuilderSpy for the conversion of SemanticsUpdateBuilder into a base class (#126570)
See https://github.com/flutter/flutter/issues/123756
2023-05-16 16:41:11 +00:00
st merlhin
6753a852d0
expose CupertinoDatePicker and CupertinoTimerPicker itemExtent … (#125852)
…property

This PR expose `CupertinoDatePicker` and `CupertinoTimerPicker` `itemExtent` property to allow setting custom one depending on `tMediaQuery.of(context).textScaleFactor`.
Fixes: #125127
2023-05-16 16:30:08 +00:00
Michael Goderbauer
5e1ba701ed
enable no_literal_bool_comparisons lint (#126647) 2023-05-16 16:14:23 +00:00
Taha Tesser
2f5ed33912
Updated the Drawer API doc to link to NavigationDrawer (#126915)
fixes https://github.com/flutter/flutter/issues/124887
2023-05-16 15:45:09 +00:00
Polina Cherkasova
ea5eddb5a9
Upgrade leak_tracker to 5.0.0 (#126367)
Fixes https://github.com/flutter/flutter/issues/126259

Updated pubspec:
345f0bffbf/packages/flutter/pubspec.yaml
2023-05-16 04:39:26 +00:00
Ian Hickson
2919572fb3
Minor documentation fixes (#126609)
Fixes for grammar, tone, and clarity.
2023-05-16 02:01:28 +00:00
Kate Lovett
27caa7fed9
Add ScrollController.onAttach & onDetach, samples/docs on listening/getting scrolling info (#124823)
This PR does a couple of things!

https://user-images.githubusercontent.com/16964204/231897483-416287f9-50ce-468d-a714-2a4bc0f2e011.mov

![Screenshot 2023-04-13 at 3 24 28 PM](https://user-images.githubusercontent.com/16964204/231897497-f5bee17d-43ed-46e5-acd7-e1bd64768274.png)

Fixes #20819 
Fixes #41910 
Fixes #121419

### Adds ScrollController.onAttach and ScrollController.onDetach

This resolves a long held pain point for developers. When using a scroll controller, there is not scroll position until the scrollable widget is built, and almost all methods of notification are only triggered when scrolling happens. Adding these two methods will help developers gain access to the scroll position when it is created. A common workaround for this was using a post frame callback to access controller.position after the first frame, but this is ripe for issues such as having multiple positions attached to the controller, or the scrollable no longer existing after that post frame callback. I think this can also be helpful for folks to debug cases when the scroll controller has multiple positions attached.

In particular, this also resolves this commented case: https://github.com/flutter/flutter/issues/20819#issuecomment-417784218
The isScrollingNotifier is hard for developers to access.

### Docs & samples

I was surprised we did not have samples on scroll notification or scroll controller, so I overhauled it and added a lot of docs on all the different ways to access scrolling information, when it is available and how they differ.
2023-05-15 21:01:06 +00:00
Kate Lovett
76a9f68325
Add more to error message of RestorationScope.of (#126444)
Fixes https://github.com/flutter/flutter/issues/126443
2023-05-15 19:17:11 +00:00
Victoria Ashworth
5d1132561f
Add debugging for Dart VM timeout flake (#126437)
Check what is available in the device's iOS DeviceSupport folder to check if symbols were properly fetched. Also, add some logging to track what status the debugger is in.

Debugging for https://github.com/flutter/flutter/issues/121231.
2023-05-15 17:51:05 +00:00
Andrew Kolos
d3e0e03e2e
rename AssetManifest.bin (#126077)
Fixes #124883. Will require a g3fix.

Renames `AssetManifest.bin` to `AssetManifest.smcbin` (madeup extension for "Standard Message Codec binary").
2023-05-15 15:45:09 +00:00
Tomasz Gucio
99c7e9f088
Add spaces after flow control statements (#126320) 2023-05-15 11:07:30 +02:00
nt4f04uNd
ae82f3cbce
Fix crash from invalid ListWheelViewport assertion (#126539)
Fixes https://github.com/flutter/flutter/issues/126491
2023-05-13 04:08:05 +00:00
stuartmorgan
aa230140e7
Add namespace to Android plugin templates (#126354)
Adds the `namespace` property necessary for AGP 8 compatibility to the plugin templates, with the conditional logic to ensure that it doesn't break AGP <4.2, so that new plugins will be maximally compatible.

Part of https://github.com/flutter/flutter/issues/125181
2023-05-12 22:16:06 +00:00
Taha Tesser
96dae5e1e3
Fix focus behavior and provided thumb and focus color aren't applied to Cupertino variant of Switch.adaptive (#126688)
fixes https://github.com/flutter/flutter/issues/126637
fixes https://github.com/flutter/flutter/issues/126669

##  ~~To be merged after https://github.com/flutter/flutter/pull/126684~~

### Description

1.  Fix the Cupertino variant of `Switch.adaptive` requires two tab key presses to focus.
2.  Fix `thumbColor` & `focusColor` aren't applied.

### Before
Requires two tab presses to focus. and `thumbColor` & `focusColor` aren't applied.

https://github.com/flutter/flutter/assets/48603081/24635551-0794-443f-8320-32fdaa5de57a

### After
Single tab key to focus (no additional focus node) and `thumbColor` & `focusColor` are applied.

https://github.com/flutter/flutter/assets/48603081/9bf42fd8-c7e0-475a-b933-192a94650b0c
2023-05-12 18:48:10 +00:00
杨加康
482d567128
[Docs] Fix Typo (#126660) 2023-05-12 11:08:59 -07:00
Taha Tesser
b9e3aef239
Add FocusNode, onFocusChange, and autofocus to CupertinoSwitch (#126684)
fixes https://github.com/flutter/flutter/issues/126679 

### Description
Control cupertino widgets like `CupertinoCheckbox` and `CupertinoRadio` have `focusNode` and `autofocus`, while these are missing in `CupertinoSwitch`.

This is blocking https://github.com/flutter/flutter/issues/126637 
(`switch.dart` currently maintains its focus node for `CupertinoSwitch` when using `Switch.adaptive` which causes a bug)
2023-05-12 17:12:20 +00:00
Justin McCandless
6ffcc9e55a
Hide the context menu on tap down (#126295)
Desktop text selection toolbar no longer flashes before closing.
2023-05-12 10:04:27 -07:00
Taha Tesser
15a7e07395
Fix showDatePicker in input mode throws an ArgumentError (#126525)
fixes https://github.com/flutter/flutter/issues/126397

The `parseCompactDate` method in `material_localizations.dart` with long text throws an argument error before the date picker could handle it to show a validation error while the date picker is on autovalidate.

This PR adds `try/catch` in the `parseCompactDate` to return null on the argument error.
2023-05-12 16:56:13 +00:00
LongCatIsLooong
4eefced8bc
Fix TextSpan gc regression (#126382)
`for (final InlineSpan child in children ?? const <InlineSpan>[])` bad

Fixes https://github.com/flutter/flutter/issues/126337
2023-05-12 08:05:20 +00:00
Andrew Kolos
5b2f658ff5
Revert "[tool] Move Java functions to their own file" (#126569)
Reverts flutter/flutter#126086.

This PR changed the interfaces of some classes, namely `AndroidSdk`, and deleted a global.

These classes had custom overrides in g3 that were not updated with a g3fix, so this PR has broken tests. See https://b.corp.google.com/issues/281945232 (non-public link)
2023-05-11 17:06:57 +00:00
Michael Goderbauer
dc3d6603f2
Make dpr available during Scrollable disposal (#126535)
Fixes https://github.com/flutter/flutter/issues/126454.

In certain situations (see linked bug) the Scrollable needs access to the DPR of the View it is drawn into during disposal. Since inherited widget lookups are not allowed during disposal, we cannot look up the DPR dynamically in these situations. Instead, we have to cache the DPR when lookups are still allowed.
2023-05-11 15:31:23 +00:00
Taha Tesser
12659f2a7b
Fix MultiChildLayoutDelegate.hasChild doc (#126433)
fixes https://github.com/flutter/flutter/issues/115898

`hasChild` checks `_idToChild` map.  `_idToChild` is not assigned until `_callPerformLayout` is called.
So `hasChild` shouldn't be called in `getSize`.

df789c9e76/packages/flutter/lib/src/rendering/custom_layout.dart (L400-L404)

Updated docs and example class names.
2023-05-11 14:59:07 +00:00
Michael Goderbauer
42d9a2b3fa
Sync lints (#126316)
Sync lints with https://github.com/dart-lang/linter/blob/master/example/all.yaml and enable `implicit_reopen` and `type_literal_in_constant_pattern` (which have no violations). Also contains some clean-up work towards enabling `matching_super_parameters`, which is not quite ready yet due to its handling of "private" arguments.
2023-05-11 13:27:51 +00:00
Andrew Kolos
0a63cd70f1
[tool] Move Java functions to their own file (#126086)
This is the first step in unifying Java-finding logic across the tool. If curious, see #126029 for an example of what all the changes will probably entail.

Moves java-related functionality like `AndroidSdk.findJavaHome` to a new class, `Java`.

See tracking issue https://github.com/flutter/flutter/issues/126126 for more.
2023-05-11 04:32:25 +00:00
Qun Cheng
4e7e4512b6
Reorder materialStateProperty defaults (#125905)
Fixes #122250. This PR is to make sure all the MaterialStateProperty defaults are able to correctly resolve different states. 
* When a widget is pressed, it is also hovered, so we need to put the `MaterialState.pressed` check before `MaterialState.hovered`. 
* When a widget is focused, the widget should still be able to be hovered, so we should check `MaterialState.hovered` before `MaterialState.focused`.
* There are also cases like in _InputDecoratorDefaultsM3, the `MaterialState.disabled` should be checked before `MaterialState.error`.

 the order should be disabled, (error), pressed, hovered, focused.
2023-05-11 00:03:09 +00:00
Alex Li
d01d8aeed0
Add strokeAlign to CircularProgressIndicator and RefreshProgressIndicator (#125945) 2023-05-10 14:57:55 -07:00
Kevin Moore
1b831a2c70
tool/web: correctly log all options to web wasm compile (#126379)
Filtering on 'true' omitted non-bool values
2023-05-10 19:26:08 +00:00
Kevin Chisholm
a153d6da84
Revert "Provide default constraints for M3 dialogs" (#126355)
Reverts flutter/flutter#120082

Causing breakages: b/281181985
2023-05-09 14:21:52 -05:00
Severin
cab29b2034
Fix platformLocation path and search dropping (#126232)
This PR fixes the dropping of both the `path` and `search` fields from the platform location in the URL when using Flutter Web and brings it in par with similar technologies (e.g. React Router).
It allows developers to keep the original path and/or search parameters in the URL, which are perfectly valid even while fragment routing is present.

**Example use case:**
Call a Flutter Web app with initial config parameters in the URL: 
`http://my-flutter.app/?skipIntro=true`

**Example:**
Before initial routing:
`http://localhost:45389/?foo=bar`
After routing:
`http://localhost:45389/#/menu`
After routing (with fix):
`http://localhost:45389/?foo=bar#menu`

Fixes #116415
2023-05-09 16:38:49 +00:00
Bruno Leroux
a800edfff9
Update FocusNode documentation (#126331)
## Description

This PR adds some details in FocusNode documentation to explain more precisely when listeners are notified.

## Related Issue

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

## Tests

Documentation only.
2023-05-09 15:50:51 +00:00
Michael Goderbauer
58454e9e31
Remove dead code (#126266)
Dead code was flagged by `unreachable_from_main` lint, which is still experimental and not ready to be enabled yet.
2023-05-09 15:47:16 +00:00
Viren Khatri
5b87e4fba4
fix AppBar's docs for backgroundColor (#126194) 2023-05-09 08:29:53 -07:00
Kevin Moore
8c5a1ea728
tool/web: tiniest tweak to wasm help content (#126284)
Missing "tick"
2023-05-08 21:00:20 +00:00
fzyzcjy
742a1b49e9
Fix that flutter test does not understand concurrency (#125942)
Close https://github.com/flutter/flutter/issues/125940

I will add tests if this PR looks roughly OK :)

The fix mainly mimics https://github.com/flutter/flutter/pull/115160 - just remove the default argument.

p.s. I ran into this bug when wanting to set concurrency in my dart_test.yaml for one set of my tests which I need to be executed without parallalization.
2023-05-08 20:25:00 +00:00
Alex Li
6b756ab5ff
Improve the format in asset_bundle.dart (#126229)
Just found these extra intents and the very long line which might be improved.

Related git blame: https://github.com/flutter/flutter/blame/master/packages/flutter/lib/src/services/asset_bundle.dart#L337.
2023-05-08 19:13:24 +00:00
fzyzcjy
431dfc8326
Tiny cleanup for Navigator code (without introducing dependency) (#125628)
Close https://github.com/flutter/flutter/issues/125724

> The `navigator.dart` has ~10 repeats of things like:
> 
> ```dart
>     final _RouteEntry? currentRouteEntry = _navigator!._history.cast<_RouteEntry?>().lastWhere(
>       (_RouteEntry? e) => e != null && _RouteEntry.isPresentPredicate(e),
>       orElse: () => null,
>     );
> ```
> 
> while it can be greatly simplified as:
> 
> ```dart
>     final _RouteEntry? currentRouteEntry = _navigator!._history.lastWhereOrNull(_RouteEntry.isPresentPredicate);
> ```
> 
> Thus, it seems that we can beautify the code a little bit.

Same as https://github.com/flutter/flutter/pull/125099, but without external dependency

For more detailed explanation why it does not introduce external dependency: https://github.com/flutter/flutter/pull/125099#discussion_r1174230502
2023-05-08 19:03:06 +00:00
Loïc Sharma
472a0ab314
[Tool] Output help on 'flutter pub' (#126211)
This change makes `flutter pub` show the help usage:

```
PS > flutter pub
Commands for managing Flutter packages.

Global options:
-h, --help                  Print this usage information.
-v, --verbose               Noisy logging, including all shell commands executed.
                            If used with "--help", shows hidden options. If used with "flutter
                            doctor", shows additional diagnostic information. (Use "-vv" to force
                            verbose logging in those cases.)
-d, --device-id             Target device id or name (prefixes allowed).
    --version               Reports the version of this tool.
    --suppress-analytics    Suppress analytics reporting for the current CLI invocation.
    --disable-telemetry     Disable telemetry reporting when this command runs.

Usage: flutter pub <subcommand> [arguments]
-h, --help    Print this usage information.

Available subcommands:
  add         Add a dependency to pubspec.yaml.
  cache       Work with the Pub system cache.
  deps        Print package dependencies.
  downgrade   Downgrade packages in a Flutter project.
  get         Get the current package's dependencies.
  global      Work with Pub global packages.
  login       Log into pub.dev.
  logout      Log out of pub.dev.
  outdated    Analyze dependencies to find which ones can be upgraded.
  pub         Pass the remaining arguments to Dart's "pub" tool.
  publish     Publish the current package to pub.dartlang.org.
  remove      Removes a dependency from the current package.
  run         Run an executable from a package.
  test        Run the "test" package.
  token       Manage authentication tokens for hosted pub repositories.
  upgrade     Upgrade the current package's dependencies to latest versions.
  uploader    Manage uploaders for a package on pub.dev.
  version     Print Pub version.

Run "flutter help" to see global options.
```

Previously it showed an error message:

```
PS > flutter pub
Missing subcommand for "flutter pub".

Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
```

Addresses https://github.com/flutter/flutter/issues/110025
2023-05-08 17:22:10 +00:00
Jackson Gardner
4439fd41d9
Always use --concurrency=1 for web tests. (#126179)
This should fix https://github.com/flutter/flutter/issues/126178

When we don't pass a `--concurrency` flag to the test package, it uses a default based on the number of cores that are on the machine. However, the web test platform itself serializes all these requests anyway, which can lead to the test package timing out. This is because from the test package's perspective, it has already started the loading process on a number of suites which are simply waiting for other test suites to compile and run. The ones that wait the longest can run up against the test packages 12 minute timeout for loading a given suite, even though they haven't actually started to try to load.

Instead, we should always pass `--concurrency=1` to the test package so that it doesn't attempt to start loads concurrently in the first place.
2023-05-08 16:33:15 +00:00
Elias Yishak
38cac91057
Add --verbose flags for flakey tests (#126162)
Related to:
- https://github.com/flutter/flutter/issues/125512

Adding verbose flags to get printed out on error to help debug the cause of the flakey test
2023-05-08 15:59:28 +00:00