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 d479dc7

Browse files
committed
temp fix: commented out change shape
1 parent a7ec9a3 commit d479dc7

File tree

3 files changed

+62
-68
lines changed

3 files changed

+62
-68
lines changed

lib/features/workspace/widgets/node_editing_toolbox.dart

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// lib/features/workspace/widgets/node_editing_toolbox.dart
21
import 'package:cookethflow/core/providers/supabase_provider.dart';
32
import 'package:cookethflow/core/utils/enums.dart';
43
import 'package:cookethflow/features/models/canvas_models/objects/connector_object.dart';
@@ -115,50 +114,50 @@ class NodeEditingToolbox extends StatelessWidget {
115114
),
116115
);
117116
}
118-
} else if (isShape) {
119-
buttons.add(
120-
_buildIconButton(
121-
context,
122-
icon: PhosphorIcons.shapes(),
123-
onPressed: () {
124-
showDialog(
125-
context: context,
126-
builder: (context) => NodePicker(
127-
onShapeSelected: (shapeType) {
128-
provider.changeObjectShape(shapeType);
129-
Navigator.of(context).pop();
130-
},
131-
su: su,
132-
),
133-
);
134-
},
135-
tooltip: 'Change Shape',
136-
su: su,
137-
),
138-
);
139-
if (canChangeColor) {
140-
buttons.add(_buildDivider());
141-
buttons.add(
142-
_buildIconButton(
143-
context,
144-
icon: PhosphorIcons.paintBucket(),
145-
onPressed: () {
146-
showDialog(
147-
context: context,
148-
builder: (context) => NodeColourPicker(
149-
initialColor: object.color,
150-
onColorSelected: (color) {
151-
provider.changeObjectColor(color);
152-
Navigator.of(context).pop();
153-
},
154-
),
155-
);
156-
},
157-
tooltip: 'Change Color',
158-
su: su,
159-
),
160-
);
161-
}
117+
// } else if (isShape) {
118+
// buttons.add(
119+
// _buildIconButton(
120+
// context,
121+
// icon: PhosphorIcons.shapes(),
122+
// onPressed: () {
123+
// showDialog(
124+
// context: context,
125+
// builder: (context) => NodePicker(
126+
// onShapeSelected: (shapeType) {
127+
// provider.changeObjectShape(shapeType);
128+
// Navigator.of(context).pop();
129+
// },
130+
// su: su,
131+
// ),
132+
// );
133+
// },
134+
// tooltip: 'Change Shape',
135+
// su: su,
136+
// ),
137+
// );
138+
// if (canChangeColor) {
139+
// buttons.add(_buildDivider());
140+
// buttons.add(
141+
// _buildIconButton(
142+
// context,
143+
// icon: PhosphorIcons.paintBucket(),
144+
// onPressed: () {
145+
// showDialog(
146+
// context: context,
147+
// builder: (context) => NodeColourPicker(
148+
// initialColor: object.color,
149+
// onColorSelected: (color) {
150+
// provider.changeObjectColor(color);
151+
// Navigator.of(context).pop();
152+
// },
153+
// ),
154+
// );
155+
// },
156+
// tooltip: 'Change Color',
157+
// su: su,
158+
// ),
159+
// );
160+
// }
162161
} else if (canChangeColor) {
163162
buttons.add(
164163
_buildIconButton(
@@ -220,4 +219,4 @@ class NodeEditingToolbox extends StatelessWidget {
220219
),
221220
);
222221
}
223-
}
222+
}

lib/features/workspace/widgets/node_picker.dart

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
55
import 'dart:math' as math;
66
import 'package:cookethflow/core/helpers/responsive_layout.helper.dart' as rh;
77
import 'package:provider/provider.dart';
8+
import 'package:flutter_screenutil/flutter_screenutil.dart';
89

910
// The main NodePicker widget, now stateful
1011
class NodePicker extends StatefulWidget {
@@ -113,7 +114,7 @@ class _NodePickerState extends State<NodePicker> {
113114
decoration: BoxDecoration(
114115
color:
115116
widget.su.isDark
116-
? Color.fromRGBO(48, 48, 48, 1)
117+
? const Color.fromRGBO(48, 48, 48, 1)
117118
: Colors.white,
118119
borderRadius: BorderRadius.circular(16.0),
119120
boxShadow: [
@@ -137,17 +138,21 @@ class _NodePickerState extends State<NodePicker> {
137138
fontSize: 24,
138139
fontWeight: FontWeight.w600,
139140
color:
140-
widget.su.isDark ? Colors.white : Color(0xFF111827),
141+
widget.su.isDark ? Colors.white : const Color(0xFF111827),
141142
),
142143
),
143144
IconButton(
144145
icon: Icon(
145146
Icons.close,
146147
color:
147-
widget.su.isDark ? Colors.white : Color(0xFF111827),
148+
widget.su.isDark ? Colors.white : const Color(0xFF111827),
148149
size: 28,
149150
),
150151
onPressed: () {
152+
// When closing, if we're not changing a shape, reset the mode
153+
if (widget.onShapeSelected == null) {
154+
provider.changeDrawMode(DrawMode.pointer);
155+
}
151156
Navigator.of(context).pop();
152157
},
153158
),
@@ -167,7 +172,7 @@ class _NodePickerState extends State<NodePicker> {
167172
filled: true,
168173
fillColor:
169174
widget.su.isDark
170-
? Color.fromRGBO(48, 48, 48, 1)
175+
? const Color.fromRGBO(48, 48, 48, 1)
171176
: const Color(0xFFF9FAFB),
172177
contentPadding: const EdgeInsets.symmetric(
173178
vertical: 14.0,
@@ -205,10 +210,7 @@ class _NodePickerState extends State<NodePicker> {
205210
if (widget.onShapeSelected != null) {
206211
widget.onShapeSelected!(shape['shapeType']);
207212
} else {
208-
Provider.of<WorkspaceProvider>(
209-
context,
210-
listen: false,
211-
).changeDrawMode(shape['drawMode']);
213+
provider.changeDrawMode(shape['drawMode']);
212214
}
213215
Navigator.of(
214216
context,
@@ -235,7 +237,6 @@ class _NodePickerState extends State<NodePicker> {
235237
class ShapeWidget extends StatelessWidget {
236238
final ShapeType shapeType;
237239
final SupabaseService su;
238-
239240
final WorkspaceProvider provider;
240241

241242

@@ -244,8 +245,8 @@ class ShapeWidget extends StatelessWidget {
244245
@override
245246
Widget build(BuildContext context) {
246247
return Container(
247-
width: 60,
248-
height: 60,
248+
width: 60.w,
249+
height: 60.h,
249250
decoration: BoxDecoration(
250251
color: Colors.transparent,
251252
borderRadius: BorderRadius.circular(8.0),
@@ -355,4 +356,4 @@ class ShapePainter extends CustomPainter {
355356
bool shouldRepaint(covariant CustomPainter oldDelegate) {
356357
return false;
357358
}
358-
}
359+
}

lib/features/workspace/widgets/toolbar.dart

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class ToolBar extends StatelessWidget {
7777
'Add new node',
7878
device,
7979
onPressed: () {
80-
_showNodePicker(context, device, suprovider,provider);
80+
_showNodePicker(context, device, suprovider, provider);
8181
},
8282
backgroundColor:
8383
suprovider.isDark
@@ -204,7 +204,7 @@ class ToolBar extends StatelessWidget {
204204
'Add new node',
205205
device,
206206
onPressed: () {
207-
_showNodePicker(context, device, suprovider,provider);
207+
_showNodePicker(context, device, suprovider, provider);
208208
},
209209
backgroundColor:
210210
suprovider.isDark
@@ -383,13 +383,7 @@ class ToolBar extends StatelessWidget {
383383
return Stack(
384384
children: [
385385
Positioned.fill(
386-
child: GestureDetector(
387-
onTap: () {
388-
Navigator.pop(context);
389-
wp.changeDrawMode(DrawMode.pointer);
390-
},
391-
child: Container(color: Colors.transparent),
392-
),
386+
child: Container(color: Colors.transparent),
393387
),
394388
Positioned(
395389
top: topPos,
@@ -497,4 +491,4 @@ class ToolBar extends StatelessWidget {
497491
);
498492
}
499493
}
500-
}
494+
}

0 commit comments

Comments
 (0)