ekyc_id_flutter 1.1.16 copy "ekyc_id_flutter: ^1.1.16" to clipboard
ekyc_id_flutter: ^1.1.16 copied to clipboard

A Flutter Plugin to interact with EkycID.

example/lib/main.dart

import 'package:ekyc_id_flutter/ekyc_id_flutter.dart';

import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  EkycIDServices.initialize(EkycAPI(
    apiKey: "",
    apiURL: "",
  ));
  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;
  final _livenessDetectionKey =
      GlobalKey<LivenessDetectionViewWithRandomPromptsState>();

  Future<void> onLivenessTestCompleted(LivenessDetectionResult res) async {
    _livenessDetectionKey.currentState?.pause();

    setState(() {
      r = res;
    });

    var result = await EkycIDServices.instance.verifyLiveness(result: res);
    print("verify result >> ${result.promptsMatch}");

    _livenessDetectionKey.currentState?.refreshPrompts();
    _livenessDetectionKey.currentState?.start();
  }

  Future<void> onDocumentScanned(DocumentScannerResult mainSide,
      DocumentScannerResult? secondarySide) async {}

  @override
  Widget build(BuildContext context) {
    var options = LivenessDetectionOptions(recordVideo: true);
    return Scaffold(
      body: Stack(
        children: [
          LivenessDetectionViewWithRandomPrompts(
            key: _livenessDetectionKey,
            options: options,
            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),
              ),
            )
          // Positioned.fill(
          //   child: DocumentScannerView(
          //     onDocumentScanned: onDocumentScanned,
          //     overlayBuilder: (context, frameStatus, currentSide, countDown) {
          //       return DocumentMinimalOverlay(
          //         options: DocumentScannerOptions(),
          //         frameStatus: frameStatus,
          //         currentSide: currentSide,
          //         showFlippingAnimation:
          //             frameStatus == FrameStatus.PROCESSING &&
          //                 currentSide == DocumentSide.SECONDARY,
          //       );
          //     },
          //   ),
          //   // 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,
          //   // ),
          // ),
        ],
      ),
    );
  }
}
6
likes
60
points
817
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter Plugin to interact with EkycID.

Homepage
Repository (GitHub)

Documentation

API reference

License

unknown (license)

Dependencies

dio, flutter, flutter_font_icons, flutter_spinkit, flutter_web_plugins, http_parser, json_bigint, just_audio, vibration

More

Packages that depend on ekyc_id_flutter