6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 8999386a

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-04-08 11:39:00 +0200
1453: Finished implementing the UI for the share room functionality.

Changed files

comwell_key_app/.gitignore                         |   1 +
 comwell_key_app/assets/translations/da-DK.json     |   3 +-
 comwell_key_app/assets/translations/en-US.json     |   3 +-
 .../booking_details/bloc/booking_details_bloc.dart |  19 ++-
 .../bloc/booking_details_event.dart                |   9 +
 .../bloc/booking_details_state.dart                |  17 +-
 .../lib/booking_details/booking_details_page.dart  |   4 +-
 .../booking_details_repository.dart                |  16 +-
 .../lib/booking_details/components/guest_list.dart | 114 +++++++++++++
 .../booking_details/components/share_button.dart   | 189 +++++++++++++--------
 comwell_key_app/lib/overview/models/booking.dart   |  51 +++++-
 .../overview/repository/overview_repository.dart   |   5 +-
 .../lib/share/components/guest_list.dart           |  90 ----------
 13 files changed, 350 insertions(+), 171 deletions(-)

Diff

diff --git a/comwell_key_app/.gitignore b/comwell_key_app/.gitignore
index 67967dc2..3ccc15f0 100644
--- a/comwell_key_app/.gitignore
+++ b/comwell_key_app/.gitignore
@@ -4,6 +4,7 @@
*.pyc
*.swp
.DS_Store
+comwell-app/.DS_Store
.atom/
.build/
.buildlog/
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index 63692ba7..297f1dcf 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -184,5 +184,6 @@
"share_booking_page_title": "Del ophold",
"share_booking_page_subtitle": "Her kan du dele dit ophold med en anden gæst og give dem adgang til bookinginformation, nøglekort og Concierge",
"share_booking_page_share_button": "Del dit ophold",
- "handle_guests_title": "Håndter gæster"
+ "handle_guests_title": "Håndter gæster",
+ "cancel_sharing": "Fortryd deling"
}
\ 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 71ce2676..6c866832 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -184,5 +184,6 @@
"share_booking_page_title": "Share booking",
"share_booking_page_subtitle": "Here you can share your booking with another guest and give them access to booking information, keycard and Concierge",
"share_booking_page_share_button": "Share your booking",
- "handle_guests_title": "Handle guests"
+ "handle_guests_title": "Handle guests",
+ "cancel_sharing": "Cancel sharing"
}
\ No newline at end of file
diff --git a/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart b/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
index 0fb9a515..bc1865b7 100644
--- a/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
+++ b/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
@@ -1,5 +1,6 @@
import 'package:bloc/bloc.dart';
import 'package:comwell_key_app/database/comwell_db.dart';
+import 'package:comwell_key_app/overview/models/guest.dart';
import 'package:comwell_key_app/utils/seos_repository.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
@@ -19,12 +20,11 @@ class BookingDetailsBloc
final BookingDetailsRepository bookingDetailsRepository;
final SeosRepository seosRepository = locator<SeosRepository>();
- final ComwellDatabase database = locator<ComwellDatabase>();
BookingDetailsBloc(
this.booking, {
required this.bookingDetailsRepository,
- }) : super(BookingDetailsState.initial()) {
+ }) : super(BookingDetailsState.initial(booking)) {
on<InitialEvent>((event, emit) async {
try {
await checkIfHouseKeepingOrdered(emit);
@@ -38,6 +38,10 @@ class BookingDetailsBloc
on<CheckIfHouseKeepingOrdered>((event, emit) async {
await checkIfHouseKeepingOrdered(emit);
});
+
+ on<UpdateBookingEvent>((event, emit) async {
+ await updateBooking(emit, booking, event);
+ });
}
Future<void> checkMobileKeys(Emitter<BookingDetailsState> emit) async {
@@ -60,4 +64,15 @@ class BookingDetailsBloc
emit(state.houseKeepingOrdered());
}
}
+
+ Future<void> updateBooking(Emitter<BookingDetailsState> emit, Booking booking,
+ UpdateBookingEvent event) async {
+ try {
+ //TODO: add this when we have the backend
+ // await bookingDetailsRepository.updateBooking(event.booking);
+ emit(state.updateGuests(event.booking.guests ?? []));
+ } catch (e) {
+ emit(state.setupError());
+ }
+ }
}
diff --git a/comwell_key_app/lib/booking_details/bloc/booking_details_event.dart b/comwell_key_app/lib/booking_details/bloc/booking_details_event.dart
index fa4f99ab..b00ffa74 100644
--- a/comwell_key_app/lib/booking_details/bloc/booking_details_event.dart
+++ b/comwell_key_app/lib/booking_details/bloc/booking_details_event.dart
@@ -19,3 +19,12 @@ final class ProvisionKeyEvent extends BookingDetailsEvent {
@override
List<Object> get props => [bookingId];
}
+
+final class UpdateBookingEvent extends BookingDetailsEvent {
+ final Booking booking;
+
+ const UpdateBookingEvent(this.booking);
+
+ @override
+ List<Object> get props => [booking];
+}
diff --git a/comwell_key_app/lib/booking_details/bloc/booking_details_state.dart b/comwell_key_app/lib/booking_details/bloc/booking_details_state.dart
index d60cc3ad..6d8d3b55 100644
--- a/comwell_key_app/lib/booking_details/bloc/booking_details_state.dart
+++ b/comwell_key_app/lib/booking_details/bloc/booking_details_state.dart
@@ -5,19 +5,22 @@ class BookingDetailsState extends Equatable {
final BookingDetailsStatus status;
final MobileKeysKey? key;
final List<MobileKeysKey> keys;
+ final List<Guest> guests;
const BookingDetailsState._(
{required this.status,
required this.key,
required this.keys,
- required this.isHouseKeepingOrdered});
+ required this.isHouseKeepingOrdered,
+ required this.guests});
- BookingDetailsState.initial()
+ BookingDetailsState.initial(Booking booking)
: this._(
status: BookingDetailsStatus.initial,
key: null,
keys: [],
- isHouseKeepingOrdered: false);
+ isHouseKeepingOrdered: false,
+ guests: booking.guests ?? []);
BookingDetailsState setupError() =>
copyWith(status: BookingDetailsStatus.setupError);
BookingDetailsState updateKeys(List<MobileKeysKey> keys) =>
@@ -25,16 +28,20 @@ class BookingDetailsState extends Equatable {
BookingDetailsState houseKeepingOrdered() => copyWith(
status: BookingDetailsStatus.houseKeepingOrdered,
isHouseKeepingOrdered: true);
+ BookingDetailsState updateGuests(List<Guest> guests) =>
+ copyWith(status: BookingDetailsStatus.guestsUpdated, guests: guests);
+
BookingDetailsState main() => copyWith(status: BookingDetailsStatus.main);
@override
- List<Object?> get props => [status];
+ List<Object?> get props => [status, guests];
BookingDetailsState copyWith({
BookingDetailsStatus? status,
MobileKeysKey? key,
List<MobileKeysKey>? keys,
bool? isHouseKeepingOrdered,
+ List<Guest>? guests,
}) {
return BookingDetailsState._(
status: status ?? this.status,
@@ -42,6 +49,7 @@ class BookingDetailsState extends Equatable {
keys: keys ?? this.keys,
isHouseKeepingOrdered:
isHouseKeepingOrdered ?? this.isHouseKeepingOrdered,
+ guests: guests ?? this.guests,
);
}
@@ -55,6 +63,7 @@ enum BookingDetailsStatus {
initial,
setupError,
keysUpdated,
+ guestsUpdated,
main,
houseKeepingOrdered
}
diff --git a/comwell_key_app/lib/booking_details/booking_details_page.dart b/comwell_key_app/lib/booking_details/booking_details_page.dart
index da5d7a1f..43b68c59 100644
--- a/comwell_key_app/lib/booking_details/booking_details_page.dart
+++ b/comwell_key_app/lib/booking_details/booking_details_page.dart
@@ -43,8 +43,8 @@ class BookingDetailsPage extends StatelessWidget {
child: Stack(
alignment: Alignment.center,
children: [
- const SafeArea(
- child: ShareButton(),
+ SafeArea(
+ child: ShareButton(guests: state.guests),
),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
diff --git a/comwell_key_app/lib/booking_details/booking_details_repository.dart b/comwell_key_app/lib/booking_details/booking_details_repository.dart
index 3753498e..52221ec0 100644
--- a/comwell_key_app/lib/booking_details/booking_details_repository.dart
+++ b/comwell_key_app/lib/booking_details/booking_details_repository.dart
@@ -1,13 +1,19 @@
+import 'package:comwell_key_app/database/comwell_db.dart';
import 'package:comwell_key_app/housekeeping/housekeeping_repository.dart';
+import 'package:comwell_key_app/overview/models/booking.dart';
+import 'package:comwell_key_app/overview/models/guest.dart';
import 'package:comwell_key_app/services/api.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'package:comwell_key_app/utils/secure_storage.dart';
class BookingDetailsRepository {
final api = Api();
final secureStorage = SecureStorage();
+ final ComwellDatabase database = locator<ComwellDatabase>();
Future<bool> isHousesKeepingOrdered() async {
- final lastOrderedValue = await secureStorage.read(HouseKeepingRepository.houseKeepingLastOrderedKey);
+ final lastOrderedValue = await secureStorage
+ .read(HouseKeepingRepository.houseKeepingLastOrderedKey);
if (lastOrderedValue != null) {
final lastOrdered =
DateTime.fromMillisecondsSinceEpoch(int.parse(lastOrderedValue));
@@ -23,4 +29,12 @@ class BookingDetailsRepository {
Future<String?> doesInvitationCodeExist(String key) async {
return await secureStorage.read(key);
}
+
+ Future<Booking> updateBooking(
+ Booking booking,
+ ) async {
+ //await api.updateBooking(booking);
+ await database.bookingsDao.insert([booking], booking.status);
+ return booking;
+ }
}
diff --git a/comwell_key_app/lib/booking_details/components/guest_list.dart b/comwell_key_app/lib/booking_details/components/guest_list.dart
new file mode 100644
index 00000000..2caa57cc
--- /dev/null
+++ b/comwell_key_app/lib/booking_details/components/guest_list.dart
@@ -0,0 +1,114 @@
+import 'package:flutter/material.dart';
+
+class GuestList extends StatefulWidget {
+ final List<String> guests;
+ final Function(List<String>) onGuestSelected;
+ final String? selectedGuest;
+
+ const GuestList({
+ super.key,
+ required this.guests,
+ required this.onGuestSelected,
+ this.selectedGuest,
+ });
+
+ @override
+ State<GuestList> createState() => _GuestListState();
+}
+
+class _GuestListState extends State<GuestList> {
+ List<String> selectedGuests = [];
+
+ @override
+ void initState() {
+ super.initState();
+ if (widget.selectedGuest != null) {
+ selectedGuests = [widget.selectedGuest!];
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return SingleChildScrollView(
+ child: ListView.builder(
+ shrinkWrap: true,
+ itemCount: widget.guests.length,
+ itemBuilder: (context, index) {
+ final guest = widget.guests[index];
+ final initials = guest.split(' ').map((name) => name[0]).join('');
+
+ return Padding(
+ padding:
+ const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
+ child: GestureDetector(
+ onTap: () {
+ setState(() {
+ if (selectedGuests.contains(guest)) {
+ selectedGuests.remove(guest);
+ } else {
+ selectedGuests.add(guest);
+ }
+ });
+ widget.onGuestSelected(selectedGuests);
+ },
+ child: Container(
+ decoration: BoxDecoration(
+ border: Border.all(
+ color: Colors.grey[300]!,
+ width: 1.0,
+ ),
+ borderRadius: BorderRadius.circular(8.0),
+ ),
+ padding: const EdgeInsets.all(12.0),
+ child: Row(
+ children: [
+ Container(
+ width: 40,
+ height: 40,
+ decoration: const BoxDecoration(
+ color: Colors.black,
+ shape: BoxShape.circle,
+ ),
+ child: Center(
+ child: Text(
+ initials,
+ style: const TextStyle(
+ color: Colors.white,
+ fontWeight: FontWeight.w400,
+ fontSize: 16,
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(width: 16),
+ Expanded(
+ child: Text(
+ guest,
+ style: Theme.of(context).textTheme.bodyLarge,
+ ),
+ ),
+ Checkbox(
+ value: selectedGuests.contains(guest),
+ onChanged: (bool? value) {
+ if (value != null) {
+ setState(() {
+ if (value) {
+ selectedGuests.add(guest);
+ } else {
+ selectedGuests.remove(guest);
+ }
+ });
+ widget.onGuestSelected(selectedGuests);
+ }
+ },
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ },
+ ),
+ );
+ }
+}
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 75d6fae2..6bb3308b 100644
--- a/comwell_key_app/lib/booking_details/components/share_button.dart
+++ b/comwell_key_app/lib/booking_details/components/share_button.dart
@@ -1,7 +1,8 @@
import 'package:comwell_key_app/booking_details/bloc/booking_details_bloc.dart';
-import 'package:comwell_key_app/common/components/bottom_sheet_widget.dart';
+import 'package:comwell_key_app/overview/models/booking.dart';
+import 'package:comwell_key_app/overview/models/guest.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
-import 'package:comwell_key_app/share/components/guest_list.dart';
+import 'package:comwell_key_app/booking_details/components/guest_list.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@@ -9,26 +10,29 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
class ShareButton extends StatelessWidget {
- const ShareButton({super.key});
+ final List<Guest> guests;
+ const ShareButton({super.key, required this.guests});
@override
Widget build(BuildContext context) {
final booking = context.read<BookingDetailsBloc>().booking;
- final theme = Theme.of(context);
+ final bloc = context.read<BookingDetailsBloc>();
+
const userButtonWidth = 50.0;
const userButtonOverlap =
15.0; // How much each button overlaps the previous one
- final numberOfUsers =
- (booking.guests?.length ?? 0) + 1; // Add 1 for the booker
+ final numberOfUsers = 1 + (guests.length); // Add 1 for the booker
final bookerInitials =
booking.booker.split(' ').map((name) => name[0]).join('');
- final guestInitials = booking.guests
- ?.map((guest) =>
- guest.name.split(' ').map((name) => name[0]).join(''))
- .toList() ??
- [];
+ final guestInitials = guests
+ .map((guest) => guest.name.split(' ').map((name) => name[0]).join(''))
+ .toList();
+
+ // Combine initials with booker first
+ final allInitials = [bookerInitials, ...guestInitials];
return Stack(
+ key: Key(guests.length.toString()),
children: [
Align(
alignment: Alignment.topLeft,
@@ -70,59 +74,15 @@ class ShareButton extends StatelessWidget {
width: userButtonWidth,
height: userButtonWidth,
child: ElevatedButton(
- onPressed: () {
- showModalBottomSheet<void>(
- context: context,
- backgroundColor: Colors.white,
- builder: (BuildContext context) {
- return SizedBox(
- height: 450,
- width: MediaQuery.of(context).size.width,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisSize: MainAxisSize.min,
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- Text('handle_guests_title'.tr(),
- style: theme.textTheme.titleLarge
- ?.copyWith(
- color: Colors.black,
- fontWeight: FontWeight.w600,
- )),
- ElevatedButton(
- style: ElevatedButton.styleFrom(
- backgroundColor:
- Colors.grey[200],
- shape: const CircleBorder(),
- elevation: 0),
- child: const Icon(Icons.close,
- color: Colors.black),
- onPressed: () =>
- Navigator.pop(context),
- ),
- ],
- ),
- ),
- const SizedBox(height: 16),
- GuestList(
- guests: booking.guests
- ?.map((guest) => guest.name)
- .toList() ??
- [],
- onGuestSelected: (guest) {},
- selectedGuest: booking.booker,
- ),
- ],
- ),
- );
- },
- );
+ onPressed: () async {
+ final results =
+ await _showGuestList(context, index, guests);
+
+ if (results is List<String>) {
+ final updatedBooking =
+ booking.updateGuests(results);
+ bloc.add(UpdateBookingEvent(updatedBooking));
+ }
},
style: ElevatedButton.styleFrom(
backgroundColor:
@@ -133,9 +93,7 @@ class ShareButton extends StatelessWidget {
),
child: Center(
child: Text(
- index == 0
- ? bookerInitials
- : guestInitials[index - 1],
+ allInitials[index],
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.w400,
@@ -154,4 +112,101 @@ class ShareButton extends StatelessWidget {
],
);
}
+
+ Future<dynamic> _showGuestList(
+ BuildContext context, int index, List<Guest> guests) async {
+ final theme = Theme.of(context);
+ List<String> selectedGuests = [];
+
+ return showModalBottomSheet<dynamic>(
+ context: context,
+ backgroundColor: Colors.white,
+ builder: (BuildContext bottomSheetContext) {
+ return StatefulBuilder(
+ builder: (BuildContext statefulContext, StateSetter setState) {
+ return SizedBox(
+ height: 450,
+ width: MediaQuery.of(context).size.width,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: <Widget>[
+ Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text('handle_guests_title'.tr(),
+ style: theme.textTheme.titleLarge?.copyWith(
+ color: Colors.black,
+ fontWeight: FontWeight.w600,
+ )),
+ ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ backgroundColor: Colors.grey[200],
+ shape: const CircleBorder(),
+ elevation: 0),
+ child: const Icon(Icons.close, color: Colors.black),
+ onPressed: () => Navigator.pop(bottomSheetContext),
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(height: 16),
+ Expanded(
+ child: GuestList(
+ guests: guests.map((guest) => guest.name).toList(),
+ onGuestSelected: (guests) {
+ setState(() {
+ selectedGuests = guests;
+ });
+ },
+ selectedGuest: null,
+ ),
+ ),
+ Column(
+ children: [
+ Divider(
+ height: 1,
+ color: Colors.grey[300],
+ ),
+ Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: SizedBox(
+ width: double.infinity,
+ child: ElevatedButton(
+ onPressed: selectedGuests.isNotEmpty
+ ? () {
+ context.pop(selectedGuests);
+ }
+ : null,
+ style: ElevatedButton.styleFrom(
+ backgroundColor: selectedGuests.isNotEmpty
+ ? Colors.black
+ : Colors.grey[200],
+ minimumSize: const Size.fromHeight(50),
+ elevation: 0,
+ ),
+ child: Text(
+ 'cancel_sharing'.tr(),
+ style: TextStyle(
+ color: selectedGuests.isNotEmpty
+ ? Colors.white
+ : Colors.grey[500],
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ );
+ },
+ );
+ },
+ );
+ }
}
diff --git a/comwell_key_app/lib/overview/models/booking.dart b/comwell_key_app/lib/overview/models/booking.dart
index 3cd9dd32..c3cde66b 100644
--- a/comwell_key_app/lib/overview/models/booking.dart
+++ b/comwell_key_app/lib/overview/models/booking.dart
@@ -24,6 +24,7 @@ class Booking extends Equatable {
final DateTime bookingDate;
final PaymentDetails paymentDetails;
final String confirmationId;
+ // TODO: Should this be here or is it a separate endpoint?
final List<Guest>? guests;
const Booking({
@@ -43,7 +44,7 @@ class Booking extends Equatable {
required this.booker,
required this.bookingDate,
required this.paymentDetails,
- this.guests,
+ required this.guests,
});
factory Booking.fromJson(Json json) => _$BookingFromJson(json);
@@ -69,6 +70,54 @@ class Booking extends Equatable {
paymentDetails,
guests,
];
+
+ Booking copyWith({
+ String? id,
+ String? userId,
+ String? roomNumber,
+ DateTime? startDate,
+ DateTime? endDate,
+ BookingStatus? status,
+ String? image,
+ String? hotelName,
+ String? hotelCode,
+ String? roomType,
+ int? adults,
+ int? children,
+ String? booker,
+ DateTime? bookingDate,
+ PaymentDetails? paymentDetails,
+ String? confirmationId,
+ List<Guest>? guests,
+ }) {
+ return Booking(
+ id: id ?? this.id,
+ userId: userId ?? this.userId,
+ roomNumber: roomNumber ?? this.roomNumber,
+ startDate: startDate ?? this.startDate,
+ endDate: endDate ?? this.endDate,
+ status: status ?? this.status,
+ image: image ?? this.image,
+ hotelName: hotelName ?? this.hotelName,
+ hotelCode: hotelCode ?? this.hotelCode,
+ roomType: roomType ?? this.roomType,
+ adults: adults ?? this.adults,
+ children: children ?? this.children,
+ booker: booker ?? this.booker,
+ bookingDate: bookingDate ?? this.bookingDate,
+ paymentDetails: paymentDetails ?? this.paymentDetails,
+ confirmationId: confirmationId ?? this.confirmationId,
+ guests: guests ?? this.guests,
+ );
+ }
+
+ Booking updateGuests(List<String> guestNames) {
+ if (guests == null) return this;
+
+ final updatedGuests =
+ guests!.where((guest) => !guestNames.contains(guest.name)).toList();
+ return copyWith(guests: updatedGuests);
+ }
}
enum BookingStatus {
diff --git a/comwell_key_app/lib/overview/repository/overview_repository.dart b/comwell_key_app/lib/overview/repository/overview_repository.dart
index 2c554d4f..fcd2d185 100644
--- a/comwell_key_app/lib/overview/repository/overview_repository.dart
+++ b/comwell_key_app/lib/overview/repository/overview_repository.dart
@@ -67,13 +67,14 @@ final response = {
"hotelName": "Seaside Resort",
"hotelCode": "CBO",
"roomType": "Deluxe",
- "adults": 2,
+ "adults": 3,
"children": 1,
"confirmationId": "",
"booker": "John Doe",
"bookingDate": "2024-10-15T14:00:00",
"guests": [
- {"name": "John Smith", "id": "123"}
+ {"name": "John Smith", "id": "123"},
+ {"name": "Jane Smith", "id": "124"}
],
"paymentDetails": {
"cardHolder": "John Doe",
diff --git a/comwell_key_app/lib/share/components/guest_list.dart b/comwell_key_app/lib/share/components/guest_list.dart
deleted file mode 100644
index c376d92b..00000000
--- a/comwell_key_app/lib/share/components/guest_list.dart
+++ /dev/null
@@ -1,90 +0,0 @@
-import 'package:flutter/material.dart';
-
-class GuestList extends StatefulWidget {
- final List<String> guests;
- final Function(String) onGuestSelected;
- final String? selectedGuest;
-
- const GuestList({
- super.key,
- required this.guests,
- required this.onGuestSelected,
- this.selectedGuest,
- });
-
- @override
- State<GuestList> createState() => _GuestListState();
-}
-
-class _GuestListState extends State<GuestList> {
- @override
- Widget build(BuildContext context) {
- return SingleChildScrollView(
- child: ListView.builder(
- shrinkWrap: true,
- itemCount: widget.guests.length,
- itemBuilder: (context, index) {
- final guest = widget.guests[index];
- final initials = guest.split(' ').map((name) => name[0]).join('');
-
- return Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
- child: Container(
- decoration: BoxDecoration(
- border: Border.all(
- color: Colors.grey[300]!,
- width: 1.0,
- ),
- borderRadius: BorderRadius.circular(8.0),
- ),
- padding: const EdgeInsets.all(12.0),
- child: Row(
- children: [
- // Initials circle
- Container(
- width: 40,
- height: 40,
- decoration: const BoxDecoration(
- color: Colors.black,
- shape: BoxShape.circle,
- ),
- child: Center(
- child: Text(
- initials,
- style: const TextStyle(
- color: Colors.white,
- fontWeight: FontWeight.w400,
- fontSize: 16,
- ),
- ),
- ),
- ),
- const SizedBox(width: 16),
-
- // Guest name
- Expanded(
- child: Text(
- guest,
- style: Theme.of(context).textTheme.bodyLarge,
- ),
- ),
- // Radio button
- Radio<String>(
- value: guest,
- groupValue: widget.selectedGuest,
- onChanged: (String? value) {
- if (value != null) {
- widget.onGuestSelected(value);
- }
- },
- ),
- ],
- ),
- ),
- );
- },
- ),
- );
- }
-}