Flutter Zoomable Widget

As of Flutter 1.20, InteractiveViewer widget supports pan and Zoom out of the box. To make any widget zoomable you need to simply wrap the child with InteractiveViewer. @override Widget build(BuildContext context) { return Center( child: InteractiveViewer( panEnabled: false, // Set it to false to prevent panning. boundaryMargin: EdgeInsets.all(80), minScale: 0.5, maxScale: 4, child: FlutterLogo(size: … Read more

Draw on HTML5 Canvas using a mouse

Here is a working sample. <html> <script type=”text/javascript”> var canvas, ctx, flag = false, prevX = 0, currX = 0, prevY = 0, currY = 0, dot_flag = false; var x = “black”, y = 2; function init() { canvas = document.getElementById(‘can’); ctx = canvas.getContext(“2d”); w = canvas.width; h = canvas.height; canvas.addEventListener(“mousemove”, function (e) { … Read more