1import 'package:connect/core/localization/app_localizations.dart';
2import 'package:flutter/material.dart';
3import 'package:flutter_bloc/flutter_bloc.dart';
4import 'package:flutter_screenutil/flutter_screenutil.dart';
5import 'package:local_auth/local_auth.dart';
7import '../../../../../../core/services/biometric_service.dart';
8import '../../../../../../core/ui/widgets/custom_snackbar.dart';
9import '../../../../domain/enum/supported_biometric_type_enum.dart';
10import '../../../logic/authentication_bloc/authentication_bloc.dart';
11import '../widgets/biometric_button.dart';
20 _SigninWithBiometricViewState();
23class _SigninWithBiometricViewState
extends State<SigninWithBiometricView> {
38 for (
final type in biometrics) {
39 if (type == BiometricType.face) {
41 }
else if (type == BiometricType.fingerprint ||
42 (type == BiometricType.strong && hasFingerprint)) {
54 context.read<AuthenticationBloc>().add(LoadCredentialsEvent());
58 Theme.of(context).colorScheme.error,
60 .
translate(
'Failed to authenticate using biometrics'),
66 Widget
build(BuildContext context) {
71 .
translate(
'Log in with ease using your biometrics'),
72 style: Theme.of(context).textTheme.bodySmall?.copyWith(
73 color: Theme.of(context).hintColor,
76 SizedBox(height: 20.sp),
80 crossAxisAlignment: CrossAxisAlignment.center,
81 mainAxisAlignment: MainAxisAlignment.center,
83 SizedBox(height: 15.sp),
85 final supportedType = biometric == BiometricType.face
86 ? SupportedBiometricType.face
87 : SupportedBiometricType.fingerprint;
88 return BiometricButton(
89 icon: supportedType.icon,
90 onPressed: () => _authenticate(biometric),
abstract class BiometricService LocalBiometricService()
String translate(String key)
static AppLocalizations of(BuildContext context)
static display(final BuildContext context, final Color color, final String message,)
override void initState()
override Widget build(BuildContext context)
class SigninWithBiometricView extends StatefulWidget _availableBiometrics
Future< void > _authenticate(BiometricType type) async
Future< void > _checkAvailableBiometrics() async