6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 966b071c
Changed files
comwell_key_app/assets/translations/da-DK.json | 6 +- comwell_key_app/assets/translations/en-US.json | 6 +- .../booking_details/components/share_button.dart | 109 ++++++++++++++++++++- 3 files changed, 116 insertions(+), 5 deletions(-)
Diff
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index aff410eb..45dfa7c6 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -194,5 +194,9 @@
"name_on_card_hint": "Navn på kort",
"card_number_hint": "Kortnummer",
"expiry_date_hint": "Udløbsdato",
- "cvc_hint": "CVC"
+ "cvc_hint": "CVC",
+ "remove_guest": "Fjern gæst",
+ "remove_guests": "Fjern gæster",
+ "are_you_sure": "Er du sikker?",
+ "guest_removal_responsibility": "Du vil være ansvarlig for alle køb på værelset ved udtjekning (316 kr.)"
}
\ 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 831df6e6..51ea23dc 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -194,5 +194,9 @@
"name_on_card_hint": "Name on card",
"card_number_hint": "Card number",
"expiry_date_hint": "Expiry date",
- "cvc_hint": "CVC"
+ "cvc_hint": "CVC",
+ "remove_guest": "Remove guest",
+ "remove_guests": "Remove guests",
+ "are_you_sure": "Are you sure?",
+ "guest_removal_responsibility": "You will be responsible for all things purchased on the room at checkout "
}
\ No newline at end of file
diff --git a/comwell_key_app/lib/booking_details/components/share_button.dart b/comwell_key_app/lib/booking_details/components/share_button.dart
index 1be4fe65..3722cdbf 100644
--- a/comwell_key_app/lib/booking_details/components/share_button.dart
+++ b/comwell_key_app/lib/booking_details/components/share_button.dart
@@ -146,7 +146,6 @@ class ShareButton extends StatelessWidget {
elevation: 0),
child: const Icon(Icons.close, color: Colors.black),
onPressed: () {
- cubit.clearSelection();
Navigator.pop(bottomSheetContext);
},
),
@@ -178,8 +177,22 @@ class ShareButton extends StatelessWidget {
width: double.infinity,
child: ElevatedButton(
onPressed: state.selectedGuests.isNotEmpty
- ? () {
- context.pop(state.selectedGuests);
+ ? () async {
+ final shouldRemove =
+ await showDialog<bool>(
+ context: bottomSheetContext,
+ builder: (context) =>
+ _buildRemoveGuestDialog(
+ context,
+ cubit,
+ bottomSheetContext,
+ state.selectedGuests,
+ ),
+ );
+
+ if (shouldRemove == true) {
+ context.pop(state.selectedGuests);
+ }
}
: null,
style: ElevatedButton.styleFrom(
@@ -211,4 +224,94 @@ class ShareButton extends StatelessWidget {
},
);
}
+
+ Widget _buildRemoveGuestDialog(
+ BuildContext context,
+ ShareBookingCubit cubit,
+ BuildContext bottomSheetContext,
+ List<String> selectedGuests,
+ ) {
+ return AlertDialog(
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(8.0),
+ ),
+ contentPadding: const EdgeInsets.all(24.0),
+ backgroundColor: Colors.white,
+ title: Center(
+ child: Text(
+ 'are_you_sure'.tr(),
+ style: const TextStyle(
+ fontSize: 20,
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ ),
+ content: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ 'guest_removal_responsibility'.tr(),
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ fontSize: 16,
+ color: Colors.grey[500],
+ ),
+ ),
+ const SizedBox(height: 16),
+ SizedBox(
+ width: double.infinity,
+ child: ElevatedButton(
+ onPressed: () {
+ Navigator.pop(bottomSheetContext, true);
+ },
+ style: ElevatedButton.styleFrom(
+ backgroundColor: Colors.white,
+ side: BorderSide(color: Colors.grey[300]!, width: 1),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(25),
+ ),
+ elevation: 0,
+ padding: const EdgeInsets.symmetric(vertical: 16),
+ ),
+ child: Text(
+ selectedGuests.length > 1
+ ? 'remove_guests'.tr()
+ : 'remove_guest'.tr(),
+ style: const TextStyle(
+ color: Colors.black,
+ fontSize: 16,
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(height: 12),
+ SizedBox(
+ width: double.infinity,
+ child: ElevatedButton(
+ onPressed: () {
+ Navigator.pop(bottomSheetContext, false);
+ },
+ style: ElevatedButton.styleFrom(
+ backgroundColor: sandColor,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(25),
+ ),
+ padding: const EdgeInsets.symmetric(vertical: 16),
+ ),
+ child: Text(
+ 'cancel'.tr(),
+ style: const TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ actions: const [],
+ );
+ }
}