6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 3427e592
Changed files
comwell_key_app/lib/common/components/bottom_sheet_widget.dart | 1 - .../lib/profile/components/comwell_club_signup_bottom_sheet.dart | 1 - .../lib/profile_settings/components/address_bottom_sheet.dart | 4 ++-- .../lib/profile_settings/cubit/profile_settings_cubit.dart | 5 +++-- comwell_key_app/lib/profile_settings/profile_settings_page.dart | 2 +- .../lib/profile_settings/repostiory/profile_settings_repository.dart | 1 + comwell_key_app/lib/services/mappers/user_mapper.dart | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-)
Diff
diff --git a/comwell_key_app/lib/common/components/bottom_sheet_widget.dart b/comwell_key_app/lib/common/components/bottom_sheet_widget.dart
index 7109e3aa..9e0eced8 100644
--- a/comwell_key_app/lib/common/components/bottom_sheet_widget.dart
+++ b/comwell_key_app/lib/common/components/bottom_sheet_widget.dart
@@ -1,4 +1,3 @@
-import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:flutter/material.dart';
import 'package:snapping_sheet/snapping_sheet.dart';
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 e22fd08a..072380c0 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
@@ -3,7 +3,6 @@ import 'package:comwell_key_app/profile/cubit/profile_cubit.dart';
import 'package:comwell_key_app/profile/utils/constants.dart';
import 'package:comwell_key_app/profile/utils/urls.dart';
import 'package:comwell_key_app/profile_settings/components/comwell_text_field.dart';
-import 'package:comwell_key_app/profile_settings/components/date_time_picker.dart';
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';
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 67277a66..06f770e0 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
@@ -10,9 +10,11 @@ import 'package:go_router/go_router.dart';
class AddressBottomSheet extends StatefulWidget {
final User user;
+ final String selectedCountry;
const AddressBottomSheet({
required this.user,
+ required this.selectedCountry,
super.key,
});
@@ -35,8 +37,6 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
TextEditingController(text: widget.user.address.zipCode);
_cityController = TextEditingController(text: widget.user.address.city);
_selectedCountry = widget.user.address.country != '' ? widget.user.address.country : 'DK';
-
- print('selectedCountry: $_selectedCountry');
}
@override
diff --git a/comwell_key_app/lib/profile_settings/cubit/profile_settings_cubit.dart b/comwell_key_app/lib/profile_settings/cubit/profile_settings_cubit.dart
index 98f3b1ba..47615e1f 100644
--- a/comwell_key_app/lib/profile_settings/cubit/profile_settings_cubit.dart
+++ b/comwell_key_app/lib/profile_settings/cubit/profile_settings_cubit.dart
@@ -18,6 +18,7 @@ class ProfileSettingsCubit extends Cubit<ProfileSettingsState> {
final TextEditingController firstNameController = TextEditingController();
final TextEditingController lastNameController = TextEditingController();
final TextEditingController phoneNumberController = TextEditingController();
+ late String selectedCountry = '';
ProfileSettingsCubit(
{required this.profileRepository,
@@ -35,7 +36,8 @@ class ProfileSettingsCubit extends Cubit<ProfileSettingsState> {
firstNameController.text = user.firstName;
lastNameController.text = user.lastName;
phoneNumberController.text = user.phoneNumber;
-
+ selectedCountry = user.addressCountry != '' ? user.addressCountry : 'DK';
+
emit(ProfileSettingsState(isLoading: false, user: user, error: null));
} catch (e) {
emit(ProfileSettingsState(isLoading: false, user: null, error: Error()));
@@ -66,7 +68,6 @@ class ProfileSettingsCubit extends Cubit<ProfileSettingsState> {
void updateAddress(Address address) {
final updatedUser = state.user!.copyWith(address: address);
-
emit(state.userLoaded(user: updatedUser));
}
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 e76ef81d..34bcbf2b 100644
--- a/comwell_key_app/lib/profile_settings/profile_settings_page.dart
+++ b/comwell_key_app/lib/profile_settings/profile_settings_page.dart
@@ -123,7 +123,7 @@ class ProfileSettingsPage extends StatelessWidget {
isScrollControlled: true,
backgroundColor: Colors.white,
builder: (context) =>
- AddressBottomSheet(user: state.user!));
+ AddressBottomSheet(user: state.user!, selectedCountry: cubit.selectedCountry));
if (response is Address) {
cubit.updateAddress(response);
diff --git a/comwell_key_app/lib/profile_settings/repostiory/profile_settings_repository.dart b/comwell_key_app/lib/profile_settings/repostiory/profile_settings_repository.dart
index 7365106c..04a351ca 100644
--- a/comwell_key_app/lib/profile_settings/repostiory/profile_settings_repository.dart
+++ b/comwell_key_app/lib/profile_settings/repostiory/profile_settings_repository.dart
@@ -19,6 +19,7 @@ class ProfileSettingsRepository {
final data = response.data as Json;
final responseDto = UserDto.fromJson(data);
final user = responseDto.toUser();
+
await db.userDAO.saveUser(responseDto);
return user;
}
diff --git a/comwell_key_app/lib/services/mappers/user_mapper.dart b/comwell_key_app/lib/services/mappers/user_mapper.dart
index 4f3e3adc..7aac16c1 100644
--- a/comwell_key_app/lib/services/mappers/user_mapper.dart
+++ b/comwell_key_app/lib/services/mappers/user_mapper.dart
@@ -44,7 +44,7 @@ extension UserDtoMapper on User {
addressStreet: address.street,
addressZip: address.zipCode,
addressCity: address.city,
- addressCountry: addressCountry,
+ addressCountry: address.country,
points: points,
locale: 'en',
);