Show shared resize grips on wide chat pane dividers
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../../ui/adaptive/host.dart';
|
||||||
|
|
||||||
|
/// The same visible resize affordance for a mobile peek or a split pane.
|
||||||
|
class ChatDividerGrip extends StatelessWidget {
|
||||||
|
const ChatDividerGrip({
|
||||||
|
super.key,
|
||||||
|
this.axis = Axis.horizontal,
|
||||||
|
this.emphasized = false,
|
||||||
|
this.compact = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
final Axis axis;
|
||||||
|
final bool emphasized;
|
||||||
|
final bool compact;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final cupertino = usesCupertinoHost(context);
|
||||||
|
return RotatedBox(
|
||||||
|
quarterTurns: axis == Axis.vertical ? 1 : 0,
|
||||||
|
child: DecoratedBox(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: cupertino
|
||||||
|
? CupertinoColors.secondarySystemBackground.resolveFrom(context)
|
||||||
|
: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: emphasized
|
||||||
|
? Border.all(
|
||||||
|
color: cupertino
|
||||||
|
? CupertinoTheme.of(context).primaryColor
|
||||||
|
: Theme.of(context).colorScheme.primary,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: compact ? 6 : 8),
|
||||||
|
child: Icon(
|
||||||
|
cupertino ? CupertinoIcons.minus : Icons.drag_handle,
|
||||||
|
size: compact ? 12 : 18,
|
||||||
|
color: cupertino
|
||||||
|
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||||
|
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
import 'chat_divider_grip.dart';
|
||||||
|
|
||||||
/// A transparent touch target centred on the active chat's coloured bottom
|
/// 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.
|
/// border. Height is bounded by the original 20% peek and a nonzero minimum.
|
||||||
@@ -72,37 +71,7 @@ class _ChatMobilePeekDividerState extends State<ChatMobilePeekDivider> {
|
|||||||
onVerticalDragCancel: () => _dragHeight = null,
|
onVerticalDragCancel: () => _dragHeight = null,
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: 'Drag to resize inactive chat',
|
message: 'Drag to resize inactive chat',
|
||||||
child: Center(
|
child: Center(child: ChatDividerGrip(emphasized: _focused)),
|
||||||
child: DecoratedBox(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: usesCupertinoHost(context)
|
|
||||||
? CupertinoColors.secondarySystemBackground.resolveFrom(
|
|
||||||
context,
|
|
||||||
)
|
|
||||||
: Theme.of(context).colorScheme.surfaceContainerHigh,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: _focused
|
|
||||||
? Border.all(
|
|
||||||
color: usesCupertinoHost(context)
|
|
||||||
? CupertinoTheme.of(context).primaryColor
|
|
||||||
: Theme.of(context).colorScheme.primary,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
child: Icon(
|
|
||||||
usesCupertinoHost(context)
|
|
||||||
? CupertinoIcons.minus
|
|
||||||
: Icons.drag_handle,
|
|
||||||
size: 18,
|
|
||||||
color: usesCupertinoHost(context)
|
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
|||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
import '../../../ui/adaptive/host.dart';
|
||||||
import 'chat_workspace_controller.dart';
|
import 'chat_workspace_controller.dart';
|
||||||
|
import 'chat_divider_grip.dart';
|
||||||
import 'chat_workspace_geometry.dart';
|
import 'chat_workspace_geometry.dart';
|
||||||
|
|
||||||
/// A standard separator with a mouse/touch grab area and keyboard resizing.
|
/// A standard separator with a mouse/touch grab area and keyboard resizing.
|
||||||
@@ -93,15 +94,30 @@ class _ChatWorkspaceDividerState extends State<ChatWorkspaceDivider> {
|
|||||||
},
|
},
|
||||||
onPanEnd: (_) => setState(() => _drag = null),
|
onPanEnd: (_) => setState(() => _drag = null),
|
||||||
onPanCancel: () => setState(() => _drag = null),
|
onPanCancel: () => setState(() => _drag = null),
|
||||||
child: Center(
|
child: Tooltip(
|
||||||
child: Container(
|
message: 'Drag to resize chat panes',
|
||||||
width: verticalLine
|
child: Stack(
|
||||||
? (_hovered || _focused || _drag != null ? 3 : 1)
|
fit: StackFit.expand,
|
||||||
: null,
|
children: [
|
||||||
height: verticalLine
|
Center(
|
||||||
? null
|
child: Container(
|
||||||
: (_hovered || _focused || _drag != null ? 3 : 1),
|
width: verticalLine
|
||||||
color: color,
|
? (_hovered || _focused || _drag != null ? 3 : 1)
|
||||||
|
: null,
|
||||||
|
height: verticalLine
|
||||||
|
? null
|
||||||
|
: (_hovered || _focused || _drag != null ? 3 : 1),
|
||||||
|
color: color,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: ChatDividerGrip(
|
||||||
|
axis: verticalLine ? Axis.vertical : Axis.horizontal,
|
||||||
|
compact: true,
|
||||||
|
emphasized: _hovered || _focused || _drag != null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Visible pane divider grips
|
||||||
|
|
||||||
|
Wide/browser and unfolded pane separators now use the same native-theme grip
|
||||||
|
as mobile quick switch, rotated for side-by-side panes. A compact grip fits the
|
||||||
|
existing 12-pixel divider; split geometry and resize limits are unchanged.
|
||||||
|
Hover/focus/drag highlights the grip. Existing mouse/touch/keyboard resizing and
|
||||||
|
double-click reset remain on the same hit target. Mobile keeps its existing grip
|
||||||
|
size and appearance through the shared widget.
|
||||||
Reference in New Issue
Block a user