Skip to main content

TextInputType

Struct TextInputType 

Source
pub struct TextInputType {
    pub index: i32,
    pub signed: Option<bool>,
    pub decimal: Option<bool>,
    pub password: Option<bool>,
}
Expand description

The type of information for which to optimize the text input control.

On Android, behavior may vary across device and keyboard provider.

This class stays as close to Enum interface as possible, and allows for additional flags for some input types. For example, numeric input can specify whether it supports decimal numbers and/or signed numbers.

Fields§

§index: i32

Enum value index, corresponds to one of the VALUES.

§signed: Option<bool>

The number is signed, allowing a positive or negative sign at the start.

This flag is only used for the NUMBER input type, otherwise None. Use TextInputType::number_with_options().signed(true) to set this.

§decimal: Option<bool>

The number is decimal, allowing a decimal point to provide fractional.

This flag is only used for the NUMBER input type, otherwise None. Use TextInputType::number_with_options().decimal(true) to set this.

§password: Option<bool>

The number is a password.

This flag is only used for the NUMBER input type, otherwise None. Use TextInputType::number_with_options().password(true) to set this.

On Android, this adds TYPE_NUMBER_VARIATION_PASSWORD to the input type. It has no effect on iOS, web, or desktop platforms.

Implementations§

Source§

impl TextInputType

Source

pub const TEXT: TextInputType

Optimize for textual information.

Requests the default platform keyboard.

Source

pub const MULTILINE: TextInputType

Optimize for multiline textual information.

Requests the default platform keyboard, but accepts newlines when the enter key is pressed. This is the input type used for all multiline text fields.

Source

pub const NUMBER: TextInputType

Optimize for unsigned numerical information without a decimal point.

Requests a default keyboard with ready access to the number keys. Additional options, such as decimal point and/or positive/negative signs, can be requested using number_with_options.

Source

pub const PHONE: TextInputType

Optimize for telephone numbers.

Requests a keyboard with ready access to the number keys, “*”, and “#”.

Source

pub const DATETIME: TextInputType

Optimize for date and time information.

On iOS, requests the default keyboard.

On Android, requests a keyboard with ready access to the number keys, “:”, and “-”.

Source

pub const EMAIL_ADDRESS: TextInputType

Optimize for email addresses.

Requests a keyboard with ready access to the “@” and “.” keys.

Source

pub const URL: TextInputType

Optimize for URLs.

Requests a keyboard with ready access to the “/” and “.” keys.

Source

pub const VISIBLE_PASSWORD: TextInputType

Optimize for passwords that are visible to the user.

Requests a keyboard with ready access to both letters and numbers.

Source

pub const NAME: TextInputType

Optimized for a person’s name.

On iOS, requests the UIKeyboardType.namePhonePad keyboard, a keyboard optimized for entering a person’s name or phone number. Does not support auto-capitalization.

On Android, requests a keyboard optimized for TYPE_TEXT_VARIATION_PERSON_NAME.

Source

pub const STREET_ADDRESS: TextInputType

Optimized for postal mailing addresses.

On iOS, requests the default keyboard.

On Android, requests a keyboard optimized for TYPE_TEXT_VARIATION_POSTAL_ADDRESS.

Source

pub const NONE: TextInputType

Prevent the OS from showing the on-screen virtual keyboard.

Optimized for web searches.

Requests a keyboard that includes keys useful for web searches as well as URLs.

On iOS, requests a default keyboard with ready access to the “.” key. In contrast to URL, a space bar is available.

On Android this is remapped to the URL keyboard type as it always shows a space bar.

Source

pub const TWITTER: TextInputType

Optimized for social media.

Requests a keyboard that includes keys useful for handles and tags.

On iOS, requests a default keyboard with ready access to the “@” and “#” keys.

On Android this is remapped to the EMAIL_ADDRESS keyboard type as it always shows the “@” key.

Source

pub const VALUES: &[TextInputType]

All possible enum values.

Source

pub const fn number_with_options() -> TextInputType

Optimize for numerical information.

Requests a numeric keyboard with additional settings. The signed, decimal, and password parameters are optional.

Source

pub fn signed(self, signed: bool) -> TextInputType

Dart TextInputType.numberWithOptions(signed:).

Source

pub fn decimal(self, decimal: bool) -> TextInputType

Dart TextInputType.numberWithOptions(decimal:).

Source

pub fn password(self, password: bool) -> TextInputType

Dart TextInputType.numberWithOptions(password:).

Trait Implementations§

Source§

impl Clone for TextInputType

Source§

fn clone(&self) -> TextInputType

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TextInputType

Source§

impl Debug for TextInputType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for TextInputType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TextInputType

Source§

impl Hash for TextInputType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TextInputType

Source§

fn eq(&self, other: &TextInputType) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TextInputType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,