Skip to content

Commit ca9310d

Browse files
committed
wip to be squashed; tests; Add topics button
You will see that "TOPICS" is not aligned to the middle part of the app bar, that's because we haven't got to zulip#1039 yet.
1 parent afa2b44 commit ca9310d

11 files changed

+69
-8
lines changed

assets/l10n/app_en.arb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,10 @@
706706
"@mainMenuMyProfile": {
707707
"description": "Label for main-menu button leading to the user's own profile."
708708
},
709+
"topicsButtonLabel": "TOPICS",
710+
"@topicsButtonLabel": {
711+
"description": "Label for message list button leading to topic-list page. (Use ALL CAPS for cased alphabets: Latin, Greek, Cyrillic, etc.)"
712+
},
709713
"channelFeedButtonTooltip": "Channel feed",
710714
"@channelFeedButtonTooltip": {
711715
"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
@@ -1058,6 +1058,12 @@ abstract class ZulipLocalizations {
10581058
/// **'My profile'**
10591059
String get mainMenuMyProfile;
10601060

1061+
/// Label for message list button leading to topic-list page. (Use ALL CAPS for cased alphabets: Latin, Greek, Cyrillic, etc.)
1062+
///
1063+
/// In en, this message translates to:
1064+
/// **'TOPICS'**
1065+
String get topicsButtonLabel;
1066+
10611067
/// Tooltip for button to navigate to a given channel's feed
10621068
///
10631069
/// 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
@@ -579,6 +579,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
579579
@override
580580
String get mainMenuMyProfile => 'My profile';
581581

582+
@override
583+
String get topicsButtonLabel => 'TOPICS';
584+
582585
@override
583586
String get channelFeedButtonTooltip => 'Channel feed';
584587

lib/generated/l10n/zulip_localizations_en.dart

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

582+
@override
583+
String get topicsButtonLabel => 'TOPICS';
584+
582585
@override
583586
String get channelFeedButtonTooltip => 'Channel feed';
584587

lib/generated/l10n/zulip_localizations_ja.dart

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

582+
@override
583+
String get topicsButtonLabel => 'TOPICS';
584+
582585
@override
583586
String get channelFeedButtonTooltip => 'Channel feed';
584587

lib/generated/l10n/zulip_localizations_nb.dart

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

582+
@override
583+
String get topicsButtonLabel => 'TOPICS';
584+
582585
@override
583586
String get channelFeedButtonTooltip => 'Channel feed';
584587

lib/generated/l10n/zulip_localizations_pl.dart

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

591+
@override
592+
String get topicsButtonLabel => 'TOPICS';
593+
591594
@override
592595
String get channelFeedButtonTooltip => 'Strumień kanału';
593596

lib/generated/l10n/zulip_localizations_ru.dart

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

595+
@override
596+
String get topicsButtonLabel => 'TOPICS';
597+
595598
@override
596599
String get channelFeedButtonTooltip => 'Лента канала';
597600

lib/generated/l10n/zulip_localizations_sk.dart

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

584+
@override
585+
String get topicsButtonLabel => 'TOPICS';
586+
584587
@override
585588
String get channelFeedButtonTooltip => 'Channel feed';
586589

lib/generated/l10n/zulip_localizations_uk.dart

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

594+
@override
595+
String get topicsButtonLabel => 'TOPICS';
596+
594597
@override
595598
String get channelFeedButtonTooltip => 'Стрічка каналу';
596599

lib/widgets/message_list.dart

Lines changed: 35 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,40 @@ 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+
final designVariables = DesignVariables.of(context);
233+
final zulipLocalizations = ZulipLocalizations.of(context);
234+
actions.add(GestureDetector(
235+
onTap: () {
236+
Navigator.of(context).push(TopicListPage.buildRoute(
237+
accountId: store.accountId, streamId: streamId));
238+
},
239+
behavior: HitTestBehavior.opaque,
240+
child: Padding(
241+
padding: EdgeInsetsDirectional.fromSTEB(4, 8, 12, 8),
242+
child: Center(child: Text(zulipLocalizations.topicsButtonLabel,
243+
style: TextStyle(
244+
color: designVariables.icon,
245+
fontSize: 18,
246+
height: 19 / 18,
247+
// This is equivalent to css `all-small-caps`, see:
248+
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps#all-small-caps
249+
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
250+
).merge(weightVariableTextStyle(context, wght: 600)))))));
251+
case TopicNarrow(:final streamId):
252+
actions.add(IconButton(
253+
icon: const Icon(ZulipIcons.message_feed),
254+
tooltip: zulipLocalizations.channelFeedButtonTooltip,
255+
onPressed: () => Navigator.push(context,
256+
MessageListPage.buildRoute(context: context,
257+
narrow: ChannelNarrow(streamId)))));
231258
}
232259

233260
// Insert a PageRoot here, to provide a context that can be used for

0 commit comments

Comments
 (0)