autofill signin details

This commit is contained in:
2024-10-23 14:26:17 +02:00
parent 013baa22bd
commit 4467da83b9
3 changed files with 244 additions and 224 deletions

View File

@@ -6,6 +6,7 @@ class MIHPassField extends StatefulWidget {
final String hintText;
final bool required;
final bool signIn;
final Iterable<String>? autoFillHintGroup;
const MIHPassField({
super.key,
@@ -13,6 +14,7 @@ class MIHPassField extends StatefulWidget {
required this.hintText,
required this.required,
required this.signIn,
this.autoFillHintGroup,
});
@override
@@ -128,6 +130,7 @@ class _MIHPassFieldState extends State<MIHPassField> {
@override
Widget build(BuildContext context) {
return TextField(
autofillHints: widget.autoFillHintGroup,
controller: widget.controller,
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),

View File

@@ -6,6 +6,7 @@ class MIHTextField extends StatefulWidget {
final String hintText;
final bool editable;
final bool required;
final Iterable<String>? autoFillHintGroup;
const MIHTextField({
super.key,
@@ -13,6 +14,7 @@ class MIHTextField extends StatefulWidget {
required this.hintText,
required this.editable,
required this.required,
this.autoFillHintGroup,
});
@override
@@ -75,6 +77,15 @@ class _MIHTextFieldState extends State<MIHTextField> {
});
}
// List<AutofillGroup> getAutoFillDetails(){
// if(widget.autoFillHintGroup == null){
// return [];
// }
// else{
// return widget.autoFillHintGroup!;
// }
// }
Widget setRequiredText() {
if (widget.required) {
return Row(
@@ -116,6 +127,7 @@ class _MIHTextFieldState extends State<MIHTextField> {
@override
Widget build(BuildContext context) {
return TextField(
autofillHints: widget.autoFillHintGroup,
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),

View File

@@ -168,6 +168,7 @@ class _SignInState extends State<SignIn> {
} else {
await signUserIn();
if (successfulSignIn) {
TextInput.finishAutofillContext();
Navigator.of(context).pushNamedAndRemoveUntil('/', (route) => false);
}
}
@@ -313,6 +314,7 @@ class _SignInState extends State<SignIn> {
physics: const BouncingScrollPhysics(),
child: Padding(
padding: const EdgeInsets.all(25.0),
child: AutofillGroup(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@@ -373,6 +375,7 @@ class _SignInState extends State<SignIn> {
hintText: 'Email',
editable: true,
required: true,
autoFillHintGroup: const [AutofillHints.email],
),
),
@@ -386,6 +389,7 @@ class _SignInState extends State<SignIn> {
hintText: 'Password',
required: true,
signIn: true,
autoFillHintGroup: const [AutofillHints.password],
),
),
SizedBox(
@@ -558,6 +562,7 @@ class _SignInState extends State<SignIn> {
),
),
),
),
],
);
}