Skip to content
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 docs for {base_,}style Decorators #92

Merged
merged 1 commit into from
Aug 20, 2023
Merged

Conversation

MinusGix
Copy link
Member

I kept putting this off due to wanting to write more documentation past them, but I decided to just PR these rather than wait until I got around to that.
This just adds some basic example documentation to style/base_style

/// # use floem::{peniko::Color, view::View, views::{Decorators, label, stack}};
/// fn view() -> impl View {
/// label(|| "Hello".to_string())
/// .style(|| Style::default().font_size(20.0).color(Color::RED))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be base_style here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's intended to show how style behaves if you use it on a view that's returned, to give an illustration of what goes wrong.
(Though I could see that as potentially being confusing, so perhaps it should just be the note?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah got you.

Yeah maybe move "If you are returning from a function that produces a view, you may want to use base_style for the returned [View] instead. " under the code example.

@dzhou121 dzhou121 merged commit ec72fe0 into lapce:main Aug 20, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants