Closed airblast-dev closed 2 months ago
Thats a good point, thx. I am with you, implementing Styled sounds better, it stays closer to the ratatui std lib.
Feel free to open a PR! Otherwise I will do so in the next days
Will do!
Hey, once you've implemented this, if you're keen to contribute back to Ratatui, this might make a good recipe for the Ratatui website. https://ratatui.rs/recipes/
@airblast-dev you mentioned in your PR
Didn't need to remove List::style as ratatui seperates Styled, and Stylize traits which means only people who are implementing Styled and using the List::style method in the same module may be affected.
What exactly did you mean with that? Cause I dont see any breaking change from you changes. The orphan rule prevents that people implement Styled for List
Yes you are correct. There shouldn't any breaking changes.
Didn't need to remove List::style as ratatui seperates Styled, and Stylize traits which means only people who are implementing Styled and using the List::style method in the same module may be affected.
If I remember correctly, I meant a conflict between Styled::style
, and List::style
if Styled
was in scope. Though I just checked, and it isn't an issue so there shouldn't be any breaking changes.
published it as v0.10.1
Currently the List widget provides a
style
method that takes in a style. This can often result in boiler plate code when a user wants to only set a single field since they would have to use theFrom<_>
to constructStyle
on everyList::style
call.Simplest approach is to make
List::style
take a generic such asInto<Style>
and just callInto::into
when assigning. This would move any from/into calls in the method.However even better, we could implement Styled which provides various ease of use methods related to styling, and would allow a user to make a styling function that takes in a
Styled
that can be used onList
. Since there is an existingstyle
method this causes conflicts, and the user has to call the method via their fully qualified syntax (Self::style
orStyled::style
). Which makes this a breaking change. MaybeList::style
could be removed and replaced withStyled::set_style
, along-side a major version change?