Skip to content

Commit 28dcd85

Browse files
author
chimnayajith
committed
inbox: Add label for archived channels in headers
Fixes #800
1 parent 7fe4ce8 commit 28dcd85

11 files changed

+74
-11
lines changed

assets/l10n/app_en.arb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@
364364
"@unknownChannelName": {
365365
"description": "Replacement name for channel when it cannot be found in the store."
366366
},
367+
"channelArchivedLabel": "(archived)",
368+
"@channelArchivedLabel": {
369+
"description": "Label shown next to an archived channel's name in headers."
370+
},
367371
"composeBoxTopicHintText": "Topic",
368372
"@composeBoxTopicHintText": {
369373
"description": "Hint text for topic input widget in compose box."

lib/generated/l10n/zulip_localizations.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,12 @@ abstract class ZulipLocalizations {
585585
/// **'(unknown channel)'**
586586
String get unknownChannelName;
587587

588+
/// Label shown next to an archived channel's name in headers.
589+
///
590+
/// In en, this message translates to:
591+
/// **'(archived)'**
592+
String get channelArchivedLabel;
593+
588594
/// Hint text for topic input widget in compose box.
589595
///
590596
/// In en, this message translates to:

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Topic';
291294

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Topic';
291294

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Topic';
291294

lib/generated/l10n/zulip_localizations_nb.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Topic';
291294

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(nieznany kanał)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Wątek';
291294

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Тема';
291294

lib/generated/l10n/zulip_localizations_sk.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Topic';
291294

lib/widgets/inbox.dart

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ abstract class _HeaderItem extends StatelessWidget {
222222
final _InboxPageState pageState;
223223
final int count;
224224
final bool hasMention;
225-
225+
final bool isArchived;
226226
/// A build context within the [_StreamSection] or [_AllDmsSection].
227227
///
228228
/// Used to ensure the [_StreamSection] or [_AllDmsSection] that encloses the
@@ -236,6 +236,7 @@ abstract class _HeaderItem extends StatelessWidget {
236236
required this.count,
237237
required this.hasMention,
238238
required this.sectionContext,
239+
this.isArchived = false,
239240
});
240241

241242
String title(ZulipLocalizations zulipLocalizations);
@@ -284,16 +285,32 @@ abstract class _HeaderItem extends StatelessWidget {
284285
const SizedBox(width: 5),
285286
Expanded(child: Padding(
286287
padding: const EdgeInsets.symmetric(vertical: 4),
287-
child: Text(
288-
style: TextStyle(
289-
fontSize: 17,
290-
height: (20 / 17),
291-
// TODO(design) check if this is the right variable
292-
color: designVariables.labelMenuButton,
293-
).merge(weightVariableTextStyle(context, wght: 600)),
294-
maxLines: 1,
295-
overflow: TextOverflow.ellipsis,
296-
title(zulipLocalizations)))),
288+
child: Row(
289+
children: [
290+
Flexible(
291+
child: Text(
292+
style: TextStyle(
293+
fontSize: 17,
294+
height: (20 / 17),
295+
// TODO(design) check if this is the right variable
296+
color: designVariables.labelMenuButton,
297+
).merge(weightVariableTextStyle(context, wght: 600)),
298+
maxLines: 1,
299+
overflow: TextOverflow.ellipsis,
300+
title(zulipLocalizations))),
301+
if (isArchived)
302+
Text(
303+
' ${zulipLocalizations.channelArchivedLabel}',
304+
style: TextStyle(
305+
fontSize: 17,
306+
height: (20 / 17),
307+
color: MessageListTheme.of(context).streamRecipientHeaderChevronRight,
308+
fontStyle: FontStyle.italic,
309+
),
310+
),
311+
],
312+
),
313+
)),
297314
const SizedBox(width: 12),
298315
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
299316
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
@@ -441,6 +458,7 @@ class _StreamHeaderItem extends _HeaderItem {
441458
required super.count,
442459
required super.hasMention,
443460
required super.sectionContext,
461+
required super.isArchived,
444462
});
445463

446464
@override String title(ZulipLocalizations zulipLocalizations) =>
@@ -487,6 +505,7 @@ class _StreamSection extends StatelessWidget {
487505
collapsed: collapsed,
488506
pageState: pageState,
489507
sectionContext: context,
508+
isArchived: subscription.isArchived,
490509
);
491510
return StickyHeaderItem(
492511
header: header,

0 commit comments

Comments
 (0)