6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 450c0113

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-04-14 15:32:21 +0200
1509: Added version number to settings page.

Changed files

comwell_key_app/lib/profile/profile_page.dart | 79 +++++++++++++++++----------
 comwell_key_app/pubspec.yaml                  |  1 +
 2 files changed, 51 insertions(+), 29 deletions(-)

Diff

diff --git a/comwell_key_app/lib/profile/profile_page.dart b/comwell_key_app/lib/profile/profile_page.dart
index 648707cb..9e9fb9eb 100644
--- a/comwell_key_app/lib/profile/profile_page.dart
+++ b/comwell_key_app/lib/profile/profile_page.dart
@@ -9,15 +9,16 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
+import 'package:package_info_plus/package_info_plus.dart';
class ProfilePage extends StatelessWidget {
final SecureStorage secureStorage = SecureStorage();
ProfilePage({super.key});
-
@override
Widget build(BuildContext context) {
context.read<ProfileCubit>().sendPageViewEvent();
+
return Scaffold(
backgroundColor: sandColor[20],
body: SafeArea(
@@ -175,6 +176,17 @@ class ProfilePage extends StatelessWidget {
),
),
),
+ const SizedBox(height: 16),
+ FutureBuilder<String>(
+ future: getVersion(),
+ builder: (context, snapshot) {
+ if (snapshot.hasData) {
+ return Text(snapshot.data!,
+ style: TextStyle(color: Colors.grey[500]));
+ }
+ return const SizedBox.shrink();
+ },
+ ),
const SizedBox(height: 20),
],
),
@@ -209,40 +221,44 @@ class ProfilePage extends StatelessWidget {
fontSize: 18,
fontWeight: FontWeight.w600)),
const SizedBox(height: 20),
- ElevatedButton(
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor,
- minimumSize: const Size(280, 52),
- maximumSize: const Size(280, 52),
+ Expanded(
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ backgroundColor: sandColor,
+ minimumSize: const Size(280, 52),
+ maximumSize: const Size(280, 52),
+ ),
+ onPressed: () {
+ context
+ .read<AuthenticationBloc>()
+ .add(AuthenticationLogoutPressed());
+ },
+ child: Text("logout_profile_menu".tr(),
+ style: const TextStyle(
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ color: Colors.white)),
),
- onPressed: () {
- context
- .read<AuthenticationBloc>()
- .add(AuthenticationLogoutPressed());
- },
- child: Text("logout_profile_menu".tr(),
- style: const TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w600,
- color: Colors.white)),
),
const SizedBox(
height: 5,
),
- OutlinedButton(
- style: OutlinedButton.styleFrom(
- side: const BorderSide(color: colorDivider),
- minimumSize: const Size(280, 52),
- maximumSize: const Size(280, 52),
+ Expanded(
+ child: OutlinedButton(
+ style: OutlinedButton.styleFrom(
+ side: const BorderSide(color: colorDivider),
+ minimumSize: const Size(280, 52),
+ maximumSize: const Size(280, 52),
+ ),
+ onPressed: () {
+ context.pop();
+ },
+ child: Text("cancel".tr(),
+ style: const TextStyle(
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ color: Colors.black)),
),
- onPressed: () {
- context.pop();
- },
- child: Text("cancel".tr(),
- style: const TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w600,
- color: Colors.black)),
),
const SizedBox(
height: 10,
@@ -254,4 +270,9 @@ class ProfilePage extends StatelessWidget {
);
});
}
+
+ Future<String> getVersion() async {
+ final packageInfo = await PackageInfo.fromPlatform();
+ return packageInfo.version;
+ }
}
diff --git a/comwell_key_app/pubspec.yaml b/comwell_key_app/pubspec.yaml
index b477b99b..5f486f44 100644
--- a/comwell_key_app/pubspec.yaml
+++ b/comwell_key_app/pubspec.yaml
@@ -51,6 +51,7 @@ dependencies:
sqlite3: ^2.6.0
path: ^1.9.0
path_provider: ^2.1.5
+ package_info_plus: ^8.3.0
sentry_flutter: ^8.13.0
dependency_overrides: