6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 9c44f07f
Changed files
comwell_key_app/assets/translations/da-DK.json | 3 +- comwell_key_app/assets/translations/en-US.json | 3 +- .../components/choose_room_widget.dart | 2 +- .../choose_share_room/pages/room_info_page.dart | 245 ++++++++++----------- .../choose_share_room/pages/share_room_page.dart | 5 +- .../lib/common/components/room_image_carousel.dart | 140 ++++++++++++ .../up_sales/components/room_image_carousel.dart | 133 ----------- .../lib/up_sales/pages/room_upgrade_page.dart | 2 +- 8 files changed, 270 insertions(+), 263 deletions(-)
Diff
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index 01e5c04b..4d4ccc8b 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -308,5 +308,6 @@
"share_room_page_title": "Del værelse",
"share_room_page_subtitle": "Her kan du dele dit værelse med en anden gæst og give dem adgang til bookinginformation, nøglekort og Concierge",
"share_room_page_button": "Del dit værelse",
- "addon": "Tilkøbt"
+ "addon": "Tilkøbt",
+ "added_to_room": "Tilkøbt på værelse"
}
\ 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 71112ebb..1aadbf57 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -307,5 +307,6 @@
"share_room_page_title": "Share room",
"share_room_page_subtitle": "Here you can share your room with another guest and give them access to booking information, keycard and Concierge",
"share_room_page_button": "Share your room",
- "addon": "Added purchase"
+ "addon": "Added purchase",
+ "added_to_room": "Added to room"
}
diff --git a/comwell_key_app/lib/choose_share_room/components/choose_room_widget.dart b/comwell_key_app/lib/choose_share_room/components/choose_room_widget.dart
index 53072d73..37b29a0b 100644
--- a/comwell_key_app/lib/choose_share_room/components/choose_room_widget.dart
+++ b/comwell_key_app/lib/choose_share_room/components/choose_room_widget.dart
@@ -121,7 +121,7 @@ class ChooseRoomWidget extends StatelessWidget {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
- 'Tilkøbt på værelse',
+ 'added_to_room'.tr(),
style: theme.textTheme.bodySmall,
),
),
diff --git a/comwell_key_app/lib/choose_share_room/pages/room_info_page.dart b/comwell_key_app/lib/choose_share_room/pages/room_info_page.dart
index 3d26fb1b..733bd2d0 100644
--- a/comwell_key_app/lib/choose_share_room/pages/room_info_page.dart
+++ b/comwell_key_app/lib/choose_share_room/pages/room_info_page.dart
@@ -3,7 +3,7 @@ import 'package:comwell_key_app/choose_share_room/cubit/choose_share_room_state.
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
import 'package:comwell_key_app/common/const.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:comwell_key_app/up_sales/components/room_image_carousel.dart';
+import 'package:comwell_key_app/common/components/room_image_carousel.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@@ -36,143 +36,140 @@ class _RoomInfoPageState extends State<RoomInfoPage> {
final facilities = room?.roomFacilities.toList() ?? <RoomFacility>[];
final hasFacilities = facilities.isNotEmpty;
final description = room?.description ?? '';
+ final height = MediaQuery.of(context).size.height;
return BlocBuilder<ChooseShareRoomCubit, ChooseShareRoomState>(
- builder: (context, state) {
- if (state.isLoading) {
- return const RoomInfoShimmerLoader();
- }
-
- return Scaffold(
- extendBodyBehindAppBar: true,
- appBar: const ComwellAppBar(),
- backgroundColor: Colors.white,
- body: SingleChildScrollView(
- physics: const AlwaysScrollableScrollPhysics(),
- child: ConstrainedBox(
- constraints: BoxConstraints(
- minHeight:
- MediaQuery.of(context).size.height - kComwellAppBarHeight - 80,
- ),
- child: Column(
- children: [
- RoomImageCarousel(images: images.expand((x) => x).toList()),
- Container(
- width: double.infinity,
- decoration: const BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(24),
- topRight: Radius.circular(24),
- ),
- ),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- room?.name ?? '',
- style: theme.textTheme.headlineLarge,
- ),
- if (room?.tags.isNotEmpty ?? false)
- TagWidget(
- text: '${room?.tags.first} M2',
- textColor: sandColor),
- ],
- ),
- const SizedBox(height: 12),
- Text(
- description.isNotEmpty
- ? description
- : '${widget.booking.hotelName} - ${widget.booking.adults} adults, ${widget.booking.children} children',
- style: theme.textTheme.bodySmall,
- maxLines: _isExpanded ? null : 3,
- overflow: _isExpanded ? null : TextOverflow.ellipsis,
- ),
- const SizedBox(height: 4),
- GestureDetector(
- onTap: () {
- setState(() {
- _isExpanded = !_isExpanded;
- });
- },
- child: Text(
- _isExpanded ? 'read_less'.tr() : 'read_more'.tr(),
- style: theme.textTheme.bodySmall?.copyWith(
- color: sandColor,
- decoration: TextDecoration.underline,
- decorationColor: sandColor,
- ),
+ builder: (context, state) {
+ if (state.isLoading) {
+ return const RoomInfoShimmerLoader();
+ }
+
+ return Scaffold(
+ extendBodyBehindAppBar: true,
+ appBar: const ComwellAppBar(),
+ backgroundColor: Colors.white,
+ body: SingleChildScrollView(
+ physics: const AlwaysScrollableScrollPhysics(),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: height - kComwellAppBarHeight - 80,
+ ),
+ child: Column(
+ children: [
+ RoomImageCarousel(images: images.expand((x) => x).toList()),
+ Container(
+ width: double.infinity,
+ decoration: const BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.only(
+ topLeft: Radius.circular(24),
+ topRight: Radius.circular(24),
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 24, vertical: 16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ room?.name ?? '',
+ style: theme.textTheme.headlineLarge,
+ ),
+ if (room?.tags.isNotEmpty ?? false)
+ TagWidget(
+ text: '${room?.tags.first} M2',
+ textColor: sandColor),
+ ],
+ ),
+ const SizedBox(height: 12),
+ Text(
+ description,
+ style: theme.textTheme.bodySmall,
+ maxLines: _isExpanded ? null : 3,
+ overflow: _isExpanded ? null : TextOverflow.ellipsis,
+ ),
+ const SizedBox(height: 4),
+ GestureDetector(
+ onTap: () {
+ setState(() {
+ _isExpanded = !_isExpanded;
+ });
+ },
+ child: Text(
+ _isExpanded ? 'read_less'.tr() : 'read_more'.tr(),
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: sandColor,
+ decoration: TextDecoration.underline,
+ decorationColor: sandColor,
),
),
- const SizedBox(height: 24),
- if (hasFacilities) ...[
- Wrap(
- spacing: 8,
- runSpacing: 8,
- children: [
- ...facilities.map((f) => FacilityIconText(
- facility: f, showDivider: true)),
- GestureDetector(
- onTap: () =>
- _showFacilitiesSheet(context, facilities),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 4.0),
- child: Text(
- 'see_all_facilities'.tr(),
- style: theme.textTheme.bodySmall?.copyWith(
- color: sandColor,
- decoration: TextDecoration.underline,
- decorationColor: sandColor,
- ),
+ ),
+ const SizedBox(height: 24),
+ if (hasFacilities) ...[
+ Wrap(
+ spacing: 8,
+ runSpacing: 8,
+ children: [
+ ...facilities.map((f) => FacilityIconText(
+ facility: f, showDivider: true)),
+ GestureDetector(
+ onTap: () =>
+ _showFacilitiesSheet(context, facilities),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 4.0),
+ child: Text(
+ 'see_all_facilities'.tr(),
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: sandColor,
+ decoration: TextDecoration.underline,
+ decorationColor: sandColor,
),
),
),
- ],
- ),
- const SizedBox(height: 32),
- ],
+ ),
+ ],
+ ),
+ const SizedBox(height: 32),
],
- ),
+ ],
),
),
- ],
- ),
+ ),
+ ],
),
),
- bottomNavigationBar: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- const Divider(color: colorDivider),
- Padding(
- padding: const EdgeInsets.only(
- left: 16.0,
- right: 16.0,
- top: 16.0,
- bottom: 40,
- ),
- child: ElevatedButton(
- onPressed: () {
- Navigator.pop(context);
- },
- child: Text(
- 'choose_room'.tr(),
- style: theme.textTheme.headlineSmall
- ?.copyWith(color: Colors.white),
- ),
+ ),
+ bottomNavigationBar: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Divider(color: colorDivider),
+ Padding(
+ padding: const EdgeInsets.only(
+ left: 16.0,
+ right: 16.0,
+ top: 16.0,
+ bottom: 40,
+ ),
+ child: ElevatedButton(
+ onPressed: () {
+ Navigator.pop(context);
+ },
+ child: Text(
+ 'choose_room'.tr(),
+ style: theme.textTheme.headlineSmall
+ ?.copyWith(color: Colors.white),
),
),
- ],
- ),
- );
- }
- );
+ ),
+ ],
+ ),
+ );
+ });
}
void _showFacilitiesSheet(
diff --git a/comwell_key_app/lib/choose_share_room/pages/share_room_page.dart b/comwell_key_app/lib/choose_share_room/pages/share_room_page.dart
index 65b925ed..d9798e62 100644
--- a/comwell_key_app/lib/choose_share_room/pages/share_room_page.dart
+++ b/comwell_key_app/lib/choose_share_room/pages/share_room_page.dart
@@ -6,6 +6,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
+import 'package:go_router/go_router.dart';
class ShareRoomPage extends StatelessWidget {
final Booking booking;
@@ -35,7 +36,7 @@ class ShareRoomPage extends StatelessWidget {
padding: const EdgeInsets.only(right: 16),
child: ElevatedButton(
onPressed: () {
- Navigator.of(context).pop();
+ context.pop();
},
style: ElevatedButton.styleFrom(
minimumSize: const Size(36, 36),
@@ -126,7 +127,7 @@ class ShareRoomPage extends StatelessWidget {
color: colorHeadlineText,
),
),
- Text('Babyseng', style: theme.textTheme.headlineSmall),
+
const SizedBox(height: 24),
],
),
diff --git a/comwell_key_app/lib/common/components/room_image_carousel.dart b/comwell_key_app/lib/common/components/room_image_carousel.dart
new file mode 100644
index 00000000..74da843a
--- /dev/null
+++ b/comwell_key_app/lib/common/components/room_image_carousel.dart
@@ -0,0 +1,140 @@
+import 'package:flutter/material.dart';
+
+class RoomImageCarousel extends StatefulWidget {
+ final List<String> images;
+ const RoomImageCarousel({super.key, required this.images});
+
+ @override
+ State<RoomImageCarousel> createState() => _RoomImageCarouselState();
+}
+
+class _RoomImageCarouselState extends State<RoomImageCarousel> {
+ late PageController _pageController;
+ int _currentPage = 0;
+
+ @override
+ void initState() {
+ super.initState();
+ _pageController = PageController();
+ }
+
+ @override
+ void dispose() {
+ _pageController.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final height = MediaQuery.of(context).size.height;
+ return SizedBox(
+ width: double.infinity,
+ height: height * 0.5,
+ child: Stack(
+ children: [
+ PageView.builder(
+ controller: _pageController,
+ onPageChanged: (index) {
+ setState(() {
+ _currentPage = index;
+ });
+ },
+ itemCount: widget.images.length,
+ itemBuilder: (context, index) {
+ return Image.asset(
+ widget.images[index],
+ fit: BoxFit.cover,
+ );
+ },
+ ),
+ // This snippet conditionally displays a left arrow button for the image carousel only if
+ // there is more than one image and the currently displayed image is not the first one.
+ if (widget.images.length > 1 && _currentPage > 0)
+ Positioned(
+ left: 16,
+ bottom: 150,
+ child: Center(
+ child: Material(
+ color: Colors.transparent,
+ child: InkWell(
+ borderRadius: BorderRadius.circular(24),
+ onTap: () {
+ if (_currentPage > 0) {
+ _pageController.previousPage(
+ duration: const Duration(milliseconds: 300),
+ curve: Curves.easeInOut);
+ }
+ },
+ child: Container(
+ width: 32,
+ height: 32,
+ decoration: const BoxDecoration(
+ color: Colors.white,
+ shape: BoxShape.circle,
+ ),
+ child: const Icon(Icons.arrow_back_ios_new,
+ color: Colors.black, size: 16),
+ ),
+ ),
+ ),
+ ),
+ ),
+ // This snippet conditionally displays a right arrow button for the image carousel only if
+ // there is more than one image and the currently displayed image is not the last one.
+ if (widget.images.length > 1 &&
+ _currentPage < widget.images.length - 1)
+ Positioned(
+ right: 16,
+ bottom: 150,
+ child: Center(
+ child: Material(
+ color: Colors.transparent,
+ child: InkWell(
+ borderRadius: BorderRadius.circular(24),
+ onTap: () {
+ if (_currentPage < widget.images.length - 1) {
+ _pageController.nextPage(
+ duration: const Duration(milliseconds: 300),
+ curve: Curves.easeInOut);
+ }
+ },
+ child: Container(
+ width: 32,
+ height: 32,
+ decoration: const BoxDecoration(
+ color: Colors.white,
+ shape: BoxShape.circle,
+ ),
+ child: const Icon(Icons.arrow_forward_ios,
+ color: Colors.black, size: 16),
+ ),
+ ),
+ ),
+ ),
+ ),
+ // Dot indicators
+ Positioned(
+ bottom: 16,
+ left: 0,
+ right: 0,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: List.generate(
+ widget.images.length,
+ (index) => Container(
+ margin: const EdgeInsets.symmetric(horizontal: 4),
+ width: 8,
+ height: 8,
+ decoration: const BoxDecoration(
+ shape: BoxShape.circle,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/comwell_key_app/lib/up_sales/components/room_image_carousel.dart b/comwell_key_app/lib/up_sales/components/room_image_carousel.dart
deleted file mode 100644
index c7319280..00000000
--- a/comwell_key_app/lib/up_sales/components/room_image_carousel.dart
+++ /dev/null
@@ -1,133 +0,0 @@
-import 'package:flutter/material.dart';
-
-class RoomImageCarousel extends StatefulWidget {
- final List<String> images;
- const RoomImageCarousel({super.key, required this.images});
-
- @override
- State<RoomImageCarousel> createState() => _RoomImageCarouselState();
-}
-
-class _RoomImageCarouselState extends State<RoomImageCarousel> {
- late PageController _pageController;
- int _currentPage = 0;
-
- @override
- void initState() {
- super.initState();
- _pageController = PageController();
- }
-
- @override
- void dispose() {
- _pageController.dispose();
- super.dispose();
- }
-
- @override
- Widget build(BuildContext context) {
- final height = MediaQuery.of(context).size.height;
- return SizedBox(
- width: double.infinity,
- height: height * 0.5,
- child: Stack(
- children: [
- PageView.builder(
- controller: _pageController,
- onPageChanged: (index) {
- setState(() {
- _currentPage = index;
- });
- },
- itemCount: widget.images.length,
- itemBuilder: (context, index) {
- return Image.asset(
- widget.images[index],
- fit: BoxFit.cover,
- );
- },
- ),
- // Left arrow button
- if (widget.images.length > 1 && _currentPage > 0)
- Positioned(
- left: 16,
- bottom: 150,
- child: Center(
- child: Material(
- color: Colors.transparent,
- child: InkWell(
- borderRadius: BorderRadius.circular(24),
- onTap: () {
- if (_currentPage > 0) {
- _pageController.previousPage(duration: const Duration(milliseconds: 300), curve: Curves.easeInOut);
- }
- },
- child: Container(
- width: 32,
- height: 32,
- decoration: const BoxDecoration(
- color: Colors.white,
- shape: BoxShape.circle,
- ),
- child: const Icon(Icons.arrow_back_ios_new, color: Colors.black, size: 16),
- ),
- ),
- ),
- ),
- ),
- // Right arrow button
- if (widget.images.length > 1 && _currentPage < widget.images.length - 1)
- Positioned(
- right: 16,
- bottom: 150,
- child: Center(
- child: Material(
- color: Colors.transparent,
- child: InkWell(
- borderRadius: BorderRadius.circular(24),
- onTap: () {
- if (_currentPage < widget.images.length - 1) {
- _pageController.nextPage(duration: const Duration(milliseconds: 300), curve: Curves.easeInOut);
- }
- },
- child: Container(
- width: 32,
- height: 32,
- decoration: const BoxDecoration(
- color: Colors.white,
- shape: BoxShape.circle,
- ),
- child: const Icon(Icons.arrow_forward_ios, color: Colors.black, size: 16),
- ),
- ),
- ),
- ),
- ),
- // Dot indicators
- Positioned(
- bottom: 16,
- left: 0,
- right: 0,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: List.generate(
- widget.images.length,
- (index) => Container(
- margin: const EdgeInsets.symmetric(horizontal: 4),
- width: 8,
- height: 8,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: _currentPage == index
- ? Colors.white
- : Colors.white.withValues(alpha: 0.5),
- ),
- ),
- ),
- ),
- ),
- ],
- ),
- );
- }
-}
diff --git a/comwell_key_app/lib/up_sales/pages/room_upgrade_page.dart b/comwell_key_app/lib/up_sales/pages/room_upgrade_page.dart
index 9f675bea..381bab68 100644
--- a/comwell_key_app/lib/up_sales/pages/room_upgrade_page.dart
+++ b/comwell_key_app/lib/up_sales/pages/room_upgrade_page.dart
@@ -3,7 +3,7 @@ import 'package:comwell_key_app/common/const.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/up_sales/components/facilities_bottom_sheet.dart';
import 'package:comwell_key_app/up_sales/components/facility_icon_text.dart';
-import 'package:comwell_key_app/up_sales/components/room_image_carousel.dart';
+import 'package:comwell_key_app/common/components/room_image_carousel.dart';
import 'package:comwell_key_app/up_sales/components/up_sales_bottom_button.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';