2020-07-27 20:43:58 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
|
|
|
import 'package:mobile_nebula/components/SimplePage.dart';
|
|
|
|
import 'package:mobile_nebula/components/config/ConfigItem.dart';
|
|
|
|
import 'package:mobile_nebula/components/config/ConfigPageItem.dart';
|
|
|
|
import 'package:mobile_nebula/components/config/ConfigSection.dart';
|
|
|
|
import 'package:mobile_nebula/gen.versions.dart';
|
|
|
|
import 'package:mobile_nebula/services/utils.dart';
|
2024-09-20 18:19:23 +00:00
|
|
|
import 'package:package_info_plus/package_info_plus.dart';
|
2020-07-27 20:43:58 +00:00
|
|
|
|
|
|
|
class AboutScreen extends StatefulWidget {
|
2022-09-21 20:27:35 +00:00
|
|
|
const AboutScreen({Key? key}) : super(key: key);
|
2020-07-27 20:43:58 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
_AboutScreenState createState() => _AboutScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _AboutScreenState extends State<AboutScreen> {
|
|
|
|
bool ready = false;
|
2022-09-21 20:27:35 +00:00
|
|
|
PackageInfo? packageInfo;
|
2020-07-27 20:43:58 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
PackageInfo.fromPlatform().then((PackageInfo info) {
|
|
|
|
packageInfo = info;
|
|
|
|
setState(() {
|
|
|
|
ready = true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-09-21 20:27:35 +00:00
|
|
|
// packageInfo is null until ready is true
|
2020-07-27 20:43:58 +00:00
|
|
|
if (!ready) {
|
|
|
|
return Center(
|
2021-04-23 17:33:28 +00:00
|
|
|
child: PlatformCircularProgressIndicator(cupertino: (_, __) {
|
2020-07-27 20:43:58 +00:00
|
|
|
return CupertinoProgressIndicatorData(radius: 50);
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return SimplePage(
|
2022-11-17 21:43:16 +00:00
|
|
|
title: Text('About'),
|
2020-07-27 20:43:58 +00:00
|
|
|
child: Column(children: [
|
|
|
|
ConfigSection(children: <Widget>[
|
|
|
|
ConfigItem(
|
|
|
|
label: Text('App version'),
|
|
|
|
labelWidth: 150,
|
2022-09-21 20:27:35 +00:00
|
|
|
content: _buildText('${packageInfo!.version}-${packageInfo!.buildNumber} (sha: $gitSha)')),
|
2020-07-27 20:43:58 +00:00
|
|
|
ConfigItem(
|
|
|
|
label: Text('Nebula version'), labelWidth: 150, content: _buildText('$nebulaVersion ($goVersion)')),
|
|
|
|
ConfigItem(
|
2022-09-21 20:27:35 +00:00
|
|
|
label: Text('Flutter version'),
|
|
|
|
labelWidth: 150,
|
|
|
|
content: _buildText(flutterVersion['frameworkVersion'] ?? 'Unknown')),
|
2020-07-27 20:43:58 +00:00
|
|
|
ConfigItem(
|
2022-09-21 20:27:35 +00:00
|
|
|
label: Text('Dart version'),
|
|
|
|
labelWidth: 150,
|
|
|
|
content: _buildText(flutterVersion['dartSdkVersion'] ?? 'Unknown')),
|
2020-07-27 20:43:58 +00:00
|
|
|
]),
|
|
|
|
ConfigSection(children: <Widget>[
|
2020-08-07 22:44:40 +00:00
|
|
|
//TODO: wire up these other pages
|
|
|
|
// ConfigPageItem(label: Text('Changelog'), labelWidth: 300, onPressed: () => Utils.launchUrl('https://defined.net/mobile/changelog', context)),
|
|
|
|
ConfigPageItem(
|
|
|
|
label: Text('Privacy policy'),
|
|
|
|
labelWidth: 300,
|
2023-04-14 15:14:06 +00:00
|
|
|
onPressed: () => Utils.launchUrl('https://www.defined.net/privacy/', context)),
|
2020-08-07 22:44:40 +00:00
|
|
|
// ConfigPageItem(label: Text('Licenses'), labelWidth: 300, onPressed: () => Utils.launchUrl('https://defined.net/mobile/license', context)),
|
2020-07-27 20:43:58 +00:00
|
|
|
]),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 20),
|
|
|
|
child: Text(
|
2022-11-22 16:12:38 +00:00
|
|
|
'Copyright © 2022 Defined Networking, Inc',
|
2020-07-27 20:43:58 +00:00
|
|
|
textAlign: TextAlign.center,
|
|
|
|
)),
|
|
|
|
]),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_buildText(String str) {
|
2022-01-19 19:29:30 +00:00
|
|
|
return Align(alignment: AlignmentDirectional.centerEnd, child: SelectableText(str));
|
2020-07-27 20:43:58 +00:00
|
|
|
}
|
|
|
|
}
|