6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 322ee0c5

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-06-25 12:34:55 +0200
Created new delete profile dialog and fixed overflow issue on button

Changed files

.../components/delete_profile_dialog_widget.dart   | 88 ++++++++++++++++++++++
 .../profile_settings/profile_settings_page.dart    | 52 ++-----------
 2 files changed, 94 insertions(+), 46 deletions(-)

Diff

diff --git a/comwell_key_app/lib/profile_settings/components/delete_profile_dialog_widget.dart b/comwell_key_app/lib/profile_settings/components/delete_profile_dialog_widget.dart
new file mode 100644
index 00000000..1ad50ed1
--- /dev/null
+++ b/comwell_key_app/lib/profile_settings/components/delete_profile_dialog_widget.dart
@@ -0,0 +1,88 @@
+import 'package:comwell_key_app/profile_settings/cubit/profile_settings_cubit.dart';
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+
+class DeleteProfileDialogWidget extends StatelessWidget {
+ const DeleteProfileDialogWidget({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = Theme.of(context);
+
+ return Dialog(
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(20),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(24.0),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ "delete_profile_title".tr(),
+ textAlign: TextAlign.center,
+ style: const TextStyle(
+ color: Colors.black,
+ fontSize: 18,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ const SizedBox(height: 16),
+ Text(
+ "delete_profile_description".tr(),
+ textAlign: TextAlign.center,
+ style: const TextStyle(
+ color: Colors.grey,
+ fontSize: 14,
+ ),
+ ),
+ const SizedBox(height: 24),
+ SizedBox(
+ width: double.infinity,
+ child: ElevatedButton(
+ style: theme.elevatedButtonTheme.style?.copyWith(
+ backgroundColor: const WidgetStatePropertyAll(Colors.red),
+ padding: const WidgetStatePropertyAll(
+ EdgeInsets.symmetric(vertical: 16)),
+ ),
+ onPressed: () {
+ context.read<ProfileSettingsCubit>().deleteProfile();
+ },
+ child: Text(
+ "delete_profile_button".tr(),
+ style: const TextStyle(
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(height: 12),
+ SizedBox(
+ width: double.infinity,
+ child: OutlinedButton(
+ style: OutlinedButton.styleFrom(
+ side: BorderSide(color: Colors.grey[400]!),
+ padding: const EdgeInsets.symmetric(vertical: 16),
+ ),
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
+ child: Text(
+ "delete_profile_cancel".tr(),
+ style: const TextStyle(
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ color: Colors.black,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
\ No newline at end of file
diff --git a/comwell_key_app/lib/profile_settings/profile_settings_page.dart b/comwell_key_app/lib/profile_settings/profile_settings_page.dart
index eefd57d9..7afe97e6 100644
--- a/comwell_key_app/lib/profile_settings/profile_settings_page.dart
+++ b/comwell_key_app/lib/profile_settings/profile_settings_page.dart
@@ -1,11 +1,11 @@
import 'package:comwell_key_app/authentication/authentication_repository.dart';
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
-import 'package:comwell_key_app/common/components/generic_dialog.dart';
import 'package:comwell_key_app/login/auth.dart';
import 'package:comwell_key_app/login/components/azure_b2c_widget.dart';
import 'package:comwell_key_app/profile_settings/components/address_bottom_sheet.dart';
import 'package:comwell_key_app/profile_settings/components/comwell_text_field.dart';
import 'package:comwell_key_app/profile_settings/components/date_time_picker.dart';
+import 'package:comwell_key_app/profile_settings/components/delete_profile_dialog_widget.dart';
import 'package:comwell_key_app/profile_settings/components/intl_phone_field.dart';
import 'package:comwell_key_app/profile_settings/components/text_field_with_trailing_icon.dart';
import 'package:comwell_key_app/profile_settings/cubit/profile_settings_cubit.dart';
@@ -180,14 +180,16 @@ class ProfileSettingsPage extends StatelessWidget {
borderRadius: BorderRadius.all(Radius.circular(20)),
),
minimumSize: const Size(135, 40),
- maximumSize: const Size(155, 40),
+ maximumSize: const Size(200, 40),
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
),
child: Row(
+ mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset("assets/icons/trash-can.svg",
height: 16),
- const SizedBox(width: 4),
+ const SizedBox(width: 8),
Text(
"delete_profile".tr(),
style: theme.textTheme.labelLarge?.copyWith(
@@ -235,50 +237,8 @@ class ProfileSettingsPage extends StatelessWidget {
return showDialog<void>(
context: context,
builder: (BuildContext context) {
- return GenericDialog(
- title: 'delete_profile_title'.tr(),
- content: 'delete_profile_description'.tr(),
- confirmButtonText: 'delete_profile_button'.tr(),
- confirmButtonTextColor: Colors.red,
- cancelButtonText: 'delete_profile_cancel'.tr(),
- onConfirm: () => {
- context.read<ProfileSettingsCubit>().deleteProfile(),
- },
- onCancel: () => Navigator.of(context).pop());
+ return const DeleteProfileDialogWidget();
},
);
}
}
-
-class DeleteProfileButton extends StatelessWidget {
- const DeleteProfileButton({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- final theme = Theme.of(context);
- return Center(
- child: OutlinedButton(
- onPressed: () {},
- style: OutlinedButton.styleFrom(
- side: const BorderSide(color: colorDivider),
- backgroundColor: Colors.transparent,
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.all(Radius.circular(20)),
- ),
- minimumSize: const Size(135, 40),
- maximumSize: const Size(155, 40),
- ),
- child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
- SvgPicture.asset("assets/icons/trash-can.svg", height: 16),
- const SizedBox(width: 4),
- Text(
- "delete_profile".tr(),
- style: theme.textTheme.labelLarge?.copyWith(color: Colors.red),
- ),
- ]),
- ),
- );
- }
-}