selfprivacy.org.app/lib/ui/pages/more/info/info.dart

66 lines
2 KiB
Dart
Raw Normal View History

2020-12-02 09:16:23 +00:00
import 'package:flutter/material.dart';
import 'package:selfprivacy/config/brand_theme.dart';
import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server.dart';
2020-12-02 09:16:23 +00:00
import 'package:selfprivacy/ui/components/brand_header/brand_header.dart';
2020-12-08 19:26:51 +00:00
import 'package:selfprivacy/ui/components/brand_text/brand_text.dart';
2020-12-02 09:16:23 +00:00
import 'package:package_info/package_info.dart';
2021-03-18 07:26:54 +00:00
import 'package:easy_localization/easy_localization.dart';
2020-12-02 09:16:23 +00:00
class InfoPage extends StatelessWidget {
const InfoPage({final super.key});
2020-12-02 09:16:23 +00:00
@override
2022-06-05 19:36:32 +00:00
Widget build(final BuildContext context) => SafeArea(
child: Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(52),
child:
BrandHeader(title: 'more.about_app'.tr(), hasBackButton: true),
),
body: ListView(
padding: paddingH15V0,
children: [
const SizedBox(height: 10),
FutureBuilder(
future: _packageVersion(),
builder: (final context, final snapshot) => BrandText.body1(
'more.about_app_page.application_version_text'
.tr(args: [snapshot.data.toString()]),
),
),
FutureBuilder(
future: _apiVersion(),
builder: (final context, final snapshot) => BrandText.body1(
'more.about_app_page.api_version_text'
.tr(args: [snapshot.data.toString()]),
),
),
],
),
2020-12-02 09:16:23 +00:00
),
);
2020-12-02 09:16:23 +00:00
Future<String> _packageVersion() async {
String packageVersion = 'unknown';
try {
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
packageVersion = packageInfo.version;
} catch (e) {
print(e);
}
return packageVersion;
2020-12-02 09:16:23 +00:00
}
Future<String> _apiVersion() async {
String apiVersion = 'unknown';
try {
apiVersion = await ServerApi().getApiVersion() ?? apiVersion;
} catch (e) {
print(e);
}
return apiVersion;
}
2020-12-02 09:16:23 +00:00
}