Skip to content

Commit 5f6d141

Browse files
authored
Merge pull request #28 from swarno-tech/rewrite
workspace drawer fix
2 parents 28012da + 0cb28a9 commit 5f6d141

8 files changed

Lines changed: 266 additions & 250 deletions

File tree

lib/features/workspace/pages/mobile/workspace_mobile.dart

Lines changed: 115 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ class WorkspaceMobile extends StatelessWidget {
3030
return Scaffold(
3131
backgroundColor: provider.currentWorkspaceColor,
3232
body: Padding(
33-
padding: EdgeInsets.symmetric(vertical: 20.h),
33+
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 20.h),
3434
child: Stack(
3535
clipBehavior: Clip.none,
3636
children: [
3737
const CanvasPage(),
3838
workspaceDrawerMob(device),
39-
Positioned(right: 10.h, top: 120.h, child: UndoRedoButton()),
40-
Positioned(bottom: 100.h, left: 100.h, child: ToolBar()),
41-
42-
Positioned(
43-
bottom: 0.h,
44-
right: 230.h,
45-
child: ZoomControlButton(),
39+
Positioned(top: 120.h, right: 0.h, child: UndoRedoButton()),
40+
Padding(
41+
padding: EdgeInsets.only(bottom: 40.h),
42+
child: Align(
43+
alignment: Alignment.bottomCenter,
44+
child: ToolBar(),
45+
),
4646
),
4747

4848
Consumer2<WorkspaceProvider, CanvasProvider>(
@@ -102,7 +102,7 @@ class WorkspaceMobile extends StatelessWidget {
102102
}
103103
}
104104

105-
Widget workspaceDrawerMob(rh.DeviceType device) {
105+
Widget workspaceDrawerMob(rh.DeviceType device,) {
106106
return Consumer<WorkspaceProvider>(
107107
builder: (context, provider, child) {
108108
Color defaultBorderColor = const Color(0xFFD9D9D9);
@@ -122,74 +122,76 @@ Widget workspaceDrawerMob(rh.DeviceType device) {
122122
mainAxisAlignment: MainAxisAlignment.start,
123123
children: [
124124
// Always visible header row
125-
Container(
126-
padding: EdgeInsets.only(bottom: 10, top: 0),
127-
child: Row(
128-
mainAxisSize: MainAxisSize.min,
129-
children: [
130-
IconButton(
131-
onPressed: () {
132-
provider.toggleDrawer();
133-
},
134-
icon: Icon(
135-
PhosphorIconsRegular.sidebarSimple,
136-
size: 80.sp,
125+
Row(
126+
mainAxisSize: MainAxisSize.min,
127+
mainAxisAlignment: MainAxisAlignment.start,
128+
children: [
129+
IconButton(
130+
onPressed: () {
131+
provider.toggleDrawer();
132+
},
133+
icon:
134+
!provider.isDrawerOpen
135+
? Icon(
136+
PhosphorIconsRegular.sidebarSimple,
137+
size: 100.sp,
138+
color: Colors.black,
139+
)
140+
: Icon(
141+
Icons.close,
142+
size: 100.sp,
143+
color: Colors.black,
144+
),
145+
splashRadius: 24.r,
146+
tooltip: 'Toggle Sidebar',
147+
),
148+
SizedBox(width: 30.w),
149+
Expanded(
150+
child: TextField(
151+
controller: provider.workspaceNameController,
152+
style: TextStyle(
153+
fontFamily: 'Fredrik',
154+
fontSize: 72.sp,
155+
fontWeight: FontWeight.w600,
137156
color: Colors.black,
157+
letterSpacing: 0.6,
138158
),
139-
splashRadius: 24.r,
140-
tooltip: 'Toggle Sidebar',
141-
),
142-
SizedBox(width: 30.w),
143-
Expanded(
144-
child: TextField(
145-
controller: provider.workspaceNameController,
146-
style: TextStyle(
147-
fontFamily: 'Fredrik',
148-
fontSize: 62.sp,
149-
fontWeight: FontWeight.w600,
150-
color: Colors.black,
151-
letterSpacing: 0.6,
152-
),
153-
decoration: const InputDecoration(
154-
isDense: true,
155-
contentPadding: EdgeInsets.zero,
156-
border: InputBorder.none,
157-
focusedBorder: InputBorder.none,
158-
enabledBorder: InputBorder.none,
159-
),
159+
decoration: const InputDecoration(
160+
isDense: true,
161+
contentPadding: EdgeInsets.zero,
162+
border: InputBorder.none,
163+
focusedBorder: InputBorder.none,
164+
enabledBorder: InputBorder.none,
160165
),
161166
),
162-
SizedBox(width: 10.w),
167+
),
168+
SizedBox(width: 10.w),
163169

164-
Padding(
165-
padding: const EdgeInsets.only(right: 20),
166-
child: ElevatedButton(
167-
onPressed: () {
168-
showDialog(
169-
context: context,
170-
builder: (context) => ExportDialog(),
171-
);
172-
},
173-
style: ElevatedButton.styleFrom(
174-
elevation: 0,
175-
backgroundColor: primaryColor,
176-
padding: EdgeInsets.symmetric(
177-
vertical: 25.h,
178-
horizontal: 2.w,
179-
),
180-
shape: RoundedRectangleBorder(
181-
borderRadius: BorderRadius.circular(12.r),
182-
),
183-
),
184-
child: Icon(
185-
PhosphorIconsRegular.export,
186-
color: Colors.white,
187-
size: 80.sp,
188-
),
170+
ElevatedButton(
171+
onPressed: () {
172+
showDialog(
173+
context: context,
174+
builder: (context) => ExportDialog(),
175+
);
176+
},
177+
style: ElevatedButton.styleFrom(
178+
elevation: 0,
179+
backgroundColor: primaryColor,
180+
padding: EdgeInsets.symmetric(
181+
vertical: 10.h,
182+
horizontal: 0.1.w,
183+
),
184+
shape: RoundedRectangleBorder(
185+
borderRadius: BorderRadius.circular(12.r),
189186
),
190187
),
191-
],
192-
),
188+
child: Icon(
189+
PhosphorIconsRegular.export,
190+
color: Colors.white,
191+
size: 100.sp,
192+
),
193+
),
194+
],
193195
),
194196
Divider(),
195197
Expanded(
@@ -203,50 +205,50 @@ Widget workspaceDrawerMob(rh.DeviceType device) {
203205
alignment: Alignment.topCenter,
204206
child:
205207
provider.isDrawerOpen
206-
? Column(
207-
mainAxisSize: MainAxisSize.max,
208-
children: [
209-
device == rh.DeviceType.desktop
210-
? SizedBox(height: 20.h)
211-
: SizedBox(height: 10.h),
212-
const Divider(color: Colors.grey, thickness: 0.5),
213-
SizedBox(height: 10.h),
214-
Expanded(
215-
child: ListView.separated(
216-
padding: EdgeInsets.zero,
217-
itemCount: provider.canvasObjectsList.length,
218-
separatorBuilder:
219-
(context, index) =>
220-
device == rh.DeviceType.desktop
221-
? SizedBox(height: 8.h)
222-
: SizedBox(height: 2.h),
223-
itemBuilder: (context, index) {
224-
CanvasObject item =
225-
provider.canvasObjectsList[index];
226-
return _buildSelectableListTile(
227-
context,
228-
provider: provider,
229-
title:
230-
item.toJson()['object_type']
231-
as String,
232-
iconData: provider.getIconForObjectType(
233-
item.toJson()['object_type'],
234-
), // Use the helper
235-
index: index,
236-
isSelected:
237-
provider.currentlySelectedObjectId ==
238-
item.id,
239-
device: device,
240-
onTap: () {
241-
provider.changeCurrentlySelectedObj(
242-
item.id,
208+
? Align(
209+
alignment: Alignment.topLeft,
210+
child: SizedBox(
211+
width: 350.h,
212+
height: 780.h,
213+
child: Column(
214+
mainAxisSize: MainAxisSize.max,
215+
children: [
216+
Expanded(
217+
child: ListView.builder(
218+
padding: EdgeInsets.zero,
219+
itemCount:
220+
provider.canvasObjectsList.length,
221+
itemBuilder: (context, index) {
222+
CanvasObject item =
223+
provider.canvasObjectsList[index];
224+
return _buildSelectableListTile(
225+
context,
226+
provider: provider,
227+
title:
228+
item.toJson()['object_type']
229+
as String,
230+
iconData: provider
231+
.getIconForObjectType(
232+
item.toJson()['object_type'],
233+
), // Use the helper
234+
index: index,
235+
isSelected:
236+
provider
237+
.currentlySelectedObjectId ==
238+
item.id,
239+
device: device,
240+
onTap: () {
241+
provider.changeCurrentlySelectedObj(
242+
item.id,
243+
);
244+
},
243245
);
244246
},
245-
);
246-
},
247-
),
247+
),
248+
),
249+
],
248250
),
249-
],
251+
),
250252
)
251253
: const SizedBox.shrink(),
252254
),
@@ -274,16 +276,12 @@ Widget _buildSelectableListTile(
274276
return Container(
275277
color: Colors.white,
276278
child: ListTile(
277-
leading: Icon(
278-
iconData,
279-
size: device == rh.DeviceType.desktop ? 24.sp : 35.sp,
280-
color: iconTextColor,
281-
),
279+
leading: Icon(iconData, size: 85.sp, color: iconTextColor),
282280
title: Text(
283281
title,
284282
style: TextStyle(
285283
fontFamily: 'Fredrik',
286-
fontSize: device == rh.DeviceType.desktop ? 18.sp : 28.sp,
284+
fontSize: 60.sp,
287285
color: iconTextColor,
288286
),
289287
),

lib/features/workspace/widgets/node_picker.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:cookethflow/core/utils/enums.dart';
22
import 'package:cookethflow/features/workspace/providers/workspace_provider.dart';
33
import 'package:flutter/material.dart';
44
import 'dart:math' as math;
5-
5+
import 'package:cookethflow/core/helpers/responsive_layout.helper.dart' as rh;
66
import 'package:provider/provider.dart';
77

88
// The main NodePicker widget, now stateful
@@ -61,11 +61,12 @@ class _NodePickerState extends State<NodePicker> {
6161

6262
@override
6363
Widget build(BuildContext context) {
64+
final device = rh.ResponsiveLayoutHelper.getDeviceType(context);
6465
return Dialog(
6566
backgroundColor: Colors.transparent,
6667
elevation: 0,
6768
child: Container(
68-
width: 340,
69+
width:device == rh.DeviceType.desktop ? 340 : device == rh.DeviceType.tab ? 340 : 300,
6970
padding: const EdgeInsets.all(24.0),
7071
decoration: BoxDecoration(
7172
color: Colors.white,

lib/features/workspace/widgets/object_text_editor.dart

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:flutter_quill/flutter_quill.dart';
88
import 'package:flutter_screenutil/flutter_screenutil.dart';
99
import 'package:provider/provider.dart';
1010
import 'package:vector_math/vector_math_64.dart' as vc;
11+
import 'package:cookethflow/core/helpers/responsive_layout.helper.dart' as rh;
1112

1213
class ObjectTextEditor extends StatefulWidget {
1314
const ObjectTextEditor({super.key});
@@ -45,6 +46,7 @@ class _ObjectTextEditorState extends State<ObjectTextEditor> {
4546

4647
@override
4748
Widget build(BuildContext context) {
49+
final device = rh.ResponsiveLayoutHelper.getDeviceType(context);
4850
return Consumer2<WorkspaceProvider, CanvasProvider>(
4951
builder: (context, workspaceProvider, canvasProvider, child) {
5052
final selectedObjectId = workspaceProvider.currentlySelectedObjectId;
@@ -106,23 +108,26 @@ class _ObjectTextEditorState extends State<ObjectTextEditor> {
106108
),
107109
],
108110
),
109-
child: QuillSimpleToolbar(
110-
controller: quillController,
111-
config: const QuillSimpleToolbarConfig(
112-
showBackgroundColorButton: true,
113-
showFontFamily: true,
114-
showLink: true,
115-
showSearchButton: false,
116-
showInlineCode: true,
117-
showListCheck: true,
118-
showQuote: true,
119-
showCodeBlock: true,
120-
showListBullets: true,
121-
showListNumbers: true,
122-
showClearFormat: true,
123-
showBoldButton: true,
124-
showItalicButton: true,
125-
showHeaderStyle: true,
111+
child: SingleChildScrollView(
112+
scrollDirection: Axis.vertical,
113+
child: QuillSimpleToolbar(
114+
controller: quillController,
115+
config: const QuillSimpleToolbarConfig(
116+
showBackgroundColorButton: true,
117+
showFontFamily: true,
118+
showLink: true,
119+
showSearchButton: false,
120+
showInlineCode: true,
121+
showListCheck: true,
122+
showQuote: true,
123+
showCodeBlock: true,
124+
showListBullets: true,
125+
showListNumbers: true,
126+
showClearFormat: true,
127+
showBoldButton: true,
128+
showItalicButton: true,
129+
showHeaderStyle: true,
130+
),
126131
),
127132
),
128133
),

0 commit comments

Comments
 (0)