fixed client-reported crashes in the pdf viewer, image picker and prosemirror images, mapped webdav errors to user messages and hardened keychain, cache and push stores against io failures
This commit is contained in:
1 parent
c5592f117b
commit
23e4510bf8
19 files changed
+545
-55
No files matched your search
@@ -42,7 +42,7 @@ class PmImageView extends StatelessWidget {
|
||||
final available = constraints.maxWidth.isFinite
|
||||
? constraints.maxWidth
|
||||
: MediaQuery.sizeOf(context).width;
|
||||
final targetWidth = _resolveWidth(node.width, available);
|
||||
final targetWidth = resolvePmImageWidth(node.width, available);
|
||||
|
||||
Widget image = ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: targetWidth ?? available),
|
||||
@@ -121,16 +121,20 @@ class PmImageView extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
double? _resolveWidth(String? width, double available) {
|
||||
if (width == null) return null;
|
||||
final length = parsePmCssLength(width);
|
||||
if (length == null) return null;
|
||||
final value = length.value;
|
||||
final resolved = switch (length.unit) {
|
||||
'%' => available * value / 100,
|
||||
'em' || 'rem' => value * 16,
|
||||
_ => value,
|
||||
};
|
||||
return resolved.clamp(1, available);
|
||||
}
|
||||
}
|
||||
|
||||
/// Resolves a CSS `width` attribute against [available] pixels, or `null` when
|
||||
/// the image should simply fill what it gets. Layout may hand out zero width
|
||||
/// mid-animation, which would otherwise invert the clamp bounds.
|
||||
double? resolvePmImageWidth(String? width, double available) {
|
||||
if (width == null || available < 1) return null;
|
||||
final length = parsePmCssLength(width);
|
||||
if (length == null) return null;
|
||||
final value = length.value;
|
||||
final resolved = switch (length.unit) {
|
||||
'%' => available * value / 100,
|
||||
'em' || 'rem' => value * 16,
|
||||
_ => value,
|
||||
};
|
||||
return resolved.clamp(1, available);
|
||||
}
|
||||
Reference in new issue
Block a user