Repository navigation
Fix todayBorder color being overridden by todayForegroundColor in YearPicker - #189345
Massinissa-Mouhoub wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the _YearPickerState to respect a custom, non-transparent todayBorder color over the foreground color, falling back to the foreground color if the border is transparent. It also adds corresponding regression tests. Feedback on the tests identifies an issue where the currentDate (2016) is set before the firstDate (2018) in a test case, which prevents the year 2016 from being rendered in the YearPicker grid and will cause the test to fail.
e24c1c8 to
9d7208c
Compare
QuncCccccc
left a comment
There was a problem hiding this comment.
The code change looks good! Thanks a lot for your contribution.
Could you also update the PR description so it can be a bit more accurate. For example, in the sample code, the custom border color seems should be red to match the "After" screenshot. Also "since it's the same fix as #163909." seems the link should be #178792
| } | ||
|
|
||
| // Regression test for https://github.com/flutter/flutter/issues/189298 | ||
| testWidgets('Non-null todayBorder color should be respected over foreground color', ( |
There was a problem hiding this comment.
| testWidgets('Non-null todayBorder color should be respected over foreground color', ( | |
| testWidgets('Non-null todayBorder color should be respected over todayBackgroundColor', ( |
| borderSide = borderSide.copyWith(color: textColor); | ||
| } | ||
| final bool hasCustomBorderColor = | ||
| datePickerTheme.todayBorder != null && datePickerTheme.todayBorder!.color.opacity != 0.0; |
There was a problem hiding this comment.
Maybe consider to update the doc for datePickerTheme.todayBorder to mention yearpicker as well.
| const localizations = DefaultMaterialLocalizations(); | ||
| final initialDate = DateTime(2016, DateTime.january, 15); | ||
| DateTime? selectedDate; | ||
| testWidgets('Selected date Semantics announcement on onDateChanged', ( |
There was a problem hiding this comment.
Seems there are a bunch of reformatting changes. Can we try to rebase master and see if the formatting issues can be fixed?
- Revert unrelated dart format churn in the Semantics announcement tests so the diff only contains the year picker changes. - Rename the year picker regression test to reflect the todayBackgroundColor case. - Document that DatePickerThemeData.todayBorder also applies to the year selector, not just the day grid.
|
@QuncCccccc I applied your comments please check. I still notice formatting issues, but I don't know if I should keep it like this or revert tbh. |
I think it would be better if we can revert these unrelated changes. Do you need any help? I can push a commit to revert them if that helps. |
I think I fixed those formatting issues 🤞🤞, @QuncCccccc please check. |
|
@QuncCccccc what about now ? |
|
@QuncCccccc, could you please add autosubmit to this PR since it's been approved? |
|
@dkwingsmt @QuncCccccc I believe this PR needs |
|
Yes it is! I was waiting for a final round of CI check. Here you go. Thanks for your contribution! This PR has reached completion, however we're not able to merge this PR for the moment due to the Material/Cupertino code freeze (#184093). As soon as the decoupling is complete, we will post a way to port this PR to the new packages to land. In the meantime, I'll convert this PR to a draft and apply a label so that we can quickly find it when the freeze is lifted. |
|
Since decoupling has finished (congratulations 🎉) I was wondering what is the next step for this PR and this PR. |
|
Hi @Massinissa-Mouhoub! Yes! Material_ui and Cupertino_ui start to accept contributions. Guidance and instructions for easily porting over can be found in #188444. When the port PR is ready, feel free to close this PR:) Thank you! |
|
@QuncCccccc @dkwingsmt This PR has been ported: flutter/packages#12697, please check it. |
…roundColor` in `YearPicker` (#12697) This PR ports flutter/flutter#189345 from flutter/flutter to flutter/packages, as part of flutter/flutter#188444. Fixes flutter/flutter#189298 ## Pre-Review Checklist

The current-year item in
YearPickeralways overrode the color ofDatePickerThemeData.todayBorderwith the resolved foreground color, so a custom border color set in the theme was ignored. This was already fixed forthe day grid in #177911, but the year selector still had the old behavior.This PR applies the same color resolution to the year picker as the day picker: the border's own color is used when it is non-transparent, otherwise it falls back to
todayForegroundColor.Before / after with:
Added regression tests covering:
todayBordercolor is respected over the foreground color,todayBordercolor falls back totodayForegroundColor.Fixes #189298
Please @dkwingsmt review this since it's the same fix as #178792.
Pre-launch Checklist
///).