21049 Commits

Author SHA1 Message Date
Loïc Sharma
ce61eda70c
[Windows] Ensure window is shown (#127046)
## Background

The Windows runner has a race at startup:

1. **Platform thread**: creates a hidden window
2. **Platform thread**: launches the Flutter engine
3. **UI/Raster threads**: renders the first frame
4. **Platform thread**: Registers a callback to show the window once the next frame has been rendered.

Steps 3 and 4 happen in parallel and it is possible for step 3 to complete before step 4 starts. In this scenario, the next frame callback is never called and the window is never shown.

As a result the `windows_startup_test`'s test, which [verifies that the "show window" callback is called](1f09a8662d/dev/integration_tests/windows_startup_test/windows/runner/flutter_window.cpp (L60-L64)), can flake if the first frame is rendered before the show window callback has been registered.

## Solution

This change makes the runner schedule a frame after it registers the next frame callback. If step 3 hasn't completed yet, this no-ops as a frame is already scheduled. If step 3 has already completed, a new frame will be rendered, which will call the next frame callback and show the window.

Part of https://github.com/flutter/flutter/issues/119415

See this thread for alternatives that were considered: https://github.com/flutter/engine/pull/42061#issuecomment-1550080722
2023-05-19 22:25:55 +00:00
Phil Quitslund
d0c0439b8d
fixes to anticipate next Dart linter release (#127211)
The upcoming linter release notices null literals as unnecessary argument values and flags more `type_literal_in_constant_pattern` cases. 

See breakages: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8780744067138629361/+/u/analyze_flutter_flutter/stdout
2023-05-19 21:27:24 +00:00
Kate Lovett
e8b7889dfd
Remove deprecated OverscrollIndicatorNotification.disallowGlow (#127050)
The deprecated OverscrollIndicatorNotification.disallowGlow has expired and is removed in the PR. The replacement is OverscrollIndicatorNotification.disallowIndicator. This deprecation was introduced in https://github.com/flutter/flutter/pull/87839 when the StretchingOverscrollIndicator was added. The name change made it clearer since there is now more than one overscroll indicator.

This change is supported by dart fix. ✅ 

Part of https://github.com/flutter/flutter/issues/127042
2023-05-19 19:40:51 +00:00
Christopher Fujino
e310475fc7
[flutter_tools] only try to take a screenshot from flutter drive if the --screenshot flag is passed (#127150)
Fixes https://github.com/flutter/flutter/issues/123621
2023-05-19 19:14:17 +00:00
Chris Yang
972b447434
[tool] delete xcresult bundle file before each xcode retry. (#127144)
xcodebuild command generates a xcresult bundle file on each run, however, it doesn't delete the file generated from previous run and will throw an error if the exact file already exists.

In tool, we manually delete the file after each `flutter build` or `flutter run` command. However, there are some internal logic where xcodebuild retries multiple times. 

This PR deletes the xcresult bundle file at the start of each retry if it exists.

Fixes https://github.com/flutter/flutter/issues/127119
2023-05-19 17:18:15 +00:00
Victoria Ashworth
b9e8b0a827
[iOS] Dispose of log readers and port forwarders if launch fails (#127140)
When tests run in our CI using `flutter drive`, if there is a failure it will loop and try again.

434b81f1a5/packages/flutter_tools/lib/src/drive/drive_service.dart (L177-L186)

However, it's using the same `device` instance for each iteration. So what was happening was when it would fail to launch, it would tell its listeners that it was cancelled.
434b81f1a5/packages/flutter_tools/lib/src/ios/ios_deploy.dart (L486-L489) 

Then when the next iteration started, the `vmServiceDiscovery` would immediately return with null because the `deviceLogReader` would be cached from the previous iteration and would already be cancelled. Therefore, bypassing and cancelling the timer.

434b81f1a5/packages/flutter_tools/lib/src/ios/devices.dart (L585-L591)

434b81f1a5/packages/flutter_tools/lib/src/ios/devices.dart (L627)

In addition, it seems like sometimes the stop would fail and therefore the the drain would never get the signal that it was done and therefore would hang forever. There was no indication that the stop had failed though because the logs were going to the stream that had no listeners since `deviceLogReader` was already cancelled.
434b81f1a5/packages/flutter_tools/lib/src/ios/ios_deploy.dart (L563-L576)

Fixes https://github.com/flutter/flutter/issues/127141
2023-05-19 16:44:58 +00:00
Felix Angelov
3af7f9bef5
fix(flutter_tools): findBundleFile w/multiple flavor dimensions (#127133)
Fixes the `findBundleFile` method in `gradle.dart` to correctly locate app bundles generated from multiple flavor dimensions.

- closes https://github.com/flutter/flutter/issues/92316
- closes https://github.com/flutter/flutter/issues/65264
2023-05-19 15:00:53 +00:00
chunhtai
ea5cfe09fd
Properly cleans up routes (#126453)
fixes https://github.com/flutter/flutter/issues/126100
2023-05-19 00:32:26 +00:00
Qun Cheng
af83c76723
Remove deprecated primaryVariant and secondaryVariant from ColorScheme (#127124)
This PR is to remove deprecated `primaryVariant` and `secondaryVariant` from framework. These two apis are made obsolete in #93427

Part of https://github.com/flutter/flutter/issues/127042
2023-05-19 00:26:53 +00:00
Qun Cheng
be40991082
Update useMaterial3 api doc (#127142)
This is to update the components section for `useMaterial3` api doc.
2023-05-18 23:34:07 +00:00
Mahdi Bagheri
434b81f1a5
Fixing richMessage gesture recognizer in tooltip widget (#126207)
Fixing #126206 and #113388 issues

*The IgnorePointer is preventing the richMessage touch events being recognized. Just removing that from*

*Solves #126206 and #113388*
2023-05-18 18:32:22 +00:00
Michael Goderbauer
5ae6438157
Revert "Handle null return from WillPopCallback" (#127112)
Reverts flutter/flutter#127039

Google3 has been fixed, so this work around is no longe necessary.
2023-05-18 17:47:54 +00:00
Justin McCandless
6071f149b5
Revert "Remove obsolete drawShadow bounds workaround" (#127110)
Reverts flutter/flutter#127052, which seems to be breaking the build
because of a goldens failure.

```
The following TestFailure was thrown running a test:
Expected: one widget whose rasterized image matches golden image "shadow.PhysicalModel.enabled.png"
  Actual: _WidgetTypeFinder:<exactly one widget with type "Container" (ignoring offstage widgets):
Container(bg: Color(0xfffff59d), margin: EdgeInsets.all(150.0))>
```

See
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20web_tests_6/11051/overview
2023-05-18 09:05:07 -07:00
Qun Cheng
f31dae2a80
Clip search view content during animation (#126975)
Fixes #126590

This PR is to clip the view content when the view size is not big enough, such as during animation.
Also removes some unused properties in `_ViewContent` class: `getRect` and `viewConstraints`
2023-05-18 00:18:51 +00:00
Jim Graham
8089a309a9
Remove obsolete drawShadow bounds workaround (#127052)
This workaround was created 6 years ago with no links to bug databases to track. As best we can determine, the issue is no longer present in SkPicture or DisplayList and is most likely obsolete. More importantly, though, non-rendering primitives are ignored by the DisplayList construction and so this workaround will just be ignored anyway. If a problem surfaces about this issue that we haven't discovered by a thorough code search of the current code base, then workarounds should be installed within the relevant implementation modules rather than in the framework (and documented with bugs filed in either or both of Flutter's github repos, and/or the Skia issue database).

Workaround originally created in this PR: https://github.com/flutter/flutter/pull/9654
2023-05-18 00:17:33 +00:00
Loïc Sharma
718f444bc3
[Windows] Improve version migration message (#127048)
This also migrates the platform channel example to stamp version information on Windows.
2023-05-17 23:07:16 +00:00
Renzo Olivares
d44d657ade
Remove deprecated fixTextFieldOutlineLabel (#125893)
The deprecation period has elapsed. The method was made obsolete in https://github.com/flutter/flutter/pull/87281.
2023-05-17 22:56:14 +00:00
Sam Rawlins
7a32504531
Ignore unused_element_parameter (#126926)
When the analyzer detects an unused parameter, it reports `unused_element` which can be ignored with an inline ignore like `// ignore: unused_element`. The analyzer will start reporting instead, `unused_element_parameter`. There are ignores in flutter/flutter that need to be updated to the new code. In order to incrementally migrate, they can be changed to `// ignore: unused_element, unused_element_parameter`.

After flutter/flutter is using a new enough analyzer, we can then change those to `// ignore: unused_element_parameter`.

Work towards https://github.com/flutter/flutter/issues/126924
2023-05-17 21:16:24 +00:00
Christopher Fujino
05af460790
[flutter_tools] unpin and roll camera_android (#126945)
camera_android was pinned because of https://github.com/flutter/flutter/issues/126710, which was fixed upstream in release 0.10.8+1.
2023-05-17 18:07:20 +00:00
Michael Goderbauer
acbfb40f05
Handle null return from WillPopCallback (#127039)
Partial revert of https://github.com/flutter/flutter/pull/126647 to work around issue in google3.

See b/283046390
2023-05-17 17:50:36 +00:00
Michael Goderbauer
0bd275fe66
Remove unused (and untested) parameters from private _MasterDetailFlow (#126935)
Follow-up to https://github.com/flutter/flutter/pull/126926.
2023-05-17 17:06:18 +00:00
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