efaa0d9fca
A chat dropped onto the middle of another makes a named group (asked at once, "Group N" by default); onto a group it joins, a group dropped onto a chat takes it in, groups merge. The top level shows each group as a small pile with its name and count; a tap opens it in place under a header that leads back (also the scrim, Back and Escape). In a group, dropping a chat on the header leaves the group; a group of one dissolves. The close button ungroups a dropped group with Undo. Rename, Ungroup, Close all (with Undo), Move to group and Remove from group are in the group menu and as semantic actions. Each open-chat entry carries its group name (protocol field "group", omitted when ungrouped; older clients ignore it), stored and pushed by the server like the order; names are trimmed, printable, at most 80 characters. Needs a server restart to keep groups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
2.5 KiB
Dart
80 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../ui/sessions/chat_awaiting.dart';
|
|
import 'chat_stack_disc.dart';
|
|
import 'chat_stack_entry.dart';
|
|
import 'chat_stack_pose.dart';
|
|
|
|
/// A group's pile is the collapsed stack's, this much smaller, so it keeps
|
|
/// inside its slot.
|
|
const double chatStackGroupPileScale = .8;
|
|
|
|
/// How many of a group's chats its pile draws.
|
|
const int chatStackGroupLayers = 3;
|
|
|
|
/// A group in the open column: its first chats piled as the collapsed stack
|
|
/// piles the open ones (smaller, turned), the chat on screen on top when it
|
|
/// is in the group, and the waiting bell when any of them waits on the
|
|
/// operator. Paint-only poses; nothing animates here.
|
|
class ChatStackGroupPile extends StatelessWidget {
|
|
const ChatStackGroupPile({
|
|
super.key,
|
|
required this.entries,
|
|
this.glow,
|
|
this.ring,
|
|
});
|
|
|
|
final List<ChatStackEntry> entries;
|
|
|
|
/// The top layer's lifted look (dragged) or drop-target [ring] (0 to 1).
|
|
final Animation<double>? glow;
|
|
final Color? ring;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final current = entries.indexWhere((entry) => entry.current);
|
|
final top = current < 0 ? 0 : current;
|
|
final shown = [
|
|
for (var depth = 0; depth < entries.length; depth++)
|
|
entries[(top + depth) % entries.length],
|
|
].take(chatStackGroupLayers).toList();
|
|
final rtl = Directionality.of(context) == TextDirection.rtl;
|
|
final waiting = entries.fold(0, (sum, e) => sum + e.awaitingOperator);
|
|
return SizedBox.square(
|
|
dimension: kChatStackSlot,
|
|
child: Stack(
|
|
clipBehavior: Clip.none,
|
|
children: [
|
|
for (var depth = shown.length - 1; depth >= 0; depth--)
|
|
ChatStackPoseTransition(
|
|
progress: kAlwaysCompleteAnimation,
|
|
from: _pose(depth, rtl),
|
|
to: _pose(depth, rtl),
|
|
child: ChatStackDisc(
|
|
lift: depth == 0 ? glow : null,
|
|
liftRing: ring,
|
|
child: chatStackAvatar(shown[depth], cues: false),
|
|
),
|
|
),
|
|
if (waiting > 0)
|
|
PositionedDirectional(
|
|
top: -4,
|
|
end: -4,
|
|
child: IgnorePointer(child: ChatAwaitingBadge(count: waiting)),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
ChatStackPose _pose(int depth, bool rtl) {
|
|
final layer = chatStackLayers[depth];
|
|
final pose = ChatStackPose(
|
|
offset: layer.offset * chatStackGroupPileScale,
|
|
turn: layer.turn,
|
|
scale: layer.scale * chatStackGroupPileScale,
|
|
);
|
|
return rtl ? pose.mirrored() : pose;
|
|
}
|
|
}
|