Skip to content

Commit 4c3440b

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 4c3440b

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

lib/widgets/inbox.dart

Lines changed: 11 additions & 7 deletions
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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ 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(),
138+
inboxItemIconMarker: const HSLColor.fromAHSL(0.5, 0, 0, 0.2).toColor(),
139139
colorMessageHeaderIconInteractive: Colors.black.withValues(alpha: 0.2),
140140
contextMenuCancelBg: const Color(0xff797986).withValues(alpha: 0.15),
141141
contextMenuCancelPressedBg: const Color(0xff797986).withValues(alpha: 0.20),
@@ -180,7 +180,7 @@ 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(),
183+
inboxItemIconMarker: const HSLColor.fromAHSL(0.4, 0, 0, 1).toColor(),
184184
colorMessageHeaderIconInteractive: Colors.white.withValues(alpha: 0.2),
185185
dmHeaderBg: const HSLColor.fromAHSL(1, 46, 0.15, 0.2).toColor(),
186186
// TODO(design-dark) need proper dark-theme color (this is ad hoc)
@@ -226,7 +226,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
226226
required this.textInput,
227227
required this.title,
228228
required this.channelColorSwatches,
229-
required this.atMentionMarker,
229+
required this.inboxItemIconMarker,
230230
required this.colorMessageHeaderIconInteractive,
231231
required this.contextMenuCancelBg,
232232
required this.contextMenuCancelPressedBg,
@@ -280,7 +280,7 @@ 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;
283+
final Color inboxItemIconMarker;
284284
final Color colorMessageHeaderIconInteractive;
285285
final Color contextMenuCancelBg; // In Figma, but unnamed.
286286
final Color contextMenuCancelPressedBg; // In Figma, but unnamed.
@@ -361,7 +361,7 @@ 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,
364+
inboxItemIconMarker: atMentionMarker ?? this.inboxItemIconMarker,
365365
colorMessageHeaderIconInteractive: colorMessageHeaderIconInteractive ?? this.colorMessageHeaderIconInteractive,
366366
contextMenuCancelBg: contextMenuCancelBg ?? this.contextMenuCancelBg,
367367
contextMenuCancelPressedBg: contextMenuCancelPressedBg ?? this.contextMenuCancelPressedBg,
@@ -408,7 +408,7 @@ 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)!,
411+
inboxItemIconMarker: Color.lerp(inboxItemIconMarker, other.inboxItemIconMarker, t)!,
412412
colorMessageHeaderIconInteractive: Color.lerp(colorMessageHeaderIconInteractive, other.colorMessageHeaderIconInteractive, t)!,
413413
contextMenuCancelBg: Color.lerp(contextMenuCancelBg, other.contextMenuCancelBg, t)!,
414414
contextMenuCancelPressedBg: Color.lerp(contextMenuCancelPressedBg, other.contextMenuCancelPressedBg, t)!,

0 commit comments

Comments
 (0)