fix: focus of password entry box
This commit is contained in:
parent
af22c48a99
commit
47370bdeaf
|
@ -190,6 +190,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
|
|||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
||||
child: TextFormField(
|
||||
keyboardType: TextInputType.text,
|
||||
textInputAction: TextInputAction.next,
|
||||
controller: _passwordController1,
|
||||
obscureText: !_password1Visible,
|
||||
enableSuggestions: true,
|
||||
|
|
|
@ -149,11 +149,15 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||
children: [
|
||||
Expanded(
|
||||
child: AutofillGroup(
|
||||
child: FocusTraversalGroup(
|
||||
policy: OrderedTraversalPolicy(),
|
||||
child: ListView(
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 30,
|
||||
horizontal: 20,
|
||||
),
|
||||
child: Text(
|
||||
buttonTextAndHeading,
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
|
@ -211,6 +215,12 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
||||
child: TextFormField(
|
||||
autofillHints: const [AutofillHints.newPassword],
|
||||
onFieldSubmitted: (_) {
|
||||
do {
|
||||
FocusScope.of(context).nextFocus();
|
||||
} while (FocusScope.of(context).focusedChild!.context ==
|
||||
null);
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
fillColor:
|
||||
_isPasswordValid ? _validFieldValueColor : null,
|
||||
|
@ -255,9 +265,10 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||
onChanged: (password) {
|
||||
setState(() {
|
||||
_passwordInInputBox = password;
|
||||
_passwordStrength = estimatePasswordStrength(password);
|
||||
_isPasswordValid =
|
||||
_passwordStrength >= kMildPasswordStrengthThreshold;
|
||||
_passwordStrength =
|
||||
estimatePasswordStrength(password);
|
||||
_isPasswordValid = _passwordStrength >=
|
||||
kMildPasswordStrengthThreshold;
|
||||
_passwordsMatch = _passwordInInputBox ==
|
||||
_passwordInInputConfirmationBox;
|
||||
});
|
||||
|
@ -274,9 +285,11 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||
controller: _passwordController2,
|
||||
obscureText: !_password2Visible,
|
||||
autofillHints: const [AutofillHints.newPassword],
|
||||
onEditingComplete: () => TextInput.finishAutofillContext(),
|
||||
onEditingComplete: () =>
|
||||
TextInput.finishAutofillContext(),
|
||||
decoration: InputDecoration(
|
||||
fillColor: _passwordsMatch ? _validFieldValueColor : null,
|
||||
fillColor:
|
||||
_passwordsMatch ? _validFieldValueColor : null,
|
||||
filled: true,
|
||||
hintText: context.l10n.confirmPassword,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
|
@ -326,11 +339,14 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||
),
|
||||
),
|
||||
Opacity(
|
||||
opacity:
|
||||
(_passwordInInputBox != '') && _password1InFocus ? 1 : 0,
|
||||
opacity: (_passwordInInputBox != '') && _password1InFocus
|
||||
? 1
|
||||
: 0,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 8,
|
||||
),
|
||||
child: Text(
|
||||
context.l10n.passwordStrength(passwordStrengthText),
|
||||
style: TextStyle(
|
||||
|
@ -368,6 +384,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -458,6 +475,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||
showGenericErrorDialog(context: context);
|
||||
}
|
||||
}
|
||||
|
||||
// ignore: unawaited_futures
|
||||
routeToPage(
|
||||
context,
|
||||
|
|
Loading…
Reference in a new issue