4Q-s-r-o / signature

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

_controller.clear() bug. #19

Closed KaeganClark closed 4 years ago

KaeganClark commented 4 years ago

_controller.clear() doesn't work when called. The user must call the function and then start drawing again before it clears.

dcordi commented 4 years ago

a temporary solution :

modify signature.dart. add this line after import declaration : final signatureKey = GlobalKey();

add this line after 'final Color backgroundColor;' final Key key = signatureKey ;

and replace clear() method on SignatureController by :

  clear() {
    value = List<Point>();
    this.notifyListeners();
    signatureKey.currentState.setState(() {
    }) ;
  }

Good luck Daniel

SebastienBtr commented 4 years ago

You just need to refresh the view with a "set state":

setState(() => _controller.clear())

MartinHlavna commented 4 years ago

@SebastienBtr's way is correct way to use this.

Hovewer this is also fixed in 3.1.0