forked from zulip/zulip-flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabout_zulip.dart
60 lines (53 loc) · 2.04 KB
/
about_zulip.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/zulip_localizations.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'page.dart';
class AboutZulipPage extends StatefulWidget {
const AboutZulipPage({super.key});
static Route<void> buildRoute(BuildContext context) {
return MaterialWidgetRoute(page: const AboutZulipPage());
}
@override
State<AboutZulipPage> createState() => _AboutZulipPageState();
}
class _AboutZulipPageState extends State<AboutZulipPage> {
PackageInfo? _packageInfo;
@override
void initState() {
super.initState();
(() async {
final result = await PackageInfo.fromPlatform();
setState(() {
_packageInfo = result;
});
})();
}
@override
Widget build(BuildContext context) {
final zulipLocalizations = ZulipLocalizations.of(context);
return Scaffold(
appBar: AppBar(title: Text(zulipLocalizations.aboutPageTitle)),
body: SingleChildScrollView(
child: SafeArea(
minimum: const EdgeInsets.all(8), // ListView pads vertical
child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 400),
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
ListTile(
title: Text(zulipLocalizations.aboutPageAppVersion),
subtitle: Text(_packageInfo?.version ?? '(…)')),
ListTile(
title: Text(zulipLocalizations.aboutPageOpenSourceLicenses),
subtitle: Text(zulipLocalizations.aboutPageTapToView),
onTap: () {
// TODO(upstream?): This route and its child routes (pushed
// when you tap a package to view its licenses) can't be
// popped on iOS with the swipe-away gesture; you have to
// tap the "Back" button. Debug/fix.
showLicensePage(context: context);
}),
])))),
));
}
}