6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit c60bb25d

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-10-24 15:25:47 +0200
Fixed bug on share button

Changed files

.../booking_details/components/share_button.dart   | 202 ++++++++++-----------
 1 file changed, 100 insertions(+), 102 deletions(-)

Diff

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 0b644973..8c90f2fb 100644
--- a/comwell_key_app/lib/booking_details/components/share_button.dart
+++ b/comwell_key_app/lib/booking_details/components/share_button.dart
@@ -40,7 +40,8 @@ class ShareButton extends StatelessWidget {
child: Stack(
children: [
Positioned(
- left: (numberOfUsers - 1) * (userButtonSize - userButtonOverlap) +
+ left: (numberOfUsers - 1) *
+ (userButtonSize - userButtonOverlap) +
userButtonSize -
userButtonOverlap,
child: SizedBox(
@@ -58,7 +59,8 @@ class ShareButton extends StatelessWidget {
padding: EdgeInsets.zero,
),
child: Center(
- child: Icon(Icons.add, color: colorHeadlineText, size: 30),
+ child:
+ Icon(Icons.add, color: colorHeadlineText, size: 30),
),
),
),
@@ -118,6 +120,7 @@ class ShareButton extends StatelessWidget {
return showModalBottomSheet<dynamic>(
context: context,
backgroundColor: Colors.white,
+ isScrollControlled: true,
builder: (BuildContext bottomSheetContext) {
return BlocProvider(
create: (context) => ShareBookingCubit(),
@@ -125,64 +128,63 @@ class ShareButton extends StatelessWidget {
listener: (context, state) {},
builder: (context, state) {
final cubit = context.read<ShareBookingCubit>();
- 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
- .where((guest) => guest.name != booker)
- .map((guest) => guest.name),
- selectedGuests: state.selectedGuests,
- onGuestSelected: (Iterable<String> newSelection) {
- cubit.updateSelectedGuests(newSelection);
- },
+ return SafeArea(
+ child: SizedBox(
+ width: double.infinity,
+ height: 450,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ 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: sandColor[40],
+ shape: const CircleBorder(),
+ elevation: 0,
+ minimumSize:
+ const Size(40, 40)),
+ child: const Icon(Icons.close, color: Colors.black),
+ onPressed: () {
+ Navigator.pop(bottomSheetContext);
+ },
+ ),
+ ],
+ ),
),
- ),
- Column(
- children: [
- Divider(
- height: 1,
- color: Colors.grey.shade300,
+ const SizedBox(height: 16),
+ Expanded(
+ child: GuestList(
+ guests: guests
+ .where((guest) => guest.name != booker)
+ .map((guest) => guest.name),
+ selectedGuests: state.selectedGuests,
+ onGuestSelected: (Iterable<String> newSelection) {
+ cubit.updateSelectedGuests(newSelection);
+ },
),
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: SizedBox(
- width: double.infinity,
+ ),
+ Column(
+ children: [
+ Divider(
+ height: 1,
+ color: Colors.grey.shade300,
+ ),
+ Padding(
+ padding: const EdgeInsets.all(16.0),
child: ElevatedButton(
onPressed: state.selectedGuests.isNotEmpty
? () async {
- final shouldRemove =
- await showDialog<bool>(
+ final shouldRemove = await showDialog<bool>(
context: bottomSheetContext,
builder: (context) =>
_buildRemoveGuestDialog(
@@ -192,7 +194,7 @@ class ShareButton extends StatelessWidget {
state.selectedGuests,
),
);
-
+
if (shouldRemove == true &&
context.mounted) {
context.pop(state.selectedGuests);
@@ -216,10 +218,10 @@ class ShareButton extends StatelessWidget {
),
),
),
- ),
- ],
- ),
- ],
+ ],
+ ),
+ ],
+ ),
),
);
},
@@ -262,54 +264,50 @@ class ShareButton extends StatelessWidget {
),
),
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),
+ 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),
),
- child: Text(
- selectedGuests.length > 1
- ? 'remove_guests'.tr()
- : 'remove_guest'.tr(),
- style: const TextStyle(
- color: Colors.black,
- fontSize: 16,
- fontWeight: FontWeight.w500,
- ),
+ elevation: 0,
+ padding: const EdgeInsets.symmetric(vertical: 16),
+ minimumSize: const Size.fromHeight(50),
+ ),
+ 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),
+ ElevatedButton(
+ onPressed: () {
+ Navigator.pop(bottomSheetContext, false);
+ },
+ style: ElevatedButton.styleFrom(
+ backgroundColor: sandColor,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(25),
),
- child: Text(
- 'cancel'.tr(),
- style: const TextStyle(
- color: Colors.white,
- fontSize: 16,
- fontWeight: FontWeight.w500,
- ),
+ padding: const EdgeInsets.symmetric(vertical: 16),
+ minimumSize: const Size.fromHeight(50),
+ ),
+ child: Text(
+ 'cancel'.tr(),
+ style: const TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ fontWeight: FontWeight.w500,
),
),
),