Skip to content

Commit d79bcb7

Browse files
committed
all_channels: Remove three dot menu and add gesture controls
Make the All Channels Page consistent with the Channel Page, as navigating to channel feed and opening the bottom sheet currently uses the three-dot menu icon, which differs from the gesture pattern used in the Channel Page. Fixes part of #1914
1 parent 80f5a85 commit d79bcb7

File tree

2 files changed

+43
-26
lines changed

2 files changed

+43
-26
lines changed

lib/widgets/all_channels.dart

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import '../api/route/channels.dart';
55
import '../generated/l10n/zulip_localizations.dart';
66
import '../log.dart';
77
import '../model/channel.dart';
8+
import '../model/narrow.dart';
89
import 'action_sheet.dart';
910
import 'actions.dart';
1011
import 'app_bar.dart';
1112
import 'button.dart';
1213
import 'icons.dart';
14+
import 'message_list.dart';
1315
import 'page.dart';
1416
import 'remote_settings.dart';
1517
import 'store.dart';
@@ -96,28 +98,28 @@ class AllChannelsListEntry extends StatelessWidget {
9698
final Subscription? subscription = channel is Subscription ? channel : null;
9799
final hasContentAccess = store.selfHasContentAccess(channel);
98100

99-
return Padding(
100-
padding: EdgeInsetsDirectional.only(start: 8, end: 4),
101-
child: Row(spacing: 6, children: [
102-
Icon(
103-
size: 20,
104-
color: colorSwatchFor(context, subscription).iconOnPlainBackground,
105-
iconDataForStream(channel)),
106-
Expanded(
107-
child: Text(
108-
style: TextStyle(
109-
color: designVariables.textMessage,
110-
fontSize: 17,
111-
height: 20 / 17,
112-
).merge(weightVariableTextStyle(context, wght: 600)),
113-
channel.name)),
114-
if (hasContentAccess) _SubscribeToggle(channel: channel),
115-
ZulipIconButton(
116-
icon: ZulipIcons.more_horizontal,
117-
onPressed: () {
118-
showChannelActionSheet(context, channelId: channel.streamId);
119-
}),
120-
]));
101+
return InkWell(
102+
onTap: !hasContentAccess ? null : () => Navigator.push(context,
103+
MessageListPage.buildRoute(context: context,
104+
narrow: ChannelNarrow(channel.streamId))),
105+
onLongPress: () => showChannelActionSheet(context, channelId: channel.streamId),
106+
child: Padding(
107+
padding: EdgeInsetsDirectional.only(start: 8, end: 12),
108+
child: Row(spacing: 6, children: [
109+
Icon(
110+
size: 20,
111+
color: colorSwatchFor(context, subscription).iconOnPlainBackground,
112+
iconDataForStream(channel)),
113+
Expanded(
114+
child: Text(
115+
style: TextStyle(
116+
color: designVariables.textMessage,
117+
fontSize: 17,
118+
height: 20 / 17,
119+
).merge(weightVariableTextStyle(context, wght: 600)),
120+
channel.name)),
121+
if (hasContentAccess) _SubscribeToggle(channel: channel),
122+
])));
121123
}
122124
}
123125

test/widgets/all_channels_test.dart

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'package:zulip/widgets/app_bar.dart';
1212
import 'package:zulip/widgets/button.dart';
1313
import 'package:zulip/widgets/home.dart';
1414
import 'package:zulip/widgets/icons.dart';
15+
import 'package:zulip/widgets/message_list.dart';
1516
import 'package:zulip/widgets/page.dart';
1617
import 'package:zulip/widgets/remote_settings.dart';
1718
import 'package:zulip/widgets/theme.dart';
@@ -202,21 +203,35 @@ void main() {
202203
} else {
203204
check(maybeToggle).isNull();
204205
}
205-
206-
check(findInRow(find.byIcon(ZulipIcons.more_horizontal))).findsOne();
207206
}
208207
});
209208

210-
testWidgets('tapping three-dots button opens channel action sheet', (tester) async {
209+
testWidgets('open channel action sheet on long press', (tester) async {
211210
await setupAllChannelsPage(tester, channels: [eg.stream()]);
212211

213-
await tester.tap(find.byIcon(ZulipIcons.more_horizontal));
212+
await tester.longPress(find.byType(AllChannelsListEntry));
214213
await tester.pump();
215214
await transitionDurationObserver.pumpPastTransition(tester);
216215

217216
check(find.byType(BottomSheet)).findsOne();
218217
});
219218

219+
testWidgets('navigate to channel feed on tap', (tester) async {
220+
final channel = eg.stream(name: 'some-channel');
221+
await setupAllChannelsPage(tester, channels: [channel]);
222+
223+
connection.prepare(json: eg.newestGetMessagesResult(
224+
foundOldest: true, messages: [eg.streamMessage(stream: channel)]).toJson());
225+
await tester.tap(find.byType(AllChannelsListEntry));
226+
await tester.pump();
227+
await transitionDurationObserver.pumpPastTransition(tester);
228+
229+
check(find.descendant(
230+
of: find.byType(MessageListPage),
231+
matching: find.text('some-channel')),
232+
).findsOne();
233+
});
234+
220235
testWidgets('use toggle switch to subscribe/unsubscribe', (tester) async {
221236
final channel = eg.stream();
222237
await setupAllChannelsPage(tester, channels: [channel]);

0 commit comments

Comments
 (0)