OTPFieldStyle enum
Defines the visual style of OTP input fields.
The field style determines how the input fields are visually presented. Each style provides a different aesthetic while maintaining the same functionality.
Example usage:
OTPTextField(
fieldStyle: OTPFieldStyle.underline,
controllers: controllers,
focusNodes: focusNodes,
textStyle: TextStyle(fontSize: 24),
)
See also:
- OTPTextField.fieldStyle for using this in the widget
- OTPTheme for customizing the appearance of each style
Values
- box → const OTPFieldStyle
-
Box-shaped field with borders on all four sides.
This is the default and most common style. Fields appear as boxes with customizable border radius via OTPTheme.borderRadius.
Best for:
- Traditional OTP input
- Clear field boundaries
- Material Design apps
- underline → const OTPFieldStyle
-
Underlined fields with border only at the bottom.
Provides a minimalist appearance with less visual weight. The underline width can be customized via OTPTheme.underlineWidth.
Best for:
- Clean, modern interfaces
- Minimal designs
- When screen space is limited
- circle → const OTPFieldStyle
-
Circular fields.
Creates round input fields. The border radius is automatically calculated to create perfect circles based on the field width.
Best for:
- PIN entry screens
- Secure code input
- Unique visual design
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
OTPFieldStyle> - A constant List of the values in this enum, in order of their declaration.