ekyc_id_flutter 1.1.1
ekyc_id_flutter: ^1.1.1 copied to clipboard
A Flutter Plugin to interact with EkycID.
import 'package:ekyc_id_flutter/ekyc_id_flutter.dart';
import 'package:ekyc_id_flutter_example/test_result.dart';
import 'package:flutter/material.dart';
// import 'package:image_picker/image_picker.dart';
import 'package:permission_handler/permission_handler.dart';
// import 'package:ekyc_id_flutter/src/core/document_detection.dart';
import 'package:ekyc_id_flutter/src/document_scanner/document_scanner_values.dart';
import 'package:ekyc_id_flutter/src/core/models/object_detection_object_type.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
EkycIDServices.initialize(EkycAPI(
apiKey: "8e0231159713fd625cb31b767ee26bafaccab7b5ba652342e66cd34f856bf96f",
apiURL: "https://api.ekycsolutions.com",
));
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
Permission.camera.request();
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: HomeScreen(),
);
}
}
class HomeScreen extends StatefulWidget {
const HomeScreen({Key? key}) : super(key: key);
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
LivenessDetectionResult? r;
Future<void> onLivenessTestCompleted(LivenessDetectionResult res) async {
setState(() {
r = res;
});
}
@override
Widget build(BuildContext context) {
var options = LivenessDetectionOptions();
return Scaffold(
body: Stack(
children: [
Positioned.fill(
child: LivenessDetectionView(
options: options,
overlayBuilder: (
context,
frameStatus,
countDown,
progress,
activePrompt,
isFocusing,
) {
return LivenessOverlayMinimal(
options: options,
frameStatus: frameStatus,
progress: progress,
promptTimer: countDown,
isFocusing: isFocusing,
activePrompt: activePrompt,
);
},
onLivenessTestCompleted: onLivenessTestCompleted,
),
),
if (r?.frontFace?.image != null)
Positioned(
left: 0,
top: 0,
child: Container(
color: Colors.red,
height: 100,
width: 100,
child: Image.memory(r!.frontFace!.image),
),
)
],
),
);
}
}