Skip to content

Commit 195c1de

Browse files
committed
inbox [nfc]: Move AtMentionMarker to unread_count_badge
AtMentionMarker is going to be used in subscription_list as well as inbox, so it would be better to reuse it by having it declared as a public class.
1 parent 6e9afd5 commit 195c1de

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

lib/widgets/inbox.dart

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ abstract class _HeaderItem extends StatelessWidget {
282282
overflow: TextOverflow.ellipsis,
283283
title))),
284284
const SizedBox(width: 12),
285-
if (hasMention) const _AtMentionMarker(),
285+
if (hasMention) const AtMentionMarker(),
286286
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
287287
child: UnreadCountBadge(
288288
backgroundColor: unreadCountBadgeBackgroundColor(context),
@@ -405,7 +405,7 @@ class _DmItem extends StatelessWidget {
405405
overflow: TextOverflow.ellipsis,
406406
title))),
407407
const SizedBox(width: 12),
408-
if (hasMention) const _AtMentionMarker(),
408+
if (hasMention) const AtMentionMarker(),
409409
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
410410
child: UnreadCountBadge(backgroundColor: null,
411411
count: count)),
@@ -530,25 +530,11 @@ class _TopicItem extends StatelessWidget {
530530
overflow: TextOverflow.ellipsis,
531531
topic))),
532532
const SizedBox(width: 12),
533-
if (hasMention) const _AtMentionMarker(),
533+
if (hasMention) const AtMentionMarker(),
534534
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
535535
child: UnreadCountBadge(
536536
backgroundColor: colorSwatchFor(context, subscription),
537537
count: count)),
538538
]))));
539539
}
540540
}
541-
542-
class _AtMentionMarker extends StatelessWidget {
543-
const _AtMentionMarker();
544-
545-
@override
546-
Widget build(BuildContext context) {
547-
final designVariables = DesignVariables.of(context);
548-
// Design for at-mention marker based on Figma screen:
549-
// https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?type=design&node-id=224-16386&mode=design&t=JsNndFQ8fKFH0SjS-0
550-
return Padding(
551-
padding: const EdgeInsetsDirectional.only(end: 4),
552-
child: Icon(ZulipIcons.at_sign, size: 14, color: designVariables.atMentionMarker));
553-
}
554-
}

lib/widgets/unread_count_badge.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/widgets.dart';
22

33
import 'channel_colors.dart';
4+
import 'icons.dart';
45
import 'text.dart';
56
import 'theme.dart';
67

@@ -72,3 +73,17 @@ class MutedUnreadBadge extends StatelessWidget {
7273
shape: BoxShape.circle));
7374
}
7475
}
76+
77+
class AtMentionMarker extends StatelessWidget {
78+
const AtMentionMarker({super.key});
79+
80+
@override
81+
Widget build(BuildContext context) {
82+
final designVariables = DesignVariables.of(context);
83+
// Design for at-mention marker based on Figma screen:
84+
// https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?type=design&node-id=224-16386&mode=design&t=JsNndFQ8fKFH0SjS-0
85+
return Padding(
86+
padding: const EdgeInsetsDirectional.only(end: 4),
87+
child: Icon(ZulipIcons.at_sign, size: 14, color: designVariables.atMentionMarker));
88+
}
89+
}

0 commit comments

Comments
 (0)