Show shared resize grips on list pane dividers

This commit is contained in:
2026-11-08 14:50:07 +00:00
parent 4f51470202
commit e1da589396
6 changed files with 53 additions and 27 deletions
@@ -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<ChatMobilePeekDivider> {
onVerticalDragCancel: () => _dragHeight = null,
child: Tooltip(
message: 'Drag to resize inactive chat',
child: Center(child: ChatDividerGrip(emphasized: _focused)),
child: Center(child: AdaptiveResizeGrip(emphasized: _focused)),
),
),
),
@@ -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<ChatWorkspaceDivider> {
),
),
Center(
child: ChatDividerGrip(
child: AdaptiveResizeGrip(
axis: verticalLine ? Axis.vertical : Axis.horizontal,
compact: true,
emphasized: _hovered || _focused || _drag != null,
+7 -19
View File
@@ -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<ListPaneDivider> {
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<ListPaneDivider> {
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,
),
),
),
@@ -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,