6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 9e1e1725

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-05-14 14:28:36 +0200
Resolved unresolved PR comments

Changed files

.../profile/components/card_content_widget.dart    | 93 ++++++++++++++++++++++
 .../profile/components/profile_page_widget.dart    | 87 +-------------------
 2 files changed, 96 insertions(+), 84 deletions(-)

Diff

diff --git a/comwell_key_app/lib/profile/components/card_content_widget.dart b/comwell_key_app/lib/profile/components/card_content_widget.dart
new file mode 100644
index 00000000..55574dc6
--- /dev/null
+++ b/comwell_key_app/lib/profile/components/card_content_widget.dart
@@ -0,0 +1,93 @@
+import 'package:comwell_key_app/profile/cubit/profile_cubit.dart';
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/material.dart';
+
+class CardContentWidget extends StatelessWidget {
+ final ProfileCubit cubit;
+ final bool isActive;
+ const CardContentWidget({super.key, required this.cubit, required this.isActive});
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = Theme.of(context);
+ final user = cubit.state.user!;
+
+ return SizedBox(
+ width: double.infinity,
+ height: double.infinity,
+ child: Stack(
+ children: [
+ Positioned(
+ top: 20,
+ left: 20,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
+ decoration: BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.circular(32),
+ ),
+ child: Text(
+ isActive ? 'Comwell Club' : 'comwell_club_inactive'.tr(),
+ style: theme.textTheme.bodySmall!.copyWith(
+ color: Colors.black,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ),
+ ),
+ Positioned(
+ bottom: 20,
+ left: 20,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Navn',
+ style: TextStyle(
+ color: isActive ? Colors.white : Colors.black,
+ fontSize: 14,
+ fontWeight: FontWeight.w400,
+ ),
+ ),
+ Text(
+ '${user.firstName} ${user.lastName}',
+ style: TextStyle(
+ color: isActive ? Colors.white : Colors.black,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ],
+ ),
+ ),
+ if (isActive)
+ Positioned(
+ bottom: 20,
+ right: 20,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Text(
+ 'points'.tr(),
+ style: const TextStyle(
+ color: Colors.white,
+ fontSize: 14,
+ fontWeight: FontWeight.w400,
+ ),
+ ),
+ Text(
+ '${user.points} ${'points'.tr()}',
+ style: const TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/comwell_key_app/lib/profile/components/profile_page_widget.dart b/comwell_key_app/lib/profile/components/profile_page_widget.dart
index d5113249..53810713 100644
--- a/comwell_key_app/lib/profile/components/profile_page_widget.dart
+++ b/comwell_key_app/lib/profile/components/profile_page_widget.dart
@@ -1,5 +1,6 @@
import 'package:comwell_key_app/common/components/comwell_card_component.dart';
import 'package:comwell_key_app/common/components/round_icon_button.dart';
+import 'package:comwell_key_app/profile/components/card_content_widget.dart';
import 'package:comwell_key_app/profile/components/comwell_club_signup_bottom_sheet.dart';
import 'package:comwell_key_app/profile/components/logout_dialog_widget.dart';
import 'package:comwell_key_app/profile/components/profile_settings_item.dart';
@@ -42,7 +43,7 @@ class ProfilePageWidget extends StatelessWidget {
child: Column(
children: [
ComwellCard(
- content: getCardContent(context, cubit, isActive),
+ content: CardContentWidget(cubit: cubit, isActive: isActive),
backgroundColor: isActive ? sandColor : sandColor[10]!),
],
),
@@ -211,87 +212,5 @@ class ProfilePageWidget extends StatelessWidget {
);
}
- Widget getCardContent(
- BuildContext context, ProfileCubit cubit, bool isActive) {
- final theme = Theme.of(context);
- final user = cubit.state.user!;
-
- return SizedBox(
- width: double.infinity,
- height: double.infinity,
- child: Stack(
- children: [
- Positioned(
- top: 20,
- left: 20,
- child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(32),
- ),
- child: Text(
- isActive ? 'Comwell Club' : 'comwell_club_inactive'.tr(),
- style: theme.textTheme.bodySmall!.copyWith(
- color: Colors.black,
- fontWeight: FontWeight.w600,
- ),
- ),
- ),
- ),
- Positioned(
- bottom: 20,
- left: 20,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'Navn',
- style: TextStyle(
- color: isActive ? Colors.white : Colors.black,
- fontSize: 14,
- fontWeight: FontWeight.w400,
- ),
- ),
- Text(
- '${user.firstName} ${user.lastName}',
- style: TextStyle(
- color: isActive ? Colors.white : Colors.black,
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- ),
- ],
- ),
- ),
- if (isActive)
- Positioned(
- bottom: 20,
- right: 20,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Text(
- 'points'.tr(),
- style: const TextStyle(
- color: Colors.white,
- fontSize: 14,
- fontWeight: FontWeight.w400,
- ),
- ),
- Text(
- '${user.points} ${'points'.tr()}',
- style: const TextStyle(
- color: Colors.white,
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- );
- }
+
}