Closed SmartInovacoesTecnologias closed 2 years ago
I am sorry but this is not supported. It would require a way to reverse the export process and get points vector from raster.
IMHO I could not think of use case where I would need to edit signature. If you want to display stored data, you should display it as Image.
I was able to export points to a JSON. Remember that you need to store offsets's dx and dy along with PointType (move or tap).
My JSON that was stored on server looked something like this [[123.55,66.77,"tap"], [123.55,66.77,"move"],...]
I then used this data to create a List of Points and feed into the controller and it worked
I was able to export points to a JSON. Remember that you need to store offsets's dx and dy along with PointType (move or tap).
My JSON that was stored on server looked something like this [[123.55,66.77,"tap"], [123.55,66.77,"move"],...]
I then used this data to create a List of Points and feed into the controller and it worked
Hi Khurana, can you elaborate more about how you retrieve from server and feed into controller, thank you
I was able to export points to a JSON. Remember that you need to store offsets's dx and dy along with PointType (move or tap). My JSON that was stored on server looked something like this [[123.55,66.77,"tap"], [123.55,66.77,"move"],...] I then used this data to create a List of Points and feed into the controller and it worked
Hi Khurana, can you elaborate more about how you retrieve from server and feed into controller, thank you
I save it like this
var json = jsonEncode(_controller.points .map((e) => '${e.type},${e.offset.dx},${e.offset.dy}') .toList());
and save it on server
And when i fetch that json from server set the points like this
List<dynamic> points = jsonDecode(json); points.forEach((element) { List<String> d = element.toString().split(r','); _controller.addPoint(Point( Offset(double.parse(d[1]), double.parse(d[2])), d[0] == 'PointType.tap' ? PointType.tap : PointType.move, )); });
Im sure they are better ways but i make it fast
If needed we could add some utilities to aid in json conversion.
And when i fetch that json from server set the points like this
List<dynamic> points = jsonDecode(json); points.forEach((element) { List<String> d = element.toString().split(r','); _controller.addPoint(Point( Offset(double.parse(d[1]), double.parse(d[2])), d[0] == 'PointType.tap' ? PointType.tap : PointType.move, )); });
This lane saved my day, was trying to find how to display a recorded signature, thank you mate !
how can i open a previous signature from bytes stored in a blob column in database?, Im expecting something like
_controller.fromBytes(Uint8List)
, but, i just found the_controller.points(List<Point>)
but i cant figure out how store this on db