Skip to content

Commit 89c4f44

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 3aa29b2 commit 89c4f44

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';
@@ -87,18 +88,43 @@ class ChooseAccountPage extends StatelessWidget {
8788
SafeArea(
8889
minimum: const EdgeInsets.all(8),
8990
child: Column(children: [
90-
MenuItemButton(
91-
// round corners; not flush with device edge (SafeArea padding)
92-
style: const ButtonStyle(shape: MaterialStatePropertyAll(StadiumBorder())),
91+
_BottomMenuButton(
9392
leadingIcon: const Icon(Icons.add),
9493
onPressed: () => Navigator.push(context,
9594
AddAccountPage.buildRoute()),
9695
child: const Text('Add an account')),
96+
_BottomMenuButton(
97+
leadingIcon: const Icon(Icons.help_outline),
98+
onPressed: () {
99+
// Could make a whole page for global help.
100+
showDraggableScrollableModalBottomSheet(context: context,
101+
builder: (context) => Column(children: [
102+
// TODO button for https://zulip.com/help/
103+
MenuItemButton(
104+
onPressed: () {
105+
// TODO: Fill in [AboutDialog] data: app version, icon, etc:
106+
// https://api.flutter.dev/flutter/material/AboutDialog/AboutDialog.html
107+
showAboutDialog(context: context);
108+
},
109+
child: const Text('About Zulip')),
110+
]));
111+
},
112+
child: const Text('Help')),
97113
])),
98114
]));
99115
}
100116
}
101117

118+
class _BottomMenuButton extends MenuItemButton {
119+
const _BottomMenuButton({
120+
required super.onPressed,
121+
required super.leadingIcon,
122+
required super.child,
123+
}) : super(
124+
// round corners; not flush with device edge (SafeArea padding)
125+
style: const ButtonStyle(shape: MaterialStatePropertyAll(StadiumBorder())));
126+
}
127+
102128
class HomePage extends StatelessWidget {
103129
const HomePage({super.key});
104130

0 commit comments

Comments
 (0)