Skip to content

Commit

Permalink
fix(lib): fix preview when container has an infinite dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Jun 7, 2024
1 parent 32b9f4c commit 168695d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/src/apivideo_camera_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ class _ApiVideoCameraPreviewState extends State<ApiVideoCameraPreview> {
Widget _buildFittedPreview(
BoxConstraints constraints, NativeDeviceOrientation orientation) {
final orientedSize = _size.orientate(orientation);
final fittedSize =
applyBoxFit(widget.fit, orientedSize, constraints.biggest);
// See https://github.com/flutter/flutter/issues/17287
return SizedBox(
width: constraints.maxWidth,
height: constraints.maxHeight,
return Container(
width: fittedSize.destination.width,
height: fittedSize.destination.height,
child: FittedBox(
fit: widget.fit,
clipBehavior: Clip.hardEdge,
Expand Down

0 comments on commit 168695d

Please sign in to comment.