CameraAwesomeBuilder.awesome constructor

  1. {Sensors sensor = Sensors.back,
  2. FlashMode flashMode = FlashMode.none,
  3. double zoom = 0.0,
  4. bool mirrorFrontCamera = false,
  5. bool enablePhysicalButton = false,
  6. CameraAspectRatios aspectRatio = CameraAspectRatios.ratio_4_3,
  7. ExifPreferences? exifPreferences,
  8. bool enableAudio = true,
  9. Widget? progressIndicator,
  10. required SaveConfig saveConfig,
  11. dynamic onMediaTap(
    1. MediaCapture
  12. AwesomeFilter? filter,
  13. OnImageForAnalysis? onImageForAnalysis,
  14. AnalysisConfig? imageAnalysisConfig,
  15. OnPreviewTap onPreviewTapBuilder(
    1. CameraState
  16. OnPreviewScale onPreviewScaleBuilder(
    1. CameraState
  17. CameraPreviewFit? previewFit,
  18. CameraLayoutBuilder? previewDecoratorBuilder,
  19. AwesomeTheme? theme,
  20. Widget topActionsBuilder(
    1. CameraState state
  21. Widget bottomActionsBuilder(
    1. CameraState state
  22. Widget middleContentBuilder(
    1. CameraState state
  23. EdgeInsets previewPadding =,
  24. Alignment previewAlignment =}

Use the camera with the built-in interface.

You need to provide a SaveConfig to define if you want to take photos, videos or both and where to save them.

You can initiate the camera with a few parameters:

  • which sensor to use (front or back)
  • which flashMode to use
  • how much zoom you want (0.0 = no zoom, 1.0 = max zoom)
  • enableAudio when recording a video or not
  • exifPreferences to indicate if you want to save GPS location when taking photos

If you want to customize the UI of the camera, you have several options:

  • use a progressIndicator and define what to do when the preview of the last media taken is tapped thanks to onMediaTap
  • use topActionsBuilder, bottomActionsBuilder, and middleContentBuilder which let you build entirely the UI similarly to how the built-in UI is done. Check AwesomeCameraLayout for more details.
  • build your UI entirely thanks to the custom constructor.

If you want to do image analysis (for AI for instance), you can set the imageAnaysisConfig and listen to the stream of images with onImageForAnalysis.


  Sensors sensor = Sensors.back,
  FlashMode flashMode = FlashMode.none,
  double zoom = 0.0,
  bool mirrorFrontCamera = false,
  bool enablePhysicalButton = false,
  CameraAspectRatios aspectRatio = CameraAspectRatios.ratio_4_3,
  ExifPreferences? exifPreferences,
  bool enableAudio = true,
  Widget? progressIndicator,
  required SaveConfig saveConfig,
  Function(MediaCapture)? onMediaTap,
  AwesomeFilter? filter,
  OnImageForAnalysis? onImageForAnalysis,
  AnalysisConfig? imageAnalysisConfig,
  OnPreviewTap Function(CameraState)? onPreviewTapBuilder,
  OnPreviewScale Function(CameraState)? onPreviewScaleBuilder,
  CameraPreviewFit? previewFit,
  CameraLayoutBuilder? previewDecoratorBuilder,
  AwesomeTheme? theme,
  Widget Function(CameraState state)? topActionsBuilder,
  Widget Function(CameraState state)? bottomActionsBuilder,
  Widget Function(CameraState state)? middleContentBuilder,
  EdgeInsets previewPadding =,
  Alignment previewAlignment =,
}) : this._(
        sensor: sensor,
        flashMode: flashMode,
        zoom: zoom,
        mirrorFrontCamera: mirrorFrontCamera,
        aspectRatio: aspectRatio,
        exifPreferences: exifPreferences,
        enableAudio: enableAudio,
        enablePhysicalButton: enablePhysicalButton,
        progressIndicator: progressIndicator,
        builder: (cameraModeState, previewSize, previewRect) {
          return AwesomeCameraLayout(
            state: cameraModeState,
            onMediaTap: onMediaTap,
            topActions: topActionsBuilder?.call(cameraModeState),
            bottomActions: bottomActionsBuilder?.call(cameraModeState),
            middleContent: middleContentBuilder?.call(cameraModeState),
        filter: filter,
        saveConfig: saveConfig,
        onMediaTap: onMediaTap,
        onImageForAnalysis: onImageForAnalysis,
        imageAnalysisConfig: imageAnalysisConfig,
        onPreviewTapBuilder: onPreviewTapBuilder,
        onPreviewScaleBuilder: onPreviewScaleBuilder,
        previewFit: previewFit ?? CameraPreviewFit.cover,
        previewDecoratorBuilder: previewDecoratorBuilder,
        theme: theme ?? AwesomeTheme(),
        previewPadding: previewPadding,
        previewAlignment: previewAlignment,