pub struct FilteringTextInputFormatter {
pub filter_pattern: FilterPattern,
pub allow: bool,
pub replacement_string: String,
}Expand description
A TextInputFormatter that prevents the insertion of characters matching
(or not matching) a particular pattern, by replacing the characters with the
given replacement_string.
Fields§
§filter_pattern: FilterPatternA pattern to match or replace in incoming TextEditingValues.
allow: boolWhether the pattern is an allow list or not.
replacement_string: StringString used to replace banned patterns.
Implementations§
Source§impl FilteringTextInputFormatter
impl FilteringTextInputFormatter
Sourcepub fn new(
filter_pattern: FilterPattern,
allow: bool,
) -> FilteringTextInputFormatter
pub fn new( filter_pattern: FilterPattern, allow: bool, ) -> FilteringTextInputFormatter
Creates a formatter that replaces banned patterns with the given
replacement_string.
Sourcepub fn replacement_string(self, replacement_string: impl Into<String>) -> Self
pub fn replacement_string(self, replacement_string: impl Into<String>) -> Self
Dart FilteringTextInputFormatter(replacementString:).
Sourcepub fn allow(filter_pattern: FilterPattern) -> FilteringTextInputFormatter
pub fn allow(filter_pattern: FilterPattern) -> FilteringTextInputFormatter
Creates a formatter that only allows characters matching a pattern.
Sourcepub fn deny(filter_pattern: FilterPattern) -> FilteringTextInputFormatter
pub fn deny(filter_pattern: FilterPattern) -> FilteringTextInputFormatter
Creates a formatter that blocks characters matching a pattern.
Sourcepub fn single_line_formatter() -> TextInputFormatterRef
pub fn single_line_formatter() -> TextInputFormatterRef
A TextInputFormatter that forces input to be a single line.
Sourcepub fn digits_only() -> TextInputFormatterRef
pub fn digits_only() -> TextInputFormatterRef
A TextInputFormatter that takes in digits [0-9] only.
Trait Implementations§
Source§impl Clone for FilteringTextInputFormatter
impl Clone for FilteringTextInputFormatter
Source§impl Debug for FilteringTextInputFormatter
impl Debug for FilteringTextInputFormatter
Source§impl TextInputFormatter for FilteringTextInputFormatter
impl TextInputFormatter for FilteringTextInputFormatter
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 FilteringTextInputFormatter
impl RefUnwindSafe for FilteringTextInputFormatter
impl Send for FilteringTextInputFormatter
impl Sync for FilteringTextInputFormatter
impl Unpin for FilteringTextInputFormatter
impl UnsafeUnpin for FilteringTextInputFormatter
impl UnwindSafe for FilteringTextInputFormatter
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