Skip to content

Commit

Permalink
fixed rendering for case when there is no active tool
Browse files Browse the repository at this point in the history
  • Loading branch information
featzima committed Mar 12, 2021
1 parent 5adb6ca commit 587020a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.9

* fixed rendering for case when there is no active tool

## 1.1.8

* migrated to the Lint package
Expand Down
5 changes: 4 additions & 1 deletion lib/src/ui/reactive_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ class ReactivePainter extends ChangeNotifier implements CustomPainter {
bool? hitTest(Offset position) => null;

void startStroke(Offset position) {
_strokes.add(Stroke([position], strokeStyle!.color.withOpacity(strokeStyle!.opacity), strokeStyle!.weight));
_strokes.add(Stroke(
[position],
strokeStyle!.color.withOpacity(strokeStyle!.opacity),
strokeStyle!.weight));
notifyListeners();
}

Expand Down
34 changes: 19 additions & 15 deletions lib/src/ui/sketch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,25 @@ class _SketchState extends State<Sketch> {

@override
Widget build(BuildContext context) {
return Container(
color: widget.controller.backgroundColor,
child: Transform.translate(
offset: Offset(0, -_offset),
child: Stack(
children: [
...RepaintBoundary.wrapAll(widget.controller.layers
.map((layer) => CustomPaint(
key: ValueKey(layer.id), painter: layer.painter))
.toList(growable: false)),
CustomPaint(
painter: _toolController?.toolPainter,
child: _activeTool == SketchTool.none ? null : touch,
),
],
return IgnorePointer(
ignoring: _activeTool == SketchTool.none,
child: Container(
color: widget.controller.backgroundColor,
child: Transform.translate(
offset: Offset(0, -_offset),
child: Stack(
fit: StackFit.expand,
children: [
...RepaintBoundary.wrapAll(widget.controller.layers
.map((layer) => CustomPaint(
key: ValueKey(layer.id), painter: layer.painter))
.toList(growable: false)),
CustomPaint(
painter: _toolController?.toolPainter,
child: touch,
),
],
),
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sketcher
description: Sketch your ideas to life with the sketcher package. Provides the handwriting widget that allows to import\export content to SVG.
version: 1.1.8
version: 1.1.9
homepage: https://github.com/glynskyi/sketcher

environment:
Expand Down

0 comments on commit 587020a

Please sign in to comment.