-
I checked the examples of the crate, tour had a text input that was adding it's value to a text element, I'm interested in how does the text element scroll when the text overflows, because it doesn't behave like that when I do it, it just wraps to a new line my view
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Text wraps by default. The only way to get it to "scroll" is by using the text input. If you just want it to be cut off on a single row of text, you can make the following change: fn view(&mut self) -> Element<'_, Self::Message> {
container::Container::new(
Text::new(&self.key).height(iced::Length::Units(20))
)
.width(iced::Length::Fill)
.height(iced::Length::Fill)
.center_x()
.into()
} Iced uses default font size of 20. Match the height of the |
Beta Was this translation helpful? Give feedback.
Text wraps by default. The only way to get it to "scroll" is by using the text input. If you just want it to be cut off on a single row of text, you can make the following change:
Iced uses default font size of 20. Match the height of the
Text
widget with the font size so it doesn't wrap.