Skip to content

Commit 69710cb

Browse files
committed
feat: shortcut upgrade
1 parent 7d6ab67 commit 69710cb

File tree

6 files changed

+59
-53
lines changed

6 files changed

+59
-53
lines changed

lib/features/workspace/pages/desktop/workspace_desktop.dart

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import 'package:cookethflow/features/workspace/widgets/workspace_drawer.dart';
1414
import 'package:cookethflow/features/workspace/widgets/workspace_shortcuts.dart'; // shortcut file
1515
import 'package:cookethflow/features/workspace/widgets/zoom_control_button.dart';
1616
import 'package:flutter/material.dart';
17+
import 'package:go_router/go_router.dart';
1718
import 'package:provider/provider.dart';
1819
import 'package:flutter_screenutil/flutter_screenutil.dart';
1920
import 'package:cookethflow/features/workspace/widgets/object_text_editor.dart';
@@ -115,6 +116,12 @@ class _WorkspaceDesktopState extends State<WorkspaceDesktop> {
115116
return null;
116117
},
117118
),
119+
EscapeIntent: CallbackAction<EscapeIntent>(
120+
onInvoke: (intent) {
121+
context.pop();
122+
return null;
123+
},
124+
),
118125
};
119126

120127
return Consumer2<WorkspaceProvider, SupabaseService>(
@@ -142,12 +149,12 @@ class _WorkspaceDesktopState extends State<WorkspaceDesktop> {
142149
children: [
143150
const CanvasPage(),
144151
const WorkspaceDrawer(),
145-
SizedBox(width: 20.w),
146-
Positioned(
147-
top: 0,
148-
left: 0.21.sw,
149-
child: UndoRedoButton(su: suprovider),
150-
),
152+
// SizedBox(width: 20.w),
153+
// Positioned(
154+
// top: 0,
155+
// left: 0.21.sw,
156+
// child: UndoRedoButton(su: suprovider),
157+
// ),
151158
Positioned(
152159
top: 0,
153160
right: 0.001.sw,

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ class WorkspaceMobile extends StatelessWidget {
3737
children: [
3838
const CanvasPage(),
3939
workspaceDrawerMob(device),
40-
Positioned(
41-
top: 120.h,
42-
right: 0.h,
43-
child: UndoRedoButton(su: suprovider),
44-
),
40+
// Positioned(
41+
// top: 120.h,
42+
// right: 0.h,
43+
// child: UndoRedoButton(su: suprovider),
44+
// ),
4545
Padding(
4646
padding: EdgeInsets.only(bottom: 40.h),
4747
child: Align(

lib/features/workspace/pages/tablet/workspace_tablet.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class WorkspaceTablet extends StatelessWidget {
3434
CanvasPage(),
3535
// Top Bar
3636
const WorkspaceDrawer(),
37-
SizedBox(width: 16.w),
37+
// SizedBox(width: 16.w),
3838

39-
Positioned(top: 0, left: 0.31.sw, child: UndoRedoButton(su: suprovider,)),
39+
// Positioned(top: 0, left: 0.31.sw, child: UndoRedoButton(su: suprovider,)),
4040
Positioned(
4141
top: 0,
4242
right: 0.001.sw,

lib/features/workspace/widgets/toolbar.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class ToolBar extends StatelessWidget {
216216
_horizontalDivider(device),
217217
_toolIcon(
218218
PhosphorIconsRegular.cursor,
219-
'Pointer\nPress P',
219+
'Pointer\nPress CTRL + P',
220220
device,
221221
iconColor:
222222
provider.currentMode == DrawMode.pointer
@@ -235,7 +235,7 @@ class ToolBar extends StatelessWidget {
235235
_horizontalDivider(device),
236236
_toolIcon(
237237
PhosphorIconsRegular.handGrabbing,
238-
'Pan\nPress A',
238+
'Pan\nPress CTRL + A',
239239
device,
240240
iconColor:
241241
provider.currentMode == DrawMode.hand
@@ -254,7 +254,7 @@ class ToolBar extends StatelessWidget {
254254
_horizontalDivider(device),
255255
_toolIcon(
256256
PhosphorIconsRegular.textT,
257-
'Text box\nPress T',
257+
'Text box\nPress ALT + T',
258258
device,
259259
iconColor:
260260
provider.currentMode == DrawMode.textBox
@@ -286,7 +286,7 @@ class ToolBar extends StatelessWidget {
286286
_horizontalDivider(device),
287287
_toolIcon(
288288
PhosphorIconsFill.noteBlank,
289-
'Add new sticky note\nPress S',
289+
'Add new sticky note\nPress CTRL + S',
290290
device,
291291
iconColor:
292292
provider.currentMode == DrawMode.stickyNote
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// it is the file to control the keyboard shortcuts
21
import 'package:flutter/material.dart';
32
import 'package:flutter/services.dart';
43

5-
// define intents
64
class PointerIntent extends Intent {}
75

86
class PanIntent extends Intent {}
@@ -17,14 +15,15 @@ class ZoomInIntent extends Intent {}
1715

1816
class ZoomOutIntent extends Intent {}
1917

20-
// define shortcuts
18+
class EscapeIntent extends Intent {}
2119

2220
final Map<LogicalKeySet, Intent> workspaceShortCut = {
23-
LogicalKeySet(LogicalKeyboardKey.keyP): PointerIntent(),
24-
LogicalKeySet(LogicalKeyboardKey.keyA): PanIntent(),
25-
LogicalKeySet(LogicalKeyboardKey.keyT): TextIntent(),
26-
LogicalKeySet(LogicalKeyboardKey.keyS): StickyNoteIntent(),
27-
LogicalKeySet(LogicalKeyboardKey.keyR): ResetIntent(),
28-
LogicalKeySet(LogicalKeyboardKey.keyZ): ZoomInIntent(),
29-
LogicalKeySet(LogicalKeyboardKey.keyX): ZoomOutIntent(),
30-
};
21+
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyP): PointerIntent(),
22+
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyA): PanIntent(),
23+
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.keyT): TextIntent(),
24+
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyS): StickyNoteIntent(),
25+
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyR): ResetIntent(),
26+
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyZ): ZoomInIntent(),
27+
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyX): ZoomOutIntent(),
28+
LogicalKeySet(LogicalKeyboardKey.escape) : EscapeIntent(),
29+
};

lib/features/workspace/widgets/zoom_control_button.dart

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,31 @@ class ZoomControlButton extends StatelessWidget {
3434
child: Row(
3535
crossAxisAlignment: CrossAxisAlignment.center,
3636
children: [
37-
Text(
38-
"${canvasProvider.currentZoomPercentage.toStringAsFixed(0)}%", // Display current zoom
39-
style: TextStyle(
40-
color: suprovider.isDark ? Colors.white : Colors.black,
41-
fontWeight: FontWeight.w500,
42-
fontSize:
43-
device == rh.DeviceType.desktop
44-
? 24.sp
45-
: device == rh.DeviceType.tab
46-
? 24.sp
47-
: 40.sp,
48-
),
49-
),
50-
SizedBox(
51-
width:
52-
device == rh.DeviceType.desktop
53-
? 8.w
54-
: device == rh.DeviceType.tab
55-
? 8.w
56-
: 12.w,
57-
),
58-
VerticalCustomDivider(),
37+
// Text(
38+
// "${canvasProvider.currentZoomPercentage.toStringAsFixed(0)}%", // Display current zoom
39+
// style: TextStyle(
40+
// color: suprovider.isDark ? Colors.white : Colors.black,
41+
// fontWeight: FontWeight.w500,
42+
// fontSize:
43+
// device == rh.DeviceType.desktop
44+
// ? 24.sp
45+
// : device == rh.DeviceType.tab
46+
// ? 24.sp
47+
// : 40.sp,
48+
// ),
49+
// ),
50+
// SizedBox(
51+
// width:
52+
// device == rh.DeviceType.desktop
53+
// ? 8.w
54+
// : device == rh.DeviceType.tab
55+
// ? 8.w
56+
// : 12.w,
57+
// ),
58+
// VerticalCustomDivider(),
5959
SizedBox(width: 8.w),
6060
IconButton(
61-
tooltip: "Press Z",
61+
tooltip: "Press CTRL + Z",
6262
onPressed: () {
6363
canvasProvider.zoomIn(); // Call zoomIn method
6464
},
@@ -77,7 +77,7 @@ class ZoomControlButton extends StatelessWidget {
7777
VerticalCustomDivider(),
7878
SizedBox(width: 8.w),
7979
IconButton(
80-
tooltip: 'Press X',
80+
tooltip: 'Press CTRL + X',
8181
onPressed: () {
8282
canvasProvider.zoomOut(); // Call zoomOut method
8383
},
@@ -109,7 +109,7 @@ class ZoomControlButton extends StatelessWidget {
109109
: 60.sp,
110110
), // Icon for reset
111111
visualDensity: VisualDensity.compact,
112-
tooltip: 'Reset Zoom\nPress R',
112+
tooltip: 'Reset Zoom\nPress CTRL + R',
113113
),
114114
],
115115
),

0 commit comments

Comments
 (0)