Skip to content

Commit 7f65193

Browse files
committed
feat: nodes and notes
1 parent 513bfd1 commit 7f65193

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/features/models/canvas_models/canvas_painter.dart

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,22 @@ class CanvasPainter extends CustomPainter {
170170
Rect.fromCircle(center: canvasObject.center, radius: canvasObject.radius);
171171
} else if (canvasObject is StickyNoteObject) {
172172
rect = canvasObject.getBounds();
173-
final double borderThickness =
174-
min(min(rect.width, rect.height) * 0.05, 5.0);
173+
// The image shows a darker, thinner border
174+
final double borderThickness = 2.0;
175175
final borderPaint = Paint()
176-
..color = Color.lerp(canvasObject.color, Colors.black, 0.1)!;
177-
canvas.drawRect(rect, borderPaint);
176+
..color = Color.lerp(canvasObject.color, Colors.black, 0.3)!
177+
..strokeWidth = borderThickness
178+
..style = PaintingStyle.stroke;
179+
178180
final bodyRect = Rect.fromLTRB(
179181
rect.left + borderThickness,
180182
rect.top + borderThickness,
181183
rect.right - borderThickness,
182184
rect.bottom - borderThickness);
185+
183186
final bodyPaint = Paint()..color = canvasObject.color;
184-
canvas.drawRect(bodyRect, bodyPaint);
187+
canvas.drawRect(rect, bodyPaint);
188+
canvas.drawRect(rect, borderPaint);
185189
} else if (canvasObject is TextBoxObject) {
186190
rect = canvasObject.getBounds();
187191
if (canvasObject.color != Colors.transparent) {
@@ -269,9 +273,7 @@ class CanvasPainter extends CustomPainter {
269273
final List<dynamic> delta = jsonDecode(canvasObject.textDelta!);
270274
double textPadding = 8.0;
271275
if (canvasObject is StickyNoteObject) {
272-
final double borderThickness =
273-
min(min(rect.width, rect.height) * 0.05, 5.0);
274-
textPadding += borderThickness;
276+
textPadding = 12.0; // Adjusted padding for the new sticky note style
275277
}
276278
double yOffset = rect.top + textPadding;
277279
final List<Map<String, dynamic>> lines = [];

0 commit comments

Comments
 (0)