6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 8eb908c3
Changed files
.../booking_details/bloc/booking_details_bloc.dart | 25 +++++++-- .../bloc/booking_details_event.dart | 2 + .../lib/booking_details/booking_details_page.dart | 16 +++--- .../components/booking_details_bottom_sheet.dart | 10 ++-- .../components/check_in_button.dart | 12 ----- .../components/check_in_button_timer.dart | 57 ++++++++++---------- .../components/preregister_button.dart | 35 ++++--------- .../components/room_number_container.dart | 2 +- .../lib/check_out/bloc/check_out_cubit.dart | 14 +++++ .../lib/common/components/generic_dialog.dart | 10 ++-- comwell_key_app/lib/common/const.dart | 1 + .../lib/contact/components/call_us_section.dart | 13 +++-- .../components/get_a_phone_call_section.dart | 30 ++++++----- comwell_key_app/lib/contact/contact_page.dart | 60 +++++++++++++--------- .../lib/contact/cubit/contact_cubit.dart | 24 ++++++++- .../lib/contact/cubit/contact_state.dart | 20 ++++++-- .../components/balance_bottom_sheet.dart | 53 +++++++++++-------- .../lib/notifications/notifications_page.dart | 14 ++--- .../payment_cards/bloc/payment_cards_cubit.dart | 2 +- .../pregistration/bloc/preregistration_cubit.dart | 14 +---- .../pregistration/pages/prereg_profile_page.dart | 6 +-- .../lib/pregistration/preregistration_flow.dart | 33 +----------- comwell_key_app/lib/pregistration/utils/utils.dart | 35 +++++++++++++ .../comwell_club_signup_bottom_sheet.dart | 16 +++--- .../profile/components/logout_dialog_widget.dart | 11 ++-- .../profile/components/profile_page_widget.dart | 5 +- .../lib/profile/profile_repository.dart | 2 +- .../components/address_bottom_sheet.dart | 8 +-- comwell_key_app/lib/routing/app_router.dart | 17 ++++-- comwell_key_app/lib/services/api.dart | 17 +++--- comwell_key_app/lib/services/http_client.dart | 2 +- comwell_key_app/lib/themes/dark_theme.dart | 13 +++++ comwell_key_app/lib/themes/light_theme.dart | 13 +++++ comwell_key_app/lib/utils/locator.dart | 2 + 34 files changed, 339 insertions(+), 255 deletions(-)
Diff
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 6b1c2a4b..2c8b42c4 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
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:comwell_key_app/overview/models/guest.dart';
import 'package:comwell_key_app/profile/profile_repository.dart';
+import 'package:comwell_key_app/profile_settings/model/user.dart';
import 'package:comwell_key_app/utils/seos_repository.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
@@ -19,12 +20,12 @@ part 'booking_details_state.dart';
class BookingDetailsBloc
extends Bloc<BookingDetailsEvent, BookingDetailsState> {
late Booking booking;
+ late User user;
Timer? _timer;
final BookingDetailsRepository bookingDetailsRepository;
final ProfileRepository profileRepository;
final SeosRepository seosRepository = locator<SeosRepository>();
Duration _remainingTime = Duration.zero;
-
BookingDetailsBloc(
this.booking, {
@@ -38,7 +39,9 @@ class BookingDetailsBloc
add(CheckIfHouseKeepingOrdered());
add(CheckMobileKeys());
add(GetBookingDetailsEvent(booking.confirmationId));
+ add(GetUserEvent());
add(UpdateRemainingEvent(getCheckInTime().difference(DateTime.now())));
+
} catch (e, st) {
if (kDebugMode) print("err=$e, $st");
emit(state.setupError());
@@ -64,6 +67,11 @@ class BookingDetailsBloc
on<GetBookingDetailsEvent>((event, emit) async {
await getBookingDetails(emit, event.bookingId);
});
+
+ on<GetUserEvent>((event, emit) async {
+
+ await getUser(emit);
+ });
}
Future<Booking> getBookingDetails(
@@ -71,6 +79,7 @@ class BookingDetailsBloc
try {
final bookingDetails =
await profileRepository.getBookingDetails(bookingId);
+ booking = bookingDetails;
emit(state.copyWith(status: BookingDetailsStatus.main));
return bookingDetails;
} catch (e) {
@@ -117,7 +126,8 @@ class BookingDetailsBloc
_timer?.cancel();
_timer = Timer.periodic(
const Duration(seconds: 1),
- (_) => add(UpdateRemainingEvent(getCheckInTime().difference(DateTime.now()))),
+ (_) => add(
+ UpdateRemainingEvent(getCheckInTime().difference(DateTime.now()))),
);
}
@@ -131,9 +141,8 @@ class BookingDetailsBloc
final now = DateTime.now();
_remainingTime = getCheckInTime().difference(now);
-
emit(state.updateRemainingTime(_remainingTime));
-
+
if (_remainingTime.isNegative) {
_timer?.cancel();
emit(state.updateRemainingTime(_remainingTime));
@@ -142,4 +151,12 @@ class BookingDetailsBloc
//TODO add checkin time from backend when we have it
DateTime getCheckInTime() => booking.startDate.add(const Duration(hours: 15));
+
+ Future<void> getUser(Emitter<BookingDetailsState> emit) async {
+ user = await profileRepository.fetchProfileSettings();
+ print("DEBUG: GetUserEvent");
+ print("DEBUG: user: ${user.phoneNumber}");
+ }
}
+
+
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 f12eec4a..5087319f 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
@@ -20,6 +20,8 @@ final class GetBookingDetailsEvent extends BookingDetailsEvent {
List<Object> get props => [bookingId];
}
+final class GetUserEvent extends BookingDetailsEvent {}
+
final class CheckMobileKeys extends BookingDetailsEvent {}
final class UpdateRemainingEvent extends BookingDetailsEvent {
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 43d40271..6c2eb898 100644
--- a/comwell_key_app/lib/booking_details/booking_details_page.dart
+++ b/comwell_key_app/lib/booking_details/booking_details_page.dart
@@ -3,10 +3,7 @@ import 'package:comwell_key_app/booking_details/components/check_in_button_timer
import 'package:comwell_key_app/booking_details/components/preregister_button.dart';
import 'package:comwell_key_app/booking_details/components/room_number_container.dart';
import 'package:comwell_key_app/booking_details/components/share_button.dart';
-import 'package:comwell_key_app/common/components/bottom_sheet_widget.dart';
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
-import 'package:comwell_key_app/booking_details/components/housekeeping_button.dart';
-import 'package:comwell_key_app/booking_details/components/practical_information_button.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
@@ -16,7 +13,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'bloc/booking_details_bloc.dart';
-import 'components/check_out_button.dart';
import 'components/unlock_room_button.dart';
class BookingDetailsPage extends StatelessWidget {
@@ -99,10 +95,12 @@ class BookingDetailsPage extends StatelessWidget {
const SizedBox(height: 10),
if (state.keys.isNotEmpty && cubit.booking.roomNumber != '')
const UnlockRoomButton()
- else if (cubit.booking.reservationStatus == ReservationStatus.newreservation)
- const CheckInButtonTimer()
else if (cubit.booking.reservationStatus == ReservationStatus.preregistered)
- const PreregisterButton(),
+ const CheckInButtonTimer()
+ else if (cubit.booking.reservationStatus == ReservationStatus.newreservation)
+ const PreregisterButton()
+ else
+ const SizedBox(),
const SizedBox(
height: 100,
),
@@ -115,8 +113,8 @@ class BookingDetailsPage extends StatelessWidget {
);
}
- Widget _buildBookingDetailsInformation(BuildContext context, BookingDetailsState state,
- BookingDetailsBloc cubit, ThemeData theme) {
+ Widget _buildBookingDetailsInformation(BuildContext context,
+ BookingDetailsState state, BookingDetailsBloc cubit, ThemeData theme) {
return InkWell(
onTap: () {
context.pushNamed(AppRoutes.myBooking.name, extra: cubit.booking);
diff --git a/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart b/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart
index da655ebc..a3092cef 100644
--- a/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart
+++ b/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart
@@ -1,10 +1,7 @@
import 'package:comwell_key_app/booking_details/bloc/booking_details_bloc.dart';
-import 'package:comwell_key_app/booking_details/components/check_in_button_timer.dart';
import 'package:comwell_key_app/booking_details/components/check_out_button.dart';
import 'package:comwell_key_app/booking_details/components/housekeeping_button.dart';
import 'package:comwell_key_app/booking_details/components/practical_information_button.dart';
-import 'package:comwell_key_app/booking_details/components/preregister_button.dart';
-
import 'package:comwell_key_app/common/components/bottom_sheet_widget.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:easy_localization/easy_localization.dart';
@@ -14,9 +11,9 @@ import 'package:go_router/go_router.dart';
class BookingDetailsBottomSheet extends StatelessWidget {
final BookingDetailsBloc cubit;
final BookingDetailsState state;
+
const BookingDetailsBottomSheet(
{super.key, required this.cubit, required this.state});
-
@override
Widget build(BuildContext context) {
return BottomSheetWidget(
@@ -43,7 +40,8 @@ class BookingDetailsBottomSheet extends StatelessWidget {
"booking_details_page_hotel_information_button_subtitle"
.tr(),
onClick: () {
- context.pushNamed(AppRoutes.hotelInformation.name);
+ context.pushNamed(AppRoutes.hotelInformation.name,
+ );
}),
),
),
@@ -56,7 +54,7 @@ class BookingDetailsBottomSheet extends StatelessWidget {
title: "booking_details_page_contact_button_title".tr(),
subtitle: "booking_details_page_contact_button_subtitle".tr(),
onClick: () {
- context.pushNamed(AppRoutes.contact.name);
+ context.pushNamed(AppRoutes.contact.name, extra: {'user': cubit.user, 'booking': cubit.booking});
}),
),
),
diff --git a/comwell_key_app/lib/booking_details/components/check_in_button.dart b/comwell_key_app/lib/booking_details/components/check_in_button.dart
index 9a2858e3..0a0f621c 100644
--- a/comwell_key_app/lib/booking_details/components/check_in_button.dart
+++ b/comwell_key_app/lib/booking_details/components/check_in_button.dart
@@ -29,18 +29,6 @@ class CheckInButton extends StatelessWidget {
bloc.add(InitialEvent());
}
},
- style: ElevatedButton.styleFrom(
- elevation: 0,
- backgroundColor: sandColor[80],
- textStyle: const TextStyle(
- color: Colors.white,
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(30),
- ),
- ),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
diff --git a/comwell_key_app/lib/booking_details/components/check_in_button_timer.dart b/comwell_key_app/lib/booking_details/components/check_in_button_timer.dart
index 4a79ed02..27126f92 100644
--- a/comwell_key_app/lib/booking_details/components/check_in_button_timer.dart
+++ b/comwell_key_app/lib/booking_details/components/check_in_button_timer.dart
@@ -1,4 +1,3 @@
-import 'dart:async';
import 'package:comwell_key_app/booking_details/bloc/booking_details_bloc.dart';
import 'package:comwell_key_app/booking_details/components/check_in_button.dart';
import 'package:comwell_key_app/utils/time_utils.dart';
@@ -8,30 +7,30 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
class CheckInButtonTimer extends StatefulWidget {
- const CheckInButtonTimer({super.key,});
+ const CheckInButtonTimer({
+ super.key,
+ });
@override
State<CheckInButtonTimer> createState() => _CheckInButtonTimerState();
}
class _CheckInButtonTimerState extends State<CheckInButtonTimer> {
-
@override
Widget build(BuildContext context) {
return BlocBuilder<BookingDetailsBloc, BookingDetailsState>(
builder: (context, state) {
return AnimatedSwitcher(
- duration: const Duration(milliseconds: 300),
- transitionBuilder: (Widget child, Animation<double> animation) {
- return FadeTransition(
- opacity: animation,
- child: child,
- );
- },
- child: state.remainingTime.isNegative
- ? const CheckInButton(key: ValueKey('check_in_button'))
- : getTimerWidget()
- );
+ duration: const Duration(milliseconds: 300),
+ transitionBuilder: (Widget child, Animation<double> animation) {
+ return FadeTransition(
+ opacity: animation,
+ child: child,
+ );
+ },
+ child: state.remainingTime.isNegative
+ ? const CheckInButton(key: ValueKey('check_in_button'))
+ : getTimerWidget());
},
);
}
@@ -41,27 +40,31 @@ class _CheckInButtonTimerState extends State<CheckInButtonTimer> {
key: const ValueKey('timer_view'),
builder: (context, state) {
final cubit = context.read<BookingDetailsBloc>();
- final (days, hours, minutes, seconds) = getDurationInMinutes(state.remainingTime);
+ final (days, hours, minutes, seconds) =
+ getDurationInMinutes(state.remainingTime);
final checkInTime = cubit.getCheckInTime();
final dateStr = DateFormat('d. MMM', 'da').format(checkInTime);
-
+
final theme = Theme.of(context);
- final timeStr = days > 0
- ? "check_in_button_timer_days_hours_minutes".tr(args: [days.toString(), hours.toString(), minutes.toString()])
+ final timeStr = days > 0
+ ? "check_in_button_timer_days_hours_minutes".tr(
+ args: [days.toString(), hours.toString(), minutes.toString()])
: hours > 0
- ? "check_in_button_timer_hours_minutes".tr(args: [hours.toString(), minutes.toString()])
+ ? "check_in_button_timer_hours_minutes"
+ .tr(args: [hours.toString(), minutes.toString()])
: minutes > 0
- ? "check_in_button_timer_minutes".tr(args: [minutes.toString()])
- : "check_in_button_timer_seconds".tr(args: [seconds.toString()]);
+ ? "check_in_button_timer_minutes"
+ .tr(args: [minutes.toString()])
+ : "check_in_button_timer_seconds"
+ .tr(args: [seconds.toString()]);
return Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
- color: Colors.grey[900]?.withOpacity(0.8),
+ color: Colors.grey[900]?.withValues(alpha: 0.8),
borderRadius: BorderRadius.circular(30),
),
- padding:
- const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
child: Row(
children: [
SvgPicture.asset(
@@ -85,8 +88,8 @@ class _CheckInButtonTimerState extends State<CheckInButtonTimer> {
),
Text(
timeStr,
- style: theme.textTheme.bodyMedium?.copyWith(
- color: Colors.white.withOpacity(0.8)),
+ style: theme.textTheme.bodyMedium
+ ?.copyWith(color: Colors.white.withValues(alpha: 0.8)),
),
],
),
@@ -97,7 +100,7 @@ class _CheckInButtonTimerState extends State<CheckInButtonTimer> {
Text(
dateStr.toUpperCase(),
style: theme.textTheme.bodySmall?.copyWith(
- color: Colors.white.withOpacity(0.7),
+ color: Colors.white.withValues(alpha: 0.7),
fontWeight: FontWeight.w600,
),
),
diff --git a/comwell_key_app/lib/booking_details/components/preregister_button.dart b/comwell_key_app/lib/booking_details/components/preregister_button.dart
index daec1b5a..b26c651d 100644
--- a/comwell_key_app/lib/booking_details/components/preregister_button.dart
+++ b/comwell_key_app/lib/booking_details/components/preregister_button.dart
@@ -5,7 +5,6 @@ import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import '../../routing/app_routes.dart';
-import '../../themes/dark_theme.dart';
import '../bloc/booking_details_bloc.dart';
class PreregisterButton extends StatelessWidget {
@@ -14,30 +13,20 @@ class PreregisterButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final bloc = context.read<BookingDetailsBloc>();
-
+ final theme = Theme.of(context);
+
return Container(
- margin: const EdgeInsets.symmetric(horizontal: 10),
+ margin: const EdgeInsets.symmetric(horizontal: 8),
child: ElevatedButton(
onPressed: () async {
- final (result) = await context.pushNamed(AppRoutes.preregistration.name,
- extra: bloc.booking);
+ final (result) = await context
+ .pushNamed(AppRoutes.preregistration.name, extra: bloc.booking);
if (result != null) {
bloc.add(InitialEvent());
}
},
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor[80],
- textStyle: const TextStyle(
- color: Colors.white,
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(30),
- ),
- ),
child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 8.0),
+ padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
children: [
SvgPicture.asset("assets/icons/ic_exit.svg"),
@@ -47,18 +36,12 @@ class PreregisterButton extends StatelessWidget {
children: [
Text(
"prepare_room".tr(),
- style: Theme
- .of(context)
- .textTheme
- .titleMedium
- ?.copyWith(color: Colors.white),
+ style: theme.textTheme.titleMedium?.copyWith(
+ color: Colors.white, fontWeight: FontWeight.w600),
),
Text(
"jump_line_text".tr(),
- style: Theme
- .of(context)
- .textTheme
- .bodySmall
+ style: theme.textTheme.bodySmall
?.copyWith(color: Colors.white),
),
],
diff --git a/comwell_key_app/lib/booking_details/components/room_number_container.dart b/comwell_key_app/lib/booking_details/components/room_number_container.dart
index 39413475..1c76ccc9 100644
--- a/comwell_key_app/lib/booking_details/components/room_number_container.dart
+++ b/comwell_key_app/lib/booking_details/components/room_number_container.dart
@@ -29,6 +29,6 @@ class RoomNumberContainer extends StatelessWidget {
),
),
),
- );;
+ );
}
}
\ No newline at end of file
diff --git a/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart b/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart
index 45916244..8ef52242 100644
--- a/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart
+++ b/comwell_key_app/lib/check_out/bloc/check_out_cubit.dart
@@ -8,6 +8,8 @@ import 'package:comwell_key_app/check_out/pages/check_out_page.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/pregistration/pregistration_repository.dart';
import 'package:comwell_key_app/profile/profile_repository.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/tracking/models/analytics_event_item.dart';
import 'package:comwell_key_app/utils/locator.dart';
import 'package:flutter/material.dart';
@@ -15,6 +17,7 @@ class CheckoutCubit extends Cubit<CheckoutState> {
final ProfileRepository profileRepository = locator<ProfileRepository>();
final PreregistrationRepository preregistrationRepository =
locator<PreregistrationRepository>();
+ final _tracking = locator<ComwellTracking>();
final pageController = PageController();
bool _isAnimating = false;
final Booking booking;
@@ -46,6 +49,17 @@ class CheckoutCubit extends Cubit<CheckoutState> {
}
void processCheckout() async {
+ final analyticsEventItem = AnalyticsEventItem(
+ hotelName: "Comwell",
+ currency: "DKK",
+ value: 500,
+ placement: "placement",
+ items: ["items"],
+ itemId: "itemId",
+ itemName: "itemName",
+ price: 200,
+ quantity: 200);
+ _tracking.trackBeginCheckout(analyticsEventItem);
emit(state.processingStateUpdated(CheckoutProcessingStateProcessing()));
createSession();
}
diff --git a/comwell_key_app/lib/common/components/generic_dialog.dart b/comwell_key_app/lib/common/components/generic_dialog.dart
index cc81a689..9a89ba70 100644
--- a/comwell_key_app/lib/common/components/generic_dialog.dart
+++ b/comwell_key_app/lib/common/components/generic_dialog.dart
@@ -65,10 +65,12 @@ class GenericDialog extends StatelessWidget {
const SizedBox(height: 5),Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ElevatedButton(
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor,
- minimumSize: const Size(double.infinity, 52),
- maximumSize: const Size(double.infinity, 52),
+ style: theme.elevatedButtonTheme.style?.copyWith(
+ minimumSize: const WidgetStatePropertyAll(
+ Size(double.infinity, 52)),
+ shape: WidgetStatePropertyAll(
+ RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(25))),
),
onPressed: onCancel,
child: Text(
diff --git a/comwell_key_app/lib/common/const.dart b/comwell_key_app/lib/common/const.dart
index c3d6f7c7..8efa19c6 100644
--- a/comwell_key_app/lib/common/const.dart
+++ b/comwell_key_app/lib/common/const.dart
@@ -2,6 +2,7 @@ const accessToken = 'access_token';
const refreshToken = 'refresh_token';
const isEndpointSetup = 'isEndpointSetup';
const hasKey = 'hasKey';
+const needsScaffold = 'needsScaffold';
// Adyen
class AdyenConstants {
diff --git a/comwell_key_app/lib/contact/components/call_us_section.dart b/comwell_key_app/lib/contact/components/call_us_section.dart
index dd8698d9..fff392f3 100644
--- a/comwell_key_app/lib/contact/components/call_us_section.dart
+++ b/comwell_key_app/lib/contact/components/call_us_section.dart
@@ -1,4 +1,3 @@
-import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/utils/launch_util.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@@ -25,12 +24,12 @@ class CallUsSection extends StatelessWidget {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 0),
child: ElevatedButton(
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(25),
- ),
- minimumSize: const Size(double.infinity, 52),
+ style: theme.elevatedButtonTheme.style?.copyWith(
+ minimumSize: const WidgetStatePropertyAll(
+ Size(double.infinity, 52)),
+ shape: WidgetStatePropertyAll(
+ RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(25))),
),
onPressed: () async {
await makePhoneCall('comwell_telephone_number'.tr());
diff --git a/comwell_key_app/lib/contact/components/get_a_phone_call_section.dart b/comwell_key_app/lib/contact/components/get_a_phone_call_section.dart
index 2618a80b..ed7551af 100644
--- a/comwell_key_app/lib/contact/components/get_a_phone_call_section.dart
+++ b/comwell_key_app/lib/contact/components/get_a_phone_call_section.dart
@@ -1,11 +1,14 @@
+import 'package:comwell_key_app/contact/cubit/contact_cubit.dart';
import 'package:comwell_key_app/profile_settings/components/intl_phone_field.dart';
-import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/profile_settings/model/user.dart';
+import 'package:comwell_key_app/utils/launch_util.dart';
import 'package:comwell_key_app/utils/phone_utils.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
class GetAPhoneCallSection extends StatelessWidget {
- final VoidCallback onPressed;
+ final VoidCallback onPressed;
const GetAPhoneCallSection({
super.key,
required this.onPressed,
@@ -14,7 +17,9 @@ class GetAPhoneCallSection extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
- final (countryCode, phoneNumber) = getCountryCodeFromPhoneNumber('+4528960099');
+ final cubit = context.read<ContactCubit>();
+
+
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -27,22 +32,19 @@ class GetAPhoneCallSection extends StatelessWidget {
const SizedBox(height: 8),
Text('telephone_number'.tr(), style: theme.textTheme.labelLarge),
IntlPhoneField(
- readOnly: true,
- title: 'Telefonnummer',
- phoneNumber: phoneNumber,
- countryCode: countryCode,
- controller: TextEditingController(),
+ readOnly: false,
+ title: 'telephone_number'.tr(),
+ phoneNumber: cubit.phoneNumber,
+ countryCode: cubit.countryCode,
+ controller: cubit.phoneNumberController,
),
const SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 0),
child: ElevatedButton(
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(25),
- ),
- minimumSize: const Size(double.infinity, 52),
+ style: theme.elevatedButtonTheme.style?.copyWith(
+ minimumSize: const WidgetStatePropertyAll(
+ Size(double.infinity, 52)),
),
onPressed: () async {
// await makePhoneCall('comwell_telefon_number'.tr());
diff --git a/comwell_key_app/lib/contact/contact_page.dart b/comwell_key_app/lib/contact/contact_page.dart
index f638e0bf..883bb0ff 100644
--- a/comwell_key_app/lib/contact/contact_page.dart
+++ b/comwell_key_app/lib/contact/contact_page.dart
@@ -1,41 +1,53 @@
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
import 'package:comwell_key_app/contact/components/call_us_section.dart';
import 'package:comwell_key_app/contact/components/get_a_phone_call_section.dart';
+import 'package:comwell_key_app/contact/cubit/contact_cubit.dart';
+import 'package:comwell_key_app/profile_settings/model/user.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
class ContactPage extends StatelessWidget {
final String hotelCode;
const ContactPage({required this.hotelCode, super.key});
@override
Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.white,
- appBar: const ComwellAppBar(),
- body: Padding(
- padding: const EdgeInsets.all(16.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 20),
- Text(
- 'need_help'.tr(),
- style: Theme.of(context).textTheme.headlineLarge,
+ return BlocConsumer<ContactCubit, ContactState>(
+ listener: (context, state) {
+
+ },
+ builder: (context, state) {
+ return Scaffold(
+ backgroundColor: Colors.white,
+ appBar: const ComwellAppBar(),
+ body: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 20),
+ Text(
+ 'need_help'.tr(),
+ style: Theme.of(context).textTheme.headlineLarge,
+ ),
+ const SizedBox(height: 40),
+ const CallUsSection(),
+ const SizedBox(height: 20),
+ const Divider(color: colorDivider),
+ const SizedBox(height: 20),
+ GetAPhoneCallSection(
+ onPressed: () {
+
+ },
+ ),
+ ],
),
- const SizedBox(height: 40),
- const CallUsSection(),
- const SizedBox(height: 20),
- const Divider(color: colorDivider),
- const SizedBox(height: 20),
- GetAPhoneCallSection(
- onPressed: () {
-
- },
- ),
- ],
+ ),
),
- ),
+ );
+ },
);
}
}
diff --git a/comwell_key_app/lib/contact/cubit/contact_cubit.dart b/comwell_key_app/lib/contact/cubit/contact_cubit.dart
index 9eccc328..34786a3b 100644
--- a/comwell_key_app/lib/contact/cubit/contact_cubit.dart
+++ b/comwell_key_app/lib/contact/cubit/contact_cubit.dart
@@ -1,14 +1,23 @@
import 'package:bloc/bloc.dart';
import 'package:comwell_key_app/contact/repository/contact_repository.dart';
import 'package:comwell_key_app/overview/repository/overview_repository.dart';
+import 'package:comwell_key_app/profile/profile_repository.dart';
+import 'package:comwell_key_app/profile_settings/model/user.dart';
+import 'package:comwell_key_app/utils/phone_utils.dart';
+import 'package:country_code_picker/country_code_picker.dart';
import 'package:equatable/equatable.dart';
+import 'package:flutter/material.dart';
part 'contact_state.dart';
class ContactCubit extends Cubit<ContactState> {
final ContactRepository contactRepository;
final OverviewRepository overviewRepository;
- ContactCubit({required this.contactRepository, required this.overviewRepository}) : super(const ContactState.initial());
+ final ProfileRepository profileRepository;
+ final TextEditingController phoneNumberController = TextEditingController();
+ late CountryCode countryCode = CountryCode.fromCountryCode('DK');
+ late String phoneNumber = '';
+ ContactCubit({required this.contactRepository, required this.overviewRepository, required this.profileRepository}) : super(const ContactState.initial());
void sendContact(String hotelCode) async {
emit(const ContactState.contactSend());
@@ -21,4 +30,17 @@ class ContactCubit extends Cubit<ContactState> {
emit(const ContactState.contactError());
}
}
+
+ Future<void> init() async {
+ final user = await profileRepository.fetchProfileSettings();
+ final (countryCode, phoneNumber) = getCountryCodeFromPhoneNumber(user.phoneNumber);
+
+ this.countryCode = countryCode;
+ this.phoneNumber = phoneNumber;
+
+ phoneNumberController.text = phoneNumber;
+
+
+ emit(state.userLoaded(user: user));
+ }
}
diff --git a/comwell_key_app/lib/contact/cubit/contact_state.dart b/comwell_key_app/lib/contact/cubit/contact_state.dart
index a4f87356..25bf62a4 100644
--- a/comwell_key_app/lib/contact/cubit/contact_state.dart
+++ b/comwell_key_app/lib/contact/cubit/contact_state.dart
@@ -1,18 +1,28 @@
part of 'contact_cubit.dart';
class ContactState extends Equatable {
+ final User? user;
const ContactState._(
+ this.user,
);
-const ContactState.initial() : this._();
+const ContactState.initial() : user = null;
-const ContactState.contactSend() : this._();
+const ContactState.contactSend() : this._(null);
-const ContactState.contactSent() : this._();
+const ContactState.contactSent() : this._(null);
-const ContactState.contactError() : this._();
+const ContactState.contactError() : this._(null);
+
+ContactState userLoaded({required User user}) => _copyWith(user: user);
@override
- List<Object?> get props => [];
+ List<Object?> get props => [user];
+
+ContactState _copyWith({
+ User? user,
+}) {
+ return ContactState._(user ?? this.user);
+}
}
\ No newline at end of file
diff --git a/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart b/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart
index bfaf3bb4..0ea5ae46 100644
--- a/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart
+++ b/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart
@@ -32,10 +32,10 @@ class BalanceBottomSheet extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
- padding: const EdgeInsets.symmetric(vertical: 40.0, horizontal: 16),
+ padding:
+ const EdgeInsets.symmetric(vertical: 40.0, horizontal: 16),
child: Container(
- padding:
- const EdgeInsets.symmetric(vertical: 8),
+ padding: const EdgeInsets.symmetric(vertical: 8),
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(color: colorDivider),
@@ -115,7 +115,9 @@ class BalanceBottomSheet extends StatelessWidget {
fontWeight: FontWeight.w400,
),
),
- Text('total_charge_value'.tr(args: [booking.totalCharge.toString()]),
+ Text(
+ 'total_charge_value'
+ .tr(args: [booking.totalCharge.toString()]),
style: theme.textTheme.titleLarge
?.copyWith(fontWeight: FontWeight.bold),
),
@@ -153,20 +155,32 @@ class BalanceBottomSheet extends StatelessWidget {
onPressed: () {
// Handle payment
},
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor,
- elevation: 0,
- padding: const EdgeInsets.symmetric(vertical: 16),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(32),
- ),
+ style: theme.elevatedButtonTheme.style?.copyWith(
+ padding: const WidgetStatePropertyAll(
+ EdgeInsets.symmetric(vertical: 16)),
+ shape: WidgetStatePropertyAll(RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(32))),
),
- child: Text(
- 'Gå til betaling ${balance.toInt()} kr.',
- style: const TextStyle(
- color: Colors.white,
- fontSize: 16,
- fontWeight: FontWeight.w500,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ 'Gå til betaling ',
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: Colors.white,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ Text("${balance.toInt()} kr.",
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: Colors.white,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ )),
+ ],
),
),
),
@@ -211,10 +225,7 @@ class BalanceBottomSheet extends StatelessWidget {
color: Colors.grey[200],
borderRadius: BorderRadius.circular(2),
),
- child: Text(
- 'payed'.tr(),
- style: theme.textTheme.bodySmall
- ),
+ child: Text('payed'.tr(), style: theme.textTheme.bodySmall),
),
],
),
diff --git a/comwell_key_app/lib/notifications/notifications_page.dart b/comwell_key_app/lib/notifications/notifications_page.dart
index 6105aefc..f8eb0129 100644
--- a/comwell_key_app/lib/notifications/notifications_page.dart
+++ b/comwell_key_app/lib/notifications/notifications_page.dart
@@ -29,14 +29,15 @@ class NotificationsPage extends StatelessWidget {
),
);
} else {
- return _buildNotificationsPage(cubit);
+ return _buildNotificationsPage(context, cubit);
}
},
),
);
}
- Widget _buildNotificationsPage(NotificationsCubit cubit) {
+ Widget _buildNotificationsPage(BuildContext context, NotificationsCubit cubit) {
+ final theme = Theme.of(context);
return SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
@@ -83,11 +84,10 @@ class NotificationsPage extends StatelessWidget {
cubit.updatePreferences(
cubit.state.allNotifications, cubit.user.id);
},
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(8),
- ),
+ style: theme.elevatedButtonTheme.style?.copyWith(
+ shape: WidgetStatePropertyAll(
+ RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(8))),
),
child: Text(
'save'.tr(),
diff --git a/comwell_key_app/lib/payment_cards/bloc/payment_cards_cubit.dart b/comwell_key_app/lib/payment_cards/bloc/payment_cards_cubit.dart
index c790005e..f9104817 100644
--- a/comwell_key_app/lib/payment_cards/bloc/payment_cards_cubit.dart
+++ b/comwell_key_app/lib/payment_cards/bloc/payment_cards_cubit.dart
@@ -69,7 +69,7 @@ class PaymentCardsCubit extends Cubit<PaymentCardsState> {
},
onAdditionalDetails: (data) async {
final response = await _api.postPaymentsDetails(data);
- return PaymentEventHandler().handleResponse(jsonResponse: response);
+ return PaymentEventHandler().handleResponse(jsonResponse: response!);
},
);
}
diff --git a/comwell_key_app/lib/pregistration/bloc/preregistration_cubit.dart b/comwell_key_app/lib/pregistration/bloc/preregistration_cubit.dart
index 2b85b85b..7bdc1586 100644
--- a/comwell_key_app/lib/pregistration/bloc/preregistration_cubit.dart
+++ b/comwell_key_app/lib/pregistration/bloc/preregistration_cubit.dart
@@ -3,6 +3,7 @@ import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/pregistration/bloc/preregistration_state.dart';
import 'package:comwell_key_app/pregistration/pregistration_repository.dart';
import 'package:comwell_key_app/pregistration/preregistration_flow.dart';
+import 'package:comwell_key_app/pregistration/utils/utils.dart';
import 'package:comwell_key_app/profile/profile_repository.dart';
import 'package:comwell_key_app/profile_settings/model/address.dart';
import 'package:comwell_key_app/profile_settings/repostiory/profile_settings_repository.dart';
@@ -20,7 +21,6 @@ class PreregistrationCubit extends Cubit<PreregistrationState> {
final _profileSettingsRepository = locator<ProfileSettingsRepository>();
final _tracking = locator<ComwellTracking>();
final _preregistrationRepository = locator<PreregistrationRepository>();
- // final _bookingDetailsBloc = locator<BookingDetailsBloc>();
final Booking booking;
final pageController = PageController();
@@ -153,18 +153,6 @@ class PreregistrationCubit extends Cubit<PreregistrationState> {
}
void _onConfirmPressed(BuildContext context) async {
- // final analyticsEventItem = AnalyticsEventItem(
- // hotelName: "Comwell",
- // currency: "DKK",
- // value: 500,
- // placement: "placement",
- // items: ["items"],
- // itemId: "itemId",
- // itemName: "itemName",
- // price: 200,
- // quantity: 200);
- // _tracking.trackBeginCheckout(analyticsEventItem);
-
emit(state.copyWith(loading: true));
try {
final confirmationId = booking.confirmationId;
diff --git a/comwell_key_app/lib/pregistration/pages/prereg_profile_page.dart b/comwell_key_app/lib/pregistration/pages/prereg_profile_page.dart
index f3c2bee3..3e1ef54b 100644
--- a/comwell_key_app/lib/pregistration/pages/prereg_profile_page.dart
+++ b/comwell_key_app/lib/pregistration/pages/prereg_profile_page.dart
@@ -36,15 +36,15 @@ class PreregProfilePage extends StatelessWidget {
final cubit = context.read<PreregistrationCubit>();
final firstNameErrorMessage =
- !cubit.isFirstNameValid && state.missingInformation
+ cubit.isFirstNameValid && state.missingInformation
? "generic_information_required".tr()
: null;
final lastNameErrorMessage =
- !cubit.isLastNameValid && state.missingInformation
+ cubit.isLastNameValid && state.missingInformation
? "generic_information_required".tr()
: null;
final phoneNumberErrorMessage =
- !cubit.isPhoneNumberValid && state.missingInformation
+ cubit.isPhoneNumberValid && state.missingInformation
? "generic_information_required".tr()
: null;
diff --git a/comwell_key_app/lib/pregistration/preregistration_flow.dart b/comwell_key_app/lib/pregistration/preregistration_flow.dart
index 4f9adf51..2fad19eb 100644
--- a/comwell_key_app/lib/pregistration/preregistration_flow.dart
+++ b/comwell_key_app/lib/pregistration/preregistration_flow.dart
@@ -1,42 +1,11 @@
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
-import 'package:comwell_key_app/payment_cards/bloc/payment_cards_cubit.dart';
-import 'package:comwell_key_app/payment_cards/payment_cards_page.dart';
import 'package:comwell_key_app/pregistration/bloc/preregistration_state.dart';
import 'package:comwell_key_app/pregistration/bloc/preregistration_cubit.dart';
-import 'package:comwell_key_app/pregistration/pages/prereg_confirmation_page.dart';
-import 'package:comwell_key_app/pregistration/pages/prereg_address_page.dart';
-import 'package:comwell_key_app/pregistration/pages/prereg_profile_page.dart';
+import 'package:comwell_key_app/pregistration/utils/utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-enum PreregistrationPage {
- profile,
- address,
- payment,
- confirmation;
-
- static PreregistrationPage fromIndex(int index) {
- return PreregistrationPage.values[index];
- }
-
- static Iterable<Widget> getPages(Key key) {
- return PreregistrationPage.values.map((page) {
- switch (page) {
- case PreregistrationPage.profile:
- return PreregProfilePage(key: key);
- case PreregistrationPage.address:
- return PreregAddressPage(key: key);
- case PreregistrationPage.payment:
- return BlocProvider(
- create: (context) => PaymentCardsCubit(),
- child: const PaymentCardsPage());
- case PreregistrationPage.confirmation:
- return PreregConfirmationPage(key: key);
- }
- });
- }
-}
class PreregistrationFlow extends StatefulWidget {
final Booking booking;
diff --git a/comwell_key_app/lib/pregistration/utils/utils.dart b/comwell_key_app/lib/pregistration/utils/utils.dart
new file mode 100644
index 00000000..6db9e391
--- /dev/null
+++ b/comwell_key_app/lib/pregistration/utils/utils.dart
@@ -0,0 +1,35 @@
+import 'package:comwell_key_app/payment_cards/bloc/payment_cards_cubit.dart';
+import 'package:comwell_key_app/payment_cards/payment_cards_page.dart';
+import 'package:comwell_key_app/pregistration/pages/prereg_address_page.dart';
+import 'package:comwell_key_app/pregistration/pages/prereg_confirmation_page.dart';
+import 'package:comwell_key_app/pregistration/pages/prereg_profile_page.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+
+enum PreregistrationPage {
+ profile,
+ address,
+ payment,
+ confirmation;
+
+ static PreregistrationPage fromIndex(int index) {
+ return PreregistrationPage.values[index];
+ }
+
+ static Iterable<Widget> getPages(Key key) {
+ return PreregistrationPage.values.map((page) {
+ switch (page) {
+ case PreregistrationPage.profile:
+ return PreregProfilePage(key: key);
+ case PreregistrationPage.address:
+ return PreregAddressPage(key: key);
+ case PreregistrationPage.payment:
+ return BlocProvider(
+ create: (context) => PaymentCardsCubit(),
+ child: const PaymentCardsPage());
+ case PreregistrationPage.confirmation:
+ return PreregConfirmationPage(key: key);
+ }
+ });
+ }
+}
diff --git a/comwell_key_app/lib/profile/components/comwell_club_signup_bottom_sheet.dart b/comwell_key_app/lib/profile/components/comwell_club_signup_bottom_sheet.dart
index ad65aa7b..52bca5c1 100644
--- a/comwell_key_app/lib/profile/components/comwell_club_signup_bottom_sheet.dart
+++ b/comwell_key_app/lib/profile/components/comwell_club_signup_bottom_sheet.dart
@@ -264,16 +264,12 @@ class _ComwellClubSignupBottomSheetState
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ElevatedButton(
- style: ElevatedButton.styleFrom(
- elevation: 0,
- backgroundColor: cubit.state.isToSAccepted &&
- _selectedGender.isNotEmpty
- ? sandColor
- : Colors.grey[200],
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(25),
- ),
- minimumSize: const Size(double.infinity, 52),
+ style: theme.elevatedButtonTheme.style?.copyWith(
+ backgroundColor: WidgetStatePropertyAll(
+ cubit.state.isToSAccepted &&
+ _selectedGender.isNotEmpty
+ ? sandColor
+ : Colors.grey[200]),
),
onPressed: () async {
final response = cubit.state.isToSAccepted &&
diff --git a/comwell_key_app/lib/profile/components/logout_dialog_widget.dart b/comwell_key_app/lib/profile/components/logout_dialog_widget.dart
index d6ff5b59..af3afc4e 100644
--- a/comwell_key_app/lib/profile/components/logout_dialog_widget.dart
+++ b/comwell_key_app/lib/profile/components/logout_dialog_widget.dart
@@ -9,7 +9,8 @@ class LogoutDialogWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
-
+ final theme = Theme.of(context);
+
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
@@ -32,9 +33,9 @@ class LogoutDialogWidget extends StatelessWidget {
SizedBox(
width: double.infinity,
child: ElevatedButton(
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor,
- padding: const EdgeInsets.symmetric(vertical: 16),
+ style: theme.elevatedButtonTheme.style?.copyWith(
+ padding: const WidgetStatePropertyAll(
+ EdgeInsets.symmetric(vertical: 16)),
),
onPressed: () {
cubit.logOutPressed();
@@ -75,4 +76,4 @@ class LogoutDialogWidget extends StatelessWidget {
),
);
}
-}
\ No newline at end of file
+}
diff --git a/comwell_key_app/lib/profile/components/profile_page_widget.dart b/comwell_key_app/lib/profile/components/profile_page_widget.dart
index 77e06fa3..18b8246a 100644
--- a/comwell_key_app/lib/profile/components/profile_page_widget.dart
+++ b/comwell_key_app/lib/profile/components/profile_page_widget.dart
@@ -1,5 +1,6 @@
import 'package:comwell_key_app/common/components/comwell_card_component.dart';
import 'package:comwell_key_app/common/components/round_icon_button.dart';
+import 'package:comwell_key_app/common/const.dart';
import 'package:comwell_key_app/profile/components/card_content_widget.dart';
import 'package:comwell_key_app/profile/components/comwell_club_signup_bottom_sheet.dart';
import 'package:comwell_key_app/profile/components/logout_dialog_widget.dart';
@@ -135,8 +136,8 @@ class ProfilePageWidget extends StatelessWidget {
text: 'payment_card_profile_menu'.tr(),
trailingIcon: Icons.chevron_right,
onTap: () {
-
- context.pushNamed(AppRoutes.paymentCards.name, queryParameters: {'needsScaffold': 'true'});
+ context.pushNamed(AppRoutes.paymentCards.name,
+ queryParameters: {needsScaffold: 'true'});
},
),
const Padding(
diff --git a/comwell_key_app/lib/profile/profile_repository.dart b/comwell_key_app/lib/profile/profile_repository.dart
index 831476ac..3a474a63 100644
--- a/comwell_key_app/lib/profile/profile_repository.dart
+++ b/comwell_key_app/lib/profile/profile_repository.dart
@@ -43,7 +43,7 @@ class ProfileRepository {
Future<Booking> getBookingDetails(String bookingId) async {
user = await fetchProfileSettings();
final response = await api.getBookingDetails(bookingId);
- await db.bookingsDao.insertBookings(BookingsDTO(current: [response], past: [], cancelled: []));
+ await db.bookingsDao.insertBookings(BookingsDTO(current: [response!], past: [], cancelled: []));
final booking = response.toBooking(user.id, BookingStatus.current, ReservationStatus.fromString(response.status));
return booking;
diff --git a/comwell_key_app/lib/profile_settings/components/address_bottom_sheet.dart b/comwell_key_app/lib/profile_settings/components/address_bottom_sheet.dart
index 239ff495..518b6023 100644
--- a/comwell_key_app/lib/profile_settings/components/address_bottom_sheet.dart
+++ b/comwell_key_app/lib/profile_settings/components/address_bottom_sheet.dart
@@ -147,12 +147,8 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ElevatedButton(
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(25),
- ),
- minimumSize: const Size(double.infinity, 52),
+ style: theme.elevatedButtonTheme.style?.copyWith(
+ minimumSize: const WidgetStatePropertyAll(Size(double.infinity, 52)),
),
onPressed: () async {
final address = Address(
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index 6ee17bd2..b8cea7a3 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -5,7 +5,10 @@ import 'package:comwell_key_app/check_in/check_in_page.dart';
import 'package:comwell_key_app/check_out/bloc/check_out_cubit.dart';
import 'package:comwell_key_app/check_out/bloc/check_out_state.dart';
import 'package:comwell_key_app/check_out/check_out_flow.dart';
+import 'package:comwell_key_app/common/const.dart';
import 'package:comwell_key_app/contact/contact_page.dart';
+import 'package:comwell_key_app/contact/cubit/contact_cubit.dart';
+import 'package:comwell_key_app/contact/repository/contact_repository.dart';
import 'package:comwell_key_app/find_booking/find_booking_page.dart';
import 'package:comwell_key_app/find_booking/loading_page.dart';
import 'package:comwell_key_app/hotel_information/components/hotel_information_menu.dart';
@@ -142,9 +145,13 @@ GoRouter goRouter() {
path: '/${AppRoutes.contact.name}',
name: AppRoutes.contact.name,
builder: (context, state) {
- return const ContactPage(
- hotelCode: 'CBO',
- ); //TODO: Get hotel code from somewhere
+ return BlocProvider<ContactCubit>(
+ create: (BuildContext context) => ContactCubit(
+ contactRepository: locator<ContactRepository>(),
+ overviewRepository: locator<OverviewRepository>(),
+ profileRepository: locator<ProfileRepository>())..init(),
+ child: const ContactPage(hotelCode: 'CBO'),
+ );
}),
GoRoute(
path: '/loading_page',
@@ -292,8 +299,8 @@ GoRouter goRouter() {
return BlocProvider(
create: (context) => PaymentCardsCubit(),
child: Builder(builder: (context) {
- final needsScaffold = state.uri.queryParameters['needsScaffold'] == 'true';
- return PaymentCardsPage(needScaffold: needsScaffold);
+ final scaffold = state.uri.queryParameters[needsScaffold] == 'true';
+ return PaymentCardsPage(needScaffold: scaffold);
}));
}),
GoRoute(
diff --git a/comwell_key_app/lib/services/api.dart b/comwell_key_app/lib/services/api.dart
index f924be5d..f8debef0 100644
--- a/comwell_key_app/lib/services/api.dart
+++ b/comwell_key_app/lib/services/api.dart
@@ -11,6 +11,7 @@ import 'package:comwell_key_app/services/models/user_dto.dart';
import 'package:comwell_key_app/services/utils/api_endpoints.dart';
import 'package:comwell_key_app/utils/json.dart';
import 'package:dio/dio.dart';
+import 'package:flutter/material.dart';
import 'adyen/stored_payment_methods_response.dart';
@@ -153,15 +154,15 @@ class Api {
return response;
}
- Future<Json> checkIn(String confirmationId) async {
+ Future<Json?> checkIn(String confirmationId) async {
final body = {
"confirmationId": confirmationId,
};
final data = jsonEncode(body);
- print("json in api: $data");
+ debugPrint("json in api: $data");
final response = await dio.post<Json>(ApiEndpoints.checkIn, data: data);
- print("response in api: ${response.data}");
- return response.data!;
+ debugPrint("response in api: ${response.data}");
+ return response.data;
}
Future<void> sendContact(String hotelCode) async {}
@@ -171,7 +172,7 @@ class Api {
// TODO implement
}
- Future<Json> postPaymentsDetails(Json body) async {
+ Future<Json?> postPaymentsDetails(Json body) async {
final Json headers = {
"content-type": "application/json",
"x-API-key":
@@ -193,7 +194,7 @@ class Api {
options: Options(
headers: headers,
));
- return response.data!;
+ return response.data;
}
Future<String> createEndpointRegistration() async {
@@ -208,9 +209,9 @@ class Api {
.post<void>(ApiEndpoints.provisionKey, data: {'bookingId': bookingId});
}
- Future<BookingDTO> getBookingDetails(String bookingId) async {
+ Future<BookingDTO?> getBookingDetails(String bookingId) async {
final response = await dio.get<Json>('${ApiEndpoints.getBookingDetails}$bookingId');
- print("response=$response");
+ debugPrint("response=$response");
return BookingDTO.fromJson(response.data!);
}
}
diff --git a/comwell_key_app/lib/services/http_client.dart b/comwell_key_app/lib/services/http_client.dart
index bfdee632..dc2587db 100644
--- a/comwell_key_app/lib/services/http_client.dart
+++ b/comwell_key_app/lib/services/http_client.dart
@@ -16,7 +16,7 @@ class HttpClient {
static Dio _createDio() {
var dio = Dio(
BaseOptions(
- baseUrl: dotenv.env['SERVICE_URL'] ?? 'https://apim-comwell-net-services-stage.azure-api.net/api',
+ baseUrl: dotenv.env['SERVICE_URL'] ?? '',
receiveTimeout: const Duration(milliseconds: 10000),
connectTimeout: const Duration(milliseconds: 10000),
sendTimeout: const Duration(milliseconds: 10000),
diff --git a/comwell_key_app/lib/themes/dark_theme.dart b/comwell_key_app/lib/themes/dark_theme.dart
index 3aef8ff2..5f9327f2 100644
--- a/comwell_key_app/lib/themes/dark_theme.dart
+++ b/comwell_key_app/lib/themes/dark_theme.dart
@@ -35,6 +35,19 @@ ThemeData darkTheme = ThemeData(
onError: Colors.white,
brightness: Brightness.light,
shadow: colorShadow),
+ elevatedButtonTheme: ElevatedButtonThemeData(
+ style: ElevatedButton.styleFrom(
+ backgroundColor: sandColor[80],
+ textStyle: const TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ ),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(30),
+ ),
+ ),
+ ),
);
const colorPrimary = Color(0xFF677169);
diff --git a/comwell_key_app/lib/themes/light_theme.dart b/comwell_key_app/lib/themes/light_theme.dart
index 6065ca98..e6d64ff1 100644
--- a/comwell_key_app/lib/themes/light_theme.dart
+++ b/comwell_key_app/lib/themes/light_theme.dart
@@ -39,6 +39,19 @@ ThemeData lightTheme = ThemeData(
onError: Colors.white,
brightness: Brightness.light,
shadow: colorShadow),
+ elevatedButtonTheme: ElevatedButtonThemeData(
+ style: ElevatedButton.styleFrom(
+ backgroundColor: sandColor[80],
+ textStyle: const TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ ),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(30),
+ ),
+ ),
+ ),
);
const colorPrimary = Color(0xFF677169);
diff --git a/comwell_key_app/lib/utils/locator.dart b/comwell_key_app/lib/utils/locator.dart
index 7c72b707..fcccd6ff 100644
--- a/comwell_key_app/lib/utils/locator.dart
+++ b/comwell_key_app/lib/utils/locator.dart
@@ -1,4 +1,5 @@
import 'package:comwell_key_app/authentication/authentication_repository.dart';
+import 'package:comwell_key_app/contact/repository/contact_repository.dart';
import 'package:comwell_key_app/database/comwell_db.dart';
import 'package:comwell_key_app/hotel_information/repository/hotel_information_repository.dart';
import 'package:comwell_key_app/key/repository/key_repository.dart';
@@ -42,5 +43,6 @@ void setupLocator() {
() => HotelInformationRepository());
locator.registerFactory<NotificationsRepository>(
() => NotificationsRepository());
+ locator.registerFactory<ContactRepository>(() => ContactRepository());
}
}