autofill signin details
This commit is contained in:
@@ -6,6 +6,7 @@ class MIHPassField extends StatefulWidget {
|
|||||||
final String hintText;
|
final String hintText;
|
||||||
final bool required;
|
final bool required;
|
||||||
final bool signIn;
|
final bool signIn;
|
||||||
|
final Iterable<String>? autoFillHintGroup;
|
||||||
|
|
||||||
const MIHPassField({
|
const MIHPassField({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -13,6 +14,7 @@ class MIHPassField extends StatefulWidget {
|
|||||||
required this.hintText,
|
required this.hintText,
|
||||||
required this.required,
|
required this.required,
|
||||||
required this.signIn,
|
required this.signIn,
|
||||||
|
this.autoFillHintGroup,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -128,6 +130,7 @@ class _MIHPassFieldState extends State<MIHPassField> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TextField(
|
return TextField(
|
||||||
|
autofillHints: widget.autoFillHintGroup,
|
||||||
controller: widget.controller,
|
controller: widget.controller,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class MIHTextField extends StatefulWidget {
|
|||||||
final String hintText;
|
final String hintText;
|
||||||
final bool editable;
|
final bool editable;
|
||||||
final bool required;
|
final bool required;
|
||||||
|
final Iterable<String>? autoFillHintGroup;
|
||||||
|
|
||||||
const MIHTextField({
|
const MIHTextField({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -13,6 +14,7 @@ class MIHTextField extends StatefulWidget {
|
|||||||
required this.hintText,
|
required this.hintText,
|
||||||
required this.editable,
|
required this.editable,
|
||||||
required this.required,
|
required this.required,
|
||||||
|
this.autoFillHintGroup,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -75,6 +77,15 @@ class _MIHTextFieldState extends State<MIHTextField> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List<AutofillGroup> getAutoFillDetails(){
|
||||||
|
// if(widget.autoFillHintGroup == null){
|
||||||
|
// return [];
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// return widget.autoFillHintGroup!;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
Widget setRequiredText() {
|
Widget setRequiredText() {
|
||||||
if (widget.required) {
|
if (widget.required) {
|
||||||
return Row(
|
return Row(
|
||||||
@@ -116,6 +127,7 @@ class _MIHTextFieldState extends State<MIHTextField> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TextField(
|
return TextField(
|
||||||
|
autofillHints: widget.autoFillHintGroup,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ class _SignInState extends State<SignIn> {
|
|||||||
} else {
|
} else {
|
||||||
await signUserIn();
|
await signUserIn();
|
||||||
if (successfulSignIn) {
|
if (successfulSignIn) {
|
||||||
|
TextInput.finishAutofillContext();
|
||||||
Navigator.of(context).pushNamedAndRemoveUntil('/', (route) => false);
|
Navigator.of(context).pushNamedAndRemoveUntil('/', (route) => false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -313,6 +314,7 @@ class _SignInState extends State<SignIn> {
|
|||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(25.0),
|
padding: const EdgeInsets.all(25.0),
|
||||||
|
child: AutofillGroup(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@@ -373,6 +375,7 @@ class _SignInState extends State<SignIn> {
|
|||||||
hintText: 'Email',
|
hintText: 'Email',
|
||||||
editable: true,
|
editable: true,
|
||||||
required: true,
|
required: true,
|
||||||
|
autoFillHintGroup: const [AutofillHints.email],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -386,6 +389,7 @@ class _SignInState extends State<SignIn> {
|
|||||||
hintText: 'Password',
|
hintText: 'Password',
|
||||||
required: true,
|
required: true,
|
||||||
signIn: true,
|
signIn: true,
|
||||||
|
autoFillHintGroup: const [AutofillHints.password],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@@ -558,6 +562,7 @@ class _SignInState extends State<SignIn> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user