NIB / DOCUMENTATION
One-time code input — NibComponents
Enter six fixture digits through the keyboard or an on-screen keypad.
Open interactive viewEnter digits with one editing field
NibOtpInput defaults to six cells and NibOtpKeyboard.system. A prefilled or replacement controller is adopted without firing onChanged or onCompleted; later controller changes and user edits do notify. It uses one TextField behind the cells, which accepts typing and pasted codes and requests oneTimeCode autofill. The widget filters digits and bounds the visible value to length. onChanged receives partial input; onCompleted reports a newly complete value.
Keep code ownership explicit
NibOtpController exposes value, setValue, and clear. The widget sanitizes programmatic input for its display; validate and normalize configured text before storing it, as the controller itself accepts arbitrary strings. This demo stores only up to six digits. It keeps the controller through style changes and disposes it when removed.
Use the built-in keypad as an input option
NibOtpKeyboard.onScreen uses NibOtpKeypad and NibOtpKey; it does not open the system keyboard. NibOtpKeypadStyle configures key dimensions, spacing, maximum width, and colors. NibOtpCell draws each digit from char, active, theme, obscured, error, and enabled state. These exported building blocks can also form a custom composition, but you then own its value, length rules, and callbacks.
Separate entry from verification
A complete six-digit value is not proof of identity. The demo reports completion without contacting a service. Your host must verify the code, handle expiry and retry limits, and clear or preserve input according to the result. loading blocks input and shows pending verification; errorText displays an application error. No local keypad is a security guarantee.
Size cells and feedback to the available width
cellWidth defaults to 44, cellHeight to 52, and spacing to 10. The demo narrows six cells to fit its panel and uses a compact keypad. obscureText hides visible digits but does not encrypt or securely store the code. animated opts into cell feedback and defaults to false. autoFocus defaults to false so visiting the guide does not steal focus.
Handle confirmation separately from completion
The on-screen keypad supports onConfirm, a custom confirmButton, and showConfirmButton (true by default). Completion means the code has enough digits; confirmation means the user asked to continue. NibOtpKeypad receives onDigit and onBackspace, plus optional onConfirm. Keep these distinct when composing your own keypad.
A prefilled code differs or completion fires again
The displayed field strips nondigits and truncates to length. Avoid logging real codes in production; this preview only reports the number of entered digits. Completion may fire again after clearing and re-entering a code. Physical SMS autofill, device keyboards, and screen-reader behavior require their own device checks.
Limits and platform evidence
Fixture only: no code verification, authentication, or SMS service.
System autofill and physical screen-reader behavior are not established by widget tests.