Black-screen + extra-90°-rotation on Android both came from
AVFoundation vs CameraX behaving differently at the preview output:
- AVFoundation: data-output connection's `videoOrientation`
pre-rotates sample buffers. The Flutter Texture displays them
upright; `device.activeFormat` reports the sensor-native size
synchronously.
- CameraX: the SurfaceProvider hands back a Surface; CameraX
writes raw sensor frames into it. Rotation is a *transform hint*
via Preview.setTargetRotation that consumers must apply
themselves. And the final negotiated resolution isn't known
until the first SurfaceRequest fires — which happens AFTER
bindToLifecycle, AFTER lifecycle.start, async on the camera
executor. So `create` was returning Size(0,0).
Surface extension to bridge the gap:
- UxCameraValue.previewRotationQuarterTurns (int 0/1/2/3).
iOS native always emits 0; Android native emits
`(sensorRotationDegrees / 90) % 4` for the active camera.
[UxCameraPreview] wraps the Texture in a RotatedBox by that many
quarter-turns (applied *before* the front-cam mirror so the
flip lives in screen space, not sensor space).
- UxCameraPreviewSizeChanged event. Android emits this from
PreviewSink.onResize whenever a SurfaceRequest carries a new
resolution; the controller copies it into value.previewSize.
First emission is what unblocks the camera_thumb's SizedBox
from its initial 0x0 = "render nothing" state.
- UxCameraBackend.setDescription's return changed from `Size` to
`({Size previewSize, int previewRotationQuarterTurns})` so
a lens swap can both update the rotation and signal that a new
previewSizeChanged event is incoming.
iOS continues to send previewSize in the create result (the active
format is known synchronously); no previewSizeChanged emission is
needed there. The new field is set to 0 in both create and
setDescription results on iOS.
25 lines
1020 B
Dart
25 lines
1020 B
Dart
/// Flutter toolkit for fluid, native-feeling UIs.
|
|
///
|
|
/// Includes [UxKeyboard] for frame-accurate keyboard height tracking,
|
|
/// [BendBox] for curved layout painting, and bezier curve utilities.
|
|
library;
|
|
|
|
export 'src/app_info.dart';
|
|
export 'src/bend_box.dart';
|
|
export 'src/json_extension.dart';
|
|
export 'src/bezier.dart';
|
|
export 'src/camera/camera.dart';
|
|
export 'src/camera/camera_backend.dart' show UxCameraBackend, UxCameraCreateResult, UxCameraEvent, UxCameraDeviceOrientationChanged, UxCameraSessionError, UxCameraSessionInterrupted, UxCameraSessionResumed, UxCameraDiagnostic, UxCameraPreviewSizeChanged;
|
|
export 'src/camera/camera_channel.dart' show MethodChannelUxCameraBackend;
|
|
export 'src/camera/camera_preview.dart';
|
|
export 'src/clipboard.dart';
|
|
export 'src/file.dart';
|
|
export 'src/gallery.dart';
|
|
export 'src/keyboard.dart';
|
|
export 'src/auto_map.dart';
|
|
export 'src/scanner.dart';
|
|
export 'src/sensor.dart';
|
|
export 'src/functional.dart';
|
|
export 'src/crash.dart';
|
|
export 'src/log.dart';
|
|
export 'src/log_http.dart'; |