mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-03-06 16:46:35 +00:00
* Enable `flutter_lints` linting * Fix unmarked deps, we aren't on web so we don't need a URL strategy * ` dart fix --apply --code=use_super_parameters` * `dart fix --apply --code=use_key_in_widget_constructors` * `dart fix --apply --code=use_function_type_syntax_for_parameters` * Ignore code-generated `lib/services/theme.dart` file * `dart fix --apply --code=unnecessary_this` * `dart fix --apply --code=unnecessary_null_in_if_null_operators` * `dart fix --apply --code=unnecessary_new` * `dart fix --apply --code=sort_child_properties_last` * `dart fix --apply --code=sized_box_for_whitespace` * `dart fix --apply --code=prefer_typing_uninitialized_variables` * `dart fix --apply --code=prefer_is_empty` * `dart fix --apply --code=prefer_interpolation_to_compose_strings` * `dart fix --apply --code=prefer_final_fields` * `dart fix --apply --code=prefer_const_constructors_in_immutables` * `dart fix --apply --code=prefer_collection_literals` * `dart fix --apply --code=no_leading_underscores_for_local_identifiers` * `dart fix --apply --code=curly_braces_in_flow_control_structures` * `dart fix --apply --code=avoid_function_literals_in_foreach_calls` * `dart fix --apply --code=annotate_overrides` * Add CI for dart linting * `dart format lib/` * Re-enable the `usePathUrlStrategy` call, with proper deps https://docs.flutter.dev/ui/navigation/url-strategies#configuring-the-url-strategy
107 lines
3.4 KiB
Dart
107 lines
3.4 KiB
Dart
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/screens/LicensesScreen.dart';
|
|
import 'package:mobile_nebula/services/utils.dart';
|
|
import 'package:package_info_plus/package_info_plus.dart';
|
|
|
|
class AboutScreen extends StatefulWidget {
|
|
const AboutScreen({super.key});
|
|
|
|
@override
|
|
_AboutScreenState createState() => _AboutScreenState();
|
|
}
|
|
|
|
class _AboutScreenState extends State<AboutScreen> {
|
|
bool ready = false;
|
|
PackageInfo? packageInfo;
|
|
|
|
@override
|
|
void initState() {
|
|
PackageInfo.fromPlatform().then((PackageInfo info) {
|
|
packageInfo = info;
|
|
setState(() {
|
|
ready = true;
|
|
});
|
|
});
|
|
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// packageInfo is null until ready is true
|
|
if (!ready) {
|
|
return Center(
|
|
child: PlatformCircularProgressIndicator(
|
|
cupertino: (_, __) {
|
|
return CupertinoProgressIndicatorData(radius: 50);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
return SimplePage(
|
|
title: Text('About'),
|
|
child: Column(
|
|
children: [
|
|
ConfigSection(
|
|
children: <Widget>[
|
|
ConfigItem(
|
|
label: Text('App version'),
|
|
labelWidth: 150,
|
|
content: _buildText('${packageInfo!.version}-${packageInfo!.buildNumber} (sha: $gitSha)'),
|
|
),
|
|
ConfigItem(
|
|
label: Text('Nebula version'),
|
|
labelWidth: 150,
|
|
content: _buildText('$nebulaVersion ($goVersion)'),
|
|
),
|
|
ConfigItem(
|
|
label: Text('Flutter version'),
|
|
labelWidth: 150,
|
|
content: _buildText(flutterVersion['frameworkVersion'] ?? 'Unknown'),
|
|
),
|
|
ConfigItem(
|
|
label: Text('Dart version'),
|
|
labelWidth: 150,
|
|
content: _buildText(flutterVersion['dartSdkVersion'] ?? 'Unknown'),
|
|
),
|
|
],
|
|
),
|
|
ConfigSection(
|
|
children: <Widget>[
|
|
//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,
|
|
onPressed: () => Utils.launchUrl('https://www.defined.net/privacy/', context),
|
|
),
|
|
ConfigPageItem(
|
|
label: Text('Licenses'),
|
|
labelWidth: 300,
|
|
onPressed:
|
|
() => Utils.openPage(context, (context) {
|
|
return LicensesScreen();
|
|
}),
|
|
),
|
|
],
|
|
),
|
|
Padding(
|
|
padding: EdgeInsets.only(top: 20),
|
|
child: Text('Copyright © 2024 Defined Networking, Inc', textAlign: TextAlign.center),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
_buildText(String str) {
|
|
return Align(alignment: AlignmentDirectional.centerEnd, child: SelectableText(str));
|
|
}
|
|
}
|