AwesomeFlashButton constructor

AwesomeFlashButton({
  1. Key? key,
  2. required CameraState state,
  3. AwesomeTheme? theme,
  4. Widget iconBuilder(
    1. FlashMode
    )?,
  5. void onFlashTap(
    1. SensorConfig,
    2. FlashMode
    )?,
})

Implementation

AwesomeFlashButton({
  super.key,
  required this.state,
  this.theme,
  Widget Function(FlashMode)? iconBuilder,
  void Function(SensorConfig, FlashMode)? onFlashTap,
})  : iconBuilder = iconBuilder ??
          ((flashMode) {
            final IconData icon;
            switch (flashMode) {
              case FlashMode.none:
                icon = Icons.flash_off;
                break;
              case FlashMode.on:
                icon = Icons.flash_on;
                break;
              case FlashMode.auto:
                icon = Icons.flash_auto;
                break;
              case FlashMode.always:
                icon = Icons.flashlight_on;
                break;
            }
            return AwesomeCircleWidget.icon(
              icon: icon,
              theme: theme,
            );
          }),
      onFlashTap = onFlashTap ??
          ((sensorConfig, flashMode) => sensorConfig.switchCameraFlash());