pub struct LengthLimitingTextInputFormatter {
pub max_length: Option<i32>,
pub max_length_enforcement: Option<MaxLengthEnforcement>,
}Expand description
A TextInputFormatter that prevents the insertion of more characters
than allowed.
Fields§
§max_length: Option<i32>The limit on the number of user-perceived characters that this formatter will allow.
max_length_enforcement: Option<MaxLengthEnforcement>Determines how the max_length limit should be enforced.
Implementations§
Source§impl LengthLimitingTextInputFormatter
impl LengthLimitingTextInputFormatter
Sourcepub fn new(max_length: Option<i32>) -> LengthLimitingTextInputFormatter
pub fn new(max_length: Option<i32>) -> LengthLimitingTextInputFormatter
Creates a formatter that prevents the insertion of more characters than a limit.
Sourcepub fn max_length_enforcement(self, value: MaxLengthEnforcement) -> Self
pub fn max_length_enforcement(self, value: MaxLengthEnforcement) -> Self
Dart LengthLimitingTextInputFormatter(maxLengthEnforcement:).
Sourcepub fn get_default_max_length_enforcement(
platform: Option<TargetPlatform>,
) -> MaxLengthEnforcement
pub fn get_default_max_length_enforcement( platform: Option<TargetPlatform>, ) -> MaxLengthEnforcement
Returns a MaxLengthEnforcement that follows the specified platform’s
convention.
Sourcepub fn truncate(value: &TextEditingValue, max_length: i32) -> TextEditingValue
pub fn truncate(value: &TextEditingValue, max_length: i32) -> TextEditingValue
Truncate the given TextEditingValue to max_length Unicode scalar
values.
Trait Implementations§
Source§impl TextInputFormatter for LengthLimitingTextInputFormatter
impl TextInputFormatter for LengthLimitingTextInputFormatter
Source§fn format_edit_update(
&self,
old_value: &TextEditingValue,
new_value: &TextEditingValue,
) -> TextEditingValue
fn format_edit_update( &self, old_value: &TextEditingValue, new_value: &TextEditingValue, ) -> TextEditingValue
Called when text is being typed or cut/copy/pasted in the
EditableText.Auto Trait Implementations§
impl Freeze for LengthLimitingTextInputFormatter
impl RefUnwindSafe for LengthLimitingTextInputFormatter
impl Send for LengthLimitingTextInputFormatter
impl Sync for LengthLimitingTextInputFormatter
impl Unpin for LengthLimitingTextInputFormatter
impl UnsafeUnpin for LengthLimitingTextInputFormatter
impl UnwindSafe for LengthLimitingTextInputFormatter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more