-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
Feat: Add yearShape property to DatePickerThemeData #163909
base: master
Are you sure you want to change the base?
Conversation
511d91d
to
fd0d544
Compare
de44e9b
to
793d8eb
Compare
@@ -944,6 +975,9 @@ class _DatePickerDefaultsM2 extends DatePickerThemeData { | |||
elevation: 24.0, | |||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4.0))), | |||
dayShape: const MaterialStatePropertyAll<OutlinedBorder>(CircleBorder()), | |||
yearShape: const MaterialStatePropertyAll<OutlinedBorder>( | |||
RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(28.0))), |
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 suspect that this probably changes the default shape. The default shape is always a pill shape, which has borderRadius equal to half the height. Using a fixed border radius here should result in a different shape if textScaleFactor
is customized.
I think StadiumBorder
should work.
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.
Correct, previously borderRadius was equal to half the height. So, I will use StadiumBorder
instead.
@@ -944,6 +975,9 @@ class _DatePickerDefaultsM2 extends DatePickerThemeData { | |||
elevation: 24.0, | |||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4.0))), | |||
dayShape: const MaterialStatePropertyAll<OutlinedBorder>(CircleBorder()), | |||
yearShape: const MaterialStatePropertyAll<OutlinedBorder>( | |||
RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(28.0))), | |||
), |
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.
Also if the comment above is true, can you add a test case to verify that the default year shape is kept with a different textScaleFactor
(likely by verifying the drawRRect
operation)?
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.
Sure.
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.
@dkwingsmt I have pushed the change. Since i have made it StadiumBorder
. It's respecting border radius based on that. Also as you noted, I have written test for that.
551cd89
to
1fd5613
Compare
@@ -67,7 +67,7 @@ | |||
"md.comp.date-picker.modal.year-selection.year.selected.label-text.color": "onPrimary", | |||
"md.comp.date-picker.modal.year-selection.year.selected.pressed.state-layer.color": "onPrimary", | |||
"md.comp.date-picker.modal.year-selection.year.state-layer.height": 36.0, | |||
"md.comp.date-picker.modal.year-selection.year.state-layer.shape": "md.sys.shape.corner.full", | |||
"md.comp.date-picker.modal.year-selection.year.state-layer.shape": "md.sys.shape.corner.extra-large", |
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.
Why is this needed?
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.
Its not, removing now.
@@ -1206,4 +1205,67 @@ void main() { | |||
); | |||
} | |||
}); | |||
|
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 you also add a test to verify that assigning yearShape
works?
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.
Sure
Also analyzer error:
|
aaea387
to
7f31721
Compare
7f31721
to
911ef06
Compare
Feat: Add yearShape property to DatePickerThemeData
fixes: #163340
Pre-launch Checklist
///
).