Skip to content

Commit f8f4c9f

Browse files
committed
inbox [nfc]: Generalize _AtMentionMarker to take different icons
This is helpful for adding marker of topic visibility. Signed-off-by: Zixuan James Li <[email protected]>
1 parent 319a3d5 commit f8f4c9f

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

lib/widgets/inbox.dart

+11-7
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ abstract class _HeaderItem extends StatelessWidget {
291291
overflow: TextOverflow.ellipsis,
292292
title))),
293293
const SizedBox(width: 12),
294-
if (hasMention) const _AtMentionMarker(),
294+
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
295295
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
296296
child: UnreadCountBadge(
297297
backgroundColor: unreadCountBadgeBackgroundColor(context),
@@ -414,7 +414,7 @@ class _DmItem extends StatelessWidget {
414414
overflow: TextOverflow.ellipsis,
415415
title))),
416416
const SizedBox(width: 12),
417-
if (hasMention) const _AtMentionMarker(),
417+
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
418418
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
419419
child: UnreadCountBadge(backgroundColor: null,
420420
count: count)),
@@ -539,7 +539,7 @@ class _TopicItem extends StatelessWidget {
539539
overflow: TextOverflow.ellipsis,
540540
topic))),
541541
const SizedBox(width: 12),
542-
if (hasMention) const _AtMentionMarker(),
542+
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
543543
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
544544
child: UnreadCountBadge(
545545
backgroundColor: colorSwatchFor(context, subscription),
@@ -548,16 +548,20 @@ class _TopicItem extends StatelessWidget {
548548
}
549549
}
550550

551-
class _AtMentionMarker extends StatelessWidget {
552-
const _AtMentionMarker();
551+
class _IconMarker extends StatelessWidget {
552+
const _IconMarker({required this.icon});
553+
554+
final IconData icon;
553555

554556
@override
555557
Widget build(BuildContext context) {
556558
final designVariables = DesignVariables.of(context);
557-
// Design for at-mention marker based on Figma screen:
559+
// Design for icon markers based on Figma screen:
558560
// https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?type=design&node-id=224-16386&mode=design&t=JsNndFQ8fKFH0SjS-0
559561
return Padding(
560562
padding: const EdgeInsetsDirectional.only(end: 4),
561-
child: Icon(ZulipIcons.at_sign, size: 14, color: designVariables.atMentionMarker));
563+
// This color comes from the Figma screen for the "@" marker, but not
564+
// the topic visibility markers.
565+
child: Icon(icon, size: 14, color: designVariables.inboxItemIconMarker));
562566
}
563567
}

lib/widgets/theme.dart

+7-7
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
135135
textInput: const Color(0xff000000),
136136
title: const Color(0xff1a1a1a),
137137
channelColorSwatches: ChannelColorSwatches.light,
138-
atMentionMarker: const HSLColor.fromAHSL(0.5, 0, 0, 0.2).toColor(),
139138
colorMessageHeaderIconInteractive: Colors.black.withValues(alpha: 0.2),
140139
contextMenuCancelBg: const Color(0xff797986).withValues(alpha: 0.15),
141140
contextMenuCancelPressedBg: const Color(0xff797986).withValues(alpha: 0.20),
142141
dmHeaderBg: const HSLColor.fromAHSL(1, 46, 0.35, 0.93).toColor(),
143142
groupDmConversationIcon: Colors.black.withValues(alpha: 0.5),
144143
groupDmConversationIconBg: const Color(0x33808080),
144+
inboxItemIconMarker: const HSLColor.fromAHSL(0.5, 0, 0, 0.2).toColor(),
145145
loginOrDivider: const Color(0xffdedede),
146146
loginOrDividerText: const Color(0xff575757),
147147
modalBarrierColor: const Color(0xff000000).withValues(alpha: 0.3),
@@ -180,13 +180,13 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
180180
contextMenuCancelBg: const Color(0xff797986).withValues(alpha: 0.15), // the same as the light mode in Figma
181181
contextMenuCancelPressedBg: const Color(0xff797986).withValues(alpha: 0.20), // the same as the light mode in Figma
182182
// TODO(design-dark) need proper dark-theme color (this is ad hoc)
183-
atMentionMarker: const HSLColor.fromAHSL(0.4, 0, 0, 1).toColor(),
184183
colorMessageHeaderIconInteractive: Colors.white.withValues(alpha: 0.2),
185184
dmHeaderBg: const HSLColor.fromAHSL(1, 46, 0.15, 0.2).toColor(),
186185
// TODO(design-dark) need proper dark-theme color (this is ad hoc)
187186
groupDmConversationIcon: Colors.white.withValues(alpha: 0.5),
188187
// TODO(design-dark) need proper dark-theme color (this is ad hoc)
189188
groupDmConversationIconBg: const Color(0x33cccccc),
189+
inboxItemIconMarker: const HSLColor.fromAHSL(0.4, 0, 0, 1).toColor(),
190190
loginOrDivider: const Color(0xff424242),
191191
loginOrDividerText: const Color(0xffa8a8a8),
192192
modalBarrierColor: const Color(0xff000000).withValues(alpha: 0.5),
@@ -226,13 +226,13 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
226226
required this.textInput,
227227
required this.title,
228228
required this.channelColorSwatches,
229-
required this.atMentionMarker,
230229
required this.colorMessageHeaderIconInteractive,
231230
required this.contextMenuCancelBg,
232231
required this.contextMenuCancelPressedBg,
233232
required this.dmHeaderBg,
234233
required this.groupDmConversationIcon,
235234
required this.groupDmConversationIconBg,
235+
required this.inboxItemIconMarker,
236236
required this.loginOrDivider,
237237
required this.loginOrDividerText,
238238
required this.modalBarrierColor,
@@ -280,13 +280,13 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
280280
final ChannelColorSwatches channelColorSwatches;
281281

282282
// Not named variables in Figma; taken from older Figma drafts, or elsewhere.
283-
final Color atMentionMarker;
284283
final Color colorMessageHeaderIconInteractive;
285284
final Color contextMenuCancelBg; // In Figma, but unnamed.
286285
final Color contextMenuCancelPressedBg; // In Figma, but unnamed.
287286
final Color dmHeaderBg;
288287
final Color groupDmConversationIcon;
289288
final Color groupDmConversationIconBg;
289+
final Color inboxItemIconMarker;
290290
final Color loginOrDivider; // TODO(design-dark) need proper dark-theme color (this is ad hoc)
291291
final Color loginOrDividerText; // TODO(design-dark) need proper dark-theme color (this is ad hoc)
292292
final Color modalBarrierColor;
@@ -321,13 +321,13 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
321321
Color? textInput,
322322
Color? title,
323323
ChannelColorSwatches? channelColorSwatches,
324-
Color? atMentionMarker,
325324
Color? colorMessageHeaderIconInteractive,
326325
Color? contextMenuCancelBg,
327326
Color? contextMenuCancelPressedBg,
328327
Color? dmHeaderBg,
329328
Color? groupDmConversationIcon,
330329
Color? groupDmConversationIconBg,
330+
Color? inboxItemIconMarker,
331331
Color? loginOrDivider,
332332
Color? loginOrDividerText,
333333
Color? modalBarrierColor,
@@ -361,13 +361,13 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
361361
textInput: textInput ?? this.textInput,
362362
title: title ?? this.title,
363363
channelColorSwatches: channelColorSwatches ?? this.channelColorSwatches,
364-
atMentionMarker: atMentionMarker ?? this.atMentionMarker,
365364
colorMessageHeaderIconInteractive: colorMessageHeaderIconInteractive ?? this.colorMessageHeaderIconInteractive,
366365
contextMenuCancelBg: contextMenuCancelBg ?? this.contextMenuCancelBg,
367366
contextMenuCancelPressedBg: contextMenuCancelPressedBg ?? this.contextMenuCancelPressedBg,
368367
dmHeaderBg: dmHeaderBg ?? this.dmHeaderBg,
369368
groupDmConversationIcon: groupDmConversationIcon ?? this.groupDmConversationIcon,
370369
groupDmConversationIconBg: groupDmConversationIconBg ?? this.groupDmConversationIconBg,
370+
inboxItemIconMarker: inboxItemIconMarker ?? this.inboxItemIconMarker,
371371
loginOrDivider: loginOrDivider ?? this.loginOrDivider,
372372
loginOrDividerText: loginOrDividerText ?? this.loginOrDividerText,
373373
modalBarrierColor: modalBarrierColor ?? this.modalBarrierColor,
@@ -408,13 +408,13 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
408408
textInput: Color.lerp(textInput, other.textInput, t)!,
409409
title: Color.lerp(title, other.title, t)!,
410410
channelColorSwatches: ChannelColorSwatches.lerp(channelColorSwatches, other.channelColorSwatches, t),
411-
atMentionMarker: Color.lerp(atMentionMarker, other.atMentionMarker, t)!,
412411
colorMessageHeaderIconInteractive: Color.lerp(colorMessageHeaderIconInteractive, other.colorMessageHeaderIconInteractive, t)!,
413412
contextMenuCancelBg: Color.lerp(contextMenuCancelBg, other.contextMenuCancelBg, t)!,
414413
contextMenuCancelPressedBg: Color.lerp(contextMenuCancelPressedBg, other.contextMenuCancelPressedBg, t)!,
415414
dmHeaderBg: Color.lerp(dmHeaderBg, other.dmHeaderBg, t)!,
416415
groupDmConversationIcon: Color.lerp(groupDmConversationIcon, other.groupDmConversationIcon, t)!,
417416
groupDmConversationIconBg: Color.lerp(groupDmConversationIconBg, other.groupDmConversationIconBg, t)!,
417+
inboxItemIconMarker: Color.lerp(inboxItemIconMarker, other.inboxItemIconMarker, t)!,
418418
loginOrDivider: Color.lerp(loginOrDivider, other.loginOrDivider, t)!,
419419
loginOrDividerText: Color.lerp(loginOrDividerText, other.loginOrDividerText, t)!,
420420
modalBarrierColor: Color.lerp(modalBarrierColor, other.modalBarrierColor, t)!,

0 commit comments

Comments
 (0)