fix(app): chat rows put the state word on the title line and recency in the meta, as on the web
This commit is contained in:
@@ -1,55 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// The title line of a chat session row: the session's name, with its relative
|
||||
/// recency at the trailing edge. Shared by the Material and Cupertino rows so
|
||||
/// both hosts arrange the same facts the same way.
|
||||
///
|
||||
/// The recency takes at most 45% of the text column and ellipsises there, so a
|
||||
/// long title keeps the larger share and a short row never overflows. The
|
||||
/// recency is supplementary: at very large text scales it is the part that
|
||||
/// gives way, while the session's name and state word stay whole.
|
||||
class ChatSessionRowTitle extends StatelessWidget {
|
||||
const ChatSessionRowTitle({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.time,
|
||||
required this.timeStyle,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String time;
|
||||
final TextStyle timeStyle;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) => Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(title, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
if (time.isNotEmpty) ...[
|
||||
const SizedBox(width: 8),
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: constraints.maxWidth * 0.45,
|
||||
),
|
||||
child: Text(
|
||||
time,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: timeStyle,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The muted second line of a chat session row: the recorded directory and
|
||||
/// model, with the unread/closed word at the trailing edge.
|
||||
/// A chat session row line with the unread/closed word at its trailing edge:
|
||||
/// the row's title line, as on the web.
|
||||
///
|
||||
/// The directory/model is the part that ellipsises; the state word is the row's
|
||||
/// only unread marker, so it keeps its intrinsic width and the metadata shrinks
|
||||
|
||||
Reference in New Issue
Block a user