buildFlashModeSwitch method

Widget buildFlashModeSwitch(
  1. BuildContext context,
  2. CameraValue value
)

The button to switch flash modes. 切换闪光灯模式的按钮

Implementation

Widget buildFlashModeSwitch(BuildContext context, CameraValue value) {
  IconData icon;
  switch (value.flashMode) {
    case FlashMode.off:
      icon = Icons.flash_off;
      break;
    case FlashMode.auto:
      icon = Icons.flash_auto;
      break;
    case FlashMode.always:
      icon = Icons.flash_on;
      break;
    case FlashMode.torch:
      icon = Icons.flashlight_on;
      break;
  }
  return IconButton(
    onPressed: () => switchFlashesMode(value),
    tooltip: textDelegate.sFlashModeLabel(value.flashMode),
    icon: Icon(icon, size: 24),
  );
}