Files
buzz/mobile/lib/features/profile/animated_avatar_orientation.dart
klopez4212 a0298539f7 Add mobile profile editing (#6583)
## Summary

- add mobile editing for display name, profile description, and profile
photo
- support image positioning, emoji backgrounds, and animated avatar
capture with native iOS controls
- refine settings navigation, profile motion, and the connection
identity row

## Testing

- `just mobile-check`
- `just mobile-test` (1,685 tests)

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Kenny Lopez <klopez4212@gmail.com>
Co-authored-by: Carl <3c4caeafb646d23867f1c4832e68211d77e2561946171625f75c3ce1a3f2670f@buzz.block.builderlab.xyz>
2026-08-24 20:26:28 +01:00

25 lines
980 B
Dart

import 'package:camera/camera.dart';
import 'package:flutter/services.dart';
/// Returns the clockwise correction for an Android animated-avatar frame.
///
/// Android image-stream buffers remain sensor-oriented. The correction must
/// account for both the sensor mount and the orientation in which the device
/// is currently held; front-facing frames are mirrored separately after this
/// rotation.
int animatedAvatarFrameRotationDegrees({
required int sensorOrientation,
required DeviceOrientation deviceOrientation,
required CameraLensDirection lensDirection,
}) {
final deviceOrientationDegrees = switch (deviceOrientation) {
DeviceOrientation.portraitUp => 0,
DeviceOrientation.landscapeRight => 90,
DeviceOrientation.portraitDown => 180,
DeviceOrientation.landscapeLeft => 270,
};
final facingSign = lensDirection == CameraLensDirection.back ? -1 : 1;
return (sensorOrientation - deviceOrientationDegrees * facingSign + 360) %
360;
}