From 5bc90b1c747a206b378f834b1d030cca49a57c0c Mon Sep 17 00:00:00 2001 From: sooxt98 Date: Tue, 21 Nov 2023 02:53:12 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Weird=20last=20drawn=20line=20hi?= =?UTF-8?q?ghlighted=20glitch=20(#10)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 Weird last drawn line highlighted glitch * 🐛 Remove last dot * 🐛 Removed extra code --- lib/view/drawing_canvas/drawing_canvas.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/view/drawing_canvas/drawing_canvas.dart b/lib/view/drawing_canvas/drawing_canvas.dart index cc7aac4..3e2971a 100644 --- a/lib/view/drawing_canvas/drawing_canvas.dart +++ b/lib/view/drawing_canvas/drawing_canvas.dart @@ -76,6 +76,7 @@ class DrawingCanvas extends HookWidget { final offset = box.globalToLocal(details.position); final points = List.from(currentSketch.value?.points ?? []) ..add(offset); + currentSketch.value = Sketch.fromDrawingMode( Sketch( points: points, @@ -95,6 +96,20 @@ class DrawingCanvas extends HookWidget { void onPointerUp(PointerUpEvent details) { allSketches.value = List.from(allSketches.value) ..add(currentSketch.value!); + currentSketch.value = Sketch.fromDrawingMode( + Sketch( + points: [], + size: drawingMode.value == DrawingMode.eraser + ? eraserSize.value + : strokeSize.value, + color: drawingMode.value == DrawingMode.eraser + ? kCanvasColor + : selectedColor.value, + sides: polygonSides.value, + ), + drawingMode.value, + filled.value, + ); } Widget buildAllSketches(BuildContext context) {