6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 67b8debe

AuthorMikkel Thygesen<mikkelet@gmail.com>
Date2026-02-15 12:17:02 +0100
3795: migrated easy localisation to intl

Changed files

comwell_key_app/assets/translations/intl_da.arb    |   7 +-
 comwell_key_app/assets/translations/intl_en.arb    |   7 +-
 .../lib/.generated/l10n/app_localizations.dart     |  30 +++
 .../lib/.generated/l10n/app_localizations_da.dart  |  19 ++
 .../lib/.generated/l10n/app_localizations_en.dart  |  19 ++
 .../components/check_in_button.dart                |  10 +-
 .../components/check_in_button_timer.dart          |  57 +++--
 .../components/check_out_button.dart               |   8 +-
 .../components/get_keys_button.dart                |   6 +-
 .../lib/booking_details/components/guest_list.dart |   4 +-
 .../components/housekeeping_button.dart            |  35 ++-
 .../components/preregister_button.dart             |   6 +-
 .../components/remove_guest_dialog.dart            |  12 +-
 .../components/room_key_widget.dart                |  66 ++---
 .../components/room_number_container.dart          |   4 +-
 .../booking_details/components/share_button.dart   |  18 +-
 .../components/unlock_room_button.dart             |   4 +-
 .../lib/check_in/bloc/check_in_state.dart          |  17 +-
 comwell_key_app/lib/check_in/check_in_page.dart    |  21 +-
 .../choose_share_room/choose_share_room_page.dart  |  10 +-
 .../components/choose_room_widget.dart             |  12 +-
 .../components/my_room_widget.dart                 |  11 +-
 .../components/share_room_confirm_dialog.dart      |  10 +-
 .../cubit/choose_share_room_cubit.dart             |  14 +-
 .../choose_share_room/pages/room_info_page.dart    |   8 +-
 .../pages/share_room_base_page_template.dart       | 281 +++++++++++----------
 .../template_pages/payment_page_template.dart      |   4 +-
 comwell_key_app/lib/comwell_app.dart               |  23 +-
 .../lib/contact/components/call_us_section.dart    |  10 +-
 .../components/get_a_phone_call_section.dart       |  20 +-
 comwell_key_app/lib/contact/contact_page.dart      |   4 +-
 .../lib/find_booking/find_booking_page.dart        |   6 +-
 .../lib/force_update/force_update_page.dart        |  10 +-
 .../lib/hotel_information/components/address.dart  |   4 +-
 .../lib/hotel_information/components/email.dart    |   7 +-
 .../components/hotel_bottom_sheet_button.dart      |   4 +-
 .../components/maps_bottom_modal.dart              |  16 +-
 .../components/opening_hours.dart                  |   4 +-
 .../hotel_information/components/phone_number.dart |   4 +-
 .../components/spa_facility_page.dart              |  86 ++++---
 .../components/structured_text.dart                |   4 +-
 .../hotel_information/hotel_information_page.dart  |   6 +-
 .../pages/hotel_information_menu.dart              |   7 +-
 .../lib/login/components/forced_logout_banner.dart |   6 +-
 .../lib/my_booking/cubit/my_booking_state.dart     |  62 +++--
 .../components/communications_list.dart            |   5 +-
 .../notifications/cubit/notifications_cubit.dart   |  19 +-
 .../notifications/cubit/notifications_state.dart   |  12 +-
 .../models/notification_permission.dart            |  47 ++--
 .../lib/notifications/notifications_page.dart      |  12 +-
 .../notifications/notifications_repository.dart    |  32 +--
 .../overview/components/bill_download_modal.dart   |   8 +-
 .../components/booking_list_item_view.dart         |   5 +-
 .../components/current_booking_list_item_view.dart |   7 +-
 .../overview/components/find_booking_button.dart   |   4 +-
 .../overview/components/prepare_room_widget.dart   |   6 +-
 .../overview/components/room_selection_widget.dart |   6 +-
 comwell_key_app/lib/overview/overview_page.dart    |  42 +--
 .../pregistration/components/information_card.dart |   4 +-
 .../pregistration/cubit/preregistration_cubit.dart |  22 +-
 .../pregistration/pages/prereg_address_page.dart   | 198 ++++++++-------
 .../pages/prereg_confirmation_page.dart            | 197 ++++++++-------
 .../pregistration/pages/prereg_profile_page.dart   | 179 +++++++------
 .../pages/prereg_up_sales_catalog_page.dart        |  14 +-
 .../lib/pregistration/preregistration_flow.dart    | 107 ++++----
 .../past_cancelled_booking_detail_page.dart        |  31 +--
 .../screens/share_room/share_room_page.dart        |  13 +-
 .../profile/components/card_content_widget.dart    |   9 +-
 .../profile/components/comwell_club_container.dart |   6 +-
 .../comwell_club_signup_bottom_sheet.dart          |  24 +-
 .../lib/profile/components/error_page_widget.dart  |   8 +-
 .../profile/components/logout_dialog_widget.dart   |   8 +-
 .../profile/components/profile_page_widget.dart    |  11 +-
 .../components/address_bottom_sheet.dart           |  12 +-
 .../components/date_time_picker.dart               |  11 +-
 .../components/delete_profile_dialog_widget.dart   |  10 +-
 .../profile_settings/profile_settings_page.dart    | 145 ++++++-----
 .../received_shared_booking_page.dart              |   8 +-
 .../components/catalog/room_upgrade_catalog.dart   |   4 +-
 .../components/confirm_up_sales_dialog.dart        |  22 +-
 .../components/facilities_bottom_sheet.dart        |   4 +-
 .../components/up_sales_catalog_button.dart        |   6 +-
 .../components/up_sales_continue_button.dart       |   4 +-
 .../components/up_sales_services_widget.dart       |  10 +-
 .../components/up_sales_upgrades_widget.dart       |   7 +-
 .../lib/up_sales/pages/addon_upgrade_page.dart     |   7 +-
 .../pages/processing/up_sales_error_page.dart      |   8 +-
 .../lib/up_sales/pages/room_upgrade_page.dart      | 256 ++++++++++---------
 .../lib/up_sales/pages/services_upgrade_page.dart  |  14 +-
 .../up_sales/pages/up_sale_confirmation_page.dart  |  17 +-
 comwell_key_app/lib/up_sales/up_sales_catalog.dart |  10 +-
 comwell_key_app/lib/utils/context_utils.dart       |   2 +
 .../templates/share_booking_base_template.dart     |  99 ++++----
 comwell_key_app/pubspec.yaml                       |   6 +-
 94 files changed, 1418 insertions(+), 1263 deletions(-)

Diff

diff --git a/comwell_key_app/assets/translations/intl_da.arb b/comwell_key_app/assets/translations/intl_da.arb
index 91173665..8eb0a2a8 100644
--- a/comwell_key_app/assets/translations/intl_da.arb
+++ b/comwell_key_app/assets/translations/intl_da.arb
@@ -206,6 +206,7 @@
"cancel_sharing": "Fortryd deling",
"check_out_my_booking": "Check ud af mit ophold",
"dates": "Datoer",
+ "guest": "Gæst",
"guests": "Gæster",
"view_booking": "Se booking",
"comwell_booking": "Comwell Ophold",
@@ -382,5 +383,9 @@
"payment_overview_send_comment_title": "Kommentar",
"payment_overview_send_receipt_hint": "Indsæt kommentar",
"key_page_room_prefix": "Værelse {roomNumber}",
- "please_accept_terms": "Accepter venligst vilkårene"
+ "please_accept_terms": "Accepter venligst vilkårene",
+ "received_shared_room_page_subtitle": "text {name}",
+ "received_shared_room_page_title": "",
+ "received_shared_booking_page_title": "",
+ "received_shared_booking_page_subtitle": "text {name}"
}
\ No newline at end of file
diff --git a/comwell_key_app/assets/translations/intl_en.arb b/comwell_key_app/assets/translations/intl_en.arb
index eb9e0d59..9b1c279d 100644
--- a/comwell_key_app/assets/translations/intl_en.arb
+++ b/comwell_key_app/assets/translations/intl_en.arb
@@ -206,6 +206,7 @@
"cancel_sharing": "Cancel sharing",
"check_out_my_booking": "Check out my booking",
"dates": "Dates",
+ "guest": "Guest",
"guests": "Guests",
"view_booking": "View booking",
"comwell_booking": "Comwell Booking",
@@ -382,5 +383,9 @@
"payment_overview_send_comment_title": "Comment",
"payment_overview_send_receipt_hint": "Enter comment",
"key_page_room_prefix": "Room {roomNumber}",
- "please_accept_terms": "Please accept terms"
+ "please_accept_terms": "Please accept terms",
+ "received_shared_room_page_subtitle": "text {name}",
+ "received_shared_room_page_title": "",
+ "received_shared_booking_page_title": "",
+ "received_shared_booking_page_subtitle": "text {name}"
}
\ No newline at end of file
diff --git a/comwell_key_app/lib/.generated/l10n/app_localizations.dart b/comwell_key_app/lib/.generated/l10n/app_localizations.dart
index 8733b2ea..0bc12aff 100644
--- a/comwell_key_app/lib/.generated/l10n/app_localizations.dart
+++ b/comwell_key_app/lib/.generated/l10n/app_localizations.dart
@@ -1329,6 +1329,12 @@ abstract class AppLocalizations {
/// **'Dates'**
String get dates;
+ /// No description provided for @guest.
+ ///
+ /// In en, this message translates to:
+ /// **'Guest'**
+ String get guest;
+
/// No description provided for @guests.
///
/// In en, this message translates to:
@@ -2390,6 +2396,30 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Please accept terms'**
String get please_accept_terms;
+
+ /// No description provided for @received_shared_room_page_subtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'text {name}'**
+ String received_shared_room_page_subtitle(Object name);
+
+ /// No description provided for @received_shared_room_page_title.
+ ///
+ /// In en, this message translates to:
+ /// **''**
+ String get received_shared_room_page_title;
+
+ /// No description provided for @received_shared_booking_page_title.
+ ///
+ /// In en, this message translates to:
+ /// **''**
+ String get received_shared_booking_page_title;
+
+ /// No description provided for @received_shared_booking_page_subtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'text {name}'**
+ String received_shared_booking_page_subtitle(Object name);
}
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
diff --git a/comwell_key_app/lib/.generated/l10n/app_localizations_da.dart b/comwell_key_app/lib/.generated/l10n/app_localizations_da.dart
index 3ddae3a3..9849a3b3 100644
--- a/comwell_key_app/lib/.generated/l10n/app_localizations_da.dart
+++ b/comwell_key_app/lib/.generated/l10n/app_localizations_da.dart
@@ -655,6 +655,9 @@ class AppLocalizationsDa extends AppLocalizations {
@override
String get dates => 'Datoer';
+ @override
+ String get guest => 'Gæst';
+
@override
String get guests => 'Gæster';
@@ -1232,4 +1235,20 @@ class AppLocalizationsDa extends AppLocalizations {
@override
String get please_accept_terms => 'Accepter venligst vilkårene';
+
+ @override
+ String received_shared_room_page_subtitle(Object name) {
+ return 'text $name';
+ }
+
+ @override
+ String get received_shared_room_page_title => '';
+
+ @override
+ String get received_shared_booking_page_title => '';
+
+ @override
+ String received_shared_booking_page_subtitle(Object name) {
+ return 'text $name';
+ }
}
diff --git a/comwell_key_app/lib/.generated/l10n/app_localizations_en.dart b/comwell_key_app/lib/.generated/l10n/app_localizations_en.dart
index d894288d..935e413f 100644
--- a/comwell_key_app/lib/.generated/l10n/app_localizations_en.dart
+++ b/comwell_key_app/lib/.generated/l10n/app_localizations_en.dart
@@ -651,6 +651,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get dates => 'Dates';
+ @override
+ String get guest => 'Guest';
+
@override
String get guests => 'Guests';
@@ -1228,4 +1231,20 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get please_accept_terms => 'Please accept terms';
+
+ @override
+ String received_shared_room_page_subtitle(Object name) {
+ return 'text $name';
+ }
+
+ @override
+ String get received_shared_room_page_title => '';
+
+ @override
+ String get received_shared_booking_page_title => '';
+
+ @override
+ String received_shared_booking_page_subtitle(Object name) {
+ return 'text $name';
+ }
}
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 0302aa53..9ee5b5f7 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
@@ -1,4 +1,4 @@
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
@@ -40,13 +40,13 @@ class CheckInButton extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- "check_in".tr(),
+ context.strings.check_in,
style: Theme.of(
context,
).textTheme.titleMedium?.copyWith(color: colorBackground),
),
Text(
- "overview_page_check_in_button_subtitle".tr(),
+ context.strings.overview_page_check_in_button_subtitle,
style: Theme.of(
context,
).textTheme.bodySmall?.copyWith(color: colorBackground),
@@ -80,13 +80,13 @@ class CheckInButton extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- "check_in".tr(),
+ context.strings.check_in,
style: Theme.of(
context,
).textTheme.titleMedium?.copyWith(color: colorBackground),
),
Text(
- "overview_page_check_in_physical_card_subtitle".tr(),
+ context.strings.overview_page_check_in_physical_card_subtitle,
style: Theme.of(context).textTheme.bodySmall?.copyWith(color: colorBackground),
softWrap: true,
),
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 a41c961f..0766241d 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,12 +1,14 @@
+import 'package:comwell_key_app/.generated/assets/assets.gen.dart';
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/themes/light_theme.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:comwell_key_app/utils/time_utils.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
+import 'package:intl/intl.dart';
class CheckInButtonTimer extends StatefulWidget {
const CheckInButtonTimer({
@@ -22,18 +24,18 @@ class _CheckInButtonTimerState extends State<CheckInButtonTimer> {
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(),
+ );
},
);
}
@@ -48,23 +50,25 @@ 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()])
+ ? context.strings.check_in_button_timer_days_hours_minutes(
+ days.toString(),
+ hours.toString(),
+ minutes.toString(),
+ )
: hours > 0
- ? "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()]);
+ ? context.strings.check_in_button_timer_hours_minutes(
+ hours.toString(),
+ minutes.toString(),
+ )
+ : minutes > 0
+ ? context.strings.check_in_button_timer_minutes(minutes.toString())
+ : context.strings.check_in_button_timer_seconds(seconds.toString());
final timerContent = Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
@@ -76,7 +80,7 @@ class _CheckInButtonTimerState extends State<CheckInButtonTimer> {
child: Row(
children: [
SvgPicture.asset(
- 'assets/icons/ic_locked.svg',
+ Assets.icons.icLocked.path,
colorFilter: const ColorFilter.mode(
colorBackground,
BlendMode.srcIn,
@@ -96,8 +100,9 @@ class _CheckInButtonTimerState extends State<CheckInButtonTimer> {
),
Text(
timeStr,
- style: theme.textTheme.bodyMedium
- ?.copyWith(color: colorBackground.withValues(alpha: 0.8)),
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: colorBackground.withValues(alpha: 0.8),
+ ),
),
],
),
diff --git a/comwell_key_app/lib/booking_details/components/check_out_button.dart b/comwell_key_app/lib/booking_details/components/check_out_button.dart
index 381d51e0..4d44524e 100644
--- a/comwell_key_app/lib/booking_details/components/check_out_button.dart
+++ b/comwell_key_app/lib/booking_details/components/check_out_button.dart
@@ -1,7 +1,7 @@
import 'package:comwell_key_app/booking_details/bloc/booking_details_bloc.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
@@ -52,9 +52,9 @@ class CheckOutButton extends StatelessWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text("booking_details_page_checkout_title".tr()),
+ Text(context.strings.booking_details_page_checkout_title),
Text(
- "booking_details_page_checkout_subtitle".tr(),
+ context.strings.booking_details_page_checkout_subtitle,
style: Theme.of(context)
.textTheme
.bodySmall
@@ -63,7 +63,7 @@ class CheckOutButton extends StatelessWidget {
],
),
const Expanded(child: SizedBox()),
- Text("booking_details_page_checkout_time".tr()),
+ Text(context.strings.booking_details_page_checkout_time),
SvgPicture.asset("assets/icons/arrow-left.svg",
colorFilter: const ColorFilter.mode(
colorTertiary,
diff --git a/comwell_key_app/lib/booking_details/components/get_keys_button.dart b/comwell_key_app/lib/booking_details/components/get_keys_button.dart
index 1988e354..1759a5d7 100644
--- a/comwell_key_app/lib/booking_details/components/get_keys_button.dart
+++ b/comwell_key_app/lib/booking_details/components/get_keys_button.dart
@@ -1,7 +1,7 @@
import 'package:comwell_key_app/booking_details/bloc/booking_details_bloc.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/dark_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
@@ -43,14 +43,14 @@ class GetKeysButton extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- "get_keys".tr(),
+ context.strings.get_keys,
style: Theme.of(context)
.textTheme
.titleMedium
?.copyWith(color: Colors.white),
),
Text(
- "get_keys_subtitle".tr(),
+ context.strings.get_keys_subtitle,
style: Theme.of(context)
.textTheme
.bodySmall
diff --git a/comwell_key_app/lib/booking_details/components/guest_list.dart b/comwell_key_app/lib/booking_details/components/guest_list.dart
index 294eb5bf..0a57f0b8 100644
--- a/comwell_key_app/lib/booking_details/components/guest_list.dart
+++ b/comwell_key_app/lib/booking_details/components/guest_list.dart
@@ -1,7 +1,7 @@
import 'package:comwell_key_app/booking_details/components/remove_guest_dialog.dart';
import 'package:comwell_key_app/overview/models/guest.dart';
import 'package:comwell_key_app/themes/comwell_colors.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class GuestList extends StatelessWidget {
@@ -112,7 +112,7 @@ class GuestList extends StatelessWidget {
Navigator.pop(context);
}
},
- child: Text('remove_guest_overview'.tr(),
+ child: Text(context.strings.remove_guest_overview,
style: Theme.of(context)
.textTheme
.bodyLarge
diff --git a/comwell_key_app/lib/booking_details/components/housekeeping_button.dart b/comwell_key_app/lib/booking_details/components/housekeeping_button.dart
index 35a0848d..78bb54d1 100644
--- a/comwell_key_app/lib/booking_details/components/housekeeping_button.dart
+++ b/comwell_key_app/lib/booking_details/components/housekeeping_button.dart
@@ -1,6 +1,7 @@
+import 'package:comwell_key_app/.generated/assets/assets.gen.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
@@ -11,6 +12,7 @@ import '../bloc/booking_details_bloc.dart';
class HousekeepingButton extends StatelessWidget {
final Booking booking;
+
const HousekeepingButton({super.key, required this.booking});
@override
@@ -30,12 +32,11 @@ class HousekeepingButton extends StatelessWidget {
onTap: () async {
if (bloc.state.isHouseKeepingOrdered) return;
- final result = await context.push(AppRoutes.houseKeeping,
- extra: booking);
+ final result = await context.push(AppRoutes.houseKeeping, extra: booking);
if (result != null && !bloc.isClosed) {
bloc.add(OrderHouseKeepingEvent(result as List<String>));
}
- if(!bloc.isClosed) bloc.add(CheckIfHouseKeepingOrdered());
+ if (!bloc.isClosed) bloc.add(CheckIfHouseKeepingOrdered());
},
child: Padding(
padding: const EdgeInsets.all(16.0),
@@ -50,8 +51,7 @@ class HousekeepingButton extends StatelessWidget {
),
child: Padding(
padding: const EdgeInsets.all(10.0),
- child: SvgPicture.asset(
- "assets/icons/icon_housekeeping_cleaning.svg"),
+ child: SvgPicture.asset(Assets.icons.iconHousekeepingCleaning.path),
),
),
const SizedBox(width: 12),
@@ -61,34 +61,29 @@ class HousekeepingButton extends StatelessWidget {
children: [
Text(
bloc.state.isHouseKeepingOrdered == true
- ? "booking_details_page_housekeeping_button_title_ordered"
- .tr()
- : "booking_details_page_housekeeping_button_title"
- .tr(),
+ ? context.strings.booking_details_page_housekeeping_button_title_ordered
+ : context.strings.booking_details_page_housekeeping_button_title,
style: Theme.of(context).textTheme.headlineSmall,
maxLines: 1,
),
Text(
bloc.state.isHouseKeepingOrdered == true
- ? "booking_details_page_housekeeping_button_subtitle_ordered"
- .tr()
- : "booking_details_page_housekeeping_button_subtitle"
- .tr(),
+ ? context
+ .strings
+ .booking_details_page_housekeeping_button_subtitle_ordered
+ : context.strings.booking_details_page_housekeeping_button_subtitle,
maxLines: 1,
softWrap: true,
- style: Theme.of(context)
- .textTheme
- .bodySmall
- ?.copyWith(color: Colors.grey),
+ style: Theme.of(context).textTheme.bodySmall?.copyWith(color: Colors.grey),
),
],
),
),
const SizedBox(width: 12),
if (bloc.state.isHouseKeepingOrdered == true)
- SvgPicture.asset("assets/icons/ic_checkmark.svg")
+ SvgPicture.asset(Assets.icons.icCheckmark.path)
else
- SvgPicture.asset("assets/icons/arrow-left.svg")
+ SvgPicture.asset(Assets.icons.arrowLeft.path),
],
),
),
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 b4aacfb2..7c653f57 100644
--- a/comwell_key_app/lib/booking_details/components/preregister_button.dart
+++ b/comwell_key_app/lib/booking_details/components/preregister_button.dart
@@ -1,4 +1,4 @@
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
@@ -39,12 +39,12 @@ class PreregisterButton extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- "prepare_room".tr(),
+ context.strings.prepare_room,
style: theme.textTheme.titleMedium?.copyWith(
color: colorBackground, fontWeight: FontWeight.w600),
),
Text(
- "jump_line_text".tr(),
+ context.strings.jump_line_text,
style: theme.textTheme.bodySmall
?.copyWith(color: colorBackground),
),
diff --git a/comwell_key_app/lib/booking_details/components/remove_guest_dialog.dart b/comwell_key_app/lib/booking_details/components/remove_guest_dialog.dart
index f60a937d..9963edd4 100644
--- a/comwell_key_app/lib/booking_details/components/remove_guest_dialog.dart
+++ b/comwell_key_app/lib/booking_details/components/remove_guest_dialog.dart
@@ -1,5 +1,5 @@
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class RemoveGuestDialog extends StatelessWidget {
@@ -19,7 +19,7 @@ class RemoveGuestDialog extends StatelessWidget {
backgroundColor: colorBackground,
title: Center(
child: Text(
- 'are_you_sure'.tr(),
+ context.strings.are_you_sure,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
@@ -30,7 +30,7 @@ class RemoveGuestDialog extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- 'guest_removal_responsibility'.tr(),
+ context.strings.guest_removal_responsibility,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
@@ -54,8 +54,8 @@ class RemoveGuestDialog extends StatelessWidget {
),
child: Text(
selectedGuests.length > 1
- ? 'remove_guests'.tr()
- : 'remove_guest'.tr(),
+ ? context.strings.remove_guests
+ : context.strings.remove_guest,
style: const TextStyle(
color: colorTertiary,
fontSize: 16,
@@ -77,7 +77,7 @@ class RemoveGuestDialog extends StatelessWidget {
minimumSize: const Size.fromHeight(50),
),
child: Text(
- 'cancel'.tr(),
+ context.strings.cancel,
style: const TextStyle(
color: colorBackground,
fontSize: 16,
diff --git a/comwell_key_app/lib/booking_details/components/room_key_widget.dart b/comwell_key_app/lib/booking_details/components/room_key_widget.dart
index 5e59fb37..664a4659 100644
--- a/comwell_key_app/lib/booking_details/components/room_key_widget.dart
+++ b/comwell_key_app/lib/booking_details/components/room_key_widget.dart
@@ -1,11 +1,12 @@
// ignore_for_file: must_be_immutable
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class RoomKeyWidget extends StatelessWidget {
RoomKeyWidget({super.key, this.isMultipleKeys = false, required this.onPressed});
+
bool isMultipleKeys = false;
Function onPressed;
@@ -25,42 +26,45 @@ class RoomKeyWidget extends StatelessWidget {
onPressed();
}
},
- child: Container (
+ child: Container(
width: 150,
height: 150,
padding: const EdgeInsets.all(8),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: sandColor[40],
- ),
- padding: const EdgeInsets.all(8),
- child: ImageIcon(
- const AssetImage('assets/images/key.png'),
- size: 24,
- color: Theme.of(context).colorScheme.onSecondary,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Container(
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: sandColor[40],
+ ),
+ padding: const EdgeInsets.all(8),
+ child: ImageIcon(
+ const AssetImage('assets/images/key.png'),
+ size: 24,
+ color: Theme.of(context).colorScheme.onSecondary,
+ ),
),
- ),
- const SizedBox(height: 20),
- Text(
- isMultipleKeys ? 'room_keys'.tr() :'room_key'.tr(),
- style: const TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.bold,
+ const SizedBox(height: 20),
+ Text(
+ isMultipleKeys ? context.strings.room_keys : context.strings.room_key,
+ style: const TextStyle(
+ fontSize: 16,
+ fontWeight: FontWeight.bold,
+ ),
),
- ),
- const SizedBox(height: 5),
- Text('room_key_description'.tr(),
- style: TextStyle(
- fontSize: 12,
- color: Theme.of(context).colorScheme.onSecondary,
+ const SizedBox(height: 5),
+ Text(
+ context.strings.room_key_description,
+ style: TextStyle(
+ fontSize: 12,
+ color: Theme.of(context).colorScheme.onSecondary,
+ ),
),
- )],
+ ],
+ ),
),
),
- ));
+ );
}
-}
\ No newline at end of file
+}
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 1c76ccc9..3390d797 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
@@ -1,5 +1,5 @@
import 'package:comwell_key_app/booking_details/bloc/booking_details_bloc.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class RoomNumberContainer extends StatelessWidget {
@@ -21,7 +21,7 @@ class RoomNumberContainer extends StatelessWidget {
border: Border.all(color: Colors.white, width: 2),
),
child: Text(
- 'room_prefix'.tr(args: [cubit.booking.roomNumber]),
+ context.strings.room_prefix(cubit.booking.roomNumber),
style: theme.textTheme.titleLarge!.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
diff --git a/comwell_key_app/lib/booking_details/components/share_button.dart b/comwell_key_app/lib/booking_details/components/share_button.dart
index 2b64cb6e..3a9e8629 100644
--- a/comwell_key_app/lib/booking_details/components/share_button.dart
+++ b/comwell_key_app/lib/booking_details/components/share_button.dart
@@ -5,10 +5,10 @@ import 'package:comwell_key_app/overview/models/guest.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/booking_details/components/guest_list.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:comwell_key_app/utils/locator.dart';
import 'package:comwell_key_app/utils/share_button_utils.dart';
import 'package:comwell_key_app/share/cubit/share_booking_cubit.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -163,7 +163,7 @@ class ShareButton extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
- 'handle_guests_title'.tr(),
+ context.strings.handle_guests_title,
style: theme.textTheme.titleLarge?.copyWith(
color: colorTertiary,
fontWeight: FontWeight.w600,
@@ -191,8 +191,8 @@ class ShareButton extends StatelessWidget {
}
if (state.error != null) {
return ComwellErrorWidget(
- title: "share_booking_error_title".tr(),
- subtitle: "share_booking_error_subtitle".tr(),
+ title: context.strings.share_booking_error_title,
+ subtitle: context.strings.share_booking_error_subtitle,
border: true,
);
}
@@ -261,7 +261,7 @@ class ShareButton extends StatelessWidget {
elevation: 0,
),
child: Text(
- 'cancel_sharing'.tr(),
+ context.strings.cancel_sharing,
style: TextStyle(
color: state.selectedGuests.isNotEmpty
? colorBackground
@@ -296,7 +296,7 @@ class ShareButton extends StatelessWidget {
backgroundColor: colorBackground,
title: Center(
child: Text(
- 'are_you_sure'.tr(),
+ context.strings.are_you_sure,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
@@ -307,7 +307,7 @@ class ShareButton extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- 'guest_removal_responsibility'.tr(),
+ context.strings.guest_removal_responsibility,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
@@ -330,7 +330,7 @@ class ShareButton extends StatelessWidget {
minimumSize: const Size.fromHeight(50),
),
child: Text(
- selectedGuests.length > 1 ? 'remove_guests'.tr() : 'remove_guest'.tr(),
+ selectedGuests.length > 1 ? context.strings.remove_guests : context.strings.remove_guest,
style: const TextStyle(
color: colorTertiary,
fontSize: 16,
@@ -352,7 +352,7 @@ class ShareButton extends StatelessWidget {
minimumSize: const Size.fromHeight(50),
),
child: Text(
- 'cancel'.tr(),
+ context.strings.cancel,
style: const TextStyle(
color: colorBackground,
fontSize: 16,
diff --git a/comwell_key_app/lib/booking_details/components/unlock_room_button.dart b/comwell_key_app/lib/booking_details/components/unlock_room_button.dart
index d01e1cfc..571fb8f4 100644
--- a/comwell_key_app/lib/booking_details/components/unlock_room_button.dart
+++ b/comwell_key_app/lib/booking_details/components/unlock_room_button.dart
@@ -1,4 +1,4 @@
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
@@ -34,7 +34,7 @@ class UnlockRoomButton extends StatelessWidget {
},
alignLabel: Alignment.center,
label: Text(
- 'open_room'.tr(),
+ context.strings.open_room,
style: theme.textTheme.headlineSmall?.copyWith(color: Colors.white),
textAlign: TextAlign.center,
),
diff --git a/comwell_key_app/lib/check_in/bloc/check_in_state.dart b/comwell_key_app/lib/check_in/bloc/check_in_state.dart
index 0a92a430..c8d892b4 100644
--- a/comwell_key_app/lib/check_in/bloc/check_in_state.dart
+++ b/comwell_key_app/lib/check_in/bloc/check_in_state.dart
@@ -1,4 +1,5 @@
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
+import 'package:flutter/cupertino.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part '../../.generated/check_in/bloc/check_in_state.freezed.dart';
@@ -20,23 +21,23 @@ abstract class CheckInState with _$CheckInState {
CheckInState._();
- String get titleStringId {
+ String titleStringId(BuildContext context) {
switch (cardState) {
case CheckInStatus.loading:
- return "check_in_loading_title".tr();
+ return context.strings.check_in_loading_title;
case CheckInStatus.roomFound:
- return "check_in_room_found_title".tr();
+ return context.strings.check_in_room_found_title;
case CheckInStatus.done:
- return "check_in_your_digital_card_title".tr();
+ return context.strings.check_in_your_digital_card_title;
case CheckInStatus.error:
- return "check_in_error_title".tr();
+ return context.strings.check_in_error_title;
}
}
- String get subtitleStringId {
+ String subtitleStringId(BuildContext context) {
switch (cardState) {
case CheckInStatus.done:
- return "check_in_your_digital_card_subtitle".tr();
+ return context.strings.check_in_your_digital_card_subtitle;
default:
return "";
}
diff --git a/comwell_key_app/lib/check_in/check_in_page.dart b/comwell_key_app/lib/check_in/check_in_page.dart
index 05ae6a51..ee325466 100644
--- a/comwell_key_app/lib/check_in/check_in_page.dart
+++ b/comwell_key_app/lib/check_in/check_in_page.dart
@@ -3,8 +3,8 @@ import 'package:comwell_key_app/check_in/bloc/check_in_cubit.dart';
import 'package:comwell_key_app/check_in/bloc/check_in_state.dart';
import 'package:comwell_key_app/common/components/comwell_card_component.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:comwell_key_app/utils/lottie_utils.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -97,7 +97,7 @@ class _CheckInPageState extends State<CheckInPage> with SingleTickerProviderStat
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
- "${"check_in_your_digital_card_room_prefix".tr()} ${(cubit.booking.roomNumber)}",
+ "${context.strings.check_in_your_digital_card_room_prefix} ${(cubit.booking.roomNumber)}",
style: Theme.of(context).textTheme.headlineLarge?.copyWith(
color: colorBackground,
),
@@ -156,7 +156,7 @@ class _CheckInPageState extends State<CheckInPage> with SingleTickerProviderStat
children: [
const SizedBox(height: 15),
Text(
- "check_in_page_error_title".tr(),
+ context.strings.check_in_page_error_title,
textAlign: TextAlign.center,
style: theme.textTheme.headlineMedium?.copyWith(
color: colorHeadlineText,
@@ -164,12 +164,12 @@ class _CheckInPageState extends State<CheckInPage> with SingleTickerProviderStat
),
const SizedBox(height: 15),
Text(
- "check_in_page_error_subtitle".tr(),
+ context.strings.check_in_page_error_subtitle,
textAlign: TextAlign.center,
style: theme.textTheme.bodySmall?.copyWith(color: colorHeadlineText),
),
const SizedBox(height: 15),
- Text(state.subtitleStringId, style: theme.textTheme.bodySmall),
+ Text(state.subtitleStringId(context), style: theme.textTheme.bodySmall),
const SizedBox(height: 15),
const Divider(
color: colorDivider,
@@ -192,7 +192,7 @@ class _CheckInPageState extends State<CheckInPage> with SingleTickerProviderStat
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
- child: Text("generic_continue".tr()),
+ child: Text(context.strings.generic_continue),
),
),
),
@@ -211,7 +211,7 @@ class _CheckInPageState extends State<CheckInPage> with SingleTickerProviderStat
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
- "check_in_your_digital_card_nb".tr(),
+ context.strings.check_in_your_digital_card_nb,
textAlign: TextAlign.center,
style: theme.textTheme.bodySmall?.copyWith(
color: colorHeadlineText,
@@ -221,7 +221,10 @@ class _CheckInPageState extends State<CheckInPage> with SingleTickerProviderStat
const SizedBox(height: 15),
Padding(
padding: const EdgeInsets.all(16.0),
- child: Text(state.subtitleStringId, style: theme.textTheme.bodySmall),
+ child: Text(
+ state.subtitleStringId(context),
+ style: theme.textTheme.bodySmall,
+ ),
),
const SizedBox(height: 15),
const Divider(
@@ -245,7 +248,7 @@ class _CheckInPageState extends State<CheckInPage> with SingleTickerProviderStat
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
- child: Text("generic_done".tr()),
+ child: Text(context.strings.generic_done),
),
),
),
diff --git a/comwell_key_app/lib/choose_share_room/choose_share_room_page.dart b/comwell_key_app/lib/choose_share_room/choose_share_room_page.dart
index 3eeceb3e..a10c0b82 100644
--- a/comwell_key_app/lib/choose_share_room/choose_share_room_page.dart
+++ b/comwell_key_app/lib/choose_share_room/choose_share_room_page.dart
@@ -4,7 +4,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/components/comwell_error_widget.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:comwell_key_app/choose_share_room/components/choose_room_widget.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -35,8 +35,8 @@ class ChooseShareRoomPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ComwellErrorWidget(
- title: "choose_room_error_title".tr(),
- subtitle: "choose_room_error_subtitle".tr(),
+ title: context.strings.choose_room_error_title,
+ subtitle: context.strings.choose_room_error_subtitle,
),
],
),
@@ -49,12 +49,12 @@ class ChooseShareRoomPage extends StatelessWidget {
children: [
const SizedBox(height: 24),
Text(
- 'choose_room'.tr(),
+ context.strings.choose_room,
style: theme.textTheme.headlineLarge,
),
const SizedBox(height: 8),
Text(
- 'choose_room_subtitle'.tr(),
+ context.strings.choose_room_subtitle,
style: theme.textTheme.bodySmall,
),
const SizedBox(height: 24),
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 f89935c6..5b77f138 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
@@ -3,7 +3,7 @@ import 'package:comwell_key_app/choose_share_room/cubit/choose_share_room_cubit.
import 'package:comwell_key_app/choose_share_room/cubit/choose_share_room_state.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -104,12 +104,12 @@ class ChooseRoomWidget extends StatelessWidget {
SvgPicture.asset("assets/icons/user-circle.svg", width: 20, height: 20),
const SizedBox(width: 4),
Text(
- '${booking.adults} ${booking.adults > 1 ? 'adults'.tr() : 'adult'.tr()}${booking.children > 0 ? ' | ${booking.children} ${booking.children > 1 ? 'children'.tr() : 'child'.tr()}' : ''}',
+ '${booking.adults} ${booking.adults > 1 ? context.strings.adults : context.strings.adult}${booking.children > 0 ? ' | ${booking.children} ${booking.children > 1 ? context.strings.children : context.strings.child}' : ''}',
style: theme.textTheme.bodySmall,
),
const VerticalDivider(color: colorDivider, thickness: 1.5),
Text(
- 'read_more'.tr(),
+ context.strings.read_more,
style: theme.textTheme.bodySmall?.copyWith(
decoration: TextDecoration.underline,
),
@@ -122,7 +122,7 @@ class ChooseRoomWidget extends StatelessWidget {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
- 'added_to_room'.tr(),
+ context.strings.added_to_room,
style: theme.textTheme.bodySmall,
),
),
@@ -174,7 +174,9 @@ class ChooseRoomWidget extends StatelessWidget {
}
}
},
- child: Text(isAssigned ? 'share_room'.tr() : 'choose_room'.tr()),
+ child: Text(
+ isAssigned ? context.strings.share_room : context.strings.choose_room,
+ ),
),
),
),
diff --git a/comwell_key_app/lib/choose_share_room/components/my_room_widget.dart b/comwell_key_app/lib/choose_share_room/components/my_room_widget.dart
index a17171df..9380410d 100644
--- a/comwell_key_app/lib/choose_share_room/components/my_room_widget.dart
+++ b/comwell_key_app/lib/choose_share_room/components/my_room_widget.dart
@@ -1,4 +1,4 @@
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
@@ -22,7 +22,7 @@ class MyRoomWidget extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text("my_room".tr(), style: theme.textTheme.headlineMedium),
+ Text(context.strings.my_room, style: theme.textTheme.headlineMedium),
const SizedBox(height: 8),
Opacity(
opacity: 0.5,
@@ -74,8 +74,7 @@ class MyRoomWidget extends StatelessWidget {
),
),
Padding(
- padding: const EdgeInsets.only(
- left: 16.0, right: 16.0, bottom: 16.0),
+ padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 16.0),
child: Row(
children: [
SvgPicture.asset(
@@ -86,8 +85,8 @@ class MyRoomWidget extends StatelessWidget {
const SizedBox(width: 4),
Text(
guests == 1
- ? '$guests adult'.tr()
- : '$guests adults'.tr(),
+ ? "1 ${context.strings.adult}"
+ : "$guests ${context.strings.adults}",
style: theme.textTheme.bodySmall,
),
],
diff --git a/comwell_key_app/lib/choose_share_room/components/share_room_confirm_dialog.dart b/comwell_key_app/lib/choose_share_room/components/share_room_confirm_dialog.dart
index eab7c188..5325b915 100644
--- a/comwell_key_app/lib/choose_share_room/components/share_room_confirm_dialog.dart
+++ b/comwell_key_app/lib/choose_share_room/components/share_room_confirm_dialog.dart
@@ -1,7 +1,7 @@
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
-import 'package:easy_localization/easy_localization.dart';
class ShareRoomConfirmDialog extends StatelessWidget {
const ShareRoomConfirmDialog({super.key});
@@ -20,13 +20,13 @@ class ShareRoomConfirmDialog extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- 'choose_room_confirmation_title'.tr(),
+ context.strings.choose_room_confirmation_title,
textAlign: TextAlign.center,
style: theme.textTheme.headlineMedium,
),
const SizedBox(height: 16),
Text(
- 'choose_room_confirmation_subtitle'.tr(),
+ context.strings.choose_room_confirmation_subtitle,
textAlign: TextAlign.center,
style: theme.textTheme.bodySmall,
),
@@ -35,7 +35,7 @@ class ShareRoomConfirmDialog extends StatelessWidget {
onPressed: () {
context.pop(true);
},
- child: Text('choose_room_confirmation_confirm'.tr(),
+ child: Text(context.strings.choose_room_confirmation_confirm,
style: theme.textTheme.headlineSmall
?.copyWith(color: Colors.white)),
),
@@ -48,7 +48,7 @@ class ShareRoomConfirmDialog extends StatelessWidget {
onPressed: () {
context.pop(false);
},
- child: Text('choose_room_confirmation_cancel'.tr(),
+ child: Text(context.strings.choose_room_confirmation_cancel,
style: theme.textTheme.headlineSmall),
),
],
diff --git a/comwell_key_app/lib/choose_share_room/cubit/choose_share_room_cubit.dart b/comwell_key_app/lib/choose_share_room/cubit/choose_share_room_cubit.dart
index 7029f71a..cfc1f909 100644
--- a/comwell_key_app/lib/choose_share_room/cubit/choose_share_room_cubit.dart
+++ b/comwell_key_app/lib/choose_share_room/cubit/choose_share_room_cubit.dart
@@ -2,7 +2,9 @@ import 'package:comwell_key_app/base/base_cubit.dart';
import 'package:comwell_key_app/choose_share_room/choose_share_room_repository.dart';
import 'package:comwell_key_app/choose_share_room/cubit/choose_share_room_state.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:intl/intl.dart';
import 'package:share_plus/share_plus.dart';
class ChooseShareRoomCubit extends BaseCubit<ChooseShareRoomState> {
@@ -18,13 +20,13 @@ class ChooseShareRoomCubit extends BaseCubit<ChooseShareRoomState> {
safeEmit(state.copyWith(rooms: rooms));
}
- Future<void> shareRoom(Booking booking) async {
+ Future<void> shareRoom(BuildContext context,Booking booking) async {
Share.share(
'${booking.hotelName}\n\n'
- '${'dates'.tr()}: ${DateFormat('d. MMM').format(booking.startDate)} - ${DateFormat('d. MMM').format(booking.endDate)}\n'
- '${'guests'.tr()}: ${booking.adults} ${booking.adults > 1 ? 'adults'.tr() : 'adult'.tr()}${booking.children > 0 ? ' | ${booking.children} ${booking.children > 1 ? 'children'.tr() : 'child'.tr()}' : ''}\n\n'
- '${'view_booking'.tr()}: https://comwell.app/booking/${booking.id}',
- subject: 'comwell_booking'.tr(),
+ '${context.strings.dates}: ${DateFormat('d. MMM').format(booking.startDate)} - ${DateFormat('d. MMM').format(booking.endDate)}\n'
+ '${context.strings.guests}: ${booking.adults} ${booking.adults > 1 ? context.strings.adults : context.strings.adult}${booking.children > 0 ? ' | ${booking.children} ${booking.children > 1 ? context.strings.children : context.strings.child}' : ''}\n\n'
+ '${context.strings.view_booking}: https://comwell.app/booking/${booking.id}',
+ subject: context.strings.comwell_booking,
);
}
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 63d9e65a..5292071b 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
@@ -8,7 +8,7 @@ import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/up_sales/models/facility_type.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:comwell_key_app/up_sales/components/facility_icon_text.dart';
import 'package:comwell_key_app/up_sales/components/tags.dart';
@@ -99,7 +99,7 @@ class _RoomInfoPageState extends State<RoomInfoPage> {
});
},
child: Text(
- _isExpanded ? 'read_less'.tr() : 'read_more'.tr(),
+ _isExpanded ? context.strings.read_less : context.strings.read_more,
style: theme.textTheme.bodySmall?.copyWith(
color: sandColor,
decoration: TextDecoration.underline,
@@ -123,7 +123,7 @@ class _RoomInfoPageState extends State<RoomInfoPage> {
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: Text(
- 'see_all_facilities'.tr(),
+ context.strings.see_all_facilities,
style: theme.textTheme.bodySmall?.copyWith(
color: sandColor,
decoration: TextDecoration.underline,
@@ -173,7 +173,7 @@ class _RoomInfoPageState extends State<RoomInfoPage> {
}
},
child: Text(
- widget.isAssigned ? 'share_room'.tr() : 'choose_room'.tr(),
+ widget.isAssigned ? context.strings.share_room : context.strings.choose_room,
style: theme.textTheme.headlineSmall?.copyWith(color: Colors.white),
),
),
diff --git a/comwell_key_app/lib/choose_share_room/pages/share_room_base_page_template.dart b/comwell_key_app/lib/choose_share_room/pages/share_room_base_page_template.dart
index f20cd453..a2407c7c 100644
--- a/comwell_key_app/lib/choose_share_room/pages/share_room_base_page_template.dart
+++ b/comwell_key_app/lib/choose_share_room/pages/share_room_base_page_template.dart
@@ -1,7 +1,6 @@
-
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
@@ -11,161 +10,177 @@ class ShareRoomBasePageTemplate extends StatelessWidget {
final bool isShared;
final void Function() onClicked;
- const ShareRoomBasePageTemplate({super.key, required this.booking, required this.onClicked, required this.isShared});
+ const ShareRoomBasePageTemplate({
+ super.key,
+ required this.booking,
+ required this.onClicked,
+ required this.isShared,
+ });
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
- return Scaffold(
- backgroundColor: sandColor,
- body: Center(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- const SizedBox(width: 52),
- Text(isShared ? 'received_shared_room_page_title'.tr() : 'share_room_page_title'.tr(),
- style: theme.textTheme.headlineMedium
- ?.copyWith(color: Colors.white)),
- !isShared ?
- Padding(
- padding: const EdgeInsets.only(right: 16),
- child: ElevatedButton(
- onPressed: () {
- context.pop();
- },
- style: ElevatedButton.styleFrom(
- minimumSize: const Size(36, 36),
- padding: EdgeInsets.zero,
- backgroundColor: Colors.white,
- shape: const CircleBorder(),
- elevation: 0,
- ),
- child: const Icon(
- Icons.close,
- color: Colors.black,
- size: 24,
- ),
+ return Scaffold(
+ backgroundColor: sandColor,
+ body: Center(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ const SizedBox(width: 52),
+ Text(
+ isShared
+ ? context.strings.received_shared_room_page_title
+ : context.strings.share_room_page_title,
+ style: theme.textTheme.headlineMedium?.copyWith(color: Colors.white),
+ ),
+ !isShared
+ ? Padding(
+ padding: const EdgeInsets.only(right: 16),
+ child: ElevatedButton(
+ onPressed: () {
+ context.pop();
+ },
+ style: ElevatedButton.styleFrom(
+ minimumSize: const Size(36, 36),
+ padding: EdgeInsets.zero,
+ backgroundColor: Colors.white,
+ shape: const CircleBorder(),
+ elevation: 0,
+ ),
+ child: const Icon(
+ Icons.close,
+ color: Colors.black,
+ size: 24,
+ ),
+ ),
+ )
+ : const SizedBox(width: 52),
+ ],
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 32),
+ child: Card(
+ color: Colors.white,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(20),
+ ),
+ elevation: 2,
+ margin: const EdgeInsets.symmetric(horizontal: 24),
+ clipBehavior: Clip.antiAlias,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Stack(
+ children: [
+ ClipRRect(
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(20),
+ topRight: Radius.circular(20),
+ ),
+ child: Image.asset(
+ 'assets/images/borupgaard.png',
+ height: 200,
+ width: double.infinity,
+ fit: BoxFit.cover,
+ ),
+ ),
+ Positioned(
+ top: 16,
+ left: 16,
+ child: Text(
+ booking.hotelName,
+ style: theme.textTheme.headlineLarge?.copyWith(color: Colors.white),
+ ),
+ ),
+ ],
),
- ) : const SizedBox(width: 52)
- ],
- ),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 32),
- child: Card(
- color: Colors.white,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(20),
- ),
- elevation: 2,
- margin: const EdgeInsets.symmetric(horizontal: 24),
- clipBehavior: Clip.antiAlias,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Stack(
+ Padding(
+ padding: const EdgeInsets.all(20.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- ClipRRect(
- borderRadius: const BorderRadius.only(
- topLeft: Radius.circular(20),
- topRight: Radius.circular(20),
- ),
- child: Image.asset(
- 'assets/images/borupgaard.png',
- height: 200,
- width: double.infinity,
- fit: BoxFit.cover,
+ Text(booking.roomType, style: theme.textTheme.headlineMedium),
+ const SizedBox(height: 4),
+ Text(
+ booking.roomNumber,
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: colorHeadlineText,
),
),
- Positioned(
- top: 16,
- left: 16,
- child: Text(
- booking.hotelName,
- style: theme.textTheme.headlineLarge
- ?.copyWith(color: Colors.white),
- ),
+ const SizedBox(height: 16),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ SvgPicture.asset(
+ 'assets/icons/user-circle.svg',
+ width: 24,
+ height: 24,
+ ),
+ const SizedBox(width: 4),
+ Text(
+ '${booking.adults} ${booking.adults > 1 ? context.strings.adults : context.strings.adult}${booking.children > 0 ? ' | ${booking.children} ${booking.children > 1 ? context.strings.children : context.strings.child}' : ''}',
+ style: theme.textTheme.bodySmall,
+ ),
+ ],
),
- ],
- ),
- Padding(
- padding: const EdgeInsets.all(20.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(booking.roomType,
- style: theme.textTheme.headlineMedium),
- const SizedBox(height: 4),
+ const SizedBox(height: 16),
+ if (booking.addOnItems != null && booking.addOnItems!.isNotEmpty)
Text(
- booking.roomNumber,
+ context.strings.addon,
style: theme.textTheme.bodySmall?.copyWith(
color: colorHeadlineText,
),
),
- const SizedBox(height: 16),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- SvgPicture.asset('assets/icons/user-circle.svg',
- width: 24, height: 24),
- const SizedBox(width: 4),
- Text(
- '${booking.adults} ${booking.adults > 1 ? 'adults'.tr() : 'adult'.tr()}${booking.children > 0 ? ' | ${booking.children} ${booking.children > 1 ? 'children'.tr() : 'child'.tr()}' : ''}',
- style: theme.textTheme.bodySmall,
- ),
- ],
- ),
- const SizedBox(height: 16),
- if (booking.addOnItems != null && booking.addOnItems!.isNotEmpty)
- Text(
- 'addon'.tr(),
- style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
- ),
- ),
- const SizedBox(height: 24),
- ],
- ),
+ const SizedBox(height: 24),
+ ],
),
- ],
- ),
+ ),
+ ],
),
),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 40),
- child: Text(
- isShared ? 'received_shared_room_page_subtitle'.tr(args: ["${booking.firstName} ${booking.lastName}"]) : 'share_room_page_subtitle'.tr(),
- style: Theme.of(context).textTheme.bodySmall?.copyWith(
- color: Colors.white.withValues(alpha: 0.65),
- ),
- textAlign: TextAlign.center,
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 40),
+ child: Text(
+ isShared
+ ? context.strings.received_shared_room_page_subtitle(
+ "${booking.firstName} ${booking.lastName}",
+ )
+ : context.strings.share_room_page_subtitle,
+ style: Theme.of(context).textTheme.bodySmall?.copyWith(
+ color: Colors.white.withValues(alpha: 0.65),
),
+ textAlign: TextAlign.center,
),
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: SizedBox(
- width: double.infinity,
- child: ElevatedButton(
- onPressed: onClicked,
- style: ElevatedButton.styleFrom(
- backgroundColor: Colors.white,
- minimumSize: const Size.fromHeight(52),
- elevation: 0,
+ ),
+ Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: SizedBox(
+ width: double.infinity,
+ child: ElevatedButton(
+ onPressed: onClicked,
+ style: ElevatedButton.styleFrom(
+ backgroundColor: Colors.white,
+ minimumSize: const Size.fromHeight(52),
+ elevation: 0,
+ ),
+ child: Text(
+ isShared ? context.strings.generic_ok : context.strings.share_room_page_button,
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: Colors.black,
),
- child: Text(isShared ? 'generic_ok'.tr() : 'share_room_page_button'.tr(),
- style: theme.textTheme.bodyMedium?.copyWith(
- color: Colors.black,
- )),
),
),
),
- ],
- ),
+ ),
+ ],
),
- );
+ ),
+ );
}
}
diff --git a/comwell_key_app/lib/common/template_pages/payment_page_template.dart b/comwell_key_app/lib/common/template_pages/payment_page_template.dart
index ae0812bf..d45bb6e4 100644
--- a/comwell_key_app/lib/common/template_pages/payment_page_template.dart
+++ b/comwell_key_app/lib/common/template_pages/payment_page_template.dart
@@ -4,8 +4,8 @@ import 'package:comwell_key_app/check_out/components/checkout_itemized_bill.dart
import 'package:comwell_key_app/check_out/components/send_receipt.dart';
import 'package:comwell_key_app/services/models/booking_dto.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
-import 'package:easy_localization/easy_localization.dart';
class PaymentPageTemplate extends StatelessWidget {
final Iterable<BookingAddonItem> addOnItems;
@@ -53,7 +53,7 @@ class PaymentPageTemplate extends StatelessWidget {
children: [
const SizedBox(height: 40),
Text(
- "checkout_page_payment_title".tr(),
+ context.strings.checkout_page_payment_title,
style: Theme.of(context).textTheme.headlineLarge,
),
const SizedBox(height: 26),
diff --git a/comwell_key_app/lib/comwell_app.dart b/comwell_key_app/lib/comwell_app.dart
index d8b1ff92..90f254f6 100644
--- a/comwell_key_app/lib/comwell_app.dart
+++ b/comwell_key_app/lib/comwell_app.dart
@@ -1,3 +1,4 @@
+import 'package:comwell_key_app/.generated/l10n/app_localizations.dart';
import 'package:comwell_key_app/booking_details/booking_details_repository.dart';
import 'package:comwell_key_app/connection_state/connection_state_cubit.dart';
import 'package:comwell_key_app/key/bloc/key_bloc.dart';
@@ -10,14 +11,15 @@ import 'package:comwell_key_app/themes/app_button_styles.dart';
import 'package:comwell_key_app/themes/app_textstyles.dart';
import 'package:comwell_key_app/themes/dark_theme.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/utils/context_utils.dart';
import 'package:comwell_key_app/utils/locator.dart';
import 'package:comwell_key_app/utils/seos_repository.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:payment_plugin/domain/repositories/adyen_repository.dart';
import 'package:payment_plugin/presentation/app/bloc/payment_cards_cubit.dart';
import 'package:payment_plugin/presentation/app/bloc/payment_cubit.dart';
+import 'package:flutter_localizations/flutter_localizations.dart';
class ComwellApp extends StatelessWidget {
const ComwellApp({super.key});
@@ -85,9 +87,22 @@ class ComwellApp extends StatelessWidget {
child: MaterialApp.router(
title: 'Comwell Key App',
routerConfig: router,
- localizationsDelegates: context.localizationDelegates,
- supportedLocales: context.supportedLocales,
- locale: context.locale,
+ supportedLocales: AppLocalizations.supportedLocales,
+ localizationsDelegates: const [
+ AppLocalizations.delegate,
+ GlobalWidgetsLocalizations.delegate,
+ GlobalMaterialLocalizations.delegate,
+ GlobalCupertinoLocalizations.delegate,
+ ],
+ builder: (context, child) {
+ if (child != null) {
+ return MediaQuery(
+ data: context.mq.copyWith(textScaler: TextScaler.noScaling),
+ child: child,
+ );
+ }
+ return const SizedBox.shrink();
+ },
theme: lightTheme,
darkTheme: darkTheme,
themeMode: ThemeMode.system,
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 f9edb74f..c30c51ba 100644
--- a/comwell_key_app/lib/contact/components/call_us_section.dart
+++ b/comwell_key_app/lib/contact/components/call_us_section.dart
@@ -1,5 +1,5 @@
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:comwell_key_app/utils/launch_util.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
@@ -15,11 +15,11 @@ class CallUsSection extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- 'call_us'.tr(),
+ context.strings.call_us,
style: theme.textTheme.headlineMedium,
),
const SizedBox(height: 8),
- Text('call_us_description'.tr(), style: theme.textTheme.bodySmall),
+ Text(context.strings.call_us_description, style: theme.textTheme.bodySmall),
const SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 0),
@@ -30,11 +30,11 @@ class CallUsSection extends StatelessWidget {
borderRadius: BorderRadius.circular(25))),
),
onPressed: () async {
- await makePhoneCall('comwell_telephone_number'.tr());
+ await makePhoneCall(context.strings.comwell_telephone_number);
},
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
Text(
- 'call_us'.tr(),
+ context.strings.call_us,
style: theme.textTheme.headlineSmall?.copyWith(
color: Colors.white,
),
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 ee0de96d..eba82f9e 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,6 +1,6 @@
import 'package:comwell_key_app/contact/cubit/contact_cubit.dart';
import 'package:comwell_key_app/profile_settings/components/intl_phone_field.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -20,14 +20,14 @@ class GetAPhoneCallSection extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text('get_a_call'.tr(), style: theme.textTheme.headlineMedium),
+ Text(context.strings.get_a_call, style: theme.textTheme.headlineMedium),
const SizedBox(height: 8),
- Text('get_a_call_description'.tr(), style: theme.textTheme.bodySmall),
+ Text(context.strings.get_a_call_description, style: theme.textTheme.bodySmall),
const SizedBox(height: 8),
- Text('telephone_number'.tr(), style: theme.textTheme.labelLarge),
+ Text(context.strings.telephone_number, style: theme.textTheme.labelLarge),
IntlPhoneField(
readOnly: false,
- title: 'telephone_number'.tr(),
+ title: context.strings.telephone_number,
phoneNumber: cubit.phoneNumber,
countryCode: cubit.countryCode,
controller: cubit.phoneNumberController,
@@ -40,7 +40,7 @@ class GetAPhoneCallSection extends StatelessWidget {
await cubit.sendContact(cubit.phoneNumber);
},
child: Text(
- 'get_a_call'.tr(),
+ context.strings.get_a_call,
style:
theme.textTheme.headlineSmall?.copyWith(color: Colors.white),
),
@@ -60,9 +60,9 @@ class _ReceivedCard extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text('get_a_call'.tr(), style: theme.textTheme.headlineMedium),
+ Text(context.strings.get_a_call, style: theme.textTheme.headlineMedium),
const SizedBox(height: 8),
- Text('get_a_call_description'.tr(), style: theme.textTheme.bodySmall),
+ Text(context.strings.get_a_call_description, style: theme.textTheme.bodySmall),
const SizedBox(height: 8),
SizedBox(
height: 132,
@@ -77,11 +77,11 @@ class _ReceivedCard extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
- Text('call_received_title'.tr(),
+ Text(context.strings.call_received_title,
style: theme.textTheme.headlineSmall),
const SizedBox(height: 10),
Text(
- 'call_received_description'.tr(),
+ context.strings.call_received_description,
textAlign: TextAlign.center,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.surfaceTint,
diff --git a/comwell_key_app/lib/contact/contact_page.dart b/comwell_key_app/lib/contact/contact_page.dart
index df75cbad..8a6e9361 100644
--- a/comwell_key_app/lib/contact/contact_page.dart
+++ b/comwell_key_app/lib/contact/contact_page.dart
@@ -3,7 +3,7 @@ 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/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -28,7 +28,7 @@ class ContactPage extends StatelessWidget {
children: [
const SizedBox(height: 20),
Text(
- 'need_help'.tr(),
+ context.strings.need_help,
style: Theme.of(context).textTheme.headlineLarge,
),
const SizedBox(height: 40),
diff --git a/comwell_key_app/lib/find_booking/find_booking_page.dart b/comwell_key_app/lib/find_booking/find_booking_page.dart
index fa59c5ef..7e568272 100644
--- a/comwell_key_app/lib/find_booking/find_booking_page.dart
+++ b/comwell_key_app/lib/find_booking/find_booking_page.dart
@@ -4,7 +4,7 @@ import 'package:comwell_key_app/find_booking/cubit/find_booking_cubit.dart';
import 'package:comwell_key_app/find_booking/cubit/find_booking_state.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -55,7 +55,7 @@ class FindBookingPageState extends State<FindBookingPage>
const SizedBox(height: 20),
const SizedBox(height: 20),
ComwellTextField(
- fieldName: 'booking_reference'.tr(),
+ fieldName: context.strings.booking_reference,
initialValue: '',
readOnly: false,
controller: cubit.confirmationIdController,
@@ -63,7 +63,7 @@ class FindBookingPageState extends State<FindBookingPage>
),
const SizedBox(height: 20),
ComwellTextField(
- fieldName: 'your_last_name'.tr(),
+ fieldName: context.strings.your_last_name,
initialValue: '',
readOnly: false,
controller: cubit.lastNameController,
diff --git a/comwell_key_app/lib/force_update/force_update_page.dart b/comwell_key_app/lib/force_update/force_update_page.dart
index 6e0f3f55..baea5e4d 100644
--- a/comwell_key_app/lib/force_update/force_update_page.dart
+++ b/comwell_key_app/lib/force_update/force_update_page.dart
@@ -1,6 +1,8 @@
import 'package:comwell_key_app/force_update/force_update_cubit.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'dart:io' show Platform;
@@ -50,14 +52,14 @@ class ForceUpdatePage extends StatelessWidget {
child: Column(
children: [
Text(
- 'force_update_title'.tr(),
+ context.strings.force_update_title,
textAlign: TextAlign.center,
style: textTheme.headlineMedium
?.copyWith(color: Colors.white),
),
const SizedBox(height: 8),
Text(
- 'force_update_description'.tr(),
+ context.strings.force_update_description,
textAlign: TextAlign.center,
style: textTheme.bodySmall?.copyWith(
color: Colors.white.withValues(alpha: 0.65)),
@@ -92,7 +94,7 @@ class ForceUpdatePage extends StatelessWidget {
height: 24,
child: CircularProgressIndicator(strokeWidth: 2),
)
- : Text('force_update_button'.tr()),
+ : Text(context.strings.force_update_button),
),
),
SizedBox(height: 60 + MediaQuery.of(context).padding.bottom),
diff --git a/comwell_key_app/lib/hotel_information/components/address.dart b/comwell_key_app/lib/hotel_information/components/address.dart
index b026eb77..018012e1 100644
--- a/comwell_key_app/lib/hotel_information/components/address.dart
+++ b/comwell_key_app/lib/hotel_information/components/address.dart
@@ -1,6 +1,6 @@
import 'package:comwell_key_app/hotel_information/components/maps_bottom_modal.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class Address extends StatelessWidget {
@@ -14,7 +14,7 @@ class Address extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text("restaurant_page_address".tr(),
+ Text(context.strings.restaurant_page_address,
style: theme.textTheme.headlineMedium),
const SizedBox(width: 10),
GestureDetector(
diff --git a/comwell_key_app/lib/hotel_information/components/email.dart b/comwell_key_app/lib/hotel_information/components/email.dart
index fc6397da..7da90f1f 100644
--- a/comwell_key_app/lib/hotel_information/components/email.dart
+++ b/comwell_key_app/lib/hotel_information/components/email.dart
@@ -1,5 +1,6 @@
+import 'package:comwell_key_app/.generated/assets/assets.gen.dart';
import 'package:comwell_key_app/hotel_information/components/contact_hotel_button.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:comwell_key_app/utils/launch_util.dart';
@@ -10,9 +11,9 @@ class Email extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ContactHotelButton(
- title: "restaurant_page_send_email".tr(),
+ title: context.strings.restaurant_page_send_email,
subtitle: email,
- iconPath: "assets/icons/ic_send.svg",
+ iconPath: Assets.icons.icSend.path,
onClick: () {
launchEmail(context, email);
},
diff --git a/comwell_key_app/lib/hotel_information/components/hotel_bottom_sheet_button.dart b/comwell_key_app/lib/hotel_information/components/hotel_bottom_sheet_button.dart
index 6e4953a9..6af0033d 100644
--- a/comwell_key_app/lib/hotel_information/components/hotel_bottom_sheet_button.dart
+++ b/comwell_key_app/lib/hotel_information/components/hotel_bottom_sheet_button.dart
@@ -1,5 +1,5 @@
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class HotelBottomSheetButton extends StatelessWidget {
@@ -44,7 +44,7 @@ class HotelBottomSheetButton extends StatelessWidget {
return const CircularProgressIndicator();
}
return Text(
- "hotel_information_page_spa_button".tr(),
+ context.strings.hotel_information_page_spa_button,
style: theme.textTheme.bodyLarge?.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
diff --git a/comwell_key_app/lib/hotel_information/components/maps_bottom_modal.dart b/comwell_key_app/lib/hotel_information/components/maps_bottom_modal.dart
index 1e6ed585..81cb071b 100644
--- a/comwell_key_app/lib/hotel_information/components/maps_bottom_modal.dart
+++ b/comwell_key_app/lib/hotel_information/components/maps_bottom_modal.dart
@@ -1,4 +1,4 @@
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'dart:io' show Platform;
@@ -23,8 +23,10 @@ class MapsBottomModal extends StatelessWidget {
showDialog<void>(
context: context,
builder: (context) => AlertDialog(
- title: Text('open_maps_error_title'.tr(), ),
- content: Text('open_maps_error_subtitle'.tr()),
+ title: Text(
+ context.strings.open_maps_error_title,
+ ),
+ content: Text(context.strings.open_maps_error_subtitle),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
@@ -57,8 +59,8 @@ class MapsBottomModal extends StatelessWidget {
showDialog<void>(
context: context,
builder: (context) => AlertDialog(
- title: Text('open_maps_error_title'.tr()),
- content: Text('open_maps_error_subtitle'.tr()),
+ title: Text(context.strings.open_maps_error_title),
+ content: Text(context.strings.open_maps_error_subtitle),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
@@ -88,7 +90,7 @@ class MapsBottomModal extends StatelessWidget {
children: [
ListTile(
leading: const Icon(Icons.map_outlined),
- title: Text('apple_maps'.tr(), style: theme.textTheme.bodyMedium),
+ title: Text(context.strings.apple_maps, style: theme.textTheme.bodyMedium),
onTap: () async {
Navigator.pop(context);
await _launchMapsUrl(
@@ -99,7 +101,7 @@ class MapsBottomModal extends StatelessWidget {
),
ListTile(
leading: const Icon(Icons.map),
- title: Text('google_maps'.tr(), style: theme.textTheme.bodyMedium),
+ title: Text(context.strings.google_maps, style: theme.textTheme.bodyMedium),
onTap: () async {
Navigator.pop(context);
await _launchMapsUrl(
diff --git a/comwell_key_app/lib/hotel_information/components/opening_hours.dart b/comwell_key_app/lib/hotel_information/components/opening_hours.dart
index 4cccc0b6..74ef6a29 100644
--- a/comwell_key_app/lib/hotel_information/components/opening_hours.dart
+++ b/comwell_key_app/lib/hotel_information/components/opening_hours.dart
@@ -1,4 +1,4 @@
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class OpeningHours extends StatelessWidget {
@@ -13,7 +13,7 @@ class OpeningHours extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- "restaurant_page_opening_hours".tr(),
+ context.strings.restaurant_page_opening_hours,
style: theme.textTheme.headlineMedium,
),
Text(
diff --git a/comwell_key_app/lib/hotel_information/components/phone_number.dart b/comwell_key_app/lib/hotel_information/components/phone_number.dart
index 99419415..dc2fcc9f 100644
--- a/comwell_key_app/lib/hotel_information/components/phone_number.dart
+++ b/comwell_key_app/lib/hotel_information/components/phone_number.dart
@@ -1,5 +1,5 @@
import 'package:comwell_key_app/hotel_information/components/contact_hotel_button.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
@@ -10,7 +10,7 @@ class PhoneNumber extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ContactHotelButton(
- title: "call_us".tr(),
+ title: context.strings.call_us,
subtitle: phoneNumber,
iconPath: "assets/icons/ic_telephone.svg",
onClick: () {
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 d39313d5..bfdbd150 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
@@ -1,6 +1,6 @@
import 'package:comwell_key_app/hotel_information/cubit/hotel_information_cubit.dart';
-import 'package:comwell_key_app/themes/light_theme.dart' ;
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../common/components/shimmer_loader/spa_facility_shimmer_loader.dart';
@@ -13,54 +13,58 @@ class SpaFacilityPage extends StatelessWidget {
final cubit = context.read<HotelInformationCubit>();
final isLoading = cubit.state.spaButtonIsLoading;
return Scaffold(
- bottomSheet: Builder(builder: (context) {
- return Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- const Divider(
- color: colorDivider,
- height: 0,
- ),
- Row(
- children: [
- Expanded(
- child: Padding(
- padding: const EdgeInsets.all(16.0),
- child: ElevatedButton(
- onPressed: isLoading
- ? null
- : cubit.onBookSpaClicked,
- style: ButtonStyle(
- backgroundColor:
- WidgetStateProperty.resolveWith((states) {
+ bottomSheet: Builder(
+ builder: (context) {
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Divider(
+ color: colorDivider,
+ height: 0,
+ ),
+ Row(
+ children: [
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: ElevatedButton(
+ onPressed: isLoading ? null : cubit.onBookSpaClicked,
+ style: ButtonStyle(
+ backgroundColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.disabled)) {
return Colors.grey;
}
return sandColor[80];
}),
- foregroundColor:
- const WidgetStatePropertyAll(Colors.white)),
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 16.0),
- child: Builder(builder: (context) {
- if (isLoading) {
- return const SpaFacilityShimmerLoader();
- }
- return Text("${"hotel_information_page_spa_button".tr()} Spa ${cubit.state.spaButtonIsLoading}");
- }),
+ foregroundColor: const WidgetStatePropertyAll(Colors.white),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 16.0),
+ child: Builder(
+ builder: (context) {
+ if (isLoading) {
+ return const SpaFacilityShimmerLoader();
+ }
+ return Text(
+ "${context.strings.hotel_information_page_spa_button} Spa ${cubit.state.spaButtonIsLoading}",
+ );
+ },
+ ),
+ ),
),
),
),
- ),
- ],
- ),
- ],
- );
- }),
+ ],
+ ),
+ ],
+ );
+ },
+ ),
body: const Center(
- child: Column(
- children: [Text("Spa")],
- )),
+ child: Column(
+ children: [Text("Spa")],
+ ),
+ ),
);
}
}
diff --git a/comwell_key_app/lib/hotel_information/components/structured_text.dart b/comwell_key_app/lib/hotel_information/components/structured_text.dart
index a97821d1..d1a8eac9 100644
--- a/comwell_key_app/lib/hotel_information/components/structured_text.dart
+++ b/comwell_key_app/lib/hotel_information/components/structured_text.dart
@@ -3,7 +3,7 @@ import 'package:comwell_key_app/hotel_information/components/address.dart';
import 'package:comwell_key_app/hotel_information/components/phone_number.dart';
import 'package:comwell_key_app/hotel_information/components/contact_hotel_button.dart';
import 'package:comwell_key_app/themes/dark_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:comwell_key_app/hotel_information/components/image_widget.dart';
import 'package:comwell_key_app/hotel_information/components/spa_booking_link.dart';
@@ -54,7 +54,7 @@ class StructuredText extends StatelessWidget {
iconPath: "assets/icons/ic_send.svg",
onClick: () async {
await launchEmail(context, b.email,
- errorMessage: "email_launch_error".tr());
+ errorMessage: context.strings.email_launch_error);
},
),
),
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 4e2e2145..fc1b60a6 100644
--- a/comwell_key_app/lib/hotel_information/hotel_information_page.dart
+++ b/comwell_key_app/lib/hotel_information/hotel_information_page.dart
@@ -1,7 +1,7 @@
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
import 'package:comwell_key_app/common/components/comwell_error_widget.dart';
import 'package:comwell_key_app/hotel_information/cubit/hotel_information_cubit.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../common/components/shimmer_loader/hotel_information_shimmer_loader.dart';
@@ -26,8 +26,8 @@ class HotelInformationPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
ComwellErrorWidget(
- title: 'generic_error_title'.tr(),
- subtitle: 'hotel_information_error_subtitle'.tr(),
+ title: context.strings.generic_error_title,
+ subtitle: context.strings.hotel_information_error_subtitle,
border: false,
),
],
diff --git a/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart b/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart
index 87b60a37..3764652e 100644
--- a/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart
+++ b/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart
@@ -1,5 +1,6 @@
+import 'package:comwell_key_app/.generated/assets/assets.gen.dart';
import 'package:comwell_key_app/hotel_information/components/image_widget.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -44,8 +45,8 @@ class HotelInformationMenu extends StatelessWidget {
);
}),
HotelInformationListTile(
- iconPath: "assets/icons/ic_info.svg",
- title: "hotel_information_page_menu_other_info_title".tr(),
+ iconPath: Assets.icons.icInfo.path,
+ title: context.strings.hotel_information_page_menu_other_info_title,
onClick: cubit.onMoreInformationClicked,
),
],
diff --git a/comwell_key_app/lib/login/components/forced_logout_banner.dart b/comwell_key_app/lib/login/components/forced_logout_banner.dart
index 6657ffca..2918f85e 100644
--- a/comwell_key_app/lib/login/components/forced_logout_banner.dart
+++ b/comwell_key_app/lib/login/components/forced_logout_banner.dart
@@ -1,4 +1,4 @@
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class ForcedLogoutBanner extends StatelessWidget {
@@ -37,10 +37,10 @@ class ForcedLogoutBanner extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text('error_logout'.tr(),
+ Text(context.strings.error_logout,
style: theme.textTheme.titleMedium!.copyWith(
color: Colors.red, fontWeight: FontWeight.bold)),
- Text('error_logout_subtitle'.tr(),
+ Text(context.strings.error_logout_subtitle,
softWrap: true,
style: theme.textTheme.bodySmall!
.copyWith(color: Colors.red)),
diff --git a/comwell_key_app/lib/my_booking/cubit/my_booking_state.dart b/comwell_key_app/lib/my_booking/cubit/my_booking_state.dart
index 8907d56e..79118b80 100644
--- a/comwell_key_app/lib/my_booking/cubit/my_booking_state.dart
+++ b/comwell_key_app/lib/my_booking/cubit/my_booking_state.dart
@@ -1,6 +1,5 @@
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/services/models/booking_dto.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:equatable/equatable.dart';
class MyBookingState extends Equatable {
@@ -34,8 +33,7 @@ class MyBookingState extends Equatable {
if (applyClubPoints) {
return [
..._items,
- BookingAddonItem(
- "discount".tr(), "discount".tr(), clubPoints * -1, clubPoints * -1)
+ BookingAddonItem("discount", "discount", clubPoints * -1, clubPoints * -1),
];
}
@@ -44,22 +42,19 @@ class MyBookingState extends Equatable {
int _sumOfList(Iterable<BookingAddonItem> list) {
if (list.isEmpty) return 0;
- return list
- .map((item) => item.price)
- .reduce((total, price) => total + price);
+ return list.map((item) => item.price).reduce((total, price) => total + price);
}
MyBookingState.initial(Booking this.booking)
- : isTermsAccepted = false,
- error = null,
- isLoading = false,
- showTermsError = false,
- clubPoints = 0,
- applyClubPoints = false,
- _items = [];
+ : isTermsAccepted = false,
+ error = null,
+ isLoading = false,
+ showTermsError = false,
+ clubPoints = 0,
+ applyClubPoints = false,
+ _items = [];
- MyBookingState termsAccepted() =>
- copyWith(isTermsAccepted: true, showTermsError: false);
+ MyBookingState termsAccepted() => copyWith(isTermsAccepted: true, showTermsError: false);
MyBookingState termsDenied() => copyWith(isTermsAccepted: false);
@@ -76,24 +71,25 @@ class MyBookingState extends Equatable {
@override
List<Object?> get props => [
- booking,
- error,
- isLoading,
- applyClubPoints,
- clubPoints,
- isTermsAccepted,
- showTermsError,
- _items
- ];
-
- MyBookingState copyWith(
- {Booking? booking,
- bool? applyClubPoints,
- Error? error,
- int? clubPoints,
- bool? isTermsAccepted,
- bool? showTermsError,
- Iterable<BookingAddonItem>? items}) {
+ booking,
+ error,
+ isLoading,
+ applyClubPoints,
+ clubPoints,
+ isTermsAccepted,
+ showTermsError,
+ _items,
+ ];
+
+ MyBookingState copyWith({
+ Booking? booking,
+ bool? applyClubPoints,
+ Error? error,
+ int? clubPoints,
+ bool? isTermsAccepted,
+ bool? showTermsError,
+ Iterable<BookingAddonItem>? items,
+ }) {
return MyBookingState(
booking: booking ?? this.booking,
error: error ?? this.error,
diff --git a/comwell_key_app/lib/notifications/components/communications_list.dart b/comwell_key_app/lib/notifications/components/communications_list.dart
index 4939dd21..7b573f69 100644
--- a/comwell_key_app/lib/notifications/components/communications_list.dart
+++ b/comwell_key_app/lib/notifications/components/communications_list.dart
@@ -3,7 +3,7 @@ import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:flutter/material.dart';
class CommunicationsList extends StatelessWidget {
- final Iterable<NotificationPermission> notificationPermissions;
+ final List<NotificationPermission> notificationPermissions;
final void Function(String) valueChanged;
const CommunicationsList({
@@ -46,7 +46,8 @@ class CommunicationsList extends StatelessWidget {
subtitle: Text(
notificationPermissions
.elementAt(index)
- .notificationPermissionDescription ??
+ .notificationPermissionDescription
+ ?.description(context) ??
'',
style: theme.textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.surfaceTint,
diff --git a/comwell_key_app/lib/notifications/cubit/notifications_cubit.dart b/comwell_key_app/lib/notifications/cubit/notifications_cubit.dart
index 923c5ab0..ca0499fd 100644
--- a/comwell_key_app/lib/notifications/cubit/notifications_cubit.dart
+++ b/comwell_key_app/lib/notifications/cubit/notifications_cubit.dart
@@ -18,7 +18,7 @@ class NotificationsCubit extends Cubit<NotificationsState> {
init();
}
- Iterable<NotificationPermission> notificationPermissions = [];
+ List<NotificationPermission> notificationPermissions = [];
late User user;
// List of permission types that should be shown in the UI
@@ -29,13 +29,16 @@ class NotificationsCubit extends Cubit<NotificationsState> {
NotificationPermissionType.ccEmail,
];
- Iterable<NotificationPermission> _filterVisiblePermissions(
- Iterable<NotificationPermission> permissions,
+ List<NotificationPermission> _filterVisiblePermissions(
+ List<NotificationPermission> permissions,
) {
- return permissions.where(
- (permission) =>
- _visiblePermissionTypes.any((type) => type.notificationPermissionId == permission.code),
- );
+ return permissions
+ .where(
+ (permission) => _visiblePermissionTypes.any(
+ (type) => type.notificationPermissionId == permission.code,
+ ),
+ )
+ .toList();
}
void init() async {
@@ -108,7 +111,7 @@ class NotificationsCubit extends Cubit<NotificationsState> {
);
}
- void updatePreferences(Iterable<NotificationPermission> notificationPermissions) async {
+ void updatePreferences(List<NotificationPermission> notificationPermissions) async {
await notificationsRepository.updateNotificationPreferences(notificationPermissions);
emit(
diff --git a/comwell_key_app/lib/notifications/cubit/notifications_state.dart b/comwell_key_app/lib/notifications/cubit/notifications_state.dart
index 8f2d3882..24f7b080 100644
--- a/comwell_key_app/lib/notifications/cubit/notifications_state.dart
+++ b/comwell_key_app/lib/notifications/cubit/notifications_state.dart
@@ -4,7 +4,7 @@ import 'package:equatable/equatable.dart';
class NotificationsState extends Equatable {
final Error? error;
final bool isLoading;
- final Iterable<NotificationPermission> allNotifications;
+ final List<NotificationPermission> allNotifications;
const NotificationsState({
required this.allNotifications,
@@ -12,18 +12,14 @@ class NotificationsState extends Equatable {
required this.isLoading,
});
- NotificationsState.initial()
- : allNotifications = [],
- error = null,
- isLoading = false;
+ NotificationsState.initial() : allNotifications = [], error = null, isLoading = false;
NotificationsState notificationSelected({
required NotificationPermission notificationPermission,
- }) =>
- _copyWith(allNotifications: allNotifications);
+ }) => _copyWith(allNotifications: allNotifications);
NotificationsState _copyWith({
- Iterable<NotificationPermission>? allNotifications,
+ List<NotificationPermission>? allNotifications,
bool? isLoading,
Error? error,
}) {
diff --git a/comwell_key_app/lib/notifications/models/notification_permission.dart b/comwell_key_app/lib/notifications/models/notification_permission.dart
index c03d3ea3..f7ecf0af 100644
--- a/comwell_key_app/lib/notifications/models/notification_permission.dart
+++ b/comwell_key_app/lib/notifications/models/notification_permission.dart
@@ -1,5 +1,6 @@
import 'package:comwell_key_app/utils/json.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
+import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
part '../../.generated/notifications/models/notification_permission.g.dart';
@@ -26,7 +27,7 @@ enum NotificationPermissionType {
return "ccmarketingdigi"; //1406
case NotificationPermissionType.ccSms:
return "ccmarketingsms";
-
+
case NotificationPermissionType.b2bNewsletter:
return "b2bmarketingnewsletter"; //1400
case NotificationPermissionType.b2bDigital:
@@ -37,8 +38,8 @@ enum NotificationPermissionType {
return "companymarketingnewsletter";
case NotificationPermissionType.stayEmails:
return "staymarketingemail";
- case NotificationPermissionType.similarProducts:
- return "similarproducts";
+ case NotificationPermissionType.similarProducts:
+ return "similarproducts";
}
}
@@ -68,27 +69,27 @@ enum NotificationPermissionType {
}
}
-// Not all permissions are used so some of the descriptions are not implemented
- String get notificationPermissionDescription {
+ // Not all permissions are used so some of the descriptions are not implemented
+ String description(BuildContext context) {
switch (this) {
case NotificationPermissionType.b2bNewsletter:
- return 'company_deal_subtitle'.tr();
+ return context.strings.company_deal_subtitle;
case NotificationPermissionType.ccEmail:
- return 'email_subtitle'.tr();
+ return context.strings.email_subtitle;
case NotificationPermissionType.ccDigital:
- return 'digital_media_subtitle'.tr();
+ return context.strings.digital_media_subtitle;
case NotificationPermissionType.ccSms:
- return 'sms_subtitle'.tr();
+ return context.strings.sms_subtitle;
case NotificationPermissionType.b2bDigital:
return '';
case NotificationPermissionType.companyEmail:
return '';
case NotificationPermissionType.companyNotifications:
- return 'club_newsletter_subtitle'.tr();
+ return context.strings.club_newsletter_subtitle;
case NotificationPermissionType.stayEmails:
return '';
case NotificationPermissionType.appNotifications:
- return 'push_subtitle'.tr();
+ return context.strings.push_subtitle;
case NotificationPermissionType.similarProducts:
return '';
}
@@ -99,7 +100,7 @@ enum NotificationPermissionType {
class NotificationPermission {
final String code;
final String displayName;
- final String? notificationPermissionDescription;
+ final NotificationPermissionType? notificationPermissionDescription;
final bool given;
NotificationPermission({
@@ -109,19 +110,19 @@ class NotificationPermission {
required this.given,
});
- factory NotificationPermission.fromJson(Json json) =>
- _$NotificationPermissionFromJson(json);
+ factory NotificationPermission.fromJson(Json json) => _$NotificationPermissionFromJson(json);
Json toJson() => _$NotificationPermissionToJson(this);
- NotificationPermission copyWith(
- {bool? given, String? notificationPermissionDescription}) =>
- NotificationPermission(
- code: code,
- displayName: displayName,
- notificationPermissionDescription: notificationPermissionDescription,
- given: given ?? this.given,
- );
+ NotificationPermission copyWith({
+ bool? given,
+ NotificationPermissionType? notificationPermissionDescription,
+ }) => NotificationPermission(
+ code: code,
+ displayName: displayName,
+ notificationPermissionDescription: notificationPermissionDescription,
+ given: given ?? this.given,
+ );
@override
String toString() {
diff --git a/comwell_key_app/lib/notifications/notifications_page.dart b/comwell_key_app/lib/notifications/notifications_page.dart
index 4cec8158..5b5e7a99 100644
--- a/comwell_key_app/lib/notifications/notifications_page.dart
+++ b/comwell_key_app/lib/notifications/notifications_page.dart
@@ -3,7 +3,7 @@ import 'package:comwell_key_app/common/components/comwell_error_widget.dart';
import 'package:comwell_key_app/notifications/cubit/notifications_state.dart';
import 'package:comwell_key_app/notifications/models/notification_permission.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:comwell_key_app/notifications/cubit/notifications_cubit.dart';
@@ -30,8 +30,8 @@ class NotificationsPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
ComwellErrorWidget(
- title: 'generic_error_title'.tr(),
- subtitle: 'notifications_error_subtitle'.tr(),
+ title: context.strings.generic_error_title,
+ subtitle: context.strings.notifications_error_subtitle,
border: false,
),
],
@@ -58,7 +58,7 @@ class NotificationsPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- 'notifications_page_title'.tr(),
+ context.strings.notifications_page_title,
style: const TextStyle(
fontSize: 28,
fontWeight: FontWeight.w600,
@@ -91,7 +91,7 @@ class NotificationsPage extends StatelessWidget {
),
const SizedBox(width: 8),
Text(
- 'subscribe_all'.tr(),
+ context.strings.subscribe_all,
style: const TextStyle(fontSize: 16),
),
],
@@ -132,7 +132,7 @@ class NotificationsPage extends StatelessWidget {
},
style: theme.elevatedButtonTheme.style,
child: Text(
- 'save'.tr(),
+ context.strings.save,
style: const TextStyle(
color: Colors.white,
fontSize: 16,
diff --git a/comwell_key_app/lib/notifications/notifications_repository.dart b/comwell_key_app/lib/notifications/notifications_repository.dart
index 5778e11d..3aeb72ab 100644
--- a/comwell_key_app/lib/notifications/notifications_repository.dart
+++ b/comwell_key_app/lib/notifications/notifications_repository.dart
@@ -17,14 +17,13 @@ class NotificationsRepository {
return user;
}
- Future<void> updatePreferences(
- Iterable<NotificationPermission> notificationPermissions) async {
+ Future<void> updatePreferences(Iterable<NotificationPermission> notificationPermissions) async {
return api.updateNotificationPreferences(notificationPermissions);
}
Future<List<NotificationPermission>> fetchNotificationPermissions() async {
- notificationPermissions =
- await locator<ComwellDatabase>().notificationPermissionDAO.getNotificationPermissions();
+ notificationPermissions = await locator<ComwellDatabase>().notificationPermissionDAO
+ .getNotificationPermissions();
if (notificationPermissions.isEmpty) {
final response = await api.getNotificationPermissions();
@@ -35,37 +34,38 @@ class NotificationsRepository {
.map((json) => NotificationPermission.fromJson(json as Json))
.toList();
- notificationPermissions =
- addDescriptionsToPermissions(notificationPermissions);
+ notificationPermissions = addDescriptionsToPermissions(notificationPermissions);
- await locator<ComwellDatabase>().notificationPermissionDAO
- .saveNotificationPermission(notificationPermissions);
+ await locator<ComwellDatabase>().notificationPermissionDAO.saveNotificationPermission(
+ notificationPermissions,
+ );
return notificationPermissions.toList();
} else {
- notificationPermissions =
- addDescriptionsToPermissions(notificationPermissions);
+ notificationPermissions = addDescriptionsToPermissions(notificationPermissions);
return notificationPermissions.toList();
}
}
Iterable<NotificationPermission> addDescriptionsToPermissions(
- Iterable<NotificationPermission> permissions) {
+ Iterable<NotificationPermission> permissions,
+ ) {
return permissions.map((permission) {
final enumValue = NotificationPermissionType.values.firstWhere(
(type) => type.notificationPermissionId == permission.code,
);
return permission.copyWith(
- notificationPermissionDescription:
- enumValue.notificationPermissionDescription,
+ notificationPermissionDescription: enumValue,
);
}).toList();
}
Future<dynamic> updateNotificationPreferences(
- Iterable<NotificationPermission> notificationPermissions) async {
- await locator<ComwellDatabase>().notificationPermissionDAO
- .saveNotificationPermission(notificationPermissions);
+ Iterable<NotificationPermission> notificationPermissions,
+ ) async {
+ await locator<ComwellDatabase>().notificationPermissionDAO.saveNotificationPermission(
+ notificationPermissions,
+ );
return api.updateNotificationPreferences(notificationPermissions);
}
diff --git a/comwell_key_app/lib/overview/components/bill_download_modal.dart b/comwell_key_app/lib/overview/components/bill_download_modal.dart
index 40005e60..cf8fbbb8 100644
--- a/comwell_key_app/lib/overview/components/bill_download_modal.dart
+++ b/comwell_key_app/lib/overview/components/bill_download_modal.dart
@@ -1,6 +1,6 @@
import 'package:comwell_key_app/common/components/comwell_text_field.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class BillDownloadModal extends StatelessWidget {
@@ -38,7 +38,7 @@ class BillDownloadModal extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text('download_bill'.tr(), style: theme.textTheme.titleLarge),
+ Text(context.strings.download_bill, style: theme.textTheme.titleLarge),
IconButton(
onPressed: () {
Navigator.pop(context);
@@ -55,7 +55,7 @@ class BillDownloadModal extends StatelessWidget {
),
const SizedBox(height: 16),
ComwellTextField(
- fieldName: 'bill_email_placeholder'.tr(),
+ fieldName: context.strings.bill_email_placeholder,
initialValue: initialEmail,
readOnly: false,
controller: emailController),
@@ -66,7 +66,7 @@ class BillDownloadModal extends StatelessWidget {
width: double.infinity,
child: ElevatedButton(
onPressed: onDownload,
- child: Text('send_to_email'.tr(),
+ child: Text(context.strings.send_to_email,
style: theme.textTheme.headlineSmall
?.copyWith(color: Colors.white))),
),
diff --git a/comwell_key_app/lib/overview/components/booking_list_item_view.dart b/comwell_key_app/lib/overview/components/booking_list_item_view.dart
index 4e0e3727..39526569 100644
--- a/comwell_key_app/lib/overview/components/booking_list_item_view.dart
+++ b/comwell_key_app/lib/overview/components/booking_list_item_view.dart
@@ -1,10 +1,11 @@
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';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
+import 'package:intl/intl.dart';
class BookingListItemView extends StatelessWidget {
final Booking booking;
@@ -92,7 +93,7 @@ class BookingListItemView extends StatelessWidget {
const Spacer(),
if (isCancelled)
Text(
- "booking_annulled".tr(),
+ context.strings.booking_annulled,
style: theme.textTheme.bodyMedium?.copyWith(color: Colors.red),
),
const SizedBox(width: 16),
diff --git a/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart b/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart
index 15e08b2c..b1c7183f 100644
--- a/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart
+++ b/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart
@@ -6,11 +6,12 @@ import 'package:comwell_key_app/overview/models/guest.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/booking_details/components/guest_list.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.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';
+import 'package:intl/intl.dart';
class CurrentBookingListItem extends StatelessWidget {
final Booking booking;
@@ -112,7 +113,7 @@ class CurrentBookingListItem extends StatelessWidget {
SvgPicture.asset("assets/icons/ic_user_circle.svg"),
const SizedBox(width: 4),
Text(
- "${booking.adults} ${booking.adults > 1 ? 'adults'.tr() : 'adult'.tr()}${booking.children >= 1 ? ', ${booking.children} ${booking.children > 1 ? 'children'.tr() : 'child'.tr()}' : ''}",
+ "${booking.adults} ${booking.adults > 1 ? context.strings.adults : context.strings.adult}${booking.children >= 1 ? ', ${booking.children} ${booking.children > 1 ? context.strings.children : context.strings.child}' : ''}",
style: theme.textTheme.bodySmall,
),
],
@@ -176,7 +177,7 @@ Future<dynamic> _showGuestList(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
- 'handle_guests_title'.tr(),
+ context.strings.handle_guests_title,
style: theme.textTheme.titleLarge?.copyWith(
color: colorTertiary,
fontWeight: FontWeight.w600,
diff --git a/comwell_key_app/lib/overview/components/find_booking_button.dart b/comwell_key_app/lib/overview/components/find_booking_button.dart
index efad7ab4..4ca15b79 100644
--- a/comwell_key_app/lib/overview/components/find_booking_button.dart
+++ b/comwell_key_app/lib/overview/components/find_booking_button.dart
@@ -1,6 +1,6 @@
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
@@ -20,7 +20,7 @@ class FindBookingButton extends StatelessWidget {
},
icon: SvgPicture.asset('assets/icons/loop.svg'),
label: Text(
- 'find_booking'.tr(),
+ context.strings.find_booking,
style: theme.textTheme.bodyMedium,
),
style: OutlinedButton.styleFrom(
diff --git a/comwell_key_app/lib/overview/components/prepare_room_widget.dart b/comwell_key_app/lib/overview/components/prepare_room_widget.dart
index 3937e422..151a59e7 100644
--- a/comwell_key_app/lib/overview/components/prepare_room_widget.dart
+++ b/comwell_key_app/lib/overview/components/prepare_room_widget.dart
@@ -1,6 +1,6 @@
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
class PrepareRoomWidget extends StatelessWidget {
@@ -29,12 +29,12 @@ class PrepareRoomWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- "prepare_room".tr(),
+ context.strings.prepare_room,
style: theme.textTheme.bodyMedium,
textAlign: TextAlign.start,
),
Text(
- "jump_line_text".tr(),
+ context.strings.jump_line_text,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.start,
style: theme.textTheme.bodySmall?.copyWith(
diff --git a/comwell_key_app/lib/overview/components/room_selection_widget.dart b/comwell_key_app/lib/overview/components/room_selection_widget.dart
index 36404d04..9a8557ce 100644
--- a/comwell_key_app/lib/overview/components/room_selection_widget.dart
+++ b/comwell_key_app/lib/overview/components/room_selection_widget.dart
@@ -1,7 +1,7 @@
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';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -37,12 +37,12 @@ class RoomSelectionWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- "room_selection".tr(),
+ context.strings.room_selection,
style: theme.textTheme.bodyMedium,
textAlign: TextAlign.start,
),
Text(
- "room_selection_subtitle".tr(),
+ context.strings.room_selection_subtitle,
style: theme.textTheme.bodySmall?.copyWith(
color: colorHeadlineText,
),
diff --git a/comwell_key_app/lib/overview/overview_page.dart b/comwell_key_app/lib/overview/overview_page.dart
index 49f27b90..da9c0aff 100644
--- a/comwell_key_app/lib/overview/overview_page.dart
+++ b/comwell_key_app/lib/overview/overview_page.dart
@@ -11,7 +11,7 @@ import 'package:comwell_key_app/profile/utils/urls.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/utils/context_utils.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -148,10 +148,10 @@ class OverviewTabViewState extends State<OverviewPage>
dividerColor: Colors.transparent,
tabs: [
Tab(
- text: 'overview_tabbar_active'.tr(),
+ text: context.strings.overview_tabbar_active,
),
- Tab(text: 'overview_tabbar_past'.tr()),
- Tab(text: 'overview_tabbar_cancelled'.tr()),
+ Tab(text: context.strings.overview_tabbar_past),
+ Tab(text: context.strings.overview_tabbar_cancelled),
],
),
),
@@ -162,8 +162,8 @@ class OverviewTabViewState extends State<OverviewPage>
return Column(
children: [
ComwellErrorWidget(
- title: 'overview_error_title'.tr(),
- subtitle: 'overview_error_subtitle'.tr(),
+ title: context.strings.overview_error_title,
+ subtitle: context.strings.overview_error_subtitle,
border: true,
),
IconButton(
@@ -174,7 +174,7 @@ class OverviewTabViewState extends State<OverviewPage>
Icons.refresh,
color: colorTertiary,
),
- tooltip: 'refresh_bookings'.tr(),
+ tooltip: context.strings.refresh_bookings,
),
const FindBookingButton(),
],
@@ -212,12 +212,12 @@ class OverviewTabViewState extends State<OverviewPage>
backgroundColor: colorBackground,
contentPadding: const EdgeInsets.all(24),
title: Text(
- 'error_opening_website_title'.tr(),
+ context.strings.error_opening_website_title,
style: context.textStyles.headingMedium,
textAlign: TextAlign.center,
),
content: Text(
- 'error_opening_website'.tr(),
+ context.strings.error_opening_website,
style: context.textStyles.body,
textAlign: TextAlign.center,
),
@@ -230,7 +230,7 @@ class OverviewTabViewState extends State<OverviewPage>
style: ElevatedButton.styleFrom(
foregroundColor: colorBackground,
),
- child: Text('generic_ok'.tr()),
+ child: Text(context.strings.generic_ok),
),
),
],
@@ -249,7 +249,7 @@ class OverviewTabViewState extends State<OverviewPage>
),
),
child: Text(
- 'new_booking'.tr(),
+ context.strings.new_booking,
style: theme.textTheme.bodyMedium?.copyWith(color: colorBackground),
),
),
@@ -269,11 +269,11 @@ class OverviewTabViewState extends State<OverviewPage>
context: context,
builder: (BuildContext context) {
return GenericDialog(
- title: "booking_not_found".tr(),
- content: "booking_not_found_subtitle".tr(),
- confirmButtonText: "booking_not_found_button".tr(),
+ title: context.strings.booking_not_found,
+ content: context.strings.booking_not_found_subtitle,
+ confirmButtonText: context.strings.booking_not_found_button,
confirmButtonTextColor: colorTertiary,
- cancelButtonText: "booking_not_found_cancel".tr(),
+ cancelButtonText: context.strings.booking_not_found_cancel,
onConfirm: () {
context.push(AppRoutes.findBooking);
Navigator.of(context).pop(); // Close the dialog
@@ -305,21 +305,21 @@ class OverviewTabView extends StatelessWidget {
children: [
CurrentBookingsTabView(
bookings: bookings.current,
- bookingsTitle: 'no_current_bookings'.tr(),
- bookingsSubtitle: 'no_current_bookings_subtitle'.tr(),
+ bookingsTitle: context.strings.no_current_bookings,
+ bookingsSubtitle: context.strings.no_current_bookings_subtitle,
bookingsImage: 'assets/images/no_current_bookings_background.jpeg',
),
BookingsTabView(
bookings: bookings.past,
- bookingsTitle: 'no_past_bookings_title'.tr(),
- bookingsSubtitle: 'no_past_bookings_subtitle'.tr(),
+ bookingsTitle: context.strings.no_past_bookings_title,
+ bookingsSubtitle: context.strings.no_past_bookings_subtitle,
bookingsIcon: 'assets/icons/account.svg',
isCancelled: false,
),
BookingsTabView(
bookings: bookings.cancelled,
- bookingsTitle: 'no_cancelled_booking_title'.tr(),
- bookingsSubtitle: 'no_cancelled_booking_subtitle'.tr(),
+ bookingsTitle: context.strings.no_cancelled_booking_title,
+ bookingsSubtitle: context.strings.no_cancelled_booking_subtitle,
bookingsIcon: 'assets/icons/thumbs-up.svg',
isCancelled: true,
),
diff --git a/comwell_key_app/lib/pregistration/components/information_card.dart b/comwell_key_app/lib/pregistration/components/information_card.dart
index 6e9b558a..d4937e5a 100644
--- a/comwell_key_app/lib/pregistration/components/information_card.dart
+++ b/comwell_key_app/lib/pregistration/components/information_card.dart
@@ -1,5 +1,5 @@
import 'package:comwell_key_app/themes/dark_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class InformationCard extends StatelessWidget {
@@ -30,7 +30,7 @@ class InformationCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(title, style: titleStyle),
- TextButton(onPressed: onEditClick, child: Text("edit".tr(), style: const TextStyle(decoration: TextDecoration.underline, decorationColor: sandColor, color: sandColor),))
+ TextButton(onPressed: onEditClick, child: Text(context.strings.edit, style: const TextStyle(decoration: TextDecoration.underline, decorationColor: sandColor, color: sandColor),))
],
),
const SizedBox(height: 10),
diff --git a/comwell_key_app/lib/pregistration/cubit/preregistration_cubit.dart b/comwell_key_app/lib/pregistration/cubit/preregistration_cubit.dart
index b3201a64..a554066e 100644
--- a/comwell_key_app/lib/pregistration/cubit/preregistration_cubit.dart
+++ b/comwell_key_app/lib/pregistration/cubit/preregistration_cubit.dart
@@ -14,10 +14,10 @@ import 'package:comwell_key_app/up_sales/models/addon_upgrade.dart';
import 'package:comwell_key_app/up_sales/models/room_upgrade.dart';
import 'package:comwell_key_app/up_sales/models/upgrade.dart';
import 'package:comwell_key_app/up_sales/up_sales_repository.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:comwell_key_app/utils/locator.dart';
import 'package:comwell_key_app/utils/phone_utils.dart';
import 'package:country_code_picker/country_code_picker.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -47,10 +47,10 @@ class PreregistrationCubit extends Cubit<PreregistrationState> {
final List<String> favoriteCountries = ['DK', 'SE', 'NO', 'FI'];
final List<String> documentTypes = [
- 'document_type_passport'.tr(),
- 'document_type_id_card'.tr(),
- 'document_type_driver_license'.tr(),
- 'document_type_other'.tr(),
+ 'document_type_passport',
+ 'document_type_id_card',
+ 'document_type_driver_license',
+ 'document_type_other',
];
String selectedDocumentType = '';
@@ -486,21 +486,21 @@ class PreregistrationCubit extends Cubit<PreregistrationState> {
}
}
- String get buttonText {
+ String buttonText(BuildContext context) {
int page = pageController.page?.ceil() ?? 0;
final preregPage = PreregistrationPage.fromIndex(page);
switch (preregPage) {
case PreregistrationPage.profile:
- return "generic_continue".tr();
+ return context.strings.generic_continue;
case PreregistrationPage.address:
- return "generic_continue".tr();
+ return context.strings.generic_continue;
case PreregistrationPage.upSales:
if (selectedAddOnUpgrades.isEmpty && state.selectedRoomUpgrade.isEmpty) {
- return "continue_without_up_sales".tr();
+ return context.strings.continue_without_up_sales;
}
- return "generic_continue".tr();
+ return context.strings.generic_continue;
case PreregistrationPage.confirmation:
- return "generic_confirm".tr();
+ return context.strings.generic_confirm;
}
}
diff --git a/comwell_key_app/lib/pregistration/pages/prereg_address_page.dart b/comwell_key_app/lib/pregistration/pages/prereg_address_page.dart
index 0f70ddbf..124459a0 100644
--- a/comwell_key_app/lib/pregistration/pages/prereg_address_page.dart
+++ b/comwell_key_app/lib/pregistration/pages/prereg_address_page.dart
@@ -2,8 +2,8 @@ import 'package:comwell_key_app/common/components/comwell_text_field.dart';
import 'package:comwell_key_app/pregistration/cubit/preregistration_cubit.dart';
import 'package:comwell_key_app/pregistration/cubit/preregistration_state.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:country_code_picker/country_code_picker.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../common/components/shimmer_loader/prereg_address_shimmer_loader.dart';
@@ -14,91 +14,69 @@ class PreregAddressPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<PreregistrationCubit, PreregistrationState>(
- builder: (context, state) {
- final cubit = context.read<PreregistrationCubit>();
+ builder: (context, state) {
+ final cubit = context.read<PreregistrationCubit>();
- if (state.isLoading) {
- return const Center(child: PreregAddressShimmerLoader());
- }
+ if (state.isLoading) {
+ return const Center(child: PreregAddressShimmerLoader());
+ }
- final isFavoriteCountry = cubit.favoriteCountries.contains(state.selectedCountry);
+ final isFavoriteCountry = cubit.favoriteCountries.contains(state.selectedCountry);
- final addressErrorMessage =
- !cubit.isAddressValid && state.missingInformation
- ? "generic_information_required".tr()
- : null;
- final postalCodeErrorMessage =
- !cubit.isPostalCodeValid && state.missingInformation
- ? "generic_information_required".tr()
- : null;
- final cityErrorMessage = !cubit.isCityValid && state.missingInformation
- ? "generic_information_required".tr()
- : null;
+ final addressErrorMessage = !cubit.isAddressValid && state.missingInformation
+ ? context.strings.generic_information_required
+ : null;
+ final postalCodeErrorMessage = !cubit.isPostalCodeValid && state.missingInformation
+ ? context.strings.generic_information_required
+ : null;
+ final cityErrorMessage = !cubit.isCityValid && state.missingInformation
+ ? context.strings.generic_information_required
+ : null;
- final documentNumberErrorMessage =
- !cubit.isDocumentNumberValid && state.missingInformation
- ? "generic_information_required".tr()
- : null;
+ final documentNumberErrorMessage = !cubit.isDocumentNumberValid && state.missingInformation
+ ? context.strings.generic_information_required
+ : null;
- return ListView(
- padding: const EdgeInsets.symmetric(horizontal: 12.0),
- key: const PageStorageKey("information_form"),
- children: [
- const SizedBox(height: 40),
- Text("preregistration_address_title".tr(),
- style: Theme.of(context).textTheme.headlineLarge),
- const SizedBox(height: 18),
- Text("preregistration_address_subtitle".tr(),
- style: Theme.of(context).textTheme.bodySmall),
- const SizedBox(height: 40),
- ComwellTextField(
+ return ListView(
+ padding: const EdgeInsets.symmetric(horizontal: 12.0),
+ key: const PageStorageKey("information_form"),
+ children: [
+ const SizedBox(height: 40),
+ Text(
+ context.strings.preregistration_address_title,
+ style: Theme.of(context).textTheme.headlineLarge,
+ ),
+ const SizedBox(height: 18),
+ Text(
+ context.strings.preregistration_address_subtitle,
+ style: Theme.of(context).textTheme.bodySmall,
+ ),
+ const SizedBox(height: 40),
+ ComwellTextField(
key: const Key("address"),
- fieldName: "preregistration_address_label_address".tr(),
+ fieldName: context.strings.preregistration_address_label_address,
initialValue: "",
readOnly: false,
errorMessage: addressErrorMessage,
- controller: cubit.addressTextController),
- const SizedBox(height: 12),
- ComwellTextField(
- fieldName: "preregistration_address_label_postal_code".tr(),
+ controller: cubit.addressTextController,
+ ),
+ const SizedBox(height: 12),
+ ComwellTextField(
+ fieldName: context.strings.preregistration_address_label_postal_code,
initialValue: "",
textInputType: TextInputType.number,
errorMessage: postalCodeErrorMessage,
readOnly: false,
- controller: cubit.postalCodeTextController),
- const SizedBox(height: 12),
- ComwellTextField(
- fieldName: "preregistration_address_label_city".tr(),
+ controller: cubit.postalCodeTextController,
+ ),
+ const SizedBox(height: 12),
+ ComwellTextField(
+ fieldName: context.strings.preregistration_address_label_city,
initialValue: "",
readOnly: false,
errorMessage: cityErrorMessage,
- controller: cubit.cityTextController),
- const SizedBox(height: 12),
- Container(
- height: 62,
- width: double.infinity,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- border: Border.all(color: colorDivider),
- ),
- child: CountryCodePicker(
- alignLeft: true,
- textOverflow: TextOverflow.visible,
- initialSelection: cubit.countryCode?.name,
- showFlag: true,
- favorite: cubit.favoriteCountries,
- showDropDownButton: true,
- textStyle: Theme.of(context).textTheme.headlineSmall,
- showCountryOnly: true,
- showOnlyCountryWhenClosed: true,
- onChanged: (CountryCode countryCode) {
- cubit.onCountryCodeSelected(countryCode);
- },
+ controller: cubit.cityTextController,
),
- ),
- const SizedBox(height: 12),
- if (!isFavoriteCountry) ...[
- const Divider(color: colorDivider),
const SizedBox(height: 12),
Container(
height: 62,
@@ -107,42 +85,68 @@ class PreregAddressPage extends StatelessWidget {
borderRadius: BorderRadius.circular(8),
border: Border.all(color: colorDivider),
),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(vertical: 10, horizontal: 12),
- child: DropdownButtonFormField<String>(
- hint: Text("document_type".tr()),
- value: state.selectedDocumentType.isNotEmpty
- ? state.selectedDocumentType
- : null,
- style: Theme.of(context)
- .textTheme
- .headlineSmall
- ?.copyWith(color: Colors.black),
- items: cubit.documentTypes
- .map((documentType) => DropdownMenuItem(
- value: documentType, child: Text(documentType)))
- .toList(),
- onChanged: (value) {
- if (value != null) {
- cubit.onDocumentTypeSelected(value);
- }
- },
- ),
+ child: CountryCodePicker(
+ alignLeft: true,
+ textOverflow: TextOverflow.visible,
+ initialSelection: cubit.countryCode?.name,
+ showFlag: true,
+ favorite: cubit.favoriteCountries,
+ showDropDownButton: true,
+ textStyle: Theme.of(context).textTheme.headlineSmall,
+ showCountryOnly: true,
+ showOnlyCountryWhenClosed: true,
+ onChanged: (CountryCode countryCode) {
+ cubit.onCountryCodeSelected(countryCode);
+ },
),
),
const SizedBox(height: 12),
- ComwellTextField(
+ if (!isFavoriteCountry) ...[
+ const Divider(color: colorDivider),
+ const SizedBox(height: 12),
+ Container(
+ height: 62,
+ width: double.infinity,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(8),
+ border: Border.all(color: colorDivider),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12),
+ child: DropdownButtonFormField<String>(
+ hint: Text(context.strings.document_type),
+ value: state.selectedDocumentType.isNotEmpty
+ ? state.selectedDocumentType
+ : null,
+ style: Theme.of(context).textTheme.headlineSmall?.copyWith(color: Colors.black),
+ items: cubit.documentTypes
+ .map(
+ (documentType) =>
+ DropdownMenuItem(value: documentType, child: Text(documentType)),
+ )
+ .toList(),
+ onChanged: (value) {
+ if (value != null) {
+ cubit.onDocumentTypeSelected(value);
+ }
+ },
+ ),
+ ),
+ ),
+ const SizedBox(height: 12),
+ ComwellTextField(
key: const Key("document_number"),
- fieldName: "document_number".tr(),
+ fieldName: context.strings.document_number,
textInputType: TextInputType.number,
initialValue: "",
readOnly: false,
errorMessage: documentNumberErrorMessage,
- controller: cubit.documentNumberTextController),
+ controller: cubit.documentNumberTextController,
+ ),
+ ],
],
- ],
- );
- });
+ );
+ },
+ );
}
}
diff --git a/comwell_key_app/lib/pregistration/pages/prereg_confirmation_page.dart b/comwell_key_app/lib/pregistration/pages/prereg_confirmation_page.dart
index 2de32f1e..21ad8d0d 100644
--- a/comwell_key_app/lib/pregistration/pages/prereg_confirmation_page.dart
+++ b/comwell_key_app/lib/pregistration/pages/prereg_confirmation_page.dart
@@ -1,7 +1,7 @@
import 'package:comwell_key_app/pregistration/cubit/preregistration_cubit.dart';
import 'package:comwell_key_app/pregistration/components/information_card.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:payment_plugin/presentation/app/bloc/payment_cards_cubit.dart';
@@ -13,110 +13,111 @@ class PreregConfirmationPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<PaymentCardsCubit, PaymentCardsState>(
- builder: (context, state) {
- final cubit = context.read<PreregistrationCubit>();
+ builder: (context, state) {
+ final cubit = context.read<PreregistrationCubit>();
- final state = cubit.state;
- final user = state.user!;
- final theme = Theme.of(context);
- final singularExtra = cubit.numOfExtras == 1 &&
- cubit.state.selectedRoomUpgrade.isEmpty ||
- cubit.numOfExtras == 0 && cubit.state.selectedRoomUpgrade.isNotEmpty;
- String extrasTitleText;
-
+ final state = cubit.state;
+ final user = state.user!;
+ final theme = Theme.of(context);
+ final singularExtra =
+ cubit.numOfExtras == 1 && cubit.state.selectedRoomUpgrade.isEmpty ||
+ cubit.numOfExtras == 0 && cubit.state.selectedRoomUpgrade.isNotEmpty;
+ String extrasTitleText;
- if (singularExtra) {
- extrasTitleText =
- "preregistration_confirmation_extras_card_title_singular".tr();
- } else {
- extrasTitleText =
- "preregistration_confirmation_extras_card_title_plural"
- .tr(args: [cubit.numOfExtras.toString()]);
- }
+ if (singularExtra) {
+ extrasTitleText = context.strings.preregistration_confirmation_extras_card_title_singular;
+ } else {
+ extrasTitleText = context.strings.preregistration_confirmation_extras_card_title_plural(
+ cubit.numOfExtras.toString(),
+ );
+ }
- return SafeArea(
- child: ListView(
- padding: const EdgeInsets.symmetric(horizontal: 12.0),
- children: [
- const SizedBox(height: 16),
- Text("preregistration_confirmation_title".tr(),
- style: Theme.of(context).textTheme.headlineLarge),
- const SizedBox(height: 16),
- InformationCard(
- title: "preregistration_confirmation_profile_card_title".tr(),
- titleStyle: theme.textTheme.titleMedium?.copyWith(
- fontWeight: FontWeight.w500,
- color: colorHeadlineText,
+ return SafeArea(
+ child: ListView(
+ padding: const EdgeInsets.symmetric(horizontal: 12.0),
+ children: [
+ const SizedBox(height: 16),
+ Text(
+ context.strings.preregistration_confirmation_title,
+ style: Theme.of(context).textTheme.headlineLarge,
),
- onEditClick: cubit.onEditProfileClicked,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- "${state.user!.firstName} ${state.user!.lastName}",
- style: Theme.of(context).textTheme.bodyMedium,
- ),
- Text(
- user.email,
- style: Theme.of(context).textTheme.bodyMedium,
- ),
- Text(
- state.user!.phoneNumber,
- style: Theme.of(context).textTheme.bodyMedium,
- ),
- ],
- ),
- ),
- const SizedBox(height: 12),
- InformationCard(
- title: "preregistration_confirmation_address_card_title".tr(),
- titleStyle: theme.textTheme.titleMedium?.copyWith(
- fontWeight: FontWeight.w500,
- color: colorHeadlineText,
- ),
- onEditClick: cubit.onEditAddressClicked,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- cubit.state.user!.address.street,
- style: theme.textTheme.bodyMedium,
- ),
- Text(
- "${state.user!.address.zipCode}, ${state.user!.address.city}${state.user!.address.country.isNotEmpty ? ', ${state.user!.address.country}' : ''}",
- style: theme.textTheme.bodyMedium,
- ),
- ],
+ const SizedBox(height: 16),
+ InformationCard(
+ title: context.strings.preregistration_confirmation_profile_card_title,
+ titleStyle: theme.textTheme.titleMedium?.copyWith(
+ fontWeight: FontWeight.w500,
+ color: colorHeadlineText,
+ ),
+ onEditClick: cubit.onEditProfileClicked,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ "${state.user!.firstName} ${state.user!.lastName}",
+ style: Theme.of(context).textTheme.bodyMedium,
+ ),
+ Text(
+ user.email,
+ style: Theme.of(context).textTheme.bodyMedium,
+ ),
+ Text(
+ state.user!.phoneNumber,
+ style: Theme.of(context).textTheme.bodyMedium,
+ ),
+ ],
+ ),
),
- ),
- const SizedBox(height: 12),
- InformationCard(
- title: extrasTitleText,
- titleStyle: theme.textTheme.titleMedium?.copyWith(
- fontWeight: FontWeight.w500,
- color: colorHeadlineText,
+ const SizedBox(height: 12),
+ InformationCard(
+ title: context.strings.preregistration_confirmation_address_card_title,
+ titleStyle: theme.textTheme.titleMedium?.copyWith(
+ fontWeight: FontWeight.w500,
+ color: colorHeadlineText,
+ ),
+ onEditClick: cubit.onEditAddressClicked,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ cubit.state.user!.address.street,
+ style: theme.textTheme.bodyMedium,
+ ),
+ Text(
+ "${state.user!.address.zipCode}, ${state.user!.address.city}${state.user!.address.country.isNotEmpty ? ', ${state.user!.address.country}' : ''}",
+ style: theme.textTheme.bodyMedium,
+ ),
+ ],
+ ),
),
- onEditClick: cubit.onEditExtrasClicked,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- "total_charge_value"
- .tr(args: [cubit.extrasTotalPrice.toString()]),
- style: theme.textTheme.bodyMedium),
- Text(
- "preregistration_confirmation_extras_card_subtitle".tr(),
- style: theme.textTheme.bodySmall?.copyWith(
- color: colorHeadlineText,
+ const SizedBox(height: 12),
+ InformationCard(
+ title: extrasTitleText,
+ titleStyle: theme.textTheme.titleMedium?.copyWith(
+ fontWeight: FontWeight.w500,
+ color: colorHeadlineText,
+ ),
+ onEditClick: cubit.onEditExtrasClicked,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ context.strings.total_charge_value(cubit.extrasTotalPrice.toString()),
+ style: theme.textTheme.bodyMedium,
+ ),
+ Text(
+ context.strings.preregistration_confirmation_extras_card_subtitle,
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: colorHeadlineText,
+ ),
),
- )
- ],
+ ],
+ ),
),
- ),
- const SizedBox(height: 40),
- ],
- ),
- );
- });
+ const SizedBox(height: 40),
+ ],
+ ),
+ );
+ },
+ );
}
}
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 db5d5fdd..fcf30da7 100644
--- a/comwell_key_app/lib/pregistration/pages/prereg_profile_page.dart
+++ b/comwell_key_app/lib/pregistration/pages/prereg_profile_page.dart
@@ -2,8 +2,8 @@ import 'package:comwell_key_app/common/components/comwell_text_field.dart';
import 'package:comwell_key_app/profile_settings/components/intl_phone_field.dart';
import 'package:comwell_key_app/pregistration/cubit/preregistration_cubit.dart';
import 'package:comwell_key_app/pregistration/cubit/preregistration_state.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:country_code_picker/country_code_picker.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../common/components/shimmer_loader/prereg_profile_shimmer_loader.dart';
@@ -15,101 +15,100 @@ class PreregProfilePage extends StatelessWidget {
Widget build(BuildContext context) {
final theme = Theme.of(context);
return BlocBuilder<PreregistrationCubit, PreregistrationState>(
- builder: (context, state) {
- if (state.isLoading) {
- return const Center(child: PreregProfileShimmerLoader());
- }
-
- if (state.user != null) {
- return _buildProfilePage(theme, state, context);
- }
+ builder: (context, state) {
+ if (state.isLoading) {
+ return const Center(child: PreregProfileShimmerLoader());
+ }
- return Center(
- child: Text(
- "generic_error".tr(),
- style: theme.textTheme.headlineLarge,
- ),
- );
- });
+ if (state.user != null) {
+ return _buildProfilePage(theme, state, context);
+ }
+
+ return Center(
+ child: Text(
+ context.strings.generic_error,
+ style: theme.textTheme.headlineLarge,
+ ),
+ );
+ },
+ );
}
- Widget _buildProfilePage(
- ThemeData theme, PreregistrationState state, BuildContext context) {
+ Widget _buildProfilePage(ThemeData theme, PreregistrationState state, BuildContext context) {
final cubit = context.read<PreregistrationCubit>();
- final firstNameErrorMessage =
- !cubit.isFirstNameValid && state.missingInformation
- ? "generic_information_required".tr()
- : null;
- final lastNameErrorMessage =
- !cubit.isLastNameValid && state.missingInformation
- ? "generic_information_required".tr()
- : null;
- final phoneNumberErrorMessage =
- !cubit.isPhoneNumberValid && state.missingInformation
- ? "generic_information_required".tr()
- : null;
+ final firstNameErrorMessage = !cubit.isFirstNameValid && state.missingInformation
+ ? context.strings.generic_information_required
+ : null;
+ final lastNameErrorMessage = !cubit.isLastNameValid && state.missingInformation
+ ? context.strings.generic_information_required
+ : null;
+ final phoneNumberErrorMessage = !cubit.isPhoneNumberValid && state.missingInformation
+ ? context.strings.generic_information_required
+ : null;
- return ListView(children: [
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 12.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 36),
- ComwellTextField(
- key: const Key("firstName"),
- fieldName: "profile_settings_firstname".tr(),
- initialValue: state.user!.firstName,
- readOnly: false,
- controller: cubit.firstNameTextController,
- errorMessage: firstNameErrorMessage,
- onChanged: (value) {
- cubit.firstNameTextController.text = value;
- },
- ),
- const SizedBox(height: 8),
- ComwellTextField(
- key: const Key("lastName"),
- fieldName: "profile_settings_lastname".tr(),
- initialValue: state.user!.lastName,
- readOnly: false,
- controller: cubit.lastNameTextController,
- errorMessage: lastNameErrorMessage,
- onChanged: (value) {
- cubit.lastNameTextController.text = value;
- },
- ),
- const SizedBox(height: 8),
- ComwellTextField(
- key: const Key("email"),
- fieldName: "profile_settings_email".tr(),
- initialValue: state.user!.email,
- readOnly: true,
- controller: cubit.emailTextController,
- ),
- const SizedBox(height: 8),
- IntlPhoneField(
- key: const Key("phone"),
- title: "profile_settings_phone".tr(),
- phoneNumber: cubit.phoneNumber!,
- countryCode: cubit.countryCode!,
- controller: cubit.phoneNumberTextController,
- readOnly: false,
- errorMessage: phoneNumberErrorMessage,
- onCountryCodeSelected: (CountryCode countryCode) {
- cubit.onCountryCodeSelected(countryCode);
- },
- onPhoneNumberChanged: (String phoneNumber) {
- cubit.onPhoneNumberChanged(phoneNumber);
- },
- onSubmitted: (_) {
- // NO OP
- },
- ),
- ],
+ return ListView(
+ children: [
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 12.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 36),
+ ComwellTextField(
+ key: const Key("firstName"),
+ fieldName: context.strings.profile_settings_firstname,
+ initialValue: state.user!.firstName,
+ readOnly: false,
+ controller: cubit.firstNameTextController,
+ errorMessage: firstNameErrorMessage,
+ onChanged: (value) {
+ cubit.firstNameTextController.text = value;
+ },
+ ),
+ const SizedBox(height: 8),
+ ComwellTextField(
+ key: const Key("lastName"),
+ fieldName: context.strings.profile_settings_lastname,
+ initialValue: state.user!.lastName,
+ readOnly: false,
+ controller: cubit.lastNameTextController,
+ errorMessage: lastNameErrorMessage,
+ onChanged: (value) {
+ cubit.lastNameTextController.text = value;
+ },
+ ),
+ const SizedBox(height: 8),
+ ComwellTextField(
+ key: const Key("email"),
+ fieldName: context.strings.profile_settings_email,
+ initialValue: state.user!.email,
+ readOnly: true,
+ controller: cubit.emailTextController,
+ ),
+ const SizedBox(height: 8),
+ IntlPhoneField(
+ key: const Key("phone"),
+ title: context.strings.profile_settings_phone,
+ phoneNumber: cubit.phoneNumber!,
+ countryCode: cubit.countryCode!,
+ controller: cubit.phoneNumberTextController,
+ readOnly: false,
+ errorMessage: phoneNumberErrorMessage,
+ onCountryCodeSelected: (CountryCode countryCode) {
+ cubit.onCountryCodeSelected(countryCode);
+ },
+ onPhoneNumberChanged: (String phoneNumber) {
+ cubit.onPhoneNumberChanged(phoneNumber);
+ },
+ onSubmitted: (_) {
+ // NO OP
+ },
+ ),
+ ],
+ ),
),
- ),
- ]);
+ ],
+ );
}
}
diff --git a/comwell_key_app/lib/pregistration/pages/prereg_up_sales_catalog_page.dart b/comwell_key_app/lib/pregistration/pages/prereg_up_sales_catalog_page.dart
index eac10787..4e43da47 100644
--- a/comwell_key_app/lib/pregistration/pages/prereg_up_sales_catalog_page.dart
+++ b/comwell_key_app/lib/pregistration/pages/prereg_up_sales_catalog_page.dart
@@ -6,7 +6,7 @@ import 'package:comwell_key_app/up_sales/components/catalog/room_upgrade_catalog
import 'package:comwell_key_app/up_sales/components/catalog/service_catalog.dart';
import 'package:comwell_key_app/pregistration/cubit/preregistration_cubit.dart';
import 'package:comwell_key_app/pregistration/cubit/preregistration_state.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -50,20 +50,20 @@ class PreregUpSalesCatalogPage extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text('up_sales_catalog_title'.tr(),
+ child: Text(context.strings.up_sales_catalog_title,
style: theme.textTheme.headlineLarge),
),
const SizedBox(height: 40),
if (serviceUpgrades.isEmpty && addonUpgrades.isEmpty && cubit.state.availableRoomUpgrades.isEmpty) ...[
ComwellErrorWidget(
- title: 'up_sales_catalog_no_up_sales_title'.tr(),
- subtitle: 'up_sales_catalog_no_up_sales_subtitle'.tr(),
+ title: context.strings.up_sales_catalog_no_up_sales_title,
+ subtitle: context.strings.up_sales_catalog_no_up_sales_subtitle,
border: true)
],
if (serviceUpgrades.isNotEmpty) ...[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text('services'.tr(),
+ child: Text(context.strings.services,
style: theme.textTheme.headlineMedium),
),
const SizedBox(height: 8),
@@ -82,7 +82,7 @@ class PreregUpSalesCatalogPage extends StatelessWidget {
const SizedBox(height: 24),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text('room_upgrades'.tr(),
+ child: Text(context.strings.room_upgrades,
style: theme.textTheme.headlineMedium),
),
const SizedBox(height: 8),
@@ -102,7 +102,7 @@ class PreregUpSalesCatalogPage extends StatelessWidget {
const SizedBox(height: 24),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text('other_up_sales'.tr(),
+ child: Text(context.strings.other_up_sales,
style: theme.textTheme.headlineMedium),
),
const SizedBox(height: 8),
diff --git a/comwell_key_app/lib/pregistration/preregistration_flow.dart b/comwell_key_app/lib/pregistration/preregistration_flow.dart
index 1fb04148..16fdad9c 100644
--- a/comwell_key_app/lib/pregistration/preregistration_flow.dart
+++ b/comwell_key_app/lib/pregistration/preregistration_flow.dart
@@ -24,24 +24,21 @@ class _PreregistrationFlowState extends State<PreregistrationFlow> {
@override
Widget build(BuildContext context) {
return BlocProvider<PaymentCardsCubit>(
- create: (context) => PaymentCardsCubit(
- adyenRepository: locator<AdyenRepository>(),
- onPaymentMethodSelected: (paymentMethod) {
- context
- .read<PreregistrationCubit>()
- .onPaymentMethodSelected(paymentMethod);
- },
- onPaymentMethodValidationError: () {
- context
- .read<PreregistrationCubit>()
- .onPaymentMethodValidationError();
- },
- initialSelectedPaymentMethod: context
- .read<PreregistrationCubit>()
- .state
- .selectedPaymentMethod),
- child: BlocBuilder<PaymentCardsCubit, PaymentCardsState>(
- builder: (context, state) {
+ create: (context) => PaymentCardsCubit(
+ adyenRepository: locator<AdyenRepository>(),
+ onPaymentMethodSelected: (paymentMethod) {
+ context.read<PreregistrationCubit>().onPaymentMethodSelected(paymentMethod);
+ },
+ onPaymentMethodValidationError: () {
+ context.read<PreregistrationCubit>().onPaymentMethodValidationError();
+ },
+ initialSelectedPaymentMethod: context
+ .read<PreregistrationCubit>()
+ .state
+ .selectedPaymentMethod,
+ ),
+ child: BlocBuilder<PaymentCardsCubit, PaymentCardsState>(
+ builder: (context, state) {
return BlocBuilder<PreregistrationCubit, PreregistrationState>(
builder: (context, state) {
final cubit = context.read<PreregistrationCubit>();
@@ -53,8 +50,8 @@ class _PreregistrationFlowState extends State<PreregistrationFlow> {
onBackPressed: () {
if (cubit.currentPage == PreregistrationPage.profile) {
context.pop();
- } else {
- cubit.onBackClicked();
+ } else {
+ cubit.onBackClicked();
}
},
),
@@ -67,51 +64,49 @@ class _PreregistrationFlowState extends State<PreregistrationFlow> {
key: const PageStorageKey("prereg_flow"),
physics: const NeverScrollableScrollPhysics(),
controller: cubit.pageController,
- children: PreregistrationPage.getPages(ValueKey(state))
- .toList(),
+ children: PreregistrationPage.getPages(ValueKey(state)).toList(),
);
},
),
- bottomNavigationBar: Builder(builder: (context) {
- if (state.isLoading) return const SizedBox();
- return Column(
- // BOTTOM NAVIGATION
- mainAxisSize: MainAxisSize.min,
- children: [
- const Divider(
- color: Colors.black12,
- height: 0,
- ),
- Row(
- children: [
- Expanded(
- child: Padding(
- padding: const EdgeInsets.fromLTRB(
- 16.0, 16.0, 16.0, 40.0),
- child: ElevatedButton(
- onPressed: () {
-
+ bottomNavigationBar: Builder(
+ builder: (context) {
+ if (state.isLoading) return const SizedBox();
+ return Column(
+ // BOTTOM NAVIGATION
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Divider(
+ color: Colors.black12,
+ height: 0,
+ ),
+ Row(
+ children: [
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 40.0),
+ child: ElevatedButton(
+ onPressed: () {
cubit.onContinueClicked(context);
-
- },
- style: ElevatedButton.styleFrom(
- foregroundColor: colorBackground),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 16.0),
- child: Text(cubit.buttonText),
+ },
+ style: ElevatedButton.styleFrom(foregroundColor: colorBackground),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 16.0),
+ child: Text(cubit.buttonText(context)),
+ ),
),
),
),
- ),
- ],
- ),
- ],
- );
- }),
+ ],
+ ),
+ ],
+ );
+ },
+ ),
);
},
);
- }));
+ },
+ ),
+ );
}
}
diff --git a/comwell_key_app/lib/presentation/screens/past_cancelled_booking_details/past_cancelled_booking_detail_page.dart b/comwell_key_app/lib/presentation/screens/past_cancelled_booking_details/past_cancelled_booking_detail_page.dart
index d8e23834..93873c52 100644
--- a/comwell_key_app/lib/presentation/screens/past_cancelled_booking_details/past_cancelled_booking_detail_page.dart
+++ b/comwell_key_app/lib/presentation/screens/past_cancelled_booking_details/past_cancelled_booking_detail_page.dart
@@ -3,9 +3,10 @@ import 'package:comwell_key_app/overview/components/bill_download_modal.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/services/mappers/booking_mapper.dart';
import 'package:comwell_key_app/themes/comwell_colors.dart' show colorError;
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
+import 'package:intl/intl.dart';
import '../../../themes/light_theme.dart';
@@ -33,13 +34,13 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
children: [
const SizedBox(height: 20),
Text(
- 'my_booking'.tr(),
+ context.strings.my_booking,
style: theme.textTheme.headlineLarge,
),
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 0),
title: Text(
- 'booking_reference'.tr(),
+ context.strings.booking_reference,
style: theme.textTheme.bodySmall?.copyWith(color: colorHeadlineText),
),
subtitle: Text(booking.confirmationNumber, style: theme.textTheme.headlineSmall),
@@ -55,7 +56,7 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
children: [
Text(
textAlign: TextAlign.start,
- 'check_in'.tr(),
+ context.strings.check_in,
style: theme.textTheme.bodySmall?.copyWith(color: colorHeadlineText),
),
Text(
@@ -71,7 +72,7 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- 'check_out'.tr(),
+ context.strings.check_out,
style: theme.textTheme.bodySmall?.copyWith(color: colorHeadlineText),
),
Text(
@@ -87,7 +88,7 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 0),
title: Text(
- 'booking_details'.tr(),
+ context.strings.booking_details,
style: theme.textTheme.bodySmall?.copyWith(color: colorHeadlineText),
),
subtitle: Text(
@@ -99,11 +100,11 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 0),
title: Text(
- 'number_of_guests'.tr(),
+ context.strings.number_of_guests,
style: theme.textTheme.bodySmall?.copyWith(color: colorHeadlineText),
),
subtitle: Text(
- "${booking.adults} ${booking.adults > 1 ? 'adults'.tr() : 'adult'.tr()}${booking.children >= 1 ? ', ${booking.children} ${booking.children > 1 ? 'children'.tr() : 'child'.tr()}' : ''}",
+ "${booking.adults} ${booking.adults > 1 ? context.strings.adults : context.strings.adult}${booking.children >= 1 ? ', ${booking.children} ${booking.children > 1 ? context.strings.children : context.strings.child}' : ''}",
style: theme.textTheme.headlineSmall,
),
),
@@ -111,7 +112,7 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 0),
title: Text(
- 'booker'.tr(),
+ context.strings.booker,
style: theme.textTheme.bodySmall?.copyWith(color: colorHeadlineText),
),
subtitle: Text(
@@ -123,7 +124,7 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 0),
title: Text(
- 'booking_date'.tr(),
+ context.strings.booking_date,
style: theme.textTheme.bodySmall?.copyWith(color: colorHeadlineText),
),
subtitle: Text(
@@ -137,10 +138,10 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text('payment'.tr(), style: theme.textTheme.headlineLarge),
+ Text(context.strings.payment, style: theme.textTheme.headlineLarge),
const SizedBox(height: 16),
Text(
- 'payment_method'.tr(),
+ context.strings.payment_method,
style: theme.textTheme.bodySmall?.copyWith(
color: colorHeadlineText,
),
@@ -152,7 +153,7 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
const SizedBox(width: 8),
isCancelled
? Text(
- 'overview_tabbar_cancelled'.tr(),
+ context.strings.overview_tabbar_cancelled,
style: theme.textTheme.bodyMedium?.copyWith(color: colorError),
)
: SvgPicture.asset('assets/images/master.svg', width: 30, height: 30),
@@ -162,7 +163,7 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
const Divider(color: colorDivider),
const SizedBox(height: 8),
Text(
- 'bill'.tr(),
+ context.strings.bill,
style: theme.textTheme.bodySmall?.copyWith(
color: colorHeadlineText,
),
@@ -170,7 +171,7 @@ class PastCancelledBookingDetailPage extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text('get_bill'.tr(), style: theme.textTheme.headlineSmall),
+ Text(context.strings.get_bill, style: theme.textTheme.headlineSmall),
InkWell(
onTap: () {
showModalBottomSheet<void>(
diff --git a/comwell_key_app/lib/presentation/screens/share_room/share_room_page.dart b/comwell_key_app/lib/presentation/screens/share_room/share_room_page.dart
index d4d5ae68..2358f2f1 100644
--- a/comwell_key_app/lib/presentation/screens/share_room/share_room_page.dart
+++ b/comwell_key_app/lib/presentation/screens/share_room/share_room_page.dart
@@ -7,6 +7,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
class ShareRoomPage extends StatelessWidget {
final Booking booking;
+
const ShareRoomPage({super.key, required this.booking});
@override
@@ -14,10 +15,14 @@ class ShareRoomPage extends StatelessWidget {
return BlocBuilder<ChooseShareRoomCubit, ChooseShareRoomState>(
builder: (context, state) {
final cubit = context.read<ChooseShareRoomCubit>();
- return ShareRoomBasePageTemplate(booking: booking, onClicked: () {
- cubit.shareRoom(booking);
- }, isShared: false);
- }
+ return ShareRoomBasePageTemplate(
+ booking: booking,
+ onClicked: () {
+ cubit.shareRoom(context, booking);
+ },
+ isShared: false,
+ );
+ },
);
}
}
diff --git a/comwell_key_app/lib/profile/components/card_content_widget.dart b/comwell_key_app/lib/profile/components/card_content_widget.dart
index 252c2bf3..13f58b72 100644
--- a/comwell_key_app/lib/profile/components/card_content_widget.dart
+++ b/comwell_key_app/lib/profile/components/card_content_widget.dart
@@ -1,10 +1,11 @@
import 'package:comwell_key_app/profile/cubit/profile_cubit.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class CardContentWidget extends StatelessWidget {
final ProfileCubit cubit;
final bool isActive;
+
const CardContentWidget({super.key, required this.cubit, required this.isActive});
@override
@@ -27,7 +28,7 @@ class CardContentWidget extends StatelessWidget {
borderRadius: BorderRadius.circular(32),
),
child: Text(
- isActive ? 'Comwell Club' : 'comwell_club_inactive'.tr(),
+ isActive ? 'Comwell Club' : context.strings.comwell_club_inactive,
style: theme.textTheme.bodySmall!.copyWith(
color: Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.w600,
@@ -68,7 +69,7 @@ class CardContentWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
- 'points'.tr(),
+ context.strings.points,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
@@ -76,7 +77,7 @@ class CardContentWidget extends StatelessWidget {
),
),
Text(
- '${user.points} ${'points'.tr()}',
+ '${user.points} ${context.strings.points}',
style: const TextStyle(
color: Colors.white,
fontSize: 16,
diff --git a/comwell_key_app/lib/profile/components/comwell_club_container.dart b/comwell_key_app/lib/profile/components/comwell_club_container.dart
index cc04bc00..6fc6c6e3 100644
--- a/comwell_key_app/lib/profile/components/comwell_club_container.dart
+++ b/comwell_key_app/lib/profile/components/comwell_club_container.dart
@@ -2,7 +2,7 @@ import 'package:comwell_key_app/profile/components/comwell_club_signup_bottom_sh
import 'package:comwell_key_app/profile/cubit/profile_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:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -44,7 +44,7 @@ class ComwellClubContainer extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text("become_cc_member_title".tr(),
+ Text(context.strings.become_cc_member_title,
textAlign: TextAlign.start,
style: const TextStyle(
color: colorTertiary,
@@ -53,7 +53,7 @@ class ComwellClubContainer extends StatelessWidget {
SizedBox(
width: 250,
child: Text(
- "become_cc_member_subtitle".tr(),
+ context.strings.become_cc_member_subtitle,
textAlign: TextAlign.start,
maxLines: 4,
style: const TextStyle(
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 ed44be29..34c633b8 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
@@ -6,7 +6,7 @@ import 'package:comwell_key_app/profile_settings/components/comwell_text_field.d
import 'package:comwell_key_app/profile_settings/model/address.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:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -73,7 +73,7 @@ class _ComwellClubSignupBottomSheetState
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text('comwell_club_dialog_title'.tr(),
+ Text(context.strings.comwell_club_dialog_title,
style: theme.textTheme.headlineLarge),
RoundIconButton(
icon: 'assets/icons/close-icon.svg',
@@ -91,7 +91,7 @@ class _ComwellClubSignupBottomSheetState
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ComwellTextField(
- fieldName: "postal_code".tr(),
+ fieldName: context.strings.postal_code,
initialValue: widget.user.address.zipCode,
readOnly: false,
controller: _postNumberController,
@@ -114,28 +114,28 @@ class _ComwellClubSignupBottomSheetState
alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric(horizontal: 16),
hint: Text(
- "gender".tr(),
+ context.strings.gender,
style: theme.textTheme.headlineSmall,
),
items: [
DropdownMenuItem(
value: "Male",
child: Text(
- "male".tr(),
+ context.strings.male,
style: theme.textTheme.headlineSmall,
),
),
DropdownMenuItem(
value: "Female",
child: Text(
- "female".tr(),
+ context.strings.female,
style: theme.textTheme.headlineSmall,
),
),
DropdownMenuItem(
value: "Other",
child: Text(
- "not_specified".tr(),
+ context.strings.not_specified,
style: theme.textTheme.headlineSmall,
),
),
@@ -174,7 +174,7 @@ class _ComwellClubSignupBottomSheetState
text: TextSpan(
children: <TextSpan>[
TextSpan(
- text: "tos_accept".tr(),
+ text: context.strings.tos_accept,
style: TextStyle(
fontSize:
theme.textTheme.bodySmall!.fontSize,
@@ -183,7 +183,7 @@ class _ComwellClubSignupBottomSheetState
),
),
TextSpan(
- text: "tos_accept_link".tr(),
+ text: context.strings.tos_accept_link,
recognizer: TapGestureRecognizer()
..onTap = () {
launchUrl(
@@ -224,7 +224,7 @@ class _ComwellClubSignupBottomSheetState
text: TextSpan(
children: <TextSpan>[
TextSpan(
- text: "newsletter_accept".tr(),
+ text: context.strings.newsletter_accept,
style: TextStyle(
fontSize: theme.textTheme.bodySmall!.fontSize,
color: theme.textTheme.bodySmall!.color,
@@ -232,7 +232,7 @@ class _ComwellClubSignupBottomSheetState
),
),
TextSpan(
- text: "read_more".tr(),
+ text: context.strings.read_more,
recognizer: TapGestureRecognizer()
..onTap = () {
launchUrl(
@@ -284,7 +284,7 @@ class _ComwellClubSignupBottomSheetState
}
},
child: Text(
- 'save'.tr(),
+ context.strings.save,
style: theme.textTheme.headlineSmall?.copyWith(
color: cubit.state.isToSAccepted
? Colors.white
diff --git a/comwell_key_app/lib/profile/components/error_page_widget.dart b/comwell_key_app/lib/profile/components/error_page_widget.dart
index a3c4eabf..2a68a3f7 100644
--- a/comwell_key_app/lib/profile/components/error_page_widget.dart
+++ b/comwell_key_app/lib/profile/components/error_page_widget.dart
@@ -4,7 +4,7 @@ import 'package:comwell_key_app/common/components/round_icon_button.dart';
import 'package:comwell_key_app/profile/components/logout_dialog_widget.dart';
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:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -51,8 +51,8 @@ class ErrorPageWidget extends StatelessWidget {
child: Column(
children: [
ComwellErrorWidget(
- title: 'profile_error_title'.tr(),
- subtitle: 'profile_error_subtitle'.tr(),
+ title: context.strings.profile_error_title,
+ subtitle: context.strings.profile_error_subtitle,
border: true),
const SizedBox(height: 30),
Center(
@@ -69,7 +69,7 @@ class ErrorPageWidget extends StatelessWidget {
);
},
child: Text(
- 'logout_profile_menu'.tr(),
+ context.strings.logout_profile_menu,
style: const TextStyle(color: colorGrey),
),
),
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 ce370e15..3491fdd3 100644
--- a/comwell_key_app/lib/profile/components/logout_dialog_widget.dart
+++ b/comwell_key_app/lib/profile/components/logout_dialog_widget.dart
@@ -1,6 +1,6 @@
import 'package:comwell_key_app/profile/cubit/profile_cubit.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -22,7 +22,7 @@ class LogoutDialogWidget extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- "logout_dialog_title".tr(),
+ context.strings.logout_dialog_title,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
@@ -43,7 +43,7 @@ class LogoutDialogWidget extends StatelessWidget {
context.go(AppRoutes.login);
},
child: Text(
- "logout_profile_menu".tr(),
+ context.strings.logout_profile_menu,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
@@ -64,7 +64,7 @@ class LogoutDialogWidget extends StatelessWidget {
Navigator.of(context).pop();
},
child: Text(
- "cancel".tr(),
+ context.strings.cancel,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
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 312a6110..e2223c33 100644
--- a/comwell_key_app/lib/profile/components/profile_page_widget.dart
+++ b/comwell_key_app/lib/profile/components/profile_page_widget.dart
@@ -1,6 +1,5 @@
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_container.dart';
import 'package:comwell_key_app/profile/components/logout_dialog_widget.dart';
@@ -8,7 +7,7 @@ import 'package:comwell_key_app/profile/components/profile_settings_item.dart';
import 'package:comwell_key_app/profile/cubit/profile_cubit.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
@@ -70,7 +69,7 @@ class ProfilePageWidget extends StatelessWidget {
profileSettingsItem(
context,
icon: Image.asset('assets/icons/user-circle.png'),
- text: 'profile_settings_profile_menu'.tr(),
+ text: context.strings.profile_settings_profile_menu,
trailingIcon: Icons.chevron_right,
onTap: () async {
await context.push(AppRoutes.profileSettings);
@@ -84,7 +83,7 @@ class ProfilePageWidget extends StatelessWidget {
profileSettingsItem(
context,
icon: Image.asset('assets/icons/card.png'),
- text: 'payment_card_profile_menu'.tr(),
+ text: context.strings.payment_card_profile_menu,
trailingIcon: Icons.chevron_right,
onTap: () {
context.push("${AppRoutes.paymentCards}?needsScaffold=true");
@@ -98,7 +97,7 @@ class ProfilePageWidget extends StatelessWidget {
context,
icon: Image.asset('assets/icons/bell.png'),
trailingIcon: Icons.chevron_right,
- text: 'notifications_profile_menu'.tr(),
+ text: context.strings.notifications_profile_menu,
onTap: () {
context.push(AppRoutes.notifications);
},
@@ -138,7 +137,7 @@ class ProfilePageWidget extends StatelessWidget {
);
},
child: Text(
- 'logout_profile_menu'.tr(),
+ context.strings.logout_profile_menu,
style: TextStyle(color: Colors.grey[600]),
),
),
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 f0d99f43..3216b64a 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
@@ -3,8 +3,8 @@ import 'package:comwell_key_app/profile_settings/components/comwell_text_field.d
import 'package:comwell_key_app/profile_settings/model/address.dart';
import 'package:comwell_key_app/profile_settings/model/user.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:country_code_picker/country_code_picker.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -76,7 +76,7 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text('profile_settings_address'.tr(),
+ Text(context.strings.profile_settings_address,
style: theme.textTheme.headlineLarge),
RoundIconButton(
icon: 'assets/icons/close-icon.svg',
@@ -94,7 +94,7 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ComwellTextField(
- fieldName: "profile_settings_address".tr(),
+ fieldName: context.strings.profile_settings_address,
initialValue: widget.user?.address.street ?? '',
readOnly: false,
controller: _addressController)),
@@ -102,7 +102,7 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ComwellTextField(
- fieldName: "zipCode".tr(),
+ fieldName: context.strings.zipCode,
initialValue: widget.user?.address.zipCode ?? '',
readOnly: false,
controller: _zipCodeController)),
@@ -110,7 +110,7 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ComwellTextField(
- fieldName: "city".tr(),
+ fieldName: context.strings.city,
initialValue: widget.user?.address.city ?? '',
readOnly: false,
controller: _cityController)),
@@ -158,7 +158,7 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
context.pop(address);
},
child: Text(
- 'save'.tr(),
+ context.strings.save,
style: theme.textTheme.headlineSmall?.copyWith(
color: Colors.white,
),
diff --git a/comwell_key_app/lib/profile_settings/components/date_time_picker.dart b/comwell_key_app/lib/profile_settings/components/date_time_picker.dart
index 4a29a1ac..86262461 100644
--- a/comwell_key_app/lib/profile_settings/components/date_time_picker.dart
+++ b/comwell_key_app/lib/profile_settings/components/date_time_picker.dart
@@ -1,10 +1,11 @@
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:comwell_key_app/profile_settings/cubit/profile_settings_cubit.dart';
import 'package:comwell_key_app/common/components/generic_dialog.dart';
+import 'package:intl/intl.dart';
class DateTimePicker extends StatefulWidget {
final String title;
@@ -32,9 +33,9 @@ class _DatePickerState extends State<DateTimePicker> {
await showDialog<void>(
context: context,
builder: (context) => GenericDialog(
- title: 'invalid_birthday'.tr(),
- content: 'invalid_birthday_description'.tr(),
- confirmButtonText: 'generic_ok'.tr(),
+ title: context.strings.invalid_birthday,
+ content: context.strings.invalid_birthday_description,
+ confirmButtonText: context.strings.generic_ok,
confirmButtonTextColor: Colors.white,
cancelButtonText: '',
onConfirm: () {
@@ -87,7 +88,7 @@ class _DatePickerState extends State<DateTimePicker> {
initialDate: initial,
firstDate: DateTime(0),
lastDate: maxDate,
- errorInvalidText: "profile_settings_invalid_date".tr(),
+ errorInvalidText: context.strings.profile_settings_invalid_date,
).then((DateTime? selected) {
if (selected != null && selected != _selectedDate) {
setState(() => _selectedDate = selected);
diff --git a/comwell_key_app/lib/profile_settings/components/delete_profile_dialog_widget.dart b/comwell_key_app/lib/profile_settings/components/delete_profile_dialog_widget.dart
index 2192e81d..3a6c65ef 100644
--- a/comwell_key_app/lib/profile_settings/components/delete_profile_dialog_widget.dart
+++ b/comwell_key_app/lib/profile_settings/components/delete_profile_dialog_widget.dart
@@ -1,6 +1,6 @@
import 'package:comwell_key_app/profile_settings/cubit/profile_settings_cubit.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -21,7 +21,7 @@ class DeleteProfileDialogWidget extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- "delete_profile_title".tr(),
+ context.strings.delete_profile_title,
textAlign: TextAlign.center,
style: const TextStyle(
color: colorTertiary,
@@ -31,7 +31,7 @@ class DeleteProfileDialogWidget extends StatelessWidget {
),
const SizedBox(height: 16),
Text(
- "delete_profile_description".tr(),
+ context.strings.delete_profile_description,
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.grey,
@@ -51,7 +51,7 @@ class DeleteProfileDialogWidget extends StatelessWidget {
context.read<ProfileSettingsCubit>().deleteProfile();
},
child: Text(
- "delete_profile_button".tr(),
+ context.strings.delete_profile_button,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
@@ -72,7 +72,7 @@ class DeleteProfileDialogWidget extends StatelessWidget {
Navigator.of(context).pop();
},
child: Text(
- "delete_profile_cancel".tr(),
+ context.strings.delete_profile_cancel,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
diff --git a/comwell_key_app/lib/profile_settings/profile_settings_page.dart b/comwell_key_app/lib/profile_settings/profile_settings_page.dart
index d657ff28..6d7addef 100644
--- a/comwell_key_app/lib/profile_settings/profile_settings_page.dart
+++ b/comwell_key_app/lib/profile_settings/profile_settings_page.dart
@@ -9,7 +9,7 @@ import 'package:comwell_key_app/profile_settings/cubit/profile_settings_cubit.da
import 'package:comwell_key_app/profile_settings/model/address.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/utils/address_utils.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
@@ -25,31 +25,37 @@ class ProfileSettingsPage extends StatelessWidget {
builder: (context, state) {
if (state.isLoading) {
return const Scaffold(
- appBar: ComwellAppBar(
- shouldShowProfileButton: false,
- ),
- backgroundColor: Colors.white,
- body: Center(child: ProfileSettingsShimmerLoader()));
+ appBar: ComwellAppBar(
+ shouldShowProfileButton: false,
+ ),
+ backgroundColor: Colors.white,
+ body: Center(child: ProfileSettingsShimmerLoader()),
+ );
} else if (state.user != null) {
return _buildProfileSettingsPage(theme, state, context);
} else {
return Scaffold(
- appBar: const ComwellAppBar(
- shouldShowProfileButton: false,
- ),
- backgroundColor: Colors.white,
- body: Center(
- child: Text(
- "generic_error".tr(),
+ appBar: const ComwellAppBar(
+ shouldShowProfileButton: false,
+ ),
+ backgroundColor: Colors.white,
+ body: Center(
+ child: Text(
+ context.strings.generic_error,
style: theme.textTheme.headlineLarge,
- )));
+ ),
+ ),
+ );
}
},
);
}
Widget _buildProfileSettingsPage(
- ThemeData theme, ProfileSettingsState state, BuildContext context) {
+ ThemeData theme,
+ ProfileSettingsState state,
+ BuildContext context,
+ ) {
final cubit = context.read<ProfileSettingsCubit>();
final address = formatAddress(state.user!.address);
@@ -68,38 +74,41 @@ class ProfileSettingsPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 36),
- Text("profile_settings".tr(),
- style: theme.textTheme.headlineLarge
- ?.copyWith(color: colorPrimaryText),
- textAlign: TextAlign.start),
+ Text(
+ context.strings.profile_settings,
+ style: theme.textTheme.headlineLarge?.copyWith(color: colorPrimaryText),
+ textAlign: TextAlign.start,
+ ),
const SizedBox(height: 36),
ComwellTextField(
- fieldName: "profile_settings_firstname".tr(),
- initialValue: state.user!.firstName,
- readOnly: false,
- controller: cubit.firstNameController,
- onSubmitted: (value) {
- cubit.updateFirstName(value);
- }),
+ fieldName: context.strings.profile_settings_firstname,
+ initialValue: state.user!.firstName,
+ readOnly: false,
+ controller: cubit.firstNameController,
+ onSubmitted: (value) {
+ cubit.updateFirstName(value);
+ },
+ ),
const SizedBox(height: 8),
ComwellTextField(
- fieldName: "profile_settings_lastname".tr(),
- initialValue: state.user!.lastName,
- readOnly: false,
- controller: cubit.lastNameController,
- onSubmitted: (value) {
- cubit.updateLastName(value);
- }),
+ fieldName: context.strings.profile_settings_lastname,
+ initialValue: state.user!.lastName,
+ readOnly: false,
+ controller: cubit.lastNameController,
+ onSubmitted: (value) {
+ cubit.updateLastName(value);
+ },
+ ),
const SizedBox(height: 8),
ComwellTextField(
- fieldName: "profile_settings_email".tr(),
+ fieldName: context.strings.profile_settings_email,
initialValue: state.user?.email ?? '',
readOnly: true,
controller: TextEditingController(text: state.user?.email ?? ''),
),
const SizedBox(height: 8),
IntlPhoneField(
- title: "profile_settings_phone".tr(),
+ title: context.strings.profile_settings_phone,
phoneNumber: cubit.phoneNumber!,
countryCode: cubit.countryCode!,
controller: cubit.phoneNumberController,
@@ -110,27 +119,31 @@ class ProfileSettingsPage extends StatelessWidget {
),
const SizedBox(height: 8),
TextFieldWithTrailingIcon(
- title: "profile_settings_address".tr(),
- text: address,
- trailingIcon: "assets/icons/edit-alt.svg",
- onTap: () async {
- final response = await showModalBottomSheet<Address>(
- context: context,
- isScrollControlled: true,
- backgroundColor: Colors.white,
- builder: (context) =>
- AddressBottomSheet(user: state.user, selectedCountry: cubit.selectedCountry));
+ title: context.strings.profile_settings_address,
+ text: address,
+ trailingIcon: "assets/icons/edit-alt.svg",
+ onTap: () async {
+ final response = await showModalBottomSheet<Address>(
+ context: context,
+ isScrollControlled: true,
+ backgroundColor: Colors.white,
+ builder: (context) => AddressBottomSheet(
+ user: state.user,
+ selectedCountry: cubit.selectedCountry,
+ ),
+ );
- if (response is Address) {
- cubit.updateAddress(response);
- } else {
- debugPrint("Not an address $response");
- }
- },
- showTitle: true),
+ if (response is Address) {
+ cubit.updateAddress(response);
+ } else {
+ debugPrint("Not an address $response");
+ }
+ },
+ showTitle: true,
+ ),
const SizedBox(height: 8),
DateTimePicker(
- title: "profile_settings_birthday".tr(),
+ title: context.strings.profile_settings_birthday,
initialValue: state.user?.birthDate ?? DateTime(1990, 1, 1),
),
const SizedBox(height: 20),
@@ -146,7 +159,7 @@ class ProfileSettingsPage extends StatelessWidget {
maximumSize: const Size(155, 40),
),
child: Text(
- 'update_profile'.tr(),
+ context.strings.update_profile,
style: const TextStyle(
color: Colors.white,
),
@@ -169,18 +182,20 @@ class ProfileSettingsPage extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
),
child: Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- SvgPicture.asset("assets/icons/trash-can.svg",
- height: 16),
- const SizedBox(width: 8),
- Text(
- "delete_profile".tr(),
- style: theme.textTheme.labelLarge?.copyWith(
- color: Colors.red, fontWeight: FontWeight.w600),
+ mainAxisSize: MainAxisSize.min,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ SvgPicture.asset("assets/icons/trash-can.svg", height: 16),
+ const SizedBox(width: 8),
+ Text(
+ context.strings.delete_profile,
+ style: theme.textTheme.labelLarge?.copyWith(
+ color: Colors.red,
+ fontWeight: FontWeight.w600,
),
- ]),
+ ),
+ ],
+ ),
),
),
],
diff --git a/comwell_key_app/lib/received_shared_booking/received_shared_booking_page.dart b/comwell_key_app/lib/received_shared_booking/received_shared_booking_page.dart
index c6f3f6fd..b8c663a3 100644
--- a/comwell_key_app/lib/received_shared_booking/received_shared_booking_page.dart
+++ b/comwell_key_app/lib/received_shared_booking/received_shared_booking_page.dart
@@ -3,8 +3,8 @@ import 'package:comwell_key_app/common/components/shimmer_loader/share_room_shim
import 'package:comwell_key_app/received_shared_booking/cubit/received_shared_booking_cubit.dart';
import 'package:comwell_key_app/received_shared_booking/cubit/received_shared_booking_state.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:comwell_key_app/utils/templates/share_booking_base_template.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -27,8 +27,8 @@ class ReceivedSharedBookingPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ComwellErrorWidget(
- title: "share_booking_error_title".tr(),
- subtitle: "share_booking_error_subtitle".tr(),
+ title: context.strings.share_booking_error_title,
+ subtitle: context.strings.share_booking_error_subtitle,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0),
@@ -36,7 +36,7 @@ class ReceivedSharedBookingPage extends StatelessWidget {
onPressed: () {
context.go(AppRoutes.overview);
},
- child: Text("home_page".tr(),
+ child: Text(context.strings.home_page,
style: Theme.of(context)
.textTheme
.bodyMedium
diff --git a/comwell_key_app/lib/up_sales/components/catalog/room_upgrade_catalog.dart b/comwell_key_app/lib/up_sales/components/catalog/room_upgrade_catalog.dart
index 559e80e3..17339461 100644
--- a/comwell_key_app/lib/up_sales/components/catalog/room_upgrade_catalog.dart
+++ b/comwell_key_app/lib/up_sales/components/catalog/room_upgrade_catalog.dart
@@ -7,7 +7,7 @@ import 'package:comwell_key_app/up_sales/models/room_upgrade.dart';
import 'package:comwell_key_app/up_sales/models/upgrade.dart';
import 'package:comwell_key_app/up_sales/models/room_upgrade_list.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -33,7 +33,7 @@ class RoomUpgradeCatalog extends StatelessWidget {
if (availableRoomUpgrades.isEmpty) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text('no_room_upgrades_available'.tr(),
+ child: Text(context.strings.no_room_upgrades_available,
style: theme.textTheme.headlineMedium
?.copyWith(color: colorHeadlineText)),
);
diff --git a/comwell_key_app/lib/up_sales/components/confirm_up_sales_dialog.dart b/comwell_key_app/lib/up_sales/components/confirm_up_sales_dialog.dart
index bb54ec5d..9adedf94 100644
--- a/comwell_key_app/lib/up_sales/components/confirm_up_sales_dialog.dart
+++ b/comwell_key_app/lib/up_sales/components/confirm_up_sales_dialog.dart
@@ -1,10 +1,10 @@
-
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class ConfirmUpSalesDialog extends StatelessWidget {
final VoidCallback onContinue;
final int extrasTotalPrice;
+
const ConfirmUpSalesDialog({super.key, required this.onContinue, required this.extrasTotalPrice});
@override
@@ -22,31 +22,30 @@ class ConfirmUpSalesDialog extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- "confirm_up_sales_dialog_title".tr(),
+ context.strings.confirm_up_sales_dialog_title,
textAlign: TextAlign.center,
style: theme.textTheme.headlineMedium?.copyWith(
color: Theme.of(context).colorScheme.surfaceTint,
),
),
Text(
- "confirm_up_sales_dialog_subtitle".tr(args: [extrasTotalPrice.toString()]),
+ context.strings.confirm_up_sales_dialog_subtitle(extrasTotalPrice.toString()),
textAlign: TextAlign.center,
- style: theme.textTheme.bodyMedium
+ style: theme.textTheme.bodyMedium,
),
const SizedBox(height: 24),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: theme.elevatedButtonTheme.style?.copyWith(
- padding: const WidgetStatePropertyAll(
- EdgeInsets.symmetric(vertical: 16)),
+ padding: const WidgetStatePropertyAll(EdgeInsets.symmetric(vertical: 16)),
),
onPressed: () {
onContinue();
Navigator.of(context).pop();
},
child: Text(
- "confirm_up_sales_dialog_confirm".tr(),
+ context.strings.confirm_up_sales_dialog_confirm,
style: theme.textTheme.bodyMedium?.copyWith(
color: Colors.white,
),
@@ -64,10 +63,7 @@ class ConfirmUpSalesDialog extends StatelessWidget {
onPressed: () {
Navigator.of(context).pop();
},
- child: Text(
- "cancel".tr(),
- style: theme.textTheme.bodyMedium
- ),
+ child: Text(context.strings.cancel, style: theme.textTheme.bodyMedium),
),
),
],
@@ -75,4 +71,4 @@ class ConfirmUpSalesDialog extends StatelessWidget {
),
);
}
-}
\ No newline at end of file
+}
diff --git a/comwell_key_app/lib/up_sales/components/facilities_bottom_sheet.dart b/comwell_key_app/lib/up_sales/components/facilities_bottom_sheet.dart
index 4cce52ec..ec9dd975 100644
--- a/comwell_key_app/lib/up_sales/components/facilities_bottom_sheet.dart
+++ b/comwell_key_app/lib/up_sales/components/facilities_bottom_sheet.dart
@@ -1,7 +1,7 @@
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/up_sales/components/facility_icon_text.dart';
import 'package:comwell_key_app/up_sales/models/facility_type.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class FacilitiesBottomSheet extends StatelessWidget {
@@ -32,7 +32,7 @@ class FacilitiesBottomSheet extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text('facilities'.tr(), style: theme.textTheme.labelLarge),
+ Text(context.strings.facilities, style: theme.textTheme.labelLarge),
IconButton(
icon: const Icon(
Icons.close,
diff --git a/comwell_key_app/lib/up_sales/components/up_sales_catalog_button.dart b/comwell_key_app/lib/up_sales/components/up_sales_catalog_button.dart
index 37f956ae..875793bf 100644
--- a/comwell_key_app/lib/up_sales/components/up_sales_catalog_button.dart
+++ b/comwell_key_app/lib/up_sales/components/up_sales_catalog_button.dart
@@ -2,7 +2,7 @@ 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';
import 'package:comwell_key_app/up_sales/models/up_sales.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -57,13 +57,13 @@ class UpSalesCatalogButton extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- 'up_sales_catalog_button_title'.tr(),
+ context.strings.up_sales_catalog_button_title,
style: theme.textTheme.headlineMedium?.copyWith(
color: Colors.white,
),
),
Text(
- 'up_sales_catalog_button_subtitle'.tr(),
+ context.strings.up_sales_catalog_button_subtitle,
style: theme.textTheme.bodySmall?.copyWith(
color: Colors.white,
),
diff --git a/comwell_key_app/lib/up_sales/components/up_sales_continue_button.dart b/comwell_key_app/lib/up_sales/components/up_sales_continue_button.dart
index fa4f349f..fe407439 100644
--- a/comwell_key_app/lib/up_sales/components/up_sales_continue_button.dart
+++ b/comwell_key_app/lib/up_sales/components/up_sales_continue_button.dart
@@ -2,7 +2,7 @@ import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/up_sales/models/addon_upgrade.dart';
import 'package:comwell_key_app/up_sales/models/room_upgrade.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -52,7 +52,7 @@ class UpSalesContinueButton extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
- "generic_continue".tr(),
+ context.strings.generic_continue,
style: theme.textTheme.headlineSmall
?.copyWith(color: Colors.white),
),
diff --git a/comwell_key_app/lib/up_sales/components/up_sales_services_widget.dart b/comwell_key_app/lib/up_sales/components/up_sales_services_widget.dart
index 46e27bdd..a2e34a4d 100644
--- a/comwell_key_app/lib/up_sales/components/up_sales_services_widget.dart
+++ b/comwell_key_app/lib/up_sales/components/up_sales_services_widget.dart
@@ -2,7 +2,7 @@ import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/up_sales/components/comwell_radio_button.dart';
import 'package:comwell_key_app/up_sales/components/tags.dart';
import 'package:comwell_key_app/up_sales/models/upgrade.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class UpSalesServicesWidget extends StatelessWidget {
@@ -64,13 +64,11 @@ class UpSalesServicesWidget extends StatelessWidget {
Row(
children: [
Text(
- "total_charge_value"
- .tr(args: [upgrade.price.toString()]),
+ context.strings.total_charge_value(upgrade.price.toString()),
style: theme.textTheme.headlineMedium,
),
const SizedBox(width: 8),
- if (showRadioButton)
- ComwellRadioButton(selected: isSelected, onTap: onTap),
+ if (showRadioButton) ComwellRadioButton(selected: isSelected, onTap: onTap),
],
),
],
@@ -80,7 +78,7 @@ class UpSalesServicesWidget extends StatelessWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- if (isPopular!) TagWidget(text: "up_sales_popular".tr().toUpperCase()),
+ if (isPopular!) TagWidget(text: context.strings.up_sales_popular.toUpperCase()),
const SizedBox(height: 8),
SizedBox(
width: 250,
diff --git a/comwell_key_app/lib/up_sales/components/up_sales_upgrades_widget.dart b/comwell_key_app/lib/up_sales/components/up_sales_upgrades_widget.dart
index 20accec6..beb42eaa 100644
--- a/comwell_key_app/lib/up_sales/components/up_sales_upgrades_widget.dart
+++ b/comwell_key_app/lib/up_sales/components/up_sales_upgrades_widget.dart
@@ -2,7 +2,7 @@ import 'package:comwell_key_app/common/const.dart';
import 'package:comwell_key_app/up_sales/components/upgrades_counter.dart';
import 'package:comwell_key_app/up_sales/models/room_upgrade.dart';
import 'package:comwell_key_app/up_sales/models/upgrade.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/up_sales/components/comwell_radio_button.dart';
@@ -117,8 +117,7 @@ class UpSalesUpgradesWidget extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- "total_charge_value"
- .tr(args: [upgrade.price.toString()]),
+ context.strings.total_charge_value(upgrade.price.toString()),
style: theme.textTheme.headlineMedium,
),
const SizedBox(width: 8),
@@ -136,7 +135,7 @@ class UpSalesUpgradesWidget extends StatelessWidget {
),
const SizedBox(height: 8),
Text(
- 'read_more_up_sales'.tr(),
+ context.strings.read_more_up_sales,
style: theme.textTheme.bodySmall?.copyWith(
color: sandColor[80],
decoration: TextDecoration.underline,
diff --git a/comwell_key_app/lib/up_sales/pages/addon_upgrade_page.dart b/comwell_key_app/lib/up_sales/pages/addon_upgrade_page.dart
index 86de52cf..c93453f7 100644
--- a/comwell_key_app/lib/up_sales/pages/addon_upgrade_page.dart
+++ b/comwell_key_app/lib/up_sales/pages/addon_upgrade_page.dart
@@ -2,7 +2,7 @@ import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
import 'package:comwell_key_app/common/const.dart';
import 'package:comwell_key_app/up_sales/components/addon_item_counter.dart';
import 'package:comwell_key_app/up_sales/models/addon_upgrade.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../../themes/light_theme.dart';
@@ -108,8 +108,7 @@ class _AddonUpgradePageState extends State<AddonUpgradePage> {
Text(widget.addonUpgrade.name,
style: theme.textTheme.headlineLarge),
Text(
- "total_charge_value"
- .tr(args: [widget.addonUpgrade.price.toString()]),
+ context.strings.total_charge_value(widget.addonUpgrade.price.toString()),
style: theme.textTheme.headlineLarge),
],
),
@@ -153,7 +152,7 @@ class _AddonUpgradePageState extends State<AddonUpgradePage> {
extrasTotalPrice: widget.extrasTotalPrice,
selectedRoomUpgrade: widget.selectedRoomUpgrade,
children: [
- Text(quantity > 0 ? 'add_to_booking'.tr() : 'remove'.tr())
+ Text(quantity > 0 ? context.strings.add_to_booking : context.strings.remove)
],
),
),
diff --git a/comwell_key_app/lib/up_sales/pages/processing/up_sales_error_page.dart b/comwell_key_app/lib/up_sales/pages/processing/up_sales_error_page.dart
index 60a3e06d..a755df18 100644
--- a/comwell_key_app/lib/up_sales/pages/processing/up_sales_error_page.dart
+++ b/comwell_key_app/lib/up_sales/pages/processing/up_sales_error_page.dart
@@ -1,6 +1,6 @@
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class UpSalesErrorPage extends StatelessWidget {
@@ -20,13 +20,13 @@ class UpSalesErrorPage extends StatelessWidget {
Column(
children: [
Text(
- "up_sales_processing_error_title".tr(),
+ context.strings.up_sales_processing_error_title,
style: Theme.of(context)
.textTheme
.headlineMedium
?.copyWith(color: colorBackground),
),
- Text("up_sales_processing_error_subtitle".tr(),
+ Text(context.strings.up_sales_processing_error_subtitle,
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
@@ -49,7 +49,7 @@ class UpSalesErrorPage extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
- "generic_ok".tr(),
+ context.strings.generic_ok,
style: const TextStyle(color: colorTertiary),
),
)),
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 08ed0ca9..53f082f5 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
@@ -9,13 +9,14 @@ 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:comwell_key_app/up_sales/models/facility_type.dart';
import 'package:comwell_key_app/up_sales/models/room_upgrade_list.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:comwell_key_app/up_sales/components/tags.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class RoomUpgradePage extends StatefulWidget {
final RoomUpgradeList roomUpgradeList;
+
const RoomUpgradePage({super.key, required this.roomUpgradeList});
@override
@@ -24,7 +25,10 @@ class RoomUpgradePage extends StatefulWidget {
class _RoomUpgradePageState extends State<RoomUpgradePage> {
bool _isExpanded = false;
- List<FacilityType> get allFacilities => [...widget.roomUpgradeList.roomUpgrade?.facilityTypes ?? []];
+
+ List<FacilityType> get allFacilities => [
+ ...widget.roomUpgradeList.roomUpgrade?.facilityTypes ?? [],
+ ];
@override
Widget build(BuildContext context) {
@@ -32,152 +36,152 @@ class _RoomUpgradePageState extends State<RoomUpgradePage> {
final isSelected = widget.roomUpgradeList.isRoomUpgradeSelected;
final height = MediaQuery.of(context).size.height;
- return BlocBuilder<UpSalesCubit, UpSalesState>(builder: (context, state) {
- final cubit = context.read<UpSalesCubit>();
- return Scaffold(
- extendBodyBehindAppBar: true,
- appBar: const ComwellAppBar(),
- backgroundColor: Theme.of(context).colorScheme.surface,
- body: SingleChildScrollView(
- physics: const AlwaysScrollableScrollPhysics(),
- child: ConstrainedBox(
- constraints: BoxConstraints(
- minHeight: height -
- kComwellAppBarHeight -
- 80,
- ),
- child: Column(
- children: [
- RoomImageCarousel(
- images: widget.roomUpgradeList.roomUpgrade?.images.toList() ?? []),
- Container(
- width: double.infinity,
- decoration: BoxDecoration(
- color: Theme.of(context).colorScheme.surface,
- borderRadius: const BorderRadius.only(
- topLeft: Radius.circular(24),
- topRight: Radius.circular(24),
- ),
+ return BlocBuilder<UpSalesCubit, UpSalesState>(
+ builder: (context, state) {
+ final cubit = context.read<UpSalesCubit>();
+ return Scaffold(
+ extendBodyBehindAppBar: true,
+ appBar: const ComwellAppBar(),
+ backgroundColor: Theme.of(context).colorScheme.surface,
+ body: SingleChildScrollView(
+ physics: const AlwaysScrollableScrollPhysics(),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: height - kComwellAppBarHeight - 80,
+ ),
+ child: Column(
+ children: [
+ RoomImageCarousel(
+ images: widget.roomUpgradeList.roomUpgrade?.images.toList() ?? [],
),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 24, vertical: 16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Expanded(
- child: Text(
- widget.roomUpgradeList.roomUpgrade?.name ?? '',
- style: theme.textTheme.headlineLarge,
+ Container(
+ width: double.infinity,
+ decoration: BoxDecoration(
+ color: Theme.of(context).colorScheme.surface,
+ borderRadius: const 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,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Expanded(
+ child: Text(
+ widget.roomUpgradeList.roomUpgrade?.name ?? '',
+ style: theme.textTheme.headlineLarge,
+ ),
),
- ),
- const SizedBox(width: 12),
- if (widget.roomUpgradeList.roomUpgrade?.roomSize != null)
- TagWidget(
+ const SizedBox(width: 12),
+ if (widget.roomUpgradeList.roomUpgrade?.roomSize != null)
+ TagWidget(
text: '${widget.roomUpgradeList.roomUpgrade?.roomSize} M2',
- textColor: sandColor),
- ],
- ),
- const SizedBox(height: 12),
- Text(
- widget.roomUpgradeList.roomUpgrade?.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,
+ textColor: sandColor,
+ ),
+ ],
+ ),
+ const SizedBox(height: 12),
+ Text(
+ widget.roomUpgradeList.roomUpgrade?.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 ? context.strings.read_less : context.strings.read_more,
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: sandColor,
+ decoration: TextDecoration.underline,
+ decorationColor: sandColor,
+ ),
),
),
- ),
- const SizedBox(height: 24),
- // Facilities row
- Wrap(
- spacing: 8,
- runSpacing: 8,
- children: [
- ...widget.roomUpgradeList.roomUpgrade?.facilityTypes.map((f) =>
- FacilityIconText(
- facility: f, showDivider: true)).toList() ?? [],
- GestureDetector(
- onTap: () => _showFacilitiesSheet(context),
- 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),
+ // Facilities row
+ Wrap(
+ spacing: 8,
+ runSpacing: 8,
+ children: [
+ ...widget.roomUpgradeList.roomUpgrade?.facilityTypes
+ .map((f) => FacilityIconText(facility: f, showDivider: true))
+ .toList() ??
+ [],
+ GestureDetector(
+ onTap: () => _showFacilitiesSheet(context),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 4.0),
+ child: Text(
+ context.strings.see_all_facilities,
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: sandColor,
+ decoration: TextDecoration.underline,
+ decorationColor: sandColor,
+ ),
),
),
),
- ),
- ],
- ),
- const SizedBox(height: 32),
- ],
+ ],
+ ),
+ const SizedBox(height: 32),
+ ],
+ ),
),
),
- ),
- // Booking button
- ],
+ // Booking button
+ ],
+ ),
),
),
- ),
- bottomNavigationBar: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- const Divider(color: colorDivider),
- UpSalesBottomButton(
+ bottomNavigationBar: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Divider(color: colorDivider),
+ UpSalesBottomButton(
onContinue: () {
Navigator.pop(context, [widget.roomUpgradeList.roomUpgrade, isSelected]);
},
extrasTotalPrice: cubit.extrasTotalPrice,
selectedRoomUpgrade: state.selectedRoomUpgrade,
- children: [
+ children: [
isSelected
? Text(
- "remove_from_booking".tr(),
- style: theme.textTheme.headlineSmall
- ?.copyWith(color: Colors.white),
+ context.strings.remove_from_booking,
+ style: theme.textTheme.headlineSmall?.copyWith(color: Colors.white),
)
: Text(
- "add_to_booking".tr(),
- style: theme.textTheme.headlineSmall
- ?.copyWith(color: Colors.white),
+ context.strings.add_to_booking,
+ style: theme.textTheme.headlineSmall?.copyWith(color: Colors.white),
),
- isSelected ? Text(
- "-${"total_charge_value".tr(args: [widget.roomUpgradeList.roomUpgrade?.price.toString() ?? '0'])}",
- style: theme.textTheme.headlineSmall
- ?.copyWith(color: Colors.white),
- ) : Text(
- "+${"total_charge_value".tr(args: [widget.roomUpgradeList.roomUpgrade?.price.toString() ?? '0'])}",
- style: theme.textTheme.headlineSmall
- ?.copyWith(color: Colors.white),
- ),
- ]),
- ],
- ),
- );
- });
+ isSelected
+ ? Text(
+ "-${context.strings.total_charge_value(widget.roomUpgradeList.roomUpgrade?.price.toString() ?? '0')}",
+ style: theme.textTheme.headlineSmall?.copyWith(color: Colors.white),
+ )
+ : Text(
+ "+${context.strings.total_charge_value(widget.roomUpgradeList.roomUpgrade?.price.toString() ?? '0')}",
+ style: theme.textTheme.headlineSmall?.copyWith(color: Colors.white),
+ ),
+ ],
+ ),
+ ],
+ ),
+ );
+ },
+ );
}
void _showFacilitiesSheet(BuildContext context) {
diff --git a/comwell_key_app/lib/up_sales/pages/services_upgrade_page.dart b/comwell_key_app/lib/up_sales/pages/services_upgrade_page.dart
index 9d7cedc0..76bdbf18 100644
--- a/comwell_key_app/lib/up_sales/pages/services_upgrade_page.dart
+++ b/comwell_key_app/lib/up_sales/pages/services_upgrade_page.dart
@@ -6,7 +6,7 @@ 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';
import 'package:comwell_key_app/up_sales/models/room_upgrade_list.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -80,8 +80,8 @@ class ServicesUpgradePage extends StatelessWidget {
style: theme.textTheme.headlineLarge,
),
Text(
- "total_charge_value".tr(
- args: [roomUpgradeList.addOnUpgrade?.price.toString() ?? '0'],
+ context.strings.total_charge_value(
+ roomUpgradeList.addOnUpgrade?.price.toString() ?? '0',
),
style: theme.textTheme.headlineLarge,
),
@@ -130,20 +130,20 @@ class ServicesUpgradePage extends StatelessWidget {
children: [
isSelected
? Text(
- "remove_from_booking".tr(),
+ context.strings.remove_from_booking,
style: theme.textTheme.headlineSmall?.copyWith(color: Colors.white),
)
: Text(
- "add_to_booking".tr(),
+ context.strings.add_to_booking,
style: theme.textTheme.headlineSmall?.copyWith(color: Colors.white),
),
isSelected
? Text(
- "-${"total_charge_value".tr(args: [roomUpgradeList.addOnUpgrade?.price.toString() ?? '0'])}",
+ "-${context.strings.total_charge_value(roomUpgradeList.addOnUpgrade?.price.toString() ?? '0')}",
style: theme.textTheme.headlineSmall?.copyWith(color: Colors.white),
)
: Text(
- "+${"total_charge_value".tr(args: [roomUpgradeList.addOnUpgrade?.price.toString() ?? '0'])}",
+ "+${context.strings.total_charge_value(roomUpgradeList.addOnUpgrade?.price.toString() ?? '0')}",
style: theme.textTheme.headlineSmall?.copyWith(color: Colors.white),
),
],
diff --git a/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart b/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart
index 3c25079d..d49cc920 100644
--- a/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart
+++ b/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart
@@ -6,7 +6,7 @@ import 'package:comwell_key_app/up_sales/cubit/up_sales_state.dart';
import 'package:comwell_key_app/up_sales/models/addon_upgrade.dart';
import 'package:comwell_key_app/up_sales/models/room_upgrade.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -42,12 +42,12 @@ class UpSaleConfirmationPage extends StatelessWidget {
children: [
const SizedBox(height: 8),
Text(
- 'up_sales_confirmation_title'.tr(),
+ context.strings.up_sales_confirmation_title,
style: theme.textTheme.headlineLarge,
),
const SizedBox(height: 32),
if (selectedUpSales.isEmpty && selectedRoomUpgrade == null)
- Text('up_sales_confirmation_no_up_sales'.tr(),
+ Text(context.strings.up_sales_confirmation_no_up_sales,
style: theme.textTheme.bodyMedium),
if (selectedUpSales.isNotEmpty || selectedRoomUpgrade != null) ...[
if (selectedRoomUpgrade != null) ...[
@@ -89,10 +89,9 @@ class UpSaleConfirmationPage extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text("total_charge".tr(),
+ Text(context.strings.total_charge,
style: theme.textTheme.bodyMedium),
- Text("total_charge_value"
- .tr(args: [extrasTotalPrice.toString()])),
+ Text(context.strings.total_charge_value(extrasTotalPrice.toString())),
],
),
const SizedBox(height: 16),
@@ -109,7 +108,7 @@ class UpSaleConfirmationPage extends StatelessWidget {
),
activeColor: sandColor[80],
),
- Text("approve_conditions_title".tr(),
+ Text(context.strings.approve_conditions_title,
style: theme.textTheme.bodySmall?.copyWith(
color: colorHeadlineText,
)),
@@ -118,7 +117,7 @@ class UpSaleConfirmationPage extends StatelessWidget {
launchUrl(Uri.parse(ComwellUrls.termsAndConditions));
},
child: Text(
- 'approve_conditions_subtitle'.tr(),
+ context.strings.approve_conditions_subtitle,
style: theme.textTheme.bodySmall?.copyWith(
color: sandColor,
decoration: TextDecoration.underline,
@@ -152,7 +151,7 @@ class UpSaleConfirmationPage extends StatelessWidget {
return true;
},
label: Center(
- child: Text("add_to_booking".tr(),
+ child: Text(context.strings.add_to_booking,
style: theme.textTheme.headlineSmall
?.copyWith(color: Colors.white))),
),
diff --git a/comwell_key_app/lib/up_sales/up_sales_catalog.dart b/comwell_key_app/lib/up_sales/up_sales_catalog.dart
index e8fc19b5..7654a6bd 100644
--- a/comwell_key_app/lib/up_sales/up_sales_catalog.dart
+++ b/comwell_key_app/lib/up_sales/up_sales_catalog.dart
@@ -7,7 +7,7 @@ import 'package:comwell_key_app/up_sales/components/up_sales_continue_button.dar
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:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -55,14 +55,14 @@ class UpSalesCatalog extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text('up_sales_catalog_title'.tr(),
+ child: Text(context.strings.up_sales_catalog_title,
style: theme.textTheme.headlineLarge),
),
const SizedBox(height: 40),
if (serviceUpgrades.isNotEmpty && serviceUpgrades.any((e) => e.isService)) ...[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text('services'.tr(),
+ child: Text(context.strings.services,
style: theme.textTheme.headlineMedium),
),
const SizedBox(height: 8),
@@ -81,7 +81,7 @@ class UpSalesCatalog extends StatelessWidget {
if (cubit.upSales.roomUpgrades.isNotEmpty) ...[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text('room_upgrades'.tr(),
+ child: Text(context.strings.room_upgrades,
style: theme.textTheme.headlineMedium),
),
const SizedBox(height: 8),
@@ -101,7 +101,7 @@ class UpSalesCatalog extends StatelessWidget {
if (addonUpgrades.any((e) => !e.isService)) ...[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text('other_up_sales'.tr(),
+ child: Text(context.strings.other_up_sales,
style: theme.textTheme.headlineMedium),
),
const SizedBox(height: 8),
diff --git a/comwell_key_app/lib/utils/context_utils.dart b/comwell_key_app/lib/utils/context_utils.dart
index 78c5a00e..62f0c54f 100644
--- a/comwell_key_app/lib/utils/context_utils.dart
+++ b/comwell_key_app/lib/utils/context_utils.dart
@@ -14,4 +14,6 @@ extension BuildContextExt on BuildContext {
AppButtonStyles get buttonStyles => read<AppButtonStyles>();
ComwellPreferences get prefs => locator.get<ComwellPreferences>();
+
+ MediaQueryData get mq => MediaQuery.of(this);
}
diff --git a/comwell_key_app/lib/utils/templates/share_booking_base_template.dart b/comwell_key_app/lib/utils/templates/share_booking_base_template.dart
index bbe338ab..ac041a53 100644
--- a/comwell_key_app/lib/utils/templates/share_booking_base_template.dart
+++ b/comwell_key_app/lib/utils/templates/share_booking_base_template.dart
@@ -1,8 +1,9 @@
import 'package:comwell_key_app/common/components/comwell_error_widget.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
+import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
+import 'package:intl/intl.dart';
class ShareBookingBaseTemplate extends StatelessWidget {
final Booking booking;
@@ -10,13 +11,15 @@ class ShareBookingBaseTemplate extends StatelessWidget {
final void Function() onClicked;
final bool isLoading;
final Error? error;
- const ShareBookingBaseTemplate(
- {super.key,
- required this.booking,
- required this.onClicked,
- required this.isShared,
- required this.isLoading,
- this.error});
+
+ const ShareBookingBaseTemplate({
+ super.key,
+ required this.booking,
+ required this.onClicked,
+ required this.isShared,
+ required this.isLoading,
+ this.error,
+ });
@override
Widget build(BuildContext context) {
@@ -45,8 +48,8 @@ class ShareBookingBaseTemplate extends StatelessWidget {
padding: const EdgeInsets.only(top: 40.0),
child: error != null
? ComwellErrorWidget(
- title: "share_booking_page_error_title".tr(),
- subtitle: "share_booking_page_error_subtitle".tr(),
+ title: context.strings.share_booking_page_error_title,
+ subtitle: context.strings.share_booking_page_error_subtitle,
border: true,
small: true,
)
@@ -60,13 +63,14 @@ class ShareBookingBaseTemplate extends StatelessWidget {
children: [
const SizedBox(width: 52),
Text(
- isShared
- ? 'received_shared_booking_page_title'.tr()
- : 'share_booking_page_title'.tr(),
- style: theme.textTheme.titleMedium?.copyWith(
- color: Colors.white,
- fontWeight: FontWeight.bold,
- )),
+ isShared
+ ? context.strings.received_shared_booking_page_title
+ : context.strings.share_booking_page_title,
+ style: theme.textTheme.titleMedium?.copyWith(
+ color: Colors.white,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
Padding(
padding: const EdgeInsets.only(right: 16),
child: isShared
@@ -78,8 +82,7 @@ class ShareBookingBaseTemplate extends StatelessWidget {
style: ElevatedButton.styleFrom(
minimumSize: const Size(36, 36),
padding: EdgeInsets.zero,
- backgroundColor:
- Theme.of(context).colorScheme.surface,
+ backgroundColor: Theme.of(context).colorScheme.surface,
shape: const CircleBorder(),
elevation: 0,
),
@@ -89,7 +92,7 @@ class ShareBookingBaseTemplate extends StatelessWidget {
size: 24,
),
),
- )
+ ),
],
),
),
@@ -121,26 +124,29 @@ class ShareBookingBaseTemplate extends StatelessWidget {
children: [
Row(
children: [
- Text(DateFormat('d. MMM').format(booking.startDate),
- style: theme.textTheme.bodyMedium?.copyWith(
- color: Theme.of(context).colorScheme.surface,
- )),
- Icon(Icons.arrow_forward,
- size: 16,
- color: Theme.of(context).colorScheme.surface),
- Text(DateFormat('d. MMM').format(booking.endDate),
- style: theme.textTheme.bodyMedium?.copyWith(
- color: Theme.of(context).colorScheme.surface,
- )),
+ Text(
+ DateFormat('d. MMM').format(booking.startDate),
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: Theme.of(context).colorScheme.surface,
+ ),
+ ),
+ Icon(
+ Icons.arrow_forward,
+ size: 16,
+ color: Theme.of(context).colorScheme.surface,
+ ),
+ Text(
+ DateFormat('d. MMM').format(booking.endDate),
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: Theme.of(context).colorScheme.surface,
+ ),
+ ),
],
),
Text(
- '${booking.guests.length} ${booking.guests.length > 1 ? 'guests'.tr() : 'guest'.tr()}',
+ '${booking.guests.length} ${booking.guests.length > 1 ? context.strings.guests : context.strings.guest}',
style: theme.textTheme.bodySmall?.copyWith(
- color: Theme.of(context)
- .colorScheme
- .surface
- .withValues(alpha: 0.7),
+ color: Theme.of(context).colorScheme.surface.withValues(alpha: 0.7),
),
),
],
@@ -153,16 +159,13 @@ class ShareBookingBaseTemplate extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Text(
isShared
- ? 'received_shared_booking_page_subtitle'.tr(args: [
+ ? context.strings.received_shared_booking_page_subtitle(
"${booking.firstName} ${booking.lastName}",
- ])
- : 'share_booking_page_subtitle'.tr(),
+ )
+ : context.strings.share_booking_page_subtitle,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
- color: Theme.of(context)
- .colorScheme
- .surface
- .withValues(alpha: 0.8),
- ),
+ color: Theme.of(context).colorScheme.surface.withValues(alpha: 0.8),
+ ),
textAlign: TextAlign.center,
),
),
@@ -183,10 +186,14 @@ class ShareBookingBaseTemplate extends StatelessWidget {
backgroundColor: colorTertiary,
strokeWidth: 2,
)
- : Text(isShared ? 'generic_ok'.tr() : 'share_booking_page_share_button'.tr(),
+ : Text(
+ isShared
+ ? context.strings.generic_ok
+ : context.strings.share_booking_page_share_button,
style: theme.textTheme.bodyMedium?.copyWith(
color: Theme.of(context).colorScheme.onSurface,
- )),
+ ),
+ ),
),
),
),
diff --git a/comwell_key_app/pubspec.yaml b/comwell_key_app/pubspec.yaml
index f6c33b89..d2240940 100644
--- a/comwell_key_app/pubspec.yaml
+++ b/comwell_key_app/pubspec.yaml
@@ -8,6 +8,9 @@ environment:
dependencies:
flutter:
sdk: flutter
+ flutter_localizations:
+ sdk: flutter
+ intl: any
seos_mobile_keys_plugin:
path: ../mobilekeys_sdk_plugin
payment_plugin:
@@ -68,8 +71,7 @@ dependencies:
internet_connection_checker_plus: ^2.9.1+2
app_tracking_transparency: ^2.0.6+1
webview_flutter: ^4.13.1
- flutter_localization: ^0.3.3
- intl: any
+
dependency_overrides:
#Remove override when slider button updates