Skip to content

Commit 491b5d5

Browse files
committed
msglist: Show channel name and topic name on two rows
This mostly follows the legacy mobile app. Notably, this changes the title text to use normal font weight (wght=400), and breaks the text into two rows for topic narrow. This will eventually be superseded by zulip#1039, so we should keep the implementation as simple as possible for now. There are some differences from the old design: The legacy mobile uses different colors for the title text, depending on the color of the channel, to make the text more visible. We currently don't do that, so the text just uses the ambient color. References: https://github.com/zulip/zulip-mobile/blob/a115df1f71c9dc31e9b41060a8d57b51c017d786/src/title/TitleStream.js#L113-L141 https://github.com/zulip/zulip-mobile/blob/a115df1f71c9dc31e9b41060a8d57b51c017d786/src/styles/navStyles.js#L5-L18 Signed-off-by: Zixuan James Li <[email protected]>
1 parent e4579f7 commit 491b5d5

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

lib/widgets/message_list.dart

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ class MessageListAppBarTitle extends StatelessWidget {
314314

315315
Widget _buildStreamRow(BuildContext context, {
316316
ZulipStream? stream,
317-
required String text,
318317
}) {
319318
// A null [Icon.icon] makes a blank space.
320319
final icon = (stream != null) ? iconDataForStream(stream) : null;
@@ -325,12 +324,24 @@ class MessageListAppBarTitle extends StatelessWidget {
325324
// https://github.com/zulip/zulip-flutter/pull/219#discussion_r1281024746
326325
crossAxisAlignment: CrossAxisAlignment.center,
327326
children: [
328-
Icon(size: 16, icon),
329-
const SizedBox(width: 4),
330-
Flexible(child: Text(text)),
327+
Padding(padding: const EdgeInsetsDirectional.only(end: 8.0),
328+
child: Icon(size: 20, icon)),
329+
Flexible(child: Text(stream?.name ?? '(unknown stream)',
330+
style: const TextStyle(
331+
fontSize: 20,
332+
).merge(weightVariableTextStyle(context)))),
331333
]);
332334
}
333335

336+
Widget _buildTopicRow(BuildContext context, {
337+
required ZulipStream? stream,
338+
required String topic,
339+
}) {
340+
return Text(topic, style: const TextStyle(
341+
fontSize: 13,
342+
).merge(weightVariableTextStyle(context)));
343+
}
344+
334345
@override
335346
Widget build(BuildContext context) {
336347
final zulipLocalizations = ZulipLocalizations.of(context);
@@ -348,14 +359,17 @@ class MessageListAppBarTitle extends StatelessWidget {
348359
case ChannelNarrow(:var streamId):
349360
final store = PerAccountStoreWidget.of(context);
350361
final stream = store.streams[streamId];
351-
final streamName = stream?.name ?? '(unknown channel)';
352-
return _buildStreamRow(context, stream: stream, text: streamName);
362+
return _buildStreamRow(context, stream: stream);
353363

354364
case TopicNarrow(:var streamId, :var topic):
355365
final store = PerAccountStoreWidget.of(context);
356366
final stream = store.streams[streamId];
357-
final streamName = stream?.name ?? '(unknown channel)';
358-
return _buildStreamRow(context, stream: stream, text: "$streamName > $topic");
367+
return Column(
368+
crossAxisAlignment: CrossAxisAlignment.start,
369+
children: [
370+
_buildStreamRow(context, stream: stream),
371+
_buildTopicRow(context, stream: stream, topic: topic),
372+
]);
359373

360374
case DmNarrow(:var otherRecipientIds):
361375
final store = PerAccountStoreWidget.of(context);

test/widgets/message_list_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ void main() {
725725
).length.equals(1);
726726
check(find.descendant(
727727
of: find.byType(MessageListAppBarTitle),
728-
matching: find.text('${channel.name} > new topic')).evaluate()
728+
matching: find.text('new topic')).evaluate()
729729
).length.equals(1);
730730
});
731731
});

0 commit comments

Comments
 (0)