WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 4a39faa

Browse files
committed
fix: cylinder border
1 parent 7f65193 commit 4a39faa

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

lib/features/models/canvas_models/canvas_painter.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:convert';
22
import 'dart:math';
3+
import 'package:cookethflow/core/theme/colors.dart';
34
import 'package:cookethflow/core/utils/enums.dart';
45
import 'package:cookethflow/features/models/canvas_models/canvas_object.dart';
56
import 'package:cookethflow/features/models/canvas_models/objects/circle_object.dart';
@@ -25,6 +26,7 @@ class CanvasPainter extends CustomPainter {
2526
final String? currentlySelectedObjectId;
2627
final double handleRadius;
2728
final InteractionMode interactionMode;
29+
final Color workspaceColor; // NEW: Added workspace color
2830

2931
// NEW: Connector-related properties
3032
final double connectionPointRadius;
@@ -38,6 +40,8 @@ class CanvasPainter extends CustomPainter {
3840
this.currentlySelectedObjectId,
3941
this.handleRadius = 8.0,
4042
required this.interactionMode,
43+
// NEW: Initialize workspace color
44+
required this.workspaceColor,
4145
// NEW: Initialize connector properties
4246
this.connectionPointRadius = 6.0,
4347
this.connectorSourceId,
@@ -253,12 +257,12 @@ class CanvasPainter extends CustomPainter {
253257
canvas.drawOval(topEllipseRect, fillPaint);
254258
canvas.drawOval(bottomEllipseRect, fillPaint);
255259

256-
// Draw the white line for the top of the cylinder
257-
final whitePaint = Paint()
258-
..color = Colors.white
260+
// Use the workspaceColor for the "hollow" border
261+
final borderPaint = Paint()
262+
..color = workspaceColor
259263
..style = PaintingStyle.stroke
260264
..strokeWidth = 2.0;
261-
canvas.drawOval(topEllipseRect, whitePaint);
265+
canvas.drawOval(topEllipseRect, borderPaint);
262266
}
263267
}
264268

@@ -452,6 +456,7 @@ class CanvasPainter extends CustomPainter {
452456
oldPainter.canvasObjects.length != canvasObjects.length ||
453457
oldPainter.currentlySelectedObjectId != currentlySelectedObjectId ||
454458
oldPainter.interactionMode != interactionMode ||
459+
oldPainter.workspaceColor != workspaceColor || // NEW: Added color check
455460
_hasCanvasObjectsChanged(oldPainter.canvasObjects, canvasObjects) ||
456461
oldPainter.connectorDragPosition !=
457462
connectorDragPosition; // Add check for connector drag

lib/features/workspace/pages/canvas_page.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class CanvasPage extends StatelessWidget {
105105
currentlySelectedObjectId:
106106
workspaceProvider.currentlySelectedObjectId,
107107
handleRadius: workspaceProvider.handleRadius,
108+
workspaceColor: workspaceProvider.currentWorkspaceColor,
108109
interactionMode: workspaceProvider.interactionMode,
109110
connectionPointRadius:
110111
workspaceProvider.connectionPointRadius,

lib/features/workspace/providers/workspace_provider.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ class WorkspaceProvider extends StateHandler {
205205
connectorDragPosition: null,
206206
connectorSourceId: null,
207207
connectorSourceAlignment: null,
208+
workspaceColor: _currentWorkspaceColor, // NEW: Pass the workspace color
208209
);
209210
painter.paint(canvas, imageBounds.size);
210211

@@ -1071,5 +1072,4 @@ class WorkspaceProvider extends StateHandler {
10711072
return a == b;
10721073
}
10731074
}
1074-
}
1075-
1075+
}

0 commit comments

Comments
 (0)