diff options
author | 2024-02-21 08:43:27 +0100 | |
---|---|---|
committer | 2024-02-21 08:43:27 +0100 | |
commit | 56ac21cacbead255c6ae574ed2b7ba2895018c56 (patch) | |
tree | 89d146cb74335c4f479d5f2cd013930af47f9c37 /examples/component/src | |
parent | 5ba818a13aa99aa6bf00e360f68140b6df2d270f (diff) | |
parent | 28f0eccd8164985ea6a72b976b7b09ae81fb76ac (diff) | |
download | iced-56ac21cacbead255c6ae574ed2b7ba2895018c56.tar.gz iced-56ac21cacbead255c6ae574ed2b7ba2895018c56.tar.bz2 iced-56ac21cacbead255c6ae574ed2b7ba2895018c56.zip |
Merge pull request #2275 from iced-rs/component-size-hint
`size_hint` method for `Component` trait
Diffstat (limited to 'examples/component/src')
-rw-r--r-- | examples/component/src/main.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/component/src/main.rs b/examples/component/src/main.rs index 81be4d7f..4670824d 100644 --- a/examples/component/src/main.rs +++ b/examples/component/src/main.rs @@ -48,7 +48,7 @@ impl Sandbox for Component { mod numeric_input { use iced::alignment::{self, Alignment}; use iced::widget::{button, component, row, text, text_input, Component}; - use iced::{Element, Length}; + use iced::{Element, Length, Size}; pub struct NumericInput<Message> { value: Option<u32>, @@ -143,6 +143,13 @@ mod numeric_input { .spacing(10) .into() } + + fn size_hint(&self) -> Size<Length> { + Size { + width: Length::Fill, + height: Length::Shrink, + } + } } impl<'a, Message> From<NumericInput<Message>> for Element<'a, Message> |