mirror of
https://github.com/block/buzz.git
synced 2026-11-02 15:31:27 +00:00
## Summary - align message typography, avatars, metadata, and spacing across mobile surfaces - improve message follow behavior, touch feedback, and Activity popover motion - refine Search motion, gutters, and explicit recent-search history ## Snapshots ### Home  ### Activity  ### Search  ## Testing - `just mobile-check` - `just mobile-test` (749 passed, 1 skipped) --------- Signed-off-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: kenny lopez <klopez4212@gmail.com> Signed-off-by: npub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7f <ab176f059d100602ea25073d9a69ee9817f7b691c76a897180d48498d959faa2@buzz.block.builderlab.xyz> Signed-off-by: Wes <wesbillman@users.noreply.github.com> Signed-off-by: npub15w828kxsxu2684ynste0uah2jwkgatd99flt7ds4523hzm8ju6cshdr8hh <a38ea3d8d03715a3d49382f2fe76ea93ac8eada52a7ebf3615a2a3716cf2e6b1@buzz.block.builderlab.xyz> Co-authored-by: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@buzz.block.builderlab.xyz> Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Co-authored-by: npub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7f <ab176f059d100602ea25073d9a69ee9817f7b691c76a897180d48498d959faa2@buzz.block.builderlab.xyz> Co-authored-by: Wes <wesbillman@users.noreply.github.com> Co-authored-by: Carl <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz> Co-authored-by: npub15w828kxsxu2684ynste0uah2jwkgatd99flt7ds4523hzm8ju6cshdr8hh <a38ea3d8d03715a3d49382f2fe76ea93ac8eada52a7ebf3615a2a3716cf2e6b1@buzz.block.builderlab.xyz>
119 lines
3.6 KiB
Dart
119 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../theme/theme.dart';
|
|
|
|
/// A consistent inline author row for message-oriented surfaces.
|
|
class MessageAuthorMeta extends StatelessWidget {
|
|
/// Primary author name shown at the start of the row.
|
|
final String displayName;
|
|
|
|
/// Optional secondary username, hidden when blank or equal to [displayName].
|
|
final String? username;
|
|
|
|
/// Timestamp label shown after the author metadata.
|
|
final String timestamp;
|
|
|
|
/// Color applied to [displayName].
|
|
final Color nameColor;
|
|
|
|
/// Color applied to the username, separator, and [timestamp].
|
|
final Color metadataColor;
|
|
|
|
/// Optional callback invoked when [displayName] is tapped.
|
|
final VoidCallback? onAuthorTap;
|
|
|
|
/// Optional key assigned to the display-name text.
|
|
final Key? displayNameKey;
|
|
|
|
/// Optional key assigned to the username text.
|
|
final Key? usernameKey;
|
|
|
|
/// Optional key assigned to the timestamp text.
|
|
final Key? timestampKey;
|
|
|
|
/// Base text style for [displayName], with [nameColor] applied.
|
|
final TextStyle nameStyle;
|
|
|
|
/// Base text style for secondary metadata, with [metadataColor] applied.
|
|
final TextStyle metadataStyle;
|
|
|
|
/// Creates an inline author row with optional username and tap handling.
|
|
const MessageAuthorMeta({
|
|
super.key,
|
|
required this.displayName,
|
|
required this.timestamp,
|
|
required this.nameColor,
|
|
required this.metadataColor,
|
|
this.username,
|
|
this.onAuthorTap,
|
|
this.displayNameKey,
|
|
this.usernameKey,
|
|
this.timestampKey,
|
|
this.nameStyle = messageUsernameTextStyle,
|
|
this.metadataStyle = messageMetadataTextStyle,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final normalizedUsername = username?.trim();
|
|
final showUsername =
|
|
normalizedUsername != null &&
|
|
normalizedUsername.isNotEmpty &&
|
|
normalizedUsername != displayName.trim();
|
|
final resolvedNameStyle = nameStyle.copyWith(color: nameColor);
|
|
final resolvedMetadataStyle = metadataStyle.copyWith(color: metadataColor);
|
|
|
|
Widget authorName = Text(
|
|
displayName,
|
|
key: displayNameKey,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: resolvedNameStyle,
|
|
);
|
|
if (onAuthorTap != null) {
|
|
authorName = GestureDetector(onTap: onAuthorTap, child: authorName);
|
|
}
|
|
|
|
return LayoutBuilder(
|
|
builder: (context, constraints) {
|
|
final metadataMaxWidth = constraints.hasBoundedWidth
|
|
? constraints.maxWidth / (showUsername ? 3 : 2)
|
|
: double.infinity;
|
|
|
|
return Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Expanded(child: authorName),
|
|
if (showUsername) ...[
|
|
const SizedBox(width: Grid.half),
|
|
ConstrainedBox(
|
|
constraints: BoxConstraints(maxWidth: metadataMaxWidth),
|
|
child: Text(
|
|
normalizedUsername,
|
|
key: usernameKey,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: resolvedMetadataStyle,
|
|
),
|
|
),
|
|
],
|
|
const SizedBox(width: Grid.half),
|
|
Text('·', style: resolvedMetadataStyle),
|
|
const SizedBox(width: Grid.half),
|
|
ConstrainedBox(
|
|
constraints: BoxConstraints(maxWidth: metadataMaxWidth),
|
|
child: Text(
|
|
timestamp,
|
|
key: timestampKey,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: resolvedMetadataStyle,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|