Files
buzz/mobile/lib/features/profile/image_avatar_capture/shutter_button.dart
klopez4212 9aa332af03 Add inline profile camera capture (#6680)
## Summary

- add inline profile photo capture with smooth avatar-to-viewfinder
transitions
- add close, flip, shutter, retry, and use-photo states with haptics and
front-camera mirroring
- polish iOS liquid-glass controls and avatar editor motion

### Related issue

Follow-up to #6583.

### Testing

- just mobile-check
- just mobile-test (1,743 tests)
- built, installed, and launched on Pixel 10 and iPhone Air

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Code Reviewer <037593536284cf40e221c96c931e9877d4166d54f6bb84e5341a86d7fd5d05a4@buzz.block.builderlab.xyz>
Signed-off-by: Perci <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@buzz.block.builderlab.xyz>
Signed-off-by: Max <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@buzz.block.builderlab.xyz>
Signed-off-by: Wren <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@buzz.block.builderlab.xyz>
Signed-off-by: Meli <5aaa86bce934fc3445fc254aab560a40923f10252f92107e665073dede0e04d3@buzz.block.builderlab.xyz>
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Co-authored-by: Code Reviewer <037593536284cf40e221c96c931e9877d4166d54f6bb84e5341a86d7fd5d05a4@buzz.block.builderlab.xyz>
Co-authored-by: Tyler <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: Perci <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@buzz.block.builderlab.xyz>
Co-authored-by: Max <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@buzz.block.builderlab.xyz>
Co-authored-by: Wren <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@buzz.block.builderlab.xyz>
Co-authored-by: Meli <5aaa86bce934fc3445fc254aab560a40923f10252f92107e665073dede0e04d3@buzz.block.builderlab.xyz>
Co-authored-by: morgmart <98432065+morgmart@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-08-25 14:58:55 +01:00

76 lines
2.7 KiB
Dart

part of '../image_avatar_capture.dart';
class _ShutterButton extends StatelessWidget {
const _ShutterButton({required this.busy, required this.onTap});
final bool busy;
final VoidCallback? onTap;
@override
Widget build(BuildContext context) {
final reduceMotion = MediaQuery.disableAnimationsOf(context);
final isIos = defaultTargetPlatform == TargetPlatform.iOS;
final content = SizedBox(
key: const ValueKey('image-camera-shutter-morph'),
width: _shutterSize,
height: _shutterSize,
child: isIos
? IosGlassNavigationButton(
icon: IosGlassNavigationIcon.shutter,
semanticLabel: 'Take photo',
onPressed: onTap,
width: _shutterSize,
height: _shutterSize,
controlSize: _shutterSize,
foregroundColor: context.colors.onSurface,
isBusy: busy,
)
: Material(
color: context.colors.surfaceContainerHighest,
shape: const CircleBorder(),
clipBehavior: Clip.antiAlias,
child: InkWell(
key: const ValueKey('image-camera-shutter'),
onTap: onTap,
child: Center(
child: AnimatedSwitcher(
duration: reduceMotion
? Duration.zero
: const Duration(milliseconds: 140),
switchInCurve: Curves.easeOutCubic,
switchOutCurve: Curves.easeOutCubic,
child: busy
? BuzzLoadingIndicator(
key: const ValueKey('image-camera-capturing'),
size: 24,
color: context.colors.onSurface,
semanticLabel: 'Taking photo',
)
: Container(
key: const ValueKey('image-camera-shutter-icon'),
width: _shutterCoreSize,
height: _shutterCoreSize,
decoration: BoxDecoration(
color: context.colors.onSurface,
shape: BoxShape.circle,
border: Border.all(
color: context.colors.surface,
width: 1.5,
),
),
),
),
),
),
),
);
if (isIos) return content;
return Semantics(
label: 'Take photo',
button: true,
enabled: onTap != null,
child: ExcludeSemantics(child: content),
);
}
}