From cb102a5a61747cafce7085c0ec9d0013490af233 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sat, 20 Jan 2024 23:22:05 -0800 Subject: [PATCH] Refact. Verification code, keyboardType (#6934) Signed-off-by: fufesou --- flutter/lib/common/widgets/dialog.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/flutter/lib/common/widgets/dialog.dart b/flutter/lib/common/widgets/dialog.dart index 58db1047c..b7582c3f1 100644 --- a/flutter/lib/common/widgets/dialog.dart +++ b/flutter/lib/common/widgets/dialog.dart @@ -363,6 +363,7 @@ class DialogTextField extends StatelessWidget { final Widget? suffixIcon; final TextEditingController controller; final FocusNode? focusNode; + final TextInputType? keyboardType; final List? inputFormatters; static const kUsernameTitle = 'Username'; @@ -379,6 +380,7 @@ class DialogTextField extends StatelessWidget { this.prefixIcon, this.suffixIcon, this.hintText, + this.keyboardType, this.inputFormatters, required this.title, required this.controller}) @@ -404,6 +406,7 @@ class DialogTextField extends StatelessWidget { focusNode: focusNode, autofocus: true, obscureText: obscureText, + keyboardType: keyboardType, inputFormatters: inputFormatters, ), ), @@ -456,6 +459,7 @@ class Dialog2FaField extends ValidationField { readyCallback: readyCallback, helperText: helperText ?? translate('2fa_tip'), onChanged: _onChanged, + keyboardType: TextInputType.number, inputFormatters: [ FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), ], @@ -528,6 +532,7 @@ class DialogEmailCodeField extends ValidationField { readyCallback: readyCallback, helperText: translate('verification_tip'), onChanged: _onChanged, + keyboardType: TextInputType.visiblePassword, ); } @@ -571,6 +576,7 @@ class DialogVerificationCodeField extends StatefulWidget { this.textLength, this.readyCallback, this.onChanged, + this.keyboardType, this.inputFormatters, }) : super(key: key); @@ -585,6 +591,7 @@ class DialogVerificationCodeField extends StatefulWidget { final VoidCallback? readyCallback; final Function(StateSetter setState, SimpleWrapper errText)? onChanged; + final TextInputType? keyboardType; final List? inputFormatters; @override @@ -646,6 +653,7 @@ class _DialogVerificationCodeField extends State { errorText: widget.errorText ?? errorText.value, focusNode: _focusNode, helperText: widget.helperText, + keyboardType: widget.keyboardType, inputFormatters: widget.inputFormatters, ); }