← Back to Pull requests

Fix/image cropper web settings #565

Open
RAJEEVTIWARI8052 opened this pull request with 75 lines diff across 5 files
View on GitHub
RAJEEVTIWARI8052 RAJEEVTIWARI8052 commented on Mar 26, 2026 14:18 UTC
Author

Fixes #563
Fixes #564

Describe the changes you have made in this PR:


  • Refactored UsersApi.updateProfile to accept XFile instead of File.

  • Implemented MultipartFile.fromBytes for profile image uploads to ensure cross-platform compatibility (Web/Mobile).

  • Updated EditProfileViewModel to use CroppedFile (XFile compatible) for the updated image.

  • Updated EditProfileView with a platform-aware image preview (NetworkImage for Web, FileImage for Mobile).

  • Added mandatory WebUiSettings to the ImageCropper call.
  • Why these changes were necessary:


    The app crashed on Web whenever a user tried to pick or upload a profile photo because dart:io and native file paths are not supported in browsers. These changes make the profile update feature fully functional on the Web.

    before fixing bug

    <img width="1470" height="956" alt="Screenshot 2026-03-26 at 7 12 44 PM" src="https://github.com/user-attachments/assets/154bcc60-6445-49c9-996b-fb65fc22dfd4" />
    after fixing bug ->i can edit the profile photo
    <img width="1470" height="956" alt="Screenshot 2026-03-26 at 7 43 18 PM" src="https://github.com/user-attachments/assets/6f99ea61-311e-45a6-9522-84552c1a9a95" />

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Release Notes

    Improvements
    Enhanced profile image upload functionality with improved cross-platform compatibility.
    Refined profile image display handling to ensure consistent performance on both web and native platforms.
    Better support for image processing and preview updates during profile editing.

    Dependencies
    Updated shared_preferences package.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 75 lines (+44 / -31) across 5 files Reviewer: magic-peach Review duration: 273227m
    All Vouch review confidence checks passed
    Residual risk 0.04 = Change Risk (0.42) × (1 − Review Confidence (0.90)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 75 lines diff across 5 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.92 · 3 substantive comment(s)
    0.92
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    89%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.259
    Real PR Conversation Timeline
    6 items
    netlify[bot] netlify[bot] commented on Mar 26, 2026 14:18 UTC
    Bot

    <span aria-hidden="true">✅</span> Deploy Preview for cv-mobile-app-web ready!

    | Name | Link |
    |:-:|------------------------|
    |<span aria-hidden="true">🔨</span> Latest commit | 3300d9b99a9bbd659cbbeca0f1c3a02f1e833d59 |
    |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/cv-mobile-app-web/deploys/69c5402cbce9550008fb6ea8 |
    |<span aria-hidden="true">😎</span> Deploy Preview | https://deploy-preview-565--cv-mobile-app-web.netlify.app |
    |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />!QR Code<br /><br />_Use your smartphone camera to open QR code link._</details> |
    ---
    <!-- cv-mobile-app-web Preview -->
    _To edit notification comments on pull requests, go to your Netlify project configuration._

    coderabbitai[bot] coderabbitai[bot] commented on Mar 26, 2026 14:18 UTC
    Bot

    <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
    <!-- walkthrough_start -->

    Walkthrough


    This change refactors the profile image flow for cross-platform compatibility and web cropping support. UsersApi and HttpUsersApi now accept XFile? for updateProfile and build uploads with MultipartFile.fromBytes using image bytes and filename. EditProfileView updates the image picker call to pass BuildContext and conditionally renders the updated image using NetworkImage on web and FileImage on other platforms, with necessary imports and typing adjustments. EditProfileViewModel stores the cropped result as CroppedFile?, requires BuildContext for pickProfileImage, supplies WebUiSettings to ImageCropper on web, and converts CroppedFile to XFile for API calls. pubspec.yaml adjusts a dependency version.

    <!-- walkthrough_end -->

    <!-- pre_merge_checks_walkthrough_start -->

    <details>
    <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary>

    ❌ Failed checks (1 warning)

    | Check name | Status | Explanation | Resolution |
    | :------------------------: | :--------- | :------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | Out of Scope Changes check | ⚠️ Warning | The pubspec.yaml dependency change (shared_preferences ^2.5.4 to ^2.5.3) appears unrelated to the image cropper web fixes and may be out of scope. | Remove the shared_preferences version downgrade from pubspec.yaml unless it is necessary for the image cropper web fixes; clarify its purpose in the PR description. |

    <details>
    <summary>✅ Passed checks (4 passed)</summary>

    | Check name | Status | Explanation |
    | :-----------------: | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
    | Title check | ✅ Passed | The title 'Fix/image cropper web settings' is directly related to the main objective of fixing ImageCropper crashes on Web by adding WebUiSettings. |
    | Linked Issues check | ✅ Passed | All code changes address the linked issues: #563 [WebUiSettings requirement] - BuildContext added to pickProfileImage and passed to WebUiSettings; #564 [XFile/dart:io] - File replaced with XFile/CroppedFile and MultipartFile.fromBytes used. |
    | Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |

    </details>

    <sub>✏️ Tip: You can configure your own custom pre-merge checks in the settings.</sub>

    </details>

    <!-- pre_merge_checks_walkthrough_end -->

    <!-- finishing_touch_checkbox_start -->

    <details>
    <summary>✨ Finishing Touches</summary>

    <details>
    <summary>🧪 Generate unit tests (beta)</summary>

  • <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create PR with unit tests
  • </details>

    </details>

    <!-- finishing_touch_checkbox_end -->

    <!-- tips_start -->

    ---

    Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

    <details>
    <summary>❤️ Share</summary>

  • X

  • Mastodon

  • Reddit

  • LinkedIn
  • </details>

    <sub>Comment @coderabbitai help to get the list of available commands and usage tips.</sub>

    <!-- tips_end -->

    <!-- internal state start -->

    <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrIPR1AGxJcAYvAAeAPTwzGikjBT43NyUkADuJAL2JLjiGETIABS2kGYArABseQCUkHKQNgCCAFIAorUAatAAkgDqlTbNABwADHkATAA09vjYFAwkZVQYDLCQAGYBwaGkYAyR0ZRgCQJgiClpGbp6kKGINBQakADKuNTYiFxRZBpGACLS6/Dc4vgYHAYoH5/NIUIgHKD8gUAMzoDD0KEAFleUBsJHmaDE+AodEgAFV9hREJVuPANNhuLRqCQrJFFl5IAR0AwJj9IAANPwM+AYc4kND0fDzSBckgoyDNZjcLxsDA0egAWWwHnE3GcuFFGnmkWYACFZDRkPNsTw6fBuStJhSPPgBcgmWQHDiIvhwWBpdRjRRmAopdR4GoPOp5JlWolAgrBOaSMVxXjKdT6LVaOpaULow14CQ4pGlB5GfhIA9JgBhDYxWiiyCZTnR31q8QCLylL2M2BWhPylCWuOd3HJ1NmryZ7PxdRzNA8Dye7HMMBoOLOSYhMKTXgkCRZuLVgByKTi2IA1pLVwsTWGBMNRSfwq3I4GY+LKrQlPRQvDqNj5Be8fBrgceSOJlcHbCVLTLKIYj4Bg0A8DxxRsf0/lg7w20mNBogiNBEHbQUsAveJ2ywUkGEPQDAmtW0U3SU10wZbhYHwAgZFENBi0gKkKE4eBC0wegMH9KQFjrBtYGQJci15CluGxLseSmfA4kJRAAG40P2RhYEwUhkFCQ81yHDsqRoBZsBmX4BPzP5IAvV4DGaGYPGwV8ynRbESECNB5guex1hIR1GNwZAlGYP5zioQ40IUXl8AZShIj4PiooPCgyJoldwnWKJTkUWC7Isaw7CURAvh+HisAy6QDAKm9QXknJitKiyjDgSZjTgxTAO7VdkASZ0eQYJyXPkkDJgaz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ZQ+iZw/0hI+Eno+MBY+OIePorxl7J82eHgNPn925598lm26aMtIEQBjZ+eH3HPh9zz5g8C+UAomLOj1gFZrgTAcnKbgUrl8pesPImNXyh62MKm7/QmMr0R5q9QIW9BgN7V3r71q6ztDvkHAtqtlrayyJXKCAjrB1JMTIQQVHUTybBnAyAMyJby7DW8pO+vA0s71BBJRQgsDR3rgOFAlRngtaGgVZVih4BVeRMeTKYSijcC8G64PgQIhTzH1rI/jOIOkCoBrxtKTAlgfmDMheBbCqsVAOQG+w9JHYFHNlnrw+aKCAg0gNSPPkmh5lUqyAXWBQEm7LgIKoEcaES2mi/8P+rmOns4AZ66DRAMfT/HHyoFzMyBzPBeOAMgFc8k+eAWdPMHwHPAiBk9eAeCCQHZ9K+6AhJpgIqGEx6mDAQJjRGCbKBSAaQ2XvcEoFsIYeifWgQ3wR4WQ1m49eYC3U7pDk440rTgfQDZhT0JYTkUmP4x6EOwgMphKgDuRuCo9wy+yHYb0P2RMAQmmUdRoeB0HFC9BTiQwYTFSbqBJg5wvYYJgCGmRzIT1TVttTQhaZCwPScQLmXzKRIDhp4ECFZV5hv9ihn/QmN/yIBDCwBqfW4WL254fCmmGQZAc/hib6Nnmt3c4LYAB6TNm+3PRRD0AEBFABAXQc6PMGhCUjFEtCHoIiFoD9AWG3DLoGgDyAMABgDIkgAUGmSIg6RtAREAIHmACA8gAgRRIKKpBdBpk/IaEHkGZFkNoQHDRUYz0Jioo6MNgGFms3IZoBzoJAaZJSLQAkBEQyiWgNCEVEzIegzIxhnSN5FUMlk0oq1NMmEY8MBA50c6LKIYAcNVRlDaZEoDyDzAVRXQKZEsXxEoMIApoEgMowoCqNvuWDeRp1gAbANtEbEfYPgzl7xitGojAwDo21HJlysr/SoNuxkamNjs6gO2HKBsY9Box6YgbJmOLA5jqQoiVMatiAA -->

    <!-- internal state end -->

    coderabbitai[bot] coderabbitai[bot] commented on code on Mar 26, 2026 14:23 UTC
    Code Review
    pubspec.yaml:1
    @@ -51,7 +51,7 @@ dependencies:
       provider: ^6.1.5
       scroll_to_index: ^3.0.1
       share_plus: ^11.1.0
    -  shared_preferences: ^2.5.4
    +  shared_preferences: ^2.5.3

    _⚠️ Potential issue_ | _🟡 Minor_

    <details>
    <summary>🧩 Analysis chain</summary>

    🏁 Script executed:

    #!/bin/bash
    # Check latest shared_preferences versions and any potential issues
    curl -s https://pub.dev/api/packages/shared_preferences | jq '.versions[-5:] | .[] | .version'
    

    Repository: CircuitVerse/mobile-app

    Length of output: 106

    ---

    🏁 Script executed:

    # Check git history of pubspec.yaml to understand the context of this change
    cd . && git log --oneline pubspec.yaml 2>/dev/null | head -20
    

    Repository: CircuitVerse/mobile-app

    Length of output: 159

    ---

    🏁 Script executed:

    # Search for any comments related to shared_preferences version constraints
    rg -i "shared_preferences|2\.5\.[34]" --type yaml
    

    Repository: CircuitVerse/mobile-app

    Length of output: 108

    ---

    🏁 Script executed:

    # Check the current pubspec.yaml to see the full context
    cat -n pubspec.yaml | sed -n '50,60p'
    

    Repository: CircuitVerse/mobile-app

    Length of output: 409

    ---

    🏁 Script executed:

    # Check the git diff to see what changed in that commit
    git show 3300d9b --stat
    

    Repository: CircuitVerse/mobile-app

    Length of output: 31624

    ---

    🏁 Script executed:

    # Get the actual diff for pubspec.yaml in that commit
    git show 3300d9b -- pubspec.yaml | head -100
    

    Repository: CircuitVerse/mobile-app

    Length of output: 2941

    ---

    </details>

    Clarify or update the shared_preferences version.

    The version constraint ^2.5.3 appears to bypass the available 2.5.4 and 2.5.5 releases. Either document why 2.5.3 is specifically required (e.g., compatibility constraint), or consider updating to ^2.5.5 for access to the latest patch.

    <!-- fingerprinting:phantom:poseidon:ocelot -->

    <!-- This is an auto-generated comment by CodeRabbit -->

    coderabbitai[bot] coderabbitai[bot] requested changes on Mar 26, 2026 14:23 UTC
    Changes Requested Reviewer

    Actionable comments posted: 1

    <details>
    <summary>🧹 Nitpick comments (2)</summary><blockquote>

    <details>
    <summary>lib/viewmodels/profile/edit_profile_viewmodel.dart (2)</summary><blockquote>

    47-51: Consider adding platform-specific UI settings for a consistent experience.

    Only WebUiSettings is provided. For a polished mobile experience, you could add AndroidUiSettings and IOSUiSettings to customize the cropper appearance (toolbar color, title, etc.). The current implementation will use platform defaults which is functional but less customizable.

    <details>
    <summary>Example with platform-specific settings</summary>

          uiSettings: [
            WebUiSettings(
              context: context,
            ),
    +       AndroidUiSettings(
    +         toolbarTitle: 'Crop Image',
    +         toolbarColor: CVTheme.primaryColor,
    +         toolbarWidgetColor: Colors.white,
    +         initAspectRatio: CropAspectRatioPreset.square,
    +         lockAspectRatio: true,
    +       ),
    +       IOSUiSettings(
    +         title: 'Crop Image',
    +         aspectRatioLockEnabled: true,
    +       ),
          ],
    

    </details>

    ---

    81-81: Simplify by passing updatedImage directly since CroppedFile extends XFile.

    CroppedFile inherits from XFile, so you can pass it directly without creating a new instance. The current approach XFile(updatedImage!.path) creates a new XFile from just the path, which works but is unnecessary.

    <details>
    <summary>Suggested simplification</summary>

    -        updatedImage != null ? XFile(updatedImage!.path) : null,
    +        updatedImage,
    

    </details>

    </blockquote></details>

    </blockquote></details>

    ---

    <details>
    <summary>ℹ️ Review info</summary>

    <details>
    <summary>⚙️ Run configuration</summary>

    Configuration used: Organization UI

    Review profile: CHILL

    Plan: Pro

    Run ID: 139c8588-21eb-407a-911d-53b9d07a44b2

    </details>

    <details>
    <summary>📥 Commits</summary>

    Reviewing files that changed from the base of the PR and between f621531ff51327b83f37459c942eaea036e352d6 and 3300d9b99a9bbd659cbbeca0f1c3a02f1e833d59.

    </details>

    <details>
    <summary>⛔ Files ignored due to path filters (1)</summary>

    pubspec.lock is excluded by !/.lock

    </details>

    <details>
    <summary>📒 Files selected for processing (4)</summary>

    lib/services/API/users_api.dart
    lib/ui/views/profile/edit_profile_view.dart
    lib/viewmodels/profile/edit_profile_viewmodel.dart
    pubspec.yaml

    </details>

    </details>

    <!-- This is an auto-generated comment by CodeRabbit for review status -->

    magic-peach magic-peach approved these changes on May 25, 2026 04:31 UTC
    Approved Reviewer

    The core fix is correct — switching to XFile/MultipartFile.fromBytes for web compatibility, adding the required WebUiSettings, and using a platform-conditional image provider all land correctly.

    One thing to watch: the pubspec.lock shows image_cropper at 10.0.9, but the main branch has it at 11.0.2 and PR #587 bumps it further to 12.2.1. This branch will need a rebase before merge to avoid a lock file conflict.

    Reviewers
    Assignees
    RAJEEVTIWARI8052 RAJEEVTIWARI8052
    Labels
    risk: low confidence: 89.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 41.8% (MEDIUM) · Higher = larger blast radius
    41.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 89.8% · Lower = rushed or shallow review
    89.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 4.3% · Safe to merge
    4.3%