TimeInputFormatter class
Custom TextInputFormatter for time input fields
This formatter ensures that only digits are accepted and limits input to 4 digits maximum. It also handles cursor positioning during input to maintain a smooth user experience.
Features:
- Filters out all non-digit characters
- Limits input to maximum 4 digits (HHMM format)
- Maintains proper cursor positioning during filtering
- Uses cached regex for optimal performance
Usage: Applied automatically by TimeInput widget to ensure consistent input handling.
- Inheritance
-
- Object
- TextInputFormatter
- TimeInputFormatter
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
formatEditUpdate(
TextEditingValue oldValue, TextEditingValue newValue) → TextEditingValue -
Formats text input by filtering digits and managing cursor position
override
-
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