6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit fbd7cc38
Changed files
comwell_key_app/assets/icons/bell.png | Bin 0 -> 375 bytes comwell_key_app/assets/icons/card.png | Bin 0 -> 224 bytes comwell_key_app/assets/icons/user-circle.png | Bin 0 -> 480 bytes comwell_key_app/assets/images/cc_inactive.png | Bin 0 -> 6061 bytes comwell_key_app/assets/translations/da-DK.json | 12 +- comwell_key_app/assets/translations/en-US.json | 11 +- .../profile/components/profile_settings_item.dart | 24 ++ .../lib/profile/cubit/profile_cubit.dart | 8 + .../lib/profile/cubit/profile_state.dart | 10 + comwell_key_app/lib/profile/profile_page.dart | 241 ++++++++++++++++++--- comwell_key_app/lib/themes/light_theme.dart | 1 + comwell_key_app/pubspec.yaml | 1 + 12 files changed, 281 insertions(+), 27 deletions(-)
Diff
diff --git a/comwell_key_app/assets/icons/bell.png b/comwell_key_app/assets/icons/bell.png
new file mode 100644
index 00000000..26102a35
Binary files /dev/null and b/comwell_key_app/assets/icons/bell.png differ
diff --git a/comwell_key_app/assets/icons/card.png b/comwell_key_app/assets/icons/card.png
new file mode 100644
index 00000000..bc8b28a1
Binary files /dev/null and b/comwell_key_app/assets/icons/card.png differ
diff --git a/comwell_key_app/assets/icons/user-circle.png b/comwell_key_app/assets/icons/user-circle.png
new file mode 100644
index 00000000..b43aaaaa
Binary files /dev/null and b/comwell_key_app/assets/icons/user-circle.png differ
diff --git a/comwell_key_app/assets/images/cc_inactive.png b/comwell_key_app/assets/images/cc_inactive.png
new file mode 100644
index 00000000..98f986a3
Binary files /dev/null and b/comwell_key_app/assets/images/cc_inactive.png differ
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index bf387a30..c5326f78 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -10,5 +10,15 @@
"try_again": "Prøv igen",
"room_key_description": "Dette er din nøgle til værelset.",
"login_button": "Login",
- "create_user_button": "Opret ny bruger"
+ "create_user_button": "Opret ny bruger",
+ "profile_settings_profile_menu": "Profilindstillinger",
+ "payment_card_profile_menu": "Betalingskort",
+ "notifications_profile_menu": "Notifikationer",
+ "logout_profile_menu": "Log ud",
+ "logout_dialog_title": "Vil du logge ud af din profil",
+ "cancel": "Annuller",
+ "name_cc_sign": "Navn",
+ "become_cc_member_title": "Bliv medlem af comwell club",
+ "become_cc_member_subtitle": "Bliv medlem og optjen point, hver gang du overnatter på et Comwell Hotel."
+
}
\ No newline at end of file
diff --git a/comwell_key_app/assets/translations/en-US.json b/comwell_key_app/assets/translations/en-US.json
index b630b3a3..20a6c2d4 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -10,5 +10,14 @@
"try_again": "Try again",
"room_key_description": "This is your room key",
"login_button": "Login",
- "create_user_button": "create new user"
+ "create_user_button": "create new user",
+ "profile_settings_profile_menu": "Profile settings",
+ "payment_card_profile_menu": "Payment card",
+ "notifications_profile_menu": "Notifications",
+ "logout_profile_menu": "Logout",
+ "logout_dialog_title": "Do you want to log out of your profile",
+ "cancel": "Cancel",
+ "name_cc_sign": "Name",
+ "become_cc_member_title": "Join comwell club",
+ "become_cc_member_subtitle": "Join and earn points every time you stay at a Comwell Hotel."
}
\ No newline at end of file
diff --git a/comwell_key_app/lib/profile/components/profile_settings_item.dart b/comwell_key_app/lib/profile/components/profile_settings_item.dart
new file mode 100644
index 00000000..d170e20d
--- /dev/null
+++ b/comwell_key_app/lib/profile/components/profile_settings_item.dart
@@ -0,0 +1,24 @@
+import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:flutter/material.dart';
+
+Widget profileSettingsItem(
+ BuildContext context, {
+ required Widget icon,
+ required String text,
+ required IconData trailingIcon,
+ required VoidCallback onTap,
+}) {
+ return ListTile(
+ leading: Container(
+ padding: const EdgeInsets.all(8.0),
+ decoration: BoxDecoration(
+ color: sandColor[20],
+ shape: BoxShape.circle,
+ ),
+ child: icon,
+ ),
+ title: Text(text, style: const TextStyle(color: Colors.black)),
+ trailing: Icon(trailingIcon, color: Colors.black, size: 24),
+ onTap: onTap,
+ );
+}
diff --git a/comwell_key_app/lib/profile/cubit/profile_cubit.dart b/comwell_key_app/lib/profile/cubit/profile_cubit.dart
new file mode 100644
index 00000000..0a51596a
--- /dev/null
+++ b/comwell_key_app/lib/profile/cubit/profile_cubit.dart
@@ -0,0 +1,8 @@
+import 'package:bloc/bloc.dart';
+import 'package:equatable/equatable.dart';
+
+part 'profile_state.dart';
+
+class ProfileCubit extends Cubit<ProfileState> {
+ ProfileCubit() : super(ProfileInitial());
+}
diff --git a/comwell_key_app/lib/profile/cubit/profile_state.dart b/comwell_key_app/lib/profile/cubit/profile_state.dart
new file mode 100644
index 00000000..ef8b370e
--- /dev/null
+++ b/comwell_key_app/lib/profile/cubit/profile_state.dart
@@ -0,0 +1,10 @@
+part of 'profile_cubit.dart';
+
+sealed class ProfileState extends Equatable {
+ const ProfileState();
+
+ @override
+ List<Object> get props => [];
+}
+
+final class ProfileInitial extends ProfileState {}
diff --git a/comwell_key_app/lib/profile/profile_page.dart b/comwell_key_app/lib/profile/profile_page.dart
index 696becad..f704afb6 100644
--- a/comwell_key_app/lib/profile/profile_page.dart
+++ b/comwell_key_app/lib/profile/profile_page.dart
@@ -1,7 +1,9 @@
import 'package:comwell_key_app/components/round_icon_button.dart';
+import 'package:comwell_key_app/profile/components/profile_settings_item.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/utils/secure_storage.dart';
+import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -12,37 +14,226 @@ class ProfilePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
- backgroundColor: sandColor[40],
- body: Stack(
+ backgroundColor: sandColor[20],
+ body: Column(
children: [
- const Center(
- child: Text('Profile Information'),
+ Padding(
+ padding: const EdgeInsets.only(top: 50),
+ child: Container(
+ alignment: Alignment.centerRight,
+ child: RoundIconButton(
+ icon: Icons.close,
+ onPressed: () {
+ context.pop();
+ }),
+ ),
),
- Positioned(
- bottom: 20,
- left: 0,
- right: 0,
- child: Center(
- child: ElevatedButton(
- onPressed: () {
- secureStorage.deleteAll();
- context.goNamed(AppRoutes.login.name);
- },
- child: const Text('Logout'),
- ),
+ Expanded(
+ child: Column(
+ children: [
+ const Spacer(),
+ Stack(children: [
+ Image.asset('assets/images/cc_inactive.png'),
+ Positioned(
+ bottom: 20,
+ left: 20,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'name_cc_sign'.tr(),
+ style: const TextStyle(
+ color: Colors.black,
+ fontSize: 14,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ const Text(
+ 'Nikolaj King Lykkegaard',
+ style: TextStyle(
+ color: Colors.black,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ]),
+ ),
+ ]),
+ const SizedBox(
+ height: 20,
+ )
+ ],
),
),
- Positioned(
- top: 60,
- right: 10,
- child: RoundIconButton(
- icon: Icons.close,
- onPressed: () {
- context.pop();
- }),
+ Container(
+ color: Colors.white,
+ child: Column(
+ children: [
+ const SizedBox(height: 20),
+ Container(
+ margin: const EdgeInsets.symmetric(horizontal: 16),
+ padding: const EdgeInsets.symmetric(vertical: 16),
+ decoration: BoxDecoration(
+ color: sandColor[10],
+ borderRadius: const BorderRadius.all(Radius.circular(10)),
+ ),
+ height: 100,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text("become_cc_member_title".tr(),
+ textAlign: TextAlign.start,
+ style: const TextStyle(
+ color: Colors.black,
+ fontSize: 16,
+ fontWeight: FontWeight.w600)),
+ SizedBox(
+ width: 250,
+ child: Text(
+ "become_cc_member_subtitle".tr(),
+ textAlign: TextAlign.start,
+ maxLines: 3,
+ style: const TextStyle(
+ color: Colors.black,
+ fontSize: 14,
+ fontWeight: FontWeight.w500),
+ ),
+ ),
+ ],
+ ),
+ const Icon(Icons.chevron_right, color: Colors.black, size: 24,),
+ ],
+ )),
+ const SizedBox(height: 16),
+ profileSettingsItem(
+ context,
+ icon: Image.asset('assets/icons/user-circle.png'),
+ text: 'profile_settings_profile_menu'.tr(),
+ trailingIcon: Icons.chevron_right,
+ onTap: () {
+ // Navigate to profile settings
+ },
+ ),
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16.0),
+ child: Divider(color: colorDivider),
+ ),
+ profileSettingsItem(
+ context,
+ icon: Image.asset('assets/icons/card.png'),
+ text: 'payment_card_profile_menu'.tr(),
+ trailingIcon: Icons.chevron_right,
+ onTap: () {
+ // Navigate to card
+ },
+ ),
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16.0),
+ child: Divider(color: colorDivider),
+ ),
+ profileSettingsItem(
+ context,
+ icon: Image.asset('assets/icons/bell.png'),
+ trailingIcon: Icons.chevron_right,
+ text: 'notifications_profile_menu'.tr(),
+ onTap: () {
+ // Navigate to notifications
+ },
+ ),
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16.0),
+ child: Divider(color: colorDivider),
+ ),
+ const SizedBox(height: 20),
+ Center(
+ child: OutlinedButton(
+ style: OutlinedButton.styleFrom(
+ side: const BorderSide(color: colorDivider),
+ ),
+ onPressed: () {
+ secureStorage.deleteAll();
+ showLogoutDialog(context);
+ },
+ child: Text(
+ 'logout_profile_menu'.tr(),
+ style: const TextStyle(color: colorDivider),
+ ),
+ ),
+ ),
+ const SizedBox(height: 20),
+ ],
+ ),
),
],
),
);
}
-}
\ No newline at end of file
+
+ Future<AlertDialog?> showLogoutDialog(BuildContext context) {
+ return showDialog<AlertDialog>(
+ context: context,
+ builder: (BuildContext context) {
+ return Dialog(
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(20),
+ ),
+ child: SizedBox(
+ height: 220,
+ child: Padding(
+ padding: const EdgeInsets.only(left: 20, right: 20, top: 20),
+ child: Column(
+ children: [
+ const SizedBox(
+ height: 10,
+ ),
+ Text("logout_dialog_title".tr(),
+ textAlign: TextAlign.center,
+ style: const TextStyle(
+ color: Colors.black,
+ 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),
+ ),
+ onPressed: () {
+ context.goNamed(AppRoutes.login.name);
+ },
+ child: Text("logout_profile_menu".tr(),
+ style: const TextStyle(
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ color: Colors.white)),
+ ),
+ 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)),
+ ),
+ const SizedBox(
+ height: 10,
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ });
+ }
+}
diff --git a/comwell_key_app/lib/themes/light_theme.dart b/comwell_key_app/lib/themes/light_theme.dart
index 418d2d89..f918c858 100644
--- a/comwell_key_app/lib/themes/light_theme.dart
+++ b/comwell_key_app/lib/themes/light_theme.dart
@@ -48,6 +48,7 @@ const colorTertiary = Color(0xFF000000);
const colorTertiaryText = Color(0xFF000000);
const colorTertiarySystem = Color(0xFF000000);
const colorShadow = Color(0xFF000000);
+const colorDivider = Color(0xFFE0E0E0);
const int _earthColor = 0xFF677169;
const earthColor = MaterialColor(_earthColor, <int,Color>
diff --git a/comwell_key_app/pubspec.yaml b/comwell_key_app/pubspec.yaml
index bd01d7c9..2ba21098 100644
--- a/comwell_key_app/pubspec.yaml
+++ b/comwell_key_app/pubspec.yaml
@@ -74,6 +74,7 @@ flutter:
- assets/animations/
- assets/translations/
- assets/images/
+ - assets/icons/
- .env
# To add assets to your application, add an assets section, like this: