feedback icon indicating copy to clipboard operation
feedback copied to clipboard

Feedback Offsets Page to the Right On Submit

Open darkfrog26 opened this issue 1 year ago • 10 comments

Version

3.1.0

Library

feedback

Flutter channel

beta

Flutter version

3.24.0-0.2.pre

Platform

Web

Details

The feedback opens as expected, and if I close it, everything returns to normal. However, after submitting, the page is shifted to the right: Screenshot from 2024-08-21 08-53-04

Steps to reproduce

  • Open Feedback
  • Enter text
  • Click Submit

Output of flutter doctor -v

[✓] Flutter (Channel beta, 3.24.0-0.2.pre, on Pop!_OS 22.04 LTS 6.9.3-76060903-generic, locale en_US.UTF-8)
    • Flutter version 3.24.0-0.2.pre on channel beta at /usr/bin/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7c6b7e9ca4 (3 weeks ago), 2024-07-30 14:26:44 +0700
    • Engine revision 6e4deceb38
    • Dart version 3.5.0 (build 3.5.0-323.2.beta)
    • DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/mhicks/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/mhicks/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 14.0.0-1ubuntu1.1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 2024.1)
    • Android Studio at /home/mhicks/.local/share/JetBrains/Toolbox/apps/android-studio
    • Flutter plugin version 81.0.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.2)
    • IntelliJ at /home/mhicks/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate
    • Flutter plugin version 81.1.3
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.92.2)
    • VS Code at /usr/share/code
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Pop!_OS 22.04 LTS 6.9.3-76060903-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 127.0.6533.119

[✓] Network resources
    • All expected network resources are available.

• No issues found!

darkfrog26 avatar Aug 21 '24 13:08 darkfrog26

Three weeks ago and not a single response?

darkfrog26 avatar Sep 10 '24 13:09 darkfrog26

This is a hobby project and right now I have other priorities. If this is a huge issue for you, please feel free to submit a bug fix as a PR.

ueman avatar Sep 10 '24 17:09 ueman

@ueman, my apologies...I didn't realize this was a single-person project. I'm happy to attempt a fix. Do you have any suggestions of where I might start looking?

darkfrog26 avatar Sep 10 '24 18:09 darkfrog26

Unfortunately, I have no idea :(

ueman avatar Sep 10 '24 18:09 ueman

@darkfrog26 Hey man, I had the same problem for Web, it seems to be a issue with the screenshot process, that's why we have to put a Future Delayed to wait properly this async process when we call the show method at the moment, something like this:

image

I hope, it will be useful to you buddy

CesarArellano avatar Sep 30 '24 20:09 CesarArellano

@CesarArellano you're absolutely right man! Adding the delay fixed the problem. This should probably still be considered a bug, but at least there's a workaround. Thanks!

darkfrog26 avatar Sep 30 '24 20:09 darkfrog26

@darkfrog26 awesome Matt, it's definitely a bug to be addressed, I hope we get an official fix asap in the package itself.

CesarArellano avatar Sep 30 '24 20:09 CesarArellano

@darkfrog26 Hey man, I had the same problem for Web, it seems to be a issue with the screenshot process, that's why we have to put a Future Delayed to wait properly this async process when we call the show method at the moment, something like this:

image I hope, it will be useful to you buddy

This did not help resolve it for me unfortunately. Behaviour is consistent and only on web. The offset added on the right seems relative to screen size. Smaller screen size give smaller offset. lager screen size a larger offset. Offset is not added again after second feedback submit But Offset is set to different size if you resize screen between feedbacks. Thus offset is applied every time again and every time calculated (wrongly) after every submit The offset has the same color as the color set in FeedbackThemeData.background

maybe this helps someone figure out where to look for the bug @ueman

jakusb avatar Dec 08 '24 11:12 jakusb

I encountered a similar layout offset issue after upgrading to Flutter 3.24+ (currently testing on 3.29.2, using feedback version 3.1.0.

While the original issue reported an offset to the right on Web, my symptom was slightly different:

  • Platform: Physical Android Device
  • Issue: After closing the feedback view (either by submitting or cancelling/closing), the underlying application screen content remains offset right/down.
  • Emulator: Interestingly, this issue did not occur on Android emulators, only on physical devices.

Potential Fix Found:

After debugging, I found that modifying the _FeedbackLayoutDelegate within lib/src/feedback_widget.dart resolved this offset on my physical Android device. The fix involves explicitly positioning the main screenshot content (_screenshotId) at Offset.zero when the feedback UI is hidden (!displayFeedback).

Code Modification in _FeedbackLayoutDelegate.performLayout:

  @override
  void performLayout(Size size) {
    if (!displayFeedback) {
      // Ensure only the main screenshot content is laid out and positioned correctly
      // when feedback is hidden.
      layoutChild(_screenshotId, BoxConstraints.tight(size));
+     // Explicitly position at zero offset - THIS FIXED THE RIGHT/DOWN OFFSET ON ANDROID
+     positionChild(_screenshotId, Offset.zero);
      return; // Essential: stop processing layout here
    }

    // --- Original layout logic for when feedback IS displayed ---
    // ... (rest of the method remains the same) ...
  }

Reasoning: Although positionChild should default to Offset.zero if not called, it seems that in Flutter 3.24+ on (some?) physical devices, explicitly calling it is necessary within this CustomMultiChildLayout delegate to reliably reset the position after the complex layout and animation performed while the feedback UI was visible. This might indicate a subtle framework change or edge case related to layout/state persistence in this specific scenario.

Hope this helps!

Would love to see this tested by others and a new version with that fix of the library.

go-run-jump avatar Mar 26 '25 17:03 go-run-jump

@ueman Thanks for a great library! I appreciate all the effort that went into it. Any chance that above proposed fix by @go-run-jump can be tested and released? :)

jakusb avatar Sep 11 '25 14:09 jakusb