face_liveness_verification 1.0.1
face_liveness_verification: ^1.0.1 copied to clipboard
Flutter face detection, face liveness, and face verification package with FaceNet embedding matching and customizable challenge flow.
example/main.dart
import 'package:face_liveness_verification/face_liveness_verification.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const FaceLivenessExampleApp());
}
class FaceLivenessExampleApp extends StatelessWidget {
const FaceLivenessExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'face_liveness_verification example',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF0EA5E9)),
useMaterial3: true,
),
home: const ExampleHomePage(),
);
}
}
class ExampleHomePage extends StatelessWidget {
const ExampleHomePage({super.key});
@override
Widget build(BuildContext context) {
final uiState = FaceLivenessUiState(
message: 'Align your face and perform the action shown',
ringColor: Colors.orange,
isCompleted: false,
isValidFace: true,
phase: FaceValidationPhase.detection,
nextAction: FaceLivenessAction.blink,
);
return Scaffold(
appBar: AppBar(title: const Text('face_liveness_verification')),
body: Padding(
padding: const EdgeInsets.all(16),
child: Center(
child: AspectRatio(
aspectRatio: 3 / 4,
child: FaceLivenessUi(
preview: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xFF1F2937), Color(0xFF111827)],
),
),
alignment: Alignment.center,
child: const Icon(
Icons.face_6_rounded,
size: 84,
color: Colors.white70,
),
),
state: uiState,
),
),
),
),
);
}
}