Skip to content

Commit

Permalink
Fix baking again, add error builder for images
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Dec 20, 2024
1 parent c84820d commit ddcd5fe
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 83 deletions.
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| Version | Supported | |
| --------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| 2.2.3-dev | :warning: | [Docs](https://butterfly.linwood.dev/docs/2.1/intro) [Release](https://github.com/LinwoodDev/butterfly/releases/tag/v2.2.3-rc.1) |
| 2.2.3-dev | :warning: | [Docs](https://butterfly.linwood.dev/docs/2.1/intro) [Release](https://github.com/LinwoodDev/butterfly/releases/tag/v2.2.3-rc.2) |
| 2.2.2 | :white_check_mark: | [Docs](https://butterfly.linwood.dev/docs/2.2/intro) [Release](https://github.com/LinwoodDev/butterfly/releases/tag/v2.2.2) |
| 2.1.1 | :x: | [Docs](https://butterfly.linwood.dev/docs/2.1/intro) [Release](https://github.com/LinwoodDev/butterfly/releases/tag/v2.1.1) |
| 2.0.3 | :x: | [Docs](https://butterfly.linwood.dev/docs/2.0/intro) [Release](https://github.com/LinwoodDev/butterfly/releases/tag/v2.0.3) |
Expand Down
24 changes: 12 additions & 12 deletions api/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,10 @@ packages:
dependency: "direct dev"
description:
name: lints
sha256: "4a16b3f03741e1252fda5de3ce712666d010ba2122f8e912c94f9f7b90e1a4c3"
sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7
url: "https://pub.dev"
source: hosted
version: "5.1.0"
version: "5.1.1"
logging:
dependency: transitive
description:
Expand Down Expand Up @@ -419,10 +419,10 @@ packages:
dependency: transitive
description:
name: pubspec_parse
sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8
sha256: "81876843eb50dc2e1e5b151792c9a985c5ed2536914115ed04e9c8528f6647b0"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.4.0"
replay_bloc:
dependency: "direct main"
description:
Expand Down Expand Up @@ -523,18 +523,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
url: "https://pub.dev"
source: hosted
version: "1.12.0"
version: "1.12.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
sha256: "4ac0537115a24d772c408a2520ecd0abb99bca2ea9c4e634ccbdbfae64fe17ec"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
version: "2.1.3"
stream_transform:
dependency: transitive
description:
Expand Down Expand Up @@ -563,10 +563,10 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: "43490fe4c0f5ecb898f3fa1cdcdad8d521d7f6ff17ebdc4e8cd32b2e99524a20"
sha256: "8391fbe68d520daf2314121764d38e37f934c02fd7301ad18307bd93bd6b725d"
url: "https://pub.dev"
source: hosted
version: "1.25.13"
version: "1.25.14"
test_api:
dependency: transitive
description:
Expand Down Expand Up @@ -675,9 +675,9 @@ packages:
dependency: transitive
description:
name: yaml
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce
url: "https://pub.dev"
source: hosted
version: "3.1.2"
version: "3.1.3"
sdks:
dart: ">=3.6.0 <4.0.0"
4 changes: 2 additions & 2 deletions app/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.1025.0)
aws-partitions (1.1026.0)
aws-sdk-core (3.214.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
Expand Down Expand Up @@ -141,7 +141,7 @@ GEM
googleauth (~> 1.9)
mini_mime (~> 1.0)
google-logging-utils (0.1.0)
googleauth (1.12.1)
googleauth (1.12.2)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.2)
google-logging-utils (~> 0.1)
Expand Down
14 changes: 7 additions & 7 deletions app/lib/cubits/current_index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -493,16 +493,20 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
if (size.height <= 0 || size.width <= 0) {
return;
}
if (viewportSize != null) {
size *= resolution.multiplier;
}
var transform = state.transformCubit.state;
final realWidth = size.width / transform.size;
final realHeight = size.height / transform.size;
var rect = Rect.fromLTWH(
transform.position.dx, transform.position.dy, realWidth, realHeight);
var rect = Rect.fromLTWH(transform.position.dx, transform.position.dy,
realWidth / resolution.multiplier, realHeight / resolution.multiplier);
var renderers =
List<Renderer<PadElement>>.from(cameraViewport.unbakedElements);
final recorder = ui.PictureRecorder();
final canvas = ui.Canvas(recorder);
final friction = transform.friction;
rect = resolution.getRect(rect);
if (friction != null) {
final topLeft = Offset(
min(transform.position.dx, friction.beginPosition.dx),
Expand All @@ -511,7 +515,7 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
final bottomRight = Offset(
max(transform.position.dx, friction.beginPosition.dx),
max(transform.position.dy, friction.beginPosition.dy),
).translate(realWidth, realHeight);
).translate(size.width, size.height);
transform = transform.withPosition(topLeft);
rect = Rect.fromPoints(topLeft, bottomRight);
size = Size(bottomRight.dx - topLeft.dx, bottomRight.dy - topLeft.dy) *
Expand All @@ -520,12 +524,8 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
final document = blocState.data;
final page = blocState.page;
final info = blocState.info;
if (viewportSize != null) {
size *= resolution.multiplier;
}
final imageWidth = (size.width * ratio).ceil();
final imageHeight = (size.height * ratio).ceil();
rect = resolution.getRect(rect);
final renderTransform = transform.improve(resolution, rect.size);
final viewChanged = cameraViewport.width != size.width.ceil() ||
cameraViewport.height != size.height.ceil() ||
Expand Down
9 changes: 9 additions & 0 deletions app/lib/views/files/card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:typed_data';

import 'package:butterfly_api/butterfly_api.dart';
import 'package:flutter/material.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';

class AssetCard extends StatelessWidget {
const AssetCard({
Expand Down Expand Up @@ -40,6 +41,14 @@ class AssetCard extends StatelessWidget {
fit: BoxFit.cover,
width: 640,
alignment: Alignment.center,
errorBuilder: (context, error, stackTrace) {
return Center(
child: Icon(
PhosphorIconsLight.warningCircle,
color: colorScheme.onSurface,
),
);
},
),
),
if ((metadata?.name.isNotEmpty ?? false) ||
Expand Down
12 changes: 6 additions & 6 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: "4a16b3f03741e1252fda5de3ce712666d010ba2122f8e912c94f9f7b90e1a4c3"
sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7
url: "https://pub.dev"
source: hosted
version: "5.1.0"
version: "5.1.1"
logging:
dependency: transitive
description:
Expand Down Expand Up @@ -1120,10 +1120,10 @@ packages:
dependency: transitive
description:
name: pubspec_parse
sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8
sha256: "81876843eb50dc2e1e5b151792c9a985c5ed2536914115ed04e9c8528f6647b0"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.4.0"
qr:
dependency: transitive
description:
Expand Down Expand Up @@ -1630,10 +1630,10 @@ packages:
dependency: transitive
description:
name: yaml
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce
url: "https://pub.dev"
source: hosted
version: "3.1.2"
version: "3.1.3"
sdks:
dart: ">=3.6.0 <4.0.0"
flutter: ">=3.27.1"
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/react": "^4.1.1",
"@astrojs/react": "^4.1.2",
"@astrojs/starlight": "^0.30.3",
"@phosphor-icons/react": "^2.1.7",
"@types/react": "^19.0.2",
"@types/react-dom": "^19.0.2",
"astro": "^5.1.0",
"astro": "^5.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"remark-gemoji": "^8.0.0",
"remark-heading-id": "^1.0.1",
"sharp": "^0.33.5",
"typescript": "^5.7.2"
},
"packageManager": "[email protected].0",
"packageManager": "[email protected].1",
"devDependencies": {
"sass": "^1.83.0"
}
Expand Down
Loading

0 comments on commit ddcd5fe

Please sign in to comment.