I was using Scratcher() on a SimpleDialog()/ShowGeneralDialog() and encountered a couple of issues.
OnChange() not called, OnThreshold() called only at 100%
This issue is caused by _setCheckpoints() initializing checkpoints with bad data due to size being [0,0] the first time CustomPaint.onDraw(size) is called. The issue can be resolved by changing widgets.dart line 141...
from:
if (totalCheckpoints == 0) {
to:
if (totalCheckpoints == 0 && size.width != 0) {
Intermittently responding to gestures the first time ShowDialog view is presented
This appears to be an artifact of SimpleDialog() placing children under a scrollable Material() that consumes drag events used by Scratcher(). On first presentation the Material() appears to be scrollable, despite having no overflow. This can be confirmed by using a dark background, clicking on the Scratcher() widget, and furiously dragging up and down. The white Material end-of-scroll indicators will become more opaque at the top and bottom of the Dialog and no events will be passed to Scratcher(). Upon subsequent presentations, the SimpleDialog is able to determine the contents do not overflow and will pass drag gestures to Scratcher().
I could not find a way to disable the Material's scroll. I ended up replacing Flutter's SimpleDialog() with a custom version without a scrollable Material. Note I still needed to use the above checkpoints fix to present Scratcher using showGeneralDialog() and my custom dialog.
Please advise if there's a better place to leave info like this. I can't do a pull request with my copy of Scratcher
Flutter Version: 2.1.0-12.1.pre Testing platforms: Android SDK Emulator, Samsung G20
I was using Scratcher() on a SimpleDialog()/ShowGeneralDialog() and encountered a couple of issues.
OnChange() not called, OnThreshold() called only at 100%
This issue is caused by _setCheckpoints() initializing checkpoints with bad data due to size being [0,0] the first time CustomPaint.onDraw(size) is called. The issue can be resolved by changing widgets.dart line 141...
from:
if (totalCheckpoints == 0) {
to:if (totalCheckpoints == 0 && size.width != 0) {
Intermittently responding to gestures the first time ShowDialog view is presented
This appears to be an artifact of SimpleDialog() placing children under a scrollable Material() that consumes drag events used by Scratcher(). On first presentation the Material() appears to be scrollable, despite having no overflow. This can be confirmed by using a dark background, clicking on the Scratcher() widget, and furiously dragging up and down. The white Material end-of-scroll indicators will become more opaque at the top and bottom of the Dialog and no events will be passed to Scratcher(). Upon subsequent presentations, the SimpleDialog is able to determine the contents do not overflow and will pass drag gestures to Scratcher().
I could not find a way to disable the Material's scroll. I ended up replacing Flutter's SimpleDialog() with a custom version without a scrollable Material. Note I still needed to use the above checkpoints fix to present Scratcher using showGeneralDialog() and my custom dialog.