Skip to content

Commit 99ef5ab

Browse files
committed
accounts: Add global "Help" menu item, with option to show [AboutDialog]
From Flutter's [AboutDialog], the user can tap a button to show [LicensePage], so resolving #99. Fixes: #99
1 parent af0af36 commit 99ef5ab

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

lib/widgets/app.dart

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22

33
import 'compose_box.dart';
4+
import 'draggable_scrollable_modal_bottom_sheet.dart';
45
import 'login.dart';
56
import 'message_list.dart';
67
import 'page.dart';
@@ -82,18 +83,43 @@ class ChooseAccountPage extends StatelessWidget {
8283
SafeArea(
8384
minimum: const EdgeInsets.all(8),
8485
child: Column(children: [
85-
MenuItemButton(
86-
// round corners; not flush with device edge (SafeArea padding)
87-
style: const ButtonStyle(shape: MaterialStatePropertyAll(StadiumBorder())),
86+
_BottomMenuButton(
8887
leadingIcon: const Icon(Icons.add),
8988
onPressed: () => Navigator.push(context,
9089
AddAccountPage.buildRoute()),
9190
child: const Text('Add an account')),
91+
_BottomMenuButton(
92+
leadingIcon: const Icon(Icons.help_outline),
93+
onPressed: () {
94+
// Could make a whole page for global help.
95+
showDraggableScrollableModalBottomSheet(context: context,
96+
builder: (context) => Column(children: [
97+
// TODO button for https://zulip.com/help/
98+
MenuItemButton(
99+
onPressed: () {
100+
// TODO: Fill in [AboutDialog] data: app version, icon, etc:
101+
// https://api.flutter.dev/flutter/material/AboutDialog/AboutDialog.html
102+
showAboutDialog(context: context);
103+
},
104+
child: const Text('About Zulip')),
105+
]));
106+
},
107+
child: const Text('Help')),
92108
])),
93109
]));
94110
}
95111
}
96112

113+
class _BottomMenuButton extends MenuItemButton {
114+
const _BottomMenuButton({
115+
required super.onPressed,
116+
required super.leadingIcon,
117+
required super.child,
118+
}) : super(
119+
// round corners; not flush with device edge (SafeArea padding)
120+
style: const ButtonStyle(shape: MaterialStatePropertyAll(StadiumBorder())));
121+
}
122+
97123
class HomePage extends StatelessWidget {
98124
const HomePage({super.key});
99125

0 commit comments

Comments
 (0)