From 76a421bba5df992a6dc892a2f266f37070182237 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Tue, 2 Apr 2024 17:14:17 +0300 Subject: [PATCH] profile(refactor): New functionalityy for settings screen --- lib/presentation/auth/auth_screen/auth_screen.dart | 12 ++++++++++++ .../diary_edit_screen/bloc/diary_edit_bloc.dart | 1 + .../my_profile_screen/bloc/my_profile_bloc.dart | 6 ++++-- .../my_profile_screen/my_settings_screen.dart | 6 +++--- lib/widgets/custom_expandable_list.dart | 4 ++-- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/presentation/auth/auth_screen/auth_screen.dart b/lib/presentation/auth/auth_screen/auth_screen.dart index 93d38b46..1ac19724 100644 --- a/lib/presentation/auth/auth_screen/auth_screen.dart +++ b/lib/presentation/auth/auth_screen/auth_screen.dart @@ -71,6 +71,12 @@ class AuthScreen extends StatelessWidget { EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: onTapDiaryTest(context)), + NextStepButton( + text: "Тест профиля".toUpperCase(), + margin: + EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapProfileTest(context)), BlocBuilder(builder: (context, state) { return NextStepButton( text: "authentificate".tr.toUpperCase(), @@ -156,6 +162,12 @@ class AuthScreen extends StatelessWidget { }; } + onTapProfileTest(BuildContext context) { + return () { + Navigator.pushNamed(context, AppRoutes.mySettings); + }; + } + onTapNoAccount(BuildContext context) { return () { Navigator.pushNamed(context, AppRoutes.languageSelectScreen); diff --git a/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart b/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart index 72f012d7..82bafe8a 100644 --- a/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart +++ b/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart @@ -451,6 +451,7 @@ class DiaryEditBloc extends Bloc { (meal) => meal['type'] == event.value.id, orElse: () => null); + print(meal); int? id = event.value.id; DiaryEditLoadedState updatedState = currentState.copyWith( currentMeal: event.value, 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 03ae81b8..dad1ce9a 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 @@ -21,8 +21,10 @@ class MyProfileBloc extends Bloc { Emitter emit, ) async { try { - final box = await Hive.openBox('token'); - final token = box.get('token'); + /*final box = await Hive.openBox('token'); + final token = box.get('token');*/ + final token = + "9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1neAggmpR2TidVGDPN34fa201a"; final response = await http.get( Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/index'), headers: { 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 a95b0434..923597a6 100644 --- a/lib/presentation/profile/my_profile_screen/my_settings_screen.dart +++ b/lib/presentation/profile/my_profile_screen/my_settings_screen.dart @@ -44,15 +44,15 @@ class MySettingsScreen extends StatelessWidget { _buildSetingsScreen(BuildContext context, MyProfileLoadedState state) { mediaQueryData = MediaQuery.of(context); - SafeArea( + return SafeArea( child: Scaffold( appBar: _buildAppBar(context, "my_settings".tr), body: Padding( padding: const EdgeInsets.all(16.0), child: ListView( children: [ - SectionTitle('Язык'), - LanguageDropdown(), + //SectionTitle('Язык'), + //LanguageDropdown(), SectionTitle('Уведомления'), NotificationSwitch('Уведомление об обновлениях'), NotificationSwitch('Напоминания о заполнении'), diff --git a/lib/widgets/custom_expandable_list.dart b/lib/widgets/custom_expandable_list.dart index f20ac19e..786ed6be 100644 --- a/lib/widgets/custom_expandable_list.dart +++ b/lib/widgets/custom_expandable_list.dart @@ -130,7 +130,7 @@ class _ExpandableListState extends State { decoration: InputDecoration(labelText: 'date_of_birth'.tr), controller: state.dateFormController, onTap: inputTime(context, state)), - DropdownButtonFormField( + /*DropdownButtonFormField( value: state.selectedCountry, hint: Text(state.selectedCountry ?? "Не выбрано"), onChanged: setCountry(state), @@ -153,7 +153,7 @@ class _ExpandableListState extends State { ); }).toList(), decoration: InputDecoration(labelText: 'city_of_living'.tr), - ), + ),*/ TextField( controller: state.weightFormController, decoration: InputDecoration(labelText: 'weight_measurements'.tr),