Skip to content

Commit f9f2776

Browse files
committed
Always set maximum scrollable height for open with dialog, fixes #1229
1 parent 52d0586 commit f9f2776

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/app.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5224,22 +5224,20 @@ impl Application for App {
52245224
.secondary_action(
52255225
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
52265226
)
5227-
.control(
5228-
widget::scrollable(column).height(if let Some(size) = self.size {
5229-
let max_size = (size.height - 256.0).min(480.0);
5230-
// (32 (item_height) + 5.0 (custom button padding)) + (space_xxs (list item spacing) * 2)
5231-
let scrollable_height = available_apps.len() as f32
5232-
* (item_height + 5.0 + (2.0 * space_xxs as f32));
5233-
5234-
if scrollable_height > max_size {
5235-
Length::Fixed(max_size)
5236-
} else {
5237-
Length::Shrink
5238-
}
5227+
.control(widget::scrollable(column).height({
5228+
let max_size = self
5229+
.size
5230+
.map_or(480.0, |size| (size.height - 256.0).min(480.0));
5231+
// (32 (item_height) + 5.0 (custom button padding)) + (space_xxs (list item spacing) * 2)
5232+
let scrollable_height = available_apps.len() as f32
5233+
* (item_height + 5.0 + (2.0 * space_xxs as f32));
5234+
5235+
if scrollable_height > max_size {
5236+
Length::Fixed(max_size)
52395237
} else {
5240-
Length::Fill
5241-
}),
5242-
);
5238+
Length::Shrink
5239+
}
5240+
}));
52435241

52445242
if let Some(app) = store_opt {
52455243
dialog = dialog.tertiary_action(

0 commit comments

Comments
 (0)