Allow to scroll compare table

This commit is contained in:
traxys 2023-12-08 16:09:00 +01:00
parent 51693b3894
commit 984e3a5be5

View file

@ -1,13 +1,16 @@
use std::{collections::BTreeMap, cmp::Ordering, iter};
use std::{cmp::Ordering, collections::BTreeMap, iter};
use iced::{
widget::{column, component, row, text, Row, horizontal_rule, Column, vertical_rule, container, button},
widget::{
button, column, component, container, horizontal_rule, row, scrollable, text,
vertical_rule, Column, Row,
},
Alignment, Length, Renderer,
};
use iced_aw::{selection_list, card, modal};
use iced_aw::{card, modal, selection_list};
use itertools::Itertools;
use crate::{CompareLoad, CompareSide, ReportDate, Spendings, TEXT_H2, TEXT_H1, TEXT_EMPH2};
use crate::{CompareLoad, CompareSide, ReportDate, Spendings, TEXT_EMPH2, TEXT_H1, TEXT_H2};
pub(crate) struct Compare<F> {
pub left: Option<(CompareLoad, Box<dyn Spendings>)>,
@ -243,7 +246,7 @@ where
compare
}
table::<_, _, iced::Element<_>, _>(
scrollable(table::<_, _, iced::Element<_>, _>(
properties,
itertools::chain![
iter::once(headings),
@ -252,7 +255,7 @@ where
iter::once(mk_section("Variable")),
item_compare(left.map(|r| r.variable()), right.map(|r| r.variable())),
],
)
))
.into()
}
}
@ -294,7 +297,7 @@ where
.zip(props.iter())
.map(|(col, prop)| {
Column::with_children(col)
.height(Length::Fill)
.height(Length::Shrink)
.width(prop.width)
.max_width(prop.max_width)
.align_items(prop.align)
@ -302,8 +305,9 @@ where
})
.intersperse_with(|| {
container(vertical_rule(0.))
.height(Length::Fill)
.width(Length::Shrink)
.max_height(1000.0)
.height(Length::Fill)
.center_y()
.into()
})