Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class PainterController extends ChangeNotifier {
Color _drawColor = new Color.fromARGB(255, 0, 0, 0);
Color _backgroundColor = new Color.fromARGB(255, 255, 255, 255);
bool _eraseMode = false;
bool _rounded = false;

double _thickness = 1.0;
PictureDetails? _cached;
Expand All @@ -221,6 +222,15 @@ class PainterController extends ChangeNotifier {
_updatePaint();
}

/// Whether line caps and joins will be rounded.
bool get rounded => _rounded;

/// If set to true, line caps and joins will be rounded.
set rounded(bool enabled) {
_rounded = enabled;
_updatePaint();
}

/// Retrieves the current draw color.
Color get drawColor => _drawColor;

Expand Down Expand Up @@ -259,6 +269,10 @@ class PainterController extends ChangeNotifier {
}
paint.style = PaintingStyle.stroke;
paint.strokeWidth = thickness;
if (_rounded) {
paint.strokeCap = StrokeCap.round;
paint.strokeJoin = StrokeJoin.round;
}
_pathHistory.currentPaint = paint;
_pathHistory.setBackgroundColor(backgroundColor);
notifyListeners();
Expand Down