intp_flutter_liveness_sdk 1.3.6 copy "intp_flutter_liveness_sdk: ^1.3.6" to clipboard
intp_flutter_liveness_sdk: ^1.3.6 copied to clipboard

The Flutter SDK built incorporates the view of the liveness detection video recording feature.

example/lib/main.dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:intp_flutter_liveness_sdk/intp_flutter_liveness_sdk.dart';

Future<void> main() async {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Liveness detection'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Future<String?> buildDialog(Map<String, dynamic> value) {
    debugPrint("_buildDialog: $value");

    String content = "Detection failed !!!";

    if (value['Liveness'] != null && value['Liveness']['detectSuccess']) {
      content = "Detection success !!!";
    }

    if (value['statusCode'] != null && value['statusCode'] != 200) {
      content = "Error : $value";
    }

    return showDialog<String>(
      context: context,
      builder: (BuildContext context) => AlertDialog(
        title: const Text('Result'),
        content: Text(content),
        actions: <Widget>[
          TextButton(
            onPressed: () => Navigator.pop(context, 'OK'),
            child: const Text('OK'),
          ),
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SafeArea(
        child: LivenessCamera(
          livenessResponse: (Map<String, dynamic> value) {
            // handle your next event or navigation from below
            buildDialog(value);
          },
          endpoint: "API_ENDPOINT",
          apiKey: "API_KEY",
          transactionId: "TRANSACTION_ID",
          // actionsInstruction: const {
          //   'SHAKE_LEFT': 'New caption turn your head left',
          //   'SHAKE_RIGHT': 'New caption turn your head right',
          //   'NOD_HEAD': "New caption nod your head",
          //   'MOUTH': "New caption open your mouth",
          // },
          // numberOfActions: 2,
          // numberOfRetry: 1,
          // backgroundColor: Colors.red,
          // fontFamily: "Kanit-Regular", /* Load font from assets */
        ),
      ),
    );
  }
}
1
likes
120
points
22
downloads

Publisher

unverified uploader

Weekly Downloads

The Flutter SDK built incorporates the view of the liveness detection video recording feature.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

camera, dio, flutter, logger, path_provider, plugin_platform_interface, video_compress, video_thumbnail

More

Packages that depend on intp_flutter_liveness_sdk

Packages that implement intp_flutter_liveness_sdk