6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 68fbaf29
Changed files
comwell_key_app/assets/translations/da-DK.json | 5 +- comwell_key_app/assets/translations/en-US.json | 5 +- .../booking_details/bloc/booking_details_bloc.dart | 6 +- .../lib/booking_details/booking_details_page.dart | 2 +- .../components/booking_details_bottom_sheet.dart | 2 + .../lib/my_booking/my_booking_page.dart | 1 + comwell_key_app/lib/routing/app_router.dart | 3 +- .../lib/up_sales/cubit/up_sales_cubit.dart | 11 +++ .../lib/up_sales/cubit/up_sales_state.dart | 4 + comwell_key_app/lib/up_sales/up_sale_widget.dart | 109 +++++++++++++++++++++ comwell_key_app/lib/utils/locator.dart | 1 + 11 files changed, 143 insertions(+), 6 deletions(-)
Diff
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index a6cf76cb..0134df8d 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -254,6 +254,9 @@
"check_in_button_timer_minutes": "Om {} minutter",
"check_in_button_timer_seconds": "Om {} sekunder",
"payment_cards_approve_conditions_title": "Jeg accepter ",
- "payment_cards_approve_conditions_subtitle": "betingelserne"
+ "payment_cards_approve_conditions_subtitle": "betingelserne",
+ "up_sales_title": "Tidlig check-in",
+ "up_sales_subtitle": "Med tidlig check-in kan du checke ind kl. 13.00 i stedet for kl. 15.00.",
+ "up_sales_popular": "POPULÆR"
}
\ 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 e0a94f68..d4601fee 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -253,5 +253,8 @@
"check_in_button_timer_minutes": "In {} minutes",
"check_in_button_timer_seconds": "In {} seconds",
"payment_cards_approve_conditions_title": "I accept ",
- "payment_cards_approve_conditions_subtitle": "terms and conditions"
+ "payment_cards_approve_conditions_subtitle": "terms and conditions",
+ "up_sales_title": "Early check-in",
+ "up_sales_subtitle": "With early check-in you can check in at 13.00 instead of 15.00.",
+ "up_sales_popular": "POPULAR"
}
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 2c8b42c4..ea269aa7 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
@@ -4,6 +4,7 @@ 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/up_sales/cubit/up_sales_cubit.dart';
import 'package:comwell_key_app/utils/seos_repository.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
@@ -21,16 +22,17 @@ class BookingDetailsBloc
extends Bloc<BookingDetailsEvent, BookingDetailsState> {
late Booking booking;
late User user;
- Timer? _timer;
+ Timer? _timer;
final BookingDetailsRepository bookingDetailsRepository;
final ProfileRepository profileRepository;
final SeosRepository seosRepository = locator<SeosRepository>();
Duration _remainingTime = Duration.zero;
+ final UpSalesCubit upSalesCubit = locator<UpSalesCubit>();
BookingDetailsBloc(
this.booking, {
required this.bookingDetailsRepository,
- required this.profileRepository,
+ required this.profileRepository,
}) : super(BookingDetailsState.initial(booking)) {
on<InitialEvent>((event, emit) async {
try {
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 29e5d9d0..f00f9f00 100644
--- a/comwell_key_app/lib/booking_details/booking_details_page.dart
+++ b/comwell_key_app/lib/booking_details/booking_details_page.dart
@@ -14,7 +14,7 @@ import 'package:go_router/go_router.dart';
import 'bloc/booking_details_bloc.dart';
import 'components/unlock_room_button.dart';
-
+
class BookingDetailsPage extends StatelessWidget {
const BookingDetailsPage({super.key});
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 74b27e80..7bf2cbc7 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
@@ -5,6 +5,7 @@ import 'package:comwell_key_app/booking_details/components/practical_information
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/routing/app_routes.dart';
+import 'package:comwell_key_app/up_sales/up_sale_widget.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -26,6 +27,7 @@ class BookingDetailsBottomSheet extends StatelessWidget {
: const SizedBox(),
const SizedBox(height: 20),
const CheckOutButton(),
+ const UpSaleWidget(),
const SizedBox(height: 20),
Text("booking_details_page_practical_information".tr()),
const SizedBox(height: 20),
diff --git a/comwell_key_app/lib/my_booking/my_booking_page.dart b/comwell_key_app/lib/my_booking/my_booking_page.dart
index af32ffca..a6bb3095 100644
--- a/comwell_key_app/lib/my_booking/my_booking_page.dart
+++ b/comwell_key_app/lib/my_booking/my_booking_page.dart
@@ -6,6 +6,7 @@ import 'package:comwell_key_app/my_booking/components/balance_bottom_sheet.dart'
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/profile/profile_repository.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/up_sales/cubit/up_sales_cubit.dart';
import 'package:comwell_key_app/utils/locator.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index d7579fc1..df08b22b 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -45,6 +45,7 @@ import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/routing/go_router_observer.dart';
import 'package:comwell_key_app/share/cubit/share_booking_cubit.dart';
import 'package:comwell_key_app/share/share_booking_page.dart';
+import 'package:comwell_key_app/up_sales/cubit/up_sales_cubit.dart';
import 'package:comwell_key_app/utils/stream_to_listenable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -262,7 +263,7 @@ GoRouter goRouter() {
booking,
bookingDetailsRepository:
locator<BookingDetailsRepository>(),
- profileRepository: locator<ProfileRepository>(),
+ profileRepository: locator<ProfileRepository>()
),
child: const BookingDetailsPage(),
);
diff --git a/comwell_key_app/lib/up_sales/cubit/up_sales_cubit.dart b/comwell_key_app/lib/up_sales/cubit/up_sales_cubit.dart
new file mode 100644
index 00000000..0f805b4c
--- /dev/null
+++ b/comwell_key_app/lib/up_sales/cubit/up_sales_cubit.dart
@@ -0,0 +1,11 @@
+import 'package:bloc/bloc.dart';
+import 'package:comwell_key_app/up_sales/cubit/up_sales_state.dart';
+
+class UpSalesCubit extends Cubit<UpSalesState> {
+ UpSalesCubit() : super(UpSalesState(selected: false));
+
+ void toggleSelected() {
+ emit(UpSalesState(selected: !state.selected));
+ }
+}
+
diff --git a/comwell_key_app/lib/up_sales/cubit/up_sales_state.dart b/comwell_key_app/lib/up_sales/cubit/up_sales_state.dart
new file mode 100644
index 00000000..e3b8c084
--- /dev/null
+++ b/comwell_key_app/lib/up_sales/cubit/up_sales_state.dart
@@ -0,0 +1,4 @@
+class UpSalesState {
+ final bool selected;
+ UpSalesState({required this.selected});
+}
\ No newline at end of file
diff --git a/comwell_key_app/lib/up_sales/up_sale_widget.dart b/comwell_key_app/lib/up_sales/up_sale_widget.dart
new file mode 100644
index 00000000..442efb81
--- /dev/null
+++ b/comwell_key_app/lib/up_sales/up_sale_widget.dart
@@ -0,0 +1,109 @@
+import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/up_sales/cubit/up_sales_cubit.dart';
+import 'package:comwell_key_app/up_sales/cubit/up_sales_state.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+
+class UpSaleWidget extends StatelessWidget {
+
+ const UpSaleWidget({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = Theme.of(context);
+
+
+ return BlocProvider(
+ create: (context) => UpSalesCubit(),
+ child: BlocBuilder<UpSalesCubit, UpSalesState>(
+ builder: (context, state) {
+ final cubit = context.read<UpSalesCubit>();
+ return Container(
+ padding: const EdgeInsets.all(24),
+ decoration: BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.circular(24),
+ border: Border.all(color: Colors.grey.shade300, width: 2),
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text('Tidlig check-in',
+ style: theme.textTheme.headlineMedium),
+ ],
+ ),
+ ),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Row(
+ children: [
+ Text(
+ '200 kr.',
+ style: theme.textTheme.headlineMedium,
+ ),
+ const SizedBox(width: 16),
+ GestureDetector(
+ onTap: cubit.toggleSelected,
+ child: Container(
+ width: 24,
+ height: 24,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ border: Border.all(color: colorDivider, width: 1),
+ ),
+ child: cubit.state.selected
+ ? Center(
+ child: Container(
+ width: 12,
+ height: 12,
+ decoration: BoxDecoration(
+ color: theme.primaryColor,
+ shape: BoxShape.circle,
+ ),
+ ),
+ )
+ : null,
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ],
+ ),
+ const SizedBox(height: 32),
+ Container(
+ padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
+ decoration: BoxDecoration(
+ color: sandColor,
+ borderRadius: BorderRadius.circular(32),
+ ),
+ child: Text(
+ 'POPULÆR',
+ style: theme.textTheme.headlineMedium?.copyWith(
+ color: Colors.white,
+ ),
+ ),
+ ),
+ const SizedBox(height: 24),
+ Text(
+ 'Med tidlig check-in kan du checke ind kl. 13.00 i stedet for kl. 15.00.',
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: colorPrimaryText,
+ ),
+ ),
+ ],
+ ),
+ );
+ }),
+ );
+ }
+}
diff --git a/comwell_key_app/lib/utils/locator.dart b/comwell_key_app/lib/utils/locator.dart
index fcccd6ff..3339263a 100644
--- a/comwell_key_app/lib/utils/locator.dart
+++ b/comwell_key_app/lib/utils/locator.dart
@@ -9,6 +9,7 @@ import 'package:comwell_key_app/pregistration/pregistration_repository.dart';
import 'package:comwell_key_app/profile/profile_repository.dart';
import 'package:comwell_key_app/profile_settings/repostiory/profile_settings_repository.dart';
import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/up_sales/cubit/up_sales_cubit.dart';
import 'package:comwell_key_app/utils/seos_repository.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';