move the pin toggle to the pane leading slot

The pin/unpin toggle is a mode control, not navigation — grouping it
with back/forward/jump implied they work alike. Pull it out of
ReaderActionBar into a standalone ReaderPinButton placed before the
title (ClidePaneChrome.leading), leaving the right-hand navigator to
back/forward/jump-to-pin/edit. Applies to all three readers. (T-198)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 15:26:23 +02:00
co-authored by Claude Opus 4.8
parent e2b43b2a86
commit 5b3fbb994f
5 changed files with 46 additions and 30 deletions
+5 -4
View File
@@ -40,10 +40,11 @@ heading, and (b) bumping `pubspec.yaml` `version:` in the same commit.
`.clideignore` pair — the single ignore knob clide owns. (T-52)
- `files.walk` command — a recursive, ignore-pruned, capped flat file listing
of the workspace, backing quick-open and search. (T-51, T-52)
- Sidebar readers (markdown, decision, and ticket) gain a chrome action bar: a
pin/unpin toggle on the left, then a navigator (back, forward, jump-to-pin) and
an edit pencil on the right (no pencil for tickets — they're not files). The
ticket reader joins the shared retained nav and drops its per-click tab churn.
- Sidebar readers (markdown, decision, and ticket) gain chrome: a pin/unpin
toggle in the leading slot before the title (a mode control, kept separate
from navigation), and a right-hand navigator — back, forward, jump-to-pin —
plus an edit pencil (no pencil for tickets — they're not files). The ticket
reader joins the shared retained nav and drops its per-click tab churn.
(T-189, T-190, T-191, T-198, T-199)
### Fixed
@@ -110,6 +110,10 @@ class _DecisionDetailViewState extends State<DecisionDetailView> {
return ClidePaneChrome(
title: id,
subtitle: title,
leading: ReaderPinButton(
pinned: _nav?.hasPinned ?? false,
onTap: _decision != null ? _onPin : null,
),
trailing: [
ReaderActionBar(
canGoBack: _nav?.canGoBack ?? false,
@@ -117,7 +121,6 @@ class _DecisionDetailViewState extends State<DecisionDetailView> {
hasPinned: _nav?.hasPinned ?? false,
onBack: (_nav?.canGoBack ?? false) ? _onBack : null,
onForward: (_nav?.canGoForward ?? false) ? _onForward : null,
onPin: _decision != null ? _onPin : null,
onJumpToPin: (_nav?.hasPinned ?? false) ? _onJumpToPin : null,
onEdit: filePath != null ? _onEdit : null,
),
@@ -103,6 +103,10 @@ class _MarkdownViewerState extends State<MarkdownViewer> {
return ClidePaneChrome(
title: _path ?? 'viewer',
subtitle: '${_content!.split('\n').length} lines',
leading: ReaderPinButton(
pinned: _nav?.hasPinned ?? false,
onTap: _path != null ? _onPin : null,
),
trailing: [
ReaderActionBar(
canGoBack: _nav?.canGoBack ?? false,
@@ -110,7 +114,6 @@ class _MarkdownViewerState extends State<MarkdownViewer> {
hasPinned: _nav?.hasPinned ?? false,
onBack: (_nav?.canGoBack ?? false) ? _onBack : null,
onForward: (_nav?.canGoForward ?? false) ? _onForward : null,
onPin: _path != null ? _onPin : null,
onJumpToPin: (_nav?.hasPinned ?? false) ? _onJumpToPin : null,
onEdit: _path != null ? _onEdit : null,
),
+29 -23
View File
@@ -14,13 +14,12 @@ import 'package:flutter/widgets.dart';
// Action bar widget
// ---------------------------------------------------------------------------
/// A row of reader-chrome action buttons. Layout (T-196 UX): a pin/unpin
/// **toggle on the left**, then the **navigator** on the right — back,
/// forward, jump-to-pin (only while pinned) — and the edit pencil last.
/// The left toggles pinned state; the right navigates.
///
/// Designed to plug into [ClidePaneChrome.trailing]. All callbacks are
/// optional — pass null to hide/disable the corresponding button.
/// The reader's **navigator** — back, forward, jump-to-pin (only while
/// pinned), and the edit pencil. Plugs into [ClidePaneChrome.trailing].
/// The pin/unpin toggle is deliberately NOT here: it's a mode control,
/// not navigation, so it lives in the pane's leading slot as a
/// standalone [ReaderPinButton] (T-198). All callbacks are optional —
/// pass null to hide/disable the corresponding button.
class ReaderActionBar extends StatelessWidget {
const ReaderActionBar({
super.key,
@@ -29,7 +28,6 @@ class ReaderActionBar extends StatelessWidget {
required this.hasPinned,
required this.onBack,
required this.onForward,
required this.onPin,
required this.onJumpToPin,
required this.onEdit,
});
@@ -40,10 +38,6 @@ class ReaderActionBar extends StatelessWidget {
final VoidCallback? onBack;
final VoidCallback? onForward;
/// Called when the pin toggle is tapped — pins the current entry when
/// nothing is pinned, else clears the pin.
final VoidCallback? onPin;
/// Called when the jump-to-pin button (in the navigator) is tapped.
final VoidCallback? onJumpToPin;
@@ -56,17 +50,6 @@ class ReaderActionBar extends StatelessWidget {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
// Left — toggle the pinned state.
_ActionButton(
painter: PhosphorIcons.pushPin,
tooltip: hasPinned ? 'Unpin' : 'Pin',
enabled: onPin != null,
active: hasPinned,
onTap: onPin,
tokens: tokens,
),
const SizedBox(width: 8),
// Right — the navigator.
_ActionButton(
painter: PhosphorIcons.caretLeft,
tooltip: 'Back',
@@ -107,6 +90,29 @@ class ReaderActionBar extends StatelessWidget {
}
}
/// The pin/unpin toggle — a single button that sits in the pane's
/// leading slot (before the title), separate from the navigator so the
/// two kinds of control don't read as one group (T-198). [pinned]
/// drives the accent + the Pin/Unpin label; [onTap] toggles.
class ReaderPinButton extends StatelessWidget {
const ReaderPinButton({super.key, required this.pinned, required this.onTap});
final bool pinned;
final VoidCallback? onTap;
@override
Widget build(BuildContext context) {
return _ActionButton(
painter: PhosphorIcons.pushPin,
tooltip: pinned ? 'Unpin' : 'Pin',
enabled: onTap != null,
active: pinned,
onTap: onTap,
tokens: ClideTheme.of(context).surface,
);
}
}
// ---------------------------------------------------------------------------
// Private button widget
// ---------------------------------------------------------------------------
@@ -73,6 +73,10 @@ class _TicketDetailViewState extends State<TicketDetailView> {
return ClidePaneChrome(
title: d.id,
subtitle: d.title,
leading: ReaderPinButton(
pinned: _nav?.hasPinned ?? false,
onTap: _onPin,
),
trailing: [
ReaderActionBar(
canGoBack: _nav?.canGoBack ?? false,
@@ -80,7 +84,6 @@ class _TicketDetailViewState extends State<TicketDetailView> {
hasPinned: _nav?.hasPinned ?? false,
onBack: (_nav?.canGoBack ?? false) ? _onBack : null,
onForward: (_nav?.canGoForward ?? false) ? _onForward : null,
onPin: _onPin,
onJumpToPin: (_nav?.hasPinned ?? false) ? _onJumpToPin : null,
onEdit: null, // tickets are pql records, not files
),