Chat stack: polish pile layers, dark tone, Add chat picker title, probe param
This commit is contained in:
@@ -16,45 +16,41 @@ const double kChatStackPitch = kChatStackSlot + 8;
|
||||
/// The gap between an item's name label and its avatar.
|
||||
const double kChatStackLabelGap = 10;
|
||||
|
||||
/// An opaque disc in the design's shape (a circle, or a framed square under a
|
||||
/// flat design) that carries one avatar of the stack. The list avatar's fill
|
||||
/// is translucent; the disc keeps stacked avatars from showing through each
|
||||
/// other, and its rim separates them. A raised design drops a short shadow;
|
||||
/// a flat one keeps its hairline frame instead.
|
||||
/// An opaque disc in the design's shape (a circle, or the design's square
|
||||
/// under a flat design) that carries one avatar of the stack. The list
|
||||
/// avatar's fill is translucent; the disc keeps stacked avatars from showing
|
||||
/// through each other, and its rim separates them. A raised design drops a
|
||||
/// short shadow; a flat one casts none, and its avatar frames itself.
|
||||
class ChatStackDisc extends StatelessWidget {
|
||||
const ChatStackDisc({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.ring,
|
||||
this.shadow = true,
|
||||
});
|
||||
const ChatStackDisc({super.key, required this.child, this.ring});
|
||||
|
||||
final Widget child;
|
||||
|
||||
/// The rim's colour when it marks the current chat; null for the surface.
|
||||
final Color? ring;
|
||||
|
||||
/// Whether this disc may cast a shadow (a layer under another does not).
|
||||
final bool shadow;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final tokens = AppDesignTokens.of(context);
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final base = tokens.panelFill(scheme, scheme.surface);
|
||||
// A raised dark design lifts the disc a tone, as Material's dark
|
||||
// elevation does, so the pile's layers read where a shadow cannot.
|
||||
final dark = Theme.of(context).brightness == Brightness.dark;
|
||||
final base = tokens.panelFill(
|
||||
scheme,
|
||||
dark ? scheme.surfaceContainerHighest : scheme.surface,
|
||||
);
|
||||
final ring = this.ring;
|
||||
final shape = chatStackShape(tokens);
|
||||
final frame = tokens.frameSide;
|
||||
return SizedBox.square(
|
||||
dimension: kChatStackSlot,
|
||||
child: Center(
|
||||
child: DecoratedBox(
|
||||
decoration: ShapeDecoration(
|
||||
color: ring ?? base,
|
||||
shape: shape.copyWith(
|
||||
side: ring == null && frame != null ? frame : BorderSide.none,
|
||||
),
|
||||
shadows: shadow && !tokens.flat ? chatStackShadows(scheme) : null,
|
||||
// A flat design's avatar frames itself; the rim stays bare.
|
||||
shape: shape,
|
||||
shadows: !tokens.flat ? chatStackShadows(scheme) : null,
|
||||
),
|
||||
child: SizedBox.square(
|
||||
dimension: kChatStackDisc,
|
||||
|
||||
@@ -45,9 +45,9 @@ class ChatStackPose {
|
||||
/// so the pile reads as cards rather than one disc.
|
||||
const List<ChatStackPose> chatStackLayers = [
|
||||
ChatStackPose(),
|
||||
ChatStackPose(offset: Offset(-4, -6), turn: -7 * math.pi / 180, scale: .94),
|
||||
ChatStackPose(offset: Offset(4, -11), turn: 6 * math.pi / 180, scale: .88),
|
||||
ChatStackPose(offset: Offset(-1, -15), turn: -4 * math.pi / 180, scale: .82),
|
||||
ChatStackPose(offset: Offset(-7, -7), turn: -8 * math.pi / 180, scale: .94),
|
||||
ChatStackPose(offset: Offset(4, -13), turn: 7 * math.pi / 180, scale: .88),
|
||||
ChatStackPose(offset: Offset(-4, -18), turn: -4 * math.pi / 180, scale: .82),
|
||||
];
|
||||
|
||||
/// How many avatars the collapsed stack draws.
|
||||
|
||||
Reference in New Issue
Block a user