- 24 Jul, 2023 7 commits
-
-
Ian Hickson authored
This makes the output less sensitive on JS int vs double shenanigans.
-
Taha Tesser authored
fixes [Material3: TimePicker clock dial use wrong spec color and its web spec has a mistake](https://github.com/flutter/flutter/issues/118657) ### Description This PR fixes the default color used for the Material 3 dial background. ### Code sample <details> <summary>expand 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) { final ThemeData theme = ThemeData(useMaterial3: true); return MaterialApp( debugShowCheckedModeBanner: false, // theme: theme, theme: theme.copyWith( colorScheme: theme.colorScheme.copyWith( surfaceVariant: const Color(0xffffbf00), ), ), home: const Example(), ); } } class Example extends StatelessWidget { const Example({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Sample'), ), body: Center( child: ElevatedButton( onPressed: () { showTimePicker( context: context, initialTime: TimeOfDay.now(), ); }, child: const Text('Open Time Picker'), ), ), ); } } ``` </details> ### Default dial background color | Before | After | | --------------- | --------------- | | <img src="https://github.com/flutter/flutter/assets/48603081/59514586-60c6-489f-b024-f659a26fa1e7" /> | <img src="https://github.com/flutter/flutter/assets/48603081/75c3c360-df2b-47c8-8187-136ff6d963b6" /> | ### Custom color scheme | Before | After | | --------------- | --------------- | | <img src="https://github.com/flutter/flutter/assets/48603081/666dd2fc-7ee2-4268-9af0-923019adfccd" /> | <img src="https://github.com/flutter/flutter/assets/48603081/f32dc39e-a43f-4a63-a6e4-9df479b723ed" /> |
-
Bruno Leroux authored
## Description This PR updates how a floating snack bar is positionned when a `Scaffold` defines a FAB with `Scaffold.floatingActionButtonLocation` sets to one of the top locations. **Before this PR:** - When a FAB location is set to the top of the `Scaffold`, a floating `SnackBar` can't be displayed and an assert throws in debug mode. **After this PR:** - When a FAB location is set to the top of the `Scaffold`, a floating `SnackBar` will be displayed at the bottom of the screen, above a `NavigationBar` for instance (the top FAB is ignored when computing the floating snack bar position).  ## Motivation This is a edge case related to a discrepancy between the Material spec and the Flutter `Scaffold` customizability: - Material spec states that a floating `SnackBar` should be displayed above a FAB. But, in Material spec, FABs are expected to be on the bottom. - Since https://github.com/flutter/flutter/issues/51465, Flutter `Scaffold` makes it valid to show a FAB on the top of the `Scaffold`. ## Related Issue fixes https://github.com/flutter/flutter/issues/128150 ## Tests Adds 1 test.
-
Tae Hyung Kim authored
This PR changes the paint functions for SliverMainAxisGroup and SliverCrossAxisGroup so that only visible slivers are painted. Fixes https://github.com/flutter/flutter/issues/129214.
-
Sabin Neupane authored
Fixes: #130674 Before: The dropdown menu was not closed if empty text was provided After: The dropdown menu is closed even if empty text is provided https://github.com/flutter/flutter/assets/61322712/fccac501-9fca-4f60-8a94-abfc50552ec9 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
-
Lexycon authored
This PR changes the material date picker behavior when changing the year so that it matches the native picker and the material component guideline. (#81547) See material component guideline for the date picker: [Material component date-picker behavior](https://m3.material.io/components/date-pickers/guidelines#1531a81f-4052-4a75-a20d-228c7e110156) See also: [Material components android discussion](https://github.com/material-components/material-components-android/issues/1723) When selecting another year in the native picker, the same day will be selected (by respecting the boundaries of the date picker). The current material date picker does not select any day when changing the year. This will lead to confusion if the user presses OK and the year does not get updated. So here is my suggestion: It will try to preselect the day like the native picker: - respecting the boundaries of the date picker (firstDate, lastDate) - changing from leapyear 29th february will set 28th february if not a leapyear is selected - only set the day if it is selectable (selectableDayPredicate) The calendar shown in the recording was setup with this parameters: ``` firstDate: DateTime(2016, DateTime.june, 9), initialDate: DateTime(2018, DateTime.may, 4), lastDate: DateTime(2021, DateTime.january, 15), ``` https://github.com/flutter/flutter/assets/13588771/3041c296-b9d0-4078-88cd-d1135fc343b3 Fixes #81547
-
Martin Kustermann authored
The change in [0] has propagated now everywhere, so we can use `utf8.encode()` instead of the longer `const Utf8Encoder.convert()`. Also it cleans up code like ``` TypedData bytes; bytes.buffer.asByteData(); ``` as that is not guaranteed to be correct, the correct version would be ``` TypedData bytes; bytes.buffer.asByteData(bytes.offsetInBytes, bytes.lengthInBytes); ``` a shorter hand for that is: ``` TypedData bytes; ByteData.sublistView(bytes); ``` [0] https://github.com/dart-lang/sdk/issues/52801
-
- 22 Jul, 2023 1 commit
-
-
Polina Cherkasova authored
-
- 21 Jul, 2023 1 commit
-
-
hangyu authored
fixes: https://github.com/flutter/flutter/issues/129618
-
- 20 Jul, 2023 9 commits
-
-
Greg Spencer authored
## Description This modifies the `MenuAnchor` `onPressed` activation to delay until after the current frame is built, and resolve any focus changes before it invokes the `onPressed`, so that actions that operate on the `primaryFocus` can have a chance of working on the focused item they were meant to work on. ## Related Issues - Fixes https://github.com/flutter/flutter/issues/118731 ## Tests - No tests yet (hence draft still)
-
Qun Cheng authored
Update `TextSelectionTheme`, `ThemeData`, `TimePicker`, and `TimePickerTheme` tests for M2/M3 (#130547) Updated unit tests for `TextSelectionTheme`, `ThemeData`, `TimePicker` and `TimePickerTheme` to have M2 and M3 versions. More info in #127064
-
Bruno Leroux authored
This PR updates unit tests from autocomplete_test.dart for M3 migration. More info in https://github.com/flutter/flutter/issues/127064 I replaced magic numbers (64.0 and 187.0) and found ways to compute them without relying on the Material version.
-
Bruno Leroux authored
This PR updates unit tests in `about_test.dart` for M3 migration. More info in https://github.com/flutter/flutter/issues/127064 - Two tests were failing in M3 due to a memory leak. As the memory leak is now fixed, see https://github.com/flutter/flutter/pull/130720, this two tests does not depend anymore on the Material version. - Created several M3 tests related to typography and rendering changes.
-
Taha Tesser authored
fixes [Chip's delete button tap target is too big](https://github.com/flutter/flutter/issues/129986) ### Description This PR fixes the issue where the chip delete button is tappable within the label. ### Code sample <details> <summary>expand 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, theme: ThemeData(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('Sample'), ), body: Center( child: Chip( label: const Text('Really Long Label'), onDeleted: () {}, ), ), ); } } ``` </details> ### Before https://github.com/flutter/flutter/assets/48603081/14b369c5-c740-4dfc-a512-779bd3a1a46b ### After https://github.com/flutter/flutter/assets/48603081/08c6e232-0237-4ab2-9829-66ee8e5cead2
-
Bruno Leroux authored
## Description This PR adds a call to dispose the internal `MaterialStatesController` instantiated by `_SelectableIconButtonState`. I found this memory leak while working on M2/M3 test update for `about_test.dart`. This memory leak only happens when using M3 because `IconButton` relies on `_SelectableIconButton` only when useMaterial3 is true: https://github.com/flutter/flutter/blob/3a1190a5a85c3e6a0cf3a9c30f34548fdd48ac1e/packages/flutter/lib/src/material/icon_button.dart#L671-L721 ## Related Issue Fixes https://github.com/flutter/flutter/issues/130708 ## Tests Adds 1 test.
-
Bruno Leroux authored
This PR updates unit tests from banner_theme_test.dart for M3 migration. More info in https://github.com/flutter/flutter/issues/127064 Just added some `Material`prefixes.
-
Ian Hickson authored
Fixes https://github.com/flutter/flutter/issues/92722
-
chunhtai authored
Currently if the focus is on a focusnode that `skipTraversal = true`, the tab won't be able to traverse focus out of the node. this pr fixes it
-
- 19 Jul, 2023 2 commits
-
-
Greg Spencer authored
## Description Modifies the semantic label for popup and context menus to be "Dismiss menu" instead of just "Dismiss". ## Related Issues - Fixes https://github.com/flutter/flutter/issues/118994 ## Tests - Updated tests
-
Tomasz Gucio authored
-
- 18 Jul, 2023 6 commits
-
-
Bruno Leroux authored
This PR updates unit tests from app_builder_test.dart for M3 migration. More info in https://github.com/flutter/flutter/issues/127064 In this particular case, I choose to make the tests Material-agnostic by removing the color theming which was not meaningful to what is tested here.
-
Ian Hickson authored
Fixes https://github.com/flutter/flutter/issues/42390
-
Bruno Leroux authored
This PR updates unit tests for `SnackBar` to have M2 and M3 versions. More info in https://github.com/flutter/flutter/issues/127064
-
Taha Tesser authored
Updated unit tests for `AppBar` and `AppBarTheme` to have M2 and M3 versions. More info in https://github.com/flutter/flutter/issues/127064
-
Bruno Leroux authored
This PR updates unit tests from `app_test.dart` for M3 migration. More info in https://github.com/flutter/flutter/issues/127064 The diff is somewhat misleading because third test in the original code is now the fourth in the updated one, but because they were very similar git diff does not reflect this swap. And also, first test is M2 only and last one M3 only.
-
Taha Tesser authored
fixes [[Material3] AppBar does not respect `foregroundColor` or `iconTheme` for leading and actions in some cases](https://github.com/flutter/flutter/issues/130485) ### Description - Fix `Colors.white` not applied in dark mode - Add regression tests - make `iconStyle` private for consistency ### Before  ### After 
-
- 17 Jul, 2023 9 commits
-
-
LongCatIsLooong authored
Fixes https://github.com/flutter/flutter/issues/129611
-
Polina Cherkasova authored
-
LongCatIsLooong authored
Deprecate `textScaleFactor` in favor of `textScaler`, in preparation for Android 14 [Non-linear font scaling to 200%](https://developer.android.com/about/versions/14/features#non-linear-font-scaling). The `TextScaler` class can be moved to `dart:ui` in the future, if we decide to use the Android platform API or AndroidX to get the scaling curve instead of hard coding the curve in the framework. I haven't put the Flutter version in the deprecation message so the analyzer checks are failing. Will do so after I finish the migration guide. **Why `TextScaler.textScaleFactor`** The author of a `TextScaler` subclass should provide a fallback `textScaleFactor`. By making `TextScaler` also contain the `textScaleFactor` information it also makes it easier to migrate: if a widget overrides `MediaQueryData.textScaler` in the tree, for unmigrated widgets in the subtree it would also have to override `MediaQueryData.textScaleFactor`, and that makes it difficult to remove `MediaQueryData.textScaleFactor` in the future. ## A full list of affected APIs in this PR Deprecated: The method/getter/setter/argument is annotated with a `@Deprecated()` annotation in this PR, and the caller should replace it with `textScaler` instead. Unless otherwise specified there will be a Flutter fix available to help with migration but it's still recommended to migrate case-by-case. **Replaced**: The method this `textScaleFactor` argument belongs to is rarely called directly by user code and is not overridden by any of the registered custom tests, so the argument is directly replaced by `TextScaler`. **To Be Deprecated**: The method/getter/setter/argument can't be deprecated in this PR because a registered customer test depends on it and a Flutter fix isn't available (or the test was run without applying flutter fixes first). This method/getter/setter/argument will be deprecated in a followup PR once the registered test is migrated. ### `Painting` Library | Affected API | State of `textScaleFactor` | Comment | | --- | --- | --- | | `InlineSpan.build({ double textScaleFactor = 1.0 })` argument | **Replaced** | | | `TextStyle.getParagraphStyle({ double TextScaleFactor = 1.0 })` argument | **Replaced** | | | `TextStyle.getTextStyle({ double TextScaleFactor = 1.0 })` argument| Deprecated | Can't replace: https://github.com/superlistapp/super_editor/blob/c47fd38dca4b7f43611690913b551a1773c563d7/super_editor/lib/src/infrastructure/super_textfield/desktop/desktop_textfield.dart#L1903-L1905| | `TextPainter({ double TextScaleFactor = 1.0 })` constructor argument | Deprecated | | | `TextPainter.textScaleFactor` getter and setter | Deprecated | No Flutter Fix, not expressible yet | | `TextPainter.computeWidth({ double TextScaleFactor = 1.0 })` argument | Deprecated | | | `TextPainter.computeMaxIntrinsicWidth({ double TextScaleFactor = 1.0 })` argument | Deprecated | | ### `Rendering` Library | Affected API | State of `textScaleFactor` | Comment | | --- | --- | --- | | `RenderEditable({ double TextScaleFactor = 1.0 })` constructor argument | Deprecated | | | `RenderEditable.textScaleFactor` getter and setter | Deprecated | No Flutter Fix, not expressible yet | | `RenderParagraph({ double TextScaleFactor = 1.0 })` constructor argument | Deprecated | | | `RenderParagraph.textScaleFactor` getter and setter | Deprecated | No Flutter Fix, not expressible yet | ### `Widgets` Library | Affected API | State of `textScaleFactor` | Comment | | --- | --- | --- | | `MediaQueryData({ double TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | https://github.com/flutter/packages/blob/cd7b93532e5cb605a42735e20f1de70fc00adae7/packages/flutter_markdown/test/text_scale_factor_test.dart#LL39C21-L39C35 | | `MediaQueryData.textScaleFactor` getter | Deprecated | | | `MediaQueryData.copyWith({ double? TextScaleFactor })` argument | Deprecated | | | `MediaQuery.maybeTextScaleFactorOf(BuildContext context)` static method | Deprecated | No Flutter Fix, not expressible yet | | `MediaQuery.textScaleFactorOf(BuildContext context)` static method | **To Be Deprecated** | https://github.com/flutter/packages/blob/cd7b93532e5cb605a42735e20f1de70fc00adae7/packages/flutter_markdown/lib/src/_functions_io.dart#L68-L70, No Flutter Fix, not expressible yet | | `RichText({ double TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | https://github.com/flutter/packages/blob/cd7b93532e5cb605a42735e20f1de70fc00adae7/packages/flutter_markdown/lib/src/builder.dart#L829-L843 | | `RichText.textScaleFactor` getter | **To Be Deprecated** | A constructor argument can't be deprecated right away| | `Text({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | https://github.com/flutter/packages/blob/914d120da12fba458c020210727831c31bd71041/packages/rfw/lib/src/flutter/core_widgets.dart#L647 , No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 | | `Text.rich({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | The default constructor has an argument that can't be deprecated right away. No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 | | `Text.textScaleFactor` getter | **To Be Deprecated** | A constructor argument can't be deprecated right away | | `EditableText({ double? TextScaleFactor = 1.0 })` constructor argument | Deprecated | No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 | | `EditableText.textScaleFactor` getter | Deprecated | | ### `Material` Library | Affected API | State of `textScaleFactor` | Comment | | --- | --- | --- | | `SelectableText({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | https://github.com/flutter/packages/blob/cd7b93532e5cb605a42735e20f1de70fc00adae7/packages/flutter_markdown/lib/src/builder.dart#L829-L843, No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 | | `SelectableText.rich({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | The default constructor has an argument that can't be deprecated right away. No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 | | `SelectableText.textScaleFactor` getter | **To Be Deprecated** | A constructor argument can't be deprecated right away | A lot of material widgets (`Slider`, `RangeSlider`, `TimePicker`, and different types of buttons) also change their layout based on `textScaleFactor`. These need to be handled in a case-by-case fashion and will be migrated in follow-up PRs.
-
LongCatIsLooong authored
Fixes https://github.com/flutter/flutter/issues/130588
-
LongCatIsLooong authored
Fixes https://github.com/flutter/flutter/issues/130668
-
Michael Goderbauer authored
This change enables Flutter to generate multiple Scenes to be rendered into separate FlutterViews from a single widget tree. Each Scene is described by a separate render tree, which are all associated with the single widget tree. This PR implements the framework-side mechanisms to describe the content to be rendered into multiple views. Separate engine-side changes are necessary to provide these views to the framework and to draw the framework-generated Scene into them. ## Summary of changes The details of this change are described in [flutter.dev/go/multiple-views](https://flutter.dev/go/multiple-views). Below is a high-level summary organized by layers. ### Rendering layer changes * The `RendererBinding` no longer owns a single `renderView`. In fact, it doesn't OWN any `RenderView`s at all anymore. Instead, it offers an API (`addRenderView`/`removeRenderView`) to add and remove `RenderView`s that then will be MANAGED by the binding. The `RenderView` itself is now owned by a higher-level abstraction (e.g. the `RawView` Element of the widgets layer, see below), who is also in charge of adding it to the binding. When added, the binding will interact with the `RenderView` to produce a frame (e.g. by calling `compositeFrame` on it) and to perform hit tests for incoming pointer events. Multiple `RenderView`s can be added to the binding (typically one per `FlutterView`) to produce multiple Scenes. * Instead of owning a single `pipelineOwner`, the `RendererBinding` now owns the root of the `PipelineOwner` tree (exposed as `rootPipelineOwner` on the binding). Each `PipelineOwner` in that tree (except for the root) typically manages its own render tree typically rooted in one of the `RenderView`s mentioned in the previous bullet. During frame production, the binding will instruct each `PipelineOwner` of that tree to flush layout, paint, semantics etc. A higher-level abstraction (e.g. the widgets layer, see below) is in charge of adding `PipelineOwner`s to this tree. * Backwards compatibility: The old `renderView` and `pipelineOwner` properties of the `RendererBinding` are retained, but marked as deprecated. Care has been taken to keep their original behavior for the deprecation period, i.e. if you just call `runApp`, the render tree bootstrapped by this call is rooted in the deprecated `RendererBinding.renderView` and managed by the deprecated `RendererBinding.pipelineOwner`. ### Widgets layer changes * The `WidgetsBinding` no longer attaches the widget tree to an existing render tree. Instead, it bootstraps a stand-alone widget tree that is not backed by a render tree. For this, `RenderObjectToWidgetAdapter` has been replaced by `RootWidget`. * Multiple render trees can be bootstrapped and attached to the widget tree with the help of the `View` widget, which internally is backed by a `RawView` widget. Configured with a `FlutterView` to render into, the `RawView` creates a new `PipelineOwner` and a new `RenderView` for the new render tree. It adds the new `RenderView` to the `RendererBinding` and its `PipelineOwner` to the pipeline owner tree. * The `View` widget can only appear in certain well-defined locations in the widget tree since it bootstraps a new render tree and does not insert a `RenderObject` into an ancestor. However, almost all Elements expect that their children insert `RenderObject`s, otherwise they will not function properly. To produce a good error message when the `View` widget is used in an illegal location, the `debugMustInsertRenderObjectIntoSlot` method has been added to Element, where a child can ask whether a given slot must insert a RenderObject into its ancestor or not. In practice, the `View` widget can be used as a child of the `RootWidget`, inside the `view` slot of the `ViewAnchor` (see below) and inside a `ViewCollection` (see below). In those locations, the `View` widget may be wrapped in other non-RenderObjectWidgets (e.g. InheritedWidgets). * The new `ViewAnchor` can be used to create a side-view inside a parent `View`. The `child` of the `ViewAnchor` widget renders into the parent `View` as usual, but the `view` slot can take on another `View` widget, which has access to all inherited widgets above the `ViewAnchor`. Metaphorically speaking, the view is anchored to the location of the `ViewAnchor` in the widget tree. * The new `ViewCollection` widget allows for multiple sibling views as it takes a list of `View`s as children. It can be used in all the places that accept a `View` widget. ## Google3 As of July 5, 2023 this change passed a TAP global presubmit (TGP) in google3: tap/OCL:544707016:BASE:545809771:1688597935864:e43dd651 ## Note to reviewers This change is big (sorry). I suggest focusing the initial review on the changes inside of `packages/flutter` first. The majority of the changes describe above are implemented in (listed in suggested review order): * `rendering/binding.dart` * `widgets/binding.dart` * `widgets/view.dart` * `widgets/framework.dart` All other changes included in the PR are basically the fallout of what's implemented in those files. Also note that a lot of the lines added in this PR are documentation and tests. I am also very happy to walk reviewers through the code in person or via video call, if that is helpful. I appreciate any feedback. ## Feedback to address before submitting ("TODO")
-
Taha Tesser authored
This relands https://github.com/flutter/flutter/pull/130414 (which was reverted in https://github.com/flutter/flutter/pull/130578)
-
Taha Tesser authored
Fix `DatePicker` uses incorrect overlay color from `DatePickerTheme` and add missing tests (#130584) fixes [YearPickerState in calendar_date_picker is using dayOverlayColor instead of yearOverlayColor](https://github.com/flutter/flutter/issues/130051) ### Description - Fix year selection uses incorrect overlay color from `DatePickerTheme` - Update defaults tests to check for overlay color for different modes - Add tests to check overlay color is resolved. ### Code sample <details> <summary>expand 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( theme: ThemeData( datePickerTheme: const DatePickerThemeData( yearOverlayColor: MaterialStatePropertyAll<Color>(Colors.green), dayOverlayColor: MaterialStatePropertyAll<Color>(Colors.amber), ), useMaterial3: true, ), home: Directionality( textDirection: TextDirection.ltr, child: Material( child: Center( child: DatePickerDialog( initialDate: DateTime(2023, DateTime.january, 25), firstDate: DateTime(2022), lastDate: DateTime(2024, DateTime.december, 31), currentDate: DateTime(2023, DateTime.january, 24), ), ), ), ), ); } } ``` </details> ```dart yearOverlayColor: MaterialStatePropertyAll<Color>(Colors.green), dayOverlayColor: MaterialStatePropertyAll<Color>(Colors.red), ``` ### Before  ### After 
-
Qun Cheng authored
Updated unit tests for `DropdownMenu`, `SnackBarTheme` and `Stepper` to have M2 and M3 versions. More info in #127064
-
- 14 Jul, 2023 5 commits
-
-
LongCatIsLooong authored
-
Polina Cherkasova authored
-
Zachary Anderson authored
Reverts flutter/flutter#130414 Skia gold failures https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20framework_tests_libraries/11972/overview
-
Taha Tesser authored
Updated unit tests for `DialogTheme` to have M2 and M3 versions. More info in https://github.com/flutter/flutter/pull/128725
-
lsaudon authored
If the margin is used, set the `HitTestBehavior` to `deferToChild`. *List which issues are fixed by this PR. You must list at least one issue.* #78537 #114810 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
-