-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Normalize input decoration theme #168981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normalize input decoration theme #168981
Conversation
|
@QuncCccccc This PR sets Because, |
7e4398b to
520a3d9
Compare
|
I think we can leave it for now until we decided to clean up the properties in |
e87d275 to
02b9d21
Compare
QuncCccccc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me! Thanks so much for working on this big theme! Just left some comments, please let me know if you have any thoughts on them:)
| /// Overrides the [InputDatePickerFormField]'s input decoration theme. | ||
| /// If this is null, [ThemeData.inputDecorationTheme] is used instead. | ||
| final InputDecorationTheme? inputDecorationTheme; | ||
| final InputDecorationThemeData? inputDecorationTheme; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not sure if we should change the parameter type here because it may introduce more breaking changes. Do you think if it would be better to change the type when we are really removing the properties in InputDecorationTheme?
Similar for other widgets, just feel these public apis may cause too many breaking changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I reverted this changes and just kept the ThemeData.inputDecorationTheme change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was adding g3fix for this PR and noticed for this property and DropdownMenu.inputDecorationTheme, several usages are: ThemeData.inputDecorationTheme.copyWith() so with the changes in PR, breaking changes happened. Do you think if we should change both type to Object so the commonly-used cases can be accepted? Also once the normalization is done, we actually should deprecate these properties because at that time, developers can wrap the widget with InputDecorationTheme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed both types to Object? in the last commit, seems reasonable.
Let me know if it helps with g3 fix.
673b58e to
06d1336
Compare
a08dca9 to
6d5b2f4
Compare
80609ec to
32f1bd0
Compare
QuncCccccc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks great! Thank you!
| const String twoLines = 'line1\nline2'; | ||
| const String threeLines = 'line1\nline2\nline3'; | ||
|
|
||
| Widget buildInputDecorator({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test to check if a local InputDecorationTheme can override the themedata.inputDecortationTheme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I missed that. It will required several changes as the current implementation as many references to Theme.of(context).inputDecorationTheme.
For the test, I will create a group because there are many properties and combinations to test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a group to test that most of the properties can be overridden with a local theme.
Some properties are missing because there are no M3 tests for them. To make it easier to track this work, I will filed other PRs to add the missing M3 tests and, when needed, fix the implementation if it does not use the local theme properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Some properties are missing because there are no M3 tests for them. To make it easier to track this work, I will filed other PRs to add the missing M3 tests
We don't need to add the M3 tests if M3 didn't specify the property in defaults. It would be fine as long as we can make sure the properties works when we use them in a local InputDecorationThemeData.
when needed, fix the implementation if it does not use the local theme properly.
Does this mean that some properties don't work in a InputDecorationThemeData? If so, maybe we should not add them in InputDecorationThemeData.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrating InputDecoration tests to M3 is still a work in a progress. This is why some properties are missing existing M3 tests.
To correctly check that the local theme properly work for those properties I would first have to add tests that check if the general theme is working for those properties (hopefully most of them are probably ok, otherwise we would have get some reports).
My problem is that I prefer to do that in separate PRs as it becomes difficult to track changes in this PR, and It would be more revert proof.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. Yeah, separating PRs makes sense to me!
32f1bd0 to
4e17bec
Compare
…ter#171584) ## Description This PR is similar to what was done for `DatePickerThemeData` in flutter#168981. It changes `TimePickerThemeData.inputDecorationTheme` type to `InputDecorationThemeData` (instead of `InputDecorationTheme`) and uses Object? for the corresponding constructor parameter. ## Tests Adds 1 test
## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `TextFormField` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to #168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [TextFormField does not inherit local InputDecorationTheme](#176391) ## Tests - Adds 1 test
…r#176397) ## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `TextFormField` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to flutter#168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [TextFormField does not inherit local InputDecorationTheme](flutter#176391) ## Tests - Adds 1 test
…r#176397) ## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `TextFormField` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to flutter#168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [TextFormField does not inherit local InputDecorationTheme](flutter#176391) ## Tests - Adds 1 test
…me (#176564) ## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `DropdownButtonFormField` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to #168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [DropdownButtonFormField does not inherit local InputDecorationTheme](#176561) ## Tests - Adds 1 test
## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `TextField` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to #168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [[SearchBar] Inconsistent inheritance of InputDecorationTheme](#176198) ## Tests - Adds 1 test - Updates 1 test
…#177086) ## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `DateRangePickerDialog` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to #168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [DateRangePickerDialog does not inherit local InputDecorationTheme](#177083) ## Tests - Adds 1 test
…eme (#177090) ## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `InputDatePickerFormField` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to #168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [InputDatePickerFormField does not inherit local InputDecorationTheme](#177088) ## Tests - Adds 1 test
…ter#170903) ## Description This PR adds missing M3 tests for InputDecoration.floatingLabelAlignment. ## Related Issue Will help to complete flutter#168981 ## Tests Adds 8 tests (based on existing M2 tests).
) ## Description This PR adds tests for `InputDecorationThemeData.floatingLabelBehavior`, `InputDecorationThemeData.floatingLabelAlignment`, and `InputDecorationThemeData.contentPadding`. ## Related Issue Related to flutter#168981 ## Tests Adds 3 tests, moves one.
…ter#171584) ## Description This PR is similar to what was done for `DatePickerThemeData` in flutter#168981. It changes `TimePickerThemeData.inputDecorationTheme` type to `InputDecorationThemeData` (instead of `InputDecorationTheme`) and uses Object? for the corresponding constructor parameter. ## Tests Adds 1 test
…lutter#175838) ## Description This PR adds tests for `InputDecorationThemeData` border related properties. It also adds some missing M3 tests for those same properties. ## Related Issue Related to flutter#168981 ## Tests Adds 10 tests.
…r#176397) ## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `TextFormField` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to flutter#168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [TextFormField does not inherit local InputDecorationTheme](flutter#176391) ## Tests - Adds 1 test
…me (flutter#176564) ## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `DropdownButtonFormField` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to flutter#168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [DropdownButtonFormField does not inherit local InputDecorationTheme](flutter#176561) ## Tests - Adds 1 test
…6300) ## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `TextField` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to flutter#168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [[SearchBar] Inconsistent inheritance of InputDecorationTheme](flutter#176198) ## Tests - Adds 1 test - Updates 1 test
…flutter#177086) ## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `DateRangePickerDialog` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to flutter#168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [DateRangePickerDialog does not inherit local InputDecorationTheme](flutter#177083) ## Tests - Adds 1 test
…eme (flutter#177090) ## Description This PR replaces global `ThemeData.inputDecorationTheme` usage in `InputDatePickerFormField` with `InputDecorationTheme.of ` which returns the ambient `InputDecorationTheme`. It is a follow up to flutter#168981 which introduces `InputDecorationTheme.of `. ## Related Issue Fixes [InputDatePickerFormField does not inherit local InputDecorationTheme](flutter#177088) ## Tests - Adds 1 test
This PR is to make
InputDecorationThemeconform to Flutter Material's conventions for component themes:InputDecorationThemeDataclass which defines overrides for the defaults forInputDecoratorproperties.InputDecorationThemeconstructor parameters:InputDecorationThemeData? dataandWidget? child. This is now the preferred way to configure aInputDecorationTheme:These two properties are made nullable to not break existing apps which has customized
ThemeData.inputDecorationTheme.InputDecorationThemeto be anInheritedThemesubclass.InputDecorationThemetoInputDecorationThemeData.InputDecorationTheme bottomAppBarThemeproperty toObject? bottomAppBarThemeinThemeDataandThemeData.copyWith()(Object? is used for the moment to minimize Google tests failure. A follow-up PR will replaceObject?withInputDecorationThemeData.A migration guide will be created on website repo.