@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
55import 'dart:math' as math;
66import 'package:cookethflow/core/helpers/responsive_layout.helper.dart' as rh;
77import 'package:provider/provider.dart' ;
8+ import 'package:flutter_screenutil/flutter_screenutil.dart' ;
89
910// The main NodePicker widget, now stateful
1011class 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> {
235237class 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+ }
0 commit comments