geweald / flutter_onfido

Flutter Onfido Plugin
MIT License
8 stars 20 forks source link

flutter_onfido

Onfido SDK flutter plugin. Inspired and based on Onfido react-native-sdk

Android SDK: 9.3.1

iOS SDK: 23.0

Project adjustments

Android

Enable multidex in android/app/build.gradle:

android {
  defaultConfig {
    ...
    multiDexEnabled true
  }
}

iOS

Update your iOS configuration files

Change ios/Podfile to use version 10:

platform :ios, '10.0'

Add descriptions for camera and microphone permissions to ios/YourProjectName/Info.plist:

<plist version="1.0">
<dict>
  <!-- Add these four elements: -->
    <key>NSCameraUsageDescription</key>
    <string>Required for document and facial capture</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>Required for video capture</string>
  <!-- ... -->
</dict>
</plist>

Usage

 var result = await FlutterOnfido.start(
    config: OnfidoConfig(
        sdkToken: "SDK_TOKEN_JWT",
        flowSteps: OnfidoFlowSteps(
            welcome: false,
            captureDocument: OnfidoCaptureDocumentStep(countryCode: OnfidoCountryCode.USA, docType: OnfidoDocumentType.GENERIC),
            captureFace: OnfidoCaptureFaceStep(OnfidoCaptureType.PHOTO),
        ),
    ),
    iosAppearance: OnfidoIOSAppearance(),
);

Parameters details:

Flow steps:

Theme

For iOS theme config use OnfidoAppearance class and its properties.

For Android in order to enhance the user experience on the transition between your application and the SDK, you can provide some customization by defining certain colors inside your own colors.xml file inside android folder and project:

Contributions

Inspired and based on Onfido react-native-sdk. Java has been changed to kotlin which I don't know well so code may be improved. I won't maintain this package very frequently, feel free to contribute! Some action points:

TODO:

Getting Started with Flutter plugins

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.