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

outdated

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

example/lib/main.dart

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> {
  @override
  Widget build(BuildContext context) {
    SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);

    Future<String?> _buildDialog(Map<String, dynamic> value) {
      debugPrint("_buildDialog: $value");

      String content = "Detection success !!!";

      if (!value['detectSuccess']) {
        content = "Detection failed !!!";
      }

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

      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'),
            ),
          ],
        ),
      );
    }

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SafeArea(
        child: Container(
          child: LivenessCamera(
            livenessResponse: (Map<String, dynamic> value) {
              // handle your next event or navigation from below
              _buildDialog(value);
            },
            endpoint: "API_ENDPOINT",
            apiKey: "API_KEY",
            // actionsInstruction: const {
            //   'NOD_HEAD': "Please nod your head",
            //   'MOUTH': "Please open your mouth",
            // },
            // numberOfActions: 2,
            // numberOfRetry: 0,
            // backgroundColor: Colors.red,
            // fontFamily: "Roboto",
            // prepareText: "Position your face in the circle.",
            // prepareFontColor: Colors.amber,
            // prepareFontSize: 24,
            // loadingColor: Colors.amber,
            // loadingSize: 50.0,
            // buttonLabel: "Start",
            // buttonStyle: ElevatedButton.styleFrom(
            //   primary: Colors.red
            // ),
            // buttonPadding: EdgeInsets.all(100),
          ),
        ),
      ),
    );
  }
}
1
likes
0
points
16
downloads

Publisher

unverified uploader

Weekly Downloads

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

Homepage

License

unknown (license)

Dependencies

camera, dio, flutter, logger, plugin_platform_interface, video_player

More

Packages that depend on intp_flutter_liveness_sdk

Packages that implement intp_flutter_liveness_sdk