Merge pull request #2513 from ayeniswe/feat/set-width_text-editor

feat: add width setter for Text-Editor widget
This commit is contained in:
Héctor Ramón 2024-09-13 01:20:25 +02:00 committed by GitHub
commit 295aae4faa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -109,6 +109,12 @@ where
self
}
/// Sets the width of the [`TextEditor`].
pub fn width(mut self, width: impl Into<Pixels>) -> Self {
self.width = Length::from(width.into());
self
}
/// Sets the message that should be produced when some action is performed in
/// the [`TextEditor`].
///
@ -498,7 +504,7 @@ where
state.highlighter_settings = self.highlighter_settings.clone();
}
let limits = limits.height(self.height);
let limits = limits.width(self.width).height(self.height);
internal.editor.update(
limits.shrink(self.padding).max(),