A pin code widget with can be automatically fullfiled with codes received via SMS both on Android and iOS.
Android codes are provided via the native
user_consent API https://developers.google.com/identity/sms-retriever/user-consent/request
iOS are automatically provided by the system as an auto-complete suggestion over the keyboard.
Just add the
SMSPinCode at your widget hierarchy:
SmsPinCode( controller: _smsCodeController, focusNode: _smsCodeFocus, onSubmitted: (text) => _confirmSmsTap() )
controller: A regular
TextEditingControllerwhich will hold the entire input pin code on a single string.
focusNode: The focus of the SMS Pin Code. Useful to focus on it automatically after the sms is sent.
VoidCallbackto be called when the pin is completed.
color: The background color of the input.
digits: The number of digits of the PIN. Defaults to
isSmsCode: If SMS Code completion should be enabled. Defaults to true when
digits == 6.