diff options
Diffstat (limited to 'native/src/widget/text_input.rs')
-rw-r--r-- | native/src/widget/text_input.rs | 89 |
1 files changed, 34 insertions, 55 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 84d171be..fe95eb95 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -170,38 +170,39 @@ where layout: Layout<'_>, cursor_position: Point, value: Option<&Value>, - ) -> Renderer::Output { - let value = value.unwrap_or(&self.value); - let bounds = layout.bounds(); - let text_bounds = layout.children().next().unwrap().bounds(); - - if self.is_secure { - self::Renderer::draw( - renderer, - bounds, - text_bounds, - cursor_position, - self.font, - self.size.unwrap_or(renderer.default_size()), - &self.placeholder, - &value.secure(), - &self.state, - &self.style, - ) - } else { - self::Renderer::draw( - renderer, - bounds, - text_bounds, - cursor_position, - self.font, - self.size.unwrap_or(renderer.default_size()), - &self.placeholder, - value, - &self.state, - &self.style, - ) - } + ) { + // TODO + // let value = value.unwrap_or(&self.value); + // let bounds = layout.bounds(); + // let text_bounds = layout.children().next().unwrap().bounds(); + + // if self.is_secure { + // self::Renderer::draw( + // renderer, + // bounds, + // text_bounds, + // cursor_position, + // self.font, + // self.size.unwrap_or(renderer.default_size()), + // &self.placeholder, + // &value.secure(), + // &self.state, + // &self.style, + // ) + // } else { + // self::Renderer::draw( + // renderer, + // bounds, + // text_bounds, + // cursor_position, + // self.font, + // self.size.unwrap_or(renderer.default_size()), + // &self.placeholder, + // value, + // &self.state, + // &self.style, + // ) + // } } } @@ -630,7 +631,7 @@ where layout: Layout<'_>, cursor_position: Point, _viewport: &Rectangle, - ) -> Renderer::Output { + ) { self.draw(renderer, layout, cursor_position, None) } @@ -673,28 +674,6 @@ pub trait Renderer: text::Renderer + Sized { state: &State, ) -> f32; - /// Draws a [`TextInput`]. - /// - /// It receives: - /// - the bounds of the [`TextInput`] - /// - the bounds of the text (i.e. the current value) - /// - the cursor position - /// - the placeholder to show when the value is empty - /// - the current [`Value`] - /// - the current [`State`] - fn draw( - &mut self, - bounds: Rectangle, - text_bounds: Rectangle, - cursor_position: Point, - font: Self::Font, - size: u16, - placeholder: &str, - value: &Value, - state: &State, - style: &Self::Style, - ) -> Self::Output; - /// Computes the position of the text cursor at the given X coordinate of /// a [`TextInput`]. fn find_cursor_position( |