diff --git a/lib/screens/capture_screen.dart b/lib/screens/capture_screen.dart index e1f7f21..26d4f2c 100644 --- a/lib/screens/capture_screen.dart +++ b/lib/screens/capture_screen.dart @@ -24,6 +24,7 @@ int? _countdown; Timer? _countdownTimer; Uint8List? _snapshotBytes; + bool _hideOverlay = false; final _rawCaptureService = RawCaptureService(); @override @@ -65,7 +66,10 @@ } Future _captureWithSnapshot() async { - // PixelCopy でカメラ領域のスナップショットを瞬時に取得 + // オーバーレイを非表示にしてからキャプチャ + setState(() => _hideOverlay = true); + await Future.delayed(const Duration(milliseconds: 50)); + try { if (!mounted) return; final renderBox = context.findRenderObject() as RenderBox?; @@ -84,10 +88,13 @@ width: (size.width * ratio).round(), height: (size.height * ratio).round(), ); - setState(() => _snapshotBytes = bytes); + setState(() { + _snapshotBytes = bytes; + _hideOverlay = false; + }); } } catch (_) { - // 失敗しても撮影は続行 + setState(() => _hideOverlay = false); } if (!mounted) return; @@ -230,44 +237,46 @@ ), ), // タイマー切り替えボタン(左側) - Positioned( - left: 24, - bottom: 36, - child: GestureDetector( - onTap: () { - _cancelCountdown(); - setState(() => _timerEnabled = !_timerEnabled); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Icon( - _timerEnabled ? Icons.timer : Icons.timer_off, - color: Colors.black, - size: 40, - ), - Icon( - _timerEnabled ? Icons.timer : Icons.timer_off, - color: _timerEnabled ? Colors.yellow : Colors.grey, - size: 32, - ), - ], + if (!cameraProvider.isSaving && !_hideOverlay) + Positioned( + left: 24, + bottom: 36, + child: GestureDetector( + onTap: () { + _cancelCountdown(); + setState(() => _timerEnabled = !_timerEnabled); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Icon( + _timerEnabled ? Icons.timer : Icons.timer_off, + color: Colors.black, + size: 40, + ), + Icon( + _timerEnabled ? Icons.timer : Icons.timer_off, + color: _timerEnabled ? Colors.yellow : Colors.grey, + size: 32, + ), + ], + ), ), ), - ), // シャッターボタン(中央) - Positioned( - left: 0, - right: 0, - bottom: 24, - child: Center( - child: ShutterButton( - onPressed: cameraProvider.isSaving || _countdown != null - ? () {} - : _onShutterPressed, + if (!cameraProvider.isSaving && !_hideOverlay) + Positioned( + left: 0, + right: 0, + bottom: 24, + child: Center( + child: ShutterButton( + onPressed: cameraProvider.isSaving || _countdown != null + ? () {} + : _onShutterPressed, + ), ), ), - ), ], ); }