Refact. Verification code, keyboardType (#6934)

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2024-01-20 23:22:05 -08:00 committed by GitHub
parent 28f01784c1
commit cb102a5a61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -363,6 +363,7 @@ class DialogTextField extends StatelessWidget {
final Widget? suffixIcon; final Widget? suffixIcon;
final TextEditingController controller; final TextEditingController controller;
final FocusNode? focusNode; final FocusNode? focusNode;
final TextInputType? keyboardType;
final List<TextInputFormatter>? inputFormatters; final List<TextInputFormatter>? inputFormatters;
static const kUsernameTitle = 'Username'; static const kUsernameTitle = 'Username';
@ -379,6 +380,7 @@ class DialogTextField extends StatelessWidget {
this.prefixIcon, this.prefixIcon,
this.suffixIcon, this.suffixIcon,
this.hintText, this.hintText,
this.keyboardType,
this.inputFormatters, this.inputFormatters,
required this.title, required this.title,
required this.controller}) required this.controller})
@ -404,6 +406,7 @@ class DialogTextField extends StatelessWidget {
focusNode: focusNode, focusNode: focusNode,
autofocus: true, autofocus: true,
obscureText: obscureText, obscureText: obscureText,
keyboardType: keyboardType,
inputFormatters: inputFormatters, inputFormatters: inputFormatters,
), ),
), ),
@ -456,6 +459,7 @@ class Dialog2FaField extends ValidationField {
readyCallback: readyCallback, readyCallback: readyCallback,
helperText: helperText ?? translate('2fa_tip'), helperText: helperText ?? translate('2fa_tip'),
onChanged: _onChanged, onChanged: _onChanged,
keyboardType: TextInputType.number,
inputFormatters: [ inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
], ],
@ -528,6 +532,7 @@ class DialogEmailCodeField extends ValidationField {
readyCallback: readyCallback, readyCallback: readyCallback,
helperText: translate('verification_tip'), helperText: translate('verification_tip'),
onChanged: _onChanged, onChanged: _onChanged,
keyboardType: TextInputType.visiblePassword,
); );
} }
@ -571,6 +576,7 @@ class DialogVerificationCodeField extends StatefulWidget {
this.textLength, this.textLength,
this.readyCallback, this.readyCallback,
this.onChanged, this.onChanged,
this.keyboardType,
this.inputFormatters, this.inputFormatters,
}) : super(key: key); }) : super(key: key);
@ -585,6 +591,7 @@ class DialogVerificationCodeField extends StatefulWidget {
final VoidCallback? readyCallback; final VoidCallback? readyCallback;
final Function(StateSetter setState, SimpleWrapper<String?> errText)? final Function(StateSetter setState, SimpleWrapper<String?> errText)?
onChanged; onChanged;
final TextInputType? keyboardType;
final List<TextInputFormatter>? inputFormatters; final List<TextInputFormatter>? inputFormatters;
@override @override
@ -646,6 +653,7 @@ class _DialogVerificationCodeField extends State<DialogVerificationCodeField> {
errorText: widget.errorText ?? errorText.value, errorText: widget.errorText ?? errorText.value,
focusNode: _focusNode, focusNode: _focusNode,
helperText: widget.helperText, helperText: widget.helperText,
keyboardType: widget.keyboardType,
inputFormatters: widget.inputFormatters, inputFormatters: widget.inputFormatters,
); );
} }