4Q-s-r-o / signature

Flutter plugin that creates a canvas for writing down a signature
MIT License
252 stars 83 forks source link

exportBytes not working #15

Closed TinusJ closed 4 years ago

TinusJ commented 4 years ago

Hi i have the following code.

 if (_signatureCanvas.isEmpty) {
                    Scaffold.of(context).showSnackBar(
                      SnackBar(
                        content: Text(
                            'Error could not save signed document. Please sign before saving'),
                        duration: Duration(seconds: 3),
                      ),
                    );
                  } else {
                    print('1');
                     _signatureCanvas.exportBytes().then((bytes) {
                      print(bytes);
                      _service.setSignature(bytes);
                      _service.submitSignature();
                    }).catchError((e) {
                      print(e);
                    });

                    print('2');
                  }

The exportBytes is not working and only 1 and 2 is printed

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v1.12.13+hotfix.6, on Microsoft Windows [Version 10.0.18362.535], locale en-ZA)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Chrome - develop for the web
[!] Android Studio (version 3.1)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code, 64-bit edition (version 1.41.1)
[√] Connected device (2 available)

! Doctor found issues in 1 category.

Running Flutter web though

MartinHlavna commented 4 years ago

May be related to #13

MartinHlavna commented 4 years ago

Version 3.0.0 will be published today. Does your problem still persists?

TinusJ commented 4 years ago

@MartinHlavna Not sure if it still persists, using a different lib

TinusJ commented 4 years ago

This is still happening, tested on v3.0.0

happening on var data = await _signatureController.toPngBytes();

Note: its working on var data = await _signatureController.toImage(); this returns an HtmlImage

TinusJ commented 4 years ago

This is a flutter web issue where Image.toByteData is broken @see https://github.com/flutter/flutter/issues/44908