identifyWidget method

Widget identifyWidget({
  1. required dynamic onIdentify(
    1. dynamic
    ),
  2. required Widget customPermissionBuilder(
    1. dynamic
    ),
  3. dynamic onFps(
    1. dynamic
    )?,
  4. required Center onLoadingWidget,
  5. required Widget faceMaskOverlay,
  6. required Stack builder(
    1. Widget,
    2. FlutterSmartfacePlatformCameraController
    ),
  7. double? securityLevel,
  8. double? livenessThreshold,
  9. bool livenessEnabled = false,
  10. bool saveImage = false,
  11. bool keepIdentification = false,
  12. Duration identifyTimeout = const Duration(seconds: 5),
  13. SmartfaceCameraPosition? cameraPosition = SmartfaceCameraPosition.front,
  14. bool enableCheckImageQuality = false,
})

Creates a widget for identifying faces with various customization options.

The identifyWidget method returns a widget that integrates face identification functionality with customizable components.

Parameters:

  • onIdentify: A required callback function that is triggered when a face is identified.
  • customPermissionBuilder: A required builder function that returns a widget for custom permission handling.
  • onFps: An optional callback function that is triggered with the current frames per second (FPS).
  • onLoadingWidget: A required widget that is displayed while the identification process is loading.
  • faceMaskOverlay: A required widget that overlays the face mask on the camera view.
  • builder: A required builder function that returns a stack widget containing the camera view and the controller.

Returns:

  • A widget that integrates face identification with the provided customization options.

Implementation

Widget identifyWidget({
  required Function(dynamic) onIdentify,
  required Widget Function(dynamic) customPermissionBuilder,
  Function(dynamic)? onFps,
  required Center onLoadingWidget,
  required Widget faceMaskOverlay,
  required Stack Function(Widget, FlutterSmartfacePlatformCameraController)
      builder,
  double? securityLevel,
  double? livenessThreshold,
  bool livenessEnabled = false,
  bool saveImage = false,
  bool keepIdentification = false,
  Duration identifyTimeout = const Duration(seconds: 5),
  SmartfaceCameraPosition? cameraPosition = SmartfaceCameraPosition.front,
  bool enableCheckImageQuality = false,
}) {
  return platformViewLink(
    cameraPosition: cameraPosition,
    onFps: onFps,
    onIdentify: onIdentify,
    customPermissionBuilder: customPermissionBuilder,
    onLoadingWidget: onLoadingWidget,
    faceMaskOverlay: faceMaskOverlay,
    builder: builder,
    viewType: 'identify_view',
    creationParams: {
      'livenessEnabled': livenessEnabled,
      'livenessThreshold': livenessThreshold,
      'securityLevel': securityLevel,
      'saveImage': saveImage,
      'keepIdentification': keepIdentification,
      'identifyTimeout': identifyTimeout.inMilliseconds,
      'enableCheckImageQuality': enableCheckImageQuality,
    },
  );
}