Move padding on uniform list inside the scrollable area

This commit is contained in:
Conrad Irwin 2023-11-29 10:05:31 -07:00
parent 5d59108b97
commit 35481e2c79
2 changed files with 4 additions and 6 deletions

View file

@ -173,7 +173,7 @@ impl Element for UniformList {
let item_size = element_state.item_size; let item_size = element_state.item_size;
let content_size = Size { let content_size = Size {
width: padded_bounds.size.width, width: padded_bounds.size.width,
height: item_size.height * self.item_count, height: item_size.height * self.item_count + padding.top + padding.bottom,
}; };
let shared_scroll_offset = element_state let shared_scroll_offset = element_state
@ -221,9 +221,7 @@ impl Element for UniformList {
let items = (self.render_items)(visible_range.clone(), cx); let items = (self.render_items)(visible_range.clone(), cx);
cx.with_z_index(1, |cx| { cx.with_z_index(1, |cx| {
let content_mask = ContentMask { let content_mask = ContentMask { bounds };
bounds: padded_bounds,
};
cx.with_content_mask(Some(content_mask), |cx| { cx.with_content_mask(Some(content_mask), |cx| {
for (item, ix) in items.into_iter().zip(visible_range) { for (item, ix) in items.into_iter().zip(visible_range) {
let item_origin = padded_bounds.origin let item_origin = padded_bounds.origin

View file

@ -205,7 +205,6 @@ impl<D: PickerDelegate> Render for Picker<D> {
.when(self.delegate.match_count() > 0, |el| { .when(self.delegate.match_count() > 0, |el| {
el.child( el.child(
v_stack() v_stack()
.p_1()
.grow() .grow()
.child( .child(
uniform_list( uniform_list(
@ -239,7 +238,8 @@ impl<D: PickerDelegate> Render for Picker<D> {
} }
}, },
) )
.track_scroll(self.scroll_handle.clone()), .track_scroll(self.scroll_handle.clone())
.p_1()
) )
.max_h_72() .max_h_72()
.overflow_hidden(), .overflow_hidden(),