Skip to content

Commit

Permalink
fix: cropper overflow on web
Browse files Browse the repository at this point in the history
  • Loading branch information
borgoat committed Jan 3, 2025
1 parent dc944d9 commit dfd337f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 6 deletions.
24 changes: 18 additions & 6 deletions lib/presentation/widgets/image_form_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,24 @@ class _ImageFormFieldState extends FormFieldState<XFile> {

try {
final cropped = await _imageCropper.cropImage(
sourcePath: imageFile.path,
aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1),
compressFormat: ImageCompressFormat.jpg,
maxHeight: 512,
maxWidth: 512,
uiSettings: [if (context.mounted) WebUiSettings(context: context)]);
sourcePath: imageFile.path,
aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1),
compressFormat: ImageCompressFormat.jpg,
maxHeight: 512,
maxWidth: 512,
uiSettings: [
if (context.mounted)
WebUiSettings(
context: context,
// https://github.com/hnvn/flutter_image_cropper/issues/529
// Hack to avoid the cropper being too big on the web, at least
// initially, as resizing the window won't resize the cropper.
size: CropperSize(
height: MediaQuery.of(context).size.height ~/ 2,
),
),
],
);
if (cropped == null) return null;
return XFile(cropped.path);
} catch (e) {
Expand Down
34 changes: 34 additions & 0 deletions macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,23 @@ PODS:
- GTMSessionFetcher/Core (3.5.0)
- GTMSessionFetcher/Full (3.5.0):
- GTMSessionFetcher/Core
- in_app_review (2.0.0):
- FlutterMacOS
- package_info_plus (0.0.1):
- FlutterMacOS
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- PostHog (3.18.0)
- posthog_flutter (0.0.1):
- Flutter
- FlutterMacOS
- PostHog (~> 3.0)
- Sentry/HybridSDK (8.42.0)
- sentry_flutter (8.12.0):
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.42.0)
- share_plus (0.0.1):
- FlutterMacOS
- shared_preferences_foundation (0.0.1):
Expand All @@ -46,7 +60,11 @@ DEPENDENCIES:
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- google_sign_in_ios (from `Flutter/ephemeral/.symlinks/plugins/google_sign_in_ios/darwin`)
- in_app_review (from `Flutter/ephemeral/.symlinks/plugins/in_app_review/macos`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- posthog_flutter (from `Flutter/ephemeral/.symlinks/plugins/posthog_flutter/macos`)
- sentry_flutter (from `Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos`)
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- sign_in_with_apple (from `Flutter/ephemeral/.symlinks/plugins/sign_in_with_apple/macos`)
Expand All @@ -58,6 +76,8 @@ SPEC REPOS:
- GoogleSignIn
- GTMAppAuth
- GTMSessionFetcher
- PostHog
- Sentry

EXTERNAL SOURCES:
app_links:
Expand All @@ -68,8 +88,16 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral
google_sign_in_ios:
:path: Flutter/ephemeral/.symlinks/plugins/google_sign_in_ios/darwin
in_app_review:
:path: Flutter/ephemeral/.symlinks/plugins/in_app_review/macos
package_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
posthog_flutter:
:path: Flutter/ephemeral/.symlinks/plugins/posthog_flutter/macos
sentry_flutter:
:path: Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos
share_plus:
:path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
shared_preferences_foundation:
Expand All @@ -88,7 +116,13 @@ SPEC CHECKSUMS:
GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db
GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
in_app_review: 0599bccaed5e02f6bed2b0d30d16f86b63ed8638
package_info_plus: f0052d280d17aa382b932f399edf32507174e870
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
PostHog: 6ce18b57e7de83868707dec4a0c35ebbc866e88b
posthog_flutter: 37053225347313fb5385539b300a8237fae24e34
Sentry: 38ed8bf38eab5812787274bf591e528074c19e02
sentry_flutter: a72ca0eb6e78335db7c4ddcddd1b9f6c8ed5b764
share_plus: 510bf0af1a42cd602274b4629920c9649c52f4cc
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sign_in_with_apple: 6673c03c9e3643f6c8d33601943fbfa9ae99f94e
Expand Down

0 comments on commit dfd337f

Please sign in to comment.