remove unnessasary code and trigger bio when needed and not initstate
This commit is contained in:
@@ -68,7 +68,7 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
|||||||
|
|
||||||
void authenticateUser() async {
|
void authenticateUser() async {
|
||||||
final bool canAuthWithBio = await _auth.canCheckBiometrics;
|
final bool canAuthWithBio = await _auth.canCheckBiometrics;
|
||||||
print("Biomentric Available: $canAuthWithBio");
|
// print("Biomentric Available: $canAuthWithBio");
|
||||||
if (canAuthWithBio) {
|
if (canAuthWithBio) {
|
||||||
try {
|
try {
|
||||||
final bool didBioAuth = await _auth.authenticate(
|
final bool didBioAuth = await _auth.authenticate(
|
||||||
@@ -82,7 +82,7 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
|||||||
_isBioAuthenticated = true;
|
_isBioAuthenticated = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
print("Authenticated: $didBioAuth");
|
// print("Authenticated: $didBioAuth");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
print(error);
|
print(error);
|
||||||
}
|
}
|
||||||
@@ -123,22 +123,21 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
|||||||
),
|
),
|
||||||
//spacer
|
//spacer
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
if (!_isBioAuthenticated)
|
// if (!_isBioAuthenticated)
|
||||||
Icon(
|
Icon(
|
||||||
Icons.lock,
|
Icons.lock,
|
||||||
size: 200,
|
size: 200,
|
||||||
color: MzanziInnovationHub.of(context)!
|
color:
|
||||||
.theme
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
.secondaryColor(),
|
),
|
||||||
),
|
// if (_isBioAuthenticated)
|
||||||
if (_isBioAuthenticated)
|
// Icon(
|
||||||
Icon(
|
// Icons.lock_open,
|
||||||
Icons.lock_open,
|
// size: 200,
|
||||||
size: 200,
|
// color: MzanziInnovationHub.of(context)!
|
||||||
color: MzanziInnovationHub.of(context)!
|
// .theme
|
||||||
.theme
|
// .secondaryColor(),
|
||||||
.secondaryColor(),
|
// ),
|
||||||
),
|
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
Container(
|
Container(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
@@ -187,7 +186,7 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
if (widget.firstBoot == true) authenticateUser();
|
// if (widget.firstBoot == true) authenticateUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -206,6 +205,7 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
|||||||
personalSelected: widget.personalSelected,
|
personalSelected: widget.personalSelected,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
authenticateUser();
|
||||||
return getBiomentricAuthScreen();
|
return getBiomentricAuthScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user