1import 'package:flutter/material.dart';
2import 'package:flutter_bloc/flutter_bloc.dart';
3import 'package:flutter_screenutil/flutter_screenutil.dart';
4import 'package:local_auth/local_auth.dart';
6import '../../../../../../core/common/enums/biometric_type_enum.dart';
7import '../../../../../../core/services/biometric_service.dart';
8import '../../../../../../core/ui/widgets/custom_snackbar.dart';
9import '../../../bloc/authentication_bloc/authentication_bloc.dart';
10import '../widgets/biomitric_auth_buttons.dart';
19 _SigninWithBiometricViewState();
22class _SigninWithBiometricViewState
extends State<SigninWithBiometricView> {
37 for (
final type in biometrics) {
38 if (
type == BiometricType.face) {
40 }
else if (
type == BiometricType.fingerprint || (
type == BiometricType.strong && hasFingerprint)) {
51 context.read<AuthenticationBloc>().add(LoadCredentialsEvent());
55 Theme.of(context).colorScheme.error,
56 'Failed to authenticate using biometrics',
62 Widget
build(BuildContext context) {
66 'Log in with ease using your biometrics',
67 style: Theme.of(context).textTheme.bodySmall?.copyWith(
68 color: Theme.of(context).hintColor,
75 crossAxisAlignment: CrossAxisAlignment.center,
76 mainAxisAlignment: MainAxisAlignment.center,
80 final supportedType = biometric == BiometricType.face
81 ? SupportedBiometricType.face
82 : SupportedBiometricType.fingerprint;
83 return BiometricButton(
84 icon: supportedType.icon,
85 onPressed: () => _authenticate(biometric),
override void initState()
class App extends StatefulWidget build(BuildContext context)
abstract class BiometricService LocalBiometricService()
static ScaffoldFeatureController< SnackBar, SnackBarClosedReason > display(final BuildContext context, final Color color, final String message,)
class SigninWithBiometricView extends StatefulWidget _availableBiometrics
Future< void > _authenticate(BiometricType type) async
Future< void > _checkAvailableBiometrics() async
style Text( '${ 'scheduling.reference'.tr()}:${collection.internalCode}', style:Theme.of(context).textTheme.bodySmall,)
style SizedBox(height:2.h)
style Column(crossAxisAlignment:CrossAxisAlignment.end, children:[Container(padding:EdgeInsets.symmetric(horizontal:8.w, vertical:4.h), decoration:BoxDecoration(color:ColorPalette.tiffanyBlue.withValues(alpha:0.1), borderRadius:BorderRadius.circular(12),), child:Text(collection.type ?? '', style:Theme.of(context).textTheme.bodySmall?.copyWith(color:ColorPalette.tiffanyBlue, fontWeight:FontWeight.bold,),),),],)