Skip to content

Commit ce64ca5

Browse files
theme: Added labelTime variable in MessageListTheme
Added `labelTime` variable in `MessageListTheme` that replaces the `dateSeparatorText` and `messageTimestamp` variable according to the latest design. `labelTime`: #1213 (comment)
1 parent 1f0c262 commit ce64ca5

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

lib/widgets/message_list.dart

+9-16
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
3030
MessageListTheme.light() :
3131
this._(
3232
dateSeparator: Colors.black,
33-
dateSeparatorText: const HSLColor.fromAHSL(0.75, 0, 0, 0.15).toColor(),
33+
labelTime: const HSLColor.fromAHSL(0.49, 0, 0, 0).toColor(),
3434
dmRecipientHeaderBg: const HSLColor.fromAHSL(1, 46, 0.35, 0.93).toColor(),
35-
messageTimestamp: const HSLColor.fromAHSL(0.8, 0, 0, 0.2).toColor(),
3635
recipientHeaderText: const HSLColor.fromAHSL(1, 0, 0, 0.15).toColor(),
3736
senderBotIcon: const HSLColor.fromAHSL(1, 180, 0.08, 0.65).toColor(),
3837
senderName: const HSLColor.fromAHSL(1, 0, 0, 0.2).toColor(),
@@ -56,9 +55,8 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
5655
MessageListTheme.dark() :
5756
this._(
5857
dateSeparator: Colors.white.withValues(alpha: 51),
59-
dateSeparatorText: const HSLColor.fromAHSL(0.5, 0, 0, 1).toColor(),
58+
labelTime: const HSLColor.fromAHSL(0.5, 0, 0, 1).toColor(),
6059
dmRecipientHeaderBg: const HSLColor.fromAHSL(1, 0, 0, 0.14).toColor(),
61-
messageTimestamp: const HSLColor.fromAHSL(0.5, 0, 0, 1).toColor(),
6260
recipientHeaderText: const HSLColor.fromAHSL(0.9, 0, 0, 1).toColor(),
6361
senderBotIcon: const HSLColor.fromAHSL(1, 180, 0.05, 0.5).toColor(),
6462
senderName: const HSLColor.fromAHSL(0.9, 0, 0, 1).toColor(),
@@ -80,9 +78,8 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
8078

8179
MessageListTheme._({
8280
required this.dateSeparator,
83-
required this.dateSeparatorText,
81+
required this.labelTime,
8482
required this.dmRecipientHeaderBg,
85-
required this.messageTimestamp,
8683
required this.recipientHeaderText,
8784
required this.senderBotIcon,
8885
required this.senderName,
@@ -104,9 +101,8 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
104101
}
105102

106103
final Color dateSeparator;
107-
final Color dateSeparatorText;
104+
final Color labelTime;
108105
final Color dmRecipientHeaderBg;
109-
final Color messageTimestamp;
110106
final Color recipientHeaderText;
111107
final Color senderBotIcon;
112108
final Color senderName;
@@ -119,9 +115,8 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
119115
@override
120116
MessageListTheme copyWith({
121117
Color? dateSeparator,
122-
Color? dateSeparatorText,
118+
Color? labelTime,
123119
Color? dmRecipientHeaderBg,
124-
Color? messageTimestamp,
125120
Color? recipientHeaderText,
126121
Color? senderBotIcon,
127122
Color? senderName,
@@ -133,9 +128,8 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
133128
}) {
134129
return MessageListTheme._(
135130
dateSeparator: dateSeparator ?? this.dateSeparator,
136-
dateSeparatorText: dateSeparatorText ?? this.dateSeparatorText,
131+
labelTime: labelTime ?? this.labelTime,
137132
dmRecipientHeaderBg: dmRecipientHeaderBg ?? this.dmRecipientHeaderBg,
138-
messageTimestamp: messageTimestamp ?? this.messageTimestamp,
139133
recipientHeaderText: recipientHeaderText ?? this.recipientHeaderText,
140134
senderBotIcon: senderBotIcon ?? this.senderBotIcon,
141135
senderName: senderName ?? this.senderName,
@@ -154,9 +148,8 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
154148
}
155149
return MessageListTheme._(
156150
dateSeparator: Color.lerp(dateSeparator, other.dateSeparator, t)!,
157-
dateSeparatorText: Color.lerp(dateSeparatorText, other.dateSeparatorText, t)!,
151+
labelTime: Color.lerp(labelTime, other.labelTime, t)!,
158152
dmRecipientHeaderBg: Color.lerp(streamMessageBgDefault, other.dmRecipientHeaderBg, t)!,
159-
messageTimestamp: Color.lerp(messageTimestamp, other.messageTimestamp, t)!,
160153
recipientHeaderText: Color.lerp(recipientHeaderText, other.recipientHeaderText, t)!,
161154
senderBotIcon: Color.lerp(senderBotIcon, other.senderBotIcon, t)!,
162155
senderName: Color.lerp(senderName, other.senderName, t)!,
@@ -1220,7 +1213,7 @@ class DateText extends StatelessWidget {
12201213
final zulipLocalizations = ZulipLocalizations.of(context);
12211214
return Text(
12221215
style: TextStyle(
1223-
color: messageListTheme.dateSeparatorText,
1216+
color: messageListTheme.labelTime,
12241217
fontSize: fontSize,
12251218
height: height,
12261219
// This is equivalent to css `all-small-caps`, see:
@@ -1327,7 +1320,7 @@ class MessageWithPossibleSender extends StatelessWidget {
13271320
const SizedBox(width: 4),
13281321
Text(time,
13291322
style: TextStyle(
1330-
color: messageListTheme.messageTimestamp,
1323+
color: messageListTheme.labelTime,
13311324
fontSize: 16,
13321325
height: (18 / 16),
13331326
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],

0 commit comments

Comments
 (0)