Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializing SignaturePad a #317

Closed
vin-fandemand opened this issue Jun 14, 2020 · 7 comments
Closed

Initializing SignaturePad a #317

vin-fandemand opened this issue Jun 14, 2020 · 7 comments

Comments

@vin-fandemand
Copy link
Contributor

How do you initialize Signature-pad. I tried passing Uint8List.fromList([]) in the intialValue, but it did not load anything. Can you please show an example ? Also, can you show and example where initial values are displayed in a read only form ?

@danvick
Copy link
Collaborator

danvick commented Jun 19, 2020

Hi @vin-fandemand,
According to the author of the signature package, there's no easy way of converting Uint8List to List.

To initialize the value of the signature you'd have to use SignatureController which only takes in List<Point>.

@vin-fandemand
Copy link
Contributor Author

vin-fandemand commented Jun 24, 2020

Hi @vin-fandemand,
According to the author of the signature package, there's no easy way of converting Uint8List to List.

To initialize the value of the signature you'd have to use SignatureController which only takes in List<Point>.

Thanks for the reply. I see that you have depreciated the initialValue for signature.
There is a way around.

  1. On init value show Image.memory(Uint8List) instead of the Signature widget.
  2. When we press Clear button, show the Signature Widget
  3. When the form is saved, show the Image.memory(Uint8List) again.

This way the package users don't have to do anything with the Point class or even import signature package (for the controller).

I have created a PR https://github.com/danvick/flutter_form_builder/pull/344 . Please approve if you like it.

vin-fandemand added a commit to vin-fandemand/flutter_form_builder that referenced this issue Jun 25, 2020
@danvick
Copy link
Collaborator

danvick commented Jun 25, 2020

I've thought about doing this. But the problem with that is that users may expect that they could be able to edit the static image shown - and may be reported as unexpected behavior.

@vin-fandemand
Copy link
Contributor Author

vin-fandemand commented Jun 25, 2020

Yes. By making it look different when saved and not saved (one is a card with some elevation and one is signature pad, which is an inward facing white rectangle ). May be we can even have different text on the Clear button to show the difference.
In any case, this feature would make this field inline with other fields - every other field has an initial value and readonly ability.

@vin-fandemand
Copy link
Contributor Author

my suggestion is that we push it and see how your package users respond. I am sure there are any out there who don't want to use Signature Controller (As you rightly described as complex) and would happily welcome this change.

@vin-fandemand
Copy link
Contributor Author

@danvick can you please share your thoughts on it ? I believe that if you don't fix this problem in some way (whether it is my approach or some other approach), it would feel like this feature is kind of dangling

awhitford pushed a commit that referenced this issue Jul 6, 2020
* #317 fix for initializing signature
@MartinHlavna
Copy link

Another way around may be allowing users to store data as List<Point> . That would allow you to pass points to SignatureController and edit data.

But since it is signature pad and not a full featured drawing editor I can't think of use case where end user would want to edit Signature instead of making a new one.

@danvick danvick closed this as completed Jul 16, 2020
danvick added a commit that referenced this issue Aug 26, 2020
* #317 fix for initializing signature

* resolve review comments

* fix final review comments

* v3.11.3 docs

* add txtstyle params and re-implmenet numberFormat (#343)

* add txtstyle params and re-implmenet numberFormat

* rename fieldTextStyle and add it as a fallback

* Fix bug in ChoiceChip & FilterChip where using FieldOption label instead of child  breaks app. Closes #348

* Added labelPadding and labelStyle to ChoiceChip field

* Added const keyword to constructor.

* Added an extra deprecated annotation so that users are alerted to the deprecation of label.  (I noticed that my code was not alerting with the deprecation only on the field declaration.)

* Dependency upgrades.

* chages to fix teh overflow with labels

Co-authored-by: Danvick Miller <danvickmiller@live.com>
Co-authored-by: William Cunha Cardoso <31575772+WilliamCunhaCardoso@users.noreply.github.com>
Co-authored-by: Anthony Whitford <anthony@whitford.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants