Skip to content

Commit 211108c

Browse files
committed
wip.
Signed-off-by: Zixuan James Li <[email protected]>
1 parent cfce389 commit 211108c

File tree

3 files changed

+55
-19
lines changed

3 files changed

+55
-19
lines changed

assets/l10n/app_en.arb

+8
Original file line numberDiff line numberDiff line change
@@ -529,5 +529,13 @@
529529
"manyPeopleTyping": "Several people are typing…",
530530
"@manyPeopleTyping": {
531531
"description": "Text to display when there are multiple users typing."
532+
},
533+
"messageIsEditedLabel": "EDITED",
534+
"@messageIsEditedLabel": {
535+
"description": "Label for an edited message."
536+
},
537+
"messageIsMovedLabel": "MOVED",
538+
"@messageIsMovedLabel": {
539+
"description": "Label for a moved message."
532540
}
533541
}

lib/widgets/edit_state_marker.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ class _EditStateMarkerPill extends StatelessWidget {
6969
child: Transform.translate(
7070
offset: offset,
7171
child: Icon(
72-
icon, size: 16, color: messageListTheme.editedMovedMarkerCollapsed)));
72+
icon, size: 16, color: messageListTheme.editedMovedMarker)));
7373
}
7474
}

lib/widgets/message_list.dart

+46-18
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
3333
dateSeparator: Colors.black,
3434
dateSeparatorText: const HSLColor.fromAHSL(0.75, 0, 0, 0.15).toColor(),
3535
dmRecipientHeaderBg: const HSLColor.fromAHSL(1, 46, 0.35, 0.93).toColor(),
36-
editedMovedMarkerCollapsed: const Color.fromARGB(128, 146, 167, 182),
36+
editedMovedMarker: Colors.black.withOpacity(0.35),
3737
messageTimestamp: const HSLColor.fromAHSL(0.8, 0, 0, 0.2).toColor(),
3838
recipientHeaderText: const HSLColor.fromAHSL(1, 0, 0, 0.15).toColor(),
3939
senderBotIcon: const HSLColor.fromAHSL(1, 180, 0.08, 0.65).toColor(),
@@ -60,8 +60,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
6060
dateSeparator: Colors.white,
6161
dateSeparatorText: const HSLColor.fromAHSL(0.75, 0, 0, 1).toColor(),
6262
dmRecipientHeaderBg: const HSLColor.fromAHSL(1, 46, 0.15, 0.2).toColor(),
63-
// TODO(design-dark) need proper dark-theme color (this is ad hoc)
64-
editedMovedMarkerCollapsed: const Color.fromARGB(128, 214, 202, 194),
63+
editedMovedMarker: Colors.white.withOpacity(0.35),
6564
messageTimestamp: const HSLColor.fromAHSL(0.6, 0, 0, 1).toColor(),
6665
recipientHeaderText: const HSLColor.fromAHSL(0.8, 0, 0, 1).toColor(),
6766
senderBotIcon: const HSLColor.fromAHSL(1, 180, 0.05, 0.5).toColor(),
@@ -86,7 +85,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
8685
required this.dateSeparator,
8786
required this.dateSeparatorText,
8887
required this.dmRecipientHeaderBg,
89-
required this.editedMovedMarkerCollapsed,
88+
required this.editedMovedMarker,
9089
required this.messageTimestamp,
9190
required this.recipientHeaderText,
9291
required this.senderBotIcon,
@@ -111,7 +110,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
111110
final Color dateSeparator;
112111
final Color dateSeparatorText;
113112
final Color dmRecipientHeaderBg;
114-
final Color editedMovedMarkerCollapsed;
113+
final Color editedMovedMarker;
115114
final Color messageTimestamp;
116115
final Color recipientHeaderText;
117116
final Color senderBotIcon;
@@ -127,7 +126,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
127126
Color? dateSeparator,
128127
Color? dateSeparatorText,
129128
Color? dmRecipientHeaderBg,
130-
Color? editedMovedMarkerCollapsed,
129+
Color? editedMovedMarker,
131130
Color? messageTimestamp,
132131
Color? recipientHeaderText,
133132
Color? senderBotIcon,
@@ -142,7 +141,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
142141
dateSeparator: dateSeparator ?? this.dateSeparator,
143142
dateSeparatorText: dateSeparatorText ?? this.dateSeparatorText,
144143
dmRecipientHeaderBg: dmRecipientHeaderBg ?? this.dmRecipientHeaderBg,
145-
editedMovedMarkerCollapsed: editedMovedMarkerCollapsed ?? this.editedMovedMarkerCollapsed,
144+
editedMovedMarker: editedMovedMarker ?? this.editedMovedMarker,
146145
messageTimestamp: messageTimestamp ?? this.messageTimestamp,
147146
recipientHeaderText: recipientHeaderText ?? this.recipientHeaderText,
148147
senderBotIcon: senderBotIcon ?? this.senderBotIcon,
@@ -164,7 +163,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
164163
dateSeparator: Color.lerp(dateSeparator, other.dateSeparator, t)!,
165164
dateSeparatorText: Color.lerp(dateSeparatorText, other.dateSeparatorText, t)!,
166165
dmRecipientHeaderBg: Color.lerp(streamMessageBgDefault, other.dmRecipientHeaderBg, t)!,
167-
editedMovedMarkerCollapsed: Color.lerp(editedMovedMarkerCollapsed, other.editedMovedMarkerCollapsed, t)!,
166+
editedMovedMarker: Color.lerp(editedMovedMarker, other.editedMovedMarker, t)!,
168167
messageTimestamp: Color.lerp(messageTimestamp, other.messageTimestamp, t)!,
169168
recipientHeaderText: Color.lerp(recipientHeaderText, other.recipientHeaderText, t)!,
170169
senderBotIcon: Color.lerp(senderBotIcon, other.senderBotIcon, t)!,
@@ -1253,6 +1252,29 @@ class MessageWithPossibleSender extends StatelessWidget {
12531252
]);
12541253
}
12551254

1255+
Widget? editStateRow;
1256+
if (message.editState != MessageEditState.none) {
1257+
final localizations = ZulipLocalizations.of(context);
1258+
final String editStateText;
1259+
switch (message.editState) {
1260+
case MessageEditState.edited:
1261+
editStateText = localizations.messageIsEditedLabel;
1262+
case MessageEditState.moved:
1263+
editStateText = localizations.messageIsMovedLabel;
1264+
case MessageEditState.none:
1265+
editStateText = '';
1266+
assert(false);
1267+
}
1268+
editStateRow = Text(editStateText,
1269+
textAlign: TextAlign.end,
1270+
style: TextStyle(
1271+
color: messageListTheme.editedMovedMarker,
1272+
fontFamily: 'Source Sans 3',
1273+
fontSize: 12,
1274+
height: (12 / 12),
1275+
));
1276+
}
1277+
12561278
return GestureDetector(
12571279
behavior: HitTestBehavior.translucent,
12581280
onLongPress: () => showMessageActionSheet(context: context, message: message),
@@ -1262,21 +1284,27 @@ class MessageWithPossibleSender extends StatelessWidget {
12621284
if (senderRow != null)
12631285
Padding(padding: const EdgeInsets.fromLTRB(16, 2, 16, 0),
12641286
child: senderRow),
1265-
EditStateMarker(
1266-
editState: message.editState,
1287+
Row(
1288+
crossAxisAlignment: CrossAxisAlignment.baseline,
1289+
textBaseline: localizedTextBaseline(context),
12671290
children: [
1268-
Expanded(child: Column(
1269-
crossAxisAlignment: CrossAxisAlignment.stretch,
1270-
children: [
1271-
MessageContent(message: message, content: item.content),
1272-
if ((message.reactions?.total ?? 0) > 0)
1273-
ReactionChipsList(messageId: message.id, reactions: message.reactions!)
1274-
])),
1291+
const SizedBox(width: 16),
1292+
Expanded(
1293+
child: Column(
1294+
crossAxisAlignment: CrossAxisAlignment.stretch,
1295+
children: [
1296+
MessageContent(message: message, content: item.content),
1297+
if ((message.reactions?.total ?? 0) > 0)
1298+
ReactionChipsList(messageId: message.id, reactions: message.reactions!),
1299+
if (editStateRow != null)
1300+
editStateRow,
1301+
]),
1302+
),
12751303
SizedBox(width: 16,
12761304
child: message.flags.contains(MessageFlag.starred)
12771305
? Icon(ZulipIcons.star_filled, size: 16, color: designVariables.star)
12781306
: null),
1279-
]),
1307+
]),
12801308
])));
12811309
}
12821310
}

0 commit comments

Comments
 (0)