-
Notifications
You must be signed in to change notification settings - Fork 128
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
Add round scroll bar option #96
Conversation
Maybe let's create a |
I think this is good. I don't love having to import ScrollBarStyle and create a new instance of it to add it to the function. Something SwiftUI-esque like .scroll_bar_style( || .color(Color::GREEN) ) would be nice but I don't know of any way to do this so I think this is good enough |
I guess this is possible... pub fn scroll_bar_style(
self,
style: impl Fn(ScrollBarStyle) -> ScrollBarStyle + 'static,
) -> Self {
let id = self.id;
create_effect(move |_| {
let style = style(ScrollBarStyle::BASE);
id.update_state(UpdateState::Style(style), false);
});
self
} and then .scroll_bar_style(|base| base.color(custom_scroll_bar_color())) |
I actually really quite like this for styles. Would actually be a nice way to do View styles as well |
#97 affects how this pr is viewed |
I agree. This is very nice. We could do the same for view style. |
On the scroll bar style, I feel like we need to put it in the view style and let it affect child views like the way font size does. So that you can only specify it once at the root. Still you have the ability to customise it at a child view. |
Ok. Looks like that's done by adding a current / saved value to the paint and a layout contexts? |
Yes. |
And when adding these to the view style should we keep them together (in a ScrollBarStyle) struct or separate them? Together seems better for the implementation but it'll be ugly to use |
Feels like we should seperate them since all other styles are "flat". |
Minimal testing but does seem to work with applying to child views and overrides also work.This also switches the |
This adds the option for a scroll bar to be rounded and makes that the default on macOS
Update: this now also