diff --git a/lib/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart b/lib/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart index 88b64681..9b9e3d47 100644 --- a/lib/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart +++ b/lib/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart @@ -74,6 +74,7 @@ class MyProfileBloc extends Bloc { allergiesFormController: currentState.allergiesFormController, pillsFormController: currentState.pillsFormController, sportsFormController: currentState.sportsFormController, + dateFormController: currentState.dateFormController, )); } else { print(data['userDetails']); @@ -115,6 +116,8 @@ class MyProfileBloc extends Bloc { text: data['userDetails']['about_taking_pils']), sportsFormController: TextEditingController( text: data['userDetails']['about_sport_hobbies']), + dateFormController: + TextEditingController(text: data['userDetails']['birthdate']), )); } } else { diff --git a/lib/presentation/profile/my_profile_screen/bloc/my_profile_state.dart b/lib/presentation/profile/my_profile_screen/bloc/my_profile_state.dart index 32b5b349..ae748d6e 100644 --- a/lib/presentation/profile/my_profile_screen/bloc/my_profile_state.dart +++ b/lib/presentation/profile/my_profile_screen/bloc/my_profile_state.dart @@ -35,6 +35,7 @@ class MyProfileLoadedState extends MyProfileState { this.firstNameFormController, this.lastNameFormController, this.countryFormController, + this.dateFormController, this.cityFormController, this.heightFormController, this.weightFormController, @@ -63,6 +64,7 @@ class MyProfileLoadedState extends MyProfileState { TextEditingController? firstNameFormController; TextEditingController? lastNameFormController; TextEditingController? countryFormController; + TextEditingController? dateFormController; TextEditingController? cityFormController; TextEditingController? heightFormController; TextEditingController? upPressureFormController; @@ -90,6 +92,7 @@ class MyProfileLoadedState extends MyProfileState { firstNameFormController, lastNameFormController, countryFormController, + dateFormController, cityFormController, heightFormController, weightFormController, @@ -116,6 +119,7 @@ class MyProfileLoadedState extends MyProfileState { TextEditingController? firstNameFormController, TextEditingController? lastNameFormController, TextEditingController? countryFormController, + TextEditingController? dateFormController, TextEditingController? cityFormController, TextEditingController? heightFormController, TextEditingController? weightFormeFormController, @@ -152,6 +156,7 @@ class MyProfileLoadedState extends MyProfileState { lastNameFormController ?? this.lastNameFormController, countryFormController: countryFormController ?? this.countryFormController, + dateFormController: dateFormController ?? this.dateFormController, cityFormController: cityFormController ?? this.cityFormController, heightFormController: heightFormController ?? this.heightFormController, weightFormController: weightFormController ?? this.weightFormController, diff --git a/lib/presentation/profile/my_profile_screen/my_settings_screen.dart b/lib/presentation/profile/my_profile_screen/my_settings_screen.dart index f87a3d19..7b009b6d 100644 --- a/lib/presentation/profile/my_profile_screen/my_settings_screen.dart +++ b/lib/presentation/profile/my_profile_screen/my_settings_screen.dart @@ -8,6 +8,7 @@ import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:eatvio_app/widgets/custom_bottom_bar.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; +import 'package:intl/intl.dart'; import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:flutter/material.dart'; @@ -315,9 +316,23 @@ class _ExpandableListState extends State { decoration: InputDecoration(labelText: 'last_name'.tr), ), TextField( - decoration: InputDecoration(labelText: 'date_of_birth'.tr), - onTap: () {}, - ), + decoration: InputDecoration(labelText: 'date_of_birth'.tr), + controller: state.dateFormController, + onTap: () { + showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(1900), + lastDate: DateTime.now(), + ).then((selectedDate) { + if (selectedDate != null) { + setState(() { + state.dateFormController!.text = + DateFormat('yyyy-MM-dd').format(selectedDate); + }); + } + }); + }), TextField( controller: state.countryFormController, decoration: InputDecoration(labelText: 'country'.tr),