Closed aarajput closed 10 months ago
Hey, by design it's not possible to use 'drawing' Widget inside any ScrollView. But you can solve this issue with little workaround - please check scroll_test in example.
Basically you need to prevent ScrollView from receiving gesture events - there is multiple ways how to achieve this (Focus
, Listener
, IgnorePointer
, GestureDetector
etc) based on your needs.
In example you can find disabling scroll physics with NeverScrollableScrollPhysics
on pointer down event.
Here is how i fixed this issue. I just wrapped HandSignature widget with GestureDetector widget and passed onHorizontalDragUpdate and onVerticalDragUpdate with empty function.
Example:
GestureDetector(
onHorizontalDragUpdate: (_) {},
onVerticalDragUpdate: (_) {},
child: HandSignature(
control: controller,
color: Colors.black,
),
)
@RomanBase , i think you sould add this login in _example/lib/scrolltest.dart
Hey, as mentioned above there is multiple solutions and every app will have other challenges to achieve correct behavior. I think you solution (not tested) will not work inside PageView, because you override 'drag' events. So in example is most general solution (maybe not correct for every Scrollable) that works as a 'hint' how to achieve something like this.
For example in our production code we mostly uses Overlay so 'Drawing Pad' is above Scrollable.
If you please HandSignature widget inside ListVew and user tried to make a signature, list also move up and down with it.