@@ -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
1120class 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}
0 commit comments