Based on feedback from various desktop developers, and to be consistent between the defaults and the sample code, this PR switches the default for visual density in desktop themes to be compact instead of standard.
It also removes the same setting from the sample code generated by "flutter create" because it is no longer needed now that it is the default.
Updates all null safe dependencies to versions that allow 2.10 stable and 2.11 dev releases.
Also updates flutter_goldens and flutter_goldens_client to allow 2.11 dev.
The throttle duration could delay past the point where the destination sink was closed. Check if it is closed before adding an event. Fixes a crash on dev: StateError: Bad State: Stream is already closed.
If a file scheme and one or more roots is provided, fall back to this mapping before the direct file path if the file path cannot be turned into a package URI.
Use URI representation so that the transformation is resilient to the org-dartlang-app scheme used by the web builds.
Fixes#66095Fixes#66404
If a file scheme and one or more roots is provided, fall back to this mapping before the direct file path if the file path cannot be turned into a package URI.
Fixes#66095
The k toggle allows switching between canvaskit and html backend at runtime. unfortunately this causes hot restart to break, since the dart_sdk modules stores state at runtime. The recommendation will be to use cavaskit via dart-defines.
_attemptServiceConnection in FallbackDiscovery would fail if the root
library URI was not a package URI even if the VM service connection
attempt was successful. This resulted in a VM service connection being
left alive, causing DDS to fail its connection to the VM service.
Updated _attemptServiceConnection to ensure the VM service instance is
disposed after a non-connection related failure and to allow for root
library URIs with a file scheme.
* wrap LicensePage's loading widget with cardColor
* Set AnimatedSwitcer's duration in LicensePage to zero
* Remove AnimatedSwitcher
* Add test code for checking color is same
The main.dart.js bypass is not needed now that we have skipWaiting. Additionally optimize the fetch handler so that resources not in the cache skip the service worker altogether.
Fixes#66068
Removes the template version from the Windows template; the API and
tooling boundary will now be considered stable, so there will no longer
be frequent breaking changes.
Also updates the link for adding desktop support to a project for all
three platforms to reflect the current location.
Fixes https://github.com/flutter/flutter/issues/52748
Adds a VERSIONINFO to Runner.rc in the Windows app template, populated
from the project creation metadata.
Currently the version itself is hard-coded, but it is future-proofed to
allow plumbing the actual version through at build time via preprocessor
defines.
If the tool is downloaded from a precompiled snapshot, or if the backing source files in the pub cache are deleted, the dwds debugging functionality will break as the client.js file cannot be located. Instead use the PackageConfig to verify that package location, downloading if it is missing.
Override the dwds middleware to avoid Isolate.resolvePackageUri
Fixes#53644Fixes#65475
We've gotten feedback that the VelocityTracker change was disruptive, though it did not break any of the flutter framework or customer tests. In order to make the change non-breaking, PointerDeviceKind parameter can be made optional.
Nevertheless, this parameter should be provided so that the existing touch handlers can use more accurate gestures on mouse/stylus inputs, so we can encourage this by deprecating the default constructor and pointing users towards the VelocityTracker.withKind constructor that takes a non-optional parameter
PR #65873 enabled DDS for non-web Flutter applications. This change
surfaced a bug where DDS would not send ServiceRegistered events to VM
service clients when they subscribed to the Service stream. This would
cause tools and tests that rely on these events (e.g., hot reload in
VSCode) to fail.
Fixes#66038.
If a new service worker is installed, automatically update this behind the scenes. Immediately after a page refresh, the new worker and cache will be available, though the main.dart.js and others will be available sooner due to the cache busting URLS
This fixes a problem where the character field of the RawKeyEvent was not being set at all for non-Android platforms.
I also updated the key maps, and corrected a problem with the Windows key map where the backquote character wasn't correctly mapped.
This follows https://github.com/flutter/flutter/pull/59364 and cl/319911104
FittedBox is still default to hardEdge clip as new FittedBox is added to Google very quickly. Let's first roll other part of changes into Google first.
Generates version.json in web directory of project. version.json can be used in the future version of package_info which will support web. version.json has the following keys : app_name, version and build_number. This file is generated every time a user runs or builds the project.
Co-authored-by: Jonah Williams <jonahwilliams@google.com>
Like the ProcessException thrown from zip running on a bad file, the tool should catch the ArchiveException thrown from windows implementation using package:archive.
Port the deprecated settings devicelab test to tool integration shard. Tests that apps can be built using the deprecated android/settings.gradle file.
Part of #65790
* Reland "Nnbd widgets (#64672)"
This reverts commit 127e67902e.
* remove non-nullable enforcement on AsyncSnapshot
* make data param non-nullable for AsyncSnapshot.withData
* make some Text params non-nullable
Some terminals stdin do not support single char mode (like an emacs terminal buffer apparently). If this is the case, then the presented choice values would always have an appended newline \n which would prevent us from finding the value in the listed index (or using it as a signal for the default choice). To fix, treat '' as the default choice and always trim the choice value.
While this has seemingly always been broken, it wasn't noticeable until the multi-device selection prompt was added a few months ago.
Fixes#65267
* fuchsia_remote_debug_protocol allows open port on remote device
Allows defining a port forwarding function for which the accessible
port is not on the host device. Examples include tunneling solutions
where a tunneling program on the same device as the Dart VM exposes
an open port through which it tunnels connections to the VM.
* Move ssh-specific comment to SshPortForwarder
* [gen_l10n] Support string list as preferred-supported-locales, as documented.
* [gen_l10n] Convert preferredSupportedLocale to a list of strings.
* [gen_l10n] Accept a multi option instead of a json string in the command line.
The Windows plugin CMake generation had code to ensure that the paths
written to it used POSIX separators, but the Linux version didn't; that
meant that plugin updates run on Windows machines would corrupt the
generated (but checked in) Linux CMake file.
This change shares that code so that both will use POSIX paths
regardless of what OS they are generated on.
Fixes https://github.com/flutter/flutter/issues/64591
* migrate widget to nullsafety
* remove double blank line after license
* address review comments in actions.dart
* nullable ObjectKey.value
* use local variable oldElement
* make State.build non-nullable
* make State.context non-nullable
* newline at eof
* make ProxyWidget.child non-nullable
* make _InactiveElements.debugContains non-nullable
* make Element.depth non-nullable
* make ProxyElement.build non-nullable
* make StatefulElement.state non-nullable
* remove 'Notice that'
* avoid cast of list in RenderObjectElement.updateChildren
* make IndexedSlot.value non-nullable
* avoid cast of list in MultiChildRenderObjectElement.mount
* make some WidgetsApp parameters non-nullable
* hitTest take non-nullable position
* make ScrollableState.position non-nullable
* use _pixels instead of pixels
* make ViewportOffset.pixels non-nullable
* make param and return type of IndexedWidgetBuilder non-nullable
* unused_import
* make context param non-nullable for Builder in animated_list.dart
* make ScrollMetrics.viewportDimension non-nullable
* make ScrollMetrics.{min,max}ScrollExtent non-nullable
* make _Location.file non-nullable
* _WidgetForTypeTests.createElement throw UnimplementedError
* update _NullWidget.build error message
* make _ShortcutsState.manager non-nullable
* Fix childCount issues for NNBD
* fix childCount computation on web
* increase max value on js side to compute childCount
* make aspect parameter of dependOnInheritedWidgetOfExactType nullable
* merge has{min,max}ScrollExtent into hasScrollExtents
* update focus_manager.dart
* address review comments in icon.dart
* address review comments in image.dart
* address review comments in routes.dart
* address review comments in scroll_activity.dart
* update doc comments
* make UserScrollNotification.direction non-nullable and required
* rename hasScrollExtents to hasContentDimensions
* unnecessary late
Co-authored-by: Ian Hickson <ian@hixie.ch>
Integration tests must only go through the real file system/process manager/platform. The global indirection makes this code harder to understand than if it directly referred to the concrete instances that are being used.
Update the integration shard to use a const instance of a LocalFIleSystem, LocalProcessManager, and LocalPlatform. Remove global usage and apply testWithoutContext.
Currently the framework uses fairly large "hit slop" values to disambiguate taps from drags/pans. This makes sense on touch devices where the interaction is not very precise, on mice however it can feel as if the UI is lagging. This is immediately noticeable on our infra dashboard, where it takes almost half of a grid square of drag before the actual drag kicks in.
One potential solution is to always use smaller constants depending on whether the interaction is mouse or touch based. The only reasonable choice is to use the pointer device kind and not target platform - same platform can have different input sources. This requires exposing the pointer device kind in a few new places in several of the gesture detectors, and using the enum to compute the correct hit slop from an expanded set of constants.
This almost works, however there are a few places (notably ListViews) which uses the touch hit slop as a default value in scroll physics. It does not seem like it will be easy to disambiguate a user provided scroll physics constant from the default and/or adjust it somehow - this might require significant changes to scroll physics which I have left out of this PR.
This PR does not adjust:
kTouchSlop used in scroll_physics.dart's minFlingDistance
kTouchSlop used in PrimaryPointerGestureRecognizer/LongPressGestureRecognizer
This allows us to rationalize the nullability of some of our APIs.
Prior to this we'd end up in a situation where Container assumed that
getClipPath would be non-null but Decoration was ok with return null.
Currently flutter run -d web creates a server with the x-frame-options: SAMEORIGIN added by default (shelf add it's by default). This doesn't allow you to use it inside a frame.
I am trying to build an embedded simulator in vscode and it requires using an iframe.
With this PR I remove the header for debug and profile mode.
The flutter tool is currently unable to detect missing permissions in gradle/gradle.bat that would cause a gradle build to fail via process exception. Rather than crashing and exiting, we can display the exception as an error message and tool exit.
While linux/macOS are able to add the +x bit, this is not possible on windows with our current file system/OS API. These crashes represent a substantial amount of crash reporting, but are otherwise not actionable on our end.
Almost all of the flag setup on Linux, macOS, and Windows should be
identical; this pulls that common setup to a shared method.
This adds support for several flags on macOS that have all the necessary
plumbing already in place due to shared backend code, but were never
enabled.
Fixes https://github.com/flutter/flutter/issues/64944
People frequently assume they can run the executable they find at the
top level of the build directory, and don't understand why they get
resource errors from the engine. To avoid that, this puts the unbundled
copy of the executable in a subdirectory with a name that should warn
people away from running it.
Fixes#64963
Attempt to bypass aggressive CDN by requesting main.dart.js/sw.js with a query param and defaulting index.html to online first. This will not stop aggressive CDN caching of the index.html
#64968
Previous benchmarks have established the performance of sync*. Additionally, why allocate a list when you don't need to? Since these APIs are private, they can be re-arranged a bit to avoid creating as many lists. Will probably not have a large effect on benchmarks
Exit the tool after a repeated network error to download. previously we were returning null and continuing on, leading to a ProcessException when we unzipped a missing file.
Flutter's `moreOrLessEquals` has a few advantages over `closeTo` from
the `matcher` package:
* It emits the epsilon value in the test result on failure.
* It uses a named parameter for epsilon, which improves readability
at the call site.
* It has a reasonable default for epsilon in cases where something
more specific isn't required.
Using it also has the nice property that it aids in its own discovery
when when people go looking for such functionality in new tests.
This change also includes a couple unrelated whitespace formatting cleanups.
* synthetic packages by default in gen_l10n tool
* Refactor default path for synthetic package
* Remove unused import
* Code cleanup
* Further improvements to help text
* Refactor synthetic package path
* Remove newlines
* Test cleanup
* clean up logic in inputs and outputs list function
* Update l10n.yaml usage
* only add option if value is non-null
* Update stocks app as proof of concept for synthetic package usage
* Address nits
* print pubspec contents
* add print statements
* Do not allow null value for useSyntheticPackage
* +
* +
* +
* +
* Cleanup
* Add test
* Fix text
* Dont parse pubspec directly
* Test using context
* WIP: generate synthetic packages on pub get -- needs tests
* Allow null value
* Update null handling
* Refactor to properly handle null case
* Fix yamlMap condition
* Fix yaml node for real
* WIP: struggling to write tests
* WIP - take absolute path as an option
* Add tests
* Use environment project directory for synthetic package generation pathway
* Fix typo
* Improve help text
* Update defaults
* Remove unauthorized path import
* Fix pathing issues at synthetic package generation
* Fix typo in test
* Use path.join so projectDir matches up based on OS
* Fix Windows pathing in test
* Remove unnecessary replaceApp code for projectDir.path
* Use globals.fs.currentDirectory.path in resident_runner_test.dart
* Fix merge conflict
* Add test to ensure that synthetic package is generated on pub get
* Fix resident_runner_test.dart tests
* Fix tests
* Use package:file instead of dart:io
* WIP - exploration
* Remove synthetic package use from stocks example
* Update integration test to not use synthetic packages
* Remove trailing whitespace
* flutter pub get runs synth package generation
* Remove more print statements
* Add license header
* WIP - minimally working pub.get
* Use own MockBuildSystem
* Modify test and implementation to be a little cleaner
* Fix flutter pub get invocation
* Use synthetic packages in stocks app
* Revert "Use synthetic packages in stocks app"
This reverts commit 45bf24903c.
* Add environment and buildSystem params to flutter test
* Address code review feedback
* +
* Isolate codegen into its own API
* Fix imports
* Slight refactor
* Add one more test for no l10n.yaml file
* Remove unneeded mock class and import in pub_get_test.dart
* More code review feedback
* Remove unnecessary imports
* Remove `return await`s that I missed
* use arrow functions instead
moreOrLessEquals is the preferred mechanism for checking that a value is
within some error bound epsilon, with default value for epsilon of
precisionErrorTolerance.
This patch replaces instances of closeTo using precisionErrorTolerance.
Several of our tests make use of numbers without an exact floating point
representation (frequently 0.x where x!=5) which, when scaled, also
scale the error. The end result is that some of these tests currently
implicitly rely on an implementation detail of floating point math and
are sensitive to differences in the ~15th decimal place.
This patch reduces the sensitivity of some of these tests, checking
values using `moreOrLessEquals` from the flutter_test package
rather than requiring en exact match.
* Reland "Re-enable the Dart Development Service (DDS) (#64671)"
This reverts commit 2ae25cc2d7.
* Fix MDNS building Observatory URI with port 0 instead of forwarding the device port
* Added MDNS test