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
Introduce new Slider
shapes
#147783
base: master
Are you sure you want to change the base?
Introduce new Slider
shapes
#147783
Conversation
3fc68e1
to
dc1178f
Compare
dc1178f
to
b1710e7
Compare
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.
Nice work, just a general comment, I think we should make it easier to use the new shapes, since they will become the new default. Rather than manually specifying them, developers could flip a flag on ThemeData
.
Interesting idea, tho this is only specific to |
Perhaps |
Added |
b1710e7
to
bb9d19d
Compare
@guidezpl |
bb9d19d
to
732076d
Compare
732076d
to
428389a
Compare
This PR #148789 removes the tokens for current M3 defaults so I will update the new shapes to use new the tokens and restore deleted token values as we plan to keep the current M3 shapes under the new flag. |
bf932aa
to
260bd1a
Compare
260bd1a
to
745acf8
Compare
Updated the PR to use new tokens, restored the current M3 defaults, and made minor improvements. |
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.
nice! looking for a second review
@override | ||
Color? get inactiveTickMarkColor => ${componentColor('$tokenGroup.with-tick-marks.inactive.container')}; | ||
// TODO(tahatesser): Update this hard-coded value to use the correct token value. | ||
Color? get inactiveTickMarkColor => _colors.primary; |
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 think this token is available
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 checked, it seems incorrect it uses secondary container color which makes inactive tick marks invisible on the inactive track. I will file an issue as this lands.
double? get trackGapSize => 6.0; | ||
} | ||
|
||
/// The default [SliderThemeData] for the legacy Material 3 slider. |
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.
nit: please clarify that legacy = first version of the M3 slider and that the look has been updated this year
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.
Updated
/// the default gap size is 6 pixels. | ||
final double? trackGapSize; | ||
|
||
/// A temporary flag that can be used to opt-in to the new 2024 slider shapes. |
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.
nit: please indicate that this flag is intended to migrate usages, after which it will be defaulted to true in a breaking change, and subsequently removed.
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.
Updated
fixes Update
Slider
for Material 3 redesignDescription
This PR adds new
Slider
shapesBarSliderThumbShape
,ExpressiveRoundedRectSliderTrackShape
, andRoundedRectSliderValueIndicatorShape
which are enabled when using the newSliderThemeData.use2024SliderShapes
flag.Preview
New shapes when dragged
Record_2024-05-03-17-12-14.mp4
Record_2024-05-03-17-12-28.mp4
Stop indicator in the
RoundedRectSliderValueIndicatorShape
track shapestop_indicator.mov
trackGapSize
set to0
trackGapSize
&barThumbSize
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.