@@ -30,10 +30,9 @@ class _ObjectTextEditorState extends State<ObjectTextEditor> {
3030 return Consumer2 <WorkspaceProvider , CanvasProvider >(
3131 builder: (context, workspaceProvider, canvasProvider, child) {
3232 final selectedObjectId = workspaceProvider.currentlySelectedObjectId;
33- final selectedObject =
34- selectedObjectId != null
35- ? workspaceProvider.canvasObjects[selectedObjectId]
36- : null ;
33+ final selectedObject = selectedObjectId != null
34+ ? workspaceProvider.canvasObjects[selectedObjectId]
35+ : null ;
3736
3837 if (workspaceProvider.interactionMode != InteractionMode .editingText ||
3938 selectedObject == null ) {
@@ -47,14 +46,11 @@ class _ObjectTextEditorState extends State<ObjectTextEditor> {
4746 });
4847
4948 final Rect objectBounds = selectedObject.getBounds ();
50- final Matrix4 transform = canvasProvider.transformationController.value;
49+ final Matrix4 transform =
50+ canvasProvider.transformationController.value;
5151 final vc.Vector3 transformedTopLeft = transform.transform3 (
5252 vc.Vector3 (objectBounds.topLeft.dx, objectBounds.topLeft.dy, 0 ),
5353 );
54- final Offset screenTopLeft = Offset (
55- transformedTopLeft.x,
56- transformedTopLeft.y,
57- );
5854 final vc.Vector3 transformedBottomRight = transform.transform3 (
5955 vc.Vector3 (
6056 objectBounds.bottomRight.dx,
@@ -63,23 +59,24 @@ class _ObjectTextEditorState extends State<ObjectTextEditor> {
6359 ),
6460 );
6561 final visibleRect = Rect .fromPoints (
66- screenTopLeft ,
62+ Offset (transformedTopLeft.x, transformedTopLeft.y) ,
6763 Offset (transformedBottomRight.x, transformedBottomRight.y),
6864 );
6965
70- final quillController = workspaceProvider.selectedObjectQuillController;
66+ final quillController =
67+ workspaceProvider.selectedObjectQuillController;
7168
72- return Positioned (
73- left : visibleRect.left,
74- // Position the entire widget (toolbar + editor) at the object's location
75- top : visibleRect.top,
76- child : Material (
77- color : Colors .transparent,
78- child : Column (
79- crossAxisAlignment : CrossAxisAlignment .start,
80- children : [
81- Container (
82- width : visibleRect.width < 350. w ? 350. w : visibleRect.width,
69+ // RESTRUCTURE: Use a Stack to position the toolbar and editor independently.
70+ return Stack (
71+ children : [
72+ // 1. The Quill Toolbar, positioned to the right of the text object.
73+ Positioned (
74+ left : visibleRect.right + 10. w, // Place it right of the object
75+ top : visibleRect.top,
76+ child : Material (
77+ color : Colors .transparent,
78+ child : Container (
79+ // The toolbar will size itself, but you can add constraints if needed
8380 decoration: BoxDecoration (
8481 color: Colors .white,
8582 borderRadius: BorderRadius .circular (8. r),
@@ -111,18 +108,24 @@ class _ObjectTextEditorState extends State<ObjectTextEditor> {
111108 ),
112109 ),
113110 ),
114- SizedBox (height: 4. h), // Spacing between toolbar and editor
115- // FIX: Add a visible container for the editor
116- Container (
117- width: visibleRect.width,
118- height: visibleRect.height,
111+ ),
112+ ),
113+
114+ // 2. The Quill Editor, positioned directly over the text object.
115+ Positioned (
116+ left: visibleRect.left,
117+ top: visibleRect.top,
118+ width: visibleRect.width,
119+ height: visibleRect.height,
120+ child: Material (
121+ color: Colors .transparent,
122+ child: Container (
119123 decoration: BoxDecoration (
120- color: Colors .white, // Make the editor background white
124+ color: Colors .white,
121125 border: Border .all (
122- color: Colors .blue.shade300,
123- width: 1.5 ,
124- ), // Add a border
125- borderRadius: BorderRadius .circular (4. r),
126+ color: Colors .blue.shade400, // Brighter border
127+ width: 2.0 , // Thicker border to indicate editing
128+ ),
126129 ),
127130 child: QuillEditor .basic (
128131 controller: quillController,
@@ -139,17 +142,17 @@ class _ObjectTextEditorState extends State<ObjectTextEditor> {
139142 null ,
140143 ),
141144 ),
142- placeholder: 'Type here ...' ,
145+ placeholder: 'Type something ...' ,
143146 ),
144147 focusNode: _focusNode,
145148 scrollController: ScrollController (),
146149 ),
147150 ),
148- ] ,
151+ ) ,
149152 ),
150- ) ,
153+ ] ,
151154 );
152155 },
153156 );
154157 }
155- }
158+ }
0 commit comments