Skip to content

How to apply a style to a container #1266

Answered by 13r0ck
KiraResari asked this question in Q&A
Discussion options

You must be logged in to vote

The error is saying you haven’t implemented ‘style’ correctly.

Implementing a style has quite some boiler plate.
https://github.com/iced-rs/iced/blob/master/examples/styling/src/main.rs#L157

or if the light/dark is confusing here is an example from a personal project
https://github.com/13r0ck/bathtub/blob/main/src/style.rs

Basically your style needs to implement ‘From’ for each widget you want to put it on, then that let’s rust “find” the right value for each widget, which you then you can implement the style sheet for each widget

https://github.com/13r0ck/bathtub/blob/main/src/style.rs#L125

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@KiraResari
Comment options

@patientplatypus6
Comment options

@KiraResari
Comment options

Answer selected by KiraResari
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants