RomanBase / hand_signature

A Flutter plugin providing signature pad for drawing smooth signatures.
https://pub.dev/packages/hand_signature
MIT License
108 stars 25 forks source link

error creating image based only on 1 drawn pixel #36

Closed gemunet closed 1 year ago

gemunet commented 1 year ago

There is an error that occurs when instead of drawing a line, you only click to paint a single pixel. then when trying to create the image the method fails, when it should create the image

Screenshot_1677007419

Snap 2023-02-21 at 16 26 30

error line

var pngImage = await control.toImage();

rest of the code

final control = HandSignatureControl(
    threshold: 3.0,
    smoothRatio: 0.65,
    velocityRange: 2.0,
  );

......
                  child: HandSignature(
                    control: control,
                    type: SignatureDrawType.shape,
                  ),
...

hand_signature v"3.0.0"

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.7.0, on Microsoft Windows [Versi¢n 10.0.19044.2604], locale es-CL)
[X] Windows Version (Unable to confirm if installed Windows version is 10 or greater)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.8.5)
[√] Android Studio (version 2021.3)
[!] Android Studio (version 4.1)
    X Unable to determine bundled Java version.
[√] VS Code (version 1.75.1)
[√] Connected device (5 available)
[√] HTTP Host Availability

! Doctor found issues in 2 categories.
RomanBase commented 1 year ago

In 1 vertice scenario PathUtil.bounds returned zero sized Rect. So scalling and then painting failed. To prevent this issue we added minSize attribute.