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
+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,
),
),
),