Skip to content

Commit

Permalink
inbox [nfc]: Move AtMentionMarker to unread_count_badge
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Khader-1 committed Aug 10, 2024
1 parent 32e37ca commit 7b6d47e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
20 changes: 3 additions & 17 deletions lib/widgets/inbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ abstract class _HeaderItem extends StatelessWidget {
overflow: TextOverflow.ellipsis,
title))),
const SizedBox(width: 12),
if (hasMention) const _AtMentionMarker(),
if (hasMention) const AtMentionMarker(),
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
child: UnreadCountBadge(
backgroundColor: unreadCountBadgeBackgroundColor(context),
Expand Down Expand Up @@ -404,7 +404,7 @@ class _DmItem extends StatelessWidget {
overflow: TextOverflow.ellipsis,
title))),
const SizedBox(width: 12),
if (hasMention) const _AtMentionMarker(),
if (hasMention) const AtMentionMarker(),
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
child: UnreadCountBadge(backgroundColor: null,
count: count)),
Expand Down Expand Up @@ -529,25 +529,11 @@ class _TopicItem extends StatelessWidget {
overflow: TextOverflow.ellipsis,
topic))),
const SizedBox(width: 12),
if (hasMention) const _AtMentionMarker(),
if (hasMention) const AtMentionMarker(),
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
child: UnreadCountBadge(
backgroundColor: colorSwatchFor(context, subscription),
count: count)),
]))));
}
}

class _AtMentionMarker extends StatelessWidget {
const _AtMentionMarker();

@override
Widget build(BuildContext context) {
final designVariables = DesignVariables.of(context);
// Design for at-mention marker based on Figma screen:
// https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?type=design&node-id=224-16386&mode=design&t=JsNndFQ8fKFH0SjS-0
return Padding(
padding: const EdgeInsetsDirectional.only(end: 4),
child: Icon(ZulipIcons.at_sign, size: 14, color: designVariables.atMentionMarker));
}
}
15 changes: 15 additions & 0 deletions lib/widgets/unread_count_badge.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/widgets.dart';

import 'channel_colors.dart';
import 'icons.dart';
import 'text.dart';
import 'theme.dart';

Expand Down Expand Up @@ -72,3 +73,17 @@ class MutedUnreadBadge extends StatelessWidget {
shape: BoxShape.circle));
}
}

class AtMentionMarker extends StatelessWidget {
const AtMentionMarker({super.key});

@override
Widget build(BuildContext context) {
final designVariables = DesignVariables.of(context);
// Design for at-mention marker based on Figma screen:
// https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?type=design&node-id=224-16386&mode=design&t=JsNndFQ8fKFH0SjS-0
return Padding(
padding: const EdgeInsetsDirectional.only(end: 4),
child: Icon(ZulipIcons.at_sign, size: 14, color: designVariables.atMentionMarker));
}
}

0 comments on commit 7b6d47e

Please sign in to comment.