Skip to content

Commit 05768ec

Browse files
chrisbobbegnprice
authored andcommitted
unread_count_badge: Remove bold variant; pin down to current Figma
The "Channels" page and "Inbox" page both have updated designs in Figma, which we should follow. This commit matches the badges on the "Channels" page to that new design. There's more work to match the badges on the "Inbox" page, but now that work is defined crisply in a TODO: // TODO support the "kind=quantity" variant, update dartdoc Related: zulip#1406 Related: zulip#1527
1 parent 50a1a08 commit 05768ec

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

lib/widgets/inbox.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ abstract class _HeaderItem extends StatelessWidget {
311311
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
312312
child: UnreadCountBadge(
313313
channelIdForBackground: channelId,
314-
bold: true,
315314
count: count)),
316315
])));
317316
}

lib/widgets/subscription_list.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,7 @@ class SubscriptionItem extends StatelessWidget {
338338
opacity: opacity,
339339
child: UnreadCountBadge(
340340
count: unreadCount,
341-
channelIdForBackground: subscription.streamId,
342-
bold: true)),
341+
channelIdForBackground: subscription.streamId)),
343342
] else if (showMutedUnreadBadge) ...[
344343
const SizedBox(width: 12),
345344
// TODO(#747) show @-mention indicator when it applies

lib/widgets/theme.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
184184
foreground: const Color(0xff000000),
185185
icon: const Color(0xff6159e1),
186186
iconSelected: const Color(0xff222222),
187-
labelCounterUnread: const Color(0xff222222),
187+
labelCounterUnread: const Color(0xff1a1a1a),
188188
labelEdited: const HSLColor.fromAHSL(0.35, 0, 0, 0).toColor(),
189189
labelMenuButton: const Color(0xff222222),
190190
labelSearchPrompt: const Color(0xff000000).withValues(alpha: 0.5),
@@ -285,7 +285,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
285285
foreground: const Color(0xffffffff),
286286
icon: const Color(0xff7977fe),
287287
iconSelected: Colors.white.withValues(alpha: 0.8),
288-
labelCounterUnread: const Color(0xffffffff).withValues(alpha: 0.7),
288+
labelCounterUnread: const Color(0xffffffff).withValues(alpha: 0.95),
289289
labelEdited: const HSLColor.fromAHSL(0.35, 0, 0, 1).toColor(),
290290
labelMenuButton: const Color(0xffffffff).withValues(alpha: 0.85),
291291
labelSearchPrompt: const Color(0xffffffff).withValues(alpha: 0.5),

lib/widgets/unread_count_badge.dart

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,32 @@ import 'theme.dart';
66

77
/// A widget to display a given number of unreads in a conversation.
88
///
9-
/// Implements the design for these in Figma:
10-
/// <https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=341%3A12387&mode=dev>
9+
/// See Figma's "counter-menu" component, which this is based on:
10+
/// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=2037-186671&m=dev
11+
/// It looks like that component was created for the main menu,
12+
/// then adapted for various other contexts, like the Inbox page.
13+
///
14+
/// Currently this widget supports only those other contexts (not the main menu)
15+
/// and only the component's "kind=unread" variant (not "kind=quantity").
16+
/// For example, the "Channels" page:
17+
/// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6205-26001&m=dev
18+
// TODO support the main-menu context, update dartdoc
19+
// TODO support the "kind=quantity" variant, update dartdoc
1120
class UnreadCountBadge extends StatelessWidget {
1221
const UnreadCountBadge({
1322
super.key,
1423
required this.count,
1524
required this.channelIdForBackground,
16-
this.bold = false,
1725
});
1826

1927
final int count;
20-
final bool bold;
2128

2229
/// An optional [Subscription.streamId], for a channel-colorized background.
2330
///
2431
/// Useful when this badge represents messages in one specific channel.
2532
///
2633
/// If null, the default neutral background will be used.
34+
// TODO remove; the Figma doesn't use this anymore.
2735
final int? channelIdForBackground;
2836

2937
@override
@@ -46,19 +54,17 @@ class UnreadCountBadge extends StatelessWidget {
4654

4755
return DecoratedBox(
4856
decoration: BoxDecoration(
49-
borderRadius: BorderRadius.circular(3),
57+
borderRadius: BorderRadius.circular(5),
5058
color: backgroundColor,
5159
),
5260
child: Padding(
53-
padding: const EdgeInsets.fromLTRB(4, 0, 4, 1),
61+
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 3),
5462
child: Text(
5563
style: TextStyle(
5664
fontSize: 16,
57-
height: (18 / 16),
58-
fontFeatures: const [FontFeature.enable('smcp')], // small caps
65+
height: (16 / 16),
5966
color: textColor,
60-
).merge(weightVariableTextStyle(context,
61-
wght: bold ? 600 : null)),
67+
).merge(weightVariableTextStyle(context, wght: 500)),
6268
count.toString())));
6369
}
6470
}

test/widgets/checks.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ extension PerAccountStoreWidgetChecks on Subject<PerAccountStoreWidget> {
9494

9595
extension UnreadCountBadgeChecks on Subject<UnreadCountBadge> {
9696
Subject<int> get count => has((b) => b.count, 'count');
97-
Subject<bool> get bold => has((b) => b.bold, 'bold');
9897
Subject<int?> get channelIdForBackground => has((b) => b.channelIdForBackground, 'channelIdForBackground');
9998
}
10099

0 commit comments

Comments
 (0)