6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 5c7b40bf

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-04-28 16:00:23 +0200
1509: Resolved PR comment

Changed files

comwell_key_app/lib/profile/cubit/profile_cubit.dart | 6 ++++++
 comwell_key_app/lib/profile/profile_page.dart        | 7 +------
 2 files changed, 7 insertions(+), 6 deletions(-)

Diff

diff --git a/comwell_key_app/lib/profile/cubit/profile_cubit.dart b/comwell_key_app/lib/profile/cubit/profile_cubit.dart
index 888deef9..e2b9bdc5 100644
--- a/comwell_key_app/lib/profile/cubit/profile_cubit.dart
+++ b/comwell_key_app/lib/profile/cubit/profile_cubit.dart
@@ -2,6 +2,7 @@ import 'package:bloc/bloc.dart';
import 'package:comwell_key_app/profile/profile_repository.dart';
import 'package:equatable/equatable.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
+import 'package:package_info_plus/package_info_plus.dart';
part 'profile_state.dart';
@@ -16,6 +17,11 @@ class ProfileCubit extends Cubit<ProfileState> {
);
}
+ Future<String> getVersion() async {
+ final packageInfo = await PackageInfo.fromPlatform();
+ return packageInfo.version;
+ }
+
void deleteAllInfoOnLogOut() async {
emit(ProfileLogOut());
}
diff --git a/comwell_key_app/lib/profile/profile_page.dart b/comwell_key_app/lib/profile/profile_page.dart
index a6373523..b44423d5 100644
--- a/comwell_key_app/lib/profile/profile_page.dart
+++ b/comwell_key_app/lib/profile/profile_page.dart
@@ -178,7 +178,7 @@ class ProfilePage extends StatelessWidget {
),
const SizedBox(height: 16),
FutureBuilder<String>(
- future: getVersion(),
+ future: context.read<ProfileCubit>().getVersion(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Text(snapshot.data!,
@@ -270,9 +270,4 @@ class ProfilePage extends StatelessWidget {
);
});
}
-
- Future<String> getVersion() async {
- final packageInfo = await PackageInfo.fromPlatform();
- return packageInfo.version;
- }
}