6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 366ec2ba
Changed files
.../hotel_information/models/facilities.g.dart | 2 +- .../hotel_information/models/parking_info.g.dart | 8 +- .../hotel_information/models/restaurant.g.dart | 8 +- .../.generated/hotel_information/models/spa.g.dart | 8 +- .../models/structured_text.g.dart | 20 +++++ .../booking_details/bloc/booking_details_bloc.dart | 2 - .../components/get_a_phone_call_section.dart | 3 - comwell_key_app/lib/contact/contact_page.dart | 1 - .../components/hotel_information_menu.dart | 2 +- .../components/parking_facility_page.dart | 91 +++++++++++++--------- .../components/restaurant_page.dart | 20 +++-- .../components/spa_facility_page.dart | 21 +++-- .../cubit/hotel_information_cubit.dart | 19 ++--- .../hotel_information/hotel_information_page.dart | 3 +- .../lib/hotel_information/models/facilities.dart | 16 ++-- .../lib/hotel_information/models/hotel.dart | 6 ++ .../lib/hotel_information/models/parking_info.dart | 24 +++--- .../lib/hotel_information/models/restaurant.dart | 29 +++---- .../lib/hotel_information/models/spa.dart | 24 +++--- .../hotel_information/models/structured_text.dart | 18 +++++ .../repository/hotel_information_repository.dart | 6 +- .../pregistration/bloc/preregistration_cubit.dart | 2 - .../profile/components/logout_dialog_widget.dart | 1 - comwell_key_app/lib/routing/app_router.dart | 6 +- comwell_key_app/lib/services/api.dart | 8 +- 25 files changed, 218 insertions(+), 130 deletions(-)
Diff
diff --git a/comwell_key_app/lib/.generated/hotel_information/models/facilities.g.dart b/comwell_key_app/lib/.generated/hotel_information/models/facilities.g.dart
index 72018c49..3648eebc 100644
--- a/comwell_key_app/lib/.generated/hotel_information/models/facilities.g.dart
+++ b/comwell_key_app/lib/.generated/hotel_information/models/facilities.g.dart
@@ -7,7 +7,7 @@ part of '../../../hotel_information/models/facilities.dart';
// **************************************************************************
Map<String, dynamic> _$FacilityToJson(Facility instance) => <String, dynamic>{
- 'type': instance.type,
+ r'$type': instance.type,
'title': instance.title,
'iconPath': instance.iconPath,
'routeName': instance.routeName,
diff --git a/comwell_key_app/lib/.generated/hotel_information/models/parking_info.g.dart b/comwell_key_app/lib/.generated/hotel_information/models/parking_info.g.dart
index 63018362..0ab13115 100644
--- a/comwell_key_app/lib/.generated/hotel_information/models/parking_info.g.dart
+++ b/comwell_key_app/lib/.generated/hotel_information/models/parking_info.g.dart
@@ -12,7 +12,10 @@ ParkingInfo _$ParkingInfoFromJson(Map json) => ParkingInfo(
electricChargingTitle: json['electricChargingTitle'] as String,
electricChargingDescription:
json['electricChargingDescription'] as String,
- structedText: Map<String, dynamic>.from(json['structedText'] as Map),
+ structuredTextBlocks: (json['structuredTextBlocks'] as List<dynamic>)
+ .map((e) =>
+ StructuredTextBlock.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
);
Map<String, dynamic> _$ParkingInfoToJson(ParkingInfo instance) =>
@@ -21,5 +24,6 @@ Map<String, dynamic> _$ParkingInfoToJson(ParkingInfo instance) =>
'electricCharging': instance.electricCharging,
'electricChargingTitle': instance.electricChargingTitle,
'electricChargingDescription': instance.electricChargingDescription,
- 'structedText': instance.structedText,
+ 'structuredTextBlocks':
+ instance.structuredTextBlocks.map((e) => e.toJson()).toList(),
};
diff --git a/comwell_key_app/lib/.generated/hotel_information/models/restaurant.g.dart b/comwell_key_app/lib/.generated/hotel_information/models/restaurant.g.dart
index 86ffb2e2..d540d0f7 100644
--- a/comwell_key_app/lib/.generated/hotel_information/models/restaurant.g.dart
+++ b/comwell_key_app/lib/.generated/hotel_information/models/restaurant.g.dart
@@ -13,7 +13,10 @@ Restaurant _$RestaurantFromJson(Map json) => Restaurant(
openingHours: json['openingHours'] as String,
phoneNumber: json['phoneNumber'] as String,
email: json['email'] as String,
- structedText: Map<String, dynamic>.from(json['structedText'] as Map),
+ structuredTextBlocks: (json['structuredText'] as List<dynamic>)
+ .map((e) =>
+ StructuredTextBlock.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
);
Map<String, dynamic> _$RestaurantToJson(Restaurant instance) =>
@@ -24,5 +27,6 @@ Map<String, dynamic> _$RestaurantToJson(Restaurant instance) =>
'openingHours': instance.openingHours,
'phoneNumber': instance.phoneNumber,
'email': instance.email,
- 'structedText': instance.structedText,
+ 'structuredText':
+ instance.structuredTextBlocks.map((e) => e.toJson()).toList(),
};
diff --git a/comwell_key_app/lib/.generated/hotel_information/models/spa.g.dart b/comwell_key_app/lib/.generated/hotel_information/models/spa.g.dart
index df1cd3f0..ebaf87e2 100644
--- a/comwell_key_app/lib/.generated/hotel_information/models/spa.g.dart
+++ b/comwell_key_app/lib/.generated/hotel_information/models/spa.g.dart
@@ -11,14 +11,18 @@ Spa _$SpaFromJson(Map json) => Spa(
image: json['image'] as String,
spaBookingLink: SpaBookingLink.fromJson(
Map<String, dynamic>.from(json['spaBookingLink'] as Map)),
- structedText: Map<String, dynamic>.from(json['structedText'] as Map),
+ structuredTextBlocks: (json['structuredText'] as List<dynamic>)
+ .map((e) =>
+ StructuredTextBlock.fromJson(Map<String, dynamic>.from(e as Map)))
+ .toList(),
);
Map<String, dynamic> _$SpaToJson(Spa instance) => <String, dynamic>{
'title': instance.title,
'image': instance.image,
'spaBookingLink': instance.spaBookingLink.toJson(),
- 'structedText': instance.structedText,
+ 'structuredText':
+ instance.structuredTextBlocks.map((e) => e.toJson()).toList(),
};
SpaBookingLink _$SpaBookingLinkFromJson(Map json) => SpaBookingLink(
diff --git a/comwell_key_app/lib/.generated/hotel_information/models/structured_text.g.dart b/comwell_key_app/lib/.generated/hotel_information/models/structured_text.g.dart
new file mode 100644
index 00000000..7c45d5be
--- /dev/null
+++ b/comwell_key_app/lib/.generated/hotel_information/models/structured_text.g.dart
@@ -0,0 +1,20 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../hotel_information/models/structured_text.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+StructuredTextBlock _$StructuredTextBlockFromJson(Map json) =>
+ StructuredTextBlock(
+ type: json['type'] as String,
+ data: json['data'] as String,
+ );
+
+Map<String, dynamic> _$StructuredTextBlockToJson(
+ StructuredTextBlock instance) =>
+ <String, dynamic>{
+ 'type': instance.type,
+ 'data': instance.data,
+ };
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..fc240b73 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
@@ -154,8 +154,6 @@ class BookingDetailsBloc
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/contact/components/get_a_phone_call_section.dart b/comwell_key_app/lib/contact/components/get_a_phone_call_section.dart
index 9e6f4529..19149c30 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,8 +1,5 @@
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/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';
diff --git a/comwell_key_app/lib/contact/contact_page.dart b/comwell_key_app/lib/contact/contact_page.dart
index 883bb0ff..7d417180 100644
--- a/comwell_key_app/lib/contact/contact_page.dart
+++ b/comwell_key_app/lib/contact/contact_page.dart
@@ -2,7 +2,6 @@ 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';
diff --git a/comwell_key_app/lib/hotel_information/components/hotel_information_menu.dart b/comwell_key_app/lib/hotel_information/components/hotel_information_menu.dart
index 829de7f0..17420f22 100644
--- a/comwell_key_app/lib/hotel_information/components/hotel_information_menu.dart
+++ b/comwell_key_app/lib/hotel_information/components/hotel_information_menu.dart
@@ -19,7 +19,7 @@ class HotelInformationMenu extends StatelessWidget {
children: [
Image.network(
hotel.image,
- height: height * 0.5,
+ height: height * 0.4,
width: double.infinity,
fit: BoxFit.cover,
),
diff --git a/comwell_key_app/lib/hotel_information/components/parking_facility_page.dart b/comwell_key_app/lib/hotel_information/components/parking_facility_page.dart
index d689d211..17bfad19 100644
--- a/comwell_key_app/lib/hotel_information/components/parking_facility_page.dart
+++ b/comwell_key_app/lib/hotel_information/components/parking_facility_page.dart
@@ -9,51 +9,68 @@ class ParkingFacilityPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final height = MediaQuery.of(context).size.height;
-
- return Column(
- children: [
- Image.asset(
- 'assets/images/parking.png',
- height: height * 0.45,
- width: double.infinity,
- fit: BoxFit.cover,
- ),
- Expanded(
- child: SingleChildScrollView(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 26),
- Text(
- parkingInfo.title,
- style: Theme.of(context).textTheme.headlineLarge,
- ),
- const SizedBox(height: 20),
- Text(
- parkingInfo.structedText.toString(),
- style: Theme.of(context).textTheme.bodySmall,
- ),
- if (parkingInfo.electricCharging) ...[
- const SizedBox(height: 40),
+ final theme = Theme.of(context);
+
+ return Scaffold(
+ backgroundColor: Colors.white,
+ body: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image.asset(
+ 'assets/images/parking.png',
+ height: height * 0.4,
+ width: double.infinity,
+ fit: BoxFit.cover,
+ ),
+ Expanded(
+ child: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ const SizedBox(height: 26),
Text(
- parkingInfo.electricChargingTitle,
- style: Theme.of(context).textTheme.headlineMedium,
+ parkingInfo.title,
+ style: theme.textTheme.headlineLarge,
),
const SizedBox(height: 20),
- Text(
- parkingInfo.electricChargingDescription,
- style: Theme.of(context).textTheme.bodySmall,
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: parkingInfo.structuredTextBlocks.map((block) {
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 16.0),
+ child: Text(
+ block.data,
+ style: block.type == "headerBlock"
+ ? theme.textTheme.headlineSmall
+ : theme.textTheme.bodySmall,
+ ),
+ );
+ }).toList(),
),
+ if (parkingInfo.electricCharging) ...[
+ const SizedBox(height: 40),
+ Text(
+ parkingInfo.electricChargingTitle,
+ style: theme.textTheme.headlineMedium,
+ ),
+ const SizedBox(height: 20),
+ Text(
+ parkingInfo.electricChargingDescription,
+ style: theme.textTheme.bodySmall,
+ ),
+ ],
],
- const SizedBox(height: 100),
- ],
+ ),
),
),
),
- ),
- ],
+ ],
+ ),
);
}
}
diff --git a/comwell_key_app/lib/hotel_information/components/restaurant_page.dart b/comwell_key_app/lib/hotel_information/components/restaurant_page.dart
index 9d1f8db1..d0937ced 100644
--- a/comwell_key_app/lib/hotel_information/components/restaurant_page.dart
+++ b/comwell_key_app/lib/hotel_information/components/restaurant_page.dart
@@ -16,11 +16,11 @@ class RestaurantPage extends StatelessWidget {
return Scaffold(
backgroundColor: Colors.white,
- bottomSheet: Column(
+ body: Column(
children: [
Image.network(
restaurant.image,
- height: height * 0.45,
+ height: height * 0.4,
width: double.infinity,
fit: BoxFit.cover,
),
@@ -37,9 +37,19 @@ class RestaurantPage extends StatelessWidget {
style: theme.textTheme.headlineLarge,
),
const SizedBox(height: 20),
- Text(
- restaurant.structedText.toString(),
- style: theme.textTheme.bodySmall,
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: restaurant.structuredTextBlocks.map((block) {
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 16.0),
+ child: Text(
+ block.data,
+ style: block.type == "headerBlock"
+ ? theme.textTheme.headlineSmall
+ : theme.textTheme.bodySmall,
+ ),
+ );
+ }).toList(),
),
const SizedBox(height: 40),
Text(
diff --git a/comwell_key_app/lib/hotel_information/components/spa_facility_page.dart b/comwell_key_app/lib/hotel_information/components/spa_facility_page.dart
index f6a18f26..a50f3b87 100644
--- a/comwell_key_app/lib/hotel_information/components/spa_facility_page.dart
+++ b/comwell_key_app/lib/hotel_information/components/spa_facility_page.dart
@@ -15,6 +15,7 @@ class SpaFacilityPage extends StatelessWidget {
final isLoading = cubit.state.spaButtonIsLoading;
final theme = Theme.of(context);
final height = MediaQuery.of(context).size.height;
+
return Scaffold(
backgroundColor: Colors.white,
bottomSheet: Builder(builder: (context) {
@@ -74,7 +75,7 @@ class SpaFacilityPage extends StatelessWidget {
children: [
Image.network(
spa.image,
- height: height * 0.45,
+ height: height * 0.4,
width: double.infinity,
fit: BoxFit.cover,
),
@@ -88,12 +89,22 @@ class SpaFacilityPage extends StatelessWidget {
const SizedBox(height: 26),
Text(
spa.title,
- style: Theme.of(context).textTheme.headlineLarge,
+ style: theme.textTheme.headlineLarge,
),
const SizedBox(height: 20),
- Text(
- spa.structedText.toString(),
- style: Theme.of(context).textTheme.bodySmall,
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: spa.structuredTextBlocks.map((block) {
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 16.0),
+ child: Text(
+ block.data,
+ style: block.type == "headerBlock"
+ ? theme.textTheme.headlineSmall
+ : theme.textTheme.bodySmall,
+ ),
+ );
+ }).toList(),
),
const SizedBox(height: 100),
],
diff --git a/comwell_key_app/lib/hotel_information/cubit/hotel_information_cubit.dart b/comwell_key_app/lib/hotel_information/cubit/hotel_information_cubit.dart
index ac92e380..16e6497c 100644
--- a/comwell_key_app/lib/hotel_information/cubit/hotel_information_cubit.dart
+++ b/comwell_key_app/lib/hotel_information/cubit/hotel_information_cubit.dart
@@ -1,3 +1,5 @@
+import 'dart:ui';
+
import 'package:bloc/bloc.dart';
import 'package:comwell_key_app/hotel_information/models/hotel.dart';
import 'package:comwell_key_app/hotel_information/repository/hotel_information_repository.dart';
@@ -12,29 +14,22 @@ class HotelInformationCubit extends Cubit<HotelInformationState> {
final api = Api();
final HotelInformationRepository hotelInformationRepository;
late final Hotel hotel;
+ final Locale culture;
final Booking booking;
HotelInformationCubit(
- {required this.hotelInformationRepository, required this.booking})
+ {required this.hotelInformationRepository, required this.booking, required this.culture})
: super(const HotelInformationState.initial());
void init() async {
emit(state.hotelLoading());
try {
- print("fetching hotel information for ${booking.hotelCode}");
hotel = await hotelInformationRepository
- .fetchHotelInformation(booking.hotelCode);
+ .fetchHotelInformation(booking.hotelCode, culture);
+ print("hotel: $hotel");
emit(state.hotelSuccess());
} catch (e) {
- print("error fetching hotel information for ${booking.hotelCode}: $e");
- emit(state.hotelError());
- }
- }
-
- void fetchHotelInformation(String hotelCode) async {
- try {
- print("fetching hotel information for $hotelCode");
- } catch (e) {
+ debugPrint("error fetching hotel information for ${booking.hotelCode}: $e");
emit(state.hotelError());
}
}
diff --git a/comwell_key_app/lib/hotel_information/hotel_information_page.dart b/comwell_key_app/lib/hotel_information/hotel_information_page.dart
index 11fc5ee8..84844af6 100644
--- a/comwell_key_app/lib/hotel_information/hotel_information_page.dart
+++ b/comwell_key_app/lib/hotel_information/hotel_information_page.dart
@@ -1,9 +1,9 @@
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
import 'package:comwell_key_app/hotel_information/cubit/hotel_information_cubit.dart';
-import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
+
class HotelInformationPage extends StatelessWidget {
final Widget child;
const HotelInformationPage({super.key, required this.child});
@@ -12,6 +12,7 @@ class HotelInformationPage extends StatelessWidget {
Widget build(BuildContext context) {
return BlocBuilder<HotelInformationCubit, HotelInformationState>(
builder: (context, state) {
+
return Scaffold(
extendBodyBehindAppBar: true,
appBar: const ComwellAppBar(),
diff --git a/comwell_key_app/lib/hotel_information/models/facilities.dart b/comwell_key_app/lib/hotel_information/models/facilities.dart
index b8407441..d09f6613 100644
--- a/comwell_key_app/lib/hotel_information/models/facilities.dart
+++ b/comwell_key_app/lib/hotel_information/models/facilities.dart
@@ -8,6 +8,7 @@ part '../../.generated/hotel_information/models/facilities.g.dart';
@JsonSerializable(createFactory: false)
class Facility {
+ @JsonKey(name: '\$type')
final String type;
final String title;
final String iconPath;
@@ -23,16 +24,15 @@ class Facility {
});
factory Facility.fromJson(Json json) {
- final facilityType = json["type"] as String;
- final valueJson = json["value"] as Json;
-
- return switch (facilityType) {
- "Spa" => Spa.fromJson({...json, "value": valueJson}),
- "Restaurant" => Restaurant.fromJson({...json, "value": valueJson}),
- "ParkingInfo" => ParkingInfo.fromJson({...json, "value": valueJson}),
- _ => throw Exception("Unsupported facility type: $facilityType")
+ return switch (json["\$type"] as String) {
+ "SpaFacility" => Spa.fromJson(json),
+ "RestaurantFacility" => Restaurant.fromJson(json),
+ "ParkingFacility" => ParkingInfo.fromJson(json),
+ _ => throw Exception("Unsupported facility type: ${json["\$type"]}")
};
}
Json toJson() => _$FacilityToJson(this);
}
+
+
diff --git a/comwell_key_app/lib/hotel_information/models/hotel.dart b/comwell_key_app/lib/hotel_information/models/hotel.dart
index 2145d9ef..1a27b168 100644
--- a/comwell_key_app/lib/hotel_information/models/hotel.dart
+++ b/comwell_key_app/lib/hotel_information/models/hotel.dart
@@ -27,4 +27,10 @@ class Hotel {
factory Hotel.fromJson(Json json) => _$HotelFromJson(json);
Json toJson() => _$HotelToJson(this);
+
+ @override
+ String toString() {
+ return "Hotel(hotelCode: $hotelCode, hotelName: $hotelName, address: $address, city: $city, country: $country, image: $image, facilities: $facilities)";
+ }
+
}
diff --git a/comwell_key_app/lib/hotel_information/models/parking_info.dart b/comwell_key_app/lib/hotel_information/models/parking_info.dart
index f74637e6..41c3e734 100644
--- a/comwell_key_app/lib/hotel_information/models/parking_info.dart
+++ b/comwell_key_app/lib/hotel_information/models/parking_info.dart
@@ -1,6 +1,6 @@
import 'package:comwell_key_app/hotel_information/models/facilities.dart';
+import 'package:comwell_key_app/hotel_information/models/structured_text.dart';
import 'package:comwell_key_app/utils/json.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:json_annotation/json_annotation.dart';
part '../../.generated/hotel_information/models/parking_info.g.dart';
@@ -10,36 +10,36 @@ class ParkingInfo extends Facility {
final bool electricCharging;
final String electricChargingTitle;
final String electricChargingDescription;
- final Json structedText;
+ final List<StructuredTextBlock> structuredTextBlocks;
ParkingInfo({
required super.title,
required this.electricCharging,
required this.electricChargingTitle,
required this.electricChargingDescription,
- required this.structedText,
+ required this.structuredTextBlocks,
}) : super(
- type: "Parking",
+ type: "ParkingFacility",
iconPath: "assets/icons/ic_car.svg",
routeName: "parking",
value: {
- "\$type": "ParkingFacility",
"title": title,
"electricCharging": electricCharging,
"electricChargingTitle": electricChargingTitle,
"electricChargingDescription": electricChargingDescription,
- "structedText": structedText,
+ "structuredText": structuredTextBlocks.map((block) => block.toJson()).toList(),
},
);
factory ParkingInfo.fromJson(Json json) {
- final value = json["value"] as Json;
return ParkingInfo(
- title: value["title"] as String,
- electricCharging: value["electricCharging"] as bool,
- electricChargingTitle: value["electricChargingTitle"] as String,
- electricChargingDescription: value["electricChargingDescription"] as String,
- structedText: value["structedText"] as Json,
+ title: json["title"] as String,
+ electricCharging: json["electricCharging"] as bool,
+ electricChargingTitle: json["electricChargingTitle"] as String,
+ electricChargingDescription: json["electricChargingDescription"] as String,
+ structuredTextBlocks: (json["structuredText"] as List)
+ .map((block) => StructuredTextBlock.fromJson(block as Json))
+ .toList(),
);
}
diff --git a/comwell_key_app/lib/hotel_information/models/restaurant.dart b/comwell_key_app/lib/hotel_information/models/restaurant.dart
index 4bef1ad6..f645ff37 100644
--- a/comwell_key_app/lib/hotel_information/models/restaurant.dart
+++ b/comwell_key_app/lib/hotel_information/models/restaurant.dart
@@ -1,6 +1,6 @@
import 'package:comwell_key_app/hotel_information/models/facilities.dart';
+import 'package:comwell_key_app/hotel_information/models/structured_text.dart';
import 'package:comwell_key_app/utils/json.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:json_annotation/json_annotation.dart';
part '../../.generated/hotel_information/models/restaurant.g.dart';
@@ -12,7 +12,8 @@ class Restaurant extends Facility {
final String openingHours;
final String phoneNumber;
final String email;
- final Json structedText;
+ @JsonKey(name: 'structuredText')
+ final List<StructuredTextBlock> structuredTextBlocks;
Restaurant({
required super.title,
@@ -21,33 +22,33 @@ class Restaurant extends Facility {
required this.openingHours,
required this.phoneNumber,
required this.email,
- required this.structedText,
+ required this.structuredTextBlocks,
}) : super(
- type: "Restaurant",
+ type: "RestaurantFacility",
iconPath: "assets/icons/ic_chefs_hat.svg",
routeName: "restaurant",
value: {
- "\$type": "RestaurantFacility",
"image": image,
"title": title,
"address": address,
"openingHours": openingHours,
"phoneNumber": phoneNumber,
"email": email,
- "structedText": structedText,
+ "structuredText": structuredTextBlocks.map((block) => block.toJson()).toList(),
},
);
factory Restaurant.fromJson(Json json) {
- final value = json["value"] as Json;
return Restaurant(
- title: value["title"] as String,
- image: value["image"] as String,
- address: value["address"] as String,
- openingHours: value["openingHours"] as String,
- phoneNumber: value["phoneNumber"] as String,
- email: value["email"] as String,
- structedText: value["structedText"] as Json,
+ title: json["title"] as String,
+ image: json["image"] as String,
+ address: json["address"] as String,
+ openingHours: json["openingHours"] as String,
+ phoneNumber: json["phoneNumber"] as String,
+ email: json["email"] as String,
+ structuredTextBlocks: (json["structuredText"] as List)
+ .map((block) => StructuredTextBlock.fromJson(block as Json))
+ .toList(),
);
}
diff --git a/comwell_key_app/lib/hotel_information/models/spa.dart b/comwell_key_app/lib/hotel_information/models/spa.dart
index b3dcb291..4d1126f8 100644
--- a/comwell_key_app/lib/hotel_information/models/spa.dart
+++ b/comwell_key_app/lib/hotel_information/models/spa.dart
@@ -1,6 +1,6 @@
import 'package:comwell_key_app/hotel_information/models/facilities.dart';
+import 'package:comwell_key_app/hotel_information/models/structured_text.dart';
import 'package:comwell_key_app/utils/json.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:json_annotation/json_annotation.dart';
part '../../.generated/hotel_information/models/spa.g.dart';
@@ -9,33 +9,35 @@ part '../../.generated/hotel_information/models/spa.g.dart';
class Spa extends Facility {
final String image;
final SpaBookingLink spaBookingLink;
- final Json structedText;
+ @JsonKey(name: 'structuredText')
+ final List<StructuredTextBlock> structuredTextBlocks;
Spa({
required super.title,
required this.image,
required this.spaBookingLink,
- required this.structedText,
+ required this.structuredTextBlocks,
}) : super(
- type: "Spa",
+ type: "SpaFacility",
iconPath: "assets/icons/ic_spa.svg",
routeName: "spa",
value: {
- "\$type": "SpaFacility",
"image": image,
"spaBookingLink": spaBookingLink.toJson(),
"title": title,
- "structedText": structedText,
+ "structuredText":
+ structuredTextBlocks.map((block) => block.toJson()).toList(),
},
);
factory Spa.fromJson(Json json) {
- final value = json["value"] as Json;
return Spa(
- title: value["title"] as String,
- image: value["image"] as String,
- spaBookingLink: SpaBookingLink.fromJson(value["spaBookingLink"] as Json),
- structedText: value["structedText"] as Json,
+ title: json["title"] as String,
+ image: json["image"] as String,
+ spaBookingLink: SpaBookingLink.fromJson(json["spaBookingLink"] as Json),
+ structuredTextBlocks: (json["structuredText"] as List)
+ .map((block) => StructuredTextBlock.fromJson(block as Json))
+ .toList(),
);
}
diff --git a/comwell_key_app/lib/hotel_information/models/structured_text.dart b/comwell_key_app/lib/hotel_information/models/structured_text.dart
new file mode 100644
index 00000000..d3198d72
--- /dev/null
+++ b/comwell_key_app/lib/hotel_information/models/structured_text.dart
@@ -0,0 +1,18 @@
+import 'package:comwell_key_app/utils/json.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part '../../.generated/hotel_information/models/structured_text.g.dart';
+
+@JsonSerializable()
+class StructuredTextBlock {
+ final String type;
+ final String data;
+
+ StructuredTextBlock({
+ required this.type,
+ required this.data,
+ });
+
+ factory StructuredTextBlock.fromJson(Json json) => _$StructuredTextBlockFromJson(json);
+ Json toJson() => _$StructuredTextBlockToJson(this);
+}
\ No newline at end of file
diff --git a/comwell_key_app/lib/hotel_information/repository/hotel_information_repository.dart b/comwell_key_app/lib/hotel_information/repository/hotel_information_repository.dart
index effdfe32..14e7ac3c 100644
--- a/comwell_key_app/lib/hotel_information/repository/hotel_information_repository.dart
+++ b/comwell_key_app/lib/hotel_information/repository/hotel_information_repository.dart
@@ -1,3 +1,5 @@
+import 'dart:ui';
+
import 'package:comwell_key_app/hotel_information/models/hotel.dart';
import 'package:comwell_key_app/services/api.dart';
import 'package:comwell_key_app/utils/json.dart';
@@ -5,9 +7,9 @@ import 'package:comwell_key_app/utils/json.dart';
class HotelInformationRepository {
final api = Api();
- Future<Hotel> fetchHotelInformation(String hotelCode) async {
+ Future<Hotel> fetchHotelInformation(String hotelCode, Locale culture) async {
try {
- final response = await api.getHotelInfo(hotelCode);
+ final response = await api.getHotelInfo(hotelCode, culture);
final data = response.data as Json;
final hotelInfo = Hotel.fromJson(data);
return hotelInfo;
diff --git a/comwell_key_app/lib/pregistration/bloc/preregistration_cubit.dart b/comwell_key_app/lib/pregistration/bloc/preregistration_cubit.dart
index 62b1ed36..ad2fbc91 100644
--- a/comwell_key_app/lib/pregistration/bloc/preregistration_cubit.dart
+++ b/comwell_key_app/lib/pregistration/bloc/preregistration_cubit.dart
@@ -2,7 +2,6 @@ import 'package:bloc/bloc.dart';
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';
@@ -293,7 +292,6 @@ class PreregistrationCubit extends Cubit<PreregistrationState> {
}
void onTermsAndConditionsToggled(bool toggle) {
- print("toggle: $toggle");
emit(state.copyWith(isTermsAccepted: toggle));
}
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 af3afc4e..26a17cde 100644
--- a/comwell_key_app/lib/profile/components/logout_dialog_widget.dart
+++ b/comwell_key_app/lib/profile/components/logout_dialog_widget.dart
@@ -1,5 +1,4 @@
import 'package:comwell_key_app/profile/cubit/profile_cubit.dart';
-import 'package:comwell_key_app/themes/light_theme.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 11464f08..c820663d 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -53,6 +53,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
+import 'package:easy_localization/easy_localization.dart';
import '../hotel_information/models/restaurant.dart';
import '../hotel_information/repository/hotel_information_repository.dart';
@@ -105,13 +106,14 @@ GoRouter goRouter() {
navigatorKey: _shellNavigatorKey,
parentNavigatorKey: _rootNavigatorKey,
pageBuilder: (context, state, child) {
-
+ final culture = context.locale;
return NoTransitionPage(
child: BlocProvider<HotelInformationCubit>(
create: (BuildContext context) => HotelInformationCubit(
hotelInformationRepository:
locator<HotelInformationRepository>(),
- booking: state.extra as Booking)
+ booking: state.extra as Booking,
+ culture: culture)
..init(),
child:
BlocBuilder<HotelInformationCubit, HotelInformationState>(
diff --git a/comwell_key_app/lib/services/api.dart b/comwell_key_app/lib/services/api.dart
index 0e5d8718..29e0c805 100644
--- a/comwell_key_app/lib/services/api.dart
+++ b/comwell_key_app/lib/services/api.dart
@@ -39,7 +39,6 @@ class Api {
Future<StoredPaymentsResponse?> getPaymentMethods() async {
final response = await dio.get<Json>(ApiEndpoints.storedPaymentMethods);
- print("response=$response");
return StoredPaymentsResponse.fromJson(response.data!);
}
@@ -154,9 +153,10 @@ class Api {
return response;
}
- Future<dynamic> getHotelInfo(String hotelCode) async {
- final response = await dio.get<Json>('/Content/v1/api/v1/hotel?hotelCode=$hotelCode');
- print("qqq response: ${response.data}");
+ Future<dynamic> getHotelInfo(String hotelCode, Locale culture) async {
+ final cultureString = culture.toString().replaceAll('_', '-');
+ final response = await dio.get<Json>('/Content/v1/api/v1/hotel?hotelCode=$hotelCode&culture=$cultureString');
+
return response;
}