AwesomeBottomActions constructor

AwesomeBottomActions({
  1. Key? key,
  2. required CameraState state,
  3. Widget? left,
  4. Widget? right,
  5. Widget? captureButton,
  6. OnMediaTap? onMediaTap,
  7. EdgeInsets padding = const EdgeInsets.symmetric(vertical: 8),
})

Implementation

AwesomeBottomActions({
  super.key,
  required this.state,
  Widget? left,
  Widget? right,
  Widget? captureButton,
  OnMediaTap? onMediaTap,
  this.padding = const EdgeInsets.symmetric(vertical: 8),
})  : captureButton = captureButton ??
          AwesomeCaptureButton(
            state: state,
          ),
      left = left ??
          (state is VideoRecordingCameraState
              ? AwesomePauseResumeButton(
                  state: state,
                )
              : Builder(builder: (context) {
                  final theme = AwesomeThemeProvider.of(context).theme;
                  return AwesomeCameraSwitchButton(
                    state: state,
                    theme: theme.copyWith(
                      buttonTheme: theme.buttonTheme.copyWith(
                        backgroundColor: Colors.white12,
                      ),
                    ),
                  );
                })),
      right = right ??
          (state is VideoRecordingCameraState
              ? const SizedBox(width: 48)
              : StreamBuilder<MediaCapture?>(
                  stream: state.captureState$,
                  builder: (context, snapshot) {
                    if (!snapshot.hasData) {
                      return const SizedBox(width: 60, height: 60);
                    }
                    return SizedBox(
                      width: 60,
                      child: AwesomeMediaPreview(
                        mediaCapture: snapshot.requireData,
                        onMediaTap: onMediaTap,
                      ),
                    );
                  },
                ));