Skip to content

Commit 22e7a35

Browse files
committed
msglist: Apply text style and padding to stream/topic recipient headers
Fixes: zulip#372
1 parent a9c144f commit 22e7a35

File tree

1 file changed

+46
-31
lines changed

1 file changed

+46
-31
lines changed

lib/widgets/message_list.dart

+46-31
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,11 @@ class StreamMessageRecipientHeader extends StatelessWidget {
568568
}
569569
final textStyle = TextStyle(
570570
color: contrastingColor,
571-
);
571+
fontFamily: 'Source Sans 3',
572+
fontSize: 16,
573+
letterSpacing: 0.02 * 16,
574+
height: (18 / 16),
575+
).merge(weightVariableTextStyle(context, wght: 600, wghtIfPlatformRequestsBold: 900));
572576

573577
final Widget streamWidget;
574578
if (!showStream) {
@@ -581,18 +585,25 @@ class StreamMessageRecipientHeader extends StatelessWidget {
581585
onTap: () => Navigator.push(context,
582586
MessageListPage.buildRoute(context: context,
583587
narrow: StreamNarrow(message.streamId))),
584-
child: Row(children: [
585-
const SizedBox(width: 16),
586-
// TODO globe/lock icons for web-public and private streams
587-
Text(streamName, style: textStyle),
588-
Padding(
589-
// Figma has 5px horizontal padding around an 8px wide icon.
590-
// Icon is 16px wide here so horizontal padding is 1px.
591-
padding: const EdgeInsets.symmetric(horizontal: 1),
592-
child: Icon(size: 16,
593-
color: contrastingColor.withOpacity(0.6),
594-
ZulipIcons.chevron_right)),
595-
]));
588+
child: Row(
589+
crossAxisAlignment: CrossAxisAlignment.center,
590+
children: [
591+
const SizedBox(width: 16),
592+
// TODO globe/lock icons for web-public and private streams
593+
Padding(
594+
padding: const EdgeInsets.symmetric(vertical: 11),
595+
child: Text(streamName,
596+
style: textStyle,
597+
overflow: TextOverflow.ellipsis),
598+
),
599+
Padding(
600+
// Figma has 5px horizontal padding around an 8px wide icon.
601+
// Icon is 16px wide here so horizontal padding is 1px.
602+
padding: const EdgeInsets.symmetric(horizontal: 1),
603+
child: Icon(size: 16,
604+
color: contrastingColor.withOpacity(0.6),
605+
ZulipIcons.chevron_right)),
606+
]));
596607
}
597608

598609
return GestureDetector(
@@ -601,23 +612,24 @@ class StreamMessageRecipientHeader extends StatelessWidget {
601612
narrow: TopicNarrow.ofMessage(message))),
602613
child: ColoredBox(
603614
color: backgroundColor,
604-
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
605-
// TODO(#282): Long stream name will break layout; find a fix.
606-
streamWidget,
607-
Expanded(
608-
child: Padding(
609-
// Web has padding 9, 3, 3, 2 here; but 5px is the chevron.
610-
padding: const EdgeInsets.fromLTRB(4, 3, 3, 2),
611-
child: Text(topic,
612-
// TODO: Give a way to see the whole topic (maybe a
613-
// long-press interaction?)
614-
style: textStyle,
615-
overflow: TextOverflow.ellipsis))),
616-
// TODO topic links?
617-
// Then web also has edit/resolve/mute buttons. Skip those for mobile.
618-
RecipientHeaderDate(message: message,
619-
color: contrastingColor.withOpacity(0.4)),
620-
])));
615+
child: Row(
616+
crossAxisAlignment: CrossAxisAlignment.center,
617+
children: [
618+
// TODO(#282): Long stream name will break layout; find a fix.
619+
streamWidget,
620+
Expanded(
621+
child: Padding(
622+
padding: const EdgeInsets.symmetric(vertical: 11),
623+
child: Text(topic,
624+
// TODO: Give a way to see the whole topic (maybe a
625+
// long-press interaction?)
626+
style: textStyle,
627+
overflow: TextOverflow.ellipsis))),
628+
// TODO topic links?
629+
// Then web also has edit/resolve/mute buttons. Skip those for mobile.
630+
RecipientHeaderDate(message: message,
631+
color: contrastingColor.withOpacity(0.4)),
632+
])));
621633
}
622634
}
623635

@@ -678,7 +690,10 @@ class RecipientHeaderDate extends StatelessWidget {
678690
color: color,
679691
fontFamily: 'Source Sans 3',
680692
fontSize: 16,
681-
height: (19 / 16),
693+
// In Figma this has a line-height of 19, but using 18
694+
// here to match the stream/topic text widgets helps
695+
// to align all the text to the same baseline.
696+
height: (18 / 16),
682697
// This is equivalent to css `all-small-caps`, see:
683698
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps#all-small-caps
684699
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],

0 commit comments

Comments
 (0)