buildCaptureButton method

Widget buildCaptureButton(
  1. BoxConstraints constraints
)

The shooting button. 拍照按钮

Implementation

Widget buildCaptureButton(BoxConstraints constraints) {
  const Size outerSize = Size.square(115);
  const Size innerSize = Size.square(82);
  return Semantics(
    label: textDelegate.sActionShootingButtonTooltip,
    onTap: onTap,
    onTapHint: onTapHint,
    onLongPress: onLongPress,
    onLongPressHint: onLongPressHint,
    child: Listener(
      behavior: HitTestBehavior.opaque,
      onPointerUp: onPointerUp,
      onPointerMove: onPointerMove(constraints),
      child: GestureDetector(
        onTap: onTap,
        onLongPress: onLongPress,
        child: SizedBox.fromSize(
          size: outerSize,
          child: Stack(
            children: <Widget>[
              Center(
                child: AnimatedContainer(
                  duration: kThemeChangeDuration,
                  width: isShootingButtonAnimate
                      ? outerSize.width
                      : innerSize.width,
                  height: isShootingButtonAnimate
                      ? outerSize.height
                      : innerSize.height,
                  padding: EdgeInsets.all(isShootingButtonAnimate ? 41 : 11),
                  decoration: BoxDecoration(
                    color: theme.canvasColor.withOpacity(0.85),
                    shape: BoxShape.circle,
                  ),
                  child: const DecoratedBox(
                    decoration: BoxDecoration(
                      color: Colors.white,
                      shape: BoxShape.circle,
                    ),
                  ),
                ),
              ),
              if ((innerController?.value.isRecordingVideo ?? false) &&
                  isRecordingRestricted)
                CameraProgressButton(
                  isAnimating: isShootingButtonAnimate,
                  duration: pickerConfig.maximumRecordingDuration!,
                  outerRadius: outerSize.width,
                  ringsColor: theme.indicatorColor,
                  ringsWidth: 2,
                ),
            ],
          ),
        ),
      ),
    ),
  );
}