mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 15:30:40 +00:00
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),
|
padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
controller: _passwordController1,
|
controller: _passwordController1,
|
||||||
obscureText: !_password1Visible,
|
obscureText: !_password1Visible,
|
||||||
enableSuggestions: true,
|
enableSuggestions: true,
|
||||||
|
@ -149,11 +149,15 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: AutofillGroup(
|
child: AutofillGroup(
|
||||||
|
child: FocusTraversalGroup(
|
||||||
|
policy: OrderedTraversalPolicy(),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding:
|
padding: const EdgeInsets.symmetric(
|
||||||
const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
|
vertical: 30,
|
||||||
|
horizontal: 20,
|
||||||
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
buttonTextAndHeading,
|
buttonTextAndHeading,
|
||||||
style: Theme.of(context).textTheme.headlineMedium,
|
style: Theme.of(context).textTheme.headlineMedium,
|
||||||
@ -211,6 +215,12 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
autofillHints: const [AutofillHints.newPassword],
|
autofillHints: const [AutofillHints.newPassword],
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
do {
|
||||||
|
FocusScope.of(context).nextFocus();
|
||||||
|
} while (FocusScope.of(context).focusedChild!.context ==
|
||||||
|
null);
|
||||||
|
},
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
fillColor:
|
fillColor:
|
||||||
_isPasswordValid ? _validFieldValueColor : null,
|
_isPasswordValid ? _validFieldValueColor : null,
|
||||||
@ -255,9 +265,10 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||||||
onChanged: (password) {
|
onChanged: (password) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_passwordInInputBox = password;
|
_passwordInInputBox = password;
|
||||||
_passwordStrength = estimatePasswordStrength(password);
|
_passwordStrength =
|
||||||
_isPasswordValid =
|
estimatePasswordStrength(password);
|
||||||
_passwordStrength >= kMildPasswordStrengthThreshold;
|
_isPasswordValid = _passwordStrength >=
|
||||||
|
kMildPasswordStrengthThreshold;
|
||||||
_passwordsMatch = _passwordInInputBox ==
|
_passwordsMatch = _passwordInInputBox ==
|
||||||
_passwordInInputConfirmationBox;
|
_passwordInInputConfirmationBox;
|
||||||
});
|
});
|
||||||
@ -274,9 +285,11 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||||||
controller: _passwordController2,
|
controller: _passwordController2,
|
||||||
obscureText: !_password2Visible,
|
obscureText: !_password2Visible,
|
||||||
autofillHints: const [AutofillHints.newPassword],
|
autofillHints: const [AutofillHints.newPassword],
|
||||||
onEditingComplete: () => TextInput.finishAutofillContext(),
|
onEditingComplete: () =>
|
||||||
|
TextInput.finishAutofillContext(),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
fillColor: _passwordsMatch ? _validFieldValueColor : null,
|
fillColor:
|
||||||
|
_passwordsMatch ? _validFieldValueColor : null,
|
||||||
filled: true,
|
filled: true,
|
||||||
hintText: context.l10n.confirmPassword,
|
hintText: context.l10n.confirmPassword,
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
@ -326,11 +339,14 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Opacity(
|
Opacity(
|
||||||
opacity:
|
opacity: (_passwordInInputBox != '') && _password1InFocus
|
||||||
(_passwordInInputBox != '') && _password1InFocus ? 1 : 0,
|
? 1
|
||||||
|
: 0,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding: const EdgeInsets.symmetric(
|
||||||
const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
|
horizontal: 20,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
context.l10n.passwordStrength(passwordStrengthText),
|
context.l10n.passwordStrength(passwordStrengthText),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -368,6 +384,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -458,6 +475,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||||||
showGenericErrorDialog(context: context);
|
showGenericErrorDialog(context: context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
routeToPage(
|
routeToPage(
|
||||||
context,
|
context,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user