Skip to content

Commit 822e6ae

Browse files
committed
msglist [nfc]: Deduplicate recipient-header text style
1 parent 7100ac5 commit 822e6ae

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

lib/widgets/message_list.dart

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -665,12 +665,6 @@ class StreamMessageRecipientHeader extends StatelessWidget {
665665
backgroundColor = _kUnsubscribedStreamRecipientHeaderColor;
666666
iconColor = Colors.black;
667667
}
668-
final textStyle = TextStyle(
669-
color: _kRecipientHeaderTextColor,
670-
fontSize: 16,
671-
letterSpacing: proportionalLetterSpacing(context, 0.02, baseFontSize: 16),
672-
height: (18 / 16),
673-
).merge(weightVariableTextStyle(context, wght: 600));
674668

675669
final Widget streamWidget;
676670
if (!showStream) {
@@ -699,7 +693,7 @@ class StreamMessageRecipientHeader extends StatelessWidget {
699693
Padding(
700694
padding: const EdgeInsets.symmetric(vertical: 11),
701695
child: Text(streamName,
702-
style: textStyle,
696+
style: recipientHeaderTextStyle(context),
703697
overflow: TextOverflow.ellipsis),
704698
),
705699
Padding(
@@ -730,7 +724,7 @@ class StreamMessageRecipientHeader extends StatelessWidget {
730724
// TODO: Give a way to see the whole topic (maybe a
731725
// long-press interaction?)
732726
overflow: TextOverflow.ellipsis,
733-
style: textStyle))),
727+
style: recipientHeaderTextStyle(context)))),
734728
// TODO topic links?
735729
// Then web also has edit/resolve/mute buttons. Skip those for mobile.
736730
RecipientHeaderDate(message: message,
@@ -776,12 +770,7 @@ class DmRecipientHeader extends StatelessWidget {
776770
child: Icon(size: 16, ZulipIcons.user)),
777771
Expanded(
778772
child: Text(title,
779-
style: TextStyle(
780-
color: _kRecipientHeaderTextColor,
781-
fontSize: 16,
782-
letterSpacing: proportionalLetterSpacing(context, 0.02, baseFontSize: 16),
783-
height: (18 / 16),
784-
).merge(weightVariableTextStyle(context, wght: 600)),
773+
style: recipientHeaderTextStyle(context),
785774
overflow: TextOverflow.ellipsis)),
786775
RecipientHeaderDate(message: message,
787776
color: _kDmRecipientHeaderDateColor),
@@ -795,6 +784,14 @@ class DmRecipientHeader extends StatelessWidget {
795784
final _kDmRecipientHeaderColor = const HSLColor.fromAHSL(1, 46, 0.35, 0.93).toColor();
796785
final _kDmRecipientHeaderDateColor = Colors.black.withOpacity(0.4);
797786

787+
TextStyle recipientHeaderTextStyle(BuildContext context) {
788+
return TextStyle(
789+
color: _kRecipientHeaderTextColor,
790+
fontSize: 16,
791+
letterSpacing: proportionalLetterSpacing(context, 0.02, baseFontSize: 16),
792+
height: (18 / 16),
793+
).merge(weightVariableTextStyle(context, wght: 600));
794+
}
798795
final _kRecipientHeaderTextColor = const HSLColor.fromAHSL(1, 0, 0, 0.15).toColor();
799796

800797
class RecipientHeaderDate extends StatelessWidget {

0 commit comments

Comments
 (0)