diff --git a/app/lib/features/chat/workspace/chat_mobile_peek_divider.dart b/app/lib/features/chat/workspace/chat_mobile_peek_divider.dart index b6be0936..bcc51fbd 100644 --- a/app/lib/features/chat/workspace/chat_mobile_peek_divider.dart +++ b/app/lib/features/chat/workspace/chat_mobile_peek_divider.dart @@ -1,7 +1,7 @@ import 'dart:math' as math; import 'package:flutter/services.dart'; import 'package:flutter/material.dart'; -import 'chat_divider_grip.dart'; +import '../../../ui/adaptive/resize_grip.dart'; /// A transparent touch target centred on the active chat's coloured bottom /// border. Height is bounded by the original 20% peek and a nonzero minimum. @@ -71,7 +71,7 @@ class _ChatMobilePeekDividerState extends State { onVerticalDragCancel: () => _dragHeight = null, child: Tooltip( message: 'Drag to resize inactive chat', - child: Center(child: ChatDividerGrip(emphasized: _focused)), + child: Center(child: AdaptiveResizeGrip(emphasized: _focused)), ), ), ), diff --git a/app/lib/features/chat/workspace/chat_workspace_divider.dart b/app/lib/features/chat/workspace/chat_workspace_divider.dart index 191f7f12..74eb6e90 100644 --- a/app/lib/features/chat/workspace/chat_workspace_divider.dart +++ b/app/lib/features/chat/workspace/chat_workspace_divider.dart @@ -4,7 +4,7 @@ import 'package:flutter/services.dart'; import '../../../ui/adaptive/host.dart'; import 'chat_workspace_controller.dart'; -import 'chat_divider_grip.dart'; +import '../../../ui/adaptive/resize_grip.dart'; import 'chat_workspace_geometry.dart'; /// A standard separator with a mouse/touch grab area and keyboard resizing. @@ -112,7 +112,7 @@ class _ChatWorkspaceDividerState extends State { ), ), Center( - child: ChatDividerGrip( + child: AdaptiveResizeGrip( axis: verticalLine ? Axis.vertical : Axis.horizontal, compact: true, emphasized: _hovered || _focused || _drag != null, diff --git a/app/lib/shell/list_pane_divider.dart b/app/lib/shell/list_pane_divider.dart index e48d6b25..cc19c2be 100644 --- a/app/lib/shell/list_pane_divider.dart +++ b/app/lib/shell/list_pane_divider.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import '../ui/adaptive/host.dart'; +import '../ui/adaptive/resize_grip.dart'; /// How wide the divider's invisible grab area is, centred on its line. const double kListPaneDividerGrabWidth = 12; @@ -27,7 +28,8 @@ class ListPaneDividerLine extends StatelessWidget { /// The grab area over [ListPaneDividerLine]: dragging it (mouse or touch) /// resizes the list pane between [min] and [max], the arrow keys move it by /// [kListPaneDividerKeyStep], and a double tap or click returns it to the -/// default policy. It shows a handle while hovered, focused or dragged. +/// default policy. The handle is always visible and is emphasized while +/// hovered, focused or dragged. class ListPaneDivider extends StatefulWidget { const ListPaneDivider({ super.key, @@ -119,10 +121,6 @@ class _ListPaneDividerState extends State { String _describe(double width) => '${width.round()} pixels'; - Color _handleColor(BuildContext context) => usesCupertinoHost(context) - ? CupertinoTheme.of(context).primaryColor - : Theme.of(context).colorScheme.primary; - @override Widget build(BuildContext context) { final dragging = _dragWidth != null; @@ -163,20 +161,10 @@ class _ListPaneDividerState extends State { onHorizontalDragCancel: _dragEnd, onDoubleTap: widget.onReset, child: Center( - child: AnimatedOpacity( - opacity: active ? 1 : 0, - duration: const Duration(milliseconds: 150), - child: Container( - width: 4, - decoration: BoxDecoration( - // A hovered or focused handle is a hint; it firms up - // while dragged. - color: _handleColor( - context, - ).withValues(alpha: dragging ? 1 : 0.5), - borderRadius: BorderRadius.circular(2), - ), - ), + child: AdaptiveResizeGrip( + axis: Axis.vertical, + compact: true, + emphasized: active, ), ), ), diff --git a/app/lib/features/chat/workspace/chat_divider_grip.dart b/app/lib/ui/adaptive/resize_grip.dart similarity index 88% rename from app/lib/features/chat/workspace/chat_divider_grip.dart rename to app/lib/ui/adaptive/resize_grip.dart index eb9f9b4e..455941a2 100644 --- a/app/lib/features/chat/workspace/chat_divider_grip.dart +++ b/app/lib/ui/adaptive/resize_grip.dart @@ -1,11 +1,11 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; +import 'host.dart'; -/// The same visible resize affordance for a mobile peek or a split pane. -class ChatDividerGrip extends StatelessWidget { - const ChatDividerGrip({ +/// A native-themed affordance for a draggable pane divider. +class AdaptiveResizeGrip extends StatelessWidget { + const AdaptiveResizeGrip({ super.key, this.axis = Axis.horizontal, this.emphasized = false, diff --git a/app/notes/sidebar-resize-grips.md b/app/notes/sidebar-resize-grips.md new file mode 100644 index 00000000..4a858ad2 --- /dev/null +++ b/app/notes/sidebar-resize-grips.md @@ -0,0 +1,16 @@ +# Shared sidebar resize grips + +The Chat, Pipelines, and Runs list/detail divider now uses the shared adaptive +native-theme resize grip. It is visible at rest and gains emphasis on hover, +focus, and drag. Chat's split-pane and mobile peek dividers use the same neutral +`AdaptiveResizeGrip` widget. + +Focused verification: + +- `tool/memwatch/full.sh 'test/shell/list_pane_resize_test.dart test/shell/list_pane_width_test.dart test/shell/list_pane_compact_test.dart test/features/chat/workspace/chat_workspace_test.dart test/features/chat/workspace/chat_mobile_panes_test.dart'`: 32 passed. +- `tool/analyze.sh`: clean. + +The widget coverage exercises both Material and Cupertino hosts, including +resting visibility and focus emphasis. Existing resize tests continue to cover +mouse/touch drag bounds, keyboard resizing, reset, semantics, persistence, +and compact behavior. diff --git a/app/test/shell/list_pane_resize_test.dart b/app/test/shell/list_pane_resize_test.dart index 39073d7d..60e2d1c3 100644 --- a/app/test/shell/list_pane_resize_test.dart +++ b/app/test/shell/list_pane_resize_test.dart @@ -10,6 +10,7 @@ import 'package:pipelines_app/shell/list_detail.dart'; import 'package:pipelines_app/shell/list_pane_divider.dart'; import 'package:pipelines_app/shell/list_pane_widths.dart'; import 'package:pipelines_app/shell/shell_bar.dart'; +import 'package:pipelines_app/ui/adaptive/resize_grip.dart'; /// Dragging the divider between a list and its open item resizes the list, /// within bounds, per destination, remembered on this device. @@ -209,6 +210,27 @@ void main() { expect(listWidth(tester), kListPaneMaxWidth); semantics.dispose(); }); + + testWidgets('$host: the native resize grip is visible at rest and gains ' + 'emphasis on focus', (tester) async { + await setSize(tester, const Size(1200, 800)); + await tester.pumpWidget( + shell(cupertino: cupertino, store: MemoryListPaneWidthStore()), + ); + await settle(tester); + + AdaptiveResizeGrip grip() => tester.widget( + find.descendant( + of: find.byType(ListPaneDivider), + matching: find.byType(AdaptiveResizeGrip), + ), + ); + expect(grip().emphasized, isFalse); + + Focus.of(tester.element(divider)).requestFocus(); + await tester.pump(); + expect(grip().emphasized, isTrue); + }); } test('bounds: list at least 240, open item at least half the window', () {