Skip to content

Commit

Permalink
Provide State reference instead of closure to pick_list::draw
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Feb 14, 2023
1 parent bbff06b commit fee1ab6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions native/src/widget/pick_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ where
self.selected.as_ref(),
&self.handle,
&self.style,
|| tree.state.downcast_ref::<State<T>>(),
tree.state.downcast_ref::<State<T>>(),
)
}

Expand Down Expand Up @@ -593,13 +593,12 @@ pub fn draw<'a, T, Renderer>(
selected: Option<&T>,
handle: &Handle<Renderer::Font>,
style: &<Renderer::Theme as StyleSheet>::Style,
state: impl FnOnce() -> &'a State<T>,
state: &State<T>,
) where
Renderer: text::Renderer,
Renderer::Theme: StyleSheet,
T: ToString + 'a,
{
let state = state();
let bounds = layout.bounds();
let is_mouse_over = bounds.contains(cursor_position);
let is_selected = selected.is_some();
Expand Down

0 comments on commit fee1ab6

Please sign in to comment.