Skip to content

Commit 1a4f0da

Browse files
committed
msglist: Apply text style and padding to stream/topic recipient headers
Fixes: #372
1 parent e97e6fd commit 1a4f0da

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
@@ -569,7 +569,11 @@ class StreamMessageRecipientHeader extends StatelessWidget {
569569
}
570570
final textStyle = TextStyle(
571571
color: contrastingColor,
572-
);
572+
fontFamily: 'Source Sans 3',
573+
fontSize: 16,
574+
letterSpacing: 0.02 * 16,
575+
height: (18 / 16),
576+
).merge(weightVariableTextStyle(context, wght: 600, wghtIfPlatformRequestsBold: 900));
573577

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

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

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

0 commit comments

Comments
 (0)