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
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.
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.
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);
```
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
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.
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).
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
## 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 |
|--------|--------|
|  |  |
## Related Issue
Fixes https://github.com/flutter/flutter/issues/111958.
## Tests
Adds 5 tests.
## 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.
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)
## 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.
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
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
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
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`.
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`. |
Feat: Drag handle size can now be changed to any given size.
So, In previous behaviour drag handle size was not able to extends beyond 48x48. But some user might want to change it.
In current behaviour, drag handle size is default to same 48x48 but if drag handle size grows beyond that, we don't restrict it.
Fixes#149170
Closes https://github.com/flutter/flutter/issues/152325.
This PR is large due to generate `flutter create --platforms android`. A quick summary:
- Moves the integration test from `packages/flutter_driver/test` to `dev/integration_tests`
- Created a sample Flutter app that draws a blue rectangle
- Forked a subset of `package:flutter_goldens` that will work on the standalone Dart VM
- Forked a subset of `goldens.dart` (from `flutter_test`) to `src/native/goldens.dart` (i.e. `matchesGoldenFile`)
This ... works locally, but as usual I have no idea if it will work on Skia Gold so let's roll some dice.
## Description
This adds a call to the `PlatformDispatcher` whenever the focus changes, so that the engine can decide what to do about view focus. This lets widgets use autofocus, and when they are focused their view will also receive focus.
## Related Issues
- Fixes https://github.com/flutter/flutter/issues/151251
## Tests
- Added a test and some methods to the `TestPlatformDispatcher` to allow introspection of the values sent.
https://github.com/flutter/flutter/issues/150800. The 2nd batch of `widgets` library `@docImport`s.
After this patch, in the `widgets` library:
```
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/scroll_view.dart: (TargetPlatformVariant.mobile)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/_platform_selectable_region_context_menu_web.dart: (ui_web.platformViewRegistry.registerViewFactory)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/primary_scroll_controller.dart: (TargetPlatformVariant.mobile)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/selectable_region.dart: (material, WidgetTester.dragFrom)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/basic.dart: (ui.Gradient.linear)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/framework.dart: (Finder)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart: (WidgetTester.pumpAndSettle)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/binding.dart: (WidgetTester.restartAndRestore, WidgetTester.pumpWidget, TestWidgetsFlutterBinding, testWidgets, TestWidgetsFlutterBinding.ensureInitialized)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/localizations.dart: (GlobalWidgetsLocalizations)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/scroll_controller.dart: (WidgetTester.pumpAndSettle)
Can not fully resolve ../../flutter/packages/flutter/lib/src/widgets/scrollbar.dart: (TargetPlatformVariant.desktop)
21 out-of-scope references in 11 files, 16 unique symbols were left unresolved.
```
Turns out just supporting the right value for `kDebugMode` was a lot simpler than I thought. Debug builds used to never go through the build system code path when using `flutter run`, but now that we have wasm this can occur with the run command.
This should address https://github.com/flutter/flutter/issues/148850
## Description
This PR attemps to clarify the `InputDecoration.collapsed` documentation by explaining that it is not meant to be use with helper, label, counter, icons, prefixes and suffixes.
It also adds some parameters that make sense for a collapsed decoration (`hintMaxLines`, `hintFadeDuration`, `constraints`).
Removing parameters that should not have been added (`floatingLabelBehavior` and `floatingLabelAlignment`) will be part of another PR as it will require deprecations.
## Related Issue
Fixes https://github.com/flutter/flutter/issues/61331
## Tests
Adds 3 tests.
The current example:
> for example, when unlimited width is available and
/// you would like a child that would otherwise attempt to expand infinitely to
/// instead size itself to a more reasonable width.
doesn't seem to be the most useful example because most leaf widgets will just size themselves to their intrinsic size if the incoming constraints are not tight, so when
I was reading the doc I wasn't able to come up with any concrete widget combination that would require the use of `IntrinsicHeight`.
Updates the expected steps in the async function defined within `stepping_project.dart`.
The Dart web team is updating the async semantics of DDC to bring them in line with the other backends. Currently, the DDC async semantics don't adhere to the Dart spec and this can lead to inconsistent and surprising results.
However, the step-over operation doesn't work well yet with the new DDC async semantics. In the long run we intend to improve this but until then the debug stepper will have sporadic results that we can't model well with this test. When we are able to fix the stepper functionality, we will return this test to cover more of the async function being stepped over.