I've noticed that the Scrollable widget on iced_web applies max_with to it's content, but not on itself. Which results in having the width of the scrollable DIV to not being limited by the maximum width.
This is a different behavior than iced_native.
Code to reproduce:
use iced::{
scrollable, Container, Element, Length, Sandbox, Scrollable,
Settings, Text
};
fn main() -> iced::Result {
ScrollTest::run(Settings::default())
}
struct ScrollTest {
state: scrollable::State,
}
#[derive(Clone, Debug)]
enum Message {}
impl Sandbox for ScrollTest {
type Message = Message;
fn new() -> Self {
ScrollTest {
state: scrollable::State::new(),
}
}
fn title(&self) -> String {
String::from("Scrollable Test")
}
fn update(&mut self, _: Self::Message) { }
fn view(&mut self) -> Element<'_, Self::Message> {
Container::new(
Scrollable::new(&mut self.state)
.max_width(600)
.push(Text::new("This is a line").width(Length::Fill))
.push(Text::new("This is a line").width(Length::Fill))
.push(Text::new("This is a line").width(Length::Fill))
.push(Text::new("This is a line").width(Length::Fill))
.push(Text::new("This is a line").width(Length::Fill))
.push(Text::new("This is a line").width(Length::Fill))
.push(Text::new("This is a line").width(Length::Fill))
)
.center_x()
.center_y()
.width(Length::Fill)
.height(Length::Fill)
.into()
}
}
Hello,
I've noticed that the
Scrollable
widget oniced_web
appliesmax_with
to it's content, but not on itself. Which results in having the width of the scrollableDIV
to not being limited by the maximum width.This is a different behavior than
iced_native
.Code to reproduce:
iced_native
on Linux:iced_web
without maximum width:iced_web
with maximum width: