add text zoom, fix context panel drag, widen default panels
Ctrl+Plus/Minus/0 text zoom (5% steps, 60%–200%) via MediaQuery textScaler. App-wide clideLineHeight (1.25) applied in DefaultTextStyle. Context panel drag resize was inverted — dragging left shrank the panel instead of growing it. Negate delta for right-anchored slots. Default sidebar widened from 240px to 400px, context panel from 280px to 420px (both at their previous maximums). Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+33
-7
@@ -55,6 +55,11 @@ class _RootShell extends StatefulWidget {
|
||||
|
||||
class _RootShellState extends State<_RootShell> {
|
||||
late final FocusNode _keyFocus;
|
||||
double _textScale = 1.0;
|
||||
|
||||
static const double _scaleStep = 0.05;
|
||||
static const double _scaleMin = 0.6;
|
||||
static const double _scaleMax = 2.0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -75,15 +80,18 @@ class _RootShellState extends State<_RootShell> {
|
||||
style: TextStyle(
|
||||
color: tokens.globalForeground,
|
||||
fontSize: 15,
|
||||
height: clideLineHeight,
|
||||
fontWeight: clideUiDefaultWeight,
|
||||
fontFamily: clideUiFamily,
|
||||
fontFamilyFallback: clideUiFamilyFallback,
|
||||
),
|
||||
child: KeyboardListener(
|
||||
focusNode: _keyFocus,
|
||||
autofocus: true,
|
||||
onKeyEvent: _onKey,
|
||||
child: ColoredBox(
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.linear(_textScale)),
|
||||
child: KeyboardListener(
|
||||
focusNode: _keyFocus,
|
||||
autofocus: true,
|
||||
onKeyEvent: _onKey,
|
||||
child: ColoredBox(
|
||||
color: tokens.globalBackground,
|
||||
child: ClideResizeBorder(
|
||||
windowControls: widget.services.window,
|
||||
@@ -107,10 +115,28 @@ class _RootShellState extends State<_RootShell> {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _onKey(KeyEvent event) {
|
||||
if (event is KeyDownEvent || event is KeyRepeatEvent) {
|
||||
final ctrl = HardwareKeyboard.instance.isControlPressed;
|
||||
if (ctrl) {
|
||||
if (event.logicalKey == LogicalKeyboardKey.equal || event.logicalKey == LogicalKeyboardKey.add) {
|
||||
setState(() => _textScale = (_textScale + _scaleStep).clamp(_scaleMin, _scaleMax));
|
||||
return;
|
||||
}
|
||||
if (event.logicalKey == LogicalKeyboardKey.minus) {
|
||||
setState(() => _textScale = (_textScale - _scaleStep).clamp(_scaleMin, _scaleMax));
|
||||
return;
|
||||
}
|
||||
if (event.logicalKey == LogicalKeyboardKey.digit0) {
|
||||
setState(() => _textScale = 1.0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
final binding = KeybindingResolver.fromKeyEvent(
|
||||
event,
|
||||
HardwareKeyboard.instance,
|
||||
@@ -137,8 +163,8 @@ class RootLayout extends StatelessWidget {
|
||||
final contextVisible = a.isVisible(Slots.contextPanel);
|
||||
final contextCollapsed = a.isCollapsed(Slots.contextPanel);
|
||||
final statusVisible = a.isVisible(Slots.statusbar);
|
||||
final sidebarSize = a.sizeOf(Slots.sidebar) ?? 240;
|
||||
final contextSize = a.sizeOf(Slots.contextPanel) ?? 280;
|
||||
final sidebarSize = a.sizeOf(Slots.sidebar) ?? 400;
|
||||
final contextSize = a.sizeOf(Slots.contextPanel) ?? 420;
|
||||
final statusHeight = a.sizeOf(Slots.statusbar) ?? 26;
|
||||
|
||||
return Column(
|
||||
|
||||
@@ -72,9 +72,10 @@ class _DragResizeHandleState extends State<DragResizeHandle> {
|
||||
final start = _dragStartSize;
|
||||
final startPt = _dragStartPointer;
|
||||
if (start == null || startPt == null) return;
|
||||
final delta = widget.axis == Axis.horizontal
|
||||
final rawDelta = widget.axis == Axis.horizontal
|
||||
? e.position.dx - startPt.dx
|
||||
: e.position.dy - startPt.dy;
|
||||
final delta = widget.slot == Slots.contextPanel ? -rawDelta : rawDelta;
|
||||
widget.arrangement.setSize(widget.slot, start + delta);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import 'package:clide/kernel/src/panels/slot_id.dart';
|
||||
/// default-layout extension share one source of truth.
|
||||
///
|
||||
/// Columns (px):
|
||||
/// sidebar 240 (drag 180–400)
|
||||
/// sidebar 400 (drag 180–400)
|
||||
/// center flex (workspace on top, statusbar below)
|
||||
/// context 280 (drag 220–420)
|
||||
/// context 420 (drag 220–420)
|
||||
/// statusbar 26 (fixed height strip)
|
||||
LayoutPresetContribution classicPreset() => const LayoutPresetContribution(
|
||||
id: 'builtin.default-layout.classic',
|
||||
@@ -17,7 +17,7 @@ LayoutPresetContribution classicPreset() => const LayoutPresetContribution(
|
||||
LayoutSlot(
|
||||
slot: Slots.sidebar,
|
||||
position: SlotPosition.left,
|
||||
defaultSize: 240,
|
||||
defaultSize: 400,
|
||||
minSize: 180,
|
||||
maxSize: 400,
|
||||
),
|
||||
@@ -28,7 +28,7 @@ LayoutPresetContribution classicPreset() => const LayoutPresetContribution(
|
||||
LayoutSlot(
|
||||
slot: Slots.contextPanel,
|
||||
position: SlotPosition.right,
|
||||
defaultSize: 280,
|
||||
defaultSize: 420,
|
||||
minSize: 220,
|
||||
maxSize: 420,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user