Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

feat: add reset app scale hotkey (#5386)

Sander Hoeve859eaf903bec
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart
index e979f102e3..b2d9945b2b 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart
@@ -141,6 +141,16 @@ class _HomeHotKeysState extends State<HomeHotKeys> {
keyDownHandler: (_) => _scaleWithStep(-0.1),
),
+ // Reset app scaling
+ HotKeyItem(
+ hotKey: HotKey(
+ KeyCode.digit0,
+ modifiers: [Platform.isMacOS ? KeyModifier.meta : KeyModifier.control],
+ scope: HotKeyScope.inapp,
+ ),
+ keyDownHandler: (_) => _scaleToSize(1),
+ ),
+
// Open settings dialog
openSettingsHotKey(context, widget.userProfile),
];
@@ -182,7 +192,11 @@ class _HomeHotKeysState extends State<HomeHotKeys> {
Log.info('scale the app from $currentScaleFactor to $textScale');
- ScaledWidgetsFlutterBinding.instance.scaleFactor = (_) => textScale;
- await windowSizeManager.setScaleFactor(textScale);
+ await _scaleToSize(textScale);
+ }
+
+ Future<void> _scaleToSize(double size) async {
+ ScaledWidgetsFlutterBinding.instance.scaleFactor = (_) => size;
+ await windowSizeManager.setScaleFactor(size);
}
}