feat: Implement autofillhints

This commit is contained in:
Christian Pauly 2021-02-01 11:08:29 +01:00
parent 56edb77b68
commit 41a24574ce
3 changed files with 17 additions and 6 deletions

View File

@ -180,6 +180,7 @@ class _LoginState extends State<Login> {
autofocus: true, autofocus: true,
onChanged: (t) => _checkWellKnownWithCoolDown(t, context), onChanged: (t) => _checkWellKnownWithCoolDown(t, context),
controller: usernameController, controller: usernameController,
autofillHints: [AutofillHints.username],
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: Icon(Icons.account_box_outlined), prefixIcon: Icon(Icons.account_box_outlined),
hintText: hintText:
@ -193,6 +194,7 @@ class _LoginState extends State<Login> {
child: TextField( child: TextField(
readOnly: loading, readOnly: loading,
autocorrect: false, autocorrect: false,
autofillHints: [AutofillHints.password],
controller: passwordController, controller: passwordController,
obscureText: !showPassword, obscureText: !showPassword,
onSubmitted: (t) => login(context), onSubmitted: (t) => login(context),

View File

@ -95,6 +95,7 @@ class _SignUpState extends State<SignUp> {
autocorrect: false, autocorrect: false,
controller: usernameController, controller: usernameController,
onSubmitted: (s) => signUpAction(context), onSubmitted: (s) => signUpAction(context),
autofillHints: [AutofillHints.newUsername],
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: Icon(Icons.account_circle_outlined), prefixIcon: Icon(Icons.account_circle_outlined),
hintText: L10n.of(context).username, hintText: L10n.of(context).username,

View File

@ -1,12 +1,13 @@
import 'dart:math'; import 'dart:math';
import 'package:adaptive_page_layout/adaptive_page_layout.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flushbar/flushbar_helper.dart'; import 'package:flushbar/flushbar_helper.dart';
import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/matrix.dart'; import 'package:fluffychat/components/matrix.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:url_launcher/url_launcher.dart';
class SignUpPassword extends StatefulWidget { class SignUpPassword extends StatefulWidget {
final MatrixFile avatar; final MatrixFile avatar;
@ -74,13 +75,19 @@ class _SignUpPasswordState extends State<SignUpPassword> {
return setState(() => loading = false); return setState(() => loading = false);
} }
_lastAuthWebViewStage = currentStage; _lastAuthWebViewStage = currentStage;
await AdaptivePageLayout.of(context).pushNamed( await launch(
'/authwebview/$currentStage/${exception.session}', Matrix.of(context).client.homeserver.toString() +
arguments: () => _signUpAction( '/_matrix/client/r0/auth/$currentStage/fallback/web?session=${exception.session}',
);
if (OkCancelResult.ok ==
await showOkCancelAlertDialog(
context: context,
)) {
_signUpAction(
context, context,
auth: AuthenticationData(session: exception.session), auth: AuthenticationData(session: exception.session),
),
); );
}
return; return;
} }
} else { } else {
@ -135,6 +142,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
autofocus: true, autofocus: true,
autocorrect: false, autocorrect: false,
onSubmitted: (t) => _signUpAction(context), onSubmitted: (t) => _signUpAction(context),
autofillHints: [AutofillHints.newPassword],
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: Icon(Icons.lock_outlined), prefixIcon: Icon(Icons.lock_outlined),
hintText: '****', hintText: '****',