Skip to content

Commit

Permalink
nav: Add an About Zulip button to the main menu
Browse files Browse the repository at this point in the history
Fixes: zulip#1128
  • Loading branch information
tomlin7 committed Dec 19, 2024
1 parent 6c07ab5 commit 02e7838
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/widgets/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';

import '../generated/l10n/zulip_localizations.dart';
import '../model/narrow.dart';
import 'about_zulip.dart';
import 'action_sheet.dart';
import 'app.dart';
import 'app_bar.dart';
Expand Down Expand Up @@ -264,6 +265,7 @@ void _showMainMenu(BuildContext context, {
// TODO(#97): Settings
// TODO(#661): Notifications
// const SizedBox(height: 8),
const _AboutZulipButton(),
// TODO(#1095): VersionInfo
];

Expand Down Expand Up @@ -551,6 +553,23 @@ class _SwitchAccountButton extends _MenuButton {
}
}

class _AboutZulipButton extends _MenuButton {
const _AboutZulipButton();

@override
IconData get icon => ZulipIcons.info;

@override
String label(ZulipLocalizations zulipLocalizations) {
return zulipLocalizations.aboutPageTitle;
}

@override
void onPressed(BuildContext context) {
Navigator.of(context).push(AboutZulipPage.buildRoute(context));
}
}

/// Apply [Transform.scale] to the child widget when tapped, and reset its scale
/// when released, while animating the transitions.
class AnimatedScaleOnTap extends StatefulWidget {
Expand Down
11 changes: 11 additions & 0 deletions test/widgets/home_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter_checks/flutter_checks.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:zulip/api/model/events.dart';
import 'package:zulip/model/store.dart';
import 'package:zulip/widgets/about_zulip.dart';
import 'package:zulip/widgets/app.dart';
import 'package:zulip/widgets/app_bar.dart';
import 'package:zulip/widgets/home.dart';
Expand Down Expand Up @@ -215,6 +216,16 @@ void main () {
check(find.byType(ProfilePage)).findsOne();
check(find.text(eg.selfUser.fullName)).findsAny();
});

testWidgets('_AboutZulipButton', (tester) async {
await prepare(tester);
await tapOpenMenu(tester);

await tester.tap(find.byIcon(ZulipIcons.info));
await tester.pump(Duration.zero); // tap the button
await tester.pump(const Duration(milliseconds: 250)); // wait for animation
check(find.byType(AboutZulipPage)).findsOne();
});
});

group('_LoadingPlaceholderPage', () {
Expand Down

0 comments on commit 02e7838

Please sign in to comment.