FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
115 stars 19 forks source link

Laggy Gesture Detection in Custom Widget #3722

Open roystontay opened 2 weeks ago

roystontay commented 2 weeks ago

Can we access your project?

Current Behavior

As you can see from the attached video, the onPanStart and onPanUpdate events only start after the finger has started moving over ~20px in the simulator. That's when the blue line starts being drawn.

Expected Behavior

when ran in flutter (without flutterflow), this gesture event would start firing almost immediately. i.e. the blue line tracing the finger movements has no lag.

I've created a project in my account specifically to recreate this issue report called "for issue reporting". Flutterflow team may access this.

Steps to Reproduce

  1. Create Custom Widget
  2. Use Gesture Detection - OnPanUpdate to trace finger panning movements on a canvas
  3. use CLI command to export code locally to a mac
  4. "flutter run" to run project in a simulator / iphone device
  5. you will observe a lag when dragging finger across the screen. the first ~20px seems to not trigger onPanUpdate at all.

Reproducible from Blank

Bug Report Code (Required)

IT4WksmBwItNrsNK0KrtbcBvmicXQkB/aIJIjMN9dwgdIYjqP6YPXfikSEpWZ9+kTHxcL2Gjqz4K7t7Hv/OTA+UrMk+aQIBlz5dudA3JTmembJiuCsyCR0ZBHtFJJVPG5MGRvyVBPuleV3g62WC6Pt6/dHffJL7pNmsZL/mIJof4+wqrQ0SLb3kNh1JWeC/v

Visual documentation

https://github.com/user-attachments/assets/3c23f804-4be4-4c9e-8373-f30eea5ed0e0

Environment

- FlutterFlow version: v4.1.85+
- Platform: Web - export to Mac - "flutter run"
- Browser name and version: Chrome 128.0.6613.85
- Operating system and version affected: MacOS Sonoma 14.5

Additional Information

I'm using a library (https://pub.dev/packages/stroke_order_animator) where the onPanUpdate mechanism is being used. When i run the provided example directly in flutter, it works perfectly (i.e. no lag). When I port the example into flutterflow as a custom widget, this lag is encountered. Through debugging, I think the issue can be isolated to how slow the onPanUpdate event starts firing.

This issue is critical to my use case that requires tracing a finger gesture, which I imagine would be required for many drawing apps?

paulperez-dev commented 1 week ago

Hi @roystontay! Can you please try running FF app on a local device and verify if the performance is better?

roystontay commented 1 week ago

do you mean running

"flutter run -d "

to have the code compiled and run on my physical iphone?

if so, yes I've just verified that using this same project. the lag is still there. however, i'm not able to record my screen with the touch gesture showing when i started tapping vs when the app starts detecting it (similar to the video i uploaded before). there doesn't seem to be a way to record that on iphones.

roystontay commented 1 week ago

Hi, have you been able to replicate this? I've tried building the app using CLI and using flutter desktop app. The lag is experienced in both.

When testing on flutter web, there's no perceivable lag. i.e. the line starts drawing where my mouse cursor first starts clicking and moving.

Please let me know if

  1. This is something you're able to recreate. i.e. I'm not doing something dumb / wrong & there's an easy fix / workaround
  2. If you do manage to recreate this issue, whether it's something flutterflow is keen to fix

As mentioned, this is a pretty critical part to my app. I'd have to look for alternatives otherwise, thanks!