Skip to content

Commit

Permalink
fix(mobile): don't crop memories in landscape mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hrdl committed Feb 9, 2024
1 parent b67fddf commit 425a925
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions mobile/lib/modules/memories/ui/memory_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,7 @@ class MemoryCard extends StatelessWidget {
LayoutBuilder(
builder: (context, constraints) {
// Determine the fit using the aspect ratio
BoxFit fit = BoxFit.fitWidth;
if (asset.width != null && asset.height != null) {
final aspectRatio = asset.height! / asset.width!;
final phoneAspectRatio =
constraints.maxWidth / constraints.maxHeight;
// Look for a 25% difference in either direction
if (phoneAspectRatio * .75 < aspectRatio &&
phoneAspectRatio * 1.25 > aspectRatio) {
// Cover to look nice if we have nearly the same aspect ratio
fit = BoxFit.cover;
}
}
BoxFit fit = BoxFit.contain;

if (asset.isImage) {
return Hero(
Expand Down

0 comments on commit 425a925

Please sign in to comment.