enrollWithoutServerPushingWidget method

Widget enrollWithoutServerPushingWidget({
  1. required bool withGlasses,
  2. required dynamic onPercentageChanged(
    1. dynamic
    ),
  3. required dynamic onCountdownStarted(
    1. dynamic
    ),
  4. required dynamic onCompleted(
    1. Map<String, dynamic>
    ),
  5. required dynamic onFailed(
    1. dynamic
    ),
  6. required Widget customPermissionBuilder(
    1. dynamic
    ),
  7. required Widget onLoadingWidget,
  8. required Widget faceMaskOverlay,
  9. required Stack builder(
    1. Widget,
    2. FlutterSmartfacePlatformCameraController
    ),
  10. SmartfaceCameraPosition? cameraPosition = SmartfaceCameraPosition.front,
})

Creates a widget for enrolling without server pushing.

This widget handles the enrollment process with various callbacks and customizations.

Parameters:

  • withGlasses (required): A boolean indicating if the user is wearing glasses.
  • onPercentageChanged (required): A callback function that is triggered when the percentage changes.
  • onCountdownStarted (required): A callback function that is triggered when the countdown starts.
  • onCompleted (required): A callback function that is triggered when the enrollment is completed. It receives a map of string to dynamic values.
  • onFailed (required): A callback function that is triggered when the enrollment fails.
  • customPermissionBuilder (required): A function that returns a widget for custom permission handling.
  • onLoadingWidget (required): A widget to display while loading.
  • faceMaskOverlay (required): A widget to overlay on the face mask.
  • builder (required): A function that returns a stack of widgets and a camera controller.

Returns: A widget that handles the enrollment process.

Implementation

Widget enrollWithoutServerPushingWidget({
  required bool withGlasses,
  required Function(dynamic) onPercentageChanged,
  required Function(dynamic) onCountdownStarted,
  required Function(Map<String, dynamic>) onCompleted,
  required Function(dynamic) onFailed,
  required Widget Function(dynamic) customPermissionBuilder,
  required Widget onLoadingWidget,
  required Widget faceMaskOverlay,
  required Stack Function(Widget, FlutterSmartfacePlatformCameraController)
      builder,
  SmartfaceCameraPosition? cameraPosition = SmartfaceCameraPosition.front,
}) {
  return platformViewLink(
    cameraPosition: cameraPosition,
    creationParams: {
      'withGlasses': withGlasses,
      'withoutServerPushing': true,
      'counter': 3,
    },
    onPercentageChanged: onPercentageChanged,
    onCountdownStarted: onCountdownStarted,
    onCompleted: (arguments) {
      final Map<String, dynamic> args = jsonDecode(arguments);
      onCompleted(args);
    },
    onFailed: onFailed,
    customPermissionBuilder: customPermissionBuilder,
    onLoadingWidget: onLoadingWidget,
    faceMaskOverlay: faceMaskOverlay,
    builder: builder,
    viewType: 'enroll_finish_view',
  );
}