Skip to content

Commit c4bcd87

Browse files
committed
wip; 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 c4bcd87

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

lib/widgets/message_list.dart

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -314,23 +314,33 @@ class MessageListAppBarTitle extends StatelessWidget {
314314

315315
Widget _buildStreamRow(BuildContext context, {
316316
ZulipStream? stream,
317-
required String text,
318317
}) {
319-
// A null [Icon.icon] makes a blank space.
320-
final icon = (stream != null) ? iconDataForStream(stream) : null;
318+
final icon = (stream == null) ? ZulipIcons.hash_sign : iconDataForStream(stream);
321319
return Row(
322320
mainAxisSize: MainAxisSize.min,
323321
// TODO(design): The vertical alignment of the stream privacy icon is a bit ad hoc.
324322
// For screenshots of some experiments, see:
325323
// https://github.com/zulip/zulip-flutter/pull/219#discussion_r1281024746
326324
crossAxisAlignment: CrossAxisAlignment.center,
327325
children: [
328-
Icon(size: 16, icon),
329-
const SizedBox(width: 4),
330-
Flexible(child: Text(text)),
326+
Padding(padding: const EdgeInsetsDirectional.only(end: 8.0),
327+
child: Icon(size: 20, icon)),
328+
Flexible(child: Text(stream?.name ?? '(unknown stream)',
329+
style: const TextStyle(
330+
fontSize: 20,
331+
).merge(weightVariableTextStyle(context)))),
331332
]);
332333
}
333334

335+
Widget _buildTopicRow(BuildContext context, {
336+
required ZulipStream? stream,
337+
required String topic,
338+
}) {
339+
return Text(topic, style: const TextStyle(
340+
fontSize: 13,
341+
).merge(weightVariableTextStyle(context)));
342+
}
343+
334344
@override
335345
Widget build(BuildContext context) {
336346
final zulipLocalizations = ZulipLocalizations.of(context);
@@ -348,14 +358,17 @@ class MessageListAppBarTitle extends StatelessWidget {
348358
case ChannelNarrow(:var streamId):
349359
final store = PerAccountStoreWidget.of(context);
350360
final stream = store.streams[streamId];
351-
final streamName = stream?.name ?? '(unknown channel)';
352-
return _buildStreamRow(context, stream: stream, text: streamName);
361+
return _buildStreamRow(context, stream: stream);
353362

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

360373
case DmNarrow(:var otherRecipientIds):
361374
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)