Skip to content

Commit ce1a4cd

Browse files
committed
topics: Add topic list page
For the topic-list page app bar, we leave out the icon "chevron_down.svg" since it's related to a new design (zulip#1039) we haven't implemented yet. This also why "TOPICS" is not aligned to the middle part of the app bar on the message-list page. We also leave out the new topic button and topic filtering, which are out-of-scope for zulip#1158. The topic-list implementation is quite similar to parts of inbox page and message-list page. Therefore, we structure the code to make it easy to maintain in the future. Especially, this helps us (a) when we're changing one, apply the same change to the other, where appropriate, and (b) later reconcile the differences they do have and then refactor to unify them. Figma design: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6819-35869&m=dev The "TOPICS" icon on message-list page in a topic narrow is a UX change from the design. See CZO discussion: https://chat.zulip.org/#narrow/channel/48-mobile/topic/Flutter.20beta.3A.20missing.20topic.20list/near/2177505
1 parent b3a52c0 commit ce1a4cd

15 files changed

+803
-8
lines changed

assets/l10n/app_en.arb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,10 @@
769769
"@mainMenuMyProfile": {
770770
"description": "Label for main-menu button leading to the user's own profile."
771771
},
772+
"topicsButtonLabel": "TOPICS",
773+
"@topicsButtonLabel": {
774+
"description": "Label for message list button leading to topic-list page. (Use ALL CAPS for cased alphabets: Latin, Greek, Cyrillic, etc.)"
775+
},
772776
"channelFeedButtonTooltip": "Channel feed",
773777
"@channelFeedButtonTooltip": {
774778
"description": "Tooltip for button to navigate to a given channel's feed"

lib/generated/l10n/zulip_localizations.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,12 @@ abstract class ZulipLocalizations {
11511151
/// **'My profile'**
11521152
String get mainMenuMyProfile;
11531153

1154+
/// Label for message list button leading to topic-list page. (Use ALL CAPS for cased alphabets: Latin, Greek, Cyrillic, etc.)
1155+
///
1156+
/// In en, this message translates to:
1157+
/// **'TOPICS'**
1158+
String get topicsButtonLabel;
1159+
11541160
/// Tooltip for button to navigate to a given channel's feed
11551161
///
11561162
/// 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
@@ -629,6 +629,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
629629
@override
630630
String get mainMenuMyProfile => 'My profile';
631631

632+
@override
633+
String get topicsButtonLabel => 'TOPICS';
634+
632635
@override
633636
String get channelFeedButtonTooltip => 'Channel feed';
634637

lib/generated/l10n/zulip_localizations_de.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,9 @@ class ZulipLocalizationsDe extends ZulipLocalizations {
629629
@override
630630
String get mainMenuMyProfile => 'My profile';
631631

632+
@override
633+
String get topicsButtonLabel => 'TOPICS';
634+
632635
@override
633636
String get channelFeedButtonTooltip => 'Channel feed';
634637

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
629629
@override
630630
String get mainMenuMyProfile => 'My profile';
631631

632+
@override
633+
String get topicsButtonLabel => 'TOPICS';
634+
632635
@override
633636
String get channelFeedButtonTooltip => 'Channel feed';
634637

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
629629
@override
630630
String get mainMenuMyProfile => 'My profile';
631631

632+
@override
633+
String get topicsButtonLabel => 'TOPICS';
634+
632635
@override
633636
String get channelFeedButtonTooltip => 'Channel feed';
634637

lib/generated/l10n/zulip_localizations_nb.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
629629
@override
630630
String get mainMenuMyProfile => 'My profile';
631631

632+
@override
633+
String get topicsButtonLabel => 'TOPICS';
634+
632635
@override
633636
String get channelFeedButtonTooltip => 'Channel feed';
634637

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
638638
@override
639639
String get mainMenuMyProfile => 'Mój profil';
640640

641+
@override
642+
String get topicsButtonLabel => 'TOPICS';
643+
641644
@override
642645
String get channelFeedButtonTooltip => 'Strumień kanału';
643646

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
642642
@override
643643
String get mainMenuMyProfile => 'Мой профиль';
644644

645+
@override
646+
String get topicsButtonLabel => 'TOPICS';
647+
645648
@override
646649
String get channelFeedButtonTooltip => 'Лента канала';
647650

lib/generated/l10n/zulip_localizations_sk.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
631631
@override
632632
String get mainMenuMyProfile => 'Môj profil';
633633

634+
@override
635+
String get topicsButtonLabel => 'TOPICS';
636+
634637
@override
635638
String get channelFeedButtonTooltip => 'Channel feed';
636639

lib/generated/l10n/zulip_localizations_uk.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,9 @@ class ZulipLocalizationsUk extends ZulipLocalizations {
641641
@override
642642
String get mainMenuMyProfile => 'Мій профіль';
643643

644+
@override
645+
String get topicsButtonLabel => 'TOPICS';
646+
644647
@override
645648
String get channelFeedButtonTooltip => 'Стрічка каналу';
646649

lib/widgets/message_list.dart

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import 'sticky_header.dart';
2424
import 'store.dart';
2525
import 'text.dart';
2626
import 'theme.dart';
27+
import 'topic_list.dart';
2728

2829
/// Message-list styles that differ between light and dark themes.
2930
class MessageListTheme extends ThemeExtension<MessageListTheme> {
@@ -220,14 +221,23 @@ class _MessageListPageState extends State<MessageListPage> implements MessageLis
220221
removeAppBarBottomBorder = true;
221222
}
222223

223-
List<Widget>? actions;
224-
if (narrow case TopicNarrow(:final streamId)) {
225-
(actions ??= []).add(IconButton(
226-
icon: const Icon(ZulipIcons.message_feed),
227-
tooltip: zulipLocalizations.channelFeedButtonTooltip,
228-
onPressed: () => Navigator.push(context,
229-
MessageListPage.buildRoute(context: context,
230-
narrow: ChannelNarrow(streamId)))));
224+
List<Widget> actions = [];
225+
switch (narrow) {
226+
case CombinedFeedNarrow():
227+
case MentionsNarrow():
228+
case StarredMessagesNarrow():
229+
case DmNarrow():
230+
break;
231+
case ChannelNarrow(:final streamId):
232+
actions.add(_TopicListButton(streamId: streamId));
233+
case TopicNarrow(:final streamId):
234+
actions.add(IconButton(
235+
icon: const Icon(ZulipIcons.message_feed),
236+
tooltip: zulipLocalizations.channelFeedButtonTooltip,
237+
onPressed: () => Navigator.push(context,
238+
MessageListPage.buildRoute(context: context,
239+
narrow: ChannelNarrow(streamId)))));
240+
actions.add(_TopicListButton(streamId: streamId));
231241
}
232242

233243
// Insert a PageRoot here, to provide a context that can be used for
@@ -277,6 +287,35 @@ class _MessageListPageState extends State<MessageListPage> implements MessageLis
277287
}
278288
}
279289

290+
class _TopicListButton extends StatelessWidget {
291+
const _TopicListButton({required this.streamId});
292+
293+
final int streamId;
294+
295+
@override
296+
Widget build(BuildContext context) {
297+
final zulipLocalizations = ZulipLocalizations.of(context);
298+
final designVariables = DesignVariables.of(context);
299+
return GestureDetector(
300+
onTap: () {
301+
Navigator.of(context).push(TopicListPage.buildRoute(
302+
context: context, streamId: streamId));
303+
},
304+
behavior: HitTestBehavior.opaque,
305+
child: Padding(
306+
padding: EdgeInsetsDirectional.fromSTEB(12, 8, 12, 8),
307+
child: Center(child: Text(zulipLocalizations.topicsButtonLabel,
308+
style: TextStyle(
309+
color: designVariables.icon,
310+
fontSize: 18,
311+
height: 19 / 18,
312+
// This is equivalent to css `all-small-caps`, see:
313+
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps#all-small-caps
314+
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
315+
).merge(weightVariableTextStyle(context, wght: 600))))));
316+
}
317+
}
318+
280319
class MessageListAppBarTitle extends StatelessWidget {
281320
const MessageListAppBarTitle({
282321
super.key,

0 commit comments

Comments
 (0)