CameraAwesomeBuilder.awesome constructor
CameraAwesomeBuilder.awesome({
- SensorConfig? sensorConfig,
- bool enablePhysicalButton = false,
- Widget? progressIndicator,
- required SaveConfig saveConfig,
- dynamic onMediaTap()?,
- OnImageForAnalysis? onImageForAnalysis,
- AnalysisConfig? imageAnalysisConfig,
- OnPreviewTap onPreviewTapBuilder()?,
- OnPreviewScale onPreviewScaleBuilder()?,
- CameraPreviewFit? previewFit,
- CameraLayoutBuilder? previewDecoratorBuilder,
- AwesomeTheme? theme,
- Widget topActionsBuilder(
- CameraState state
- Widget bottomActionsBuilder(
- CameraState state
- Widget middleContentBuilder(
- CameraState state
- EdgeInsets previewPadding = EdgeInsets.zero,
- Alignment previewAlignment = Alignment.center,
- PictureInPictureConfigBuilder? pictureInPictureConfigBuilder,
- AwesomeFilter? defaultFilter,
- List<
AwesomeFilter> ? availableFilters, - OnMediaCaptureEvent? onMediaCaptureEvent,
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 through the SensorConfig:
- which
sensors
to use (front
orback
) - which
flashMode
to use - how much zoom you want (0.0 = no zoom, 1.0 = max zoom)
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 toonMediaTap
- use
topActionsBuilder
,bottomActionsBuilder
, andmiddleContentBuilder
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
.
Implementation
CameraAwesomeBuilder.awesome(
{SensorConfig? sensorConfig,
bool enablePhysicalButton = false,
Widget? progressIndicator,
required SaveConfig saveConfig,
Function(MediaCapture)? onMediaTap,
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 = EdgeInsets.zero,
Alignment previewAlignment = Alignment.center,
PictureInPictureConfigBuilder? pictureInPictureConfigBuilder,
AwesomeFilter? defaultFilter,
List<AwesomeFilter>? availableFilters,
OnMediaCaptureEvent? onMediaCaptureEvent})
: this._(
sensorConfig: sensorConfig ??
SensorConfig.single(
sensor: Sensor.position(SensorPosition.back),
),
enablePhysicalButton: enablePhysicalButton,
progressIndicator: progressIndicator,
builder: (cameraModeState, preview) {
return AwesomeCameraLayout(
state: cameraModeState,
onMediaTap: onMediaTap,
topActions: topActionsBuilder?.call(cameraModeState),
bottomActions: bottomActionsBuilder?.call(cameraModeState),
middleContent: middleContentBuilder?.call(cameraModeState),
);
},
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,
pictureInPictureConfigBuilder: pictureInPictureConfigBuilder,
defaultFilter: defaultFilter,
availableFilters: availableFilters ?? awesomePresetFiltersList,
onMediaCaptureEvent: onMediaCaptureEvent,
);