From e180ff16b60cb91222ea35a1fde020c7632f9ffb Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 9 Jul 2024 17:50:32 +0300 Subject: [PATCH 01/21] refactor(all): refactor --- lib/app_router.dart | 41 +- .../initialization_cubit.dart | 84 ++-- .../chat/presentation/pages/chat_screen.dart | 2 - .../chat_select_screen.dart | 30 +- .../models/feed_blog_post_settings_model.dart | 15 + ...feed_blog_post_settings_model.freezed.dart | 175 ++++++++ .../feed_blog_post_settings_model.g.dart | 21 + .../feed/repositories/feed_repository.dart | 2 +- lib/features/feed/services/feed_service.dart | 6 +- .../feed/services/feed_service.g.dart | 9 +- lib/main.dart | 1 - .../auth/auth_screen/auth_screen.dart | 2 +- .../bloc/my_profile_bloc.dart | 28 +- .../my_profile_screen/my_profile_screen.dart | 382 ++++++++++-------- .../bloc/recipe_edit_bloc.dart | 42 +- .../bloc/recipe_select_bloc.dart | 26 +- .../bloc/recipe_select_state.dart | 6 +- .../recipe_select_screen.dart | 1 + .../bloc/recipe_show_bloc.dart | 49 ++- .../additional_information_screen.dart | 166 +++++--- .../allergies_screen/allergies_screen.dart | 116 +++--- .../blood_pressure_screen.dart | 255 +++++++----- .../body_circumferences_screen.dart | 137 ++++--- .../city_of_living_screen.dart | 124 +++--- .../credentials_screen.dart | 143 ++++--- .../date_of_birth_screen.dart | 94 +++-- .../favorite_foods_screen.dart | 151 ++++--- .../favorite_sports_screen.dart | 124 +++--- .../gender_screen/gender_screen.dart | 70 ++-- .../height_screen/height_screen.dart | 42 +- .../language_select_screen.dart | 45 ++- .../medicine_intake_screen.dart | 136 ++++--- .../registration/name_screen/name_screen.dart | 125 +++--- .../weight_screen/weight_screen.dart | 42 +- lib/theme/theme_helper.dart | 113 +++--- lib/widgets/custom_navigation_menu_item.dart | 8 +- pubspec.yaml | 16 +- 37 files changed, 1706 insertions(+), 1123 deletions(-) create mode 100644 lib/features/feed/models/feed_blog_post_settings_model.dart create mode 100644 lib/features/feed/models/feed_blog_post_settings_model.freezed.dart create mode 100644 lib/features/feed/models/feed_blog_post_settings_model.g.dart diff --git a/lib/app_router.dart b/lib/app_router.dart index 02c517f7..20905a65 100644 --- a/lib/app_router.dart +++ b/lib/app_router.dart @@ -48,7 +48,6 @@ class AppRouter { name: 'authScreen', redirect: (context, state) async { if (await TokenStorage.haveTokenInStorage()) { - await context.read().runInitialization(); return '/my-profile-screen'; } return null; @@ -106,29 +105,31 @@ class AppRouter { builder: (context, state) => BloodPressureScreen.builder(context, state.extra), routes: [ GoRoute( - path: 'favorite-sports-screen', - name: 'favoriteSportsScreen', - builder: (context, state) => FavoriteSportsScreen.builder(context, state.extra), + name: 'allergiesScreen', + path: 'allergiesScreen', + builder: (context, state) => AllergiesScreen.builder(context, state.extra), routes: [ GoRoute( - name: 'allergiesScreen', - path: 'allergiesScreen', - builder: (context, state) => AllergiesScreen.builder(context, state.extra), + name: 'medicineIntakeScreen', + path: 'medicine-intake-screen', + builder: (context, state) => MedicineIntakeScreen.builder(context, state.extra), routes: [ GoRoute( - name: 'medicineIntakeScreen', - path: 'medicine-intake-screen', - builder: (context, state) => MedicineIntakeScreen.builder(context, state.extra), - ), - GoRoute( - name: 'favoriteFoodsScreen', - path: 'favorite-foods-screen', - builder: (context, state) => FavoriteFoodsScreen.builder(context, state.extra), + path: 'favorite-sports-screen', + name: 'favoriteSportsScreen', + builder: (context, state) => FavoriteSportsScreen.builder(context, state.extra), routes: [ GoRoute( - path: 'additional-information-screen', - name: 'additionalInformationScreen', - builder: (context, state) => AdditionalInformationScreen.builder(context, state.extra), + name: 'favoriteFoodsScreen', + path: 'favorite-foods-screen', + builder: (context, state) => FavoriteFoodsScreen.builder(context, state.extra), + routes: [ + GoRoute( + path: 'additional-information-screen', + name: 'additionalInformationScreen', + builder: (context, state) => AdditionalInformationScreen.builder(context, state.extra), + ), + ], ), ], ), @@ -166,6 +167,10 @@ class AppRouter { GoRoute( path: '/my-profile-screen', name: 'myProfileScreen', + redirect: (context, state) async { + await context.read().runInitialization(); + return null; + }, builder: (context, state) => MyProfileScreen(), ), GoRoute( diff --git a/lib/core/initialization_cubit/initialization_cubit.dart b/lib/core/initialization_cubit/initialization_cubit.dart index a7034e21..2052a25a 100644 --- a/lib/core/initialization_cubit/initialization_cubit.dart +++ b/lib/core/initialization_cubit/initialization_cubit.dart @@ -9,6 +9,7 @@ import 'package:eatvio_app/locator_service.dart'; class InitializationCubit extends Cubit { final ChatRepository chatRepository; + bool wasInitializated = false; InitializationCubit({required this.chatRepository}) : super(const InitializationState.loading()); @@ -49,48 +50,51 @@ class InitializationCubit extends Cubit { } Future runInitialization() async { - try { - await TokenStorage.haveTokenInStorage(); - final wsUrl = await chatRepository.getWebsocket(); - final options = PusherChannelsOptions.fromHost( - scheme: 'wss', - key: wsUrl.key, - host: wsUrl.host, - shouldSupplyMetadataQueries: true, - metadata: PusherChannelsOptionsMetadata.byDefault(), - port: 443, - ); - final client = PusherChannelsClient.websocket( - options: options, - connectionErrorHandler: (exception, trace, refresh) { - refresh(); - }, - minimumReconnectDelayDuration: const Duration( - seconds: 1, - ), - defaultActivityDuration: const Duration( - seconds: 120, - ), - activityDurationOverride: const Duration( - seconds: 120, - ), - waitForPongDuration: const Duration( - seconds: 30, - ), - ); - await client.connect(); + if (!wasInitializated) { + wasInitializated = true; + try { + await TokenStorage.haveTokenInStorage(); + final wsUrl = await chatRepository.getWebsocket(); + final options = PusherChannelsOptions.fromHost( + scheme: 'wss', + key: wsUrl.key, + host: wsUrl.host, + shouldSupplyMetadataQueries: true, + metadata: PusherChannelsOptionsMetadata.byDefault(), + port: 443, + ); + final client = PusherChannelsClient.websocket( + options: options, + connectionErrorHandler: (exception, trace, refresh) { + refresh(); + }, + minimumReconnectDelayDuration: const Duration( + seconds: 1, + ), + defaultActivityDuration: const Duration( + seconds: 120, + ), + activityDurationOverride: const Duration( + seconds: 120, + ), + waitForPongDuration: const Duration( + seconds: 30, + ), + ); + await client.connect(); - await subscribeNotifications(wsUrl.userId, client); - await subscribeChatMessages(wsUrl.userId, client); + await subscribeNotifications(wsUrl.userId, client); + await subscribeChatMessages(wsUrl.userId, client); - emit(InitializationState.success( - client: client, - )); - } catch (e) { - emit(InitializationState.error( - errorMessage: e.toString(), - )); - rethrow; + emit(InitializationState.success( + client: client, + )); + } catch (e) { + emit(InitializationState.error( + errorMessage: e.toString(), + )); + rethrow; + } } } } diff --git a/lib/features/chat/presentation/pages/chat_screen.dart b/lib/features/chat/presentation/pages/chat_screen.dart index d3ecef8b..208ff966 100644 --- a/lib/features/chat/presentation/pages/chat_screen.dart +++ b/lib/features/chat/presentation/pages/chat_screen.dart @@ -179,7 +179,6 @@ class _ChatScreenState extends State { keyboardType: TextInputType.multiline, style: TextStyle( fontSize: 16, - fontFamily: 'Mulish', fontWeight: FontWeight.w400, color: Colors.black, ), @@ -188,7 +187,6 @@ class _ChatScreenState extends State { hintText: 'Сообщение', hintStyle: TextStyle( fontSize: 16, - fontFamily: 'Mulish', fontWeight: FontWeight.w400, color: Color(0xFFAEAEB2), ), diff --git a/lib/features/chat/presentation/pages/chat_select_screen/chat_select_screen.dart b/lib/features/chat/presentation/pages/chat_select_screen/chat_select_screen.dart index d98ea7ff..dc3f3d29 100644 --- a/lib/features/chat/presentation/pages/chat_select_screen/chat_select_screen.dart +++ b/lib/features/chat/presentation/pages/chat_select_screen/chat_select_screen.dart @@ -42,18 +42,24 @@ class ChatSelectScreen extends StatelessWidget { body: NestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return [ - SliverAppBar( - automaticallyImplyLeading: false, - stretchTriggerOffset: 1, - forceMaterialTransparency: true, - floating: true, - snap: true, - title: CustomSearchView( - controller: state.searchController, - fillColor: Color(0xFFF0F2F5), - hintText: "Поиск", - hintStyle: TextStyle( - color: Color(0xFF7B8794), + SliverPadding( + padding: const EdgeInsets.only(top: 8), + sliver: SliverAppBar( + automaticallyImplyLeading: false, + stretchTriggerOffset: 1, + forceMaterialTransparency: true, + floating: true, + snap: true, + title: Padding( + padding: const EdgeInsets.only(top: 8), + child: CustomSearchView( + controller: state.searchController, + fillColor: Color(0xFFF0F2F5), + hintText: "Поиск", + hintStyle: TextStyle( + color: Color(0xFF7B8794), + ), + ), ), ), ), diff --git a/lib/features/feed/models/feed_blog_post_settings_model.dart b/lib/features/feed/models/feed_blog_post_settings_model.dart new file mode 100644 index 00000000..fa72e97e --- /dev/null +++ b/lib/features/feed/models/feed_blog_post_settings_model.dart @@ -0,0 +1,15 @@ +import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'feed_blog_post_settings_model.freezed.dart'; +part 'feed_blog_post_settings_model.g.dart'; + +@freezed +class FeedBlogPostSettingsModel with _$FeedBlogPostSettingsModel { + const factory FeedBlogPostSettingsModel({ + @JsonKey(name: 'data') + required List feedBlogPostList, + }) = _FeedBlogPostSettingsModel; + + factory FeedBlogPostSettingsModel.fromJson(Map json) => _$FeedBlogPostSettingsModelFromJson(json); +} diff --git a/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart b/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart new file mode 100644 index 00000000..7fd8a12e --- /dev/null +++ b/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart @@ -0,0 +1,175 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'feed_blog_post_settings_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +FeedBlogPostSettingsModel _$FeedBlogPostSettingsModelFromJson( + Map json) { + return _FeedBlogPostSettingsModel.fromJson(json); +} + +/// @nodoc +mixin _$FeedBlogPostSettingsModel { + @JsonKey(name: 'data') + List get feedBlogPostList => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $FeedBlogPostSettingsModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $FeedBlogPostSettingsModelCopyWith<$Res> { + factory $FeedBlogPostSettingsModelCopyWith(FeedBlogPostSettingsModel value, + $Res Function(FeedBlogPostSettingsModel) then) = + _$FeedBlogPostSettingsModelCopyWithImpl<$Res, FeedBlogPostSettingsModel>; + @useResult + $Res call({@JsonKey(name: 'data') List feedBlogPostList}); +} + +/// @nodoc +class _$FeedBlogPostSettingsModelCopyWithImpl<$Res, + $Val extends FeedBlogPostSettingsModel> + implements $FeedBlogPostSettingsModelCopyWith<$Res> { + _$FeedBlogPostSettingsModelCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? feedBlogPostList = null, + }) { + return _then(_value.copyWith( + feedBlogPostList: null == feedBlogPostList + ? _value.feedBlogPostList + : feedBlogPostList // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$FeedBlogPostSettingsModelImplCopyWith<$Res> + implements $FeedBlogPostSettingsModelCopyWith<$Res> { + factory _$$FeedBlogPostSettingsModelImplCopyWith( + _$FeedBlogPostSettingsModelImpl value, + $Res Function(_$FeedBlogPostSettingsModelImpl) then) = + __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({@JsonKey(name: 'data') List feedBlogPostList}); +} + +/// @nodoc +class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res> + extends _$FeedBlogPostSettingsModelCopyWithImpl<$Res, + _$FeedBlogPostSettingsModelImpl> + implements _$$FeedBlogPostSettingsModelImplCopyWith<$Res> { + __$$FeedBlogPostSettingsModelImplCopyWithImpl( + _$FeedBlogPostSettingsModelImpl _value, + $Res Function(_$FeedBlogPostSettingsModelImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? feedBlogPostList = null, + }) { + return _then(_$FeedBlogPostSettingsModelImpl( + feedBlogPostList: null == feedBlogPostList + ? _value._feedBlogPostList + : feedBlogPostList // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { + const _$FeedBlogPostSettingsModelImpl( + {@JsonKey(name: 'data') + required final List feedBlogPostList}) + : _feedBlogPostList = feedBlogPostList; + + factory _$FeedBlogPostSettingsModelImpl.fromJson(Map json) => + _$$FeedBlogPostSettingsModelImplFromJson(json); + + final List _feedBlogPostList; + @override + @JsonKey(name: 'data') + List get feedBlogPostList { + if (_feedBlogPostList is EqualUnmodifiableListView) + return _feedBlogPostList; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_feedBlogPostList); + } + + @override + String toString() { + return 'FeedBlogPostSettingsModel(feedBlogPostList: $feedBlogPostList)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$FeedBlogPostSettingsModelImpl && + const DeepCollectionEquality() + .equals(other._feedBlogPostList, _feedBlogPostList)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> + get copyWith => __$$FeedBlogPostSettingsModelImplCopyWithImpl< + _$FeedBlogPostSettingsModelImpl>(this, _$identity); + + @override + Map toJson() { + return _$$FeedBlogPostSettingsModelImplToJson( + this, + ); + } +} + +abstract class _FeedBlogPostSettingsModel implements FeedBlogPostSettingsModel { + const factory _FeedBlogPostSettingsModel( + {@JsonKey(name: 'data') + required final List feedBlogPostList}) = + _$FeedBlogPostSettingsModelImpl; + + factory _FeedBlogPostSettingsModel.fromJson(Map json) = + _$FeedBlogPostSettingsModelImpl.fromJson; + + @override + @JsonKey(name: 'data') + List get feedBlogPostList; + @override + @JsonKey(ignore: true) + _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/features/feed/models/feed_blog_post_settings_model.g.dart b/lib/features/feed/models/feed_blog_post_settings_model.g.dart new file mode 100644 index 00000000..3f48be1b --- /dev/null +++ b/lib/features/feed/models/feed_blog_post_settings_model.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'feed_blog_post_settings_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$FeedBlogPostSettingsModelImpl _$$FeedBlogPostSettingsModelImplFromJson( + Map json) => + _$FeedBlogPostSettingsModelImpl( + feedBlogPostList: (json['data'] as List) + .map((e) => FeedBlogPostModel.fromJson(e as Map)) + .toList(), + ); + +Map _$$FeedBlogPostSettingsModelImplToJson( + _$FeedBlogPostSettingsModelImpl instance) => + { + 'data': instance.feedBlogPostList, + }; diff --git a/lib/features/feed/repositories/feed_repository.dart b/lib/features/feed/repositories/feed_repository.dart index 50799a01..319ac32e 100644 --- a/lib/features/feed/repositories/feed_repository.dart +++ b/lib/features/feed/repositories/feed_repository.dart @@ -8,7 +8,7 @@ class FeedRepository { Future> getFeedBlogPostList() async { try { - return (await feedService.getBlocPostList()).entries.map((entry) => entry.value).toList(); + return (await feedService.getBlocPostList()).feedBlogPostList; } catch (e) { rethrow; } diff --git a/lib/features/feed/services/feed_service.dart b/lib/features/feed/services/feed_service.dart index d4f728fb..a9610378 100644 --- a/lib/features/feed/services/feed_service.dart +++ b/lib/features/feed/services/feed_service.dart @@ -1,5 +1,5 @@ import 'package:dio/dio.dart'; -import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart'; +import 'package:eatvio_app/features/feed/models/feed_blog_post_settings_model.dart'; import 'package:retrofit/retrofit.dart'; part 'feed_service.g.dart'; @@ -8,6 +8,6 @@ part 'feed_service.g.dart'; abstract class FeedService { factory FeedService(Dio dio, {String baseUrl}) = _FeedService; - @GET('/feed/index') - Future> getBlocPostList(); + @GET('/blogPosts/index') + Future getBlocPostList(); } diff --git a/lib/features/feed/services/feed_service.g.dart b/lib/features/feed/services/feed_service.g.dart index 03aa2386..2ef83811 100644 --- a/lib/features/feed/services/feed_service.g.dart +++ b/lib/features/feed/services/feed_service.g.dart @@ -19,20 +19,20 @@ class _FeedService implements FeedService { String? baseUrl; @override - Future> getBlocPostList() async { + Future getBlocPostList() async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; final _result = await _dio.fetch>( - _setStreamType>(Options( + _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) .compose( _dio.options, - '/feed/index', + '/blogPosts/index', queryParameters: queryParameters, data: _data, ) @@ -41,8 +41,7 @@ class _FeedService implements FeedService { _dio.options.baseUrl, baseUrl, )))); - var _value = _result.data!.map((k, dynamic v) => - MapEntry(k, FeedBlogPostModel.fromJson(v as Map))); + final _value = FeedBlogPostSettingsModel.fromJson(_result.data!); return _value; } diff --git a/lib/main.dart b/lib/main.dart index e73bd429..7faced2a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -47,7 +47,6 @@ class MyApp extends StatelessWidget { BlocProvider(create: (context) => sl()), BlocProvider(create: (context) => sl()), BlocProvider(create: (context) => sl()), - BlocProvider(create: (context) => ThemeBloc(ThemeState(themeType: PrefUtils().getThemeData()))), BlocProvider(create: (context) => sl()..loadFeedBlogPostList()), BlocProvider(create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent())), diff --git a/lib/presentation/auth/auth_screen/auth_screen.dart b/lib/presentation/auth/auth_screen/auth_screen.dart index 4a74ba36..c435f2db 100644 --- a/lib/presentation/auth/auth_screen/auth_screen.dart +++ b/lib/presentation/auth/auth_screen/auth_screen.dart @@ -107,7 +107,7 @@ class AuthScreen extends StatelessWidget { final box = await Hive.openBox('token'); final token = res['token']; box.put('token', token); - TokenStorage.saveTokenInStorage(token); + await TokenStorage.saveTokenInStorage(token); GoRouter.of(context).go('/my-profile-screen'); } else { showDialog( 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 806768cf..af1c5581 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,20 +74,16 @@ class MyProfileBloc extends Bloc { waistCircumferenceController: TextEditingController(), hipCircumferenceController: TextEditingController(), weightController: TextEditingController(), - chestCircumferenceFormController: - currentState.chestCircumferenceFormController, - waistCircumferenceFormController: - currentState.waistCircumferenceFormController, - hipCircumferenceFormController: - currentState.hipCircumferenceFormController, + chestCircumferenceFormController: currentState.chestCircumferenceFormController, + waistCircumferenceFormController: currentState.waistCircumferenceFormController, + hipCircumferenceFormController: currentState.hipCircumferenceFormController, firstNameFormController: currentState.firstNameFormController, lastNameFormController: currentState.lastNameFormController, countryFormController: currentState.countryFormController, cityFormController: currentState.cityFormController, heightFormController: currentState.heightFormController, upPressureFormController: currentState.upPressureFormController, - downPressureFormController: - currentState.downPressureFormController, + downPressureFormController: currentState.downPressureFormController, allergiesFormController: currentState.allergiesFormController, pillsFormController: currentState.pillsFormController, favoriteFormController: currentState.favoriteFormController, @@ -181,8 +177,7 @@ class MyProfileBloc extends Bloc { waistCircumferenceController: TextEditingController(), hipCircumferenceController: TextEditingController(), hypoFormController: data['userDetails']['has_hypo'].toString(), - hyperFormController: - data['userDetails']['has_hyper'].toString(), + hyperFormController: data['userDetails']['has_hyper'].toString(), chestCircumferenceFormController: TextEditingController( text: data['userDetails']['chest_circumference']?.toString(), ), @@ -201,12 +196,9 @@ class MyProfileBloc extends Bloc { firstNameFormController: TextEditingController( text: data['userDetails']['first_name'], ), - lastNameFormController: TextEditingController( - text: data['userDetails']['last_name']), - countryFormController: - TextEditingController(text: data['userDetails']['country']), - cityFormController: - TextEditingController(text: data['userDetails']['city']), + lastNameFormController: TextEditingController(text: data['userDetails']['last_name']), + countryFormController: TextEditingController(text: data['userDetails']['country']), + cityFormController: TextEditingController(text: data['userDetails']['city']), heightFormController: TextEditingController( text: data['userDetails']['height']?.toString(), ), @@ -234,8 +226,7 @@ class MyProfileBloc extends Bloc { additionalFormController: TextEditingController( text: data['userDetails']['additional_info'], ), - dateFormController: TextEditingController( - text: data['userDetails']['birthdate']), + dateFormController: TextEditingController(text: data['userDetails']['birthdate']), selectedCity: data['userDetails']['city'], selectedCountry: data['userDetails']['country'], selectedActivity: determineActivityLevel( @@ -282,6 +273,7 @@ class MyProfileBloc extends Bloc { var currentState = state as MyProfileLoadedState; await uploadImageToServer(event.image.path, currentState.token); + this.add(MyProfileInitialEvent()); } } diff --git a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart index 8df32943..9aeb496e 100644 --- a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart +++ b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart @@ -96,6 +96,27 @@ class MyProfileScreen extends StatelessWidget { ), SizedBox(height: 15.v), Container( + padding: EdgeInsets.symmetric( + horizontal: 24.h, + vertical: 12.v, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.all(Radius.circular(12)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 2, + blurRadius: 5, + offset: Offset(0, 3), + ), + ], + ), + child: _buildCarousel(context, state), + ), + SizedBox(height: 15.v), + if (!state.plans!.isEmpty) + Container( padding: EdgeInsets.symmetric( horizontal: 24.h, vertical: 12.v, @@ -112,32 +133,13 @@ class MyProfileScreen extends StatelessWidget { ), ], ), - child: _buildCarousel(context, state),), - SizedBox(height: 15.v), - if (!state.plans!.isEmpty) - Container( - padding: EdgeInsets.symmetric( - horizontal: 24.h, - vertical: 12.v, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], - ), - child: _buildPlans( - context, - state.plans?.map((plan) => plan['name']).toList(), - state.plans?.map((plan) => plan['image']).toList(), - state.plans?.map((plan) => plan['state']).toList(), - ),), + child: _buildPlans( + context, + state.plans?.map((plan) => plan['name']).toList(), + state.plans?.map((plan) => plan['image']).toList(), + state.plans?.map((plan) => plan['state']).toList(), + ), + ), SizedBox(height: 5.v), ], ), @@ -176,11 +178,9 @@ class MyProfileScreen extends StatelessWidget { addImage(BuildContext context) async { final picker = ImagePicker(); - List? images = await picker.pickMultiImage(); - if (images.isNotEmpty) { - for (var image in images) { - context.read().add(UploadAvatar(image)); - } + XFile? image = await picker.pickImage(source: ImageSource.gallery); + if (image != null) { + context.read().add(UploadAvatar(image)); } } @@ -199,8 +199,9 @@ class MyProfileScreen extends StatelessWidget { switch (chartType) { case 1: // График веса return GestureDetector( - onTap: () => _editWeight(context, state), - child: Column(children: [ + onTap: () => _editWeight(context, state), + child: Column( + children: [ Text( "weight_chart".tr, style: CustomTextStyles.titleMediumBlack.copyWith( @@ -213,26 +214,34 @@ class MyProfileScreen extends StatelessWidget { state.chartPoints?.values.map((e) => e['weight']).toList().map((i) => i.toDouble()).toList() ?? [0.0, 0.0, 0.0, 0.0], state.chartDates, ), - ],),); - case 2: // График ИМТ - return Column(children: [ - Text( - "bodymass_chart".tr, - style: CustomTextStyles.titleMediumBlack.copyWith( - color: appTheme.black900, - ), + ], ), - SizedBox(height: 50.v), - _buildChart( + ); + case 2: // График ИМТ + return Column( + children: [ + Text( + "bodymass_chart".tr, + style: CustomTextStyles.titleMediumBlack.copyWith( + color: appTheme.black900, + ), + ), + SizedBox(height: 50.v), + _buildChart( context, - _bodyMassIndex(state.chartPoints?.values.map((e) => e['weight']).toList().map((i) => i.toDouble()).toList() ?? [0.0, 0.0, 0.0, 0.0], - state.userDetails?['height'].toInt() ?? 160,), - state.chartDates,), - ],); + _bodyMassIndex( + state.chartPoints?.values.map((e) => e['weight']).toList().map((i) => i.toDouble()).toList() ?? [0.0, 0.0, 0.0, 0.0], + state.userDetails?['height'].toInt() ?? 160, + ), + state.chartDates, + ), + ], + ); case 3: //График обхватов return GestureDetector( - onTap: () => _editCircumference(context, state), - child: Column(children: [ + onTap: () => _editCircumference(context, state), + child: Column( + children: [ Text( "circumferences_chart".tr, style: CustomTextStyles.titleMediumBlack.copyWith( @@ -242,7 +251,9 @@ class MyProfileScreen extends StatelessWidget { SizedBox(height: 30.v), _buildCircumferenceChart(context, state.circumferences, state.chartDates), _buildChartLegend(), - ],),); + ], + ), + ); default: return Text('text', style: TextStyle(fontSize: 16.0)); } @@ -636,79 +647,108 @@ class MyProfileScreen extends StatelessWidget { /// Section Widget _buildPlans(BuildContext context, List? plans, List? imagePaths, List? states) { return Padding( - padding: EdgeInsets.only(left: 7.h), - child: Column(children: [ + padding: EdgeInsets.only(left: 7.h), + child: Column( + children: [ Padding( - padding: EdgeInsets.only(left: 15.h), - child: Text("plans_complete".tr, style: CustomTextStyles.titleMediumBlack.copyWith(color: appTheme.black900)),), + padding: EdgeInsets.only(left: 15.h), + child: Text("plans_complete".tr, style: CustomTextStyles.titleMediumBlack.copyWith(color: appTheme.black900)), + ), SizedBox(height: 5.v), Container( - decoration: AppDecoration.outlineBlueGray.copyWith(borderRadius: BorderRadiusStyle.roundedBorder5), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + decoration: AppDecoration.outlineBlueGray.copyWith(borderRadius: BorderRadiusStyle.roundedBorder5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ SizedBox( - height: 105.v, - width: 343.h, - child: Stack(alignment: Alignment.bottomCenter, children: [ + height: 105.v, + width: 343.h, + child: Stack( + alignment: Alignment.bottomCenter, + children: [ Align( - alignment: Alignment.topCenter, - child: ListView.builder( - itemCount: plans?.length ?? 0, - itemBuilder: (context, i) { - String state = states?[i]; - var boxColor = appTheme.greenA700; - switch (states?[i]) { - case 'active': - boxColor = appTheme.greenA700; - break; - case 'archived': // График ИМТ - boxColor = appTheme.gray400; - break; - case 'draft': - boxColor = appTheme.deepOrange900; - break; - case 'in_progress': //График обхватов - boxColor = appTheme.lightGreen300; - break; - } - return SizedBox( - height: 40.v, - width: 343.h, - child: Stack(alignment: Alignment.bottomRight, children: [ - Align( - alignment: Alignment.topCenter, - child: Container( - margin: EdgeInsets.only(bottom: 11.v), - padding: EdgeInsets.symmetric(horizontal: 6.h, vertical: 4.v), - decoration: AppDecoration.fillGray.copyWith(borderRadius: BorderRadiusStyle.roundedBorder5), - child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Padding( - padding: EdgeInsets.only(bottom: 1.v), - child: Text(plans![i], style: CustomTextStyles.titleSmallBluegray800Bold),), - Container( - height: 19.v, - width: 100.h, - decoration: BoxDecoration(color: boxColor, borderRadius: BorderRadius.circular(5.h)),), - ],),),), - Align( - alignment: Alignment.center, - child: Container( - margin: EdgeInsets.only(bottom: 12.h), - child: Image.network( - dotenv.env['STORAGE_URL']! + imagePaths?[i], - height: 25.adaptSize, - width: 25.adaptSize, - ),),), - Align( - alignment: Alignment.bottomRight, - child: Container( - width: 70.h, - margin: EdgeInsets.only(bottom: 14.h, right: 22.h), - child: Text("$state".tr, maxLines: 3, overflow: TextOverflow.ellipsis, style: theme.textTheme.titleSmall),),), - ],),); - },),), - ],),), - ],),), - ],),); + alignment: Alignment.topCenter, + child: ListView.builder( + itemCount: plans?.length ?? 0, + itemBuilder: (context, i) { + String state = states?[i]; + var boxColor = appTheme.greenA700; + switch (states?[i]) { + case 'active': + boxColor = appTheme.greenA700; + break; + case 'archived': // График ИМТ + boxColor = appTheme.gray400; + break; + case 'draft': + boxColor = appTheme.deepOrange900; + break; + case 'in_progress': //График обхватов + boxColor = appTheme.lightGreen300; + break; + } + return SizedBox( + height: 40.v, + width: 343.h, + child: Stack( + alignment: Alignment.bottomRight, + children: [ + Align( + alignment: Alignment.topCenter, + child: Container( + margin: EdgeInsets.only(bottom: 11.v), + padding: EdgeInsets.symmetric(horizontal: 6.h, vertical: 4.v), + decoration: AppDecoration.fillGray.copyWith(borderRadius: BorderRadiusStyle.roundedBorder5), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 1.v), + child: Text(plans![i], style: CustomTextStyles.titleSmallBluegray800Bold), + ), + Container( + height: 19.v, + width: 100.h, + decoration: BoxDecoration(color: boxColor, borderRadius: BorderRadius.circular(5.h)), + ), + ], + ), + ), + ), + Align( + alignment: Alignment.center, + child: Container( + margin: EdgeInsets.only(bottom: 12.h), + child: Image.network( + dotenv.env['STORAGE_URL']! + imagePaths?[i], + height: 25.adaptSize, + width: 25.adaptSize, + ), + ), + ), + Align( + alignment: Alignment.bottomRight, + child: Container( + width: 70.h, + margin: EdgeInsets.only(bottom: 14.h, right: 22.h), + child: Text("$state".tr, maxLines: 3, overflow: TextOverflow.ellipsis, style: theme.textTheme.titleSmall), + ), + ), + ], + ), + ); + }, + ), + ), + ], + ), + ), + ], + ), + ), + ], + ), + ); } List _bodyMassIndex(List weightPoints, int height) { @@ -729,48 +769,49 @@ class MyProfileScreen extends StatelessWidget { title: Center(child: Text("Добавить замер")), content: SizedBox( - width: 200, // Ширина диалогового окна - height: 300, // Высота диалогового окна - child: ListView( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 5.v), - child: Text("chest_circumference".tr, style: theme.textTheme.bodyLarge), - ), - SizedBox(height: 5.v), - CustomTextFormField( - controller: state.chestCircumferenceController, - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, // Ограничение ввода только цифрами - ], - ), - Padding( - padding: EdgeInsets.symmetric(vertical: 15.v), - child: Text("waist_circumference".tr, style: theme.textTheme.bodyLarge), - ), - SizedBox(height: 5.v), - CustomTextFormField( - controller: state.waistCircumferenceController, - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, // Ограничение ввода только цифрами - ], - ), - Padding( - padding: EdgeInsets.symmetric(vertical: 15.v), - child: Text("hip_circumference".tr, style: theme.textTheme.bodyLarge), - ), - SizedBox(height: 5.v), - CustomTextFormField( - controller: state.hipCircumferenceController, - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, // Ограничение ввода только цифрами - ], - ), - ], - ),), + width: 200, // Ширина диалогового окна + height: 300, // Высота диалогового окна + child: ListView( + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 5.v), + child: Text("chest_circumference".tr, style: theme.textTheme.bodyLarge), + ), + SizedBox(height: 5.v), + CustomTextFormField( + controller: state.chestCircumferenceController, + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, // Ограничение ввода только цифрами + ], + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 15.v), + child: Text("waist_circumference".tr, style: theme.textTheme.bodyLarge), + ), + SizedBox(height: 5.v), + CustomTextFormField( + controller: state.waistCircumferenceController, + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, // Ограничение ввода только цифрами + ], + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 15.v), + child: Text("hip_circumference".tr, style: theme.textTheme.bodyLarge), + ), + SizedBox(height: 5.v), + CustomTextFormField( + controller: state.hipCircumferenceController, + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, // Ограничение ввода только цифрами + ], + ), + ], + ), + ), actions: [ TextButton( onPressed: onTapOk(context), @@ -778,10 +819,12 @@ class MyProfileScreen extends StatelessWidget { ), TextButton( onPressed: sendEditData(state, context), - child: Text("Изменить", - style: CustomTextStyles.titleMediumBlack.copyWith( - color: Colors.blue, - ),), + child: Text( + "Изменить", + style: CustomTextStyles.titleMediumBlack.copyWith( + color: Colors.blue, + ), + ), ), ], backgroundColor: Colors.white, @@ -824,6 +867,7 @@ class MyProfileScreen extends StatelessWidget { // Обработка ошибок при отправке запроса print("Ошибка при отправке запроса: $e"); } + Navigator.pop(context); }; } @@ -859,10 +903,12 @@ class MyProfileScreen extends StatelessWidget { ), TextButton( onPressed: () => saveWeight(state, context), - child: Text("Изменить", - style: CustomTextStyles.titleMediumBlack.copyWith( - color: Colors.blue, - ),), + child: Text( + "Изменить", + style: CustomTextStyles.titleMediumBlack.copyWith( + color: Colors.blue, + ), + ), ), ], backgroundColor: Colors.white, diff --git a/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_bloc.dart b/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_bloc.dart index 00dbfcd3..0fbc0481 100644 --- a/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_bloc.dart +++ b/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_bloc.dart @@ -37,7 +37,7 @@ class RecipeEditBloc extends Bloc { } final String? recipeID = state.recipeModelObj?.recipeID; final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipe/show/$recipeID'), + Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/show/$recipeID'), headers: { 'Authorization': 'Bearer $token', }, @@ -47,7 +47,8 @@ class RecipeEditBloc extends Bloc { if (data is Map) { if (state is RecipeEditLoadedState) { var currentState = state as RecipeEditLoadedState; - emit(currentState.copyWith( + emit( + currentState.copyWith( recipeModelObj: currentState.recipeModelObj, title: currentState.title, token: currentState.token, @@ -56,7 +57,9 @@ class RecipeEditBloc extends Bloc { video_url: currentState.video_url, steps: currentState.steps, stepDescriptions: currentState.stepDescriptions, - tags: currentState.tags,),); + tags: currentState.tags, + ), + ); } else { final Map defaultStep = { 'description': '', @@ -75,17 +78,19 @@ class RecipeEditBloc extends Bloc { } } - emit(RecipeEditLoadedState( - token: token, - recipe: data, - title: TextEditingController(text: data['title']), - description: TextEditingController(text: data['description']), - video_url: TextEditingController(text: data['video_url']), - tagsController: TextEditingController(), - tags: await _fetchTags(data['id']), - stepDescriptions: stepDescriptions, - steps: steps, - ),); + emit( + RecipeEditLoadedState( + token: token, + recipe: data, + title: TextEditingController(text: data['title']), + description: TextEditingController(text: data['description']), + video_url: TextEditingController(text: data['video_url']), + tagsController: TextEditingController(), + tags: await _fetchTags(data['id']), + stepDescriptions: stepDescriptions, + steps: steps, + ), + ); } } else { // Один или несколько ключевых полей отсутствуют, обрабатываем ошибку @@ -195,7 +200,7 @@ class RecipeEditBloc extends Bloc { } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipe/getTags/$id'), + Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/getTags/$id'), headers: { 'Authorization': 'Bearer $token', }, @@ -213,7 +218,8 @@ class RecipeEditBloc extends Bloc { } if (state is RecipeEditLoadedState) { var currentState = state as RecipeEditLoadedState; - emit(currentState.copyWith( + emit( + currentState.copyWith( recipeModelObj: currentState.recipeModelObj, recipe: currentState.recipe, title: currentState.title, @@ -222,7 +228,9 @@ class RecipeEditBloc extends Bloc { video_url: currentState.video_url, steps: currentState.steps, stepDescriptions: currentState.stepDescriptions, - tags: currentState.tags,),); + tags: currentState.tags, + ), + ); } } } diff --git a/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart b/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart index 6f5bdfda..ab262471 100644 --- a/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart +++ b/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart @@ -1,6 +1,8 @@ import 'dart:async'; +import 'package:dio/dio.dart'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/locator_service.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; import '/core/app_export.dart'; @@ -31,27 +33,29 @@ class RecipeSelectBloc extends Bloc { if (token == null) { AppRouter.navigatorKey.currentContext?.goNamed('authScreen'); } - final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipe/index'), - ); + final response = await sl().get(dotenv.env['SERVER_ROOT']! + '/recipes/index'); print('Got response'); if (response.statusCode == 200) { print('Got 200'); - final data = jsonDecode(response.body); + final data = response.data['data']; if (data is List) { print('Got List'); if (state is RecipeSelectLoadedState) { print('Got loaded'); var currentState = state as RecipeSelectLoadedState; - emit((currentState).copyWith( - posts: data, - myProfileModelObj: currentState.myProfileModelObj, - ),); + emit( + (currentState).copyWith( + posts: data, + myProfileModelObj: currentState.myProfileModelObj, + ), + ); } else { print('Got unloaded'); - emit(RecipeSelectLoadedState( - posts: data, - ),); + emit( + RecipeSelectLoadedState( + posts: data, + ), + ); } } else { // Один или несколько ключевых полей отсутствуют, обрабатываем ошибку diff --git a/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_state.dart b/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_state.dart index feb87b2e..d320f903 100644 --- a/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_state.dart +++ b/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_state.dart @@ -12,14 +12,12 @@ class RecipeSelectState extends Equatable { } class RecipeSelectInitialState extends RecipeSelectState { - RecipeSelectInitialState({required RecipeSelectModel myProfileModelObj}) - : super(myProfileModelObj: myProfileModelObj); + RecipeSelectInitialState({required RecipeSelectModel myProfileModelObj}) : super(myProfileModelObj: myProfileModelObj); } /// Represents the state of RecipeSelect in the application. class RecipeSelectLoadedState extends RecipeSelectState { - RecipeSelectLoadedState({this.myProfileModelObj, this.posts}) - : super(myProfileModelObj: null); + RecipeSelectLoadedState({this.myProfileModelObj, this.posts}) : super(myProfileModelObj: null); RecipeSelectModel? myProfileModelObj; List? posts; diff --git a/lib/presentation/recipe/recipe_select_screen/recipe_select_screen.dart b/lib/presentation/recipe/recipe_select_screen/recipe_select_screen.dart index fa0a9506..33b59af3 100644 --- a/lib/presentation/recipe/recipe_select_screen/recipe_select_screen.dart +++ b/lib/presentation/recipe/recipe_select_screen/recipe_select_screen.dart @@ -112,6 +112,7 @@ class RecipeSelectScreen extends StatelessWidget { _buildRecipeList(BuildContext context, RecipeSelectLoadedState state) { return ListView.builder( + physics: NeverScrollableScrollPhysics(), shrinkWrap: true, // Add this line itemCount: state.posts?.length ?? 0, itemBuilder: (context, index) { diff --git a/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_bloc.dart b/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_bloc.dart index ed9b6efe..e8ef6e3a 100644 --- a/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_bloc.dart +++ b/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_bloc.dart @@ -37,7 +37,7 @@ class RecipeBloc extends Bloc { } final String? recipeID = state.recipeModelObj?.recipeID; final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipe/show/$recipeID'), + Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/show/$recipeID'), headers: { 'Authorization': 'Bearer $token', }, @@ -47,23 +47,29 @@ class RecipeBloc extends Bloc { if (data is Map) { if (state is RecipeLoadedState) { var currentState = state as RecipeLoadedState; - emit(currentState.copyWith( + emit( + currentState.copyWith( recipeModelObj: currentState.recipeModelObj, recipe: currentState.recipe, token: currentState.token, commentController: currentState.commentController, comments: currentState.comments, steps: currentState.steps, - author: currentState.author,),); + author: currentState.author, + ), + ); } else { - emit(RecipeLoadedState( + emit( + RecipeLoadedState( token: token, recipe: data, steps: data['steps'], author: await _fetchAuthor(data['id']), comments: fillCommentList(await _fetchComments(data['id'])), tags: await _fetchTags(data['id']), - commentController: TextEditingController(),),); + commentController: TextEditingController(), + ), + ); } } else { // Один или несколько ключевых полей отсутствуют, обрабатываем ошибку @@ -87,7 +93,7 @@ class RecipeBloc extends Bloc { } final int id = event.id; final response = await http.post( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipe/delete/$id'), + Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/delete/$id'), headers: { 'Authorization': 'Bearer $token', }, @@ -125,7 +131,7 @@ class RecipeBloc extends Bloc { } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipe/getAuthor/$id'), + Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/getAuthor/$id'), headers: { 'Authorization': 'Bearer $token', }, @@ -141,7 +147,7 @@ class RecipeBloc extends Bloc { AppRouter.navigatorKey.currentContext?.goNamed('authScreen'); } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipe/getComments/$id'), + Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/getComments/$id'), headers: { 'Authorization': 'Bearer $token', }, @@ -159,7 +165,7 @@ class RecipeBloc extends Bloc { } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipe/getTags/$id'), + Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/getTags/$id'), headers: { 'Authorization': 'Bearer $token', }, @@ -171,30 +177,35 @@ class RecipeBloc extends Bloc { List fillCommentList(List comments) { List list = []; for (int i = 0; i < comments.length; i++) { - list.add(CommentModel( + list.add( + CommentModel( id: comments[i]['id'].toString(), userImage: comments[i]['profile_photo_path'], username: comments[i]['name'], dateText: DateFormat('dd.MM').format(DateTime.parse(comments[i]['updated_at'])), - greetingText: comments[i]['body'],),); + greetingText: comments[i]['body'], + ), + ); } return list; } Future _sendCommentData(String? token, String body, int id) async { - String url = dotenv.env['SERVER_ROOT']! + '/recipe/createComment/$id'; + String url = dotenv.env['SERVER_ROOT']! + '/recipes/createComment/$id'; final Map credentials = { 'id': id, 'body': body, }; - var response = await http.post(Uri.parse(url), - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'Bearer $token', - }, - body: json.encode(credentials), - encoding: utf8,); + var response = await http.post( + Uri.parse(url), + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer $token', + }, + body: json.encode(credentials), + encoding: utf8, + ); return response; } diff --git a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart index 1ade5821..1543cd57 100644 --- a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart @@ -20,45 +20,59 @@ class AdditionalInformationScreen extends StatelessWidget { static Widget builder(BuildContext context, sheet) { return BlocProvider( - create: (context) => - AdditionalInformationBloc(AdditionalInformationState(additionalInformationModelObj: AdditionalInformationModel(userRegistrationSheet: sheet))) - ..add(AdditionalInformationInitialEvent()), - child: AdditionalInformationScreen(),); + create: (context) => + AdditionalInformationBloc(AdditionalInformationState(additionalInformationModelObj: AdditionalInformationModel(userRegistrationSheet: sheet))) + ..add(AdditionalInformationInitialEvent()), + child: AdditionalInformationScreen(), + ); } @override Widget build(BuildContext context) { return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h),), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 1, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400),),),), - SizedBox(height: 20.v), - SizedBox(height: 73.v), - _buildTextFormField(context), - Spacer(), - BlocBuilder(builder: (context, state) { + resizeToAvoidBottomInset: false, + appBar: _buildAppBar(context), + body: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + SizedBox(height: 7.v), + Container( + height: 16.v, + width: 343.h, + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all(color: theme.colorScheme.primary, width: 1.h), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (14 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), + SizedBox(height: 20.v), + SizedBox(height: 73.v), + _buildTextFormField(context), + Spacer(), + BlocBuilder( + builder: (context, state) { return NextStepButton( - text: "finish".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapFinish(state, context),); - },), - ],),),); + text: "finish".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapFinish(state, context), + ); + }, + ), + ], + ), + ), + ); } onTapFinish(AdditionalInformationState state, BuildContext context) { @@ -66,8 +80,12 @@ class AdditionalInformationScreen extends StatelessWidget { UserRegistrationSheet sheet = state.additionalInformationModelObj!.userRegistrationSheet; sheet.additionalInfo = state.editTextController!.text; - final response = await http.post(Uri.parse(dotenv.env['SERVER_ROOT']! + '/register'), - headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, body: jsonEncode(sheet.toJson()), encoding: utf8,); + final response = await http.post( + Uri.parse(dotenv.env['SERVER_ROOT']! + '/register'), + headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, + body: jsonEncode(sheet.toJson()), + encoding: utf8, + ); var res = await jsonDecode(response.body); if (response.statusCode == 200) { @@ -84,11 +102,12 @@ class AdditionalInformationScreen extends StatelessWidget { /// Section Widget _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 31.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 31.h, + leading: + AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } onTapBack(BuildContext context) { @@ -100,29 +119,45 @@ class AdditionalInformationScreen extends StatelessWidget { /// Section Widget _buildTextFormField(BuildContext context) { return SizedBox( - height: 315.v, - width: 343.h, - child: Stack(alignment: Alignment.center, children: [ + height: 315.v, + width: 343.h, + child: Stack( + alignment: Alignment.center, + children: [ Align( - alignment: Alignment.center, - child: Column(mainAxisSize: MainAxisSize.min, children: [ + alignment: Alignment.center, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ Container( - width: 294.h, - margin: EdgeInsets.only(left: 24.h, right: 23.h), - child: Text("enter_additional_information".tr, - maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: CustomTextStyles.titleMediumSegoeUI,),), + width: 294.h, + margin: EdgeInsets.only(left: 24.h, right: 23.h), + child: Text( + "enter_additional_information".tr, + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + style: CustomTextStyles.titleMediumSegoeUI, + ), + ), SizedBox(height: 10.v), BlocSelector( - selector: (state) => state.editTextController, - builder: (context, editTextController) { - return CustomTextFormField( - controller: editTextController, - hintText: "У меня крепкое здоровье, но последнее время часто утомляюсь, однако, это мне не мешает радоваться жизни", - textInputAction: TextInputAction.done, - maxLines: 8,); - },), - ],),), - ],),); + selector: (state) => state.editTextController, + builder: (context, editTextController) { + return CustomTextFormField( + controller: editTextController, + hintText: "У меня крепкое здоровье, но последнее время часто утомляюсь, однако, это мне не мешает радоваться жизни", + textInputAction: TextInputAction.done, + maxLines: 8, + ); + }, + ), + ], + ), + ), + ], + ), + ); } /// Navigates to the previous screen. @@ -134,12 +169,13 @@ class AdditionalInformationScreen extends StatelessWidget { /// The dialog box contains a title and a message with the `Теперь вы можете пользоваться полным функционалом приложения` showErrorMessage(BuildContext context, String text) { showDialog( - context: context, - builder: (_) => AlertDialog( - title: const Text('Ошибка'), - content: Text(text), - actions: [TextButton(onPressed: onTapOk(context), child: const Text('Ok'))], - ),); + context: context, + builder: (_) => AlertDialog( + title: const Text('Ошибка'), + content: Text(text), + actions: [TextButton(onPressed: onTapOk(context), child: const Text('Ok'))], + ), + ); } onTapOk(BuildContext context) { diff --git a/lib/presentation/registration/allergies_screen/allergies_screen.dart b/lib/presentation/registration/allergies_screen/allergies_screen.dart index 30e218c2..0c5fac4a 100644 --- a/lib/presentation/registration/allergies_screen/allergies_screen.dart +++ b/lib/presentation/registration/allergies_screen/allergies_screen.dart @@ -16,8 +16,9 @@ class AllergiesScreen extends StatefulWidget { static Widget builder(BuildContext context, sheet) { return BlocProvider( - create: (context) => AllergiesBloc(AllergiesState(allergiesModelObj: AllergiesModel(userRegistrationSheet: sheet)))..add(AllergiesInitialEvent()), - child: AllergiesScreen(),); + create: (context) => AllergiesBloc(AllergiesState(allergiesModelObj: AllergiesModel(userRegistrationSheet: sheet)))..add(AllergiesInitialEvent()), + child: AllergiesScreen(), + ); } @override @@ -28,43 +29,58 @@ class _AllergiesScreenState extends State { @override Widget build(BuildContext context) { return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h),), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 0.76, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400),),),), - SizedBox(height: 22.v), - Text("allergies_presence".tr, style: theme.textTheme.headlineSmall), - Spacer(flex: 36), - _buildTextFormField(context), - Spacer(flex: 54), - BlocBuilder(builder: (context, state) { + resizeToAvoidBottomInset: false, + appBar: _buildAppBar(context), + body: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + SizedBox(height: 7.v), + Container( + height: 16.v, + width: 343.h, + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all(color: theme.colorScheme.primary, width: 1.h), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (10 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), + SizedBox(height: 22.v), + Text("allergies_presence".tr, style: theme.textTheme.headlineSmall), + Spacer(flex: 36), + _buildTextFormField(context), + Spacer(flex: 54), + BlocBuilder( + builder: (context, state) { return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context),); - },), - BlocBuilder(builder: (context, state) { + text: "continue".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapContinue(state, context), + ); + }, + ), + BlocBuilder( + builder: (context, state) { return GestureDetector( onTap: onTapSkip(state, context), child: Text("skip".tr, style: theme.textTheme.bodyLarge), ); - },), - ],),),); + }, + ), + ], + ), + ), + ); } onTapSkip(AllergiesState state, BuildContext context) { @@ -85,11 +101,12 @@ class _AllergiesScreenState extends State { /// Section Widget _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 31.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 31.h, + leading: + AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } onTapBack(BuildContext context) { @@ -100,16 +117,23 @@ class _AllergiesScreenState extends State { /// Section Widget _buildTextFormField(BuildContext context) { - return Column(children: [ - Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), - SizedBox(height: 2.v), - BlocSelector( + return Column( + children: [ + Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), + SizedBox(height: 2.v), + BlocSelector( selector: (state) => state.enterInformationController, builder: (context, enterInformationController) { return CustomTextFormField( - controller: enterInformationController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 8,); - },), - ],); + controller: enterInformationController, + hintText: "enter_information".tr, + textInputAction: TextInputAction.done, + maxLines: 8, + ); + }, + ), + ], + ); } /// Navigates to the previous screen. diff --git a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart index 1aabdbd4..afce1b8b 100644 --- a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart @@ -19,9 +19,10 @@ class BloodPressureScreen extends StatefulWidget { static Widget builder(BuildContext context, sheet) { return BlocProvider( - create: (context) => - BloodPressureBloc(BloodPressureState(bloodPressureModelObj: BloodPressureModel(userRegistrationSheet: sheet)))..add(BloodPressureInitialEvent()), - child: BloodPressureScreen(),); + create: (context) => + BloodPressureBloc(BloodPressureState(bloodPressureModelObj: BloodPressureModel(userRegistrationSheet: sheet)))..add(BloodPressureInitialEvent()), + child: BloodPressureScreen(), + ); } @override @@ -33,115 +34,146 @@ class _BloodPressureScreenState extends State { Widget build(BuildContext context) { final digitsOnly = FilteringTextInputFormatter.digitsOnly; return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 12.h, vertical: 9.v), - child: Column(children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - padding: EdgeInsets.symmetric(horizontal: 4.h), - // Apply padding directly to the Container - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all( - color: theme.colorScheme.primary, - width: 1.h, - ), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 0.62, - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), + resizeToAvoidBottomInset: false, + appBar: _buildAppBar(context), + body: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 12.h, vertical: 9.v), + child: Column( + children: [ + SizedBox(height: 7.v), + Container( + height: 16.v, + width: 343.h, + padding: EdgeInsets.symmetric(horizontal: 4.h), + // Apply padding directly to the Container + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all( + color: theme.colorScheme.primary, + width: 1.h, ), ), - SizedBox(height: 21.v), - SizedBox( - width: 224.h, - child: Text("your_blood_pressure".tr, - maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall,),), - SizedBox(height: 21.v), - Container( - margin: EdgeInsets.only(right: 1.h), - padding: EdgeInsets.symmetric(horizontal: 3.h), - child: Column(children: [ - Text("up_pressure".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.upPressureController, - builder: (context, upPressureController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: upPressureController, hintText: "90".tr); - },), - ],),), - SizedBox(height: 21.v), - Container( - margin: EdgeInsets.only(right: 1.h), - padding: EdgeInsets.symmetric(horizontal: 3.h), - child: Column(children: [ - Text("down_pressure".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.downPressureController, - builder: (context, downPressureController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: downPressureController, hintText: "90".tr); - },), - ],),), - SizedBox(height: 22.v), - Text("do_you_have_hypotension_tendency".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - Padding( - padding: EdgeInsets.symmetric(horizontal: 4.h), - child: BlocSelector( - selector: (state) => state.bloodPressureModelObj, - builder: (context, bloodPressureModelObj) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), - child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize),), - hintText: "Не выбрано".tr, - items: bloodPressureModelObj?.dropdownItemList ?? [], - onChanged: onChangeHyper(context),); - },),), - SizedBox(height: 22.v), - Text("do_you_have_hypertension_tendency".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - Padding( - padding: EdgeInsets.symmetric(horizontal: 4.h), - child: BlocSelector( - selector: (state) => state.bloodPressureModelObj, - builder: (context, bloodPressureModelObj) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), - child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize),), - hintText: "Не выбрано".tr, - items: bloodPressureModelObj?.dropdownItemList ?? [], - onChanged: onChangeHypo(context),); - },),), - Spacer(), - BlocBuilder(builder: (context, state) { + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (9 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), + SizedBox(height: 21.v), + SizedBox( + width: 224.h, + child: Text( + "your_blood_pressure".tr, + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + style: theme.textTheme.headlineSmall, + ), + ), + SizedBox(height: 21.v), + Container( + margin: EdgeInsets.only(right: 1.h), + padding: EdgeInsets.symmetric(horizontal: 3.h), + child: Column( + children: [ + Text("up_pressure".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + BlocSelector( + selector: (state) => state.upPressureController, + builder: (context, upPressureController) { + return CustomTextFormField(inputFormatters: [digitsOnly], controller: upPressureController, hintText: "90".tr); + }, + ), + ], + ), + ), + SizedBox(height: 21.v), + Container( + margin: EdgeInsets.only(right: 1.h), + padding: EdgeInsets.symmetric(horizontal: 3.h), + child: Column( + children: [ + Text("down_pressure".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + BlocSelector( + selector: (state) => state.downPressureController, + builder: (context, downPressureController) { + return CustomTextFormField(inputFormatters: [digitsOnly], controller: downPressureController, hintText: "90".tr); + }, + ), + ], + ), + ), + SizedBox(height: 22.v), + Text("do_you_have_hypotension_tendency".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + Padding( + padding: EdgeInsets.symmetric(horizontal: 4.h), + child: BlocSelector( + selector: (state) => state.bloodPressureModelObj, + builder: (context, bloodPressureModelObj) { + return CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), + child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), + ), + hintText: "Не выбрано".tr, + items: bloodPressureModelObj?.dropdownItemList ?? [], + onChanged: onChangeHyper(context), + ); + }, + ), + ), + SizedBox(height: 22.v), + Text("do_you_have_hypertension_tendency".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + Padding( + padding: EdgeInsets.symmetric(horizontal: 4.h), + child: BlocSelector( + selector: (state) => state.bloodPressureModelObj, + builder: (context, bloodPressureModelObj) { + return CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), + child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), + ), + hintText: "Не выбрано".tr, + items: bloodPressureModelObj?.dropdownItemList ?? [], + onChanged: onChangeHypo(context), + ); + }, + ), + ), + Spacer(), + BlocBuilder( + builder: (context, state) { return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context),); - },), - BlocBuilder(builder: (context, state) { + text: "continue".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapContinue(state, context), + ); + }, + ), + BlocBuilder( + builder: (context, state) { return GestureDetector( onTap: onTapSkip(state, context), child: Text("skip".tr, style: theme.textTheme.bodyLarge), ); - },), - ],),),); + }, + ), + ], + ), + ), + ); } onTapSkip(BloodPressureState state, BuildContext context) { @@ -158,7 +190,7 @@ class _BloodPressureScreenState extends State { UserRegistrationSheet sheet = state.bloodPressureModelObj!.userRegistrationSheet; sheet.bloodPressureUp = state.upPressureController!.text; sheet.bloodPressureDown = state.downPressureController!.text; - AppRouter.navigatorKey.currentContext?.goNamed('favoriteSportsScreen', extra: sheet); + AppRouter.navigatorKey.currentContext?.goNamed('allergiesScreen', extra: sheet); } else { String errorMessage = ''; @@ -204,11 +236,12 @@ class _BloodPressureScreenState extends State { /// Section Widget _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 29.h, + leading: + AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } Function onTapBack(BuildContext context) { diff --git a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart b/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart index 3326d45a..b4b696d6 100644 --- a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart @@ -28,62 +28,84 @@ class BodyCircumferencesScreen extends StatelessWidget { final digitsOnly = FilteringTextInputFormatter.digitsOnly; mediaQueryData = MediaQuery.of(context); return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h),), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 0.40, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400),),),), - SizedBox(height: 39.v), - Text("initial_measurements".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 93.v), - Column(children: [ + resizeToAvoidBottomInset: false, + appBar: _buildAppBar(context), + body: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + SizedBox(height: 7.v), + Container( + height: 16.v, + width: 343.h, + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all(color: theme.colorScheme.primary, width: 1.h), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (6 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), + SizedBox(height: 39.v), + Text("initial_measurements".tr, style: theme.textTheme.headlineSmall), + SizedBox(height: 93.v), + Column( + children: [ Text("chest_circumference".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 3.v), BlocSelector( - selector: (state) => state.chestCircumferenceController, - builder: (context, chestCircumferenceController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: chestCircumferenceController, hintText: "90".tr); - },), - ],), - SizedBox(height: 19.v), - Text("waist_circumference".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 5.v), - BlocSelector( - selector: (state) => state.waistCircumferenceController, - builder: (context, waistCircumferenceController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: waistCircumferenceController, hintText: "60".tr); - },), - SizedBox(height: 21.v), - Text("hip_circumference".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.hipCircumferenceController, - builder: (context, hipCircumferenceController) { - return CustomTextFormField( - inputFormatters: [digitsOnly], controller: hipCircumferenceController, hintText: "90".tr, textInputAction: TextInputAction.done,); - },), - Spacer(), - BlocBuilder(builder: (context, state) { + selector: (state) => state.chestCircumferenceController, + builder: (context, chestCircumferenceController) { + return CustomTextFormField(inputFormatters: [digitsOnly], controller: chestCircumferenceController, hintText: "90".tr); + }, + ), + ], + ), + SizedBox(height: 19.v), + Text("waist_circumference".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 5.v), + BlocSelector( + selector: (state) => state.waistCircumferenceController, + builder: (context, waistCircumferenceController) { + return CustomTextFormField(inputFormatters: [digitsOnly], controller: waistCircumferenceController, hintText: "60".tr); + }, + ), + SizedBox(height: 21.v), + Text("hip_circumference".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + BlocSelector( + selector: (state) => state.hipCircumferenceController, + builder: (context, hipCircumferenceController) { + return CustomTextFormField( + inputFormatters: [digitsOnly], + controller: hipCircumferenceController, + hintText: "90".tr, + textInputAction: TextInputAction.done, + ); + }, + ), + Spacer(), + BlocBuilder( + builder: (context, state) { return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context),); - },), - ],),),); + text: "continue".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapContinue(state, context), + ); + }, + ), + ], + ), + ), + ); } onTapContinue(BodyCircumferencesState state, BuildContext context) { @@ -129,11 +151,12 @@ class BodyCircumferencesScreen extends StatelessWidget { /// Section Widget _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 29.h, + leading: + AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } Function onTapBack(BuildContext context) { diff --git a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart b/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart index 82da493d..cd862cd3 100644 --- a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart +++ b/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart @@ -1144,45 +1144,57 @@ class CityOfLivingScreen extends StatelessWidget { "Ясный", "Яхрома", ]; + return Scaffold( - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h),), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 0.32, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400),),),), - SizedBox(height: 39.v), - Text("place_of_living".tr, style: theme.textTheme.headlineSmall), - Spacer(flex: 34), - Text("country".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.cityOfLivingModelObj, - builder: (context, cityOfLivingModelObj) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), - child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize),), - hintText: "Не выбрано".tr, - items: cityOfLivingModelObj?.dropdownItemList ?? [], - onChanged: onDropDownChange(context),); - },), - SizedBox(height: 22.v), - Text("Населенный пункт", style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocBuilder(builder: (context, state) { + appBar: _buildAppBar(context), + body: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + SizedBox(height: 7.v), + Container( + height: 16.v, + width: 343.h, + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all(color: theme.colorScheme.primary, width: 1.h), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (5 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), + SizedBox(height: 39.v), + Text("place_of_living".tr, style: theme.textTheme.headlineSmall), + Spacer(flex: 34), + Text("country".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + BlocSelector( + selector: (state) => state.cityOfLivingModelObj, + builder: (context, cityOfLivingModelObj) { + return CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), + child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), + ), + hintText: "Не выбрано".tr, + items: cityOfLivingModelObj?.dropdownItemList ?? [], + onChanged: onDropDownChange(context), + ); + }, + ), + SizedBox(height: 22.v), + Text("Населенный пункт", style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + BlocBuilder( + builder: (context, state) { return RawAutocomplete( optionsBuilder: (TextEditingValue textEditingValue) => _options.where((String option) { return option.toLowerCase().startsWith(textEditingValue.text.toLowerCase()); @@ -1228,16 +1240,23 @@ class CityOfLivingScreen extends StatelessWidget { ); }, ); - },), - Spacer(flex: 65), - BlocBuilder(builder: (context, state) { + }, + ), + Spacer(flex: 65), + BlocBuilder( + builder: (context, state) { return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context),); - },), - ],),),); + text: "continue".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapContinue(state, context), + ); + }, + ), + ], + ), + ), + ); } onTapContinue(CityOfLivingState state, BuildContext context) { @@ -1256,11 +1275,12 @@ class CityOfLivingScreen extends StatelessWidget { /// Section Widget _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 29.h, + leading: + AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } Function onTapBack(BuildContext context) { diff --git a/lib/presentation/registration/credentials_screen/credentials_screen.dart b/lib/presentation/registration/credentials_screen/credentials_screen.dart index cbf31712..23517a05 100644 --- a/lib/presentation/registration/credentials_screen/credentials_screen.dart +++ b/lib/presentation/registration/credentials_screen/credentials_screen.dart @@ -27,70 +27,87 @@ class CredentialsScreen extends StatelessWidget { Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h),), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 0.05, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400),),),), - SizedBox(height: 39.v), - Text("user_registration".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 16.v), - Text("email".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.emailController, - builder: (context, emailController) { - return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done); - },), - SizedBox(height: 22.v), - Text("username".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.nameController, - builder: (context, nameController) { - return CustomTextFormField(controller: nameController, textInputAction: TextInputAction.done); - },), - SizedBox(height: 19.v), - Text("password".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 5.v), - BlocSelector( - selector: (state) => state.passwordController, - builder: (context, passwordController) { - return CustomTextFormField( - obscureText: true, - controller: passwordController, - ); - },), - SizedBox(height: 21.v), - Text("password_confirmation".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.passwordConfirmationController, - builder: (context, passwordConfirmationController) { - return CustomTextFormField(obscureText: true, controller: passwordConfirmationController, textInputAction: TextInputAction.done); - },), - Spacer(), - BlocBuilder(builder: (context, state) { + resizeToAvoidBottomInset: false, + appBar: _buildAppBar(context), + body: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + SizedBox(height: 7.v), + Container( + height: 16.v, + width: 343.h, + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all(color: theme.colorScheme.primary, width: 1.h), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (1 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), + SizedBox(height: 39.v), + Text("user_registration".tr, style: theme.textTheme.headlineSmall), + SizedBox(height: 16.v), + Text("email".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + BlocSelector( + selector: (state) => state.emailController, + builder: (context, emailController) { + return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done); + }, + ), + SizedBox(height: 22.v), + Text("username".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + BlocSelector( + selector: (state) => state.nameController, + builder: (context, nameController) { + return CustomTextFormField(controller: nameController, textInputAction: TextInputAction.done); + }, + ), + SizedBox(height: 19.v), + Text("password".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 5.v), + BlocSelector( + selector: (state) => state.passwordController, + builder: (context, passwordController) { + return CustomTextFormField( + obscureText: true, + controller: passwordController, + ); + }, + ), + SizedBox(height: 21.v), + Text("password_confirmation".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + BlocSelector( + selector: (state) => state.passwordConfirmationController, + builder: (context, passwordConfirmationController) { + return CustomTextFormField(obscureText: true, controller: passwordConfirmationController, textInputAction: TextInputAction.done); + }, + ), + Spacer(), + BlocBuilder( + builder: (context, state) { return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context),); - },), - ],),),); + text: "continue".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapContinue(state, context), + ); + }, + ), + ], + ), + ), + ); } onTapContinue(CredentialsState state, BuildContext context) { diff --git a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart index a6b2da07..e6a223ff 100644 --- a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart @@ -36,38 +36,53 @@ class _DateOfBirthScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); - return BlocBuilder(builder: (context, state) { - return Scaffold( + return BlocBuilder( + builder: (context, state) { + return Scaffold( appBar: _buildAppBar(context), body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h),), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 0.24, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400),),),), + height: 16.v, + width: 343.h, + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all(color: theme.colorScheme.primary, width: 1.h), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (4 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), SizedBox(height: 38.v), Text("date_of_birth".tr, style: theme.textTheme.headlineSmall), Spacer(flex: 39), _buildDateInput(context), Spacer(flex: 60), - BlocBuilder(builder: (context, state) { - return NextStepButton( + BlocBuilder( + builder: (context, state) { + return NextStepButton( text: "continue".tr.toUpperCase(), margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context),); - },), - ],),),); - },); + onPressed: onTapContinue(state, context), + ); + }, + ), + ], + ), + ), + ); + }, + ); } onTapContinue(DateOfBirthState state, BuildContext context) { @@ -81,11 +96,12 @@ class _DateOfBirthScreenState extends State { /// Section Widget _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 29.h, + leading: + AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } Function onTapBack(BuildContext context) { @@ -97,19 +113,27 @@ class _DateOfBirthScreenState extends State { /// Section Widget _buildDateInput(BuildContext context) { return Container( - width: 343.h, - padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 1.v), - decoration: AppDecoration.outlineBlueA.copyWith(borderRadius: BorderRadiusStyle.circleBorder8), - child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ + width: 343.h, + padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 1.v), + decoration: AppDecoration.outlineBlueA.copyWith(borderRadius: BorderRadiusStyle.circleBorder8), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize, radius: BorderRadius.circular(1.h)), SizedBox(height: 6.v), Align( - alignment: Alignment.center, - child: GestureDetector( - onTap: onTapCalendar(context), - child: Text('${selectedDate.day}.${selectedDate.month}.${selectedDate.year}', style: theme.textTheme.titleMedium),),), + alignment: Alignment.center, + child: GestureDetector( + onTap: onTapCalendar(context), + child: Text('${selectedDate.day}.${selectedDate.month}.${selectedDate.year}', style: theme.textTheme.titleMedium), + ), + ), SizedBox(height: 6.v), - ],),); + ], + ), + ); } onTapCalendar(BuildContext context) { diff --git a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart index ea90d988..76601189 100644 --- a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart @@ -16,9 +16,10 @@ class FavoriteFoodsScreen extends StatefulWidget { static Widget builder(BuildContext context, sheet) { return BlocProvider( - create: (context) => - FavoriteFoodsBloc(FavoriteFoodsState(favoriteFoodsModelObj: FavoriteFoodsModel(userRegistrationSheet: sheet)))..add(FavoriteFoodsInitialEvent()), - child: FavoriteFoodsScreen(),); + create: (context) => + FavoriteFoodsBloc(FavoriteFoodsState(favoriteFoodsModelObj: FavoriteFoodsModel(userRegistrationSheet: sheet)))..add(FavoriteFoodsInitialEvent()), + child: FavoriteFoodsScreen(), + ); } @override @@ -29,49 +30,70 @@ class _FavoriteFoodsScreenState extends State { @override Widget build(BuildContext context) { return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h),), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 0.90, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400),),),), - SizedBox(height: 19.v), - Container( - width: 327.h, - margin: EdgeInsets.only(left: 8.h, right: 7.h), - child: Text("favorite_unfavorite_foods".tr, - maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall,),), - SizedBox(height: 13.v), - _buildTextFormFieldFav(context), - SizedBox(height: 12.v), - _buildTextFormFieldUnfav(context), - Spacer(), - BlocBuilder(builder: (context, state) { + resizeToAvoidBottomInset: false, + appBar: _buildAppBar(context), + body: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + SizedBox(height: 7.v), + Container( + height: 16.v, + width: 343.h, + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all(color: theme.colorScheme.primary, width: 1.h), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (13 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), + SizedBox(height: 19.v), + Container( + width: 327.h, + margin: EdgeInsets.only(left: 8.h, right: 7.h), + child: Text( + "favorite_unfavorite_foods".tr, + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + style: theme.textTheme.headlineSmall, + ), + ), + SizedBox(height: 13.v), + _buildTextFormFieldFav(context), + SizedBox(height: 12.v), + _buildTextFormFieldUnfav(context), + Spacer(), + BlocBuilder( + builder: (context, state) { return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 40.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context),); - },), - BlocBuilder(builder: (context, state) { + text: "continue".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 40.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapContinue(state, context), + ); + }, + ), + BlocBuilder( + builder: (context, state) { return GestureDetector( onTap: onTapSkip(state, context), child: Text("skip".tr, style: theme.textTheme.bodyLarge), ); - },), - ],),),); + }, + ), + ], + ), + ), + ); } onTapSkip(FavoriteFoodsState state, BuildContext context) { @@ -93,11 +115,12 @@ class _FavoriteFoodsScreenState extends State { /// Section Widget _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 31.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 31.h, + leading: + AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } Function onTapBack(BuildContext context) { @@ -108,29 +131,39 @@ class _FavoriteFoodsScreenState extends State { /// Section Widget _buildTextFormFieldFav(BuildContext context) { - return Column(children: [ - Text("favorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI), - SizedBox(height: 2.v), - BlocSelector( + return Column( + children: [ + Text("favorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI), + SizedBox(height: 2.v), + BlocSelector( selector: (state) => state.favoriteFoodsController, builder: (context, favoriteFoodsController) { return CustomTextFormField(controller: favoriteFoodsController, hintText: "enter_information".tr, maxLines: 7); - },), - ],); + }, + ), + ], + ); } /// Section Widget _buildTextFormFieldUnfav(BuildContext context) { - return Column(children: [ - Text("unfavorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI), - SizedBox(height: 2.v), - BlocSelector( + return Column( + children: [ + Text("unfavorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI), + SizedBox(height: 2.v), + BlocSelector( selector: (state) => state.unfavoriteFoodsController, builder: (context, unfavoriteFoodsController) { return CustomTextFormField( - controller: unfavoriteFoodsController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 7,); - },), - ],); + controller: unfavoriteFoodsController, + hintText: "enter_information".tr, + textInputAction: TextInputAction.done, + maxLines: 7, + ); + }, + ), + ], + ); } /// Navigates to the previous screen. diff --git a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart index 498b24c4..187a2848 100644 --- a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart @@ -16,9 +16,10 @@ class FavoriteSportsScreen extends StatefulWidget { static Widget builder(BuildContext context, sheet) { return BlocProvider( - create: (context) => FavoriteSportsBloc(FavoriteSportsState(favoriteSportsModelObj: FavoriteSportsModel(userRegistrationSheet: sheet))) - ..add(FavoriteSportsInitialEvent()), - child: FavoriteSportsScreen(),); + create: (context) => + FavoriteSportsBloc(FavoriteSportsState(favoriteSportsModelObj: FavoriteSportsModel(userRegistrationSheet: sheet)))..add(FavoriteSportsInitialEvent()), + child: FavoriteSportsScreen(), + ); } @override @@ -29,43 +30,59 @@ class _FavoriteSportsScreenState extends State { @override Widget build(BuildContext context) { return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 5.v), - child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [ - SizedBox(height: 20.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h),), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 0.83, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400),),),), - SizedBox(height: 38.v), - Text("your_favorite_sports".tr, style: theme.textTheme.headlineSmall), - Spacer(flex: 32), - _buildTextFormFieldSection(context), - Spacer(flex: 67), - BlocBuilder(builder: (context, state) { + resizeToAvoidBottomInset: false, + appBar: _buildAppBar(context), + body: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 5.v), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox(height: 20.v), + Container( + height: 16.v, + width: 343.h, + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all(color: theme.colorScheme.primary, width: 1.h), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (12 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), + SizedBox(height: 38.v), + Text("your_favorite_sports".tr, style: theme.textTheme.headlineSmall), + Spacer(flex: 32), + _buildTextFormFieldSection(context), + Spacer(flex: 67), + BlocBuilder( + builder: (context, state) { return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context),); - },), - BlocBuilder(builder: (context, state) { + text: "continue".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapContinue(state, context), + ); + }, + ), + BlocBuilder( + builder: (context, state) { return GestureDetector( onTap: onTapSkip(state, context), child: Text("skip".tr, style: theme.textTheme.bodyLarge), ); - },), - ],),),); + }, + ), + ], + ), + ), + ); } onTapSkip(FavoriteSportsState state, BuildContext context) { @@ -85,11 +102,12 @@ class _FavoriteSportsScreenState extends State { _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 29.h, + leading: + AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } Function onTapBack(BuildContext context) { @@ -100,20 +118,24 @@ class _FavoriteSportsScreenState extends State { /// Section Widget _buildTextFormFieldSection(BuildContext context) { - return Column(children: [ - Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), - SizedBox(height: 2.v), - BlocSelector( + return Column( + children: [ + Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), + SizedBox(height: 2.v), + BlocSelector( selector: (state) => state.enterinformationController, builder: (context, enterinformationController) { return CustomTextFormField( - controller: enterinformationController, - hintText: - "Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!", - textInputAction: TextInputAction.done, - maxLines: 8,); - },), - ],); + controller: enterinformationController, + hintText: + "Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!", + textInputAction: TextInputAction.done, + maxLines: 8, + ); + }, + ), + ], + ); } onTapArrowLeft(BuildContext context) { diff --git a/lib/presentation/registration/gender_screen/gender_screen.dart b/lib/presentation/registration/gender_screen/gender_screen.dart index d6a9b63d..8fc7d23d 100644 --- a/lib/presentation/registration/gender_screen/gender_screen.dart +++ b/lib/presentation/registration/gender_screen/gender_screen.dart @@ -15,12 +15,13 @@ class GenderScreen extends StatefulWidget { static Widget builder(BuildContext context, sheet) { return BlocProvider( - create: (context) => GenderBloc( - GenderState( - genderModelObj: GenderModel(userRegistrationSheet: sheet), - ), - )..add(GenderInitialEvent()), - child: GenderScreen(),); + create: (context) => GenderBloc( + GenderState( + genderModelObj: GenderModel(userRegistrationSheet: sheet), + ), + )..add(GenderInitialEvent()), + child: GenderScreen(), + ); } @override @@ -31,25 +32,33 @@ class _GenderScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); - return BlocBuilder(builder: (context, state) { - return Scaffold( + return BlocBuilder( + builder: (context, state) { + return Scaffold( appBar: _buildAppBar(context), body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ SizedBox(height: 7.v), Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h),), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 0.16, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400),),),), + height: 16.v, + width: 343.h, + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all(color: theme.colorScheme.primary, width: 1.h), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (3 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), SizedBox(height: 36.v), Text("your_gender".tr, style: theme.textTheme.headlineSmall), RadioListTile( @@ -75,15 +84,22 @@ class _GenderScreenState extends State { ), ), Spacer(flex: 66), - BlocBuilder(builder: (context, state) { - return NextStepButton( + BlocBuilder( + builder: (context, state) { + return NextStepButton( text: "continue".tr.toUpperCase(), margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapNext(state, context),); - },), - ],),),); - },); + onPressed: onTapNext(state, context), + ); + }, + ), + ], + ), + ), + ); + }, + ); } onTapNext(GenderState state, BuildContext context) { diff --git a/lib/presentation/registration/height_screen/height_screen.dart b/lib/presentation/registration/height_screen/height_screen.dart index 22ada6c4..c990dc9b 100644 --- a/lib/presentation/registration/height_screen/height_screen.dart +++ b/lib/presentation/registration/height_screen/height_screen.dart @@ -17,8 +17,9 @@ class HeightScreen extends StatelessWidget { static Widget builder(BuildContext context, sheet) { return BlocProvider( - create: (context) => HeightBloc(HeightState(heightModelObj: HeightModel(userRegistrationSheet: sheet)))..add(HeightInitialEvent()), - child: HeightScreen(),); + create: (context) => HeightBloc(HeightState(heightModelObj: HeightModel(userRegistrationSheet: sheet)))..add(HeightInitialEvent()), + child: HeightScreen(), + ); } @override @@ -46,7 +47,7 @@ class HeightScreen extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( - value: 0.55, + value: (8 / 15).toDouble(), backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation( appTheme.blueA400, @@ -69,17 +70,19 @@ class HeightScreen extends StatelessWidget { style: theme.textTheme.bodyLarge, ), SizedBox(height: 4.v), - BlocBuilder(builder: (context, state) { - return CustomTextFormField( - width: 150.h, - textInputAction: TextInputAction.done, - controller: state.heightController, - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], - ); - },), + BlocBuilder( + builder: (context, state) { + return CustomTextFormField( + width: 150.h, + textInputAction: TextInputAction.done, + controller: state.heightController, + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], + ); + }, + ), ], ), ], @@ -115,11 +118,12 @@ class HeightScreen extends StatelessWidget { /// Section Widget _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 29.h, + leading: + AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } Function onTapBack(BuildContext context) { diff --git a/lib/presentation/registration/language_select_screen/language_select_screen.dart b/lib/presentation/registration/language_select_screen/language_select_screen.dart index a682d9db..884281fb 100644 --- a/lib/presentation/registration/language_select_screen/language_select_screen.dart +++ b/lib/presentation/registration/language_select_screen/language_select_screen.dart @@ -46,7 +46,7 @@ class LanguageSelectScreen extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( - value: 0, + value: (0 / 15).toDouble(), backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400), ), @@ -66,28 +66,29 @@ class LanguageSelectScreen extends StatelessWidget { ), Spacer(flex: 36), BlocSelector( - selector: (state) => state.languageSelectModelObj, - builder: ( - context, - languageSelectModelObj, - ) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.h), - ), - child: CustomImageView( - imagePath: ImageConstant.imgFavorite, - height: 12.adaptSize, - width: 12.adaptSize, - ), + selector: (state) => state.languageSelectModelObj, + builder: ( + context, + languageSelectModelObj, + ) { + return CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.h), ), - hintText: "Не выбрано".tr, - items: languageSelectModelObj?.dropdownItemList ?? [], - onChanged: (value) => _onDropDownChanged(context, value), - ); - },), + child: CustomImageView( + imagePath: ImageConstant.imgFavorite, + height: 12.adaptSize, + width: 12.adaptSize, + ), + ), + hintText: "Не выбрано".tr, + items: languageSelectModelObj?.dropdownItemList ?? [], + onChanged: (value) => _onDropDownChanged(context, value), + ); + }, + ), Spacer(flex: 63), ], ), diff --git a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart index bce90496..2a55586e 100644 --- a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart @@ -16,9 +16,10 @@ class MedicineIntakeScreen extends StatefulWidget { static Widget builder(BuildContext context, sheet) { return BlocProvider( - create: (context) => MedicineIntakeBloc(MedicineIntakeState(medicineIntakeModelObj: MedicineIntakeModel(userRegistrationSheet: sheet))) - ..add(MedicineIntakeInitialEvent()), - child: MedicineIntakeScreen(),); + create: (context) => + MedicineIntakeBloc(MedicineIntakeState(medicineIntakeModelObj: MedicineIntakeModel(userRegistrationSheet: sheet)))..add(MedicineIntakeInitialEvent()), + child: MedicineIntakeScreen(), + ); } @override @@ -30,54 +31,75 @@ class _MedicineIntakeScreenState extends State { Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h),), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 0.69, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400),),),), - SizedBox(height: 20.v), - Container( - width: 271.h, - margin: EdgeInsets.only(left: 35.h, right: 36.h), - child: Text("do_you_take_pills".tr, - maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall,),), - SizedBox(height: 86.v), - _buildTextFormField(context), - Spacer(), - BlocBuilder(builder: (context, state) { + resizeToAvoidBottomInset: false, + appBar: _buildAppBar(context), + body: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + SizedBox(height: 7.v), + Container( + height: 16.v, + width: 343.h, + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all(color: theme.colorScheme.primary, width: 1.h), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (11 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), + SizedBox(height: 20.v), + Container( + width: 271.h, + margin: EdgeInsets.only(left: 35.h, right: 36.h), + child: Text( + "do_you_take_pills".tr, + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + style: theme.textTheme.headlineSmall, + ), + ), + SizedBox(height: 86.v), + _buildTextFormField(context), + Spacer(), + BlocBuilder( + builder: (context, state) { return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapNext(state, context),); - },), - BlocBuilder(builder: (context, state) { + text: "continue".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapNext(state, context), + ); + }, + ), + BlocBuilder( + builder: (context, state) { return GestureDetector( onTap: onTapSkip(state, context), child: Text("skip".tr, style: theme.textTheme.bodyLarge), ); - },), - ],),),); + }, + ), + ], + ), + ), + ); } onTapSkip(MedicineIntakeState state, BuildContext context) { return () { UserRegistrationSheet sheet = state.medicineIntakeModelObj!.userRegistrationSheet; GoRouter.of(context).goNamed( - 'bloodPressureScreen', + 'favoriteSportsScreen', extra: sheet, ); }; @@ -88,7 +110,7 @@ class _MedicineIntakeScreenState extends State { UserRegistrationSheet sheet = state.medicineIntakeModelObj!.userRegistrationSheet; sheet.aboutTakingPils = state.enterInformationController!.text; GoRouter.of(context).goNamed( - 'bloodPressureScreen', + 'favoriteSportsScreen', extra: sheet, ); }; @@ -97,11 +119,12 @@ class _MedicineIntakeScreenState extends State { /// Section Widget _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 31.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 31.h, + leading: + AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } Function onTapBack(BuildContext context) { @@ -112,16 +135,23 @@ class _MedicineIntakeScreenState extends State { /// Section Widget _buildTextFormField(BuildContext context) { - return Column(children: [ - Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), - SizedBox(height: 2.v), - BlocSelector( + return Column( + children: [ + Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), + SizedBox(height: 2.v), + BlocSelector( selector: (state) => state.enterInformationController, builder: (context, enterInformationController) { return CustomTextFormField( - controller: enterInformationController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 8,); - },), - ],); + controller: enterInformationController, + hintText: "enter_information".tr, + textInputAction: TextInputAction.done, + maxLines: 8, + ); + }, + ), + ], + ); } /// Navigates to the previous screen. diff --git a/lib/presentation/registration/name_screen/name_screen.dart b/lib/presentation/registration/name_screen/name_screen.dart index 880c3ae2..4fb599df 100644 --- a/lib/presentation/registration/name_screen/name_screen.dart +++ b/lib/presentation/registration/name_screen/name_screen.dart @@ -17,76 +17,95 @@ class NameScreen extends StatelessWidget { static Widget builder(BuildContext context, sheet) { return BlocProvider( - create: (context) => NameBloc( - NameState( - nameModelObj: NameModel(userRegistrationSheet: sheet), - ), - )..add(NameInitialEvent()), - child: NameScreen(),); + create: (context) => NameBloc( + NameState( + nameModelObj: NameModel(userRegistrationSheet: sheet), + ), + )..add(NameInitialEvent()), + child: NameScreen(), + ); } @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h),), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: 0.1, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation(appTheme.blueA400),),),), - SizedBox(height: 39.v), - Text("what_is_your_name".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 93.v), - Text("first_name".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.firstNameController, - builder: (context, firstNameController) { - return CustomTextFormField(controller: firstNameController, textInputAction: TextInputAction.done); - },), - SizedBox(height: 19.v), - Text("last_name".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 5.v), - BlocSelector( - selector: (state) => state.lastNameController, - builder: (context, lastNameController) { - return CustomTextFormField( - controller: lastNameController, - ); - },), - Spacer(), - BlocBuilder(builder: (context, state) { + resizeToAvoidBottomInset: false, + appBar: _buildAppBar(context), + body: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + SizedBox(height: 7.v), + Container( + height: 16.v, + width: 343.h, + decoration: BoxDecoration( + color: theme.colorScheme.onPrimary, + borderRadius: BorderRadius.circular(8.h), + border: Border.all(color: theme.colorScheme.primary, width: 1.h), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.h), + child: LinearProgressIndicator( + value: (2 / 15).toDouble(), + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), + SizedBox(height: 39.v), + Text("what_is_your_name".tr, style: theme.textTheme.headlineSmall), + SizedBox(height: 93.v), + Text("first_name".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + BlocSelector( + selector: (state) => state.firstNameController, + builder: (context, firstNameController) { + return CustomTextFormField(controller: firstNameController, textInputAction: TextInputAction.done); + }, + ), + SizedBox(height: 19.v), + Text("last_name".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 5.v), + BlocSelector( + selector: (state) => state.lastNameController, + builder: (context, lastNameController) { + return CustomTextFormField( + controller: lastNameController, + ); + }, + ), + Spacer(), + BlocBuilder( + builder: (context, state) { return NextStepButton( text: "continue".tr.toUpperCase(), margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () => _onTapNext(context, state), // Assign callback function here ); - },), - ],),),); + }, + ), + ], + ), + ), + ); } /// Section Widget _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 29.h, - leading: AppbarLeadingImage( - imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: () => onTapArrowLeft(context),), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 29.h, + leading: AppbarLeadingImage( + imagePath: ImageConstant.imgArrowLeft, + margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), + onTap: () => onTapArrowLeft(context), + ), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } /// Navigates to the previous screen. diff --git a/lib/presentation/registration/weight_screen/weight_screen.dart b/lib/presentation/registration/weight_screen/weight_screen.dart index 5d47e8d1..caad9e79 100644 --- a/lib/presentation/registration/weight_screen/weight_screen.dart +++ b/lib/presentation/registration/weight_screen/weight_screen.dart @@ -17,8 +17,9 @@ class WeightScreen extends StatelessWidget { static Widget builder(BuildContext context, sheet) { return BlocProvider( - create: (context) => WeightBloc(WeightState(weightModelObj: WeightModel(userRegistrationSheet: sheet)))..add(WeightInitialEvent()), - child: WeightScreen(),); + create: (context) => WeightBloc(WeightState(weightModelObj: WeightModel(userRegistrationSheet: sheet)))..add(WeightInitialEvent()), + child: WeightScreen(), + ); } @override @@ -45,7 +46,7 @@ class WeightScreen extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( - value: 0.55, + value: (7 / 15).toDouble(), backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation( appTheme.blueA400, @@ -68,17 +69,19 @@ class WeightScreen extends StatelessWidget { style: theme.textTheme.bodyLarge, ), SizedBox(height: 4.v), - BlocBuilder(builder: (context, state) { - return CustomTextFormField( - width: 150.h, - textInputAction: TextInputAction.done, - controller: state.weightController, - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], - ); - },), + BlocBuilder( + builder: (context, state) { + return CustomTextFormField( + width: 150.h, + textInputAction: TextInputAction.done, + controller: state.weightController, + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], + ); + }, + ), ], ), ], @@ -114,11 +117,12 @@ class WeightScreen extends StatelessWidget { /// Section Widget _buildAppBar(BuildContext context) { return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),); + leadingWidth: 29.h, + leading: + AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + ); } Function onTapBack(BuildContext context) { diff --git a/lib/theme/theme_helper.dart b/lib/theme/theme_helper.dart index c912cb29..f9f64aa5 100644 --- a/lib/theme/theme_helper.dart +++ b/lib/theme/theme_helper.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:google_fonts/google_fonts.dart'; import '../../core/app_export.dart'; /// Helper class for managing themes and colors. @@ -22,7 +23,8 @@ class ThemeHelper { //throw exception to notify given theme is not found or not generated by the generator if (!_supportedCustomColor.containsKey(_appTheme)) { throw Exception( - "$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner",); + "$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner", + ); } //return theme from map @@ -34,13 +36,50 @@ class ThemeHelper { //throw exception to notify given theme is not found or not generated by the generator if (!_supportedColorScheme.containsKey(_appTheme)) { throw Exception( - "$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner",); + "$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner", + ); } //return theme from map - var colorScheme = - _supportedColorScheme[_appTheme] ?? ColorSchemes.primaryColorScheme; + var colorScheme = _supportedColorScheme[_appTheme] ?? ColorSchemes.primaryColorScheme; return ThemeData( + textTheme: GoogleFonts.mulishTextTheme().copyWith( + bodyLarge: TextStyle( + color: appTheme.blueGray400, + fontSize: 18, + fontWeight: FontWeight.w400, + ), + headlineSmall: TextStyle( + color: colorScheme.primary, + fontWeight: FontWeight.w600, + fontSize: 24, + ), + titleMedium: TextStyle( + color: colorScheme.primary, + fontWeight: FontWeight.w700, + fontSize: 18, + ), + titleSmall: TextStyle( + color: colorScheme.onPrimary, + fontWeight: FontWeight.w700, + fontSize: 15, + ), + bodyMedium: TextStyle( + color: appTheme.blueGray400, + fontWeight: FontWeight.w400, + fontSize: 14, + ), + bodySmall: TextStyle( + color: appTheme.gray500, + fontWeight: FontWeight.w400, + fontSize: 10, + ), + labelLarge: TextStyle( + color: appTheme.blueGray800, + fontWeight: FontWeight.w600, + fontSize: 12, + ), + ), pageTransitionsTheme: PageTransitionsTheme( builders: { TargetPlatform.android: CupertinoPageTransitionsBuilder(), @@ -49,7 +88,6 @@ class ThemeHelper { ), visualDensity: VisualDensity.standard, colorScheme: colorScheme, - textTheme: TextThemes.textTheme(colorScheme), scaffoldBackgroundColor: colorScheme.onPrimary, appBarTheme: AppBarTheme( systemOverlayStyle: SystemUiOverlayStyle( @@ -85,54 +123,6 @@ class ThemeHelper { ThemeData themeData() => _getThemeData(); } -/// Class containing the supported text theme styles. -class TextThemes { - static TextTheme textTheme(ColorScheme colorScheme) => TextTheme( - bodyLarge: TextStyle( - color: appTheme.blueGray400, - fontSize: 18.fSize, - fontFamily: 'Mulish', - fontWeight: FontWeight.w400, - ), - headlineSmall: TextStyle( - color: colorScheme.primary, - fontSize: 24.fSize, - fontFamily: 'Segoe UI', - fontWeight: FontWeight.w600, - ), - titleMedium: TextStyle( - color: colorScheme.primary, - fontSize: 18.fSize, - fontFamily: 'Mulish', - fontWeight: FontWeight.w700, - ), - titleSmall: TextStyle( - color: colorScheme.onPrimary, - fontSize: 15.fSize, - fontFamily: 'Mulish', - fontWeight: FontWeight.w700, - ), - bodyMedium: TextStyle( - color: appTheme.blueGray400, - fontSize: 14.fSize, - fontFamily: 'Mulish', - fontWeight: FontWeight.w400, - ), - bodySmall: TextStyle( - color: appTheme.gray500, - fontSize: 10.fSize, - fontFamily: 'Mulish', - fontWeight: FontWeight.w400, - ), - labelLarge: TextStyle( - color: appTheme.blueGray800, - fontSize: 12.fSize, - fontFamily: 'Mulish', - fontWeight: FontWeight.w600, - ), - ); -} - /// Class containing the supported color schemes. class ColorSchemes { static final primaryColorScheme = ColorScheme.light( @@ -149,10 +139,12 @@ class ColorSchemes { class PrimaryColors { // Blue Color get blue400 => Color(0XFF43A6F2); + Color get blueA400 => Color(0XFF2F80ED); // BlueGray Color get blueGray400 => Color(0XFF7B8794); + Color get black900 => Color(0XFF000000); // Blue @@ -160,7 +152,9 @@ class PrimaryColors { // BlueGray Color get blueGray300 => Color(0XFF9AA5B1); + Color get blueGray800 => Color(0XFF323F4B); + Color get blueGray900 => Color(0XFF2A2F4C); // DeepOrange @@ -168,22 +162,33 @@ class PrimaryColors { // Gray Color get gray100 => Color(0XFFF0F2F5); + Color get gray200 => Color(0XFFF0F0F0); + Color get gray400 => Color(0XFFC1C1C1); + Color get gray40001 => Color(0XFFC8C8C8); + Color get gray50 => Color(0XFFF6FAFF); + Color get gray500 => Color(0XFFA3A3A3); + Color get gray600 => Color(0XFF6D6D6D); + Color get gray60001 => Color(0XFF848484); + Color get gray60002 => Color(0XFF757575); + Color get gray60003 => Color(0XFF707070); // Green Color get greenA700 => Color(0XFF019A3E); + Color get greenA70001 => Color(0XFF00BE13); // LightGreen Color get lightGreen300 => Color(0XFFB2DF8A); + Color get lightGreenA700 => Color(0XFF18FF14); // Red @@ -191,6 +196,7 @@ class PrimaryColors { // Teal Color get teal100 => Color(0XFFA6CEE3); + Color get teal900 => Color(0XFF0B3F56); // White @@ -200,4 +206,5 @@ class PrimaryColors { } PrimaryColors get appTheme => ThemeHelper().themeColor(); + ThemeData get theme => ThemeHelper().themeData(); diff --git a/lib/widgets/custom_navigation_menu_item.dart b/lib/widgets/custom_navigation_menu_item.dart index 2ee47a8c..9d7d1618 100644 --- a/lib/widgets/custom_navigation_menu_item.dart +++ b/lib/widgets/custom_navigation_menu_item.dart @@ -1,3 +1,4 @@ +import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; import 'package:eatvio_app/widgets/custom_image_view.dart'; @@ -20,13 +21,12 @@ class MenuItem extends StatelessWidget { padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.center, // Выравнивание по центру вертикально + crossAxisAlignment: CrossAxisAlignment.center, // Выравнивание по центру вертикально children: [ CustomImageView(imagePath: icon), SizedBox( - width: - 8.0,), // Добавляем небольшой отступ между иконкой и текстом + width: 8.0, + ), // Добавляем небольшой отступ между иконкой и текстом Text(text), ], ), diff --git a/pubspec.yaml b/pubspec.yaml index 87ed29e8..36031fcd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,6 +44,7 @@ dependencies: easy_debounce: ^2.0.3 lazy_load_scrollview: ^1.3.0 badges: ^3.1.2 + google_fonts: ^6.2.1 dev_dependencies: build_runner: ^2.4.11 @@ -59,17 +60,4 @@ flutter: assets: - assets/ - assets/images/ - - .env - fonts: - - family: Segoe UI - fonts: - - asset: assets/fonts/SegoeUISemibold.ttf - weight: 600 - - family: Mulish - fonts: - - asset: assets/fonts/MulishBold.ttf - weight: 700 - - asset: assets/fonts/MulishRegular.ttf - weight: 400 - - asset: assets/fonts/MulishSemiBold.ttf - weight: 600 + - .env \ No newline at end of file From c3f7853d0ec0baa283883abb1e0ede3c5d39e376 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 9 Jul 2024 17:51:05 +0300 Subject: [PATCH 02/21] refactor(all): refactor fix --- .../recipe/recipe_select_screen/bloc/recipe_select_bloc.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart b/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart index ab262471..08f57b47 100644 --- a/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart +++ b/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart @@ -7,8 +7,6 @@ import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; import '/core/app_export.dart'; import 'package:eatvio_app/presentation/recipe/recipe_select_screen/models/recipe_select_model.dart'; -import 'package:http/http.dart' as http; -import 'dart:convert'; import 'package:hive/hive.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:image_picker/image_picker.dart'; From aacba077b7e08dc3f9e8dcfad0f0674200eac2de Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Thu, 11 Jul 2024 14:49:50 +0300 Subject: [PATCH 03/21] feature(registration): new registration flow --- lib/app_router.dart | 6 + .../registration_cubit.dart | 10 + .../registration_state.dart | 13 + .../registration_state.freezed.dart | 315 +++ .../pages/registration_screen.dart | 201 ++ .../auth/auth_screen/auth_screen.dart | 5 +- .../additional_information_screen.dart | 48 +- .../allergies_screen/allergies_screen.dart | 81 +- .../blood_pressure_screen.dart | 241 +- .../body_circumferences_screen.dart | 140 +- .../city_of_living_screen.dart | 2287 ++++++++--------- .../credentials_screen.dart | 50 +- .../date_of_birth_screen.dart | 94 +- .../favorite_foods_screen.dart | 63 +- .../favorite_sports_screen.dart | 65 +- .../gender_screen/gender_screen.dart | 57 +- .../height_screen/height_screen.dart | 88 +- .../bloc/language_select_bloc.dart | 26 +- .../language_select_screen.dart | 126 +- .../medicine_intake_screen.dart | 64 +- .../registration/name_screen/name_screen.dart | 48 +- .../weight_screen/weight_screen.dart | 109 +- lib/widgets/app_bar/appbar_title_image.dart | 6 +- 23 files changed, 2176 insertions(+), 1967 deletions(-) create mode 100644 lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart create mode 100644 lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart create mode 100644 lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart create mode 100644 lib/features/registration/presentation/pages/registration_screen.dart diff --git a/lib/app_router.dart b/lib/app_router.dart index 20905a65..5ca4a54c 100644 --- a/lib/app_router.dart +++ b/lib/app_router.dart @@ -2,6 +2,7 @@ import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart'; import 'package:eatvio_app/core/token_storage.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chat_screen.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/chat_select_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/registration_screen.dart'; import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart'; import 'package:eatvio_app/presentation/diary/diary_edit_screen/diary_edit_screen.dart'; import 'package:eatvio_app/presentation/diets/diet_create_screen/diet_create_screen.dart'; @@ -54,6 +55,11 @@ class AppRouter { }, builder: (context, state) => AuthScreen.builder(context), routes: [ + GoRoute( + path: 'registration-screen', + name: 'registrationScreen', + builder: (context, state) => const RegistrationScreen(), + ), GoRoute( path: 'language-select-screen', name: 'languageSelectScreen', diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart new file mode 100644 index 00000000..bf421e7f --- /dev/null +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart @@ -0,0 +1,10 @@ +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart'; +import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart'; + +class RegistrationCubit extends Cubit { + RegistrationCubit() : super(RegistrationState.loaded(sheet: LanguageSelectModel().userRegistrationSheet)); + + updateSheet(UserRegistrationSheet sheet) => emit(RegistrationState.loaded(sheet: sheet)); +} diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart new file mode 100644 index 00000000..b6ea767b --- /dev/null +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart @@ -0,0 +1,13 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'registration_state.freezed.dart'; + +@freezed +abstract class RegistrationState with _$RegistrationState { + const factory RegistrationState() = _RegistrationState; + + const factory RegistrationState.loaded({ + required UserRegistrationSheet sheet, + }) = RegistrationStateLoaded; +} diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart new file mode 100644 index 00000000..01b23826 --- /dev/null +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart @@ -0,0 +1,315 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'registration_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +/// @nodoc +mixin _$RegistrationState { + @optionalTypeArgs + TResult when( + TResult Function() $default, { + required TResult Function(UserRegistrationSheet sheet) loaded, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function()? $default, { + TResult? Function(UserRegistrationSheet sheet)? loaded, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen( + TResult Function()? $default, { + TResult Function(UserRegistrationSheet sheet)? loaded, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map( + TResult Function(_RegistrationState value) $default, { + required TResult Function(RegistrationStateLoaded value) loaded, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_RegistrationState value)? $default, { + TResult? Function(RegistrationStateLoaded value)? loaded, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap( + TResult Function(_RegistrationState value)? $default, { + TResult Function(RegistrationStateLoaded value)? loaded, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RegistrationStateCopyWith<$Res> { + factory $RegistrationStateCopyWith( + RegistrationState value, $Res Function(RegistrationState) then) = + _$RegistrationStateCopyWithImpl<$Res, RegistrationState>; +} + +/// @nodoc +class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> + implements $RegistrationStateCopyWith<$Res> { + _$RegistrationStateCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$RegistrationStateImplCopyWith<$Res> { + factory _$$RegistrationStateImplCopyWith(_$RegistrationStateImpl value, + $Res Function(_$RegistrationStateImpl) then) = + __$$RegistrationStateImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$RegistrationStateImplCopyWithImpl<$Res> + extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateImpl> + implements _$$RegistrationStateImplCopyWith<$Res> { + __$$RegistrationStateImplCopyWithImpl(_$RegistrationStateImpl _value, + $Res Function(_$RegistrationStateImpl) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$RegistrationStateImpl implements _RegistrationState { + const _$RegistrationStateImpl(); + + @override + String toString() { + return 'RegistrationState()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$RegistrationStateImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when( + TResult Function() $default, { + required TResult Function(UserRegistrationSheet sheet) loaded, + }) { + return $default(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function()? $default, { + TResult? Function(UserRegistrationSheet sheet)? loaded, + }) { + return $default?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen( + TResult Function()? $default, { + TResult Function(UserRegistrationSheet sheet)? loaded, + required TResult orElse(), + }) { + if ($default != null) { + return $default(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map( + TResult Function(_RegistrationState value) $default, { + required TResult Function(RegistrationStateLoaded value) loaded, + }) { + return $default(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_RegistrationState value)? $default, { + TResult? Function(RegistrationStateLoaded value)? loaded, + }) { + return $default?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap( + TResult Function(_RegistrationState value)? $default, { + TResult Function(RegistrationStateLoaded value)? loaded, + required TResult orElse(), + }) { + if ($default != null) { + return $default(this); + } + return orElse(); + } +} + +abstract class _RegistrationState implements RegistrationState { + const factory _RegistrationState() = _$RegistrationStateImpl; +} + +/// @nodoc +abstract class _$$RegistrationStateLoadedImplCopyWith<$Res> { + factory _$$RegistrationStateLoadedImplCopyWith( + _$RegistrationStateLoadedImpl value, + $Res Function(_$RegistrationStateLoadedImpl) then) = + __$$RegistrationStateLoadedImplCopyWithImpl<$Res>; + @useResult + $Res call({UserRegistrationSheet sheet}); +} + +/// @nodoc +class __$$RegistrationStateLoadedImplCopyWithImpl<$Res> + extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateLoadedImpl> + implements _$$RegistrationStateLoadedImplCopyWith<$Res> { + __$$RegistrationStateLoadedImplCopyWithImpl( + _$RegistrationStateLoadedImpl _value, + $Res Function(_$RegistrationStateLoadedImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? sheet = null, + }) { + return _then(_$RegistrationStateLoadedImpl( + sheet: null == sheet + ? _value.sheet + : sheet // ignore: cast_nullable_to_non_nullable + as UserRegistrationSheet, + )); + } +} + +/// @nodoc + +class _$RegistrationStateLoadedImpl implements RegistrationStateLoaded { + const _$RegistrationStateLoadedImpl({required this.sheet}); + + @override + final UserRegistrationSheet sheet; + + @override + String toString() { + return 'RegistrationState.loaded(sheet: $sheet)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RegistrationStateLoadedImpl && + (identical(other.sheet, sheet) || other.sheet == sheet)); + } + + @override + int get hashCode => Object.hash(runtimeType, sheet); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$RegistrationStateLoadedImplCopyWith<_$RegistrationStateLoadedImpl> + get copyWith => __$$RegistrationStateLoadedImplCopyWithImpl< + _$RegistrationStateLoadedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when( + TResult Function() $default, { + required TResult Function(UserRegistrationSheet sheet) loaded, + }) { + return loaded(sheet); + } + + @override + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function()? $default, { + TResult? Function(UserRegistrationSheet sheet)? loaded, + }) { + return loaded?.call(sheet); + } + + @override + @optionalTypeArgs + TResult maybeWhen( + TResult Function()? $default, { + TResult Function(UserRegistrationSheet sheet)? loaded, + required TResult orElse(), + }) { + if (loaded != null) { + return loaded(sheet); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map( + TResult Function(_RegistrationState value) $default, { + required TResult Function(RegistrationStateLoaded value) loaded, + }) { + return loaded(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_RegistrationState value)? $default, { + TResult? Function(RegistrationStateLoaded value)? loaded, + }) { + return loaded?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap( + TResult Function(_RegistrationState value)? $default, { + TResult Function(RegistrationStateLoaded value)? loaded, + required TResult orElse(), + }) { + if (loaded != null) { + return loaded(this); + } + return orElse(); + } +} + +abstract class RegistrationStateLoaded implements RegistrationState { + const factory RegistrationStateLoaded( + {required final UserRegistrationSheet sheet}) = + _$RegistrationStateLoadedImpl; + + UserRegistrationSheet get sheet; + @JsonKey(ignore: true) + _$$RegistrationStateLoadedImplCopyWith<_$RegistrationStateLoadedImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart new file mode 100644 index 00000000..f530f8bf --- /dev/null +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -0,0 +1,201 @@ +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/core/utils/image_constant.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart'; +import 'package:eatvio_app/presentation/registration/additional_information_screen/additional_information_screen.dart'; +import 'package:eatvio_app/presentation/registration/allergies_screen/allergies_screen.dart'; +import 'package:eatvio_app/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart'; +import 'package:eatvio_app/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart'; +import 'package:eatvio_app/presentation/registration/city_of_living_screen/city_of_living_screen.dart'; +import 'package:eatvio_app/presentation/registration/credentials_screen/bloc/credentials_bloc.dart'; +import 'package:eatvio_app/presentation/registration/credentials_screen/credentials_screen.dart'; +import 'package:eatvio_app/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart'; +import 'package:eatvio_app/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart'; +import 'package:eatvio_app/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart'; +import 'package:eatvio_app/presentation/registration/gender_screen/gender_screen.dart'; +import 'package:eatvio_app/presentation/registration/height_screen/height_screen.dart'; +import 'package:eatvio_app/presentation/registration/language_select_screen/bloc/language_select_bloc.dart'; +import 'package:eatvio_app/presentation/registration/language_select_screen/language_select_screen.dart'; +import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart'; +import 'package:eatvio_app/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart'; +import 'package:eatvio_app/presentation/registration/name_screen/name_screen.dart'; +import 'package:eatvio_app/presentation/registration/weight_screen/weight_screen.dart'; +import 'package:eatvio_app/theme/theme_helper.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; + +class RegistrationScreen extends StatefulWidget { + const RegistrationScreen({super.key}); + + @override + State createState() => _RegistrationScreenState(); +} + +class _RegistrationScreenState extends State { + double progressValue = 1 / 15; + int step = 1; + final pageController = PageController(); + + _showPopDialog() { + showDialog( + context: context, + builder: (context) => CupertinoAlertDialog( + content: Text('Отменить регистрацию? Заполненные данные не будут сохранены.'), + actions: [ + CupertinoDialogAction( + onPressed: () { + Navigator.pop(context); + GoRouter.of(context).pop(); + }, + child: Text('Да'), + ), + CupertinoDialogAction( + onPressed: () { + Navigator.pop(context); + }, + isDefaultAction: true, + child: Text('Нет'), + ) + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + return BlocProvider( + create: (BuildContext context) => RegistrationCubit(), + child: BlocBuilder( + builder: (BuildContext context, RegistrationState state) { + (state as RegistrationStateLoaded); + return PopScope( + canPop: false, + onPopInvoked: (_) => _showPopDialog(), + child: Scaffold( + floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, + floatingActionButton: Row( + children: [ + Container( + height: 48, + width: MediaQuery.of(context).size.width * 0.2, + padding: EdgeInsets.only(left: 16, right: 4), + child: FloatingActionButton.extended( + heroTag: 'backButtonRegistration', + highlightElevation: 0, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + backgroundColor: Color(0xFFEAF2FD), + onPressed: () { + if (pageController.page == 0) _showPopDialog(); + setState(() { + pageController.previousPage( + duration: const Duration(milliseconds: 350), + curve: Curves.easeInOut, + ); + }); + }, + label: Icon( + Icons.arrow_back_ios_new_rounded, + color: appTheme.blueA400, + ), + ), + ), + Container( + height: 48, + width: MediaQuery.of(context).size.width * 0.8, + padding: EdgeInsets.only(left: 4, right: 16), + child: FloatingActionButton.extended( + heroTag: 'nextButtonRegistration', + highlightElevation: 0, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + backgroundColor: appTheme.blueA400, + onPressed: () { + setState(() { + pageController.nextPage( + duration: const Duration(milliseconds: 350), + curve: Curves.easeInOut, + ); + }); + }, + label: Text( + 'Продолжить', + style: theme.textTheme.titleSmall, + ), + ), + ), + ], + ), + appBar: AppBar( + automaticallyImplyLeading: true, + centerTitle: true, + title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), + actions: [ + Padding( + padding: const EdgeInsets.only(right: 16), + child: Text('шаг $step из 15'), + ), + ], + bottom: PreferredSize( + preferredSize: Size(MediaQuery.of(context).size.width, 32), + child: Padding( + padding: const EdgeInsets.all(16), + child: TweenAnimationBuilder( + duration: const Duration(milliseconds: 350), + curve: Curves.easeInOut, + tween: Tween( + begin: 0, + end: progressValue, + ), + builder: (context, value, _) => LinearProgressIndicator( + value: value, + borderRadius: BorderRadius.circular(16), + minHeight: 8, + backgroundColor: Colors.grey.shade100, + valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + ), + ), + ), + ), + ), + body: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + onPageChanged: (index) { + setState(() { + step = index + 1; + progressValue = step / 15; + }); + }, + children: [ + LanguageSelectScreen.builder(context), + CredentialsScreen.builder(context, state.sheet), + NameScreen.builder(context, state.sheet), + GenderScreen.builder(context, state.sheet), + DateOfBirthScreen.builder(context, state.sheet), + CityOfLivingScreen.builder(context, state.sheet), + BodyCircumferencesScreen.builder(context, state.sheet), + WeightScreen.builder(context, state.sheet), + HeightScreen.builder(context, state.sheet), + BloodPressureScreen.builder(context, state.sheet), + AllergiesScreen.builder(context, state.sheet), + MedicineIntakeScreen.builder(context, state.sheet), + FavoriteSportsScreen.builder(context, state.sheet), + FavoriteFoodsScreen.builder(context, state.sheet), + AdditionalInformationScreen.builder(context, state.sheet), + ], + ), + ), + ); + }, + ), + ); + } +} diff --git a/lib/presentation/auth/auth_screen/auth_screen.dart b/lib/presentation/auth/auth_screen/auth_screen.dart index c435f2db..c2990137 100644 --- a/lib/presentation/auth/auth_screen/auth_screen.dart +++ b/lib/presentation/auth/auth_screen/auth_screen.dart @@ -168,8 +168,11 @@ class AuthScreen extends StatelessWidget { onTapNoAccount(BuildContext context) { return () { - GoRouter.of(context).goNamed('languageSelectScreen'); + GoRouter.of(context).goNamed('registrationScreen'); }; + // return () { + // GoRouter.of(context).goNamed('languageSelectScreen'); + // }; } /// Section Widget diff --git a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart index 1543cd57..94e6f548 100644 --- a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart @@ -29,46 +29,24 @@ class AdditionalInformationScreen extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column( children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (14 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), - ), - ), - SizedBox(height: 20.v), - SizedBox(height: 73.v), _buildTextFormField(context), - Spacer(), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "finish".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapFinish(state, context), - ); - }, - ), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "finish".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapFinish(state, context), + // ); + // }, + // ), ], ), ), diff --git a/lib/presentation/registration/allergies_screen/allergies_screen.dart b/lib/presentation/registration/allergies_screen/allergies_screen.dart index 0c5fac4a..e37134ec 100644 --- a/lib/presentation/registration/allergies_screen/allergies_screen.dart +++ b/lib/presentation/registration/allergies_screen/allergies_screen.dart @@ -28,57 +28,36 @@ class AllergiesScreen extends StatefulWidget { class _AllergiesScreenState extends State { @override Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column( - children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (10 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), - ), - ), - SizedBox(height: 22.v), - Text("allergies_presence".tr, style: theme.textTheme.headlineSmall), - Spacer(flex: 36), - _buildTextFormField(context), - Spacer(flex: 54), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context), - ); - }, - ), - BlocBuilder( - builder: (context, state) { - return GestureDetector( - onTap: onTapSkip(state, context), - child: Text("skip".tr, style: theme.textTheme.bodyLarge), - ); - }, - ), - ], - ), + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + Text("allergies_presence".tr, style: theme.textTheme.headlineSmall), + SizedBox(height: 22.v), + _buildTextFormField(context), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapContinue(state, context), + // ); + // }, + // ), + // BlocBuilder( + // builder: (context, state) { + // return GestureDetector( + // onTap: onTapSkip(state, context), + // child: Text("skip".tr, style: theme.textTheme.bodyLarge), + // ); + // }, + // ), + ], + ), ), ); } diff --git a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart index afce1b8b..cf3a8a35 100644 --- a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart @@ -30,148 +30,123 @@ class BloodPressureScreen extends StatefulWidget { } class _BloodPressureScreenState extends State { + final digitsOnly = FilteringTextInputFormatter.digitsOnly; + @override Widget build(BuildContext context) { - final digitsOnly = FilteringTextInputFormatter.digitsOnly; - return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 12.h, vertical: 9.v), - child: Column( - children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - padding: EdgeInsets.symmetric(horizontal: 4.h), - // Apply padding directly to the Container - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all( - color: theme.colorScheme.primary, - width: 1.h, + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 12.h, vertical: 9.v), + child: Column( + children: [ + SizedBox( + width: 224.h, + child: Text( + "your_blood_pressure".tr, + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + style: theme.textTheme.headlineSmall, ), ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (9 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), + SizedBox(height: 21.v), + Container( + margin: EdgeInsets.only(right: 1.h), + padding: EdgeInsets.symmetric(horizontal: 3.h), + child: Column( + children: [ + Text("up_pressure".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + BlocSelector( + selector: (state) => state.upPressureController, + builder: (context, upPressureController) { + return CustomTextFormField(inputFormatters: [digitsOnly], controller: upPressureController, hintText: "90".tr); + }, + ), + ], ), ), - ), - SizedBox(height: 21.v), - SizedBox( - width: 224.h, - child: Text( - "your_blood_pressure".tr, - maxLines: 2, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center, - style: theme.textTheme.headlineSmall, - ), - ), - SizedBox(height: 21.v), - Container( - margin: EdgeInsets.only(right: 1.h), - padding: EdgeInsets.symmetric(horizontal: 3.h), - child: Column( - children: [ - Text("up_pressure".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.upPressureController, - builder: (context, upPressureController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: upPressureController, hintText: "90".tr); - }, - ), - ], - ), - ), - SizedBox(height: 21.v), - Container( - margin: EdgeInsets.only(right: 1.h), - padding: EdgeInsets.symmetric(horizontal: 3.h), - child: Column( - children: [ - Text("down_pressure".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.downPressureController, - builder: (context, downPressureController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: downPressureController, hintText: "90".tr); - }, - ), - ], - ), - ), - SizedBox(height: 22.v), - Text("do_you_have_hypotension_tendency".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - Padding( - padding: EdgeInsets.symmetric(horizontal: 4.h), - child: BlocSelector( - selector: (state) => state.bloodPressureModelObj, - builder: (context, bloodPressureModelObj) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), - child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), + SizedBox(height: 21.v), + Container( + margin: EdgeInsets.only(right: 1.h), + padding: EdgeInsets.symmetric(horizontal: 3.h), + child: Column( + children: [ + Text("down_pressure".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + BlocSelector( + selector: (state) => state.downPressureController, + builder: (context, downPressureController) { + return CustomTextFormField(inputFormatters: [digitsOnly], controller: downPressureController, hintText: "90".tr); + }, ), - hintText: "Не выбрано".tr, - items: bloodPressureModelObj?.dropdownItemList ?? [], - onChanged: onChangeHyper(context), - ); - }, + ], + ), ), - ), - SizedBox(height: 22.v), - Text("do_you_have_hypertension_tendency".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - Padding( - padding: EdgeInsets.symmetric(horizontal: 4.h), - child: BlocSelector( - selector: (state) => state.bloodPressureModelObj, - builder: (context, bloodPressureModelObj) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), - child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), - ), - hintText: "Не выбрано".tr, - items: bloodPressureModelObj?.dropdownItemList ?? [], - onChanged: onChangeHypo(context), - ); - }, + SizedBox(height: 22.v), + Text("do_you_have_hypotension_tendency".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + Padding( + padding: EdgeInsets.symmetric(horizontal: 4.h), + child: BlocSelector( + selector: (state) => state.bloodPressureModelObj, + builder: (context, bloodPressureModelObj) { + return CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), + child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), + ), + hintText: "Не выбрано".tr, + items: bloodPressureModelObj?.dropdownItemList ?? [], + onChanged: onChangeHyper(context), + ); + }, + ), ), - ), - Spacer(), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context), - ); - }, - ), - BlocBuilder( - builder: (context, state) { - return GestureDetector( - onTap: onTapSkip(state, context), - child: Text("skip".tr, style: theme.textTheme.bodyLarge), - ); - }, - ), - ], - ), + SizedBox(height: 22.v), + Text("do_you_have_hypertension_tendency".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + Padding( + padding: EdgeInsets.symmetric(horizontal: 4.h), + child: BlocSelector( + selector: (state) => state.bloodPressureModelObj, + builder: (context, bloodPressureModelObj) { + return CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), + child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), + ), + hintText: "Не выбрано".tr, + items: bloodPressureModelObj?.dropdownItemList ?? [], + onChanged: onChangeHypo(context), + ); + }, + ), + ), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapContinue(state, context), + // ); + // }, + // ), + // BlocBuilder( + // builder: (context, state) { + // return GestureDetector( + // onTap: onTapSkip(state, context), + // child: Text("skip".tr, style: theme.textTheme.bodyLarge), + // ); + // }, + // ), + ], + ), ), ); } diff --git a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart b/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart index b4b696d6..96aa089e 100644 --- a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart @@ -12,7 +12,7 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class BodyCircumferencesScreen extends StatelessWidget { +class BodyCircumferencesScreen extends StatefulWidget { const BodyCircumferencesScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context, sheet) { @@ -23,87 +23,71 @@ class BodyCircumferencesScreen extends StatelessWidget { ); } + @override + State createState() => _BodyCircumferencesScreenState(); +} + +class _BodyCircumferencesScreenState extends State { + final digitsOnly = FilteringTextInputFormatter.digitsOnly; + @override Widget build(BuildContext context) { - final digitsOnly = FilteringTextInputFormatter.digitsOnly; - mediaQueryData = MediaQuery.of(context); - return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column( - children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h), + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + Text("initial_measurements".tr, style: theme.textTheme.headlineSmall), + SizedBox(height: 93.v), + Column( + children: [ + Text("chest_circumference".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + BlocSelector( + selector: (state) => state.chestCircumferenceController, + builder: (context, chestCircumferenceController) { + return CustomTextFormField(inputFormatters: [digitsOnly], controller: chestCircumferenceController, hintText: "90".tr); + }, + ), + ], ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (6 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), + SizedBox(height: 19.v), + Text("waist_circumference".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 5.v), + BlocSelector( + selector: (state) => state.waistCircumferenceController, + builder: (context, waistCircumferenceController) { + return CustomTextFormField(inputFormatters: [digitsOnly], controller: waistCircumferenceController, hintText: "60".tr); + }, ), - ), - SizedBox(height: 39.v), - Text("initial_measurements".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 93.v), - Column( - children: [ - Text("chest_circumference".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.chestCircumferenceController, - builder: (context, chestCircumferenceController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: chestCircumferenceController, hintText: "90".tr); - }, - ), - ], - ), - SizedBox(height: 19.v), - Text("waist_circumference".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 5.v), - BlocSelector( - selector: (state) => state.waistCircumferenceController, - builder: (context, waistCircumferenceController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: waistCircumferenceController, hintText: "60".tr); - }, - ), - SizedBox(height: 21.v), - Text("hip_circumference".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.hipCircumferenceController, - builder: (context, hipCircumferenceController) { - return CustomTextFormField( - inputFormatters: [digitsOnly], - controller: hipCircumferenceController, - hintText: "90".tr, - textInputAction: TextInputAction.done, - ); - }, - ), - Spacer(), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context), - ); - }, - ), - ], - ), + SizedBox(height: 21.v), + Text("hip_circumference".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + BlocSelector( + selector: (state) => state.hipCircumferenceController, + builder: (context, hipCircumferenceController) { + return CustomTextFormField( + inputFormatters: [digitsOnly], + controller: hipCircumferenceController, + hintText: "90".tr, + textInputAction: TextInputAction.done, + ); + }, + ), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapContinue(state, context), + // ); + // }, + // ), + ], + ), ), ); } diff --git a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart b/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart index cd862cd3..feb25d82 100644 --- a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart +++ b/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart @@ -25,1154 +25,16 @@ class CityOfLivingScreen extends StatelessWidget { @override Widget build(BuildContext context) { - List _options = [ - "Абаза", - "Абакан", - "Абдулино", - "Абинск", - "Агидель", - "Агрыз", - "Адыгейск", - "Азнакаево", - "Азов", - "Ак-Довурак", - "Аксай", - "Алагир", - "Алапаевск", - "Алатырь", - "Алдан", - "Алейск", - "Александров", - "Александровск", - "Александровск-Сахалинский", - "Алексеевка", - "Алексин", - "Алзамай", - "АлупкаОспаривается", - "АлуштаОспаривается", - "Альметьевск", - "Амурск", - "Анадырь", - "Анапа", - "Ангарск", - "Андреаполь", - "Анжеро-Судженск", - "Анива", - "Апатиты", - "Апрелевка", - "Апшеронск", - "Арамиль", - "Аргун", - "Ардатов", - "Ардон", - "Арзамас", - "Аркадак", - "Армавир", - "АрмянскОспаривается", - "Арсеньев", - "Арск", - "Артём", - "Артёмовск", - "Артёмовский", - "Архангельск", - "Асбест", - "Асино", - "Астрахань", - "Аткарск", - "Ахтубинск", - "Ачинск", - "Аша", - "Бабаево", - "Бабушкин", - "Бавлы", - "Багратионовск", - "Байкальск", - "Баймак", - "Бакал", - "Баксан", - "Балабаново", - "Балаково", - "Балахна", - "Балашиха", - "Балашов", - "Балей", - "Балтийск", - "Барабинск", - "Барнаул", - "Барыш", - "Батайск", - "БахчисарайОспаривается", - "Бежецк", - "Белая Калитва", - "Белая Холуница", - "Белгород", - "Белебей", - "Белёв", - "Белинский", - "Белово", - "Белогорск", - "БелогорскОспаривается", - "Белозерск", - "Белокуриха", - "Беломорск", - "Белоозёрский", - "Белорецк", - "Белореченск", - "Белоусово", - "Белоярский", - "Белый", - "Бердск", - "Березники", - "Берёзовский", - "Берёзовский", - "Беслан", - "Бийск", - "Бикин", - "Билибино", - "Биробиджан", - "Бирск", - "Бирюсинск", - "Бирюч", - "Благовещенск", - "Благовещенск", - "Благодарный", - "Бобров", - "Богданович", - "Богородицк", - "Богородск", - "Боготол", - "Богучар", - "Бодайбо", - "Бокситогорск", - "Болгар", - "Бологое", - "Болотное", - "Болохово", - "Болхов", - "Большой Камень", - "Бор", - "Борзя", - "Борисоглебск", - "Боровичи", - "Боровск", - "Бородино", - "Братск", - "Бронницы", - "Брянск", - "Бугульма", - "Бугуруслан", - "Будённовск", - "Бузулук", - "Буинск", - "Буй", - "Буйнакск", - "Бутурлиновка", - "Валдай", - "Валуйки", - "Велиж", - "Великие Луки", - "Великий Новгород", - "Великий Устюг", - "Вельск", - "Венёв", - "Верещагино", - "Верея", - "Верхнеуральск", - "Верхний Тагил", - "Верхний Уфалей", - "Верхняя Пышма", - "Верхняя Салда", - "Верхняя Тура", - "Верхотурье", - "Верхоянск", - "Весьегонск", - "Ветлуга", - "Видное", - "Вилюйск", - "Вилючинск", - "Вихоревка", - "Вичуга", - "Владивосток", - "Владикавказ", - "Владимир", - "Волгоград", - "Волгодонск", - "Волгореченск", - "Волжск", - "Волжский", - "Вологда", - "Володарск", - "Волоколамск", - "Волосово", - "Волхов", - "Волчанск", - "Вольск", - "Воркута", - "Воронеж", - "Ворсма", - "Воскресенск", - "Воткинск", - "Всеволожск", - "Вуктыл", - "Выборг", - "Выкса", - "Высоковск", - "Высоцк", - "Вытегра", - "Вышний Волочёк", - "Вяземский", - "Вязники", - "Вязьма", - "Вятские Поляны", - "Гаврилов Посад", - "Гаврилов-Ям", - "Гагарин", - "Гаджиево", - "Гай", - "Галич", - "Гатчина", - "Гвардейск", - "Гдов", - "Геленджик", - "Георгиевск", - "Глазов", - "Голицыно", - "Горбатов", - "Горно-Алтайск", - "Горнозаводск", - "Горняк", - "Городец", - "Городище", - "Городовиковск", - "Гороховец", - "Горячий Ключ", - "Грайворон", - "Гремячинск", - "Грозный", - "Грязи", - "Грязовец", - "Губаха", - "Губкин", - "Губкинский", - "Гудермес", - "Гуково", - "Гулькевичи", - "Гурьевск", - "Гурьевск", - "Гусев", - "Гусиноозёрск", - "Гусь-Хрустальный", - "Давлеканово", - "Дагестанские Огни", - "Далматово", - "Дальнегорск", - "Дальнереченск", - "Данилов", - "Данков", - "Дегтярск", - "Дедовск", - "Демидов", - "Дербент", - "Десногорск", - "ДжанкойОспаривается", - "Дзержинск", - "Дзержинский", - "Дивногорск", - "Дигора", - "Димитровград", - "Дмитриев", - "Дмитров", - "Дмитровск", - "Дно", - "Добрянка", - "Долгопрудный", - "Долинск", - "Домодедово", - "Донецк", - "Донской", - "Дорогобуж", - "Дрезна", - "Дубна", - "Дубовка", - "Дудинка", - "Духовщина", - "Дюртюли", - "Дятьково", - "ЕвпаторияОспаривается", - "Егорьевск", - "Ейск", - "Екатеринбург", - "Елабуга", - "Елец", - "Елизово", - "Ельня", - "Еманжелинск", - "Емва", - "Енисейск", - "Ермолино", - "Ершов", - "Ессентуки", - "Ефремов", - "Железноводск", - "Железногорск", - "Железногорск", - "Железногорск-Илимский", - "Жердевка", - "Жигулёвск", - "Жиздра", - "Жирновск", - "Жуков", - "Жуковка", - "Жуковский", - "Завитинск", - "Заводоуковск", - "Заволжск", - "Заволжье", - "Задонск", - "Заинск", - "Закаменск", - "Заозёрный", - "Заозёрск", - "Западная Двина", - "Заполярный", - "Зарайск", - "Заречный", - "Заречный", - "Заринск", - "Звенигово", - "Звенигород", - "Зверево", - "Зеленогорск", - "Зеленоградск", - "Зеленодольск", - "Зеленокумск", - "Зерноград", - "Зея", - "Зима", - "Златоуст", - "Злынка", - "Змеиногорск", - "Знаменск", - "Зубцов", - "Зуевка", - "Ивангород", - "Иваново", - "Ивантеевка", - "Ивдель", - "Игарка", - "Ижевск", - "Избербаш", - "Изобильный", - "Иланский", - "Инза", - "Иннополис", - "Инсар", - "Инта", - "Ипатово", - "Ирбит", - "Иркутск", - "Исилькуль", - "Искитим", - "Истра", - "Ишим", - "Ишимбай", - "Йошкар-Ола", - "Кадников", - "Казань", - "Калач", - "Калач-на-Дону", - "Калачинск", - "Калининград", - "Калининск", - "Калтан", - "Калуга", - "Калязин", - "Камбарка", - "Каменка", - "Каменногорск", - "Каменск-Уральский", - "Каменск-Шахтинский", - "Камень-на-Оби", - "Камешково", - "Камызяк", - "Камышин", - "Камышлов", - "Канаш", - "Кандалакша", - "Канск", - "Карабаново", - "Карабаш", - "Карабулак", - "Карасук", - "Карачаевск", - "Карачев", - "Каргат", - "Каргополь", - "Карпинск", - "Карталы", - "Касимов", - "Касли", - "Каспийск", - "Катав-Ивановск", - "Катайск", - "Качканар", - "Кашин", - "Кашира", - "Кедровый", - "Кемерово", - "Кемь", - "КерчьОспаривается", - "Кизел", - "Кизилюрт", - "Кизляр", - "Кимовск", - "Кимры", - "Кингисепп", - "Кинель", - "Кинешма", - "Киреевск", - "Киренск", - "Киржач", - "Кириллов", - "Кириши", - "Киров", - "Киров", - "Кировград", - "Кирово-Чепецк", - "Кировск", - "Кировск", - "Кирс", - "Кирсанов", - "Киселёвск", - "Кисловодск", - "Клин", - "Клинцы", - "Княгинино", - "Ковдор", - "Ковров", - "Ковылкино", - "Когалым", - "Кодинск", - "Козельск", - "Козловка", - "Козьмодемьянск", - "Кола", - "Кологрив", - "Коломна", - "Колпашево", - "Кольчугино", - "Коммунар", - "Комсомольск", - "Комсомольск-на-Амуре", - "Конаково", - "Кондопога", - "Кондрово", - "Константиновск", - "Копейск", - "Кораблино", - "Кореновск", - "Коркино", - "Королёв", - "Короча", - "Корсаков", - "Коряжма", - "Костерёво", - "Костомукша", - "Кострома", - "Котельники", - "Котельниково", - "Котельнич", - "Котлас", - "Котово", - "Котовск", - "Кохма", - "Красавино", - "Красноармейск", - "Красноармейск", - "Красновишерск", - "Красногорск", - "Краснодар", - "Краснозаводск", - "Краснознаменск", - "Краснознаменск", - "Краснокаменск", - "Краснокамск", - "КрасноперекопскОспаривается", - "Краснослободск", - "Краснослободск", - "Краснотурьинск", - "Красноуральск", - "Красноуфимск", - "Красноярск", - "Красный Кут", - "Красный Сулин", - "Красный Холм", - "Кремёнки", - "Кропоткин", - "Крымск", - "Кстово", - "Кубинка", - "Кувандык", - "Кувшиново", - "Кудрово", - "Кудымкар", - "Кузнецк", - "Куйбышев", - "Кукмор", - "Кулебаки", - "Кумертау", - "Кунгур", - "Купино", - "Курган", - "Курганинск", - "Курильск", - "Курлово", - "Куровское", - "Курск", - "Куртамыш", - "Курчалой", - "Курчатов", - "Куса", - "Кушва", - "Кызыл", - "Кыштым", - "Кяхта", - "Лабинск", - "Лабытнанги", - "Лагань", - "Ладушкин", - "Лаишево", - "Лакинск", - "Лангепас", - "Лахденпохья", - "Лебедянь", - "Лениногорск", - "Ленинск", - "Ленинск-Кузнецкий", - "Ленск", - "Лермонтов", - "Лесной", - "Лесозаводск", - "Лесосибирск", - "Ливны", - "Ликино-Дулёво", - "Липецк", - "Липки", - "Лиски", - "Лихославль", - "Лобня", - "Лодейное Поле", - "Лосино-Петровский", - "Луга", - "Луза", - "Лукоянов", - "Луховицы", - "Лысково", - "Лысьва", - "Лыткарино", - "Льгов", - "Любань", - "Люберцы", - "Любим", - "Людиново", - "Лянтор", - "Магадан", - "Магас", - "Магнитогорск", - "Майкоп", - "Майский", - "Макаров", - "Макарьев", - "Макушино", - "Малая Вишера", - "Малгобек", - "Малмыж", - "Малоархангельск", - "Малоярославец", - "Мамадыш", - "Мамоново", - "Мантурово", - "Мариинск", - "Мариинский Посад", - "Маркс", - "Махачкала", - "Мглин", - "Мегион", - "Медвежьегорск", - "Медногорск", - "Медынь", - "Межгорье", - "Междуреченск", - "Мезень", - "Меленки", - "Мелеуз", - "Менделеевск", - "Мензелинск", - "Мещовск", - "Миасс", - "Микунь", - "Миллерово", - "Минеральные Воды", - "Минусинск", - "Миньяр", - "Мирный", - "Мирный", - "Михайлов", - "Михайловка", - "Михайловск", - "Михайловск", - "Мичуринск", - "Могоча", - "Можайск", - "Можга", - "Моздок", - "Мончегорск", - "Морозовск", - "Моршанск", - "Мосальск", - "Москва", - "Муравленко", - "Мураши", - "Мурино", - "Мурманск", - "Муром", - "Мценск", - "Мыски", - "Мытищи", - "Мышкин", - "Набережные Челны", - "Навашино", - "Наволоки", - "Надым", - "Назарово", - "Назрань", - "Называевск", - "Нальчик", - "Нариманов", - "Наро-Фоминск", - "Нарткала", - "Нарьян-Мар", - "Находка", - "Невель", - "Невельск", - "Невинномысск", - "Невьянск", - "Нелидово", - "Неман", - "Нерехта", - "Нерчинск", - "Нерюнгри", - "Нестеров", - "Нефтегорск", - "Нефтекамск", - "Нефтекумск", - "Нефтеюганск", - "Нея", - "Нижневартовск", - "Нижнекамск", - "Нижнеудинск", - "Нижние Серги", - "Нижний Ломов", - "Нижний Новгород", - "Нижний Тагил", - "Нижняя Салда", - "Нижняя Тура", - "Николаевск", - "Николаевск-на-Амуре", - "Никольск", - "Никольск", - "Никольское", - "Новая Ладога", - "Новая Ляля", - "Новоалександровск", - "Новоалтайск", - "Новоаннинский", - "Нововоронеж", - "Новодвинск", - "Новозыбков", - "Новокубанск", - "Новокузнецк", - "Новокуйбышевск", - "Новомичуринск", - "Новомосковск", - "Новопавловск", - "Новоржев", - "Новороссийск", - "Новосибирск", - "Новосиль", - "Новосокольники", - "Новотроицк", - "Новоузенск", - "Новоульяновск", - "Новоуральск", - "Новохопёрск", - "Новочебоксарск", - "Новочеркасск", - "Новошахтинск", - "Новый Оскол", - "Новый Уренгой", - "Ногинск", - "Нолинск", - "Норильск", - "Ноябрьск", - "Нурлат", - "Нытва", - "Нюрба", - "Нягань", - "Нязепетровск", - "Няндома", - "Облучье", - "Обнинск", - "Обоянь", - "Обь", - "Одинцово", - "Озёрск", - "Озёрск", - "Озёры", - "Октябрьск", - "Октябрьский", - "Окуловка", - "Олёкминск", - "Оленегорск", - "Олонец", - "Омск", - "Омутнинск", - "Онега", - "Опочка", - "Орёл", - "Оренбург", - "Орехово-Зуево", - "Орлов", - "Орск", - "Оса", - "Осинники", - "Осташков", - "Остров", - "Островной", - "Острогожск", - "Отрадное", - "Отрадный", - "Оха", - "Оханск", - "Очёр", - "Павлово", - "Павловск", - "Павловский Посад", - "Палласовка", - "Партизанск", - "Певек", - "Пенза", - "Первомайск", - "Первоуральск", - "Перевоз", - "Пересвет", - "Переславль-Залесский", - "Пермь", - "Пестово", - "Петров Вал", - "Петровск", - "Петровск-Забайкальский", - "Петрозаводск", - "Петропавловск-Камчатский", - "Петухово", - "Петушки", - "Печора", - "Печоры", - "Пикалёво", - "Пионерский", - "Питкяранта", - "Плавск", - "Пласт", - "Плёс", - "Поворино", - "Подольск", - "Подпорожье", - "Покачи", - "Покров", - "Покровск", - "Полевской", - "Полесск", - "Полысаево", - "Полярные Зори", - "Полярный", - "Поронайск", - "Порхов", - "Похвистнево", - "Почеп", - "Починок", - "Пошехонье", - "Правдинск", - "Приволжск", - "Приморск", - "Приморск", - "Приморско-Ахтарск", - "Приозерск", - "Прокопьевск", - "Пролетарск", - "Протвино", - "Прохладный", - "Псков", - "Пугачёв", - "Пудож", - "Пустошка", - "Пучеж", - "Пушкино", - "Пущино", - "Пыталово", - "Пыть-Ях", - "Пятигорск", - "Радужный", - "Радужный", - "Райчихинск", - "Раменское", - "Рассказово", - "Ревда", - "Реж", - "Реутов", - "Ржев", - "Родники", - "Рославль", - "Россошь", - "Ростов-на-Дону", - "Ростов", - "Рошаль", - "Ртищево", - "Рубцовск", - "Рудня", - "Руза", - "Рузаевка", - "Рыбинск", - "Рыбное", - "Рыльск", - "Ряжск", - "Рязань", - "СакиОспаривается", - "Салават", - "Салаир", - "Салехард", - "Сальск", - "Самара", - "Санкт-Петербург", - "Саранск", - "Сарапул", - "Саратов", - "Саров", - "Сасово", - "Сатка", - "Сафоново", - "Саяногорск", - "Саянск", - "Светлогорск", - "Светлоград", - "Светлый", - "Светогорск", - "Свирск", - "Свободный", - "Себеж", - "СевастопольОспаривается", - "Северо-Курильск", - "Северобайкальск", - "Северодвинск", - "Североморск", - "Североуральск", - "Северск", - "Севск", - "Сегежа", - "Сельцо", - "Семёнов", - "Семикаракорск", - "Семилуки", - "Сенгилей", - "Серафимович", - "Сергач", - "Сергиев Посад", - "Сердобск", - "Серов", - "Серпухов", - "Сертолово", - "Сибай", - "Сим", - "СимферопольОспаривается", - "Сковородино", - "Скопин", - "Славгород", - "Славск", - "Славянск-на-Кубани", - "Сланцы", - "Слободской", - "Слюдянка", - "Смоленск", - "Снежинск", - "Снежногорск", - "Собинка", - "Советск", - "Советск", - "Советск", - "Советская Гавань", - "Советский", - "Сокол", - "Солигалич", - "Соликамск", - "Солнечногорск", - "Соль-Илецк", - "Сольвычегодск", - "Сольцы", - "Сорочинск", - "Сорск", - "Сортавала", - "Сосенский", - "Сосновка", - "Сосновоборск", - "Сосновый Бор", - "Сосногорск", - "Сочи", - "Спас-Деменск", - "Спас-Клепики", - "Спасск", - "Спасск-Дальний", - "Спасск-Рязанский", - "Среднеколымск", - "Среднеуральск", - "Сретенск", - "Ставрополь", - "Старая Купавна", - "Старая Русса", - "Старица", - "Стародуб", - "Старый КрымОспаривается", - "Старый Оскол", - "Стерлитамак", - "Стрежевой", - "Строитель", - "Струнино", - "Ступино", - "Суворов", - "СудакОспаривается", - "Суджа", - "Судогда", - "Суздаль", - "Сунжа", - "Суоярви", - "Сураж", - "Сургут", - "Суровикино", - "Сурск", - "Сусуман", - "Сухиничи", - "Сухой Лог", - "Сызрань", - "Сыктывкар", - "Сысерть", - "Сычёвка", - "Сясьстрой", - "Тавда", - "Таганрог", - "Тайга", - "Тайшет", - "Талдом", - "Талица", - "Тамбов", - "Тара", - "Тарко-Сале", - "Таруса", - "Татарск", - "Таштагол", - "Тверь", - "Теберда", - "Тейково", - "Темников", - "Темрюк", - "Терек", - "Тетюши", - "Тимашёвск", - "Тихвин", - "Тихорецк", - "Тобольск", - "Тогучин", - "Тольятти", - "Томари", - "Томмот", - "Томск", - "Топки", - "Торжок", - "Торопец", - "Тосно", - "Тотьма", - "Трёхгорный", - "Троицк", - "Трубчевск", - "Туапсе", - "Туймазы", - "Тула", - "Тулун", - "Туран", - "Туринск", - "Тутаев", - "Тында", - "Тырныауз", - "Тюкалинск", - "Тюмень", - "Уварово", - "Углегорск", - "Углич", - "Удачный", - "Удомля", - "Ужур", - "Узловая", - "Улан-Удэ", - "Ульяновск", - "Унеча", - "Урай", - "Урень", - "Уржум", - "Урус-Мартан", - "Урюпинск", - "Усинск", - "Усмань", - "Усолье-Сибирское", - "Усолье", - "Уссурийск", - "Усть-Джегута", - "Усть-Илимск", - "Усть-Катав", - "Усть-Кут", - "Усть-Лабинск", - "Устюжна", - "Уфа", - "Ухта", - "Учалы", - "Уяр", - "Фатеж", - "ФеодосияОспаривается", - "Фокино", - "Фокино", - "Фролово", - "Фрязино", - "Фурманов", - "Хабаровск", - "Хадыженск", - "Ханты-Мансийск", - "Харабали", - "Харовск", - "Хасавюрт", - "Хвалынск", - "Хилок", - "Химки", - "Холм", - "Холмск", - "Хотьково", - "Цивильск", - "Цимлянск", - "Циолковский", - "Чадан", - "Чайковский", - "Чапаевск", - "Чаплыгин", - "Чебаркуль", - "Чебоксары", - "Чегем", - "Чекалин", - "Челябинск", - "Чердынь", - "Черемхово", - "Черепаново", - "Череповец", - "Черкесск", - "Чёрмоз", - "Черноголовка", - "Черногорск", - "Чернушка", - "Черняховск", - "Чехов", - "Чистополь", - "Чита", - "Чкаловск", - "Чудово", - "Чулым", - "Чусовой", - "Чухлома", - "Шагонар", - "Шадринск", - "Шали", - "Шарыпово", - "Шарья", - "Шатура", - "Шахты", - "Шахунья", - "Шацк", - "Шебекино", - "Шелехов", - "Шенкурск", - "Шилка", - "Шимановск", - "Шиханы", - "Шлиссельбург", - "Шумерля", - "Шумиха", - "Шуя", - "Щёкино", - "ЩёлкиноОспаривается", - "Щёлково", - "Щигры", - "Щучье", - "Электрогорск", - "Электросталь", - "Электроугли", - "Элиста", - "Энгельс", - "Эртиль", - "Югорск", - "Южа", - "Южно-Сахалинск", - "Южно-Сухокумск", - "Южноуральск", - "Юрга", - "Юрьев-Польский", - "Юрьевец", - "Юрюзань", - "Юхнов", - "Ядрин", - "Якутск", - "ЯлтаОспаривается", - "Ялуторовск", - "Янаул", - "Яранск", - "Яровое", - "Ярославль", - "Ярцево", - "Ясногорск", - "Ясный", - "Яхрома", - ]; - - return Scaffold( - appBar: _buildAppBar(context), - body: Container( + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column( children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (5 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), - ), - ), SizedBox(height: 39.v), Text("place_of_living".tr, style: theme.textTheme.headlineSmall), - Spacer(flex: 34), + SizedBox(height: 39.v), Text("country".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 2.v), BlocSelector( @@ -1242,17 +104,16 @@ class CityOfLivingScreen extends StatelessWidget { ); }, ), - Spacer(flex: 65), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context), - ); - }, - ), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapContinue(state, context), + // ); + // }, + // ), ], ), ), @@ -1309,3 +170,1123 @@ buildOptions(List _options) { }); }; } + +const List _options = const [ + "Абаза", + "Абакан", + "Абдулино", + "Абинск", + "Агидель", + "Агрыз", + "Адыгейск", + "Азнакаево", + "Азов", + "Ак-Довурак", + "Аксай", + "Алагир", + "Алапаевск", + "Алатырь", + "Алдан", + "Алейск", + "Александров", + "Александровск", + "Александровск-Сахалинский", + "Алексеевка", + "Алексин", + "Алзамай", + "АлупкаОспаривается", + "АлуштаОспаривается", + "Альметьевск", + "Амурск", + "Анадырь", + "Анапа", + "Ангарск", + "Андреаполь", + "Анжеро-Судженск", + "Анива", + "Апатиты", + "Апрелевка", + "Апшеронск", + "Арамиль", + "Аргун", + "Ардатов", + "Ардон", + "Арзамас", + "Аркадак", + "Армавир", + "АрмянскОспаривается", + "Арсеньев", + "Арск", + "Артём", + "Артёмовск", + "Артёмовский", + "Архангельск", + "Асбест", + "Асино", + "Астрахань", + "Аткарск", + "Ахтубинск", + "Ачинск", + "Аша", + "Бабаево", + "Бабушкин", + "Бавлы", + "Багратионовск", + "Байкальск", + "Баймак", + "Бакал", + "Баксан", + "Балабаново", + "Балаково", + "Балахна", + "Балашиха", + "Балашов", + "Балей", + "Балтийск", + "Барабинск", + "Барнаул", + "Барыш", + "Батайск", + "БахчисарайОспаривается", + "Бежецк", + "Белая Калитва", + "Белая Холуница", + "Белгород", + "Белебей", + "Белёв", + "Белинский", + "Белово", + "Белогорск", + "БелогорскОспаривается", + "Белозерск", + "Белокуриха", + "Беломорск", + "Белоозёрский", + "Белорецк", + "Белореченск", + "Белоусово", + "Белоярский", + "Белый", + "Бердск", + "Березники", + "Берёзовский", + "Берёзовский", + "Беслан", + "Бийск", + "Бикин", + "Билибино", + "Биробиджан", + "Бирск", + "Бирюсинск", + "Бирюч", + "Благовещенск", + "Благовещенск", + "Благодарный", + "Бобров", + "Богданович", + "Богородицк", + "Богородск", + "Боготол", + "Богучар", + "Бодайбо", + "Бокситогорск", + "Болгар", + "Бологое", + "Болотное", + "Болохово", + "Болхов", + "Большой Камень", + "Бор", + "Борзя", + "Борисоглебск", + "Боровичи", + "Боровск", + "Бородино", + "Братск", + "Бронницы", + "Брянск", + "Бугульма", + "Бугуруслан", + "Будённовск", + "Бузулук", + "Буинск", + "Буй", + "Буйнакск", + "Бутурлиновка", + "Валдай", + "Валуйки", + "Велиж", + "Великие Луки", + "Великий Новгород", + "Великий Устюг", + "Вельск", + "Венёв", + "Верещагино", + "Верея", + "Верхнеуральск", + "Верхний Тагил", + "Верхний Уфалей", + "Верхняя Пышма", + "Верхняя Салда", + "Верхняя Тура", + "Верхотурье", + "Верхоянск", + "Весьегонск", + "Ветлуга", + "Видное", + "Вилюйск", + "Вилючинск", + "Вихоревка", + "Вичуга", + "Владивосток", + "Владикавказ", + "Владимир", + "Волгоград", + "Волгодонск", + "Волгореченск", + "Волжск", + "Волжский", + "Вологда", + "Володарск", + "Волоколамск", + "Волосово", + "Волхов", + "Волчанск", + "Вольск", + "Воркута", + "Воронеж", + "Ворсма", + "Воскресенск", + "Воткинск", + "Всеволожск", + "Вуктыл", + "Выборг", + "Выкса", + "Высоковск", + "Высоцк", + "Вытегра", + "Вышний Волочёк", + "Вяземский", + "Вязники", + "Вязьма", + "Вятские Поляны", + "Гаврилов Посад", + "Гаврилов-Ям", + "Гагарин", + "Гаджиево", + "Гай", + "Галич", + "Гатчина", + "Гвардейск", + "Гдов", + "Геленджик", + "Георгиевск", + "Глазов", + "Голицыно", + "Горбатов", + "Горно-Алтайск", + "Горнозаводск", + "Горняк", + "Городец", + "Городище", + "Городовиковск", + "Гороховец", + "Горячий Ключ", + "Грайворон", + "Гремячинск", + "Грозный", + "Грязи", + "Грязовец", + "Губаха", + "Губкин", + "Губкинский", + "Гудермес", + "Гуково", + "Гулькевичи", + "Гурьевск", + "Гурьевск", + "Гусев", + "Гусиноозёрск", + "Гусь-Хрустальный", + "Давлеканово", + "Дагестанские Огни", + "Далматово", + "Дальнегорск", + "Дальнереченск", + "Данилов", + "Данков", + "Дегтярск", + "Дедовск", + "Демидов", + "Дербент", + "Десногорск", + "ДжанкойОспаривается", + "Дзержинск", + "Дзержинский", + "Дивногорск", + "Дигора", + "Димитровград", + "Дмитриев", + "Дмитров", + "Дмитровск", + "Дно", + "Добрянка", + "Долгопрудный", + "Долинск", + "Домодедово", + "Донецк", + "Донской", + "Дорогобуж", + "Дрезна", + "Дубна", + "Дубовка", + "Дудинка", + "Духовщина", + "Дюртюли", + "Дятьково", + "ЕвпаторияОспаривается", + "Егорьевск", + "Ейск", + "Екатеринбург", + "Елабуга", + "Елец", + "Елизово", + "Ельня", + "Еманжелинск", + "Емва", + "Енисейск", + "Ермолино", + "Ершов", + "Ессентуки", + "Ефремов", + "Железноводск", + "Железногорск", + "Железногорск", + "Железногорск-Илимский", + "Жердевка", + "Жигулёвск", + "Жиздра", + "Жирновск", + "Жуков", + "Жуковка", + "Жуковский", + "Завитинск", + "Заводоуковск", + "Заволжск", + "Заволжье", + "Задонск", + "Заинск", + "Закаменск", + "Заозёрный", + "Заозёрск", + "Западная Двина", + "Заполярный", + "Зарайск", + "Заречный", + "Заречный", + "Заринск", + "Звенигово", + "Звенигород", + "Зверево", + "Зеленогорск", + "Зеленоградск", + "Зеленодольск", + "Зеленокумск", + "Зерноград", + "Зея", + "Зима", + "Златоуст", + "Злынка", + "Змеиногорск", + "Знаменск", + "Зубцов", + "Зуевка", + "Ивангород", + "Иваново", + "Ивантеевка", + "Ивдель", + "Игарка", + "Ижевск", + "Избербаш", + "Изобильный", + "Иланский", + "Инза", + "Иннополис", + "Инсар", + "Инта", + "Ипатово", + "Ирбит", + "Иркутск", + "Исилькуль", + "Искитим", + "Истра", + "Ишим", + "Ишимбай", + "Йошкар-Ола", + "Кадников", + "Казань", + "Калач", + "Калач-на-Дону", + "Калачинск", + "Калининград", + "Калининск", + "Калтан", + "Калуга", + "Калязин", + "Камбарка", + "Каменка", + "Каменногорск", + "Каменск-Уральский", + "Каменск-Шахтинский", + "Камень-на-Оби", + "Камешково", + "Камызяк", + "Камышин", + "Камышлов", + "Канаш", + "Кандалакша", + "Канск", + "Карабаново", + "Карабаш", + "Карабулак", + "Карасук", + "Карачаевск", + "Карачев", + "Каргат", + "Каргополь", + "Карпинск", + "Карталы", + "Касимов", + "Касли", + "Каспийск", + "Катав-Ивановск", + "Катайск", + "Качканар", + "Кашин", + "Кашира", + "Кедровый", + "Кемерово", + "Кемь", + "КерчьОспаривается", + "Кизел", + "Кизилюрт", + "Кизляр", + "Кимовск", + "Кимры", + "Кингисепп", + "Кинель", + "Кинешма", + "Киреевск", + "Киренск", + "Киржач", + "Кириллов", + "Кириши", + "Киров", + "Киров", + "Кировград", + "Кирово-Чепецк", + "Кировск", + "Кировск", + "Кирс", + "Кирсанов", + "Киселёвск", + "Кисловодск", + "Клин", + "Клинцы", + "Княгинино", + "Ковдор", + "Ковров", + "Ковылкино", + "Когалым", + "Кодинск", + "Козельск", + "Козловка", + "Козьмодемьянск", + "Кола", + "Кологрив", + "Коломна", + "Колпашево", + "Кольчугино", + "Коммунар", + "Комсомольск", + "Комсомольск-на-Амуре", + "Конаково", + "Кондопога", + "Кондрово", + "Константиновск", + "Копейск", + "Кораблино", + "Кореновск", + "Коркино", + "Королёв", + "Короча", + "Корсаков", + "Коряжма", + "Костерёво", + "Костомукша", + "Кострома", + "Котельники", + "Котельниково", + "Котельнич", + "Котлас", + "Котово", + "Котовск", + "Кохма", + "Красавино", + "Красноармейск", + "Красноармейск", + "Красновишерск", + "Красногорск", + "Краснодар", + "Краснозаводск", + "Краснознаменск", + "Краснознаменск", + "Краснокаменск", + "Краснокамск", + "КрасноперекопскОспаривается", + "Краснослободск", + "Краснослободск", + "Краснотурьинск", + "Красноуральск", + "Красноуфимск", + "Красноярск", + "Красный Кут", + "Красный Сулин", + "Красный Холм", + "Кремёнки", + "Кропоткин", + "Крымск", + "Кстово", + "Кубинка", + "Кувандык", + "Кувшиново", + "Кудрово", + "Кудымкар", + "Кузнецк", + "Куйбышев", + "Кукмор", + "Кулебаки", + "Кумертау", + "Кунгур", + "Купино", + "Курган", + "Курганинск", + "Курильск", + "Курлово", + "Куровское", + "Курск", + "Куртамыш", + "Курчалой", + "Курчатов", + "Куса", + "Кушва", + "Кызыл", + "Кыштым", + "Кяхта", + "Лабинск", + "Лабытнанги", + "Лагань", + "Ладушкин", + "Лаишево", + "Лакинск", + "Лангепас", + "Лахденпохья", + "Лебедянь", + "Лениногорск", + "Ленинск", + "Ленинск-Кузнецкий", + "Ленск", + "Лермонтов", + "Лесной", + "Лесозаводск", + "Лесосибирск", + "Ливны", + "Ликино-Дулёво", + "Липецк", + "Липки", + "Лиски", + "Лихославль", + "Лобня", + "Лодейное Поле", + "Лосино-Петровский", + "Луга", + "Луза", + "Лукоянов", + "Луховицы", + "Лысково", + "Лысьва", + "Лыткарино", + "Льгов", + "Любань", + "Люберцы", + "Любим", + "Людиново", + "Лянтор", + "Магадан", + "Магас", + "Магнитогорск", + "Майкоп", + "Майский", + "Макаров", + "Макарьев", + "Макушино", + "Малая Вишера", + "Малгобек", + "Малмыж", + "Малоархангельск", + "Малоярославец", + "Мамадыш", + "Мамоново", + "Мантурово", + "Мариинск", + "Мариинский Посад", + "Маркс", + "Махачкала", + "Мглин", + "Мегион", + "Медвежьегорск", + "Медногорск", + "Медынь", + "Межгорье", + "Междуреченск", + "Мезень", + "Меленки", + "Мелеуз", + "Менделеевск", + "Мензелинск", + "Мещовск", + "Миасс", + "Микунь", + "Миллерово", + "Минеральные Воды", + "Минусинск", + "Миньяр", + "Мирный", + "Мирный", + "Михайлов", + "Михайловка", + "Михайловск", + "Михайловск", + "Мичуринск", + "Могоча", + "Можайск", + "Можга", + "Моздок", + "Мончегорск", + "Морозовск", + "Моршанск", + "Мосальск", + "Москва", + "Муравленко", + "Мураши", + "Мурино", + "Мурманск", + "Муром", + "Мценск", + "Мыски", + "Мытищи", + "Мышкин", + "Набережные Челны", + "Навашино", + "Наволоки", + "Надым", + "Назарово", + "Назрань", + "Называевск", + "Нальчик", + "Нариманов", + "Наро-Фоминск", + "Нарткала", + "Нарьян-Мар", + "Находка", + "Невель", + "Невельск", + "Невинномысск", + "Невьянск", + "Нелидово", + "Неман", + "Нерехта", + "Нерчинск", + "Нерюнгри", + "Нестеров", + "Нефтегорск", + "Нефтекамск", + "Нефтекумск", + "Нефтеюганск", + "Нея", + "Нижневартовск", + "Нижнекамск", + "Нижнеудинск", + "Нижние Серги", + "Нижний Ломов", + "Нижний Новгород", + "Нижний Тагил", + "Нижняя Салда", + "Нижняя Тура", + "Николаевск", + "Николаевск-на-Амуре", + "Никольск", + "Никольск", + "Никольское", + "Новая Ладога", + "Новая Ляля", + "Новоалександровск", + "Новоалтайск", + "Новоаннинский", + "Нововоронеж", + "Новодвинск", + "Новозыбков", + "Новокубанск", + "Новокузнецк", + "Новокуйбышевск", + "Новомичуринск", + "Новомосковск", + "Новопавловск", + "Новоржев", + "Новороссийск", + "Новосибирск", + "Новосиль", + "Новосокольники", + "Новотроицк", + "Новоузенск", + "Новоульяновск", + "Новоуральск", + "Новохопёрск", + "Новочебоксарск", + "Новочеркасск", + "Новошахтинск", + "Новый Оскол", + "Новый Уренгой", + "Ногинск", + "Нолинск", + "Норильск", + "Ноябрьск", + "Нурлат", + "Нытва", + "Нюрба", + "Нягань", + "Нязепетровск", + "Няндома", + "Облучье", + "Обнинск", + "Обоянь", + "Обь", + "Одинцово", + "Озёрск", + "Озёрск", + "Озёры", + "Октябрьск", + "Октябрьский", + "Окуловка", + "Олёкминск", + "Оленегорск", + "Олонец", + "Омск", + "Омутнинск", + "Онега", + "Опочка", + "Орёл", + "Оренбург", + "Орехово-Зуево", + "Орлов", + "Орск", + "Оса", + "Осинники", + "Осташков", + "Остров", + "Островной", + "Острогожск", + "Отрадное", + "Отрадный", + "Оха", + "Оханск", + "Очёр", + "Павлово", + "Павловск", + "Павловский Посад", + "Палласовка", + "Партизанск", + "Певек", + "Пенза", + "Первомайск", + "Первоуральск", + "Перевоз", + "Пересвет", + "Переславль-Залесский", + "Пермь", + "Пестово", + "Петров Вал", + "Петровск", + "Петровск-Забайкальский", + "Петрозаводск", + "Петропавловск-Камчатский", + "Петухово", + "Петушки", + "Печора", + "Печоры", + "Пикалёво", + "Пионерский", + "Питкяранта", + "Плавск", + "Пласт", + "Плёс", + "Поворино", + "Подольск", + "Подпорожье", + "Покачи", + "Покров", + "Покровск", + "Полевской", + "Полесск", + "Полысаево", + "Полярные Зори", + "Полярный", + "Поронайск", + "Порхов", + "Похвистнево", + "Почеп", + "Починок", + "Пошехонье", + "Правдинск", + "Приволжск", + "Приморск", + "Приморск", + "Приморско-Ахтарск", + "Приозерск", + "Прокопьевск", + "Пролетарск", + "Протвино", + "Прохладный", + "Псков", + "Пугачёв", + "Пудож", + "Пустошка", + "Пучеж", + "Пушкино", + "Пущино", + "Пыталово", + "Пыть-Ях", + "Пятигорск", + "Радужный", + "Радужный", + "Райчихинск", + "Раменское", + "Рассказово", + "Ревда", + "Реж", + "Реутов", + "Ржев", + "Родники", + "Рославль", + "Россошь", + "Ростов-на-Дону", + "Ростов", + "Рошаль", + "Ртищево", + "Рубцовск", + "Рудня", + "Руза", + "Рузаевка", + "Рыбинск", + "Рыбное", + "Рыльск", + "Ряжск", + "Рязань", + "СакиОспаривается", + "Салават", + "Салаир", + "Салехард", + "Сальск", + "Самара", + "Санкт-Петербург", + "Саранск", + "Сарапул", + "Саратов", + "Саров", + "Сасово", + "Сатка", + "Сафоново", + "Саяногорск", + "Саянск", + "Светлогорск", + "Светлоград", + "Светлый", + "Светогорск", + "Свирск", + "Свободный", + "Себеж", + "СевастопольОспаривается", + "Северо-Курильск", + "Северобайкальск", + "Северодвинск", + "Североморск", + "Североуральск", + "Северск", + "Севск", + "Сегежа", + "Сельцо", + "Семёнов", + "Семикаракорск", + "Семилуки", + "Сенгилей", + "Серафимович", + "Сергач", + "Сергиев Посад", + "Сердобск", + "Серов", + "Серпухов", + "Сертолово", + "Сибай", + "Сим", + "СимферопольОспаривается", + "Сковородино", + "Скопин", + "Славгород", + "Славск", + "Славянск-на-Кубани", + "Сланцы", + "Слободской", + "Слюдянка", + "Смоленск", + "Снежинск", + "Снежногорск", + "Собинка", + "Советск", + "Советск", + "Советск", + "Советская Гавань", + "Советский", + "Сокол", + "Солигалич", + "Соликамск", + "Солнечногорск", + "Соль-Илецк", + "Сольвычегодск", + "Сольцы", + "Сорочинск", + "Сорск", + "Сортавала", + "Сосенский", + "Сосновка", + "Сосновоборск", + "Сосновый Бор", + "Сосногорск", + "Сочи", + "Спас-Деменск", + "Спас-Клепики", + "Спасск", + "Спасск-Дальний", + "Спасск-Рязанский", + "Среднеколымск", + "Среднеуральск", + "Сретенск", + "Ставрополь", + "Старая Купавна", + "Старая Русса", + "Старица", + "Стародуб", + "Старый КрымОспаривается", + "Старый Оскол", + "Стерлитамак", + "Стрежевой", + "Строитель", + "Струнино", + "Ступино", + "Суворов", + "СудакОспаривается", + "Суджа", + "Судогда", + "Суздаль", + "Сунжа", + "Суоярви", + "Сураж", + "Сургут", + "Суровикино", + "Сурск", + "Сусуман", + "Сухиничи", + "Сухой Лог", + "Сызрань", + "Сыктывкар", + "Сысерть", + "Сычёвка", + "Сясьстрой", + "Тавда", + "Таганрог", + "Тайга", + "Тайшет", + "Талдом", + "Талица", + "Тамбов", + "Тара", + "Тарко-Сале", + "Таруса", + "Татарск", + "Таштагол", + "Тверь", + "Теберда", + "Тейково", + "Темников", + "Темрюк", + "Терек", + "Тетюши", + "Тимашёвск", + "Тихвин", + "Тихорецк", + "Тобольск", + "Тогучин", + "Тольятти", + "Томари", + "Томмот", + "Томск", + "Топки", + "Торжок", + "Торопец", + "Тосно", + "Тотьма", + "Трёхгорный", + "Троицк", + "Трубчевск", + "Туапсе", + "Туймазы", + "Тула", + "Тулун", + "Туран", + "Туринск", + "Тутаев", + "Тында", + "Тырныауз", + "Тюкалинск", + "Тюмень", + "Уварово", + "Углегорск", + "Углич", + "Удачный", + "Удомля", + "Ужур", + "Узловая", + "Улан-Удэ", + "Ульяновск", + "Унеча", + "Урай", + "Урень", + "Уржум", + "Урус-Мартан", + "Урюпинск", + "Усинск", + "Усмань", + "Усолье-Сибирское", + "Усолье", + "Уссурийск", + "Усть-Джегута", + "Усть-Илимск", + "Усть-Катав", + "Усть-Кут", + "Усть-Лабинск", + "Устюжна", + "Уфа", + "Ухта", + "Учалы", + "Уяр", + "Фатеж", + "ФеодосияОспаривается", + "Фокино", + "Фокино", + "Фролово", + "Фрязино", + "Фурманов", + "Хабаровск", + "Хадыженск", + "Ханты-Мансийск", + "Харабали", + "Харовск", + "Хасавюрт", + "Хвалынск", + "Хилок", + "Химки", + "Холм", + "Холмск", + "Хотьково", + "Цивильск", + "Цимлянск", + "Циолковский", + "Чадан", + "Чайковский", + "Чапаевск", + "Чаплыгин", + "Чебаркуль", + "Чебоксары", + "Чегем", + "Чекалин", + "Челябинск", + "Чердынь", + "Черемхово", + "Черепаново", + "Череповец", + "Черкесск", + "Чёрмоз", + "Черноголовка", + "Черногорск", + "Чернушка", + "Черняховск", + "Чехов", + "Чистополь", + "Чита", + "Чкаловск", + "Чудово", + "Чулым", + "Чусовой", + "Чухлома", + "Шагонар", + "Шадринск", + "Шали", + "Шарыпово", + "Шарья", + "Шатура", + "Шахты", + "Шахунья", + "Шацк", + "Шебекино", + "Шелехов", + "Шенкурск", + "Шилка", + "Шимановск", + "Шиханы", + "Шлиссельбург", + "Шумерля", + "Шумиха", + "Шуя", + "Щёкино", + "ЩёлкиноОспаривается", + "Щёлково", + "Щигры", + "Щучье", + "Электрогорск", + "Электросталь", + "Электроугли", + "Элиста", + "Энгельс", + "Эртиль", + "Югорск", + "Южа", + "Южно-Сахалинск", + "Южно-Сухокумск", + "Южноуральск", + "Юрга", + "Юрьев-Польский", + "Юрьевец", + "Юрюзань", + "Юхнов", + "Ядрин", + "Якутск", + "ЯлтаОспаривается", + "Ялуторовск", + "Янаул", + "Яранск", + "Яровое", + "Ярославль", + "Ярцево", + "Ясногорск", + "Ясный", + "Яхрома", +]; diff --git a/lib/presentation/registration/credentials_screen/credentials_screen.dart b/lib/presentation/registration/credentials_screen/credentials_screen.dart index 23517a05..8fab0f47 100644 --- a/lib/presentation/registration/credentials_screen/credentials_screen.dart +++ b/lib/presentation/registration/credentials_screen/credentials_screen.dart @@ -6,7 +6,6 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:validators/validators.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -25,34 +24,14 @@ class CredentialsScreen extends StatelessWidget { @override Widget build(BuildContext context) { - mediaQueryData = MediaQuery.of(context); - return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column( + mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (1 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), - ), - ), - SizedBox(height: 39.v), Text("user_registration".tr, style: theme.textTheme.headlineSmall), SizedBox(height: 16.v), Text("email".tr, style: theme.textTheme.bodyLarge), @@ -93,17 +72,16 @@ class CredentialsScreen extends StatelessWidget { return CustomTextFormField(obscureText: true, controller: passwordConfirmationController, textInputAction: TextInputAction.done); }, ), - Spacer(), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context), - ); - }, - ), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapContinue(state, context), + // ); + // }, + // ), ], ), ), diff --git a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart index e6a223ff..9683947d 100644 --- a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:go_router/go_router.dart'; import 'bloc/date_of_birth_bloc.dart'; @@ -35,53 +36,33 @@ class _DateOfBirthScreenState extends State { @override Widget build(BuildContext context) { - mediaQueryData = MediaQuery.of(context); - return BlocBuilder( - builder: (context, state) { - return Scaffold( - appBar: _buildAppBar(context), - body: Container( + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: BlocBuilder( + builder: (context, state) { + return Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column( children: [ - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (4 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), - ), - ), - SizedBox(height: 38.v), Text("date_of_birth".tr, style: theme.textTheme.headlineSmall), - Spacer(flex: 39), + const SizedBox(height: 32), _buildDateInput(context), - Spacer(flex: 60), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context), - ); - }, - ), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapContinue(state, context), + // ); + // }, + // ), ], ), - ), - ); - }, + ); + }, + ), ); } @@ -138,10 +119,43 @@ class _DateOfBirthScreenState extends State { onTapCalendar(BuildContext context) { return () { - openDatePickerDialog(context); + // openDatePickerDialog(context); + _showDialog( + CupertinoDatePicker( + initialDateTime: DateTime.now(), + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (DateTime newTime) { + setState(() { + selectedDate = newTime; + }); + }, + ), + ); }; } + void _showDialog(Widget child) { + showCupertinoModalPopup( + context: context, + builder: (BuildContext context) => Container( + height: 216, + padding: const EdgeInsets.only(top: 6.0), + // The Bottom margin is provided to align the popup above the system + // navigation bar. + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), + // Provide a background color for the popup. + color: CupertinoColors.systemBackground.resolveFrom(context), + // Use a SafeArea widget to avoid system overlaps. + child: SafeArea( + top: false, + child: child, + ), + ), + ); + } + /// Navigates to the previous screen. onTapArrowLeft(BuildContext context) { GoRouter.of(context).pop(); diff --git a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart index 76601189..8aaaa485 100644 --- a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart @@ -29,33 +29,13 @@ class FavoriteFoodsScreen extends StatefulWidget { class _FavoriteFoodsScreenState extends State { @override Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column( children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (13 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), - ), - ), - SizedBox(height: 19.v), Container( width: 327.h, margin: EdgeInsets.only(left: 8.h, right: 7.h), @@ -71,25 +51,24 @@ class _FavoriteFoodsScreenState extends State { _buildTextFormFieldFav(context), SizedBox(height: 12.v), _buildTextFormFieldUnfav(context), - Spacer(), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 40.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context), - ); - }, - ), - BlocBuilder( - builder: (context, state) { - return GestureDetector( - onTap: onTapSkip(state, context), - child: Text("skip".tr, style: theme.textTheme.bodyLarge), - ); - }, - ), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 40.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapContinue(state, context), + // ); + // }, + // ), + // BlocBuilder( + // builder: (context, state) { + // return GestureDetector( + // onTap: onTapSkip(state, context), + // child: Text("skip".tr, style: theme.textTheme.bodyLarge), + // ); + // }, + // ), ], ), ), diff --git a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart index 187a2848..2ff9f3ca 100644 --- a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart @@ -29,56 +29,35 @@ class FavoriteSportsScreen extends StatefulWidget { class _FavoriteSportsScreenState extends State { @override Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 5.v), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - SizedBox(height: 20.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (12 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), - ), - ), - SizedBox(height: 38.v), Text("your_favorite_sports".tr, style: theme.textTheme.headlineSmall), - Spacer(flex: 32), + SizedBox(height: 22.v), _buildTextFormFieldSection(context), - Spacer(flex: 67), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapContinue(state, context), - ); - }, - ), - BlocBuilder( - builder: (context, state) { - return GestureDetector( - onTap: onTapSkip(state, context), - child: Text("skip".tr, style: theme.textTheme.bodyLarge), - ); - }, - ), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapContinue(state, context), + // ); + // }, + // ), + // BlocBuilder( + // builder: (context, state) { + // return GestureDetector( + // onTap: onTapSkip(state, context), + // child: Text("skip".tr, style: theme.textTheme.bodyLarge), + // ); + // }, + // ), ], ), ), diff --git a/lib/presentation/registration/gender_screen/gender_screen.dart b/lib/presentation/registration/gender_screen/gender_screen.dart index 8fc7d23d..df642d61 100644 --- a/lib/presentation/registration/gender_screen/gender_screen.dart +++ b/lib/presentation/registration/gender_screen/gender_screen.dart @@ -31,35 +31,15 @@ class GenderScreen extends StatefulWidget { class _GenderScreenState extends State { @override Widget build(BuildContext context) { - mediaQueryData = MediaQuery.of(context); - return BlocBuilder( - builder: (context, state) { - return Scaffold( - appBar: _buildAppBar(context), - body: Container( + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: BlocBuilder( + builder: (context, state) { + return Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column( children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (3 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), - ), - ), - SizedBox(height: 36.v), Text("your_gender".tr, style: theme.textTheme.headlineSmall), RadioListTile( title: Text('Мужской'), @@ -83,22 +63,21 @@ class _GenderScreenState extends State { height: 40, ), ), - Spacer(flex: 66), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapNext(state, context), - ); - }, - ), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapNext(state, context), + // ); + // }, + // ), ], ), - ), - ); - }, + ); + }, + ), ); } diff --git a/lib/presentation/registration/height_screen/height_screen.dart b/lib/presentation/registration/height_screen/height_screen.dart index c990dc9b..5adc277f 100644 --- a/lib/presentation/registration/height_screen/height_screen.dart +++ b/lib/presentation/registration/height_screen/height_screen.dart @@ -24,84 +24,40 @@ class HeightScreen extends StatelessWidget { @override Widget build(BuildContext context) { - mediaQueryData = MediaQuery.of(context); - return Scaffold( - appBar: _buildAppBar(context), - body: Container( + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column( children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all( - color: theme.colorScheme.primary, - width: 1.h, - ), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (8 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation( - appTheme.blueA400, - ), - ), - ), + Text( + "height_measurements".tr, + style: theme.textTheme.headlineSmall, ), - SizedBox(height: 39.v), + SizedBox(height: 174.v), Column( children: [ Text( - "height_measurements".tr, - style: theme.textTheme.headlineSmall, + "your_height".tr, + style: theme.textTheme.bodyLarge, ), - SizedBox(height: 174.v), - Column( - children: [ - Text( - "your_height".tr, - style: theme.textTheme.bodyLarge, - ), - SizedBox(height: 4.v), - BlocBuilder( - builder: (context, state) { - return CustomTextFormField( - width: 150.h, - textInputAction: TextInputAction.done, - controller: state.heightController, - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], - ); - }, - ), - ], + SizedBox(height: 4.v), + BlocBuilder( + builder: (context, state) { + return CustomTextFormField( + width: 150.h, + textInputAction: TextInputAction.done, + controller: state.heightController, + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], + ); + }, ), ], ), - Spacer(), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only( - left: 16.h, - right: 16.h, - bottom: 50.v, - ), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapNext(state, context), - ); - }, - ), ], ), ), diff --git a/lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart b/lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart index b0592bb0..c77ba3ac 100644 --- a/lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart +++ b/lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart @@ -2,33 +2,29 @@ import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; import '/core/app_export.dart'; import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart'; + part 'language_select_event.dart'; + part 'language_select_state.dart'; /// A bloc that manages the state of a LanguageSelect according to the event that is dispatched to it. -class LanguageSelectBloc - extends Bloc { +class LanguageSelectBloc extends Bloc { LanguageSelectBloc(LanguageSelectState initialState) : super(initialState) { on(_onInitialize); on(_changeDropDown); } - _onInitialize( - LanguageSelectInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith( - languageSelectModelObj: state.languageSelectModelObj - ?.copyWith(dropdownItemList: fillDropdownItemList()),),); + _onInitialize(LanguageSelectInitialEvent event, Emitter emit) async { + emit( + state.copyWith( + languageSelectModelObj: state.languageSelectModelObj?.copyWith(dropdownItemList: fillDropdownItemList()), + ), + ); } - _changeDropDown( - ChangeDropDownEvent event, - Emitter emit, - ) { + _changeDropDown(ChangeDropDownEvent event, Emitter emit) { emit(state.copyWith(selectedDropDownValue: event.value)); - state.languageSelectModelObj?.userRegistrationSheet.lang = - event.value.title; + state.languageSelectModelObj?.userRegistrationSheet.lang = event.value.title; } List fillDropdownItemList() { diff --git a/lib/presentation/registration/language_select_screen/language_select_screen.dart b/lib/presentation/registration/language_select_screen/language_select_screen.dart index 884281fb..6cac92e2 100644 --- a/lib/presentation/registration/language_select_screen/language_select_screen.dart +++ b/lib/presentation/registration/language_select_screen/language_select_screen.dart @@ -5,7 +5,6 @@ import 'bloc/language_select_bloc.dart'; import 'models/language_select_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:flutter/material.dart'; class LanguageSelectScreen extends StatelessWidget { @@ -24,84 +23,57 @@ class LanguageSelectScreen extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 5.v), - child: Column( - children: [ - CustomImageView(imagePath: ImageConstant.imgLogoEatvio, height: 50.adaptSize, width: 50.adaptSize), - SizedBox(height: 20.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all( - color: theme.colorScheme.primary, - width: 1.h, - ), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (0 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), - ), + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Column( + children: [ + Container( + width: 262.h, + margin: EdgeInsets.only(left: 41.h, right: 39.h), + child: Text( + "preferred_language".tr, + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + style: theme.textTheme.headlineSmall, ), - SizedBox(height: 20.v), - Container( - width: 262.h, - margin: EdgeInsets.only(left: 41.h, right: 39.h), - child: Text( - "preferred_language".tr, - maxLines: 2, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center, - style: theme.textTheme.headlineSmall, - ), - ), - Spacer(flex: 36), - BlocSelector( - selector: (state) => state.languageSelectModelObj, - builder: ( - context, - languageSelectModelObj, - ) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.h), - ), - child: CustomImageView( - imagePath: ImageConstant.imgFavorite, - height: 12.adaptSize, - width: 12.adaptSize, - ), + ), + const SizedBox(height: 32), + BlocSelector( + selector: (state) => state.languageSelectModelObj, + builder: ( + context, + languageSelectModelObj, + ) { + return CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.h), ), - hintText: "Не выбрано".tr, - items: languageSelectModelObj?.dropdownItemList ?? [], - onChanged: (value) => _onDropDownChanged(context, value), - ); - }, - ), - Spacer(flex: 63), - ], - ), - ), - bottomNavigationBar: BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: _saveAndPush(state, context), - ); - }, + child: CustomImageView( + imagePath: ImageConstant.imgFavorite, + height: 12.adaptSize, + width: 12.adaptSize, + ), + ), + hintText: "Не выбрано".tr, + items: languageSelectModelObj?.dropdownItemList ?? [], + onChanged: (value) => _onDropDownChanged(context, value), + ); + }, + ), + // bottomNavigationBar: BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: _saveAndPush(state, context), + // ); + // }, + // ), + ], ), ); } diff --git a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart index 2a55586e..af7cc5a4 100644 --- a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart @@ -29,34 +29,13 @@ class MedicineIntakeScreen extends StatefulWidget { class _MedicineIntakeScreenState extends State { @override Widget build(BuildContext context) { - mediaQueryData = MediaQuery.of(context); - return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column( children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (11 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), - ), - ), - SizedBox(height: 20.v), Container( width: 271.h, margin: EdgeInsets.only(left: 35.h, right: 36.h), @@ -70,25 +49,24 @@ class _MedicineIntakeScreenState extends State { ), SizedBox(height: 86.v), _buildTextFormField(context), - Spacer(), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapNext(state, context), - ); - }, - ), - BlocBuilder( - builder: (context, state) { - return GestureDetector( - onTap: onTapSkip(state, context), - child: Text("skip".tr, style: theme.textTheme.bodyLarge), - ); - }, - ), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapNext(state, context), + // ); + // }, + // ), + // BlocBuilder( + // builder: (context, state) { + // return GestureDetector( + // onTap: onTapSkip(state, context), + // child: Text("skip".tr, style: theme.textTheme.bodyLarge), + // ); + // }, + // ), ], ), ), diff --git a/lib/presentation/registration/name_screen/name_screen.dart b/lib/presentation/registration/name_screen/name_screen.dart index 4fb599df..53845a5c 100644 --- a/lib/presentation/registration/name_screen/name_screen.dart +++ b/lib/presentation/registration/name_screen/name_screen.dart @@ -28,34 +28,13 @@ class NameScreen extends StatelessWidget { @override Widget build(BuildContext context) { - mediaQueryData = MediaQuery.of(context); - return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: Container( + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column( children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all(color: theme.colorScheme.primary, width: 1.h), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (2 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation(appTheme.blueA400), - ), - ), - ), - SizedBox(height: 39.v), Text("what_is_your_name".tr, style: theme.textTheme.headlineSmall), SizedBox(height: 93.v), Text("first_name".tr, style: theme.textTheme.bodyLarge), @@ -77,17 +56,16 @@ class NameScreen extends StatelessWidget { ); }, ), - Spacer(), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () => _onTapNext(context, state), // Assign callback function here - ); - }, - ), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: () => _onTapNext(context, state), // Assign callback function here + // ); + // }, + // ), ], ), ), diff --git a/lib/presentation/registration/weight_screen/weight_screen.dart b/lib/presentation/registration/weight_screen/weight_screen.dart index caad9e79..4b650470 100644 --- a/lib/presentation/registration/weight_screen/weight_screen.dart +++ b/lib/presentation/registration/weight_screen/weight_screen.dart @@ -24,85 +24,42 @@ class WeightScreen extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - appBar: _buildAppBar(context), - body: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column( - children: [ - SizedBox(height: 7.v), - Container( - height: 16.v, - width: 343.h, - decoration: BoxDecoration( - color: theme.colorScheme.onPrimary, - borderRadius: BorderRadius.circular(8.h), - border: Border.all( - color: theme.colorScheme.primary, - width: 1.h, - ), + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + Text( + "weight_measurements".tr, + style: theme.textTheme.headlineSmall, ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.h), - child: LinearProgressIndicator( - value: (7 / 15).toDouble(), - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation( - appTheme.blueA400, + SizedBox(height: 174.v), + Column( + children: [ + Text( + "your_weight".tr, + style: theme.textTheme.bodyLarge, ), - ), + SizedBox(height: 4.v), + BlocBuilder( + builder: (context, state) { + return CustomTextFormField( + width: 150.h, + textInputAction: TextInputAction.done, + controller: state.weightController, + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], + ); + }, + ), + ], ), - ), - SizedBox(height: 39.v), - Column( - children: [ - Text( - "weight_measurements".tr, - style: theme.textTheme.headlineSmall, - ), - SizedBox(height: 174.v), - Column( - children: [ - Text( - "your_weight".tr, - style: theme.textTheme.bodyLarge, - ), - SizedBox(height: 4.v), - BlocBuilder( - builder: (context, state) { - return CustomTextFormField( - width: 150.h, - textInputAction: TextInputAction.done, - controller: state.weightController, - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], - ); - }, - ), - ], - ), - ], - ), - Spacer(), - BlocBuilder( - builder: (context, state) { - return NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only( - left: 16.h, - right: 16.h, - bottom: 50.v, - ), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapNext(state, context), - ); - }, - ), - ], - ), + ], + ), ), ); } diff --git a/lib/widgets/app_bar/appbar_title_image.dart b/lib/widgets/app_bar/appbar_title_image.dart index 4ef20de2..6242412a 100644 --- a/lib/widgets/app_bar/appbar_title_image.dart +++ b/lib/widgets/app_bar/appbar_title_image.dart @@ -26,14 +26,12 @@ class AppbarTitleImage extends StatelessWidget { padding: margin ?? EdgeInsets.zero, child: CustomImageView( imagePath: imagePath, - height: 50.adaptSize, - width: 50.adaptSize, + height: 48, fit: BoxFit.contain, ), ), ); } - void onTapCall() { - } + void onTapCall() {} } From 0f50f3b1c9e7cff4948ed51a50bd3a6a6a424732 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Thu, 11 Jul 2024 17:39:36 +0300 Subject: [PATCH 04/21] feature(registration): fix analyzer --- .../pages/registration_screen.dart | 6 -- .../additional_information_screen.dart | 15 ---- .../allergies_screen/allergies_screen.dart | 15 ---- .../blood_pressure_screen.dart | 14 ---- .../body_circumferences_screen.dart | 14 ---- .../city_of_living_screen.dart | 14 ---- .../credentials_screen.dart | 6 -- .../date_of_birth_screen.dart | 14 ---- .../favorite_foods_screen.dart | 14 ---- .../favorite_sports_screen.dart | 13 --- .../gender_screen/gender_screen.dart | 15 ---- .../height_screen/height_screen.dart | 14 ---- .../medicine_intake_screen.dart | 14 ---- .../registration/name_screen/name_screen.dart | 84 +++++++------------ .../weight_screen/weight_screen.dart | 14 ---- 15 files changed, 32 insertions(+), 234 deletions(-) diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index f530f8bf..d181e3c6 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -1,6 +1,4 @@ import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/core/utils/image_constant.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart'; import 'package:eatvio_app/presentation/registration/additional_information_screen/additional_information_screen.dart'; @@ -8,20 +6,16 @@ import 'package:eatvio_app/presentation/registration/allergies_screen/allergies_ import 'package:eatvio_app/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart'; import 'package:eatvio_app/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart'; import 'package:eatvio_app/presentation/registration/city_of_living_screen/city_of_living_screen.dart'; -import 'package:eatvio_app/presentation/registration/credentials_screen/bloc/credentials_bloc.dart'; import 'package:eatvio_app/presentation/registration/credentials_screen/credentials_screen.dart'; import 'package:eatvio_app/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart'; import 'package:eatvio_app/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart'; import 'package:eatvio_app/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart'; import 'package:eatvio_app/presentation/registration/gender_screen/gender_screen.dart'; import 'package:eatvio_app/presentation/registration/height_screen/height_screen.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/bloc/language_select_bloc.dart'; import 'package:eatvio_app/presentation/registration/language_select_screen/language_select_screen.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart'; import 'package:eatvio_app/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart'; import 'package:eatvio_app/presentation/registration/name_screen/name_screen.dart'; import 'package:eatvio_app/presentation/registration/weight_screen/weight_screen.dart'; -import 'package:eatvio_app/theme/theme_helper.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart index 94e6f548..d1c18d09 100644 --- a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart @@ -3,10 +3,6 @@ import 'package:go_router/go_router.dart'; import 'bloc/additional_information_bloc.dart'; import 'models/additional_information_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; @@ -77,17 +73,6 @@ class AdditionalInformationScreen extends StatelessWidget { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 31.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } - onTapBack(BuildContext context) { return () { onTapArrowLeft(context); diff --git a/lib/presentation/registration/allergies_screen/allergies_screen.dart b/lib/presentation/registration/allergies_screen/allergies_screen.dart index e37134ec..51c5e6a2 100644 --- a/lib/presentation/registration/allergies_screen/allergies_screen.dart +++ b/lib/presentation/registration/allergies_screen/allergies_screen.dart @@ -3,10 +3,6 @@ import 'package:go_router/go_router.dart'; import 'bloc/allergies_bloc.dart'; import 'models/allergies_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -77,17 +73,6 @@ class _AllergiesScreenState extends State { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 31.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } - onTapBack(BuildContext context) { return () { onTapArrowLeft(context); diff --git a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart index cf3a8a35..1ad36365 100644 --- a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart @@ -5,11 +5,7 @@ import 'bloc/blood_pressure_bloc.dart'; import 'package:flutter/services.dart'; import 'models/blood_pressure_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; @@ -208,16 +204,6 @@ class _BloodPressureScreenState extends State { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } Function onTapBack(BuildContext context) { return () { diff --git a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart b/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart index 96aa089e..d9f08614 100644 --- a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart @@ -4,10 +4,6 @@ import 'bloc/body_circumferences_bloc.dart'; import 'package:flutter/services.dart'; import 'models/body_circumferences_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -132,16 +128,6 @@ class _BodyCircumferencesScreenState extends State { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } Function onTapBack(BuildContext context) { return () { diff --git a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart b/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart index feb25d82..0d35f1f2 100644 --- a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart +++ b/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart @@ -3,11 +3,7 @@ import 'package:go_router/go_router.dart'; import 'bloc/city_of_living_bloc.dart'; import 'models/city_of_living_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; @@ -133,16 +129,6 @@ class CityOfLivingScreen extends StatelessWidget { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } Function onTapBack(BuildContext context) { return () { diff --git a/lib/presentation/registration/credentials_screen/credentials_screen.dart b/lib/presentation/registration/credentials_screen/credentials_screen.dart index 8fab0f47..d9e15d37 100644 --- a/lib/presentation/registration/credentials_screen/credentials_screen.dart +++ b/lib/presentation/registration/credentials_screen/credentials_screen.dart @@ -3,8 +3,6 @@ import 'package:go_router/go_router.dart'; import 'bloc/credentials_bloc.dart'; import 'models/credentials_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:validators/validators.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; @@ -129,10 +127,6 @@ class CredentialsScreen extends StatelessWidget { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar(leadingWidth: 29.h, centerTitle: true, title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); - } List validateFields(String email, String name, String password, String passwordConfirmation) { List errors = []; diff --git a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart index 9683947d..432a5be4 100644 --- a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart @@ -4,10 +4,6 @@ import 'package:go_router/go_router.dart'; import 'bloc/date_of_birth_bloc.dart'; import 'models/date_of_birth_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; @@ -74,16 +70,6 @@ class _DateOfBirthScreenState extends State { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } Function onTapBack(BuildContext context) { return () { diff --git a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart index 8aaaa485..a1015d7d 100644 --- a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart @@ -3,10 +3,6 @@ import 'package:go_router/go_router.dart'; import 'bloc/favorite_foods_bloc.dart'; import 'models/favorite_foods_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -91,16 +87,6 @@ class _FavoriteFoodsScreenState extends State { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 31.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } Function onTapBack(BuildContext context) { return () { diff --git a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart index 2ff9f3ca..5a8f3f35 100644 --- a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart @@ -3,10 +3,6 @@ import 'package:go_router/go_router.dart'; import 'bloc/favorite_sports_bloc.dart'; import 'models/favorite_sports_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -79,15 +75,6 @@ class _FavoriteSportsScreenState extends State { }; } - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } Function onTapBack(BuildContext context) { return () { diff --git a/lib/presentation/registration/gender_screen/gender_screen.dart b/lib/presentation/registration/gender_screen/gender_screen.dart index df642d61..72f8f5cb 100644 --- a/lib/presentation/registration/gender_screen/gender_screen.dart +++ b/lib/presentation/registration/gender_screen/gender_screen.dart @@ -4,10 +4,6 @@ import 'bloc/gender_bloc.dart'; import 'models/gender_model.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:flutter/material.dart'; class GenderScreen extends StatefulWidget { @@ -101,17 +97,6 @@ class _GenderScreenState extends State { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 29.h, - leading: AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack()), - centerTitle: true, - title: AppbarTitleImage( - imagePath: ImageConstant.imgLogoEatvio, - ), - ); - } Function onTapBack() { return () { diff --git a/lib/presentation/registration/height_screen/height_screen.dart b/lib/presentation/registration/height_screen/height_screen.dart index 5adc277f..66e27620 100644 --- a/lib/presentation/registration/height_screen/height_screen.dart +++ b/lib/presentation/registration/height_screen/height_screen.dart @@ -3,12 +3,8 @@ import 'package:go_router/go_router.dart'; import 'bloc/height_bloc.dart'; import 'models/height_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/services.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; @@ -71,16 +67,6 @@ class HeightScreen extends StatelessWidget { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } Function onTapBack(BuildContext context) { return () { diff --git a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart index af7cc5a4..2edc4d6c 100644 --- a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart @@ -3,10 +3,6 @@ import 'package:go_router/go_router.dart'; import 'bloc/medicine_intake_bloc.dart'; import 'models/medicine_intake_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; @@ -94,16 +90,6 @@ class _MedicineIntakeScreenState extends State { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 31.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } Function onTapBack(BuildContext context) { return () { diff --git a/lib/presentation/registration/name_screen/name_screen.dart b/lib/presentation/registration/name_screen/name_screen.dart index 53845a5c..be741706 100644 --- a/lib/presentation/registration/name_screen/name_screen.dart +++ b/lib/presentation/registration/name_screen/name_screen.dart @@ -1,14 +1,7 @@ -import 'package:eatvio_app/app_router.dart'; import 'package:go_router/go_router.dart'; - import 'bloc/name_bloc.dart'; import 'models/name_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -72,57 +65,44 @@ class NameScreen extends StatelessWidget { ); } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 29.h, - leading: AppbarLeadingImage( - imagePath: ImageConstant.imgArrowLeft, - margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), - onTap: () => onTapArrowLeft(context), - ), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } /// Navigates to the previous screen. onTapArrowLeft(BuildContext context) { GoRouter.of(context).pop(); } - _onTapNext(BuildContext context, NameState state) { - if (state.firstNameController != null && state.lastNameController != null) { - List errors = validateFields(state.firstNameController!.text, state.lastNameController!.text); - - if (errors.isEmpty) { - UserRegistrationSheet sheet = state.nameModelObj!.userRegistrationSheet; - sheet.firstName = state.firstNameController!.text; - sheet.lastName = state.lastNameController!.text; - AppRouter.navigatorKey.currentContext?.goNamed('genderScreen', extra: sheet); - } else { - String errorMessage = ''; - - for (var error in errors) { - errorMessage += error + '\n\n'; - } - - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text('Error'), - content: Text(errorMessage), - actions: [ - TextButton( - onPressed: () => onTapOk(context), - child: Text('OK'), - ), - ], - ), - ); - } - } - } + // _onTapNext(BuildContext context, NameState state) { + // if (state.firstNameController != null && state.lastNameController != null) { + // List errors = validateFields(state.firstNameController!.text, state.lastNameController!.text); + // + // if (errors.isEmpty) { + // UserRegistrationSheet sheet = state.nameModelObj!.userRegistrationSheet; + // sheet.firstName = state.firstNameController!.text; + // sheet.lastName = state.lastNameController!.text; + // AppRouter.navigatorKey.currentContext?.goNamed('genderScreen', extra: sheet); + // } else { + // String errorMessage = ''; + // + // for (var error in errors) { + // errorMessage += error + '\n\n'; + // } + // + // showDialog( + // context: context, + // builder: (context) => AlertDialog( + // title: Text('Error'), + // content: Text(errorMessage), + // actions: [ + // TextButton( + // onPressed: () => onTapOk(context), + // child: Text('OK'), + // ), + // ], + // ), + // ); + // } + // } + // } void onTapOk(BuildContext context) { Navigator.pop(context); diff --git a/lib/presentation/registration/weight_screen/weight_screen.dart b/lib/presentation/registration/weight_screen/weight_screen.dart index 4b650470..9f0ab8ef 100644 --- a/lib/presentation/registration/weight_screen/weight_screen.dart +++ b/lib/presentation/registration/weight_screen/weight_screen.dart @@ -3,12 +3,8 @@ import 'package:go_router/go_router.dart'; import 'bloc/weight_bloc.dart'; import 'models/weight_model.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/services.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; @@ -71,16 +67,6 @@ class WeightScreen extends StatelessWidget { }; } - /// Section Widget - _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 29.h, - leading: - AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio), - ); - } Function onTapBack(BuildContext context) { return () { From 2294d11ee79bf929dfbb36d8ab51e39cc84c237a Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Thu, 11 Jul 2024 18:09:42 +0300 Subject: [PATCH 05/21] feature(registration): fix analyzer 2 --- .../language_select_screen.dart | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/presentation/registration/language_select_screen/language_select_screen.dart b/lib/presentation/registration/language_select_screen/language_select_screen.dart index 6cac92e2..f2ac257e 100644 --- a/lib/presentation/registration/language_select_screen/language_select_screen.dart +++ b/lib/presentation/registration/language_select_screen/language_select_screen.dart @@ -1,6 +1,3 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:go_router/go_router.dart'; - import 'bloc/language_select_bloc.dart'; import 'models/language_select_model.dart'; import 'package:eatvio_app/core/app_export.dart'; @@ -78,15 +75,15 @@ class LanguageSelectScreen extends StatelessWidget { ); } - void Function()? _saveAndPush(LanguageSelectState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.languageSelectModelObj!.userRegistrationSheet; - GoRouter.of(context).goNamed( - 'credentialsScreen', - extra: sheet, - ); - }; - } + // void Function()? _saveAndPush(LanguageSelectState state, BuildContext context) { + // return () { + // UserRegistrationSheet sheet = state.languageSelectModelObj!.userRegistrationSheet; + // GoRouter.of(context).goNamed( + // 'credentialsScreen', + // extra: sheet, + // ); + // }; + // } void _onDropDownChanged(BuildContext context, value) { context.read().add(ChangeDropDownEvent(value: value)); From c4fd047d60266540234549b4d22d535e6852909c Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Thu, 11 Jul 2024 18:28:02 +0300 Subject: [PATCH 06/21] feature(registration): temp remove test --- test/add_info_test.dart | 54 ----------------------- test/allergies_test.dart | 54 ----------------------- test/auth_test.dart | 41 ----------------- test/blood_pressure_test.dart | 54 ----------------------- test/body_circumferences_test.dart | 54 ----------------------- test/city_of_living_test.dart | 54 ----------------------- test/credentials_test.dart | 54 ----------------------- test/date_of_birth_test.dart | 54 ----------------------- test/diary_test.dart | 71 ------------------------------ test/favorite_foods_test.dart | 54 ----------------------- test/favorite_sports_test.dart | 55 ----------------------- test/gender_test.dart | 55 ----------------------- test/height_test.dart | 55 ----------------------- test/language_select_test.dart | 26 ----------- test/launch_test.dart | 15 ------- test/medicine_intake_test.dart | 55 ----------------------- test/name_test.dart | 55 ----------------------- test/profile_test.dart | 26 ----------- test/settings_test.dart | 26 ----------- test/weight_test.dart | 55 ----------------------- 20 files changed, 967 deletions(-) delete mode 100644 test/add_info_test.dart delete mode 100644 test/allergies_test.dart delete mode 100644 test/auth_test.dart delete mode 100644 test/blood_pressure_test.dart delete mode 100644 test/body_circumferences_test.dart delete mode 100644 test/city_of_living_test.dart delete mode 100644 test/credentials_test.dart delete mode 100644 test/date_of_birth_test.dart delete mode 100644 test/diary_test.dart delete mode 100644 test/favorite_foods_test.dart delete mode 100644 test/favorite_sports_test.dart delete mode 100644 test/gender_test.dart delete mode 100644 test/height_test.dart delete mode 100644 test/language_select_test.dart delete mode 100644 test/launch_test.dart delete mode 100644 test/medicine_intake_test.dart delete mode 100644 test/name_test.dart delete mode 100644 test/profile_test.dart delete mode 100644 test/settings_test.dart delete mode 100644 test/weight_test.dart diff --git a/test/add_info_test.dart b/test/add_info_test.dart deleted file mode 100644 index 86379dda..00000000 --- a/test/add_info_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/additional_information_screen/additional_information_screen.dart'; -import 'package:eatvio_app/presentation/registration/additional_information_screen/bloc/additional_information_bloc.dart'; -import 'package:eatvio_app/presentation/registration/additional_information_screen/models/additional_information_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = AdditionalInformationBloc(AdditionalInformationState( - additionalInformationModelObj: AdditionalInformationModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: AdditionalInformationScreen(), - ), - ), - ); - }); - }); -} diff --git a/test/allergies_test.dart b/test/allergies_test.dart deleted file mode 100644 index d0a78328..00000000 --- a/test/allergies_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/allergies_screen/allergies_screen.dart'; -import 'package:eatvio_app/presentation/registration/allergies_screen/bloc/allergies_bloc.dart'; -import 'package:eatvio_app/presentation/registration/allergies_screen/models/allergies_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = AllergiesBloc(AllergiesState( - allergiesModelObj: AllergiesModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: AllergiesScreen(), - ), - ), - ); - }); - }); -} diff --git a/test/auth_test.dart b/test/auth_test.dart deleted file mode 100644 index e131dc88..00000000 --- a/test/auth_test.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter_localizations/flutter_localizations.dart'; -import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart'; -import 'package:eatvio_app/presentation/auth/auth_screen/bloc/auth_bloc.dart'; -import 'package:eatvio_app/presentation/auth/auth_screen/models/auth_model.dart'; - -void main() { - group('AuthScreen', () { - testWidgets('renders AuthScreen with initial state', - (WidgetTester tester) async { - final authBloc = AuthBloc(AuthState(authModelObj: AuthModel())); - - await tester.pumpWidget( - MaterialApp( - localizationsDelegates: [ - AppLocalizationDelegate(), - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - ], - supportedLocales: [ - Locale( - 'ru', - '', - ), - ], - home: BlocProvider( - create: (context) => authBloc, - child: Builder( - builder: (context) { - return AuthScreen(); - }, - ), - ), - ), - ); - }); - }); -} diff --git a/test/blood_pressure_test.dart b/test/blood_pressure_test.dart deleted file mode 100644 index a8c70dbe..00000000 --- a/test/blood_pressure_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart'; -import 'package:eatvio_app/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart'; -import 'package:eatvio_app/presentation/registration/blood_pressure_screen/models/blood_pressure_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = BloodPressureBloc(BloodPressureState( - bloodPressureModelObj: BloodPressureModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: BloodPressureScreen(), - ), - ), - ); - }); - }); -} diff --git a/test/body_circumferences_test.dart b/test/body_circumferences_test.dart deleted file mode 100644 index 339c3b8b..00000000 --- a/test/body_circumferences_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart'; -import 'package:eatvio_app/presentation/registration/body_circumferences_screen/bloc/body_circumferences_bloc.dart'; -import 'package:eatvio_app/presentation/registration/body_circumferences_screen/models/body_circumferences_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = BodyCircumferencesBloc(BodyCircumferencesState( - bodyCircumferencesModelObj: BodyCircumferencesModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: BodyCircumferencesScreen(), - ), - ), - ); - }); - }); -} diff --git a/test/city_of_living_test.dart b/test/city_of_living_test.dart deleted file mode 100644 index 1a6c18ba..00000000 --- a/test/city_of_living_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/city_of_living_screen/city_of_living_screen.dart'; -import 'package:eatvio_app/presentation/registration/city_of_living_screen/bloc/city_of_living_bloc.dart'; -import 'package:eatvio_app/presentation/registration/city_of_living_screen/models/city_of_living_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = CityOfLivingBloc(CityOfLivingState( - cityOfLivingModelObj: CityOfLivingModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: CityOfLivingScreen(), - ), - ), - ); - }); - }); -} diff --git a/test/credentials_test.dart b/test/credentials_test.dart deleted file mode 100644 index a82cd418..00000000 --- a/test/credentials_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/credentials_screen/credentials_screen.dart'; -import 'package:eatvio_app/presentation/registration/credentials_screen/bloc/credentials_bloc.dart'; -import 'package:eatvio_app/presentation/registration/credentials_screen/models/credentials_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = CredentialsBloc(CredentialsState( - credentialsModelObj: CredentialsModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: CredentialsScreen(), - ), - ), - ); - }); - }); -} diff --git a/test/date_of_birth_test.dart b/test/date_of_birth_test.dart deleted file mode 100644 index 8ce0a1f7..00000000 --- a/test/date_of_birth_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart'; -import 'package:eatvio_app/presentation/registration/date_of_birth_screen/bloc/date_of_birth_bloc.dart'; -import 'package:eatvio_app/presentation/registration/date_of_birth_screen/models/date_of_birth_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = DateOfBirthBloc(DateOfBirthState( - dateOfBirthModelObj: DateOfBirthModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: DateOfBirthScreen(), - ), - ), - ); - }); - }); -} diff --git a/test/diary_test.dart b/test/diary_test.dart deleted file mode 100644 index 56d1c582..00000000 --- a/test/diary_test.dart +++ /dev/null @@ -1,71 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/diary/diary_edit_screen/diary_edit_screen.dart'; -import 'package:eatvio_app/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart'; -import 'package:eatvio_app/presentation/diary/diary_edit_screen/models/diary_edit_model.dart'; - -void main() { - group('DiaryEditScreen', () { - /*testWidgets('renders CircularProgressIndicator when in initial state', - (WidgetTester tester) async { - await tester.pumpWidget( - MaterialApp( - home: DiaryEditScreen(), - ), - ); - });*/ - - testWidgets('renders _buildDiaryEditScreen when in loaded state', (WidgetTester tester) async { - final diaryEditBloc = DiaryEditBloc(DiaryEditState(diaryEditModelObj: DiaryEditModel())); - final loadedState = DiaryEditLoadedState( - diaryId: 1, - selectedSatiety: 4, - autocompleteList: [], - photos: [], - portions: [], - wakeupExpanded: false, - moderationExpanded: false, - recommendedChartValues: [10, 10, 10, 10], - consumedChartValues: [1, 2, 3, 4], - moodExpanded: false,); - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: diaryEditBloc, - child: DiaryEditScreen(), - ), - ), - ); - - diaryEditBloc.emit(loadedState); - await tester.pump(); - - //expect(find.byType(_buildDiaryEditScreen), findsOneWidget); - }); - - /*testWidgets('renders error message when in error state', - (WidgetTester tester) async { - final diaryEditBloc = - DiaryEditBloc(DiaryEditState(diaryEditModelObj: DiaryEditModel())); - final errorState = DiaryEditErrorState("error"); - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: diaryEditBloc, - child: DiaryEditScreen(), - ), - ), - ); - - diaryEditBloc.emit(errorState); - await tester.pump(); - - expect(find.text('Ошибка'), findsOneWidget); - });*/ - - // Add more tests for other scenarios if needed - }); -} diff --git a/test/favorite_foods_test.dart b/test/favorite_foods_test.dart deleted file mode 100644 index 6364726f..00000000 --- a/test/favorite_foods_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart'; -import 'package:eatvio_app/presentation/registration/favorite_foods_screen/bloc/favorite_foods_bloc.dart'; -import 'package:eatvio_app/presentation/registration/favorite_foods_screen/models/favorite_foods_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = FavoriteFoodsBloc(FavoriteFoodsState( - favoriteFoodsModelObj: FavoriteFoodsModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: FavoriteFoodsScreen(), - ), - ), - ); - }); - }); -} diff --git a/test/favorite_sports_test.dart b/test/favorite_sports_test.dart deleted file mode 100644 index 1c7311e6..00000000 --- a/test/favorite_sports_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart'; -import 'package:eatvio_app/presentation/registration/favorite_sports_screen/bloc/favorite_sports_bloc.dart'; -import 'package:eatvio_app/presentation/registration/favorite_sports_screen/models/favorite_sports_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = FavoriteSportsBloc(FavoriteSportsState( - favoriteSportsModelObj: FavoriteSportsModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteSports", - unfavoriteFoods: "unfavoriteSports", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: FavoriteSportsScreen(), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/gender_test.dart b/test/gender_test.dart deleted file mode 100644 index 94ab621c..00000000 --- a/test/gender_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/gender_screen/gender_screen.dart'; -import 'package:eatvio_app/presentation/registration/gender_screen/bloc/gender_bloc.dart'; -import 'package:eatvio_app/presentation/registration/gender_screen/models/gender_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = GenderBloc(GenderState( - genderModelObj: GenderModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteSports", - unfavoriteFoods: "unfavoriteSports", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: GenderScreen(), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/height_test.dart b/test/height_test.dart deleted file mode 100644 index cd512ed4..00000000 --- a/test/height_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/height_screen/height_screen.dart'; -import 'package:eatvio_app/presentation/registration/height_screen/bloc/height_bloc.dart'; -import 'package:eatvio_app/presentation/registration/height_screen/models/height_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = HeightBloc(HeightState( - heightModelObj: HeightModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - height: "height", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - gender: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteSports", - unfavoriteFoods: "unfavoriteSports", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: HeightScreen(), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/language_select_test.dart b/test/language_select_test.dart deleted file mode 100644 index 15582cf6..00000000 --- a/test/language_select_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/language_select_screen.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/bloc/language_select_bloc.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = LanguageSelectBloc(LanguageSelectState( - languageSelectModelObj: - LanguageSelectModel(),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: LanguageSelectScreen(), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/launch_test.dart b/test/launch_test.dart deleted file mode 100644 index 4f1eafee..00000000 --- a/test/launch_test.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/main.dart' as app; - -void main() { - testWidgets('Smoke test', (WidgetTester tester) async { - // Запустить приложение - app.main(); - - // Подождать, пока приложение загрузится - await tester.pumpAndSettle(); - - // Проверить, что нет ошибок - expect(tester.takeException(), isNull); - }); -} diff --git a/test/medicine_intake_test.dart b/test/medicine_intake_test.dart deleted file mode 100644 index eae83c13..00000000 --- a/test/medicine_intake_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart'; -import 'package:eatvio_app/presentation/registration/medicine_intake_screen/bloc/medicine_intake_bloc.dart'; -import 'package:eatvio_app/presentation/registration/medicine_intake_screen/models/medicine_intake_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = MedicineIntakeBloc(MedicineIntakeState( - medicineIntakeModelObj: MedicineIntakeModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: MedicineIntakeScreen(), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/name_test.dart b/test/name_test.dart deleted file mode 100644 index 1e271cb2..00000000 --- a/test/name_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/name_screen/name_screen.dart'; -import 'package:eatvio_app/presentation/registration/name_screen/bloc/name_bloc.dart'; -import 'package:eatvio_app/presentation/registration/name_screen/models/name_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = NameBloc(NameState( - nameModelObj: NameModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: NameScreen(), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/profile_test.dart b/test/profile_test.dart deleted file mode 100644 index cf0ebc41..00000000 --- a/test/profile_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/my_profile_screen.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart'; - -void main() { - group('MyProfileScreen', () { - testWidgets('renders CircularProgressIndicator in initial state', - (WidgetTester tester) async { - final myProfileBloc = MyProfileBloc(MyProfileState( - myProfileModelObj: - MyProfileModel(),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: MyProfileScreen(), - ), - ), - ); - }); - }); -} diff --git a/test/settings_test.dart b/test/settings_test.dart deleted file mode 100644 index c6058784..00000000 --- a/test/settings_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/my_settings_screen.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart'; - -void main() { - group('MyProfileScreen', () { - testWidgets('renders CircularProgressIndicator in initial state', - (WidgetTester tester) async { - final myProfileBloc = MyProfileBloc(MyProfileState( - myProfileModelObj: - MyProfileModel(),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: MySettingsScreen(), - ), - ), - ); - }); - }); -} diff --git a/test/weight_test.dart b/test/weight_test.dart deleted file mode 100644 index e5f9fe0c..00000000 --- a/test/weight_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/weight_screen/weight_screen.dart'; -import 'package:eatvio_app/presentation/registration/weight_screen/bloc/weight_bloc.dart'; -import 'package:eatvio_app/presentation/registration/weight_screen/models/weight_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = WeightBloc(WeightState( - weightModelObj: WeightModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: WeightScreen(), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file From b9ea8afd4ee60ad38c3aeb76f812d7e6cb879c21 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Thu, 11 Jul 2024 18:30:21 +0300 Subject: [PATCH 07/21] Revert "feature(registration): temp remove test" This reverts commit c4fd047d60266540234549b4d22d535e6852909c. --- test/add_info_test.dart | 54 +++++++++++++++++++++++ test/allergies_test.dart | 54 +++++++++++++++++++++++ test/auth_test.dart | 41 +++++++++++++++++ test/blood_pressure_test.dart | 54 +++++++++++++++++++++++ test/body_circumferences_test.dart | 54 +++++++++++++++++++++++ test/city_of_living_test.dart | 54 +++++++++++++++++++++++ test/credentials_test.dart | 54 +++++++++++++++++++++++ test/date_of_birth_test.dart | 54 +++++++++++++++++++++++ test/diary_test.dart | 71 ++++++++++++++++++++++++++++++ test/favorite_foods_test.dart | 54 +++++++++++++++++++++++ test/favorite_sports_test.dart | 55 +++++++++++++++++++++++ test/gender_test.dart | 55 +++++++++++++++++++++++ test/height_test.dart | 55 +++++++++++++++++++++++ test/language_select_test.dart | 26 +++++++++++ test/launch_test.dart | 15 +++++++ test/medicine_intake_test.dart | 55 +++++++++++++++++++++++ test/name_test.dart | 55 +++++++++++++++++++++++ test/profile_test.dart | 26 +++++++++++ test/settings_test.dart | 26 +++++++++++ test/weight_test.dart | 55 +++++++++++++++++++++++ 20 files changed, 967 insertions(+) create mode 100644 test/add_info_test.dart create mode 100644 test/allergies_test.dart create mode 100644 test/auth_test.dart create mode 100644 test/blood_pressure_test.dart create mode 100644 test/body_circumferences_test.dart create mode 100644 test/city_of_living_test.dart create mode 100644 test/credentials_test.dart create mode 100644 test/date_of_birth_test.dart create mode 100644 test/diary_test.dart create mode 100644 test/favorite_foods_test.dart create mode 100644 test/favorite_sports_test.dart create mode 100644 test/gender_test.dart create mode 100644 test/height_test.dart create mode 100644 test/language_select_test.dart create mode 100644 test/launch_test.dart create mode 100644 test/medicine_intake_test.dart create mode 100644 test/name_test.dart create mode 100644 test/profile_test.dart create mode 100644 test/settings_test.dart create mode 100644 test/weight_test.dart diff --git a/test/add_info_test.dart b/test/add_info_test.dart new file mode 100644 index 00000000..86379dda --- /dev/null +++ b/test/add_info_test.dart @@ -0,0 +1,54 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/additional_information_screen/additional_information_screen.dart'; +import 'package:eatvio_app/presentation/registration/additional_information_screen/bloc/additional_information_bloc.dart'; +import 'package:eatvio_app/presentation/registration/additional_information_screen/models/additional_information_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = AdditionalInformationBloc(AdditionalInformationState( + additionalInformationModelObj: AdditionalInformationModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: AdditionalInformationScreen(), + ), + ), + ); + }); + }); +} diff --git a/test/allergies_test.dart b/test/allergies_test.dart new file mode 100644 index 00000000..d0a78328 --- /dev/null +++ b/test/allergies_test.dart @@ -0,0 +1,54 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/allergies_screen/allergies_screen.dart'; +import 'package:eatvio_app/presentation/registration/allergies_screen/bloc/allergies_bloc.dart'; +import 'package:eatvio_app/presentation/registration/allergies_screen/models/allergies_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = AllergiesBloc(AllergiesState( + allergiesModelObj: AllergiesModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: AllergiesScreen(), + ), + ), + ); + }); + }); +} diff --git a/test/auth_test.dart b/test/auth_test.dart new file mode 100644 index 00000000..e131dc88 --- /dev/null +++ b/test/auth_test.dart @@ -0,0 +1,41 @@ +import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart'; +import 'package:eatvio_app/presentation/auth/auth_screen/bloc/auth_bloc.dart'; +import 'package:eatvio_app/presentation/auth/auth_screen/models/auth_model.dart'; + +void main() { + group('AuthScreen', () { + testWidgets('renders AuthScreen with initial state', + (WidgetTester tester) async { + final authBloc = AuthBloc(AuthState(authModelObj: AuthModel())); + + await tester.pumpWidget( + MaterialApp( + localizationsDelegates: [ + AppLocalizationDelegate(), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + supportedLocales: [ + Locale( + 'ru', + '', + ), + ], + home: BlocProvider( + create: (context) => authBloc, + child: Builder( + builder: (context) { + return AuthScreen(); + }, + ), + ), + ), + ); + }); + }); +} diff --git a/test/blood_pressure_test.dart b/test/blood_pressure_test.dart new file mode 100644 index 00000000..a8c70dbe --- /dev/null +++ b/test/blood_pressure_test.dart @@ -0,0 +1,54 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart'; +import 'package:eatvio_app/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart'; +import 'package:eatvio_app/presentation/registration/blood_pressure_screen/models/blood_pressure_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = BloodPressureBloc(BloodPressureState( + bloodPressureModelObj: BloodPressureModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: BloodPressureScreen(), + ), + ), + ); + }); + }); +} diff --git a/test/body_circumferences_test.dart b/test/body_circumferences_test.dart new file mode 100644 index 00000000..339c3b8b --- /dev/null +++ b/test/body_circumferences_test.dart @@ -0,0 +1,54 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart'; +import 'package:eatvio_app/presentation/registration/body_circumferences_screen/bloc/body_circumferences_bloc.dart'; +import 'package:eatvio_app/presentation/registration/body_circumferences_screen/models/body_circumferences_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = BodyCircumferencesBloc(BodyCircumferencesState( + bodyCircumferencesModelObj: BodyCircumferencesModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: BodyCircumferencesScreen(), + ), + ), + ); + }); + }); +} diff --git a/test/city_of_living_test.dart b/test/city_of_living_test.dart new file mode 100644 index 00000000..1a6c18ba --- /dev/null +++ b/test/city_of_living_test.dart @@ -0,0 +1,54 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/city_of_living_screen/city_of_living_screen.dart'; +import 'package:eatvio_app/presentation/registration/city_of_living_screen/bloc/city_of_living_bloc.dart'; +import 'package:eatvio_app/presentation/registration/city_of_living_screen/models/city_of_living_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = CityOfLivingBloc(CityOfLivingState( + cityOfLivingModelObj: CityOfLivingModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: CityOfLivingScreen(), + ), + ), + ); + }); + }); +} diff --git a/test/credentials_test.dart b/test/credentials_test.dart new file mode 100644 index 00000000..a82cd418 --- /dev/null +++ b/test/credentials_test.dart @@ -0,0 +1,54 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/credentials_screen/credentials_screen.dart'; +import 'package:eatvio_app/presentation/registration/credentials_screen/bloc/credentials_bloc.dart'; +import 'package:eatvio_app/presentation/registration/credentials_screen/models/credentials_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = CredentialsBloc(CredentialsState( + credentialsModelObj: CredentialsModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: CredentialsScreen(), + ), + ), + ); + }); + }); +} diff --git a/test/date_of_birth_test.dart b/test/date_of_birth_test.dart new file mode 100644 index 00000000..8ce0a1f7 --- /dev/null +++ b/test/date_of_birth_test.dart @@ -0,0 +1,54 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart'; +import 'package:eatvio_app/presentation/registration/date_of_birth_screen/bloc/date_of_birth_bloc.dart'; +import 'package:eatvio_app/presentation/registration/date_of_birth_screen/models/date_of_birth_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = DateOfBirthBloc(DateOfBirthState( + dateOfBirthModelObj: DateOfBirthModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: DateOfBirthScreen(), + ), + ), + ); + }); + }); +} diff --git a/test/diary_test.dart b/test/diary_test.dart new file mode 100644 index 00000000..56d1c582 --- /dev/null +++ b/test/diary_test.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/diary/diary_edit_screen/diary_edit_screen.dart'; +import 'package:eatvio_app/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart'; +import 'package:eatvio_app/presentation/diary/diary_edit_screen/models/diary_edit_model.dart'; + +void main() { + group('DiaryEditScreen', () { + /*testWidgets('renders CircularProgressIndicator when in initial state', + (WidgetTester tester) async { + await tester.pumpWidget( + MaterialApp( + home: DiaryEditScreen(), + ), + ); + });*/ + + testWidgets('renders _buildDiaryEditScreen when in loaded state', (WidgetTester tester) async { + final diaryEditBloc = DiaryEditBloc(DiaryEditState(diaryEditModelObj: DiaryEditModel())); + final loadedState = DiaryEditLoadedState( + diaryId: 1, + selectedSatiety: 4, + autocompleteList: [], + photos: [], + portions: [], + wakeupExpanded: false, + moderationExpanded: false, + recommendedChartValues: [10, 10, 10, 10], + consumedChartValues: [1, 2, 3, 4], + moodExpanded: false,); + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: diaryEditBloc, + child: DiaryEditScreen(), + ), + ), + ); + + diaryEditBloc.emit(loadedState); + await tester.pump(); + + //expect(find.byType(_buildDiaryEditScreen), findsOneWidget); + }); + + /*testWidgets('renders error message when in error state', + (WidgetTester tester) async { + final diaryEditBloc = + DiaryEditBloc(DiaryEditState(diaryEditModelObj: DiaryEditModel())); + final errorState = DiaryEditErrorState("error"); + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: diaryEditBloc, + child: DiaryEditScreen(), + ), + ), + ); + + diaryEditBloc.emit(errorState); + await tester.pump(); + + expect(find.text('Ошибка'), findsOneWidget); + });*/ + + // Add more tests for other scenarios if needed + }); +} diff --git a/test/favorite_foods_test.dart b/test/favorite_foods_test.dart new file mode 100644 index 00000000..6364726f --- /dev/null +++ b/test/favorite_foods_test.dart @@ -0,0 +1,54 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart'; +import 'package:eatvio_app/presentation/registration/favorite_foods_screen/bloc/favorite_foods_bloc.dart'; +import 'package:eatvio_app/presentation/registration/favorite_foods_screen/models/favorite_foods_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = FavoriteFoodsBloc(FavoriteFoodsState( + favoriteFoodsModelObj: FavoriteFoodsModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: FavoriteFoodsScreen(), + ), + ), + ); + }); + }); +} diff --git a/test/favorite_sports_test.dart b/test/favorite_sports_test.dart new file mode 100644 index 00000000..1c7311e6 --- /dev/null +++ b/test/favorite_sports_test.dart @@ -0,0 +1,55 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart'; +import 'package:eatvio_app/presentation/registration/favorite_sports_screen/bloc/favorite_sports_bloc.dart'; +import 'package:eatvio_app/presentation/registration/favorite_sports_screen/models/favorite_sports_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = FavoriteSportsBloc(FavoriteSportsState( + favoriteSportsModelObj: FavoriteSportsModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteSports", + unfavoriteFoods: "unfavoriteSports", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: FavoriteSportsScreen(), + ), + ), + ); + }); + }); +} +//sports \ No newline at end of file diff --git a/test/gender_test.dart b/test/gender_test.dart new file mode 100644 index 00000000..94ab621c --- /dev/null +++ b/test/gender_test.dart @@ -0,0 +1,55 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/gender_screen/gender_screen.dart'; +import 'package:eatvio_app/presentation/registration/gender_screen/bloc/gender_bloc.dart'; +import 'package:eatvio_app/presentation/registration/gender_screen/models/gender_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = GenderBloc(GenderState( + genderModelObj: GenderModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteSports", + unfavoriteFoods: "unfavoriteSports", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: GenderScreen(), + ), + ), + ); + }); + }); +} +//sports \ No newline at end of file diff --git a/test/height_test.dart b/test/height_test.dart new file mode 100644 index 00000000..cd512ed4 --- /dev/null +++ b/test/height_test.dart @@ -0,0 +1,55 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/height_screen/height_screen.dart'; +import 'package:eatvio_app/presentation/registration/height_screen/bloc/height_bloc.dart'; +import 'package:eatvio_app/presentation/registration/height_screen/models/height_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = HeightBloc(HeightState( + heightModelObj: HeightModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + height: "height", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + gender: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteSports", + unfavoriteFoods: "unfavoriteSports", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: HeightScreen(), + ), + ), + ); + }); + }); +} +//sports \ No newline at end of file diff --git a/test/language_select_test.dart b/test/language_select_test.dart new file mode 100644 index 00000000..15582cf6 --- /dev/null +++ b/test/language_select_test.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/language_select_screen/language_select_screen.dart'; +import 'package:eatvio_app/presentation/registration/language_select_screen/bloc/language_select_bloc.dart'; +import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = LanguageSelectBloc(LanguageSelectState( + languageSelectModelObj: + LanguageSelectModel(),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: LanguageSelectScreen(), + ), + ), + ); + }); + }); +} +//sports \ No newline at end of file diff --git a/test/launch_test.dart b/test/launch_test.dart new file mode 100644 index 00000000..4f1eafee --- /dev/null +++ b/test/launch_test.dart @@ -0,0 +1,15 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/main.dart' as app; + +void main() { + testWidgets('Smoke test', (WidgetTester tester) async { + // Запустить приложение + app.main(); + + // Подождать, пока приложение загрузится + await tester.pumpAndSettle(); + + // Проверить, что нет ошибок + expect(tester.takeException(), isNull); + }); +} diff --git a/test/medicine_intake_test.dart b/test/medicine_intake_test.dart new file mode 100644 index 00000000..eae83c13 --- /dev/null +++ b/test/medicine_intake_test.dart @@ -0,0 +1,55 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart'; +import 'package:eatvio_app/presentation/registration/medicine_intake_screen/bloc/medicine_intake_bloc.dart'; +import 'package:eatvio_app/presentation/registration/medicine_intake_screen/models/medicine_intake_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = MedicineIntakeBloc(MedicineIntakeState( + medicineIntakeModelObj: MedicineIntakeModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: MedicineIntakeScreen(), + ), + ), + ); + }); + }); +} +//sports \ No newline at end of file diff --git a/test/name_test.dart b/test/name_test.dart new file mode 100644 index 00000000..1e271cb2 --- /dev/null +++ b/test/name_test.dart @@ -0,0 +1,55 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/name_screen/name_screen.dart'; +import 'package:eatvio_app/presentation/registration/name_screen/bloc/name_bloc.dart'; +import 'package:eatvio_app/presentation/registration/name_screen/models/name_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = NameBloc(NameState( + nameModelObj: NameModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: NameScreen(), + ), + ), + ); + }); + }); +} +//sports \ No newline at end of file diff --git a/test/profile_test.dart b/test/profile_test.dart new file mode 100644 index 00000000..cf0ebc41 --- /dev/null +++ b/test/profile_test.dart @@ -0,0 +1,26 @@ +import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/profile/my_profile_screen/my_profile_screen.dart'; +import 'package:eatvio_app/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart'; +import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart'; + +void main() { + group('MyProfileScreen', () { + testWidgets('renders CircularProgressIndicator in initial state', + (WidgetTester tester) async { + final myProfileBloc = MyProfileBloc(MyProfileState( + myProfileModelObj: + MyProfileModel(),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: MyProfileScreen(), + ), + ), + ); + }); + }); +} diff --git a/test/settings_test.dart b/test/settings_test.dart new file mode 100644 index 00000000..c6058784 --- /dev/null +++ b/test/settings_test.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/profile/my_profile_screen/my_settings_screen.dart'; +import 'package:eatvio_app/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart'; +import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart'; + +void main() { + group('MyProfileScreen', () { + testWidgets('renders CircularProgressIndicator in initial state', + (WidgetTester tester) async { + final myProfileBloc = MyProfileBloc(MyProfileState( + myProfileModelObj: + MyProfileModel(),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: MySettingsScreen(), + ), + ), + ); + }); + }); +} diff --git a/test/weight_test.dart b/test/weight_test.dart new file mode 100644 index 00000000..e5f9fe0c --- /dev/null +++ b/test/weight_test.dart @@ -0,0 +1,55 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/weight_screen/weight_screen.dart'; +import 'package:eatvio_app/presentation/registration/weight_screen/bloc/weight_bloc.dart'; +import 'package:eatvio_app/presentation/registration/weight_screen/models/weight_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = WeightBloc(WeightState( + weightModelObj: WeightModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: WeightScreen(), + ), + ), + ); + }); + }); +} +//sports \ No newline at end of file From e3a134b73abd663eb5d02dc1875506ede614a432 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Thu, 11 Jul 2024 18:36:17 +0300 Subject: [PATCH 08/21] feature(registration): fix tests --- .../additional_information_screen.dart | 1 - test/add_info_test.dart | 2 +- test/allergies_test.dart | 2 +- test/blood_pressure_test.dart | 2 +- test/body_circumferences_test.dart | 2 +- test/city_of_living_test.dart | 2 +- test/credentials_test.dart | 2 +- test/date_of_birth_test.dart | 2 +- test/favorite_foods_test.dart | 2 +- test/favorite_sports_test.dart | 2 +- test/gender_test.dart | 2 +- test/height_test.dart | 2 +- test/language_select_test.dart | 2 +- test/medicine_intake_test.dart | 2 +- test/name_test.dart | 2 +- test/settings_test.dart | 2 +- test/weight_test.dart | 2 +- 17 files changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart index d1c18d09..b39743ec 100644 --- a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart @@ -82,7 +82,6 @@ class AdditionalInformationScreen extends StatelessWidget { /// Section Widget _buildTextFormField(BuildContext context) { return SizedBox( - height: 315.v, width: 343.h, child: Stack( alignment: Alignment.center, diff --git a/test/add_info_test.dart b/test/add_info_test.dart index 86379dda..9fa83f85 100644 --- a/test/add_info_test.dart +++ b/test/add_info_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: AdditionalInformationScreen(), + child: Scaffold(body: AdditionalInformationScreen()), ), ), ); diff --git a/test/allergies_test.dart b/test/allergies_test.dart index d0a78328..ca8a2f21 100644 --- a/test/allergies_test.dart +++ b/test/allergies_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: AllergiesScreen(), + child: Scaffold(body: AllergiesScreen()), ), ), ); diff --git a/test/blood_pressure_test.dart b/test/blood_pressure_test.dart index a8c70dbe..30cbb03d 100644 --- a/test/blood_pressure_test.dart +++ b/test/blood_pressure_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: BloodPressureScreen(), + child: Scaffold(body: BloodPressureScreen()), ), ), ); diff --git a/test/body_circumferences_test.dart b/test/body_circumferences_test.dart index 339c3b8b..933c8e08 100644 --- a/test/body_circumferences_test.dart +++ b/test/body_circumferences_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: BodyCircumferencesScreen(), + child: Scaffold(body: BodyCircumferencesScreen()), ), ), ); diff --git a/test/city_of_living_test.dart b/test/city_of_living_test.dart index 1a6c18ba..229c6f27 100644 --- a/test/city_of_living_test.dart +++ b/test/city_of_living_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: CityOfLivingScreen(), + child: Scaffold(body: CityOfLivingScreen()), ), ), ); diff --git a/test/credentials_test.dart b/test/credentials_test.dart index a82cd418..73995cce 100644 --- a/test/credentials_test.dart +++ b/test/credentials_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: CredentialsScreen(), + child: Scaffold(body: CredentialsScreen()), ), ), ); diff --git a/test/date_of_birth_test.dart b/test/date_of_birth_test.dart index 8ce0a1f7..e2cac1ee 100644 --- a/test/date_of_birth_test.dart +++ b/test/date_of_birth_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: DateOfBirthScreen(), + child: Scaffold(body: DateOfBirthScreen()), ), ), ); diff --git a/test/favorite_foods_test.dart b/test/favorite_foods_test.dart index 6364726f..fa4553a2 100644 --- a/test/favorite_foods_test.dart +++ b/test/favorite_foods_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: FavoriteFoodsScreen(), + child: Scaffold(body: FavoriteFoodsScreen()), ), ), ); diff --git a/test/favorite_sports_test.dart b/test/favorite_sports_test.dart index 1c7311e6..4b6f6724 100644 --- a/test/favorite_sports_test.dart +++ b/test/favorite_sports_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: FavoriteSportsScreen(), + child: Scaffold(body: FavoriteSportsScreen()), ), ), ); diff --git a/test/gender_test.dart b/test/gender_test.dart index 94ab621c..45466f48 100644 --- a/test/gender_test.dart +++ b/test/gender_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: GenderScreen(), + child: Scaffold(body: GenderScreen()), ), ), ); diff --git a/test/height_test.dart b/test/height_test.dart index cd512ed4..34eaec44 100644 --- a/test/height_test.dart +++ b/test/height_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: HeightScreen(), + child: Scaffold(body: HeightScreen()), ), ), ); diff --git a/test/language_select_test.dart b/test/language_select_test.dart index 15582cf6..d6674042 100644 --- a/test/language_select_test.dart +++ b/test/language_select_test.dart @@ -16,7 +16,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: LanguageSelectScreen(), + child: Scaffold(body: LanguageSelectScreen()), ), ), ); diff --git a/test/medicine_intake_test.dart b/test/medicine_intake_test.dart index eae83c13..510b7e88 100644 --- a/test/medicine_intake_test.dart +++ b/test/medicine_intake_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: MedicineIntakeScreen(), + child: Scaffold(body: MedicineIntakeScreen()), ), ), ); diff --git a/test/name_test.dart b/test/name_test.dart index 1e271cb2..f2a25172 100644 --- a/test/name_test.dart +++ b/test/name_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: NameScreen(), + child: Scaffold(body: NameScreen()), ), ), ); diff --git a/test/settings_test.dart b/test/settings_test.dart index c6058784..4e5021a0 100644 --- a/test/settings_test.dart +++ b/test/settings_test.dart @@ -17,7 +17,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: MySettingsScreen(), + child: Scaffold(body: MySettingsScreen()), ), ), ); diff --git a/test/weight_test.dart b/test/weight_test.dart index e5f9fe0c..fcd45c4d 100644 --- a/test/weight_test.dart +++ b/test/weight_test.dart @@ -45,7 +45,7 @@ void main() { MaterialApp( home: BlocProvider.value( value: myProfileBloc, - child: WeightScreen(), + child: Scaffold(body: WeightScreen()), ), ), ); From 89b94ea2a02324156955a62481fe79cee37de198 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Fri, 12 Jul 2024 14:23:53 +0300 Subject: [PATCH 09/21] feature(registration): try push --- lib/main.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 7faced2a..5cb4e316 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -68,7 +68,7 @@ class MyApp extends StatelessWidget { theme: theme, title: 'Eatvio', routerConfig: AppRouter.appRouter, - debugShowCheckedModeBanner: false, + debugShowCheckedModeBanner: true, localizationsDelegates: [ AppLocalizationDelegate(), GlobalMaterialLocalizations.delegate, From c903fa4e65d93275b61fb7dd6152945b2bcb3dea Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Fri, 12 Jul 2024 14:48:17 +0300 Subject: [PATCH 10/21] feat(registration): fix --- .DS_Store | Bin 0 -> 6148 bytes lib/main.dart | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..017f6122a1c39393f4632e375b97f19d52e245e6 GIT binary patch literal 6148 zcmeHKOHRWu5PhZ*l#dWBkk}yQ0#xD#0ksPjY~TPT{eTLARFopI%bq)M1+=PpPe`cV2f;eJOqlv88`iNQ zG7uT~Z4Ah}yMr9JOaxTGq*-A564>rwM7sxCmV65Ljrq;GIVG)jN z+rZ5+V2ml_4jE6FVPrp^?6xm(pYKwxkB3{uDS8}zm(2DU?Izr*vQ{1<;eH{5xc5f{ z*`;+3S^Y!8Gh3v+ZgtEf1CfEqzy|~JeMp%^XHHjE>!*X6UIC~RHmk5KzZ8N=oz9%D ztY#0zSSYoH8h6Do7S8t6*=0^wR$DlXyL=cI*|-~u(dhJ_syR$%b<86JkpZ89maT5d z`QKZ7|Mx+$78!^P{3`}b(mm@QaZ2uNZA?zi+LY;>Nkr@_s};h`9miUbqj;A|g?*_M Ws57T4tJy+{KLSca%pwCn%D_9st?(HD literal 0 HcmV?d00001 diff --git a/lib/main.dart b/lib/main.dart index 5cb4e316..7faced2a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -68,7 +68,7 @@ class MyApp extends StatelessWidget { theme: theme, title: 'Eatvio', routerConfig: AppRouter.appRouter, - debugShowCheckedModeBanner: true, + debugShowCheckedModeBanner: false, localizationsDelegates: [ AppLocalizationDelegate(), GlobalMaterialLocalizations.delegate, From 12a0db50932231ad1b2f69ffcb51c6fa66ef1012 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Sun, 14 Jul 2024 16:25:00 +0300 Subject: [PATCH 11/21] feat(registration): refactor --- test/add_info_test.dart | 54 ----------------------- test/allergies_test.dart | 54 ----------------------- test/blood_pressure_test.dart | 54 ----------------------- test/body_circumferences_test.dart | 54 ----------------------- test/city_of_living_test.dart | 54 ----------------------- test/credentials_test.dart | 54 ----------------------- test/date_of_birth_test.dart | 54 ----------------------- test/diary_test.dart | 71 ------------------------------ test/favorite_foods_test.dart | 54 ----------------------- test/favorite_sports_test.dart | 55 ----------------------- test/gender_test.dart | 55 ----------------------- test/height_test.dart | 55 ----------------------- test/language_select_test.dart | 26 ----------- test/launch_test.dart | 15 ------- test/medicine_intake_test.dart | 55 ----------------------- test/name_test.dart | 55 ----------------------- test/profile_test.dart | 26 ----------- test/settings_test.dart | 26 ----------- test/weight_test.dart | 55 ----------------------- 19 files changed, 926 deletions(-) delete mode 100644 test/add_info_test.dart delete mode 100644 test/allergies_test.dart delete mode 100644 test/blood_pressure_test.dart delete mode 100644 test/body_circumferences_test.dart delete mode 100644 test/city_of_living_test.dart delete mode 100644 test/credentials_test.dart delete mode 100644 test/date_of_birth_test.dart delete mode 100644 test/diary_test.dart delete mode 100644 test/favorite_foods_test.dart delete mode 100644 test/favorite_sports_test.dart delete mode 100644 test/gender_test.dart delete mode 100644 test/height_test.dart delete mode 100644 test/language_select_test.dart delete mode 100644 test/launch_test.dart delete mode 100644 test/medicine_intake_test.dart delete mode 100644 test/name_test.dart delete mode 100644 test/profile_test.dart delete mode 100644 test/settings_test.dart delete mode 100644 test/weight_test.dart diff --git a/test/add_info_test.dart b/test/add_info_test.dart deleted file mode 100644 index 9fa83f85..00000000 --- a/test/add_info_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/additional_information_screen/additional_information_screen.dart'; -import 'package:eatvio_app/presentation/registration/additional_information_screen/bloc/additional_information_bloc.dart'; -import 'package:eatvio_app/presentation/registration/additional_information_screen/models/additional_information_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = AdditionalInformationBloc(AdditionalInformationState( - additionalInformationModelObj: AdditionalInformationModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: AdditionalInformationScreen()), - ), - ), - ); - }); - }); -} diff --git a/test/allergies_test.dart b/test/allergies_test.dart deleted file mode 100644 index ca8a2f21..00000000 --- a/test/allergies_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/allergies_screen/allergies_screen.dart'; -import 'package:eatvio_app/presentation/registration/allergies_screen/bloc/allergies_bloc.dart'; -import 'package:eatvio_app/presentation/registration/allergies_screen/models/allergies_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = AllergiesBloc(AllergiesState( - allergiesModelObj: AllergiesModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: AllergiesScreen()), - ), - ), - ); - }); - }); -} diff --git a/test/blood_pressure_test.dart b/test/blood_pressure_test.dart deleted file mode 100644 index 30cbb03d..00000000 --- a/test/blood_pressure_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart'; -import 'package:eatvio_app/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart'; -import 'package:eatvio_app/presentation/registration/blood_pressure_screen/models/blood_pressure_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = BloodPressureBloc(BloodPressureState( - bloodPressureModelObj: BloodPressureModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: BloodPressureScreen()), - ), - ), - ); - }); - }); -} diff --git a/test/body_circumferences_test.dart b/test/body_circumferences_test.dart deleted file mode 100644 index 933c8e08..00000000 --- a/test/body_circumferences_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart'; -import 'package:eatvio_app/presentation/registration/body_circumferences_screen/bloc/body_circumferences_bloc.dart'; -import 'package:eatvio_app/presentation/registration/body_circumferences_screen/models/body_circumferences_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = BodyCircumferencesBloc(BodyCircumferencesState( - bodyCircumferencesModelObj: BodyCircumferencesModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: BodyCircumferencesScreen()), - ), - ), - ); - }); - }); -} diff --git a/test/city_of_living_test.dart b/test/city_of_living_test.dart deleted file mode 100644 index 229c6f27..00000000 --- a/test/city_of_living_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/city_of_living_screen/city_of_living_screen.dart'; -import 'package:eatvio_app/presentation/registration/city_of_living_screen/bloc/city_of_living_bloc.dart'; -import 'package:eatvio_app/presentation/registration/city_of_living_screen/models/city_of_living_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = CityOfLivingBloc(CityOfLivingState( - cityOfLivingModelObj: CityOfLivingModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: CityOfLivingScreen()), - ), - ), - ); - }); - }); -} diff --git a/test/credentials_test.dart b/test/credentials_test.dart deleted file mode 100644 index 73995cce..00000000 --- a/test/credentials_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/credentials_screen/credentials_screen.dart'; -import 'package:eatvio_app/presentation/registration/credentials_screen/bloc/credentials_bloc.dart'; -import 'package:eatvio_app/presentation/registration/credentials_screen/models/credentials_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = CredentialsBloc(CredentialsState( - credentialsModelObj: CredentialsModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: CredentialsScreen()), - ), - ), - ); - }); - }); -} diff --git a/test/date_of_birth_test.dart b/test/date_of_birth_test.dart deleted file mode 100644 index e2cac1ee..00000000 --- a/test/date_of_birth_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart'; -import 'package:eatvio_app/presentation/registration/date_of_birth_screen/bloc/date_of_birth_bloc.dart'; -import 'package:eatvio_app/presentation/registration/date_of_birth_screen/models/date_of_birth_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = DateOfBirthBloc(DateOfBirthState( - dateOfBirthModelObj: DateOfBirthModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: DateOfBirthScreen()), - ), - ), - ); - }); - }); -} diff --git a/test/diary_test.dart b/test/diary_test.dart deleted file mode 100644 index 56d1c582..00000000 --- a/test/diary_test.dart +++ /dev/null @@ -1,71 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/diary/diary_edit_screen/diary_edit_screen.dart'; -import 'package:eatvio_app/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart'; -import 'package:eatvio_app/presentation/diary/diary_edit_screen/models/diary_edit_model.dart'; - -void main() { - group('DiaryEditScreen', () { - /*testWidgets('renders CircularProgressIndicator when in initial state', - (WidgetTester tester) async { - await tester.pumpWidget( - MaterialApp( - home: DiaryEditScreen(), - ), - ); - });*/ - - testWidgets('renders _buildDiaryEditScreen when in loaded state', (WidgetTester tester) async { - final diaryEditBloc = DiaryEditBloc(DiaryEditState(diaryEditModelObj: DiaryEditModel())); - final loadedState = DiaryEditLoadedState( - diaryId: 1, - selectedSatiety: 4, - autocompleteList: [], - photos: [], - portions: [], - wakeupExpanded: false, - moderationExpanded: false, - recommendedChartValues: [10, 10, 10, 10], - consumedChartValues: [1, 2, 3, 4], - moodExpanded: false,); - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: diaryEditBloc, - child: DiaryEditScreen(), - ), - ), - ); - - diaryEditBloc.emit(loadedState); - await tester.pump(); - - //expect(find.byType(_buildDiaryEditScreen), findsOneWidget); - }); - - /*testWidgets('renders error message when in error state', - (WidgetTester tester) async { - final diaryEditBloc = - DiaryEditBloc(DiaryEditState(diaryEditModelObj: DiaryEditModel())); - final errorState = DiaryEditErrorState("error"); - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: diaryEditBloc, - child: DiaryEditScreen(), - ), - ), - ); - - diaryEditBloc.emit(errorState); - await tester.pump(); - - expect(find.text('Ошибка'), findsOneWidget); - });*/ - - // Add more tests for other scenarios if needed - }); -} diff --git a/test/favorite_foods_test.dart b/test/favorite_foods_test.dart deleted file mode 100644 index fa4553a2..00000000 --- a/test/favorite_foods_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart'; -import 'package:eatvio_app/presentation/registration/favorite_foods_screen/bloc/favorite_foods_bloc.dart'; -import 'package:eatvio_app/presentation/registration/favorite_foods_screen/models/favorite_foods_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = FavoriteFoodsBloc(FavoriteFoodsState( - favoriteFoodsModelObj: FavoriteFoodsModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: FavoriteFoodsScreen()), - ), - ), - ); - }); - }); -} diff --git a/test/favorite_sports_test.dart b/test/favorite_sports_test.dart deleted file mode 100644 index 4b6f6724..00000000 --- a/test/favorite_sports_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart'; -import 'package:eatvio_app/presentation/registration/favorite_sports_screen/bloc/favorite_sports_bloc.dart'; -import 'package:eatvio_app/presentation/registration/favorite_sports_screen/models/favorite_sports_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = FavoriteSportsBloc(FavoriteSportsState( - favoriteSportsModelObj: FavoriteSportsModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteSports", - unfavoriteFoods: "unfavoriteSports", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: FavoriteSportsScreen()), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/gender_test.dart b/test/gender_test.dart deleted file mode 100644 index 45466f48..00000000 --- a/test/gender_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/gender_screen/gender_screen.dart'; -import 'package:eatvio_app/presentation/registration/gender_screen/bloc/gender_bloc.dart'; -import 'package:eatvio_app/presentation/registration/gender_screen/models/gender_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = GenderBloc(GenderState( - genderModelObj: GenderModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteSports", - unfavoriteFoods: "unfavoriteSports", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: GenderScreen()), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/height_test.dart b/test/height_test.dart deleted file mode 100644 index 34eaec44..00000000 --- a/test/height_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/height_screen/height_screen.dart'; -import 'package:eatvio_app/presentation/registration/height_screen/bloc/height_bloc.dart'; -import 'package:eatvio_app/presentation/registration/height_screen/models/height_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = HeightBloc(HeightState( - heightModelObj: HeightModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - height: "height", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - gender: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteSports", - unfavoriteFoods: "unfavoriteSports", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: HeightScreen()), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/language_select_test.dart b/test/language_select_test.dart deleted file mode 100644 index d6674042..00000000 --- a/test/language_select_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/language_select_screen.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/bloc/language_select_bloc.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = LanguageSelectBloc(LanguageSelectState( - languageSelectModelObj: - LanguageSelectModel(),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: LanguageSelectScreen()), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/launch_test.dart b/test/launch_test.dart deleted file mode 100644 index 4f1eafee..00000000 --- a/test/launch_test.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/main.dart' as app; - -void main() { - testWidgets('Smoke test', (WidgetTester tester) async { - // Запустить приложение - app.main(); - - // Подождать, пока приложение загрузится - await tester.pumpAndSettle(); - - // Проверить, что нет ошибок - expect(tester.takeException(), isNull); - }); -} diff --git a/test/medicine_intake_test.dart b/test/medicine_intake_test.dart deleted file mode 100644 index 510b7e88..00000000 --- a/test/medicine_intake_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart'; -import 'package:eatvio_app/presentation/registration/medicine_intake_screen/bloc/medicine_intake_bloc.dart'; -import 'package:eatvio_app/presentation/registration/medicine_intake_screen/models/medicine_intake_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = MedicineIntakeBloc(MedicineIntakeState( - medicineIntakeModelObj: MedicineIntakeModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: MedicineIntakeScreen()), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/name_test.dart b/test/name_test.dart deleted file mode 100644 index f2a25172..00000000 --- a/test/name_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/name_screen/name_screen.dart'; -import 'package:eatvio_app/presentation/registration/name_screen/bloc/name_bloc.dart'; -import 'package:eatvio_app/presentation/registration/name_screen/models/name_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = NameBloc(NameState( - nameModelObj: NameModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: NameScreen()), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file diff --git a/test/profile_test.dart b/test/profile_test.dart deleted file mode 100644 index cf0ebc41..00000000 --- a/test/profile_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/my_profile_screen.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart'; - -void main() { - group('MyProfileScreen', () { - testWidgets('renders CircularProgressIndicator in initial state', - (WidgetTester tester) async { - final myProfileBloc = MyProfileBloc(MyProfileState( - myProfileModelObj: - MyProfileModel(),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: MyProfileScreen(), - ), - ), - ); - }); - }); -} diff --git a/test/settings_test.dart b/test/settings_test.dart deleted file mode 100644 index 4e5021a0..00000000 --- a/test/settings_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/my_settings_screen.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart'; - -void main() { - group('MyProfileScreen', () { - testWidgets('renders CircularProgressIndicator in initial state', - (WidgetTester tester) async { - final myProfileBloc = MyProfileBloc(MyProfileState( - myProfileModelObj: - MyProfileModel(),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: MySettingsScreen()), - ), - ), - ); - }); - }); -} diff --git a/test/weight_test.dart b/test/weight_test.dart deleted file mode 100644 index fcd45c4d..00000000 --- a/test/weight_test.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:eatvio_app/presentation/registration/weight_screen/weight_screen.dart'; -import 'package:eatvio_app/presentation/registration/weight_screen/bloc/weight_bloc.dart'; -import 'package:eatvio_app/presentation/registration/weight_screen/models/weight_model.dart'; - -void main() { - group('AdditionalInfoScreen', () { - testWidgets('renders screen in initial state', (WidgetTester tester) async { - final myProfileBloc = WeightBloc(WeightState( - weightModelObj: WeightModel( - userRegistrationSheet: UserRegistrationSheet( - name: "name", - firstName: "firstName", - lastName: "lastName", - email: "email", - password: "password", - passwordConfirmation: "passwordConfirmation", - termsAccepted: "termsAccepted", - birthdate: "birthdate", - gender: "gender", - country: "country", - city: "city", - lang: "lang", - weight: "weight", - height: "height", - chestCircumference: 'asdasd', - waistCircumference: "waistCircumference", - hipCircumference: "hipCircumference", - bloodPressureUp: "bloodPressureUp", - bloodPressureDown: "bloodPressureDown", - hasHypo: "hasHypo", - hasHyper: "hasHyper", - aboutAllergy: "aboutAllergy", - aboutTakingPils: "aboutTakingPils", - aboutSportHobbies: "aboutSportHobbies", - favoriteFoods: "favoriteFoods", - unfavoriteFoods: "unfavoriteFoods", - additionalInfo: - "additionalInfo",),),),); // Ensure that MyProfileModel is non-nullable - - await tester.pumpWidget( - MaterialApp( - home: BlocProvider.value( - value: myProfileBloc, - child: Scaffold(body: WeightScreen()), - ), - ), - ); - }); - }); -} -//sports \ No newline at end of file From 3cdab9e1bb5567486eec0c296f00beba4ab653f2 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Sun, 14 Jul 2024 16:30:10 +0300 Subject: [PATCH 12/21] feature(registration): refactor --- lib/app_router.dart | 118 --- .../user_registration_model.dart | 146 ++-- .../user_registration_model.freezed.dart | 811 ++++++++++++++++++ .../user_registration_model.g.dart | 73 ++ .../registration_cubit.dart | 4 +- .../registration_state.dart | 8 +- .../registration_state.freezed.dart | 272 ++---- .../pages/registration_screen.dart | 113 ++- .../additional_information_screen.dart | 2 +- .../allergies_screen/allergies_screen.dart | 2 +- .../bloc/blood_pressure_bloc.dart | 8 +- .../blood_pressure_screen.dart | 4 +- .../body_circumferences_screen.dart | 8 +- .../bloc/city_of_living_bloc.dart | 2 +- .../city_of_living_screen.dart | 1 - .../credentials_screen.dart | 173 ++-- .../date_of_birth_screen.dart | 2 +- .../favorite_foods_screen.dart | 4 +- .../favorite_sports_screen.dart | 2 +- .../gender_screen/bloc/gender_bloc.dart | 2 +- .../gender_screen/gender_screen.dart | 2 +- .../height_screen/height_screen.dart | 2 +- .../bloc/language_select_bloc.dart | 2 +- .../language_select_screen.dart | 100 +-- .../models/language_select_model.dart | 1 + .../medicine_intake_screen.dart | 2 +- .../registration/name_screen/name_screen.dart | 2 +- .../weight_screen/weight_screen.dart | 2 +- lib/widgets/app_bar/appbar_title_image.dart | 31 +- lib/widgets/custom_drop_down.dart | 1 - lib/widgets/custom_text_form_field.dart | 3 +- 31 files changed, 1214 insertions(+), 689 deletions(-) create mode 100644 lib/data/models/userRegistrationModel/user_registration_model.freezed.dart create mode 100644 lib/data/models/userRegistrationModel/user_registration_model.g.dart diff --git a/lib/app_router.dart b/lib/app_router.dart index 5ca4a54c..8f16666c 100644 --- a/lib/app_router.dart +++ b/lib/app_router.dart @@ -16,21 +16,6 @@ import 'package:eatvio_app/presentation/plans/plan_select_screen/plan_select_scr import 'package:eatvio_app/presentation/profile/my_profile_screen/my_profile_screen.dart'; import 'package:eatvio_app/presentation/profile/my_profile_screen/my_settings_screen.dart'; import 'package:eatvio_app/presentation/recipe/recipe_select_screen/recipe_select_screen.dart'; -import 'package:eatvio_app/presentation/registration/additional_information_screen/additional_information_screen.dart'; -import 'package:eatvio_app/presentation/registration/allergies_screen/allergies_screen.dart'; -import 'package:eatvio_app/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart'; -import 'package:eatvio_app/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart'; -import 'package:eatvio_app/presentation/registration/city_of_living_screen/city_of_living_screen.dart'; -import 'package:eatvio_app/presentation/registration/credentials_screen/credentials_screen.dart'; -import 'package:eatvio_app/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart'; -import 'package:eatvio_app/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart'; -import 'package:eatvio_app/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart'; -import 'package:eatvio_app/presentation/registration/gender_screen/gender_screen.dart'; -import 'package:eatvio_app/presentation/registration/height_screen/height_screen.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/language_select_screen.dart'; -import 'package:eatvio_app/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart'; -import 'package:eatvio_app/presentation/registration/name_screen/name_screen.dart'; -import 'package:eatvio_app/presentation/registration/weight_screen/weight_screen.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart'; import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart'; import 'package:flutter/material.dart'; @@ -60,109 +45,6 @@ class AppRouter { name: 'registrationScreen', builder: (context, state) => const RegistrationScreen(), ), - GoRoute( - path: 'language-select-screen', - name: 'languageSelectScreen', - builder: (context, state) => LanguageSelectScreen.builder(context), - routes: [ - GoRoute( - path: 'credentials-screen', - name: 'credentialsScreen', - builder: (context, state) => CredentialsScreen.builder(context, state.extra), - routes: [ - GoRoute( - path: 'name-screen', - name: 'nameScreen', - builder: (context, state) => NameScreen.builder(context, state.extra), - routes: [ - GoRoute( - path: 'gender-screen', - name: 'genderScreen', - builder: (context, state) => GenderScreen.builder(context, state.extra), - routes: [ - GoRoute( - path: 'date-of-birth-screen', - name: 'dateOfBirthScreen', - builder: (context, state) => DateOfBirthScreen.builder(context, state.extra), - routes: [ - GoRoute( - path: 'city-of-living-screen', - name: 'cityOfLivingScreen', - builder: (context, state) => CityOfLivingScreen.builder(context, state.extra), - routes: [ - GoRoute( - path: 'body-circumferences-screen', - name: 'bodyCircumferencesScreen', - builder: (context, state) => BodyCircumferencesScreen.builder(context, state.extra), - routes: [ - GoRoute( - path: 'weight-screen', - name: 'weightScreen', - builder: (context, state) => WeightScreen.builder(context, state.extra), - routes: [ - GoRoute( - path: 'height-screen', - name: 'heightScreen', - builder: (context, state) => HeightScreen.builder(context, state.extra), - routes: [ - GoRoute( - path: 'blood-pressure-screen', - name: 'bloodPressureScreen', - builder: (context, state) => BloodPressureScreen.builder(context, state.extra), - routes: [ - GoRoute( - name: 'allergiesScreen', - path: 'allergiesScreen', - builder: (context, state) => AllergiesScreen.builder(context, state.extra), - routes: [ - GoRoute( - name: 'medicineIntakeScreen', - path: 'medicine-intake-screen', - builder: (context, state) => MedicineIntakeScreen.builder(context, state.extra), - routes: [ - GoRoute( - path: 'favorite-sports-screen', - name: 'favoriteSportsScreen', - builder: (context, state) => FavoriteSportsScreen.builder(context, state.extra), - routes: [ - GoRoute( - name: 'favoriteFoodsScreen', - path: 'favorite-foods-screen', - builder: (context, state) => FavoriteFoodsScreen.builder(context, state.extra), - routes: [ - GoRoute( - path: 'additional-information-screen', - name: 'additionalInformationScreen', - builder: (context, state) => AdditionalInformationScreen.builder(context, state.extra), - ), - ], - ), - ], - ), - ], - ), - ], - ), - ], - ), - ], - ), - ], - ), - ], - ), - ], - ), - ], - ), - ], - ), - ], - ), - ], - ), - ], - ), ], ), ShellRoute( diff --git a/lib/data/models/userRegistrationModel/user_registration_model.dart b/lib/data/models/userRegistrationModel/user_registration_model.dart index baeb3a16..cae81cd1 100644 --- a/lib/data/models/userRegistrationModel/user_registration_model.dart +++ b/lib/data/models/userRegistrationModel/user_registration_model.dart @@ -1,92 +1,60 @@ -class UserRegistrationSheet { - String name; - String firstName; - String lastName; - String email; - String password; - String passwordConfirmation; - String termsAccepted; - String birthdate; - String gender; - String country; - String city; - String lang; - String weight; - String height; - String chestCircumference; - String waistCircumference; - String hipCircumference; - String bloodPressureUp; - String bloodPressureDown; - String hasHypo = ''; - String hasHyper = ''; - String aboutAllergy = ''; - String aboutTakingPils = ''; - String aboutSportHobbies = ''; - String favoriteFoods = ''; - String unfavoriteFoods = ''; - String additionalInfo = ''; +import 'package:freezed_annotation/freezed_annotation.dart'; - UserRegistrationSheet({ - required this.name, - required this.firstName, - required this.lastName, - required this.email, - required this.password, - required this.passwordConfirmation, - required this.termsAccepted, - required this.birthdate, - required this.gender, - required this.country, - required this.city, - required this.lang, - required this.weight, - required this.height, - required this.chestCircumference, - required this.waistCircumference, - required this.hipCircumference, - required this.bloodPressureUp, - required this.bloodPressureDown, - required this.hasHypo, - required this.hasHyper, - required this.aboutAllergy, - required this.aboutTakingPils, - required this.aboutSportHobbies, - required this.favoriteFoods, - required this.unfavoriteFoods, - required this.additionalInfo, - }); +part 'user_registration_model.freezed.dart'; +part 'user_registration_model.g.dart'; - Map toJson() { - return { - 'name': name, - 'first_name': firstName, - 'last_name': lastName, - 'email': email, - 'password': password, - 'password_confirmation': passwordConfirmation, - 'terms': termsAccepted, - 'birthdate': birthdate.toString(), - 'gender': gender, - 'country': country, - 'city': city, - 'lang': lang, - 'weight': weight, - 'height': height, - 'chest_circumference': chestCircumference, - 'waist_circumference': waistCircumference, - 'hip_circumference': hipCircumference, - 'blood_pressure_up': bloodPressureUp, - 'blood_pressure_down': bloodPressureDown, - 'has_hypo': hasHypo, - 'has_hyper': hasHyper, - 'about_alergy': aboutAllergy, - 'about_taking_pils': aboutTakingPils, - 'about_sport_hobbies': aboutSportHobbies, - 'favorite_foods': favoriteFoods, - 'unfavorite_foods': unfavoriteFoods, - 'additional_info': additionalInfo, - 'activity_coefficient': '1.2', - }; - } +@freezed +class UserRegistrationSheet with _$UserRegistrationSheet { + const factory UserRegistrationSheet({ + required String name, + @JsonKey(name: 'first_name') + required String firstName, + @JsonKey(name: 'last') + required String lastName, + required String email, + required String password, + @JsonKey(name: 'password_confirmation') + required String passwordConfirmation, + @Default('accepted') + @JsonKey(name: 'terms') + String termsAccepted, + required String birthdate, + required String gender, + required String country, + required String city, + required String lang, + required String weight, + required String height, + @JsonKey(name: 'chest_circumference') + required String chestCircumference, + @JsonKey(name: 'waist_circumference') + required String waistCircumference, + @JsonKey(name: 'hip_circumference') + required String hipCircumference, + @JsonKey(name: 'blood_pressure_up') + required String bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') + required String bloodPressureDown, + @JsonKey(name: 'has_hypo') + required String hasHypo, + @JsonKey(name: 'has_hyper') + required String hasHyper, + @JsonKey(name: 'about_alergy') + required String aboutAllergy, + @JsonKey(name: 'about_taking_pils') + required String aboutTakingPils, + @JsonKey(name: 'about_sport_hobbies') + required String aboutSportHobbies, + @JsonKey(name: 'favorite_foods') + required String favoriteFoods, + @JsonKey(name: 'unfavorite_foods') + required String unfavoriteFoods, + @JsonKey(name: 'additional_info') + required String additionalInfo, + @Default('1.2') + @JsonKey(name: 'activity_coefficient') + String activityCoefficient, + }) = _UserRegistrationSheet; + + factory UserRegistrationSheet.fromJson(Map json) => _$UserRegistrationSheetFromJson(json); } diff --git a/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart b/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart new file mode 100644 index 00000000..9d00a7dd --- /dev/null +++ b/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart @@ -0,0 +1,811 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user_registration_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +UserRegistrationSheet _$UserRegistrationSheetFromJson( + Map json) { + return _UserRegistrationSheet.fromJson(json); +} + +/// @nodoc +mixin _$UserRegistrationSheet { + String get name => throw _privateConstructorUsedError; + @JsonKey(name: 'first_name') + String get firstName => throw _privateConstructorUsedError; + @JsonKey(name: 'last') + String get lastName => throw _privateConstructorUsedError; + String get email => throw _privateConstructorUsedError; + String get password => throw _privateConstructorUsedError; + @JsonKey(name: 'password_confirmation') + String get passwordConfirmation => throw _privateConstructorUsedError; + @JsonKey(name: 'terms') + String get termsAccepted => throw _privateConstructorUsedError; + String get birthdate => throw _privateConstructorUsedError; + String get gender => throw _privateConstructorUsedError; + String get country => throw _privateConstructorUsedError; + String get city => throw _privateConstructorUsedError; + String get lang => throw _privateConstructorUsedError; + String get weight => throw _privateConstructorUsedError; + String get height => throw _privateConstructorUsedError; + @JsonKey(name: 'chest_circumference') + String get chestCircumference => throw _privateConstructorUsedError; + @JsonKey(name: 'waist_circumference') + String get waistCircumference => throw _privateConstructorUsedError; + @JsonKey(name: 'hip_circumference') + String get hipCircumference => throw _privateConstructorUsedError; + @JsonKey(name: 'blood_pressure_up') + String get bloodPressureUp => throw _privateConstructorUsedError; + @JsonKey(name: 'blood_pressure_down') + String get bloodPressureDown => throw _privateConstructorUsedError; + @JsonKey(name: 'has_hypo') + String get hasHypo => throw _privateConstructorUsedError; + @JsonKey(name: 'has_hyper') + String get hasHyper => throw _privateConstructorUsedError; + @JsonKey(name: 'about_alergy') + String get aboutAllergy => throw _privateConstructorUsedError; + @JsonKey(name: 'about_taking_pils') + String get aboutTakingPils => throw _privateConstructorUsedError; + @JsonKey(name: 'about_sport_hobbies') + String get aboutSportHobbies => throw _privateConstructorUsedError; + @JsonKey(name: 'favorite_foods') + String get favoriteFoods => throw _privateConstructorUsedError; + @JsonKey(name: 'unfavorite_foods') + String get unfavoriteFoods => throw _privateConstructorUsedError; + @JsonKey(name: 'additional_info') + String get additionalInfo => throw _privateConstructorUsedError; + @JsonKey(name: 'activity_coefficient') + String get activityCoefficient => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $UserRegistrationSheetCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $UserRegistrationSheetCopyWith<$Res> { + factory $UserRegistrationSheetCopyWith(UserRegistrationSheet value, + $Res Function(UserRegistrationSheet) then) = + _$UserRegistrationSheetCopyWithImpl<$Res, UserRegistrationSheet>; + @useResult + $Res call( + {String name, + @JsonKey(name: 'first_name') String firstName, + @JsonKey(name: 'last') String lastName, + String email, + String password, + @JsonKey(name: 'password_confirmation') String passwordConfirmation, + @JsonKey(name: 'terms') String termsAccepted, + String birthdate, + String gender, + String country, + String city, + String lang, + String weight, + String height, + @JsonKey(name: 'chest_circumference') String chestCircumference, + @JsonKey(name: 'waist_circumference') String waistCircumference, + @JsonKey(name: 'hip_circumference') String hipCircumference, + @JsonKey(name: 'blood_pressure_up') String bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') String bloodPressureDown, + @JsonKey(name: 'has_hypo') String hasHypo, + @JsonKey(name: 'has_hyper') String hasHyper, + @JsonKey(name: 'about_alergy') String aboutAllergy, + @JsonKey(name: 'about_taking_pils') String aboutTakingPils, + @JsonKey(name: 'about_sport_hobbies') String aboutSportHobbies, + @JsonKey(name: 'favorite_foods') String favoriteFoods, + @JsonKey(name: 'unfavorite_foods') String unfavoriteFoods, + @JsonKey(name: 'additional_info') String additionalInfo, + @JsonKey(name: 'activity_coefficient') String activityCoefficient}); +} + +/// @nodoc +class _$UserRegistrationSheetCopyWithImpl<$Res, + $Val extends UserRegistrationSheet> + implements $UserRegistrationSheetCopyWith<$Res> { + _$UserRegistrationSheetCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? firstName = null, + Object? lastName = null, + Object? email = null, + Object? password = null, + Object? passwordConfirmation = null, + Object? termsAccepted = null, + Object? birthdate = null, + Object? gender = null, + Object? country = null, + Object? city = null, + Object? lang = null, + Object? weight = null, + Object? height = null, + Object? chestCircumference = null, + Object? waistCircumference = null, + Object? hipCircumference = null, + Object? bloodPressureUp = null, + Object? bloodPressureDown = null, + Object? hasHypo = null, + Object? hasHyper = null, + Object? aboutAllergy = null, + Object? aboutTakingPils = null, + Object? aboutSportHobbies = null, + Object? favoriteFoods = null, + Object? unfavoriteFoods = null, + Object? additionalInfo = null, + Object? activityCoefficient = null, + }) { + return _then(_value.copyWith( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + firstName: null == firstName + ? _value.firstName + : firstName // ignore: cast_nullable_to_non_nullable + as String, + lastName: null == lastName + ? _value.lastName + : lastName // ignore: cast_nullable_to_non_nullable + as String, + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String, + password: null == password + ? _value.password + : password // ignore: cast_nullable_to_non_nullable + as String, + passwordConfirmation: null == passwordConfirmation + ? _value.passwordConfirmation + : passwordConfirmation // ignore: cast_nullable_to_non_nullable + as String, + termsAccepted: null == termsAccepted + ? _value.termsAccepted + : termsAccepted // ignore: cast_nullable_to_non_nullable + as String, + birthdate: null == birthdate + ? _value.birthdate + : birthdate // ignore: cast_nullable_to_non_nullable + as String, + gender: null == gender + ? _value.gender + : gender // ignore: cast_nullable_to_non_nullable + as String, + country: null == country + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String, + city: null == city + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as String, + lang: null == lang + ? _value.lang + : lang // ignore: cast_nullable_to_non_nullable + as String, + weight: null == weight + ? _value.weight + : weight // ignore: cast_nullable_to_non_nullable + as String, + height: null == height + ? _value.height + : height // ignore: cast_nullable_to_non_nullable + as String, + chestCircumference: null == chestCircumference + ? _value.chestCircumference + : chestCircumference // ignore: cast_nullable_to_non_nullable + as String, + waistCircumference: null == waistCircumference + ? _value.waistCircumference + : waistCircumference // ignore: cast_nullable_to_non_nullable + as String, + hipCircumference: null == hipCircumference + ? _value.hipCircumference + : hipCircumference // ignore: cast_nullable_to_non_nullable + as String, + bloodPressureUp: null == bloodPressureUp + ? _value.bloodPressureUp + : bloodPressureUp // ignore: cast_nullable_to_non_nullable + as String, + bloodPressureDown: null == bloodPressureDown + ? _value.bloodPressureDown + : bloodPressureDown // ignore: cast_nullable_to_non_nullable + as String, + hasHypo: null == hasHypo + ? _value.hasHypo + : hasHypo // ignore: cast_nullable_to_non_nullable + as String, + hasHyper: null == hasHyper + ? _value.hasHyper + : hasHyper // ignore: cast_nullable_to_non_nullable + as String, + aboutAllergy: null == aboutAllergy + ? _value.aboutAllergy + : aboutAllergy // ignore: cast_nullable_to_non_nullable + as String, + aboutTakingPils: null == aboutTakingPils + ? _value.aboutTakingPils + : aboutTakingPils // ignore: cast_nullable_to_non_nullable + as String, + aboutSportHobbies: null == aboutSportHobbies + ? _value.aboutSportHobbies + : aboutSportHobbies // ignore: cast_nullable_to_non_nullable + as String, + favoriteFoods: null == favoriteFoods + ? _value.favoriteFoods + : favoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + unfavoriteFoods: null == unfavoriteFoods + ? _value.unfavoriteFoods + : unfavoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + additionalInfo: null == additionalInfo + ? _value.additionalInfo + : additionalInfo // ignore: cast_nullable_to_non_nullable + as String, + activityCoefficient: null == activityCoefficient + ? _value.activityCoefficient + : activityCoefficient // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$UserRegistrationSheetImplCopyWith<$Res> + implements $UserRegistrationSheetCopyWith<$Res> { + factory _$$UserRegistrationSheetImplCopyWith( + _$UserRegistrationSheetImpl value, + $Res Function(_$UserRegistrationSheetImpl) then) = + __$$UserRegistrationSheetImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String name, + @JsonKey(name: 'first_name') String firstName, + @JsonKey(name: 'last') String lastName, + String email, + String password, + @JsonKey(name: 'password_confirmation') String passwordConfirmation, + @JsonKey(name: 'terms') String termsAccepted, + String birthdate, + String gender, + String country, + String city, + String lang, + String weight, + String height, + @JsonKey(name: 'chest_circumference') String chestCircumference, + @JsonKey(name: 'waist_circumference') String waistCircumference, + @JsonKey(name: 'hip_circumference') String hipCircumference, + @JsonKey(name: 'blood_pressure_up') String bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') String bloodPressureDown, + @JsonKey(name: 'has_hypo') String hasHypo, + @JsonKey(name: 'has_hyper') String hasHyper, + @JsonKey(name: 'about_alergy') String aboutAllergy, + @JsonKey(name: 'about_taking_pils') String aboutTakingPils, + @JsonKey(name: 'about_sport_hobbies') String aboutSportHobbies, + @JsonKey(name: 'favorite_foods') String favoriteFoods, + @JsonKey(name: 'unfavorite_foods') String unfavoriteFoods, + @JsonKey(name: 'additional_info') String additionalInfo, + @JsonKey(name: 'activity_coefficient') String activityCoefficient}); +} + +/// @nodoc +class __$$UserRegistrationSheetImplCopyWithImpl<$Res> + extends _$UserRegistrationSheetCopyWithImpl<$Res, + _$UserRegistrationSheetImpl> + implements _$$UserRegistrationSheetImplCopyWith<$Res> { + __$$UserRegistrationSheetImplCopyWithImpl(_$UserRegistrationSheetImpl _value, + $Res Function(_$UserRegistrationSheetImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? firstName = null, + Object? lastName = null, + Object? email = null, + Object? password = null, + Object? passwordConfirmation = null, + Object? termsAccepted = null, + Object? birthdate = null, + Object? gender = null, + Object? country = null, + Object? city = null, + Object? lang = null, + Object? weight = null, + Object? height = null, + Object? chestCircumference = null, + Object? waistCircumference = null, + Object? hipCircumference = null, + Object? bloodPressureUp = null, + Object? bloodPressureDown = null, + Object? hasHypo = null, + Object? hasHyper = null, + Object? aboutAllergy = null, + Object? aboutTakingPils = null, + Object? aboutSportHobbies = null, + Object? favoriteFoods = null, + Object? unfavoriteFoods = null, + Object? additionalInfo = null, + Object? activityCoefficient = null, + }) { + return _then(_$UserRegistrationSheetImpl( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + firstName: null == firstName + ? _value.firstName + : firstName // ignore: cast_nullable_to_non_nullable + as String, + lastName: null == lastName + ? _value.lastName + : lastName // ignore: cast_nullable_to_non_nullable + as String, + email: null == email + ? _value.email + : email // ignore: cast_nullable_to_non_nullable + as String, + password: null == password + ? _value.password + : password // ignore: cast_nullable_to_non_nullable + as String, + passwordConfirmation: null == passwordConfirmation + ? _value.passwordConfirmation + : passwordConfirmation // ignore: cast_nullable_to_non_nullable + as String, + termsAccepted: null == termsAccepted + ? _value.termsAccepted + : termsAccepted // ignore: cast_nullable_to_non_nullable + as String, + birthdate: null == birthdate + ? _value.birthdate + : birthdate // ignore: cast_nullable_to_non_nullable + as String, + gender: null == gender + ? _value.gender + : gender // ignore: cast_nullable_to_non_nullable + as String, + country: null == country + ? _value.country + : country // ignore: cast_nullable_to_non_nullable + as String, + city: null == city + ? _value.city + : city // ignore: cast_nullable_to_non_nullable + as String, + lang: null == lang + ? _value.lang + : lang // ignore: cast_nullable_to_non_nullable + as String, + weight: null == weight + ? _value.weight + : weight // ignore: cast_nullable_to_non_nullable + as String, + height: null == height + ? _value.height + : height // ignore: cast_nullable_to_non_nullable + as String, + chestCircumference: null == chestCircumference + ? _value.chestCircumference + : chestCircumference // ignore: cast_nullable_to_non_nullable + as String, + waistCircumference: null == waistCircumference + ? _value.waistCircumference + : waistCircumference // ignore: cast_nullable_to_non_nullable + as String, + hipCircumference: null == hipCircumference + ? _value.hipCircumference + : hipCircumference // ignore: cast_nullable_to_non_nullable + as String, + bloodPressureUp: null == bloodPressureUp + ? _value.bloodPressureUp + : bloodPressureUp // ignore: cast_nullable_to_non_nullable + as String, + bloodPressureDown: null == bloodPressureDown + ? _value.bloodPressureDown + : bloodPressureDown // ignore: cast_nullable_to_non_nullable + as String, + hasHypo: null == hasHypo + ? _value.hasHypo + : hasHypo // ignore: cast_nullable_to_non_nullable + as String, + hasHyper: null == hasHyper + ? _value.hasHyper + : hasHyper // ignore: cast_nullable_to_non_nullable + as String, + aboutAllergy: null == aboutAllergy + ? _value.aboutAllergy + : aboutAllergy // ignore: cast_nullable_to_non_nullable + as String, + aboutTakingPils: null == aboutTakingPils + ? _value.aboutTakingPils + : aboutTakingPils // ignore: cast_nullable_to_non_nullable + as String, + aboutSportHobbies: null == aboutSportHobbies + ? _value.aboutSportHobbies + : aboutSportHobbies // ignore: cast_nullable_to_non_nullable + as String, + favoriteFoods: null == favoriteFoods + ? _value.favoriteFoods + : favoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + unfavoriteFoods: null == unfavoriteFoods + ? _value.unfavoriteFoods + : unfavoriteFoods // ignore: cast_nullable_to_non_nullable + as String, + additionalInfo: null == additionalInfo + ? _value.additionalInfo + : additionalInfo // ignore: cast_nullable_to_non_nullable + as String, + activityCoefficient: null == activityCoefficient + ? _value.activityCoefficient + : activityCoefficient // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { + const _$UserRegistrationSheetImpl( + {required this.name, + @JsonKey(name: 'first_name') required this.firstName, + @JsonKey(name: 'last') required this.lastName, + required this.email, + required this.password, + @JsonKey(name: 'password_confirmation') + required this.passwordConfirmation, + @JsonKey(name: 'terms') this.termsAccepted = 'accepted', + required this.birthdate, + required this.gender, + required this.country, + required this.city, + required this.lang, + required this.weight, + required this.height, + @JsonKey(name: 'chest_circumference') required this.chestCircumference, + @JsonKey(name: 'waist_circumference') required this.waistCircumference, + @JsonKey(name: 'hip_circumference') required this.hipCircumference, + @JsonKey(name: 'blood_pressure_up') required this.bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') required this.bloodPressureDown, + @JsonKey(name: 'has_hypo') required this.hasHypo, + @JsonKey(name: 'has_hyper') required this.hasHyper, + @JsonKey(name: 'about_alergy') required this.aboutAllergy, + @JsonKey(name: 'about_taking_pils') required this.aboutTakingPils, + @JsonKey(name: 'about_sport_hobbies') required this.aboutSportHobbies, + @JsonKey(name: 'favorite_foods') required this.favoriteFoods, + @JsonKey(name: 'unfavorite_foods') required this.unfavoriteFoods, + @JsonKey(name: 'additional_info') required this.additionalInfo, + @JsonKey(name: 'activity_coefficient') this.activityCoefficient = '1.2'}); + + factory _$UserRegistrationSheetImpl.fromJson(Map json) => + _$$UserRegistrationSheetImplFromJson(json); + + @override + final String name; + @override + @JsonKey(name: 'first_name') + final String firstName; + @override + @JsonKey(name: 'last') + final String lastName; + @override + final String email; + @override + final String password; + @override + @JsonKey(name: 'password_confirmation') + final String passwordConfirmation; + @override + @JsonKey(name: 'terms') + final String termsAccepted; + @override + final String birthdate; + @override + final String gender; + @override + final String country; + @override + final String city; + @override + final String lang; + @override + final String weight; + @override + final String height; + @override + @JsonKey(name: 'chest_circumference') + final String chestCircumference; + @override + @JsonKey(name: 'waist_circumference') + final String waistCircumference; + @override + @JsonKey(name: 'hip_circumference') + final String hipCircumference; + @override + @JsonKey(name: 'blood_pressure_up') + final String bloodPressureUp; + @override + @JsonKey(name: 'blood_pressure_down') + final String bloodPressureDown; + @override + @JsonKey(name: 'has_hypo') + final String hasHypo; + @override + @JsonKey(name: 'has_hyper') + final String hasHyper; + @override + @JsonKey(name: 'about_alergy') + final String aboutAllergy; + @override + @JsonKey(name: 'about_taking_pils') + final String aboutTakingPils; + @override + @JsonKey(name: 'about_sport_hobbies') + final String aboutSportHobbies; + @override + @JsonKey(name: 'favorite_foods') + final String favoriteFoods; + @override + @JsonKey(name: 'unfavorite_foods') + final String unfavoriteFoods; + @override + @JsonKey(name: 'additional_info') + final String additionalInfo; + @override + @JsonKey(name: 'activity_coefficient') + final String activityCoefficient; + + @override + String toString() { + return 'UserRegistrationSheet(name: $name, firstName: $firstName, lastName: $lastName, email: $email, password: $password, passwordConfirmation: $passwordConfirmation, termsAccepted: $termsAccepted, birthdate: $birthdate, gender: $gender, country: $country, city: $city, lang: $lang, weight: $weight, height: $height, chestCircumference: $chestCircumference, waistCircumference: $waistCircumference, hipCircumference: $hipCircumference, bloodPressureUp: $bloodPressureUp, bloodPressureDown: $bloodPressureDown, hasHypo: $hasHypo, hasHyper: $hasHyper, aboutAllergy: $aboutAllergy, aboutTakingPils: $aboutTakingPils, aboutSportHobbies: $aboutSportHobbies, favoriteFoods: $favoriteFoods, unfavoriteFoods: $unfavoriteFoods, additionalInfo: $additionalInfo, activityCoefficient: $activityCoefficient)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$UserRegistrationSheetImpl && + (identical(other.name, name) || other.name == name) && + (identical(other.firstName, firstName) || + other.firstName == firstName) && + (identical(other.lastName, lastName) || + other.lastName == lastName) && + (identical(other.email, email) || other.email == email) && + (identical(other.password, password) || + other.password == password) && + (identical(other.passwordConfirmation, passwordConfirmation) || + other.passwordConfirmation == passwordConfirmation) && + (identical(other.termsAccepted, termsAccepted) || + other.termsAccepted == termsAccepted) && + (identical(other.birthdate, birthdate) || + other.birthdate == birthdate) && + (identical(other.gender, gender) || other.gender == gender) && + (identical(other.country, country) || other.country == country) && + (identical(other.city, city) || other.city == city) && + (identical(other.lang, lang) || other.lang == lang) && + (identical(other.weight, weight) || other.weight == weight) && + (identical(other.height, height) || other.height == height) && + (identical(other.chestCircumference, chestCircumference) || + other.chestCircumference == chestCircumference) && + (identical(other.waistCircumference, waistCircumference) || + other.waistCircumference == waistCircumference) && + (identical(other.hipCircumference, hipCircumference) || + other.hipCircumference == hipCircumference) && + (identical(other.bloodPressureUp, bloodPressureUp) || + other.bloodPressureUp == bloodPressureUp) && + (identical(other.bloodPressureDown, bloodPressureDown) || + other.bloodPressureDown == bloodPressureDown) && + (identical(other.hasHypo, hasHypo) || other.hasHypo == hasHypo) && + (identical(other.hasHyper, hasHyper) || + other.hasHyper == hasHyper) && + (identical(other.aboutAllergy, aboutAllergy) || + other.aboutAllergy == aboutAllergy) && + (identical(other.aboutTakingPils, aboutTakingPils) || + other.aboutTakingPils == aboutTakingPils) && + (identical(other.aboutSportHobbies, aboutSportHobbies) || + other.aboutSportHobbies == aboutSportHobbies) && + (identical(other.favoriteFoods, favoriteFoods) || + other.favoriteFoods == favoriteFoods) && + (identical(other.unfavoriteFoods, unfavoriteFoods) || + other.unfavoriteFoods == unfavoriteFoods) && + (identical(other.additionalInfo, additionalInfo) || + other.additionalInfo == additionalInfo) && + (identical(other.activityCoefficient, activityCoefficient) || + other.activityCoefficient == activityCoefficient)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hashAll([ + runtimeType, + name, + firstName, + lastName, + email, + password, + passwordConfirmation, + termsAccepted, + birthdate, + gender, + country, + city, + lang, + weight, + height, + chestCircumference, + waistCircumference, + hipCircumference, + bloodPressureUp, + bloodPressureDown, + hasHypo, + hasHyper, + aboutAllergy, + aboutTakingPils, + aboutSportHobbies, + favoriteFoods, + unfavoriteFoods, + additionalInfo, + activityCoefficient + ]); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> + get copyWith => __$$UserRegistrationSheetImplCopyWithImpl< + _$UserRegistrationSheetImpl>(this, _$identity); + + @override + Map toJson() { + return _$$UserRegistrationSheetImplToJson( + this, + ); + } +} + +abstract class _UserRegistrationSheet implements UserRegistrationSheet { + const factory _UserRegistrationSheet( + {required final String name, + @JsonKey(name: 'first_name') required final String firstName, + @JsonKey(name: 'last') required final String lastName, + required final String email, + required final String password, + @JsonKey(name: 'password_confirmation') + required final String passwordConfirmation, + @JsonKey(name: 'terms') final String termsAccepted, + required final String birthdate, + required final String gender, + required final String country, + required final String city, + required final String lang, + required final String weight, + required final String height, + @JsonKey(name: 'chest_circumference') + required final String chestCircumference, + @JsonKey(name: 'waist_circumference') + required final String waistCircumference, + @JsonKey(name: 'hip_circumference') + required final String hipCircumference, + @JsonKey(name: 'blood_pressure_up') required final String bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') + required final String bloodPressureDown, + @JsonKey(name: 'has_hypo') required final String hasHypo, + @JsonKey(name: 'has_hyper') required final String hasHyper, + @JsonKey(name: 'about_alergy') required final String aboutAllergy, + @JsonKey(name: 'about_taking_pils') required final String aboutTakingPils, + @JsonKey(name: 'about_sport_hobbies') + required final String aboutSportHobbies, + @JsonKey(name: 'favorite_foods') required final String favoriteFoods, + @JsonKey(name: 'unfavorite_foods') required final String unfavoriteFoods, + @JsonKey(name: 'additional_info') required final String additionalInfo, + @JsonKey(name: 'activity_coefficient') + final String activityCoefficient}) = _$UserRegistrationSheetImpl; + + factory _UserRegistrationSheet.fromJson(Map json) = + _$UserRegistrationSheetImpl.fromJson; + + @override + String get name; + @override + @JsonKey(name: 'first_name') + String get firstName; + @override + @JsonKey(name: 'last') + String get lastName; + @override + String get email; + @override + String get password; + @override + @JsonKey(name: 'password_confirmation') + String get passwordConfirmation; + @override + @JsonKey(name: 'terms') + String get termsAccepted; + @override + String get birthdate; + @override + String get gender; + @override + String get country; + @override + String get city; + @override + String get lang; + @override + String get weight; + @override + String get height; + @override + @JsonKey(name: 'chest_circumference') + String get chestCircumference; + @override + @JsonKey(name: 'waist_circumference') + String get waistCircumference; + @override + @JsonKey(name: 'hip_circumference') + String get hipCircumference; + @override + @JsonKey(name: 'blood_pressure_up') + String get bloodPressureUp; + @override + @JsonKey(name: 'blood_pressure_down') + String get bloodPressureDown; + @override + @JsonKey(name: 'has_hypo') + String get hasHypo; + @override + @JsonKey(name: 'has_hyper') + String get hasHyper; + @override + @JsonKey(name: 'about_alergy') + String get aboutAllergy; + @override + @JsonKey(name: 'about_taking_pils') + String get aboutTakingPils; + @override + @JsonKey(name: 'about_sport_hobbies') + String get aboutSportHobbies; + @override + @JsonKey(name: 'favorite_foods') + String get favoriteFoods; + @override + @JsonKey(name: 'unfavorite_foods') + String get unfavoriteFoods; + @override + @JsonKey(name: 'additional_info') + String get additionalInfo; + @override + @JsonKey(name: 'activity_coefficient') + String get activityCoefficient; + @override + @JsonKey(ignore: true) + _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/data/models/userRegistrationModel/user_registration_model.g.dart b/lib/data/models/userRegistrationModel/user_registration_model.g.dart new file mode 100644 index 00000000..8eafe710 --- /dev/null +++ b/lib/data/models/userRegistrationModel/user_registration_model.g.dart @@ -0,0 +1,73 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_registration_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$UserRegistrationSheetImpl _$$UserRegistrationSheetImplFromJson( + Map json) => + _$UserRegistrationSheetImpl( + name: json['name'] as String, + firstName: json['first_name'] as String, + lastName: json['last'] as String, + email: json['email'] as String, + password: json['password'] as String, + passwordConfirmation: json['password_confirmation'] as String, + termsAccepted: json['terms'] as String? ?? 'accepted', + birthdate: json['birthdate'] as String, + gender: json['gender'] as String, + country: json['country'] as String, + city: json['city'] as String, + lang: json['lang'] as String, + weight: json['weight'] as String, + height: json['height'] as String, + chestCircumference: json['chest_circumference'] as String, + waistCircumference: json['waist_circumference'] as String, + hipCircumference: json['hip_circumference'] as String, + bloodPressureUp: json['blood_pressure_up'] as String, + bloodPressureDown: json['blood_pressure_down'] as String, + hasHypo: json['has_hypo'] as String, + hasHyper: json['has_hyper'] as String, + aboutAllergy: json['about_alergy'] as String, + aboutTakingPils: json['about_taking_pils'] as String, + aboutSportHobbies: json['about_sport_hobbies'] as String, + favoriteFoods: json['favorite_foods'] as String, + unfavoriteFoods: json['unfavorite_foods'] as String, + additionalInfo: json['additional_info'] as String, + activityCoefficient: json['activity_coefficient'] as String? ?? '1.2', + ); + +Map _$$UserRegistrationSheetImplToJson( + _$UserRegistrationSheetImpl instance) => + { + 'name': instance.name, + 'first_name': instance.firstName, + 'last': instance.lastName, + 'email': instance.email, + 'password': instance.password, + 'password_confirmation': instance.passwordConfirmation, + 'terms': instance.termsAccepted, + 'birthdate': instance.birthdate, + 'gender': instance.gender, + 'country': instance.country, + 'city': instance.city, + 'lang': instance.lang, + 'weight': instance.weight, + 'height': instance.height, + 'chest_circumference': instance.chestCircumference, + 'waist_circumference': instance.waistCircumference, + 'hip_circumference': instance.hipCircumference, + 'blood_pressure_up': instance.bloodPressureUp, + 'blood_pressure_down': instance.bloodPressureDown, + 'has_hypo': instance.hasHypo, + 'has_hyper': instance.hasHyper, + 'about_alergy': instance.aboutAllergy, + 'about_taking_pils': instance.aboutTakingPils, + 'about_sport_hobbies': instance.aboutSportHobbies, + 'favorite_foods': instance.favoriteFoods, + 'unfavorite_foods': instance.unfavoriteFoods, + 'additional_info': instance.additionalInfo, + 'activity_coefficient': instance.activityCoefficient, + }; diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart index bf421e7f..5e59454f 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart @@ -4,7 +4,7 @@ import 'package:eatvio_app/features/registration/presentation/bloc/registration_ import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart'; class RegistrationCubit extends Cubit { - RegistrationCubit() : super(RegistrationState.loaded(sheet: LanguageSelectModel().userRegistrationSheet)); + RegistrationCubit() : super(RegistrationState(sheet: LanguageSelectModel().userRegistrationSheet)); - updateSheet(UserRegistrationSheet sheet) => emit(RegistrationState.loaded(sheet: sheet)); + updateSheet(UserRegistrationSheet sheet) => emit(RegistrationState(sheet: sheet)); } diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart index b6ea767b..d1e20906 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.dart @@ -4,10 +4,8 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'registration_state.freezed.dart'; @freezed -abstract class RegistrationState with _$RegistrationState { - const factory RegistrationState() = _RegistrationState; - - const factory RegistrationState.loaded({ +class RegistrationState with _$RegistrationState { + const factory RegistrationState({ required UserRegistrationSheet sheet, - }) = RegistrationStateLoaded; + }) = _RegistrationState; } diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart index 01b23826..dcb49236 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart @@ -16,43 +16,10 @@ final _privateConstructorUsedError = UnsupportedError( /// @nodoc mixin _$RegistrationState { - @optionalTypeArgs - TResult when( - TResult Function() $default, { - required TResult Function(UserRegistrationSheet sheet) loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function()? $default, { - TResult? Function(UserRegistrationSheet sheet)? loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function()? $default, { - TResult Function(UserRegistrationSheet sheet)? loaded, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(_RegistrationState value) $default, { - required TResult Function(RegistrationStateLoaded value) loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_RegistrationState value)? $default, { - TResult? Function(RegistrationStateLoaded value)? loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(_RegistrationState value)? $default, { - TResult Function(RegistrationStateLoaded value)? loaded, - required TResult orElse(), - }) => + UserRegistrationSheet get sheet => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $RegistrationStateCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -61,6 +28,10 @@ abstract class $RegistrationStateCopyWith<$Res> { factory $RegistrationStateCopyWith( RegistrationState value, $Res Function(RegistrationState) then) = _$RegistrationStateCopyWithImpl<$Res, RegistrationState>; + @useResult + $Res call({UserRegistrationSheet sheet}); + + $UserRegistrationSheetCopyWith<$Res> get sheet; } /// @nodoc @@ -72,13 +43,41 @@ class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> final $Val _value; // ignore: unused_field final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? sheet = null, + }) { + return _then(_value.copyWith( + sheet: null == sheet + ? _value.sheet + : sheet // ignore: cast_nullable_to_non_nullable + as UserRegistrationSheet, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $UserRegistrationSheetCopyWith<$Res> get sheet { + return $UserRegistrationSheetCopyWith<$Res>(_value.sheet, (value) { + return _then(_value.copyWith(sheet: value) as $Val); + }); + } } /// @nodoc -abstract class _$$RegistrationStateImplCopyWith<$Res> { +abstract class _$$RegistrationStateImplCopyWith<$Res> + implements $RegistrationStateCopyWith<$Res> { factory _$$RegistrationStateImplCopyWith(_$RegistrationStateImpl value, $Res Function(_$RegistrationStateImpl) then) = __$$RegistrationStateImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({UserRegistrationSheet sheet}); + + @override + $UserRegistrationSheetCopyWith<$Res> get sheet; } /// @nodoc @@ -88,119 +87,13 @@ class __$$RegistrationStateImplCopyWithImpl<$Res> __$$RegistrationStateImplCopyWithImpl(_$RegistrationStateImpl _value, $Res Function(_$RegistrationStateImpl) _then) : super(_value, _then); -} - -/// @nodoc - -class _$RegistrationStateImpl implements _RegistrationState { - const _$RegistrationStateImpl(); - - @override - String toString() { - return 'RegistrationState()'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$RegistrationStateImpl); - } - - @override - int get hashCode => runtimeType.hashCode; - - @override - @optionalTypeArgs - TResult when( - TResult Function() $default, { - required TResult Function(UserRegistrationSheet sheet) loaded, - }) { - return $default(); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function()? $default, { - TResult? Function(UserRegistrationSheet sheet)? loaded, - }) { - return $default?.call(); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function()? $default, { - TResult Function(UserRegistrationSheet sheet)? loaded, - required TResult orElse(), - }) { - if ($default != null) { - return $default(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_RegistrationState value) $default, { - required TResult Function(RegistrationStateLoaded value) loaded, - }) { - return $default(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_RegistrationState value)? $default, { - TResult? Function(RegistrationStateLoaded value)? loaded, - }) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_RegistrationState value)? $default, { - TResult Function(RegistrationStateLoaded value)? loaded, - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); - } -} - -abstract class _RegistrationState implements RegistrationState { - const factory _RegistrationState() = _$RegistrationStateImpl; -} - -/// @nodoc -abstract class _$$RegistrationStateLoadedImplCopyWith<$Res> { - factory _$$RegistrationStateLoadedImplCopyWith( - _$RegistrationStateLoadedImpl value, - $Res Function(_$RegistrationStateLoadedImpl) then) = - __$$RegistrationStateLoadedImplCopyWithImpl<$Res>; - @useResult - $Res call({UserRegistrationSheet sheet}); -} - -/// @nodoc -class __$$RegistrationStateLoadedImplCopyWithImpl<$Res> - extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateLoadedImpl> - implements _$$RegistrationStateLoadedImplCopyWith<$Res> { - __$$RegistrationStateLoadedImplCopyWithImpl( - _$RegistrationStateLoadedImpl _value, - $Res Function(_$RegistrationStateLoadedImpl) _then) - : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ Object? sheet = null, }) { - return _then(_$RegistrationStateLoadedImpl( + return _then(_$RegistrationStateImpl( sheet: null == sheet ? _value.sheet : sheet // ignore: cast_nullable_to_non_nullable @@ -211,22 +104,22 @@ class __$$RegistrationStateLoadedImplCopyWithImpl<$Res> /// @nodoc -class _$RegistrationStateLoadedImpl implements RegistrationStateLoaded { - const _$RegistrationStateLoadedImpl({required this.sheet}); +class _$RegistrationStateImpl implements _RegistrationState { + const _$RegistrationStateImpl({required this.sheet}); @override final UserRegistrationSheet sheet; @override String toString() { - return 'RegistrationState.loaded(sheet: $sheet)'; + return 'RegistrationState(sheet: $sheet)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$RegistrationStateLoadedImpl && + other is _$RegistrationStateImpl && (identical(other.sheet, sheet) || other.sheet == sheet)); } @@ -236,80 +129,19 @@ class _$RegistrationStateLoadedImpl implements RegistrationStateLoaded { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$RegistrationStateLoadedImplCopyWith<_$RegistrationStateLoadedImpl> - get copyWith => __$$RegistrationStateLoadedImplCopyWithImpl< - _$RegistrationStateLoadedImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function() $default, { - required TResult Function(UserRegistrationSheet sheet) loaded, - }) { - return loaded(sheet); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function()? $default, { - TResult? Function(UserRegistrationSheet sheet)? loaded, - }) { - return loaded?.call(sheet); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function()? $default, { - TResult Function(UserRegistrationSheet sheet)? loaded, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(sheet); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(_RegistrationState value) $default, { - required TResult Function(RegistrationStateLoaded value) loaded, - }) { - return loaded(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_RegistrationState value)? $default, { - TResult? Function(RegistrationStateLoaded value)? loaded, - }) { - return loaded?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(_RegistrationState value)? $default, { - TResult Function(RegistrationStateLoaded value)? loaded, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(this); - } - return orElse(); - } + _$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => + __$$RegistrationStateImplCopyWithImpl<_$RegistrationStateImpl>( + this, _$identity); } -abstract class RegistrationStateLoaded implements RegistrationState { - const factory RegistrationStateLoaded( - {required final UserRegistrationSheet sheet}) = - _$RegistrationStateLoadedImpl; +abstract class _RegistrationState implements RegistrationState { + const factory _RegistrationState( + {required final UserRegistrationSheet sheet}) = _$RegistrationStateImpl; + @override UserRegistrationSheet get sheet; + @override @JsonKey(ignore: true) - _$$RegistrationStateLoadedImplCopyWith<_$RegistrationStateLoadedImpl> - get copyWith => throw _privateConstructorUsedError; + _$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index d181e3c6..3ee6d0ca 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -20,6 +20,7 @@ import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; +import 'package:validators/validators.dart'; class RegistrationScreen extends StatefulWidget { const RegistrationScreen({super.key}); @@ -64,7 +65,6 @@ class _RegistrationScreenState extends State { create: (BuildContext context) => RegistrationCubit(), child: BlocBuilder( builder: (BuildContext context, RegistrationState state) { - (state as RegistrationStateLoaded); return PopScope( canPop: false, onPopInvoked: (_) => _showPopDialog(), @@ -112,12 +112,14 @@ class _RegistrationScreenState extends State { ), backgroundColor: appTheme.blueA400, onPressed: () { - setState(() { - pageController.nextPage( - duration: const Duration(milliseconds: 350), - curve: Curves.easeInOut, - ); - }); + if (canGoNext(state)) { + setState(() { + pageController.nextPage( + duration: const Duration(milliseconds: 350), + curve: Curves.easeInOut, + ); + }); + } }, label: Text( 'Продолжить', @@ -169,21 +171,21 @@ class _RegistrationScreenState extends State { }); }, children: [ - LanguageSelectScreen.builder(context), - CredentialsScreen.builder(context, state.sheet), - NameScreen.builder(context, state.sheet), - GenderScreen.builder(context, state.sheet), - DateOfBirthScreen.builder(context, state.sheet), - CityOfLivingScreen.builder(context, state.sheet), - BodyCircumferencesScreen.builder(context, state.sheet), - WeightScreen.builder(context, state.sheet), - HeightScreen.builder(context, state.sheet), - BloodPressureScreen.builder(context, state.sheet), - AllergiesScreen.builder(context, state.sheet), - MedicineIntakeScreen.builder(context, state.sheet), - FavoriteSportsScreen.builder(context, state.sheet), - FavoriteFoodsScreen.builder(context, state.sheet), - AdditionalInformationScreen.builder(context, state.sheet), + LanguageSelectScreen(sheet: context.read().state.sheet), + CredentialsScreen(sheet: context.read().state.sheet), + NameScreen(), + GenderScreen(), + DateOfBirthScreen(), + CityOfLivingScreen(), + BodyCircumferencesScreen(), + WeightScreen(), + HeightScreen(), + BloodPressureScreen(), + AllergiesScreen(), + MedicineIntakeScreen(), + FavoriteSportsScreen(), + FavoriteFoodsScreen(), + AdditionalInformationScreen(), ], ), ), @@ -192,4 +194,71 @@ class _RegistrationScreenState extends State { ), ); } + + bool canGoNext(state) { + switch (step) { + case 2: + List errors = validateFields(state.sheet.email, state.sheet.name, state.sheet.password, state.sheet.passwordConfirmation); + if (errors.isEmpty) { + return true; + } else { + String errorMessage = ''; + + for (var error in errors) { + errorMessage += error + '\n\n'; + } + + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text('Ошибка'), + content: Text(errorMessage), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text('OK'), + ), + ], + ), + ); + return false; + } + default: + return true; + } + } + + List validateFields(String email, String name, String password, String passwordConfirmation) { + List errors = []; + + if (!isEmail(email)) { + errors.add('email_invalid'.tr); + } + + if (email.isEmpty) { + errors.add('email_empty'.tr); + } + + if (name.length < 6) { + errors.add('name_short'.tr); + } + + if (name.isEmpty) { + errors.add('name_empty'.tr); + } + + if (password.isEmpty) { + errors.add('name_empty'.tr); + } + + if (password.length < 6) { + errors.add('password_short'.tr); + } + + if (password != passwordConfirmation) { + errors.add('password_confirmation_mismatch'.tr); + } + + return errors; + } } diff --git a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart index b39743ec..c12af1f8 100644 --- a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart @@ -52,7 +52,7 @@ class AdditionalInformationScreen extends StatelessWidget { onTapFinish(AdditionalInformationState state, BuildContext context) { return () async { UserRegistrationSheet sheet = state.additionalInformationModelObj!.userRegistrationSheet; - sheet.additionalInfo = state.editTextController!.text; + // sheet.additionalInfo = state.editTextController!.text; final response = await http.post( Uri.parse(dotenv.env['SERVER_ROOT']! + '/register'), diff --git a/lib/presentation/registration/allergies_screen/allergies_screen.dart b/lib/presentation/registration/allergies_screen/allergies_screen.dart index 51c5e6a2..7a2ac1c6 100644 --- a/lib/presentation/registration/allergies_screen/allergies_screen.dart +++ b/lib/presentation/registration/allergies_screen/allergies_screen.dart @@ -68,7 +68,7 @@ class _AllergiesScreenState extends State { onTapContinue(AllergiesState state, BuildContext context) { return () { UserRegistrationSheet sheet = state.allergiesModelObj!.userRegistrationSheet; - sheet.aboutAllergy = state.enterInformationController!.text; + // sheet.aboutAllergy = state.enterInformationController!.text; GoRouter.of(context).goNamed('medicineIntakeScreen', extra: sheet); }; } diff --git a/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart b/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart index 47416549..2fda1b59 100644 --- a/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart +++ b/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart @@ -18,9 +18,9 @@ class BloodPressureBloc extends Bloc { Emitter emit, ) { if (event.value.id == 1) { - state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '1'; + // state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '1'; } else { - state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '0'; + // state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '0'; } emit(state.copyWith(selectedHyperValue: event.value)); } @@ -30,9 +30,9 @@ class BloodPressureBloc extends Bloc { Emitter emit, ) { if (event.value.id == 1) { - state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '1'; + // state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '1'; } else { - state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '0'; + // state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '0'; } emit(state.copyWith(selectedHypoValue: event.value)); } diff --git a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart index 1ad36365..d8efedd1 100644 --- a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart @@ -159,8 +159,8 @@ class _BloodPressureScreenState extends State { List errors = validateFields(state.upPressureController!.text, state.downPressureController!.text); if (errors.isEmpty) { UserRegistrationSheet sheet = state.bloodPressureModelObj!.userRegistrationSheet; - sheet.bloodPressureUp = state.upPressureController!.text; - sheet.bloodPressureDown = state.downPressureController!.text; + // sheet.bloodPressureUp = state.upPressureController!.text; + // sheet.bloodPressureDown = state.downPressureController!.text; AppRouter.navigatorKey.currentContext?.goNamed('allergiesScreen', extra: sheet); } else { String errorMessage = ''; diff --git a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart b/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart index d9f08614..60733e36 100644 --- a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart @@ -36,7 +36,7 @@ class _BodyCircumferencesScreenState extends State { child: Column( children: [ Text("initial_measurements".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 93.v), + SizedBox(height: 16.v), Column( children: [ Text("chest_circumference".tr, style: theme.textTheme.bodyLarge), @@ -94,9 +94,9 @@ class _BodyCircumferencesScreenState extends State { validateFields(state.chestCircumferenceController!.text, state.waistCircumferenceController!.text, state.hipCircumferenceController!.text); if (errors.isEmpty) { UserRegistrationSheet sheet = state.bodyCircumferencesModelObj!.userRegistrationSheet; - sheet.chestCircumference = state.chestCircumferenceController!.text; - sheet.waistCircumference = state.waistCircumferenceController!.text; - sheet.hipCircumference = state.hipCircumferenceController!.text; + // sheet.chestCircumference = state.chestCircumferenceController!.text; + // sheet.waistCircumference = state.waistCircumferenceController!.text; + // sheet.hipCircumference = state.hipCircumferenceController!.text; GoRouter.of(context).goNamed('weightScreen', extra: sheet); } else { String errorMessage = ''; diff --git a/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_bloc.dart b/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_bloc.dart index 71864dbf..e642961e 100644 --- a/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_bloc.dart +++ b/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_bloc.dart @@ -27,7 +27,7 @@ class CityOfLivingBloc extends Bloc { Emitter emit, ) { emit(state.copyWith(selectedDropDownValue: event.value)); - state.cityOfLivingModelObj?.userRegistrationSheet.country = + // state.cityOfLivingModelObj?.userRegistrationSheet.country = event.value.title; } diff --git a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart b/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart index 0d35f1f2..f5ee8a8f 100644 --- a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart +++ b/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart @@ -28,7 +28,6 @@ class CityOfLivingScreen extends StatelessWidget { padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column( children: [ - SizedBox(height: 39.v), Text("place_of_living".tr, style: theme.textTheme.headlineSmall), SizedBox(height: 39.v), Text("country".tr, style: theme.textTheme.bodyLarge), diff --git a/lib/presentation/registration/credentials_screen/credentials_screen.dart b/lib/presentation/registration/credentials_screen/credentials_screen.dart index d9e15d37..ec7809ce 100644 --- a/lib/presentation/registration/credentials_screen/credentials_screen.dart +++ b/lib/presentation/registration/credentials_screen/credentials_screen.dart @@ -1,23 +1,34 @@ -import 'package:go_router/go_router.dart'; - -import 'bloc/credentials_bloc.dart'; -import 'models/credentials_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:validators/validators.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; +import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class CredentialsScreen extends StatelessWidget { - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => CredentialsBloc( - CredentialsState( - credentialsModelObj: CredentialsModel(userRegistrationSheet: sheet), - ), - )..add(CredentialsInitialEvent()), - child: CredentialsScreen(), - ); +class CredentialsScreen extends StatefulWidget { + final UserRegistrationSheet sheet; + + const CredentialsScreen({super.key, required this.sheet}); + + @override + State createState() => _CredentialsScreenState(); +} + +class _CredentialsScreenState extends State { + final emailController = TextEditingController(); + + final nameController = TextEditingController(); + + final passwordController = TextEditingController(); + + final passwordConfirmationController = TextEditingController(); + + @override + void initState() { + super.initState(); + emailController.text = widget.sheet.email; + nameController.text = widget.sheet.name; + passwordController.text = widget.sheet.password; + passwordConfirmationController.text = widget.sheet.passwordConfirmation; } @override @@ -34,131 +45,51 @@ class CredentialsScreen extends StatelessWidget { SizedBox(height: 16.v), Text("email".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.emailController, - builder: (context, emailController) { - return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done); + CustomTextFormField( + controller: emailController, + textInputAction: TextInputAction.done, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(email: newValue)); }, ), SizedBox(height: 22.v), Text("username".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.nameController, - builder: (context, nameController) { - return CustomTextFormField(controller: nameController, textInputAction: TextInputAction.done); + CustomTextFormField( + controller: nameController, + textInputAction: TextInputAction.done, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(name: newValue)); }, ), SizedBox(height: 19.v), Text("password".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 5.v), - BlocSelector( - selector: (state) => state.passwordController, - builder: (context, passwordController) { - return CustomTextFormField( - obscureText: true, - controller: passwordController, - ); + CustomTextFormField( + obscureText: true, + controller: passwordController, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(password: newValue)); }, ), SizedBox(height: 21.v), Text("password_confirmation".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.passwordConfirmationController, - builder: (context, passwordConfirmationController) { - return CustomTextFormField(obscureText: true, controller: passwordConfirmationController, textInputAction: TextInputAction.done); + CustomTextFormField( + obscureText: true, + controller: passwordConfirmationController, + textInputAction: TextInputAction.done, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(passwordConfirmation: newValue)); }, ), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapContinue(state, context), - // ); - // }, - // ), ], ), ), ); } - - onTapContinue(CredentialsState state, BuildContext context) { - return () { - List errors = - validateFields(state.emailController!.text, state.nameController!.text, state.passwordController!.text, state.passwordConfirmationController!.text); - if (errors.isEmpty) { - UserRegistrationSheet sheet = state.credentialsModelObj!.userRegistrationSheet; - sheet.email = state.emailController!.text; - sheet.name = state.nameController!.text; - sheet.password = state.passwordController!.text; - sheet.passwordConfirmation = state.passwordConfirmationController!.text; - GoRouter.of(context).goNamed('nameScreen', extra: sheet); - } else { - String errorMessage = ''; - - for (var error in errors) { - errorMessage += error + '\n\n'; - } - - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text('Ошибка'), - content: Text(errorMessage), - actions: [ - TextButton( - onPressed: onTapOk(context), - child: Text('OK'), - ), - ], - ), - ); - } - }; - } - - onTapOk(BuildContext context) { - return () { - Navigator.pop(context); - }; - } - - - List validateFields(String email, String name, String password, String passwordConfirmation) { - List errors = []; - - if (!isEmail(email)) { - errors.add('email_invalid'.tr); - } - - if (email.isEmpty) { - errors.add('email_empty'.tr); - } - - if (name.length < 6) { - errors.add('name_short'.tr); - } - - if (name.isEmpty) { - errors.add('name_empty'.tr); - } - - if (password.isEmpty) { - errors.add('name_empty'.tr); - } - - if (password.length < 6) { - errors.add('password_short'.tr); - } - - if (password != passwordConfirmation) { - errors.add('password_confirmation_mismatch'.tr); - } - - return errors; - } } diff --git a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart index 432a5be4..0952a664 100644 --- a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart @@ -65,7 +65,7 @@ class _DateOfBirthScreenState extends State { onTapContinue(DateOfBirthState state, BuildContext context) { return () { UserRegistrationSheet sheet = state.dateOfBirthModelObj!.userRegistrationSheet; - sheet.birthdate = selectedDate.toString(); + // sheet.birthdate = selectedDate.toString(); GoRouter.of(context).goNamed('cityOfLivingScreen', extra: sheet); }; } diff --git a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart index a1015d7d..0db859db 100644 --- a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart @@ -81,8 +81,8 @@ class _FavoriteFoodsScreenState extends State { onTapContinue(FavoriteFoodsState state, BuildContext context) { return () { UserRegistrationSheet sheet = state.favoriteFoodsModelObj!.userRegistrationSheet; - sheet.favoriteFoods = state.favoriteFoodsController!.text; - sheet.unfavoriteFoods = state.unfavoriteFoodsController!.text; + // sheet.favoriteFoods = state.favoriteFoodsController!.text; + // sheet.unfavoriteFoods = state.unfavoriteFoodsController!.text; GoRouter.of(context).goNamed('additionalInformationScreen', extra: sheet); }; } diff --git a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart index 5a8f3f35..5d8be5da 100644 --- a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart @@ -70,7 +70,7 @@ class _FavoriteSportsScreenState extends State { onTapContinue(FavoriteSportsState state, BuildContext context) { return () { UserRegistrationSheet sheet = state.favoriteSportsModelObj!.userRegistrationSheet; - sheet.aboutSportHobbies = state.enterinformationController!.text; + // sheet.aboutSportHobbies = state.enterinformationController!.text; GoRouter.of(context).goNamed('favoriteFoodsScreen', extra: sheet); }; } diff --git a/lib/presentation/registration/gender_screen/bloc/gender_bloc.dart b/lib/presentation/registration/gender_screen/bloc/gender_bloc.dart index 5f614c27..fe305815 100644 --- a/lib/presentation/registration/gender_screen/bloc/gender_bloc.dart +++ b/lib/presentation/registration/gender_screen/bloc/gender_bloc.dart @@ -24,6 +24,6 @@ class GenderBloc extends Bloc { Emitter emit, ) { emit(state.copyWith(selectedRadioValue: event.value)); - state.genderModelObj?.userRegistrationSheet.gender = event.value; + // state.genderModelObj?.userRegistrationSheet.gender = event.value; } } diff --git a/lib/presentation/registration/gender_screen/gender_screen.dart b/lib/presentation/registration/gender_screen/gender_screen.dart index 72f8f5cb..5ffa6be2 100644 --- a/lib/presentation/registration/gender_screen/gender_screen.dart +++ b/lib/presentation/registration/gender_screen/gender_screen.dart @@ -80,7 +80,7 @@ class _GenderScreenState extends State { onTapNext(GenderState state, BuildContext context) { return () { UserRegistrationSheet sheet = state.genderModelObj!.userRegistrationSheet; - sheet.gender = state.selectedRadioValue!; + // sheet.gender = state.selectedRadioValue!; GoRouter.of(context).goNamed('dateOfBirthScreen', extra: sheet); }; } diff --git a/lib/presentation/registration/height_screen/height_screen.dart b/lib/presentation/registration/height_screen/height_screen.dart index 66e27620..1e0b88b7 100644 --- a/lib/presentation/registration/height_screen/height_screen.dart +++ b/lib/presentation/registration/height_screen/height_screen.dart @@ -31,7 +31,7 @@ class HeightScreen extends StatelessWidget { "height_measurements".tr, style: theme.textTheme.headlineSmall, ), - SizedBox(height: 174.v), + SizedBox(height: 16.v), Column( children: [ Text( diff --git a/lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart b/lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart index c77ba3ac..76047173 100644 --- a/lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart +++ b/lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart @@ -24,7 +24,7 @@ class LanguageSelectBloc extends Bloc _changeDropDown(ChangeDropDownEvent event, Emitter emit) { emit(state.copyWith(selectedDropDownValue: event.value)); - state.languageSelectModelObj?.userRegistrationSheet.lang = event.value.title; + // state.languageSelectModelObj?.userRegistrationSheet.lang = event.value.title; } List fillDropdownItemList() { diff --git a/lib/presentation/registration/language_select_screen/language_select_screen.dart b/lib/presentation/registration/language_select_screen/language_select_screen.dart index f2ac257e..1a0dc415 100644 --- a/lib/presentation/registration/language_select_screen/language_select_screen.dart +++ b/lib/presentation/registration/language_select_screen/language_select_screen.dart @@ -1,21 +1,29 @@ -import 'bloc/language_select_bloc.dart'; -import 'models/language_select_model.dart'; import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:flutter/material.dart'; -class LanguageSelectScreen extends StatelessWidget { - const LanguageSelectScreen({Key? key}) : super(key: key); +class LanguageSelectScreen extends StatefulWidget { + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context) { - return BlocProvider( - create: (context) => LanguageSelectBloc( - LanguageSelectState( - languageSelectModelObj: LanguageSelectModel(), - ), - )..add(LanguageSelectInitialEvent()), - child: LanguageSelectScreen(), - ); + const LanguageSelectScreen({required this.sheet, super.key}); + + @override + State createState() => _LanguageSelectScreenState(); +} + +class _LanguageSelectScreenState extends State { + final List dropdownItemList = [ + SelectionPopupModel(id: 1, title: "Русский", isSelected: true), + ]; + + late SelectionPopupModel value; + + @override + void initState() { + super.initState(); + value = SelectionPopupModel(title: widget.sheet.lang); } @override @@ -36,56 +44,28 @@ class LanguageSelectScreen extends StatelessWidget { ), ), const SizedBox(height: 32), - BlocSelector( - selector: (state) => state.languageSelectModelObj, - builder: ( - context, - languageSelectModelObj, - ) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.h), - ), - child: CustomImageView( - imagePath: ImageConstant.imgFavorite, - height: 12.adaptSize, - width: 12.adaptSize, - ), - ), - hintText: "Не выбрано".tr, - items: languageSelectModelObj?.dropdownItemList ?? [], - onChanged: (value) => _onDropDownChanged(context, value), - ); - }, + CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1.h), + ), + child: CustomImageView( + imagePath: ImageConstant.imgFavorite, + height: 12.adaptSize, + width: 12.adaptSize, + ), + ), + hintText: "Не выбрано".tr, + items: dropdownItemList, + onChanged: (SelectionPopupModel newValue) => setState(() { + value = newValue; + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(lang: value.title)); + }), ), - // bottomNavigationBar: BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: _saveAndPush(state, context), - // ); - // }, - // ), ], ), ); } - - // void Function()? _saveAndPush(LanguageSelectState state, BuildContext context) { - // return () { - // UserRegistrationSheet sheet = state.languageSelectModelObj!.userRegistrationSheet; - // GoRouter.of(context).goNamed( - // 'credentialsScreen', - // extra: sheet, - // ); - // }; - // } - - void _onDropDownChanged(BuildContext context, value) { - context.read().add(ChangeDropDownEvent(value: value)); - } } diff --git a/lib/presentation/registration/language_select_screen/models/language_select_model.dart b/lib/presentation/registration/language_select_screen/models/language_select_model.dart index 465a8ac8..c337c55e 100644 --- a/lib/presentation/registration/language_select_screen/models/language_select_model.dart +++ b/lib/presentation/registration/language_select_screen/models/language_select_model.dart @@ -8,6 +8,7 @@ import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model /// and is typically used to hold data that is passed between different parts of the application. class LanguageSelectModel extends Equatable { LanguageSelectModel({this.dropdownItemList = const []}); + UserRegistrationSheet userRegistrationSheet = UserRegistrationSheet( name: '', firstName: '', diff --git a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart index 2edc4d6c..4934d31f 100644 --- a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart @@ -82,7 +82,7 @@ class _MedicineIntakeScreenState extends State { onTapNext(MedicineIntakeState state, BuildContext context) { return () { UserRegistrationSheet sheet = state.medicineIntakeModelObj!.userRegistrationSheet; - sheet.aboutTakingPils = state.enterInformationController!.text; + // sheet.aboutTakingPils = state.enterInformationController!.text; GoRouter.of(context).goNamed( 'favoriteSportsScreen', extra: sheet, diff --git a/lib/presentation/registration/name_screen/name_screen.dart b/lib/presentation/registration/name_screen/name_screen.dart index be741706..8721d1f5 100644 --- a/lib/presentation/registration/name_screen/name_screen.dart +++ b/lib/presentation/registration/name_screen/name_screen.dart @@ -29,7 +29,7 @@ class NameScreen extends StatelessWidget { child: Column( children: [ Text("what_is_your_name".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 93.v), + SizedBox(height: 16.v), Text("first_name".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 3.v), BlocSelector( diff --git a/lib/presentation/registration/weight_screen/weight_screen.dart b/lib/presentation/registration/weight_screen/weight_screen.dart index 9f0ab8ef..2fe886b9 100644 --- a/lib/presentation/registration/weight_screen/weight_screen.dart +++ b/lib/presentation/registration/weight_screen/weight_screen.dart @@ -31,7 +31,7 @@ class WeightScreen extends StatelessWidget { "weight_measurements".tr, style: theme.textTheme.headlineSmall, ), - SizedBox(height: 174.v), + SizedBox(height: 16.v), Column( children: [ Text( diff --git a/lib/widgets/app_bar/appbar_title_image.dart b/lib/widgets/app_bar/appbar_title_image.dart index 6242412a..429ab4d8 100644 --- a/lib/widgets/app_bar/appbar_title_image.dart +++ b/lib/widgets/app_bar/appbar_title_image.dart @@ -3,35 +3,16 @@ import 'package:flutter/material.dart'; // ignore: must_be_immutable class AppbarTitleImage extends StatelessWidget { - AppbarTitleImage({ - Key? key, - this.imagePath, - this.margin, - this.onTap, - }) : super( - key: key, - ); + const AppbarTitleImage({required this.imagePath, super.key}); - String? imagePath; - - EdgeInsetsGeometry? margin; - - Function? onTap; + final String? imagePath; @override Widget build(BuildContext context) { - return InkWell( - onTap: onTapCall, - child: Padding( - padding: margin ?? EdgeInsets.zero, - child: CustomImageView( - imagePath: imagePath, - height: 48, - fit: BoxFit.contain, - ), - ), + return CustomImageView( + imagePath: imagePath, + height: 48, + fit: BoxFit.contain, ); } - - void onTapCall() {} } diff --git a/lib/widgets/custom_drop_down.dart b/lib/widgets/custom_drop_down.dart index 759efc1a..09fdbba3 100644 --- a/lib/widgets/custom_drop_down.dart +++ b/lib/widgets/custom_drop_down.dart @@ -92,7 +92,6 @@ class CustomDropDown extends StatelessWidget { value: item, child: Text( item.title, - overflow: TextOverflow.fade, style: hintStyle ?? Theme.of(context).textTheme.titleMedium, ), ); diff --git a/lib/widgets/custom_text_form_field.dart b/lib/widgets/custom_text_form_field.dart index e70b2b53..3d061e91 100644 --- a/lib/widgets/custom_text_form_field.dart +++ b/lib/widgets/custom_text_form_field.dart @@ -62,7 +62,7 @@ class CustomTextFormField extends StatelessWidget { final String? initialValue; final Function(String)? onFieldSubmitted; final void Function(String?)? onSaved; - final void Function(String?)? onChanged; + final void Function(String)? onChanged; @override Widget build(BuildContext context) { @@ -128,6 +128,7 @@ class CustomTextFormField extends StatelessWidget { : SizedBox( width: width ?? double.maxFinite, child: TextFormField( + onChanged: onChanged, controller: controller, focusNode: focusNode ?? null, autofocus: autofocus!, From 088fe08b377f164187bf27a5deda972a62f20192 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Sun, 14 Jul 2024 16:44:08 +0300 Subject: [PATCH 13/21] feature(registration): refactor 1 --- lib/main.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 7faced2a..5cb4e316 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -68,7 +68,7 @@ class MyApp extends StatelessWidget { theme: theme, title: 'Eatvio', routerConfig: AppRouter.appRouter, - debugShowCheckedModeBanner: false, + debugShowCheckedModeBanner: true, localizationsDelegates: [ AppLocalizationDelegate(), GlobalMaterialLocalizations.delegate, From da447d696049f917cd3f42f44c92f60cab1e4a1a Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Sun, 14 Jul 2024 16:45:57 +0300 Subject: [PATCH 14/21] feature(registration): refactor 2 --- lib/main.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 5cb4e316..7faced2a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -68,7 +68,7 @@ class MyApp extends StatelessWidget { theme: theme, title: 'Eatvio', routerConfig: AppRouter.appRouter, - debugShowCheckedModeBanner: true, + debugShowCheckedModeBanner: false, localizationsDelegates: [ AppLocalizationDelegate(), GlobalMaterialLocalizations.delegate, From d49ce2120ac46a057595596492bff9d3089ab01e Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Sun, 14 Jul 2024 22:16:59 +0300 Subject: [PATCH 15/21] feature(registration): refactor i 2. --- .../selection_popup_model.dart | 25 ++- .../selection_popup_model.freezed.dart | 189 ++++++++++++++++++ .../pages/registration_screen.dart | 112 ++++++++--- .../glossary_screen/glossary_screen.dart | 2 +- .../date_of_birth_screen.dart | 155 +++++--------- .../gender_screen/gender_screen.dart | 148 ++++++-------- .../language_select_screen.dart | 20 +- .../registration/name_screen/name_screen.dart | 131 +++--------- lib/widgets/custom_drop_down.dart | 5 +- 9 files changed, 430 insertions(+), 357 deletions(-) create mode 100644 lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart diff --git a/lib/data/models/selectionPopupModel/selection_popup_model.dart b/lib/data/models/selectionPopupModel/selection_popup_model.dart index e9aa2c89..82c519c6 100644 --- a/lib/data/models/selectionPopupModel/selection_popup_model.dart +++ b/lib/data/models/selectionPopupModel/selection_popup_model.dart @@ -1,15 +1,14 @@ -///SelectionPopupModel is common model -///used for setting data into dropdowns -class SelectionPopupModel { - int? id; - String title; - dynamic value; - bool isSelected; +import 'package:freezed_annotation/freezed_annotation.dart'; - SelectionPopupModel({ - this.id, - required this.title, - this.value, - this.isSelected = false, - }); +part 'selection_popup_model.freezed.dart'; + +@freezed +class SelectionPopupModel with _$SelectionPopupModel { + const factory SelectionPopupModel({ + int? id, + required String title, + dynamic value, + @Default(false) + bool isSelected, + }) = _SelectionPopupModel; } diff --git a/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart b/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart new file mode 100644 index 00000000..917785c7 --- /dev/null +++ b/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart @@ -0,0 +1,189 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'selection_popup_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +/// @nodoc +mixin _$SelectionPopupModel { + int? get id => throw _privateConstructorUsedError; + String get title => throw _privateConstructorUsedError; + dynamic get value => throw _privateConstructorUsedError; + bool get isSelected => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $SelectionPopupModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SelectionPopupModelCopyWith<$Res> { + factory $SelectionPopupModelCopyWith( + SelectionPopupModel value, $Res Function(SelectionPopupModel) then) = + _$SelectionPopupModelCopyWithImpl<$Res, SelectionPopupModel>; + @useResult + $Res call({int? id, String title, dynamic value, bool isSelected}); +} + +/// @nodoc +class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> + implements $SelectionPopupModelCopyWith<$Res> { + _$SelectionPopupModelCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? title = null, + Object? value = freezed, + Object? isSelected = null, + }) { + return _then(_value.copyWith( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int?, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + value: freezed == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as dynamic, + isSelected: null == isSelected + ? _value.isSelected + : isSelected // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$SelectionPopupModelImplCopyWith<$Res> + implements $SelectionPopupModelCopyWith<$Res> { + factory _$$SelectionPopupModelImplCopyWith(_$SelectionPopupModelImpl value, + $Res Function(_$SelectionPopupModelImpl) then) = + __$$SelectionPopupModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int? id, String title, dynamic value, bool isSelected}); +} + +/// @nodoc +class __$$SelectionPopupModelImplCopyWithImpl<$Res> + extends _$SelectionPopupModelCopyWithImpl<$Res, _$SelectionPopupModelImpl> + implements _$$SelectionPopupModelImplCopyWith<$Res> { + __$$SelectionPopupModelImplCopyWithImpl(_$SelectionPopupModelImpl _value, + $Res Function(_$SelectionPopupModelImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? title = null, + Object? value = freezed, + Object? isSelected = null, + }) { + return _then(_$SelectionPopupModelImpl( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int?, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + value: freezed == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as dynamic, + isSelected: null == isSelected + ? _value.isSelected + : isSelected // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// @nodoc + +class _$SelectionPopupModelImpl implements _SelectionPopupModel { + const _$SelectionPopupModelImpl( + {this.id, required this.title, this.value, this.isSelected = false}); + + @override + final int? id; + @override + final String title; + @override + final dynamic value; + @override + @JsonKey() + final bool isSelected; + + @override + String toString() { + return 'SelectionPopupModel(id: $id, title: $title, value: $value, isSelected: $isSelected)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SelectionPopupModelImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.title, title) || other.title == title) && + const DeepCollectionEquality().equals(other.value, value) && + (identical(other.isSelected, isSelected) || + other.isSelected == isSelected)); + } + + @override + int get hashCode => Object.hash(runtimeType, id, title, + const DeepCollectionEquality().hash(value), isSelected); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => + __$$SelectionPopupModelImplCopyWithImpl<_$SelectionPopupModelImpl>( + this, _$identity); +} + +abstract class _SelectionPopupModel implements SelectionPopupModel { + const factory _SelectionPopupModel( + {final int? id, + required final String title, + final dynamic value, + final bool isSelected}) = _$SelectionPopupModelImpl; + + @override + int? get id; + @override + String get title; + @override + dynamic get value; + @override + bool get isSelected; + @override + @JsonKey(ignore: true) + _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index 3ee6d0ca..0f6a3bc9 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -171,11 +171,11 @@ class _RegistrationScreenState extends State { }); }, children: [ - LanguageSelectScreen(sheet: context.read().state.sheet), - CredentialsScreen(sheet: context.read().state.sheet), - NameScreen(), - GenderScreen(), - DateOfBirthScreen(), + LanguageSelectScreen(sheet: state.sheet), + CredentialsScreen(sheet: state.sheet), + NameScreen(sheet: state.sheet), + GenderScreen(sheet: state.sheet), + DateOfBirthScreen(sheet: state.sheet), CityOfLivingScreen(), BodyCircumferencesScreen(), WeightScreen(), @@ -197,38 +197,64 @@ class _RegistrationScreenState extends State { bool canGoNext(state) { switch (step) { - case 2: - List errors = validateFields(state.sheet.email, state.sheet.name, state.sheet.password, state.sheet.passwordConfirmation); - if (errors.isEmpty) { - return true; - } else { - String errorMessage = ''; - - for (var error in errors) { - errorMessage += error + '\n\n'; - } - - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text('Ошибка'), - content: Text(errorMessage), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text('OK'), - ), - ], - ), - ); - return false; - } + // case 2: + // List errors = validateCredentialsFields(state.sheet.email, state.sheet.name, state.sheet.password, state.sheet.passwordConfirmation); + // if (errors.isEmpty) { + // return true; + // } else { + // String errorMessage = ''; + // + // for (var error in errors) { + // errorMessage += error + '\n\n'; + // } + // + // showDialog( + // context: context, + // builder: (context) => AlertDialog( + // title: Text('Ошибка'), + // content: Text(errorMessage), + // actions: [ + // TextButton( + // onPressed: () => Navigator.pop(context), + // child: Text('OK'), + // ), + // ], + // ), + // ); + // return false; + // } + // case 3: + // List errors = validateNameFields(state.sheet.firstName, state.sheet.lastName); + // if (errors.isEmpty) { + // return true; + // } else { + // String errorMessage = ''; + // + // for (var error in errors) { + // errorMessage += error + '\n\n'; + // } + // + // showDialog( + // context: context, + // builder: (context) => AlertDialog( + // title: Text('Ошибка'), + // content: Text(errorMessage), + // actions: [ + // TextButton( + // onPressed: () => Navigator.pop(context), + // child: Text('OK'), + // ), + // ], + // ), + // ); + // return false; + // } default: return true; } } - List validateFields(String email, String name, String password, String passwordConfirmation) { + List validateCredentialsFields(String email, String name, String password, String passwordConfirmation) { List errors = []; if (!isEmail(email)) { @@ -261,4 +287,26 @@ class _RegistrationScreenState extends State { return errors; } + + List validateNameFields(String firstName, String lastName) { + List errors = []; + + if (firstName.isEmpty) { + errors.add('First name cannot be empty'); + } + + if (firstName.length < 1) { + errors.add('First name is too short'); + } + + if (lastName.isEmpty) { + errors.add('Last name cannot be empty'); + } + + if (lastName.length < 1) { + errors.add('Last name is too short'); + } + + return errors; + } } diff --git a/lib/presentation/glossary/glossary_screen/glossary_screen.dart b/lib/presentation/glossary/glossary_screen/glossary_screen.dart index b421b87a..35caec2d 100644 --- a/lib/presentation/glossary/glossary_screen/glossary_screen.dart +++ b/lib/presentation/glossary/glossary_screen/glossary_screen.dart @@ -175,7 +175,7 @@ class GlossaryScreen extends StatelessWidget { ), CustomDropDown( items: state.productGroups, - defaultValue: state.productGroups?[0], + value: state.productGroups?[0], fillColor: Colors.grey[200]!, hintText: 'Выберите категорию', borderDecoration: OutlineInputBorder( diff --git a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart index 0952a664..49118cac 100644 --- a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart @@ -1,82 +1,49 @@ +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:flutter/cupertino.dart'; -import 'package:go_router/go_router.dart'; - -import 'bloc/date_of_birth_bloc.dart'; -import 'models/date_of_birth_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; class DateOfBirthScreen extends StatefulWidget { - const DateOfBirthScreen({Key? key}) : super(key: key); + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => DateOfBirthBloc( - DateOfBirthState( - dateOfBirthModelObj: DateOfBirthModel( - userRegistrationSheet: sheet, - ), - ), - )..add(DateOfBirthInitialEvent()), - child: DateOfBirthScreen(), - ); - } + const DateOfBirthScreen({super.key, required this.sheet}); @override State createState() => _DateOfBirthScreenState(); } class _DateOfBirthScreenState extends State { - DateTime selectedDate = DateTime.now(); + late DateTime selectedDate; + + @override + void initState() { + super.initState(); + if (widget.sheet.birthdate.isNotEmpty) { + selectedDate = DateFormat('yyyy-mm-dd').parse(widget.sheet.birthdate); + } else { + selectedDate = DateTime.now(); + } + } @override Widget build(BuildContext context) { return SingleChildScrollView( padding: EdgeInsets.only(bottom: 80), - child: BlocBuilder( - builder: (context, state) { - return Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column( - children: [ - Text("date_of_birth".tr, style: theme.textTheme.headlineSmall), - const SizedBox(height: 32), - _buildDateInput(context), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapContinue(state, context), - // ); - // }, - // ), - ], - ), - ); - }, + child: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + Text("date_of_birth".tr, style: theme.textTheme.headlineSmall), + const SizedBox(height: 32), + _buildDateInput(context), + ], + ), ), ); } - onTapContinue(DateOfBirthState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.dateOfBirthModelObj!.userRegistrationSheet; - // sheet.birthdate = selectedDate.toString(); - GoRouter.of(context).goNamed('cityOfLivingScreen', extra: sheet); - }; - } - - - Function onTapBack(BuildContext context) { - return () { - onTapArrowLeft(context); - }; - } - /// Section Widget _buildDateInput(BuildContext context) { return Container( @@ -105,14 +72,16 @@ class _DateOfBirthScreenState extends State { onTapCalendar(BuildContext context) { return () { - // openDatePickerDialog(context); _showDialog( CupertinoDatePicker( initialDateTime: DateTime.now(), mode: CupertinoDatePickerMode.date, - onDateTimeChanged: (DateTime newTime) { + onDateTimeChanged: (DateTime newDateTime) { setState(() { - selectedDate = newTime; + selectedDate = newDateTime; + print(selectedDate); + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(birthdate: selectedDate.toString())); }); }, ), @@ -123,50 +92,26 @@ class _DateOfBirthScreenState extends State { void _showDialog(Widget child) { showCupertinoModalPopup( context: context, - builder: (BuildContext context) => Container( - height: 216, - padding: const EdgeInsets.only(top: 6.0), - // The Bottom margin is provided to align the popup above the system - // navigation bar. - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).viewInsets.bottom, - ), - // Provide a background color for the popup. - color: CupertinoColors.systemBackground.resolveFrom(context), - // Use a SafeArea widget to avoid system overlaps. - child: SafeArea( - top: false, - child: child, - ), - ), + builder: (BuildContext context) => + Container( + height: 216, + padding: const EdgeInsets.only(top: 6.0), + // The Bottom margin is provided to align the popup above the system + // navigation bar. + margin: EdgeInsets.only( + bottom: MediaQuery + .of(context) + .viewInsets + .bottom, + ), + // Provide a background color for the popup. + color: CupertinoColors.systemBackground.resolveFrom(context), + // Use a SafeArea widget to avoid system overlaps. + child: SafeArea( + top: false, + child: child, + ), + ), ); } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } - - /// Displays a date picker dialog to update the selected date - /// - /// This function returns a `Future` that completes with `void`. - Future openDatePickerDialog(BuildContext context) async { - DateTime? dateTime = await showDatePicker( - context: context, - initialDate: DateTime.now(), - firstDate: DateTime(1924), - lastDate: DateTime( - DateTime.now().year, - DateTime.now().month, - DateTime.now().day, - ), - ); - if (dateTime != null) { - if (mounted) { - setState(() { - selectedDate = dateTime; - }); - } - } - } } diff --git a/lib/presentation/registration/gender_screen/gender_screen.dart b/lib/presentation/registration/gender_screen/gender_screen.dart index 5ffa6be2..803759da 100644 --- a/lib/presentation/registration/gender_screen/gender_screen.dart +++ b/lib/presentation/registration/gender_screen/gender_screen.dart @@ -1,111 +1,79 @@ -import 'package:go_router/go_router.dart'; - -import 'bloc/gender_bloc.dart'; -import 'models/gender_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; class GenderScreen extends StatefulWidget { - const GenderScreen({Key? key}) : super(key: key); + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => GenderBloc( - GenderState( - genderModelObj: GenderModel(userRegistrationSheet: sheet), - ), - )..add(GenderInitialEvent()), - child: GenderScreen(), - ); - } + const GenderScreen({super.key, required this.sheet}); @override State createState() => _GenderScreenState(); } class _GenderScreenState extends State { + late String currentValue; + + @override + void initState() { + super.initState(); + currentValue = widget.sheet.gender; + } + @override Widget build(BuildContext context) { return SingleChildScrollView( padding: EdgeInsets.only(bottom: 80), - child: BlocBuilder( - builder: (context, state) { - return Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column( - children: [ - Text("your_gender".tr, style: theme.textTheme.headlineSmall), - RadioListTile( - title: Text('Мужской'), - value: 'male', - groupValue: state.selectedRadioValue, - onChanged: onMale(context), - secondary: Image.asset( - 'assets/images/img_male.png', - width: 40, - height: 40, - ), - ), - RadioListTile( - title: Text('Женский'), - value: 'female', - groupValue: state.selectedRadioValue, - onChanged: onFemale(context), - secondary: Image.asset( - 'assets/images/img_female.png', - width: 40, - height: 40, - ), - ), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapNext(state, context), - // ); - // }, - // ), - ], + child: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + Text("your_gender".tr, style: theme.textTheme.headlineSmall), + RadioListTile( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + title: Text('Мужской'), + value: 'male', + groupValue: currentValue, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'male')); + setState(() { + currentValue = 'male'; + }); + }, + secondary: Image.asset( + 'assets/images/img_male.png', + width: 40, + height: 40, + ), ), - ); - }, + RadioListTile( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + title: Text('Женский'), + value: 'female', + groupValue: currentValue, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'female')); + setState(() { + currentValue = 'female'; + }); + }, + secondary: Image.asset( + 'assets/images/img_female.png', + width: 40, + height: 40, + ), + ), + ], + ), ), ); } - - onTapNext(GenderState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.genderModelObj!.userRegistrationSheet; - // sheet.gender = state.selectedRadioValue!; - GoRouter.of(context).goNamed('dateOfBirthScreen', extra: sheet); - }; - } - - onMale(BuildContext context) { - return (value) { - BlocProvider.of(context).add(GenderSelectEvent(value: 'male')); - }; - } - - onFemale(BuildContext context) { - return (value) { - BlocProvider.of(context).add(GenderSelectEvent(value: 'female')); - }; - } - - - Function onTapBack() { - return () { - GoRouter.of(context).pop(); - }; - } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } } diff --git a/lib/presentation/registration/language_select_screen/language_select_screen.dart b/lib/presentation/registration/language_select_screen/language_select_screen.dart index 1a0dc415..c770c0c7 100644 --- a/lib/presentation/registration/language_select_screen/language_select_screen.dart +++ b/lib/presentation/registration/language_select_screen/language_select_screen.dart @@ -18,12 +18,14 @@ class _LanguageSelectScreenState extends State { SelectionPopupModel(id: 1, title: "Русский", isSelected: true), ]; - late SelectionPopupModel value; + SelectionPopupModel? value; @override void initState() { super.initState(); - value = SelectionPopupModel(title: widget.sheet.lang); + if (widget.sheet.lang.isNotEmpty) { + value = dropdownItemList.first; + } } @override @@ -45,23 +47,13 @@ class _LanguageSelectScreenState extends State { ), const SizedBox(height: 32), CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.h), - ), - child: CustomImageView( - imagePath: ImageConstant.imgFavorite, - height: 12.adaptSize, - width: 12.adaptSize, - ), - ), + value: value, hintText: "Не выбрано".tr, items: dropdownItemList, onChanged: (SelectionPopupModel newValue) => setState(() { value = newValue; final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(lang: value.title)); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(lang: value!.title)); }), ), ], diff --git a/lib/presentation/registration/name_screen/name_screen.dart b/lib/presentation/registration/name_screen/name_screen.dart index 8721d1f5..dfd9a169 100644 --- a/lib/presentation/registration/name_screen/name_screen.dart +++ b/lib/presentation/registration/name_screen/name_screen.dart @@ -1,22 +1,27 @@ -import 'package:go_router/go_router.dart'; -import 'bloc/name_bloc.dart'; -import 'models/name_model.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class NameScreen extends StatelessWidget { - const NameScreen({Key? key}) : super(key: key); +class NameScreen extends StatefulWidget { + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => NameBloc( - NameState( - nameModelObj: NameModel(userRegistrationSheet: sheet), - ), - )..add(NameInitialEvent()), - child: NameScreen(), - ); + const NameScreen({required this.sheet, super.key}); + + @override + State createState() => _NameScreenState(); +} + +class _NameScreenState extends State { + final firstNameController = TextEditingController(); + final lastNameController = TextEditingController(); + + @override + void initState() { + super.initState(); + firstNameController.text = widget.sheet.firstName; + lastNameController.text = widget.sheet.lastName; } @override @@ -32,101 +37,27 @@ class NameScreen extends StatelessWidget { SizedBox(height: 16.v), Text("first_name".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.firstNameController, - builder: (context, firstNameController) { - return CustomTextFormField(controller: firstNameController, textInputAction: TextInputAction.done); + CustomTextFormField( + controller: firstNameController, + textInputAction: TextInputAction.done, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(firstName: newValue)); }, ), SizedBox(height: 19.v), Text("last_name".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 5.v), - BlocSelector( - selector: (state) => state.lastNameController, - builder: (context, lastNameController) { - return CustomTextFormField( - controller: lastNameController, - ); + CustomTextFormField( + controller: lastNameController, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(lastName: newValue)); }, - ), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: () => _onTapNext(context, state), // Assign callback function here - // ); - // }, - // ), + ) ], ), ), ); } - - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } - - // _onTapNext(BuildContext context, NameState state) { - // if (state.firstNameController != null && state.lastNameController != null) { - // List errors = validateFields(state.firstNameController!.text, state.lastNameController!.text); - // - // if (errors.isEmpty) { - // UserRegistrationSheet sheet = state.nameModelObj!.userRegistrationSheet; - // sheet.firstName = state.firstNameController!.text; - // sheet.lastName = state.lastNameController!.text; - // AppRouter.navigatorKey.currentContext?.goNamed('genderScreen', extra: sheet); - // } else { - // String errorMessage = ''; - // - // for (var error in errors) { - // errorMessage += error + '\n\n'; - // } - // - // showDialog( - // context: context, - // builder: (context) => AlertDialog( - // title: Text('Error'), - // content: Text(errorMessage), - // actions: [ - // TextButton( - // onPressed: () => onTapOk(context), - // child: Text('OK'), - // ), - // ], - // ), - // ); - // } - // } - // } - - void onTapOk(BuildContext context) { - Navigator.pop(context); - } - - List validateFields(String firstName, String lastName) { - List errors = []; - - if (firstName.isEmpty) { - errors.add('First name cannot be empty'); - } - - if (firstName.length < 1) { - errors.add('First name is too short'); - } - - if (lastName.isEmpty) { - errors.add('Last name cannot be empty'); - } - - if (lastName.length < 1) { - errors.add('Last name is too short'); - } - - return errors; - } } diff --git a/lib/widgets/custom_drop_down.dart b/lib/widgets/custom_drop_down.dart index 09fdbba3..ff80bac9 100644 --- a/lib/widgets/custom_drop_down.dart +++ b/lib/widgets/custom_drop_down.dart @@ -23,7 +23,7 @@ class CustomDropDown extends StatelessWidget { this.filled = true, this.validator, this.onChanged, - this.defaultValue, + this.value, }) : super( key: key, ); @@ -62,7 +62,7 @@ class CustomDropDown extends StatelessWidget { final bool? filled; - final SelectionPopupModel? defaultValue; + final SelectionPopupModel? value; final FormFieldValidator? validator; @@ -85,6 +85,7 @@ class CustomDropDown extends StatelessWidget { focusNode: focusNode ?? FocusNode(), icon: icon, autofocus: autofocus!, + value: value, isExpanded: true, style: textStyle ?? Theme.of(context).textTheme.titleMedium, items: items?.map((SelectionPopupModel item) { From 4780caf38918b2af2299f3b86ff72bb9be57a18f Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Sun, 14 Jul 2024 22:21:30 +0300 Subject: [PATCH 16/21] feature(registration): refactor i 3. --- .../pages/registration_screen.dart | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index 0f6a3bc9..534ea113 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -197,58 +197,58 @@ class _RegistrationScreenState extends State { bool canGoNext(state) { switch (step) { - // case 2: - // List errors = validateCredentialsFields(state.sheet.email, state.sheet.name, state.sheet.password, state.sheet.passwordConfirmation); - // if (errors.isEmpty) { - // return true; - // } else { - // String errorMessage = ''; - // - // for (var error in errors) { - // errorMessage += error + '\n\n'; - // } - // - // showDialog( - // context: context, - // builder: (context) => AlertDialog( - // title: Text('Ошибка'), - // content: Text(errorMessage), - // actions: [ - // TextButton( - // onPressed: () => Navigator.pop(context), - // child: Text('OK'), - // ), - // ], - // ), - // ); - // return false; - // } - // case 3: - // List errors = validateNameFields(state.sheet.firstName, state.sheet.lastName); - // if (errors.isEmpty) { - // return true; - // } else { - // String errorMessage = ''; - // - // for (var error in errors) { - // errorMessage += error + '\n\n'; - // } - // - // showDialog( - // context: context, - // builder: (context) => AlertDialog( - // title: Text('Ошибка'), - // content: Text(errorMessage), - // actions: [ - // TextButton( - // onPressed: () => Navigator.pop(context), - // child: Text('OK'), - // ), - // ], - // ), - // ); - // return false; - // } + case 2: + List errors = validateCredentialsFields(state.sheet.email, state.sheet.name, state.sheet.password, state.sheet.passwordConfirmation); + if (errors.isEmpty) { + return true; + } else { + String errorMessage = ''; + + for (var error in errors) { + errorMessage += error + '\n\n'; + } + + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text('Ошибка'), + content: Text(errorMessage), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text('OK'), + ), + ], + ), + ); + return false; + } + case 3: + List errors = validateNameFields(state.sheet.firstName, state.sheet.lastName); + if (errors.isEmpty) { + return true; + } else { + String errorMessage = ''; + + for (var error in errors) { + errorMessage += error + '\n\n'; + } + + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text('Ошибка'), + content: Text(errorMessage), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text('OK'), + ), + ], + ), + ); + return false; + } default: return true; } From 8cf2388b18284ac8aad8910d64acbe4ecc032ab0 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 15 Jul 2024 11:19:29 +0300 Subject: [PATCH 17/21] feature(registration): refactor i 4 --- flutter_01.log | 97 +++++++++ .../pages/registration_screen.dart | 64 +++++- .../additional_information_screen.dart | 19 +- .../allergies_screen/allergies_screen.dart | 64 +++--- .../blood_pressure_screen.dart | 10 +- .../body_circumferences_screen.dart | 199 ++++++------------ .../city_of_living_screen.dart | 193 +++++++++-------- .../favorite_foods_screen.dart | 11 +- .../favorite_sports_screen.dart | 11 +- .../height_screen/height_screen.dart | 18 +- .../medicine_intake_screen.dart | 11 +- .../weight_screen/weight_screen.dart | 10 +- 12 files changed, 365 insertions(+), 342 deletions(-) create mode 100644 flutter_01.log diff --git a/flutter_01.log b/flutter_01.log new file mode 100644 index 00000000..f7f3c20d --- /dev/null +++ b/flutter_01.log @@ -0,0 +1,97 @@ +Flutter crash report. +Please report a bug at https://github.com/flutter/flutter/issues. + +## command + +flutter analyze + +## exception + +PathNotFoundException: PathNotFoundException: Cannot open file, path = '/home/alex/snap/flutter/common/flutter/version' (OS Error: No such file or directory, errno = 2) + +``` +#0 _File.throwIfError (dart:io/file_impl.dart:675:7) +#1 _File.openSync (dart:io/file_impl.dart:490:5) +#2 _File.readAsBytesSync (dart:io/file_impl.dart:574:18) +#3 _File.readAsStringSync (dart:io/file_impl.dart:624:18) +#4 ForwardingFile.readAsStringSync (package:file/src/forwarding/forwarding_file.dart:99:16) +#5 ErrorHandlingFile.readAsStringSync. (package:flutter_tools/src/base/error_handling_io.dart:217:22) +#6 _runSync (package:flutter_tools/src/base/error_handling_io.dart:587:14) +#7 ErrorHandlingFile.readAsStringSync (package:flutter_tools/src/base/error_handling_io.dart:216:12) +#8 _DefaultPub.get (package:flutter_tools/src/dart/pub.dart:302:58) +#9 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1724:17) + +#10 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1394:27) + +#11 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) + +#12 CommandRunner.runCommand (package:args/command_runner.dart:212:13) + +#13 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:372:9) + +#14 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) + +#15 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:308:5) + +#16 run.. (package:flutter_tools/runner.dart:130:9) + +#17 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) + +#18 main (package:flutter_tools/executable.dart:93:3) + +``` + +## flutter doctor + +``` +[!] Flutter (Channel [user-branch], 0.0.0-unknown, on Ubuntu 24.04 LTS 6.8.0-38-generic, locale ru_RU.UTF-8) + ! Flutter version 0.0.0-unknown on channel [user-branch] at /home/alex/snap/flutter/common/flutter + Currently on an unknown channel. Run `flutter channel` to switch to an official channel. + If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install. + Cannot resolve current version, possibly due to local changes. + Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install. + ! Upstream repository unknown source is not a standard remote. + Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error. + • Framework revision (), 1970-01-01 03:00:00.000 + • Engine revision edd8546116 + • Dart version 3.4.3 + • DevTools version 2.34.3 + • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. + +[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) + • Android SDK at /home/alex/Android/Sdk + • Platform android-35, build-tools 35.0.0 + • Java binary at: /snap/android-studio/161/jbr/bin/java + • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105) + • All Android licenses accepted. + +[✓] Chrome - develop for the web + • Chrome at google-chrome + +[✓] Linux toolchain - develop for Linux desktop + • clang version 10.0.0-4ubuntu1 + • cmake version 3.16.3 + • ninja version 1.10.0 + • pkg-config version 0.29.1 + +[✓] Android Studio (version 2024.1) + • Android Studio at /snap/android-studio/161 + • Flutter plugin version 80.0.2 + • Dart plugin can be installed from: + 🔨 https://plugins.jetbrains.com/plugin/6351-dart + • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105) + +[✓] VS Code (version 1.91.1) + • VS Code at /usr/share/code + • Flutter extension version 3.92.0 + +[✓] Connected device (3 available) + • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 15 (API 35) (emulator) + • Linux (desktop) • linux • linux-x64 • Ubuntu 24.04 LTS 6.8.0-38-generic + • Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.126 + +[✓] Network resources + • All expected network resources are available. + +! Doctor found issues in 1 category. +``` diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index 534ea113..3f3da557 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -176,16 +176,16 @@ class _RegistrationScreenState extends State { NameScreen(sheet: state.sheet), GenderScreen(sheet: state.sheet), DateOfBirthScreen(sheet: state.sheet), - CityOfLivingScreen(), - BodyCircumferencesScreen(), - WeightScreen(), - HeightScreen(), - BloodPressureScreen(), - AllergiesScreen(), - MedicineIntakeScreen(), - FavoriteSportsScreen(), - FavoriteFoodsScreen(), - AdditionalInformationScreen(), + CityOfLivingScreen(sheet: state.sheet), // todo refactor + BodyCircumferencesScreen(sheet: state.sheet), + WeightScreen(sheet: state.sheet), + HeightScreen(sheet: state.sheet), + BloodPressureScreen(sheet: state.sheet), + AllergiesScreen(sheet: state.sheet), + MedicineIntakeScreen(sheet: state.sheet), + FavoriteSportsScreen(sheet: state.sheet), + FavoriteFoodsScreen(sheet: state.sheet), + AdditionalInformationScreen(sheet: state.sheet), ], ), ), @@ -234,6 +234,32 @@ class _RegistrationScreenState extends State { errorMessage += error + '\n\n'; } + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text('Ошибка'), + content: Text(errorMessage), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text('OK'), + ), + ], + ), + ); + return false; + } + case 7: + List errors = validateCircumferencesFields(state.sheet.chestCircumference, state.sheet.waistCircumference, state.sheet.hipCircumference); + if (errors.isEmpty) { + return true; + } else { + String errorMessage = ''; + + for (var error in errors) { + errorMessage += error + '\n\n'; + } + showDialog( context: context, builder: (context) => AlertDialog( @@ -254,6 +280,24 @@ class _RegistrationScreenState extends State { } } + List validateCircumferencesFields( + String chestCircumference, + String waistCircumference, + String hipCircumference, + ) { + List errors = []; + + if (chestCircumference.isEmpty | waistCircumference.isEmpty | hipCircumference.isEmpty) { + errors.add('circumference_empty'.tr); + } + + if (![chestCircumference, waistCircumference, hipCircumference].every((circumference) => int.tryParse(circumference) != null)) { + errors.add('circumference_is_not_a_number'.tr); + } + + return errors; + } + List validateCredentialsFields(String email, String name, String password, String passwordConfirmation) { List errors = []; diff --git a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart index c12af1f8..32fbd61b 100644 --- a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart @@ -1,7 +1,6 @@ import 'package:go_router/go_router.dart'; import 'bloc/additional_information_bloc.dart'; -import 'models/additional_information_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; @@ -11,18 +10,16 @@ import 'dart:convert'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; -class AdditionalInformationScreen extends StatelessWidget { - const AdditionalInformationScreen({Key? key}) : super(key: key); +class AdditionalInformationScreen extends StatefulWidget { + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => - AdditionalInformationBloc(AdditionalInformationState(additionalInformationModelObj: AdditionalInformationModel(userRegistrationSheet: sheet))) - ..add(AdditionalInformationInitialEvent()), - child: AdditionalInformationScreen(), - ); - } + const AdditionalInformationScreen({super.key, required this.sheet}); + @override + State createState() => _AdditionalInformationScreenState(); +} + +class _AdditionalInformationScreenState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( diff --git a/lib/presentation/registration/allergies_screen/allergies_screen.dart b/lib/presentation/registration/allergies_screen/allergies_screen.dart index 7a2ac1c6..56702d97 100644 --- a/lib/presentation/registration/allergies_screen/allergies_screen.dart +++ b/lib/presentation/registration/allergies_screen/allergies_screen.dart @@ -1,6 +1,7 @@ import 'package:go_router/go_router.dart'; import 'bloc/allergies_bloc.dart'; +// ignore: unused_import import 'models/allergies_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; @@ -8,14 +9,9 @@ import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; class AllergiesScreen extends StatefulWidget { - const AllergiesScreen({Key? key}) : super(key: key); + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => AllergiesBloc(AllergiesState(allergiesModelObj: AllergiesModel(userRegistrationSheet: sheet)))..add(AllergiesInitialEvent()), - child: AllergiesScreen(), - ); - } + const AllergiesScreen({super.key, required this.sheet}); @override State createState() => _AllergiesScreenState(); @@ -27,33 +23,33 @@ class _AllergiesScreenState extends State { return SingleChildScrollView( padding: EdgeInsets.only(bottom: 80), child: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column( - children: [ - Text("allergies_presence".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 22.v), - _buildTextFormField(context), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapContinue(state, context), - // ); - // }, - // ), - // BlocBuilder( - // builder: (context, state) { - // return GestureDetector( - // onTap: onTapSkip(state, context), - // child: Text("skip".tr, style: theme.textTheme.bodyLarge), - // ); - // }, - // ), - ], - ), + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + Text("allergies_presence".tr, style: theme.textTheme.headlineSmall), + SizedBox(height: 22.v), + _buildTextFormField(context), + // BlocBuilder( + // builder: (context, state) { + // return NextStepButton( + // text: "continue".tr.toUpperCase(), + // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + // onPressed: onTapContinue(state, context), + // ); + // }, + // ), + // BlocBuilder( + // builder: (context, state) { + // return GestureDetector( + // onTap: onTapSkip(state, context), + // child: Text("skip".tr, style: theme.textTheme.bodyLarge), + // ); + // }, + // ), + ], + ), ), ); } diff --git a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart index d8efedd1..d5c24688 100644 --- a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart @@ -11,15 +11,9 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m import 'package:flutter/material.dart'; class BloodPressureScreen extends StatefulWidget { - const BloodPressureScreen({Key? key}) : super(key: key); + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => - BloodPressureBloc(BloodPressureState(bloodPressureModelObj: BloodPressureModel(userRegistrationSheet: sheet)))..add(BloodPressureInitialEvent()), - child: BloodPressureScreen(), - ); - } + const BloodPressureScreen({super.key, required this.sheet}); @override State createState() => _BloodPressureScreenState(); diff --git a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart b/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart index 60733e36..60576c8e 100644 --- a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart @@ -1,23 +1,15 @@ -import 'package:go_router/go_router.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; -import 'bloc/body_circumferences_bloc.dart'; import 'package:flutter/services.dart'; -import 'models/body_circumferences_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; class BodyCircumferencesScreen extends StatefulWidget { - const BodyCircumferencesScreen({Key? key}) : super(key: key); + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => BodyCircumferencesBloc(BodyCircumferencesState(bodyCircumferencesModelObj: BodyCircumferencesModel(userRegistrationSheet: sheet))) - ..add(BodyCircumferencesInitialEvent()), - child: BodyCircumferencesScreen(), - ); - } + const BodyCircumferencesScreen({super.key, required this.sheet}); @override State createState() => _BodyCircumferencesScreenState(); @@ -25,139 +17,72 @@ class BodyCircumferencesScreen extends StatefulWidget { class _BodyCircumferencesScreenState extends State { final digitsOnly = FilteringTextInputFormatter.digitsOnly; + final chestCircumferenceController = TextEditingController(); + final waistCircumferenceController = TextEditingController(); + final hipCircumferenceController = TextEditingController(); + + @override + void initState() { + super.initState(); + chestCircumferenceController.text = widget.sheet.chestCircumference; + waistCircumferenceController.text = widget.sheet.waistCircumference; + hipCircumferenceController.text = widget.sheet.hipCircumference; + } @override Widget build(BuildContext context) { return SingleChildScrollView( padding: EdgeInsets.only(bottom: 80), child: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column( - children: [ - Text("initial_measurements".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 16.v), - Column( - children: [ - Text("chest_circumference".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.chestCircumferenceController, - builder: (context, chestCircumferenceController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: chestCircumferenceController, hintText: "90".tr); - }, - ), - ], - ), - SizedBox(height: 19.v), - Text("waist_circumference".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 5.v), - BlocSelector( - selector: (state) => state.waistCircumferenceController, - builder: (context, waistCircumferenceController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: waistCircumferenceController, hintText: "60".tr); - }, - ), - SizedBox(height: 21.v), - Text("hip_circumference".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.hipCircumferenceController, - builder: (context, hipCircumferenceController) { - return CustomTextFormField( - inputFormatters: [digitsOnly], - controller: hipCircumferenceController, - hintText: "90".tr, - textInputAction: TextInputAction.done, - ); - }, - ), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapContinue(state, context), - // ); - // }, - // ), - ], - ), + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + Text("initial_measurements".tr, style: theme.textTheme.headlineSmall), + SizedBox(height: 16.v), + Column( + children: [ + Text("chest_circumference".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + CustomTextFormField( + inputFormatters: [digitsOnly], + controller: chestCircumferenceController, + hintText: "90".tr, + onChanged: (value) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(chestCircumference: value)); + }, + ), + ], + ), + SizedBox(height: 19.v), + Text("waist_circumference".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 5.v), + CustomTextFormField( + inputFormatters: [digitsOnly], + controller: waistCircumferenceController, + hintText: "60".tr, + onChanged: (value) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(waistCircumference: value)); + }, + ), + SizedBox(height: 21.v), + Text("hip_circumference".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + CustomTextFormField( + inputFormatters: [digitsOnly], + controller: hipCircumferenceController, + hintText: "90".tr, + textInputAction: TextInputAction.done, + onChanged: (value) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hipCircumference: value)); + }, + ), + ], + ), ), ); } - - onTapContinue(BodyCircumferencesState state, BuildContext context) { - return () { - List errors = - validateFields(state.chestCircumferenceController!.text, state.waistCircumferenceController!.text, state.hipCircumferenceController!.text); - if (errors.isEmpty) { - UserRegistrationSheet sheet = state.bodyCircumferencesModelObj!.userRegistrationSheet; - // sheet.chestCircumference = state.chestCircumferenceController!.text; - // sheet.waistCircumference = state.waistCircumferenceController!.text; - // sheet.hipCircumference = state.hipCircumferenceController!.text; - GoRouter.of(context).goNamed('weightScreen', extra: sheet); - } else { - String errorMessage = ''; - - for (var error in errors) { - errorMessage += error + '\n\n'; - } - - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text('Ошибка'), - content: Text(errorMessage), - actions: [ - TextButton( - onPressed: onTapOk(context), - child: Text('OK'), - ), - ], - ), - ); - } - }; - } - - onTapOk(BuildContext context) { - return () { - Navigator.pop(context); - }; - } - - - Function onTapBack(BuildContext context) { - return () { - onTapArrowLeft(context); - }; - } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } - - /// Navigates to the weightScreen when the action is triggered. - navigateToWeight(BuildContext context) => GoRouter.of(context).goNamed('weightScreen'); - - List validateFields( - String chestCircumference, - String waistCircumference, - String hipCircumference, - ) { - List errors = []; - - if (chestCircumference.isEmpty | waistCircumference.isEmpty | hipCircumference.isEmpty) { - errors.add('circumference_empty'.tr); - } - - if (![chestCircumference, waistCircumference, hipCircumference].every((circumference) => int.tryParse(circumference) != null)) { - errors.add('circumference_is_not_a_number'.tr); - } - - return errors; - } } diff --git a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart b/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart index f5ee8a8f..1e5f01be 100644 --- a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart +++ b/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart @@ -1,3 +1,4 @@ +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:go_router/go_router.dart'; import 'bloc/city_of_living_bloc.dart'; @@ -8,108 +9,101 @@ import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; -class CityOfLivingScreen extends StatelessWidget { - const CityOfLivingScreen({Key? key}) : super(key: key); +class CityOfLivingScreen extends StatefulWidget { + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => - CityOfLivingBloc(CityOfLivingState(cityOfLivingModelObj: CityOfLivingModel(userRegistrationSheet: sheet)))..add(CityOfLivingInitialEvent()), - child: CityOfLivingScreen(), - ); - } + const CityOfLivingScreen({super.key, required this.sheet}); + @override + State createState() => _CityOfLivingScreenState(); +} + +class _CityOfLivingScreenState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80), - child: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column( - children: [ - Text("place_of_living".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 39.v), - Text("country".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.cityOfLivingModelObj, - builder: (context, cityOfLivingModelObj) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), - child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), - ), - hintText: "Не выбрано".tr, - items: cityOfLivingModelObj?.dropdownItemList ?? [], - onChanged: onDropDownChange(context), - ); - }, - ), - SizedBox(height: 22.v), - Text("Населенный пункт", style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocBuilder( - builder: (context, state) { - return RawAutocomplete( - optionsBuilder: (TextEditingValue textEditingValue) => _options.where((String option) { - return option.toLowerCase().startsWith(textEditingValue.text.toLowerCase()); - }), - fieldViewBuilder: ( - BuildContext context, - TextEditingController textEditingController, - FocusNode focusNode, - VoidCallback onFieldSubmitted, - ) { - return CustomTextFormField( - controller: textEditingController, - focusNode: focusNode, - onFieldSubmitted: (String value) => onFieldSubmitted(), - ); - }, - optionsViewBuilder: ( - BuildContext context, - AutocompleteOnSelected onSelected, - Iterable options, - ) { - return Align( - alignment: Alignment.topLeft, - child: Material( - elevation: 4.0, - child: SizedBox( - height: 200.0, - child: ListView.builder( - padding: const EdgeInsets.all(8.0), - itemCount: options.length, - itemBuilder: (BuildContext context, int index) { - final String option = options.elementAt(index); - return GestureDetector( - onTap: () => onSelected(option), - child: ListTile( - title: Text(option), - ), - ); - }, + return BlocProvider( + create: (BuildContext context) => + CityOfLivingBloc(CityOfLivingState(cityOfLivingModelObj: CityOfLivingModel(userRegistrationSheet: widget.sheet)))..add(CityOfLivingInitialEvent()), + child: SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + Text("place_of_living".tr, style: theme.textTheme.headlineSmall), + SizedBox(height: 39.v), + Text("country".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + BlocSelector( + selector: (state) => state.cityOfLivingModelObj, + builder: (context, cityOfLivingModelObj) { + return CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), + child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), + ), + hintText: "Не выбрано".tr, + items: cityOfLivingModelObj?.dropdownItemList ?? [], + onChanged: onDropDownChange(context), + ); + }, + ), + SizedBox(height: 22.v), + Text("Населенный пункт", style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + BlocBuilder( + builder: (context, state) { + return RawAutocomplete( + optionsBuilder: (TextEditingValue textEditingValue) => _options.where((String option) { + return option.toLowerCase().startsWith(textEditingValue.text.toLowerCase()); + }), + fieldViewBuilder: ( + BuildContext context, + TextEditingController textEditingController, + FocusNode focusNode, + VoidCallback onFieldSubmitted, + ) { + return CustomTextFormField( + controller: textEditingController, + focusNode: focusNode, + onFieldSubmitted: (String value) => onFieldSubmitted(), + ); + }, + optionsViewBuilder: ( + BuildContext context, + AutocompleteOnSelected onSelected, + Iterable options, + ) { + return Align( + alignment: Alignment.topLeft, + child: Material( + elevation: 4.0, + child: SizedBox( + height: 200.0, + child: ListView.builder( + padding: const EdgeInsets.all(8.0), + itemCount: options.length, + itemBuilder: (BuildContext context, int index) { + final String option = options.elementAt(index); + return GestureDetector( + onTap: () => onSelected(option), + child: ListTile( + title: Text(option), + ), + ); + }, + ), ), ), - ), - ); - }, - ); - }, - ), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapContinue(state, context), - // ); - // }, - // ), - ], + ); + }, + ); + }, + ), + ], + ), ), ), ); @@ -125,10 +119,11 @@ class CityOfLivingScreen extends StatelessWidget { onDropDownChange(BuildContext context) { return (value) { context.read().add(ChangeDropDownEvent(value: value)); + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(country: value)); }; } - Function onTapBack(BuildContext context) { return () { onTapArrowLeft(context); @@ -141,8 +136,10 @@ class CityOfLivingScreen extends StatelessWidget { } } -selectProduct(AutocompleteOnSelected onSelected, String option, CityOfLivingState state) { +selectProduct(AutocompleteOnSelected onSelected, String option, CityOfLivingState state, BuildContext context) { state.cityController?.text = option; + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(city: option)); return () { onSelected(option); }; diff --git a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart index 0db859db..b4f54d9b 100644 --- a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart @@ -1,22 +1,15 @@ import 'package:go_router/go_router.dart'; import 'bloc/favorite_foods_bloc.dart'; -import 'models/favorite_foods_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; class FavoriteFoodsScreen extends StatefulWidget { - const FavoriteFoodsScreen({Key? key}) : super(key: key); + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => - FavoriteFoodsBloc(FavoriteFoodsState(favoriteFoodsModelObj: FavoriteFoodsModel(userRegistrationSheet: sheet)))..add(FavoriteFoodsInitialEvent()), - child: FavoriteFoodsScreen(), - ); - } + const FavoriteFoodsScreen({super.key, required this.sheet}); @override State createState() => _FavoriteFoodsScreenState(); diff --git a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart index 5d8be5da..fd3a42fb 100644 --- a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart @@ -1,6 +1,7 @@ import 'package:go_router/go_router.dart'; import 'bloc/favorite_sports_bloc.dart'; +// ignore: unused_import import 'models/favorite_sports_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; @@ -8,15 +9,9 @@ import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; class FavoriteSportsScreen extends StatefulWidget { - const FavoriteSportsScreen({Key? key}) : super(key: key); + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => - FavoriteSportsBloc(FavoriteSportsState(favoriteSportsModelObj: FavoriteSportsModel(userRegistrationSheet: sheet)))..add(FavoriteSportsInitialEvent()), - child: FavoriteSportsScreen(), - ); - } + const FavoriteSportsScreen({super.key, required this.sheet}); @override State createState() => _FavoriteSportsScreenState(); diff --git a/lib/presentation/registration/height_screen/height_screen.dart b/lib/presentation/registration/height_screen/height_screen.dart index 1e0b88b7..a41dad92 100644 --- a/lib/presentation/registration/height_screen/height_screen.dart +++ b/lib/presentation/registration/height_screen/height_screen.dart @@ -1,23 +1,22 @@ import 'package:go_router/go_router.dart'; import 'bloc/height_bloc.dart'; -import 'models/height_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/services.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; -class HeightScreen extends StatelessWidget { - const HeightScreen({Key? key}) : super(key: key); +class HeightScreen extends StatefulWidget { + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => HeightBloc(HeightState(heightModelObj: HeightModel(userRegistrationSheet: sheet)))..add(HeightInitialEvent()), - child: HeightScreen(), - ); - } + const HeightScreen({super.key, required this.sheet}); + @override + State createState() => _HeightScreenState(); +} + +class _HeightScreenState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( @@ -67,7 +66,6 @@ class HeightScreen extends StatelessWidget { }; } - Function onTapBack(BuildContext context) { return () { onTapArrowLeft(context); diff --git a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart index 4934d31f..5ccc203e 100644 --- a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart @@ -1,22 +1,15 @@ import 'package:go_router/go_router.dart'; import 'bloc/medicine_intake_bloc.dart'; -import 'models/medicine_intake_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; class MedicineIntakeScreen extends StatefulWidget { - const MedicineIntakeScreen({Key? key}) : super(key: key); + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => - MedicineIntakeBloc(MedicineIntakeState(medicineIntakeModelObj: MedicineIntakeModel(userRegistrationSheet: sheet)))..add(MedicineIntakeInitialEvent()), - child: MedicineIntakeScreen(), - ); - } + const MedicineIntakeScreen({super.key, required this.sheet}); @override State createState() => _MedicineIntakeScreenState(); diff --git a/lib/presentation/registration/weight_screen/weight_screen.dart b/lib/presentation/registration/weight_screen/weight_screen.dart index 2fe886b9..f65f0f3d 100644 --- a/lib/presentation/registration/weight_screen/weight_screen.dart +++ b/lib/presentation/registration/weight_screen/weight_screen.dart @@ -1,7 +1,6 @@ import 'package:go_router/go_router.dart'; import 'bloc/weight_bloc.dart'; -import 'models/weight_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/services.dart'; @@ -9,14 +8,9 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m import 'package:flutter/material.dart'; class WeightScreen extends StatelessWidget { - const WeightScreen({Key? key}) : super(key: key); + final UserRegistrationSheet sheet; - static Widget builder(BuildContext context, sheet) { - return BlocProvider( - create: (context) => WeightBloc(WeightState(weightModelObj: WeightModel(userRegistrationSheet: sheet)))..add(WeightInitialEvent()), - child: WeightScreen(), - ); - } + const WeightScreen({super.key, required this.sheet}); @override Widget build(BuildContext context) { From ee37f02d78e1aa0612e0e769762b9cbdca19e62b Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 15 Jul 2024 12:45:52 +0300 Subject: [PATCH 18/21] feature(registration): refactor i5 --- .../registration_cubit.dart | 14 +- .../pages/registration_screen.dart | 6 +- .../repositories/registration_repository.dart | 16 + .../services/registration_service.dart | 15 + .../services/registration_service.g.dart | 74 ++++ lib/locator_service.dart | 6 + .../additional_information_screen.dart | 146 ++------ .../allergies_screen/allergies_screen.dart | 92 ++--- .../bloc/blood_pressure_bloc.dart | 23 +- .../blood_pressure_screen.dart | 321 +++++++----------- .../favorite_foods_screen.dart | 127 ++----- .../favorite_sports_screen.dart | 93 ++--- .../height_screen/height_screen.dart | 52 ++- .../medicine_intake_screen.dart | 99 ++---- .../weight_screen/weight_screen.dart | 104 +++--- 15 files changed, 470 insertions(+), 718 deletions(-) create mode 100644 lib/features/registration/repositories/registration_repository.dart create mode 100644 lib/features/registration/services/registration_service.dart create mode 100644 lib/features/registration/services/registration_service.g.dart diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart index 5e59454f..e882eadd 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart @@ -1,10 +1,22 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart'; +import 'package:eatvio_app/features/registration/repositories/registration_repository.dart'; import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart'; class RegistrationCubit extends Cubit { - RegistrationCubit() : super(RegistrationState(sheet: LanguageSelectModel().userRegistrationSheet)); + final RegistrationRepository registrationRepository; + + RegistrationCubit({required this.registrationRepository}) : super(RegistrationState(sheet: LanguageSelectModel().userRegistrationSheet)); updateSheet(UserRegistrationSheet sheet) => emit(RegistrationState(sheet: sheet)); + + tryRegistration() async { + try { + final response = await registrationRepository.tryRegister(state.sheet); + print(response); + } catch (e) { + print(e); + } + } } diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index 3f3da557..074d67f8 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -1,6 +1,7 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart'; +import 'package:eatvio_app/locator_service.dart'; import 'package:eatvio_app/presentation/registration/additional_information_screen/additional_information_screen.dart'; import 'package:eatvio_app/presentation/registration/allergies_screen/allergies_screen.dart'; import 'package:eatvio_app/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart'; @@ -62,7 +63,7 @@ class _RegistrationScreenState extends State { @override Widget build(BuildContext context) { return BlocProvider( - create: (BuildContext context) => RegistrationCubit(), + create: (BuildContext context) => sl(), child: BlocBuilder( builder: (BuildContext context, RegistrationState state) { return PopScope( @@ -275,6 +276,9 @@ class _RegistrationScreenState extends State { ); return false; } + case 15: + context.read().tryRegistration(); + return true; default: return true; } diff --git a/lib/features/registration/repositories/registration_repository.dart b/lib/features/registration/repositories/registration_repository.dart new file mode 100644 index 00000000..bbaf43f3 --- /dev/null +++ b/lib/features/registration/repositories/registration_repository.dart @@ -0,0 +1,16 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/services/registration_service.dart'; + +class RegistrationRepository { + final RegistrationService registrationService; + + RegistrationRepository({required this.registrationService}); + + tryRegister(UserRegistrationSheet sheet) async { + try { + return await registrationService.register(sheet: sheet); + } catch (e) { + rethrow; + } + } +} \ No newline at end of file diff --git a/lib/features/registration/services/registration_service.dart b/lib/features/registration/services/registration_service.dart new file mode 100644 index 00000000..f7c41ecb --- /dev/null +++ b/lib/features/registration/services/registration_service.dart @@ -0,0 +1,15 @@ +import 'package:dio/dio.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:retrofit/retrofit.dart'; + +part 'registration_service.g.dart'; + +@RestApi() +abstract class RegistrationService { + factory RegistrationService(Dio dio, {String baseUrl}) = _RegistrationService; + + @POST('/register') + Future register({ + @Body() required UserRegistrationSheet sheet, + }); +} diff --git a/lib/features/registration/services/registration_service.g.dart b/lib/features/registration/services/registration_service.g.dart new file mode 100644 index 00000000..44140792 --- /dev/null +++ b/lib/features/registration/services/registration_service.g.dart @@ -0,0 +1,74 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'registration_service.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element + +class _RegistrationService implements RegistrationService { + _RegistrationService( + this._dio, { + this.baseUrl, + }); + + final Dio _dio; + + String? baseUrl; + + @override + Future register({required UserRegistrationSheet sheet}) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = sheet; + await _dio.fetch(_setStreamType(Options( + method: 'POST', + headers: _headers, + extra: _extra, + ) + .compose( + _dio.options, + '/register', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); + } + + RequestOptions _setStreamType(RequestOptions requestOptions) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { + if (T == String) { + requestOptions.responseType = ResponseType.plain; + } else { + requestOptions.responseType = ResponseType.json; + } + } + return requestOptions; + } + + String _combineBaseUrls( + String dioBaseUrl, + String? baseUrl, + ) { + if (baseUrl == null || baseUrl.trim().isEmpty) { + return dioBaseUrl; + } + + final url = Uri.parse(baseUrl); + + if (url.isAbsolute) { + return url.toString(); + } + + return Uri.parse(dioBaseUrl).resolveUri(url).toString(); + } +} diff --git a/lib/locator_service.dart b/lib/locator_service.dart index dfd61987..dc09164c 100644 --- a/lib/locator_service.dart +++ b/lib/locator_service.dart @@ -11,6 +11,9 @@ import 'package:eatvio_app/features/chat/services/chat_service.dart'; import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart'; import 'package:eatvio_app/features/feed/repositories/feed_repository.dart'; import 'package:eatvio_app/features/feed/services/feed_service.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; +import 'package:eatvio_app/features/registration/repositories/registration_repository.dart'; +import 'package:eatvio_app/features/registration/services/registration_service.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:get_it/get_it.dart'; @@ -22,6 +25,7 @@ Future init() async { sl.registerLazySingleton(() => NewMessagesCubit()); sl.registerLazySingleton(() => NotificationsCubit()); + sl.registerFactory(() => RegistrationCubit(registrationRepository: sl())); sl.registerFactory(() => ChatRoomCubit(chatRepository: sl(), initializationCubit: sl())); sl.registerFactory(() => FeedCubit(feedRepository: sl())); sl.registerFactory(() => BlogPostCubit(blogPostRepository: sl())); @@ -30,11 +34,13 @@ Future init() async { sl.registerLazySingleton(() => ChatRepository(chatService: sl())); sl.registerLazySingleton(() => FeedRepository(feedService: sl())); sl.registerLazySingleton(() => BlogPostRepository(blogPostService: sl())); + sl.registerLazySingleton(() => RegistrationRepository(registrationService: sl())); // Services sl.registerLazySingleton(() => ChatService(sl())); sl.registerLazySingleton(() => FeedService(sl())); sl.registerLazySingleton(() => BlogPostService(sl())); + sl.registerLazySingleton(() => RegistrationService(sl())); // External sl.registerLazySingleton( diff --git a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart index 32fbd61b..ec4578cc 100644 --- a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart @@ -1,14 +1,8 @@ -import 'package:go_router/go_router.dart'; - -import 'bloc/additional_information_bloc.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter/material.dart'; -import 'dart:convert'; -import 'package:hive/hive.dart'; -import 'package:http/http.dart' as http; class AdditionalInformationScreen extends StatefulWidget { final UserRegistrationSheet sheet; @@ -20,6 +14,14 @@ class AdditionalInformationScreen extends StatefulWidget { } class _AdditionalInformationScreenState extends State { + final editTextController = TextEditingController(); + + @override + void initState() { + super.initState(); + editTextController.text = widget.sheet.additionalInfo; + } + @override Widget build(BuildContext context) { return SingleChildScrollView( @@ -29,117 +31,31 @@ class _AdditionalInformationScreenState extends State( - // builder: (context, state) { - // return NextStepButton( - // text: "finish".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapFinish(state, context), - // ); - // }, - // ), + Container( + width: 294.h, + margin: EdgeInsets.only(left: 24.h, right: 23.h), + child: Text( + "enter_additional_information".tr, + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + style: CustomTextStyles.titleMediumSegoeUI, + ), + ), + SizedBox(height: 10.v), + CustomTextFormField( + controller: editTextController, + hintText: "У меня крепкое здоровье, но последнее время часто утомляюсь, однако, это мне не мешает радоваться жизни", + textInputAction: TextInputAction.done, + maxLines: 8, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(additionalInfo: newValue)); + }, + ), ], ), ), ); } - - onTapFinish(AdditionalInformationState state, BuildContext context) { - return () async { - UserRegistrationSheet sheet = state.additionalInformationModelObj!.userRegistrationSheet; - // sheet.additionalInfo = state.editTextController!.text; - - final response = await http.post( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/register'), - headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, - body: jsonEncode(sheet.toJson()), - encoding: utf8, - ); - - var res = await jsonDecode(response.body); - if (response.statusCode == 200) { - final box = await Hive.openBox('token'); - final token = res['token']; - box.put('token', token); - GoRouter.of(context).goNamed('myProfileScreen'); - } else { - showErrorMessage(context, res['message']); - } - }; - } - - onTapBack(BuildContext context) { - return () { - onTapArrowLeft(context); - }; - } - - /// Section Widget - _buildTextFormField(BuildContext context) { - return SizedBox( - width: 343.h, - child: Stack( - alignment: Alignment.center, - children: [ - Align( - alignment: Alignment.center, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - width: 294.h, - margin: EdgeInsets.only(left: 24.h, right: 23.h), - child: Text( - "enter_additional_information".tr, - maxLines: 2, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center, - style: CustomTextStyles.titleMediumSegoeUI, - ), - ), - SizedBox(height: 10.v), - BlocSelector( - selector: (state) => state.editTextController, - builder: (context, editTextController) { - return CustomTextFormField( - controller: editTextController, - hintText: "У меня крепкое здоровье, но последнее время часто утомляюсь, однако, это мне не мешает радоваться жизни", - textInputAction: TextInputAction.done, - maxLines: 8, - ); - }, - ), - ], - ), - ), - ], - ), - ); - } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } - - /// Displays an alert dialog when the action is triggered. - /// The dialog box contains a title and a message with the `Теперь вы можете пользоваться полным функционалом приложения` - showErrorMessage(BuildContext context, String text) { - showDialog( - context: context, - builder: (_) => AlertDialog( - title: const Text('Ошибка'), - content: Text(text), - actions: [TextButton(onPressed: onTapOk(context), child: const Text('Ok'))], - ), - ); - } - - onTapOk(BuildContext context) { - return () { - Navigator.pop(context); - }; - } } diff --git a/lib/presentation/registration/allergies_screen/allergies_screen.dart b/lib/presentation/registration/allergies_screen/allergies_screen.dart index 56702d97..3261c92f 100644 --- a/lib/presentation/registration/allergies_screen/allergies_screen.dart +++ b/lib/presentation/registration/allergies_screen/allergies_screen.dart @@ -1,10 +1,6 @@ -import 'package:go_router/go_router.dart'; - -import 'bloc/allergies_bloc.dart'; -// ignore: unused_import -import 'models/allergies_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -18,6 +14,14 @@ class AllergiesScreen extends StatefulWidget { } class _AllergiesScreenState extends State { + final enterInformationController = TextEditingController(); + + @override + void initState() { + super.initState(); + enterInformationController.text = widget.sheet.aboutAllergy; + } + @override Widget build(BuildContext context) { return SingleChildScrollView( @@ -29,75 +33,21 @@ class _AllergiesScreenState extends State { children: [ Text("allergies_presence".tr, style: theme.textTheme.headlineSmall), SizedBox(height: 22.v), - _buildTextFormField(context), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapContinue(state, context), - // ); - // }, - // ), - // BlocBuilder( - // builder: (context, state) { - // return GestureDetector( - // onTap: onTapSkip(state, context), - // child: Text("skip".tr, style: theme.textTheme.bodyLarge), - // ); - // }, - // ), + Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), + SizedBox(height: 2.v), + CustomTextFormField( + controller: enterInformationController, + hintText: "enter_information".tr, + textInputAction: TextInputAction.done, + maxLines: 8, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(aboutAllergy: newValue)); + }, + ), ], ), ), ); } - - onTapSkip(AllergiesState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.allergiesModelObj!.userRegistrationSheet; - GoRouter.of(context).goNamed('medicineIntakeScreen', extra: sheet); - }; - } - - onTapContinue(AllergiesState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.allergiesModelObj!.userRegistrationSheet; - // sheet.aboutAllergy = state.enterInformationController!.text; - GoRouter.of(context).goNamed('medicineIntakeScreen', extra: sheet); - }; - } - - onTapBack(BuildContext context) { - return () { - onTapArrowLeft(context); - }; - } - - /// Section Widget - _buildTextFormField(BuildContext context) { - return Column( - children: [ - Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.enterInformationController, - builder: (context, enterInformationController) { - return CustomTextFormField( - controller: enterInformationController, - hintText: "enter_information".tr, - textInputAction: TextInputAction.done, - maxLines: 8, - ); - }, - ), - ], - ); - } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } } diff --git a/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart b/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart index 2fda1b59..64e3e019 100644 --- a/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart +++ b/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart @@ -2,7 +2,9 @@ import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; import '/core/app_export.dart'; import 'package:eatvio_app/presentation/registration/blood_pressure_screen/models/blood_pressure_model.dart'; + part 'blood_pressure_event.dart'; + part 'blood_pressure_state.dart'; /// A bloc that manages the state of a BloodPressure according to the event that is dispatched to it. @@ -43,7 +45,11 @@ class BloodPressureBloc extends Bloc { id: 1, title: "Да", ), - SelectionPopupModel(id: 2, title: "Нет", isSelected: true), + SelectionPopupModel( + id: 2, + title: "Нет", + isSelected: true, + ), ]; } @@ -51,11 +57,16 @@ class BloodPressureBloc extends Bloc { BloodPressureInitialEvent event, Emitter emit, ) async { - emit(state.copyWith( + emit( + state.copyWith( upPressureController: TextEditingController(), - downPressureController: TextEditingController(),),); - emit(state.copyWith( - bloodPressureModelObj: state.bloodPressureModelObj - ?.copyWith(dropdownItemList: fillDropdownItemList()),),); + downPressureController: TextEditingController(), + ), + ); + emit( + state.copyWith( + bloodPressureModelObj: state.bloodPressureModelObj?.copyWith(dropdownItemList: fillDropdownItemList()), + ), + ); } } diff --git a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart index d5c24688..35669330 100644 --- a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart @@ -1,9 +1,5 @@ -import 'package:eatvio_app/app_router.dart'; -import 'package:go_router/go_router.dart'; - -import 'bloc/blood_pressure_bloc.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:flutter/services.dart'; -import 'models/blood_pressure_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; @@ -20,210 +16,147 @@ class BloodPressureScreen extends StatefulWidget { } class _BloodPressureScreenState extends State { + final List selectionPopupList = [ + SelectionPopupModel( + id: 1, + title: "Да", + ), + SelectionPopupModel( + id: 2, + title: "Нет", + ), + ]; + + late SelectionPopupModel selectedPopupHypo; + late SelectionPopupModel selectedPopupHyper; + final digitsOnly = FilteringTextInputFormatter.digitsOnly; + final upPressureController = TextEditingController(); + final downPressureController = TextEditingController(); + + @override + void initState() { + super.initState(); + selectedPopupHypo = selectionPopupList[1]; + selectedPopupHyper = selectionPopupList[1]; + upPressureController.text = widget.sheet.bloodPressureUp; + downPressureController.text = widget.sheet.bloodPressureDown; + if (widget.sheet.hasHyper.isNotEmpty) { + widget.sheet.hasHyper == 'Да' ? selectedPopupHyper = selectionPopupList[0] : selectedPopupHyper = selectionPopupList[1]; + } + if (widget.sheet.hasHypo.isNotEmpty) { + widget.sheet.hasHypo == 'Да' ? selectedPopupHypo = selectionPopupList[0] : selectedPopupHypo = selectionPopupList[1]; + } + } @override Widget build(BuildContext context) { return SingleChildScrollView( padding: EdgeInsets.only(bottom: 80), child: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 12.h, vertical: 9.v), - child: Column( - children: [ - SizedBox( - width: 224.h, - child: Text( - "your_blood_pressure".tr, - maxLines: 2, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center, - style: theme.textTheme.headlineSmall, - ), + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 12.h, vertical: 9.v), + child: Column( + children: [ + SizedBox( + width: 224.h, + child: Text( + "your_blood_pressure".tr, + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + style: theme.textTheme.headlineSmall, ), - SizedBox(height: 21.v), - Container( - margin: EdgeInsets.only(right: 1.h), - padding: EdgeInsets.symmetric(horizontal: 3.h), - child: Column( - children: [ - Text("up_pressure".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.upPressureController, - builder: (context, upPressureController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: upPressureController, hintText: "90".tr); - }, - ), - ], - ), + ), + SizedBox(height: 21.v), + Container( + margin: EdgeInsets.only(right: 1.h), + padding: EdgeInsets.symmetric(horizontal: 3.h), + child: Column( + children: [ + Text("up_pressure".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + CustomTextFormField( + inputFormatters: [digitsOnly], + controller: upPressureController, + hintText: "90".tr, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureUp: newValue)); + }, + ), + ], ), - SizedBox(height: 21.v), - Container( - margin: EdgeInsets.only(right: 1.h), - padding: EdgeInsets.symmetric(horizontal: 3.h), - child: Column( - children: [ - Text("down_pressure".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.downPressureController, - builder: (context, downPressureController) { - return CustomTextFormField(inputFormatters: [digitsOnly], controller: downPressureController, hintText: "90".tr); - }, - ), - ], - ), + ), + SizedBox(height: 21.v), + Container( + margin: EdgeInsets.only(right: 1.h), + padding: EdgeInsets.symmetric(horizontal: 3.h), + child: Column( + children: [ + Text("down_pressure".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + CustomTextFormField( + inputFormatters: [digitsOnly], + controller: downPressureController, + hintText: "90".tr, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureDown: newValue)); + }, + ), + ], ), - SizedBox(height: 22.v), - Text("do_you_have_hypotension_tendency".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - Padding( - padding: EdgeInsets.symmetric(horizontal: 4.h), - child: BlocSelector( - selector: (state) => state.bloodPressureModelObj, - builder: (context, bloodPressureModelObj) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), - child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), - ), - hintText: "Не выбрано".tr, - items: bloodPressureModelObj?.dropdownItemList ?? [], - onChanged: onChangeHyper(context), - ); - }, + ), + SizedBox(height: 22.v), + Text("do_you_have_hypotension_tendency".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + Padding( + padding: EdgeInsets.symmetric(horizontal: 4.h), + child: CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), + child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), ), + hintText: "Не выбрано".tr, + items: selectionPopupList, + value: selectedPopupHypo, + onChanged: (newPopup) { + setState(() { + selectedPopupHypo = newPopup; + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hasHypo: selectedPopupHypo.title)); + }); + }, ), - SizedBox(height: 22.v), - Text("do_you_have_hypertension_tendency".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - Padding( - padding: EdgeInsets.symmetric(horizontal: 4.h), - child: BlocSelector( - selector: (state) => state.bloodPressureModelObj, - builder: (context, bloodPressureModelObj) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), - child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), - ), - hintText: "Не выбрано".tr, - items: bloodPressureModelObj?.dropdownItemList ?? [], - onChanged: onChangeHypo(context), - ); - }, + ), + SizedBox(height: 22.v), + Text("do_you_have_hypertension_tendency".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + Padding( + padding: EdgeInsets.symmetric(horizontal: 4.h), + child: CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), + child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), ), + hintText: "Не выбрано".tr, + items: selectionPopupList, + value: selectedPopupHyper, + onChanged: (newPopup) { + setState(() { + selectedPopupHyper = newPopup; + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hasHyper: selectedPopupHyper.title)); + }); + }, ), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapContinue(state, context), - // ); - // }, - // ), - // BlocBuilder( - // builder: (context, state) { - // return GestureDetector( - // onTap: onTapSkip(state, context), - // child: Text("skip".tr, style: theme.textTheme.bodyLarge), - // ); - // }, - // ), - ], - ), + ), + ], + ), ), ); } - - onTapSkip(BloodPressureState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.bloodPressureModelObj!.userRegistrationSheet; - AppRouter.navigatorKey.currentContext?.goNamed('allergiesScreen', extra: sheet); - }; - } - - onTapContinue(BloodPressureState state, BuildContext context) { - return () { - List errors = validateFields(state.upPressureController!.text, state.downPressureController!.text); - if (errors.isEmpty) { - UserRegistrationSheet sheet = state.bloodPressureModelObj!.userRegistrationSheet; - // sheet.bloodPressureUp = state.upPressureController!.text; - // sheet.bloodPressureDown = state.downPressureController!.text; - AppRouter.navigatorKey.currentContext?.goNamed('allergiesScreen', extra: sheet); - } else { - String errorMessage = ''; - - for (var error in errors) { - errorMessage += error + '\n\n'; - } - - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text('Ошибка'), - content: Text(errorMessage), - actions: [ - TextButton( - onPressed: onTapOK(context), - child: Text('OK'), - ), - ], - ), - ); - } - }; - } - - onTapOK(BuildContext context) { - return () { - Navigator.pop(context); - }; - } - - onChangeHypo(BuildContext context) { - return (value) { - context.read().add(ChangeHyperDropDownEvent(value: value)); - }; - } - - onChangeHyper(BuildContext context) { - return (value) { - context.read().add(ChangeHypoDownEvent(value: value)); - }; - } - - - Function onTapBack(BuildContext context) { - return () { - onTapArrowLeft(context); - }; - } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } - - List validateFields( - String bloodPressureUp, - String bloodPressureDown, - ) { - List errors = []; - - if (bloodPressureUp.isEmpty | bloodPressureDown.isEmpty) { - errors.add('pressure_empty'.tr); - } - - if (![bloodPressureUp, bloodPressureDown].every((pressure) => int.tryParse(pressure) != null)) { - errors.add('pressure_is_not_a_number'.tr); - } - - return errors; - } } diff --git a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart index b4f54d9b..b26f0c24 100644 --- a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart @@ -1,6 +1,4 @@ -import 'package:go_router/go_router.dart'; - -import 'bloc/favorite_foods_bloc.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; @@ -16,6 +14,16 @@ class FavoriteFoodsScreen extends StatefulWidget { } class _FavoriteFoodsScreenState extends State { + final favoriteFoodsController = TextEditingController(); + final unFavoriteFoodsController = TextEditingController(); + + @override + void initState() { + super.initState(); + favoriteFoodsController.text = widget.sheet.favoriteFoods; + unFavoriteFoodsController.text = widget.sheet.unfavoriteFoods; + } + @override Widget build(BuildContext context) { return SingleChildScrollView( @@ -37,100 +45,33 @@ class _FavoriteFoodsScreenState extends State { ), ), SizedBox(height: 13.v), - _buildTextFormFieldFav(context), + Text("favorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI), + SizedBox(height: 2.v), + CustomTextFormField( + controller: favoriteFoodsController, + hintText: "enter_information".tr, + maxLines: 7, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(favoriteFoods: newValue)); + }, + ), SizedBox(height: 12.v), - _buildTextFormFieldUnfav(context), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 40.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapContinue(state, context), - // ); - // }, - // ), - // BlocBuilder( - // builder: (context, state) { - // return GestureDetector( - // onTap: onTapSkip(state, context), - // child: Text("skip".tr, style: theme.textTheme.bodyLarge), - // ); - // }, - // ), + Text("unfavorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI), + SizedBox(height: 2.v), + CustomTextFormField( + controller: unFavoriteFoodsController, + hintText: "enter_information".tr, + textInputAction: TextInputAction.done, + maxLines: 7, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(unfavoriteFoods: newValue)); + }, + ), ], ), ), ); } - - onTapSkip(FavoriteFoodsState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.favoriteFoodsModelObj!.userRegistrationSheet; - GoRouter.of(context).goNamed('additionalInformationScreen', extra: sheet); - }; - } - - onTapContinue(FavoriteFoodsState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.favoriteFoodsModelObj!.userRegistrationSheet; - // sheet.favoriteFoods = state.favoriteFoodsController!.text; - // sheet.unfavoriteFoods = state.unfavoriteFoodsController!.text; - GoRouter.of(context).goNamed('additionalInformationScreen', extra: sheet); - }; - } - - - Function onTapBack(BuildContext context) { - return () { - onTapArrowLeft(context); - }; - } - - /// Section Widget - _buildTextFormFieldFav(BuildContext context) { - return Column( - children: [ - Text("favorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.favoriteFoodsController, - builder: (context, favoriteFoodsController) { - return CustomTextFormField(controller: favoriteFoodsController, hintText: "enter_information".tr, maxLines: 7); - }, - ), - ], - ); - } - - /// Section Widget - _buildTextFormFieldUnfav(BuildContext context) { - return Column( - children: [ - Text("unfavorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.unfavoriteFoodsController, - builder: (context, unfavoriteFoodsController) { - return CustomTextFormField( - controller: unfavoriteFoodsController, - hintText: "enter_information".tr, - textInputAction: TextInputAction.done, - maxLines: 7, - ); - }, - ), - ], - ); - } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } - - /// Navigates to the scheduleScreen when the action is triggered. - navigateToAdditionalInformationScreen(BuildContext context) { - GoRouter.of(context).goNamed('additionalInformationScreen'); - } } diff --git a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart index fd3a42fb..86c7d24e 100644 --- a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart @@ -1,8 +1,4 @@ -import 'package:go_router/go_router.dart'; - -import 'bloc/favorite_sports_bloc.dart'; -// ignore: unused_import -import 'models/favorite_sports_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; @@ -18,6 +14,14 @@ class FavoriteSportsScreen extends StatefulWidget { } class _FavoriteSportsScreenState extends State { + final enterInformationController = TextEditingController(); + + @override + void initState() { + super.initState(); + enterInformationController.text = widget.sheet.aboutSportHobbies; + } + @override Widget build(BuildContext context) { return SingleChildScrollView( @@ -30,76 +34,21 @@ class _FavoriteSportsScreenState extends State { children: [ Text("your_favorite_sports".tr, style: theme.textTheme.headlineSmall), SizedBox(height: 22.v), - _buildTextFormFieldSection(context), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapContinue(state, context), - // ); - // }, - // ), - // BlocBuilder( - // builder: (context, state) { - // return GestureDetector( - // onTap: onTapSkip(state, context), - // child: Text("skip".tr, style: theme.textTheme.bodyLarge), - // ); - // }, - // ), + Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), + SizedBox(height: 2.v), + CustomTextFormField( + controller: enterInformationController, + hintText: "Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!", + textInputAction: TextInputAction.done, + maxLines: 8, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(aboutSportHobbies: newValue)); + }, + ), ], ), ), ); } - - onTapSkip(FavoriteSportsState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.favoriteSportsModelObj!.userRegistrationSheet; - GoRouter.of(context).goNamed('favoriteFoodsScreen', extra: sheet); - }; - } - - onTapContinue(FavoriteSportsState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.favoriteSportsModelObj!.userRegistrationSheet; - // sheet.aboutSportHobbies = state.enterinformationController!.text; - GoRouter.of(context).goNamed('favoriteFoodsScreen', extra: sheet); - }; - } - - - Function onTapBack(BuildContext context) { - return () { - onTapArrowLeft(context); - }; - } - - /// Section Widget - _buildTextFormFieldSection(BuildContext context) { - return Column( - children: [ - Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.enterinformationController, - builder: (context, enterinformationController) { - return CustomTextFormField( - controller: enterinformationController, - hintText: - "Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!", - textInputAction: TextInputAction.done, - maxLines: 8, - ); - }, - ), - ], - ); - } - - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } } diff --git a/lib/presentation/registration/height_screen/height_screen.dart b/lib/presentation/registration/height_screen/height_screen.dart index a41dad92..9936418e 100644 --- a/lib/presentation/registration/height_screen/height_screen.dart +++ b/lib/presentation/registration/height_screen/height_screen.dart @@ -1,6 +1,4 @@ -import 'package:go_router/go_router.dart'; - -import 'bloc/height_bloc.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/services.dart'; @@ -17,6 +15,14 @@ class HeightScreen extends StatefulWidget { } class _HeightScreenState extends State { + final heightController = TextEditingController(); + + @override + void initState() { + super.initState(); + heightController.text = widget.sheet.height; + } + @override Widget build(BuildContext context) { return SingleChildScrollView( @@ -38,17 +44,17 @@ class _HeightScreenState extends State { style: theme.textTheme.bodyLarge, ), SizedBox(height: 4.v), - BlocBuilder( - builder: (context, state) { - return CustomTextFormField( - width: 150.h, - textInputAction: TextInputAction.done, - controller: state.heightController, - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], - ); + CustomTextFormField( + width: 150.h, + textInputAction: TextInputAction.done, + controller: heightController, + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(height: newValue)); }, ), ], @@ -58,22 +64,4 @@ class _HeightScreenState extends State { ), ); } - - onTapNext(HeightState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.heightModelObj!.userRegistrationSheet; - GoRouter.of(context).goNamed('bloodPressureScreen', extra: sheet); - }; - } - - Function onTapBack(BuildContext context) { - return () { - onTapArrowLeft(context); - }; - } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } } diff --git a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart index 5ccc203e..1e6f4ff3 100644 --- a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart @@ -1,6 +1,4 @@ -import 'package:go_router/go_router.dart'; - -import 'bloc/medicine_intake_bloc.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; @@ -16,6 +14,14 @@ class MedicineIntakeScreen extends StatefulWidget { } class _MedicineIntakeScreenState extends State { + final enterInformationController = TextEditingController(); + + @override + void initState() { + super.initState(); + enterInformationController.text = widget.sheet.aboutTakingPils; + } + @override Widget build(BuildContext context) { return SingleChildScrollView( @@ -36,83 +42,22 @@ class _MedicineIntakeScreenState extends State { style: theme.textTheme.headlineSmall, ), ), - SizedBox(height: 86.v), - _buildTextFormField(context), - // BlocBuilder( - // builder: (context, state) { - // return NextStepButton( - // text: "continue".tr.toUpperCase(), - // margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - // buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - // onPressed: onTapNext(state, context), - // ); - // }, - // ), - // BlocBuilder( - // builder: (context, state) { - // return GestureDetector( - // onTap: onTapSkip(state, context), - // child: Text("skip".tr, style: theme.textTheme.bodyLarge), - // ); - // }, - // ), + SizedBox(height: 16.v), + Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), + SizedBox(height: 2.v), + CustomTextFormField( + controller: enterInformationController, + hintText: "enter_information".tr, + textInputAction: TextInputAction.done, + maxLines: 8, + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(aboutTakingPils: newValue)); + }, + ), ], ), ), ); } - - onTapSkip(MedicineIntakeState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.medicineIntakeModelObj!.userRegistrationSheet; - GoRouter.of(context).goNamed( - 'favoriteSportsScreen', - extra: sheet, - ); - }; - } - - onTapNext(MedicineIntakeState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.medicineIntakeModelObj!.userRegistrationSheet; - // sheet.aboutTakingPils = state.enterInformationController!.text; - GoRouter.of(context).goNamed( - 'favoriteSportsScreen', - extra: sheet, - ); - }; - } - - - Function onTapBack(BuildContext context) { - return () { - onTapArrowLeft(context); - }; - } - - /// Section Widget - _buildTextFormField(BuildContext context) { - return Column( - children: [ - Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.enterInformationController, - builder: (context, enterInformationController) { - return CustomTextFormField( - controller: enterInformationController, - hintText: "enter_information".tr, - textInputAction: TextInputAction.done, - maxLines: 8, - ); - }, - ), - ], - ); - } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } } diff --git a/lib/presentation/registration/weight_screen/weight_screen.dart b/lib/presentation/registration/weight_screen/weight_screen.dart index f65f0f3d..a8a59ca2 100644 --- a/lib/presentation/registration/weight_screen/weight_screen.dart +++ b/lib/presentation/registration/weight_screen/weight_screen.dart @@ -1,75 +1,67 @@ -import 'package:go_router/go_router.dart'; - -import 'bloc/weight_bloc.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/services.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; -class WeightScreen extends StatelessWidget { +class WeightScreen extends StatefulWidget { final UserRegistrationSheet sheet; const WeightScreen({super.key, required this.sheet}); + @override + State createState() => _WeightScreenState(); +} + +class _WeightScreenState extends State { + final weightController = TextEditingController(); + + @override + void initState() { + super.initState(); + weightController.text = widget.sheet.weight; + } + @override Widget build(BuildContext context) { return SingleChildScrollView( padding: EdgeInsets.only(bottom: 80), child: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column( - children: [ - Text( - "weight_measurements".tr, - style: theme.textTheme.headlineSmall, - ), - SizedBox(height: 16.v), - Column( - children: [ - Text( - "your_weight".tr, - style: theme.textTheme.bodyLarge, - ), - SizedBox(height: 4.v), - BlocBuilder( - builder: (context, state) { - return CustomTextFormField( - width: 150.h, - textInputAction: TextInputAction.done, - controller: state.weightController, - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], - ); - }, - ), - ], - ), - ], - ), + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + Text( + "weight_measurements".tr, + style: theme.textTheme.headlineSmall, + ), + SizedBox(height: 16.v), + Column( + children: [ + Text( + "your_weight".tr, + style: theme.textTheme.bodyLarge, + ), + SizedBox(height: 4.v), + CustomTextFormField( + width: 150.h, + textInputAction: TextInputAction.done, + controller: weightController, + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], + onChanged: (newValue) { + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(weight: newValue)); + }, + ), + ], + ), + ], + ), ), ); } - - onTapNext(WeightState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.weightModelObj!.userRegistrationSheet; - GoRouter.of(context).goNamed('heightScreen', extra: sheet); - }; - } - - - Function onTapBack(BuildContext context) { - return () { - onTapArrowLeft(context); - }; - } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } } From 726b74a236bf52ac2698c41648d233f22ffc54f0 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 15 Jul 2024 16:33:33 +0300 Subject: [PATCH 19/21] feature(registration): iter6 --- .env | 3 +- .../user_registration_model.dart | 24 +- .../user_registration_model.freezed.dart | 177 ++- .../user_registration_model.g.dart | 25 +- .../registration/consts/cities_list.dart} | 159 +-- .../registration_cubit.dart | 35 +- .../pages}/additional_information_screen.dart | 0 .../presentation/pages}/allergies_screen.dart | 0 .../pages}/blood_pressure_screen.dart | 22 +- .../pages}/body_circumferences_screen.dart | 12 +- .../pages/city_of_living_screen.dart | 88 ++ .../pages}/credentials_screen.dart | 0 .../pages}/date_of_birth_screen.dart | 0 .../pages}/favorite_foods_screen.dart | 0 .../pages}/favorite_sports_screen.dart | 0 .../presentation/pages}/gender_screen.dart | 0 .../presentation/pages}/height_screen.dart | 4 +- .../pages}/language_select_screen.dart | 0 .../pages}/medicine_intake_screen.dart | 0 .../presentation/pages}/name_screen.dart | 0 .../pages/registration_screen.dart | 46 +- .../presentation/pages}/weight_screen.dart | 4 +- .../repositories/registration_repository.dart | 4 +- .../services/registration_service.dart | 3 +- .../services/registration_service.g.dart | 5 +- .../auth/auth_screen/auth_screen.dart | 115 +- .../bloc/additional_information_bloc.dart | 22 - .../bloc/additional_information_event.dart | 16 - .../bloc/additional_information_state.dart | 31 - .../models/additional_information_model.dart | 20 - .../allergies_screen/bloc/allergies_bloc.dart | 20 - .../bloc/allergies_event.dart | 16 - .../bloc/allergies_state.dart | 31 - .../models/allergies_model.dart | 20 - .../app_navigation_screen.dart | 233 ---- .../bloc/app_navigation_bloc.dart | 18 - .../bloc/app_navigation_event.dart | 16 - .../bloc/app_navigation_state.dart | 21 - .../models/app_navigation_model.dart | 16 - .../bloc/blood_pressure_bloc.dart | 72 - .../bloc/blood_pressure_event.dart | 39 - .../bloc/blood_pressure_state.dart | 50 - .../models/blood_pressure_model.dart | 25 - .../bloc/body_circumferences_bloc.dart | 25 - .../bloc/body_circumferences_event.dart | 16 - .../bloc/body_circumferences_state.dart | 46 - .../models/body_circumferences_model.dart | 20 - .../bloc/city_of_living_bloc.dart | 37 - .../bloc/city_of_living_event.dart | 28 - .../bloc/city_of_living_state.dart | 37 - .../models/city_of_living_model.dart | 1153 ----------------- .../bloc/credentials_bloc.dart | 24 - .../bloc/credentials_event.dart | 16 - .../bloc/credentials_state.dart | 49 - .../models/credentials_model.dart | 22 - .../bloc/date_of_birth_bloc.dart | 18 - .../bloc/date_of_birth_event.dart | 16 - .../bloc/date_of_birth_state.dart | 20 - .../models/date_of_birth_model.dart | 21 - .../bloc/favorite_foods_bloc.dart | 22 - .../bloc/favorite_foods_event.dart | 16 - .../bloc/favorite_foods_state.dart | 39 - .../models/favorite_foods_model.dart | 20 - .../bloc/favorite_sports_bloc.dart | 21 - .../bloc/favorite_sports_event.dart | 16 - .../bloc/favorite_sports_state.dart | 32 - .../models/favorite_sports_model.dart | 20 - .../gender_screen/bloc/gender_bloc.dart | 29 - .../gender_screen/bloc/gender_event.dart | 26 - .../gender_screen/bloc/gender_state.dart | 30 - .../gender_screen/models/gender_model.dart | 20 - .../height_screen/bloc/height_bloc.dart | 22 - .../height_screen/bloc/height_event.dart | 16 - .../height_screen/bloc/height_state.dart | 30 - .../height_screen/models/height_model.dart | 25 - .../bloc/language_select_bloc.dart | 35 - .../bloc/language_select_event.dart | 28 - .../bloc/language_select_state.dart | 32 - .../models/language_select_model.dart | 51 - .../bloc/medicine_intake_bloc.dart | 21 - .../bloc/medicine_intake_event.dart | 16 - .../bloc/medicine_intake_state.dart | 32 - .../models/medicine_intake_model.dart | 20 - .../name_screen/bloc/name_bloc.dart | 22 - .../name_screen/bloc/name_event.dart | 16 - .../name_screen/bloc/name_state.dart | 36 - .../name_screen/models/name_model.dart | 21 - .../splash_screen/bloc/splash_bloc.dart | 26 - .../splash_screen/bloc/splash_event.dart | 16 - .../splash_screen/bloc/splash_state.dart | 20 - .../splash_screen/models/splash_model.dart | 16 - .../splash_screen/splash_screen.dart | 36 - .../weight_screen/bloc/weight_bloc.dart | 22 - .../weight_screen/bloc/weight_event.dart | 16 - .../weight_screen/bloc/weight_state.dart | 30 - .../weight_screen/models/weight_model.dart | 25 - 96 files changed, 358 insertions(+), 3503 deletions(-) rename lib/{presentation/registration/city_of_living_screen/city_of_living_screen.dart => features/registration/consts/cities_list.dart} (79%) rename lib/{presentation/registration/additional_information_screen => features/registration/presentation/pages}/additional_information_screen.dart (100%) rename lib/{presentation/registration/allergies_screen => features/registration/presentation/pages}/allergies_screen.dart (100%) rename lib/{presentation/registration/blood_pressure_screen => features/registration/presentation/pages}/blood_pressure_screen.dart (89%) rename lib/{presentation/registration/body_circumferences_screen => features/registration/presentation/pages}/body_circumferences_screen.dart (85%) create mode 100644 lib/features/registration/presentation/pages/city_of_living_screen.dart rename lib/{presentation/registration/credentials_screen => features/registration/presentation/pages}/credentials_screen.dart (100%) rename lib/{presentation/registration/date_of_birth_screen => features/registration/presentation/pages}/date_of_birth_screen.dart (100%) rename lib/{presentation/registration/favorite_foods_screen => features/registration/presentation/pages}/favorite_foods_screen.dart (100%) rename lib/{presentation/registration/favorite_sports_screen => features/registration/presentation/pages}/favorite_sports_screen.dart (100%) rename lib/{presentation/registration/gender_screen => features/registration/presentation/pages}/gender_screen.dart (100%) rename lib/{presentation/registration/height_screen => features/registration/presentation/pages}/height_screen.dart (93%) rename lib/{presentation/registration/language_select_screen => features/registration/presentation/pages}/language_select_screen.dart (100%) rename lib/{presentation/registration/medicine_intake_screen => features/registration/presentation/pages}/medicine_intake_screen.dart (100%) rename lib/{presentation/registration/name_screen => features/registration/presentation/pages}/name_screen.dart (100%) rename lib/{presentation/registration/weight_screen => features/registration/presentation/pages}/weight_screen.dart (93%) delete mode 100644 lib/presentation/registration/additional_information_screen/bloc/additional_information_bloc.dart delete mode 100644 lib/presentation/registration/additional_information_screen/bloc/additional_information_event.dart delete mode 100644 lib/presentation/registration/additional_information_screen/bloc/additional_information_state.dart delete mode 100644 lib/presentation/registration/additional_information_screen/models/additional_information_model.dart delete mode 100644 lib/presentation/registration/allergies_screen/bloc/allergies_bloc.dart delete mode 100644 lib/presentation/registration/allergies_screen/bloc/allergies_event.dart delete mode 100644 lib/presentation/registration/allergies_screen/bloc/allergies_state.dart delete mode 100644 lib/presentation/registration/allergies_screen/models/allergies_model.dart delete mode 100644 lib/presentation/registration/app_navigation_screen/app_navigation_screen.dart delete mode 100644 lib/presentation/registration/app_navigation_screen/bloc/app_navigation_bloc.dart delete mode 100644 lib/presentation/registration/app_navigation_screen/bloc/app_navigation_event.dart delete mode 100644 lib/presentation/registration/app_navigation_screen/bloc/app_navigation_state.dart delete mode 100644 lib/presentation/registration/app_navigation_screen/models/app_navigation_model.dart delete mode 100644 lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart delete mode 100644 lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_event.dart delete mode 100644 lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_state.dart delete mode 100644 lib/presentation/registration/blood_pressure_screen/models/blood_pressure_model.dart delete mode 100644 lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_bloc.dart delete mode 100644 lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_event.dart delete mode 100644 lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_state.dart delete mode 100644 lib/presentation/registration/body_circumferences_screen/models/body_circumferences_model.dart delete mode 100644 lib/presentation/registration/city_of_living_screen/bloc/city_of_living_bloc.dart delete mode 100644 lib/presentation/registration/city_of_living_screen/bloc/city_of_living_event.dart delete mode 100644 lib/presentation/registration/city_of_living_screen/bloc/city_of_living_state.dart delete mode 100644 lib/presentation/registration/city_of_living_screen/models/city_of_living_model.dart delete mode 100644 lib/presentation/registration/credentials_screen/bloc/credentials_bloc.dart delete mode 100644 lib/presentation/registration/credentials_screen/bloc/credentials_event.dart delete mode 100644 lib/presentation/registration/credentials_screen/bloc/credentials_state.dart delete mode 100644 lib/presentation/registration/credentials_screen/models/credentials_model.dart delete mode 100644 lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_bloc.dart delete mode 100644 lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_event.dart delete mode 100644 lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_state.dart delete mode 100644 lib/presentation/registration/date_of_birth_screen/models/date_of_birth_model.dart delete mode 100644 lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_bloc.dart delete mode 100644 lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_event.dart delete mode 100644 lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_state.dart delete mode 100644 lib/presentation/registration/favorite_foods_screen/models/favorite_foods_model.dart delete mode 100644 lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_bloc.dart delete mode 100644 lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_event.dart delete mode 100644 lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_state.dart delete mode 100644 lib/presentation/registration/favorite_sports_screen/models/favorite_sports_model.dart delete mode 100644 lib/presentation/registration/gender_screen/bloc/gender_bloc.dart delete mode 100644 lib/presentation/registration/gender_screen/bloc/gender_event.dart delete mode 100644 lib/presentation/registration/gender_screen/bloc/gender_state.dart delete mode 100644 lib/presentation/registration/gender_screen/models/gender_model.dart delete mode 100644 lib/presentation/registration/height_screen/bloc/height_bloc.dart delete mode 100644 lib/presentation/registration/height_screen/bloc/height_event.dart delete mode 100644 lib/presentation/registration/height_screen/bloc/height_state.dart delete mode 100644 lib/presentation/registration/height_screen/models/height_model.dart delete mode 100644 lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart delete mode 100644 lib/presentation/registration/language_select_screen/bloc/language_select_event.dart delete mode 100644 lib/presentation/registration/language_select_screen/bloc/language_select_state.dart delete mode 100644 lib/presentation/registration/language_select_screen/models/language_select_model.dart delete mode 100644 lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_bloc.dart delete mode 100644 lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_event.dart delete mode 100644 lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_state.dart delete mode 100644 lib/presentation/registration/medicine_intake_screen/models/medicine_intake_model.dart delete mode 100644 lib/presentation/registration/name_screen/bloc/name_bloc.dart delete mode 100644 lib/presentation/registration/name_screen/bloc/name_event.dart delete mode 100644 lib/presentation/registration/name_screen/bloc/name_state.dart delete mode 100644 lib/presentation/registration/name_screen/models/name_model.dart delete mode 100644 lib/presentation/registration/splash_screen/bloc/splash_bloc.dart delete mode 100644 lib/presentation/registration/splash_screen/bloc/splash_event.dart delete mode 100644 lib/presentation/registration/splash_screen/bloc/splash_state.dart delete mode 100644 lib/presentation/registration/splash_screen/models/splash_model.dart delete mode 100644 lib/presentation/registration/splash_screen/splash_screen.dart delete mode 100644 lib/presentation/registration/weight_screen/bloc/weight_bloc.dart delete mode 100644 lib/presentation/registration/weight_screen/bloc/weight_event.dart delete mode 100644 lib/presentation/registration/weight_screen/bloc/weight_state.dart delete mode 100644 lib/presentation/registration/weight_screen/models/weight_model.dart diff --git a/.env b/.env index e223a359..0f129f5c 100644 --- a/.env +++ b/.env @@ -1,2 +1,3 @@ SERVER_ROOT='https://mobile-stage.eatvio.ru/api' -STORAGE_URL='https://mobile-stage.eatvio.ru/storage/' \ No newline at end of file +STORAGE_URL='https://mobile-stage.eatvio.ru/storage/' +OFERTA='https://mobile-stage.eatvio.ru/oferta_bs.pdf' \ No newline at end of file diff --git a/lib/data/models/userRegistrationModel/user_registration_model.dart b/lib/data/models/userRegistrationModel/user_registration_model.dart index cae81cd1..686d2068 100644 --- a/lib/data/models/userRegistrationModel/user_registration_model.dart +++ b/lib/data/models/userRegistrationModel/user_registration_model.dart @@ -9,7 +9,7 @@ class UserRegistrationSheet with _$UserRegistrationSheet { required String name, @JsonKey(name: 'first_name') required String firstName, - @JsonKey(name: 'last') + @JsonKey(name: 'last_name') required String lastName, required String email, required String password, @@ -23,22 +23,22 @@ class UserRegistrationSheet with _$UserRegistrationSheet { required String country, required String city, required String lang, - required String weight, - required String height, + required int weight, + required int height, @JsonKey(name: 'chest_circumference') - required String chestCircumference, + required int chestCircumference, @JsonKey(name: 'waist_circumference') - required String waistCircumference, + required int waistCircumference, @JsonKey(name: 'hip_circumference') - required String hipCircumference, + required int hipCircumference, @JsonKey(name: 'blood_pressure_up') - required String bloodPressureUp, + required int bloodPressureUp, @JsonKey(name: 'blood_pressure_down') - required String bloodPressureDown, + required int bloodPressureDown, @JsonKey(name: 'has_hypo') - required String hasHypo, + required int hasHypo, @JsonKey(name: 'has_hyper') - required String hasHyper, + required int hasHyper, @JsonKey(name: 'about_alergy') required String aboutAllergy, @JsonKey(name: 'about_taking_pils') @@ -51,9 +51,9 @@ class UserRegistrationSheet with _$UserRegistrationSheet { required String unfavoriteFoods, @JsonKey(name: 'additional_info') required String additionalInfo, - @Default('1.2') + @Default(1.2) @JsonKey(name: 'activity_coefficient') - String activityCoefficient, + double activityCoefficient, }) = _UserRegistrationSheet; factory UserRegistrationSheet.fromJson(Map json) => _$UserRegistrationSheetFromJson(json); diff --git a/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart b/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart index 9d00a7dd..4aa91df8 100644 --- a/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart +++ b/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart @@ -24,7 +24,7 @@ mixin _$UserRegistrationSheet { String get name => throw _privateConstructorUsedError; @JsonKey(name: 'first_name') String get firstName => throw _privateConstructorUsedError; - @JsonKey(name: 'last') + @JsonKey(name: 'last_name') String get lastName => throw _privateConstructorUsedError; String get email => throw _privateConstructorUsedError; String get password => throw _privateConstructorUsedError; @@ -37,22 +37,22 @@ mixin _$UserRegistrationSheet { String get country => throw _privateConstructorUsedError; String get city => throw _privateConstructorUsedError; String get lang => throw _privateConstructorUsedError; - String get weight => throw _privateConstructorUsedError; - String get height => throw _privateConstructorUsedError; + int get weight => throw _privateConstructorUsedError; + int get height => throw _privateConstructorUsedError; @JsonKey(name: 'chest_circumference') - String get chestCircumference => throw _privateConstructorUsedError; + int get chestCircumference => throw _privateConstructorUsedError; @JsonKey(name: 'waist_circumference') - String get waistCircumference => throw _privateConstructorUsedError; + int get waistCircumference => throw _privateConstructorUsedError; @JsonKey(name: 'hip_circumference') - String get hipCircumference => throw _privateConstructorUsedError; + int get hipCircumference => throw _privateConstructorUsedError; @JsonKey(name: 'blood_pressure_up') - String get bloodPressureUp => throw _privateConstructorUsedError; + int get bloodPressureUp => throw _privateConstructorUsedError; @JsonKey(name: 'blood_pressure_down') - String get bloodPressureDown => throw _privateConstructorUsedError; + int get bloodPressureDown => throw _privateConstructorUsedError; @JsonKey(name: 'has_hypo') - String get hasHypo => throw _privateConstructorUsedError; + int get hasHypo => throw _privateConstructorUsedError; @JsonKey(name: 'has_hyper') - String get hasHyper => throw _privateConstructorUsedError; + int get hasHyper => throw _privateConstructorUsedError; @JsonKey(name: 'about_alergy') String get aboutAllergy => throw _privateConstructorUsedError; @JsonKey(name: 'about_taking_pils') @@ -66,7 +66,7 @@ mixin _$UserRegistrationSheet { @JsonKey(name: 'additional_info') String get additionalInfo => throw _privateConstructorUsedError; @JsonKey(name: 'activity_coefficient') - String get activityCoefficient => throw _privateConstructorUsedError; + double get activityCoefficient => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -83,7 +83,7 @@ abstract class $UserRegistrationSheetCopyWith<$Res> { $Res call( {String name, @JsonKey(name: 'first_name') String firstName, - @JsonKey(name: 'last') String lastName, + @JsonKey(name: 'last_name') String lastName, String email, String password, @JsonKey(name: 'password_confirmation') String passwordConfirmation, @@ -93,22 +93,22 @@ abstract class $UserRegistrationSheetCopyWith<$Res> { String country, String city, String lang, - String weight, - String height, - @JsonKey(name: 'chest_circumference') String chestCircumference, - @JsonKey(name: 'waist_circumference') String waistCircumference, - @JsonKey(name: 'hip_circumference') String hipCircumference, - @JsonKey(name: 'blood_pressure_up') String bloodPressureUp, - @JsonKey(name: 'blood_pressure_down') String bloodPressureDown, - @JsonKey(name: 'has_hypo') String hasHypo, - @JsonKey(name: 'has_hyper') String hasHyper, + int weight, + int height, + @JsonKey(name: 'chest_circumference') int chestCircumference, + @JsonKey(name: 'waist_circumference') int waistCircumference, + @JsonKey(name: 'hip_circumference') int hipCircumference, + @JsonKey(name: 'blood_pressure_up') int bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') int bloodPressureDown, + @JsonKey(name: 'has_hypo') int hasHypo, + @JsonKey(name: 'has_hyper') int hasHyper, @JsonKey(name: 'about_alergy') String aboutAllergy, @JsonKey(name: 'about_taking_pils') String aboutTakingPils, @JsonKey(name: 'about_sport_hobbies') String aboutSportHobbies, @JsonKey(name: 'favorite_foods') String favoriteFoods, @JsonKey(name: 'unfavorite_foods') String unfavoriteFoods, @JsonKey(name: 'additional_info') String additionalInfo, - @JsonKey(name: 'activity_coefficient') String activityCoefficient}); + @JsonKey(name: 'activity_coefficient') double activityCoefficient}); } /// @nodoc @@ -206,39 +206,39 @@ class _$UserRegistrationSheetCopyWithImpl<$Res, weight: null == weight ? _value.weight : weight // ignore: cast_nullable_to_non_nullable - as String, + as int, height: null == height ? _value.height : height // ignore: cast_nullable_to_non_nullable - as String, + as int, chestCircumference: null == chestCircumference ? _value.chestCircumference : chestCircumference // ignore: cast_nullable_to_non_nullable - as String, + as int, waistCircumference: null == waistCircumference ? _value.waistCircumference : waistCircumference // ignore: cast_nullable_to_non_nullable - as String, + as int, hipCircumference: null == hipCircumference ? _value.hipCircumference : hipCircumference // ignore: cast_nullable_to_non_nullable - as String, + as int, bloodPressureUp: null == bloodPressureUp ? _value.bloodPressureUp : bloodPressureUp // ignore: cast_nullable_to_non_nullable - as String, + as int, bloodPressureDown: null == bloodPressureDown ? _value.bloodPressureDown : bloodPressureDown // ignore: cast_nullable_to_non_nullable - as String, + as int, hasHypo: null == hasHypo ? _value.hasHypo : hasHypo // ignore: cast_nullable_to_non_nullable - as String, + as int, hasHyper: null == hasHyper ? _value.hasHyper : hasHyper // ignore: cast_nullable_to_non_nullable - as String, + as int, aboutAllergy: null == aboutAllergy ? _value.aboutAllergy : aboutAllergy // ignore: cast_nullable_to_non_nullable @@ -266,7 +266,7 @@ class _$UserRegistrationSheetCopyWithImpl<$Res, activityCoefficient: null == activityCoefficient ? _value.activityCoefficient : activityCoefficient // ignore: cast_nullable_to_non_nullable - as String, + as double, ) as $Val); } } @@ -283,7 +283,7 @@ abstract class _$$UserRegistrationSheetImplCopyWith<$Res> $Res call( {String name, @JsonKey(name: 'first_name') String firstName, - @JsonKey(name: 'last') String lastName, + @JsonKey(name: 'last_name') String lastName, String email, String password, @JsonKey(name: 'password_confirmation') String passwordConfirmation, @@ -293,22 +293,22 @@ abstract class _$$UserRegistrationSheetImplCopyWith<$Res> String country, String city, String lang, - String weight, - String height, - @JsonKey(name: 'chest_circumference') String chestCircumference, - @JsonKey(name: 'waist_circumference') String waistCircumference, - @JsonKey(name: 'hip_circumference') String hipCircumference, - @JsonKey(name: 'blood_pressure_up') String bloodPressureUp, - @JsonKey(name: 'blood_pressure_down') String bloodPressureDown, - @JsonKey(name: 'has_hypo') String hasHypo, - @JsonKey(name: 'has_hyper') String hasHyper, + int weight, + int height, + @JsonKey(name: 'chest_circumference') int chestCircumference, + @JsonKey(name: 'waist_circumference') int waistCircumference, + @JsonKey(name: 'hip_circumference') int hipCircumference, + @JsonKey(name: 'blood_pressure_up') int bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') int bloodPressureDown, + @JsonKey(name: 'has_hypo') int hasHypo, + @JsonKey(name: 'has_hyper') int hasHyper, @JsonKey(name: 'about_alergy') String aboutAllergy, @JsonKey(name: 'about_taking_pils') String aboutTakingPils, @JsonKey(name: 'about_sport_hobbies') String aboutSportHobbies, @JsonKey(name: 'favorite_foods') String favoriteFoods, @JsonKey(name: 'unfavorite_foods') String unfavoriteFoods, @JsonKey(name: 'additional_info') String additionalInfo, - @JsonKey(name: 'activity_coefficient') String activityCoefficient}); + @JsonKey(name: 'activity_coefficient') double activityCoefficient}); } /// @nodoc @@ -404,39 +404,39 @@ class __$$UserRegistrationSheetImplCopyWithImpl<$Res> weight: null == weight ? _value.weight : weight // ignore: cast_nullable_to_non_nullable - as String, + as int, height: null == height ? _value.height : height // ignore: cast_nullable_to_non_nullable - as String, + as int, chestCircumference: null == chestCircumference ? _value.chestCircumference : chestCircumference // ignore: cast_nullable_to_non_nullable - as String, + as int, waistCircumference: null == waistCircumference ? _value.waistCircumference : waistCircumference // ignore: cast_nullable_to_non_nullable - as String, + as int, hipCircumference: null == hipCircumference ? _value.hipCircumference : hipCircumference // ignore: cast_nullable_to_non_nullable - as String, + as int, bloodPressureUp: null == bloodPressureUp ? _value.bloodPressureUp : bloodPressureUp // ignore: cast_nullable_to_non_nullable - as String, + as int, bloodPressureDown: null == bloodPressureDown ? _value.bloodPressureDown : bloodPressureDown // ignore: cast_nullable_to_non_nullable - as String, + as int, hasHypo: null == hasHypo ? _value.hasHypo : hasHypo // ignore: cast_nullable_to_non_nullable - as String, + as int, hasHyper: null == hasHyper ? _value.hasHyper : hasHyper // ignore: cast_nullable_to_non_nullable - as String, + as int, aboutAllergy: null == aboutAllergy ? _value.aboutAllergy : aboutAllergy // ignore: cast_nullable_to_non_nullable @@ -464,7 +464,7 @@ class __$$UserRegistrationSheetImplCopyWithImpl<$Res> activityCoefficient: null == activityCoefficient ? _value.activityCoefficient : activityCoefficient // ignore: cast_nullable_to_non_nullable - as String, + as double, )); } } @@ -475,7 +475,7 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { const _$UserRegistrationSheetImpl( {required this.name, @JsonKey(name: 'first_name') required this.firstName, - @JsonKey(name: 'last') required this.lastName, + @JsonKey(name: 'last_name') required this.lastName, required this.email, required this.password, @JsonKey(name: 'password_confirmation') @@ -501,7 +501,7 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { @JsonKey(name: 'favorite_foods') required this.favoriteFoods, @JsonKey(name: 'unfavorite_foods') required this.unfavoriteFoods, @JsonKey(name: 'additional_info') required this.additionalInfo, - @JsonKey(name: 'activity_coefficient') this.activityCoefficient = '1.2'}); + @JsonKey(name: 'activity_coefficient') this.activityCoefficient = 1.2}); factory _$UserRegistrationSheetImpl.fromJson(Map json) => _$$UserRegistrationSheetImplFromJson(json); @@ -512,7 +512,7 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { @JsonKey(name: 'first_name') final String firstName; @override - @JsonKey(name: 'last') + @JsonKey(name: 'last_name') final String lastName; @override final String email; @@ -535,30 +535,30 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { @override final String lang; @override - final String weight; + final int weight; @override - final String height; + final int height; @override @JsonKey(name: 'chest_circumference') - final String chestCircumference; + final int chestCircumference; @override @JsonKey(name: 'waist_circumference') - final String waistCircumference; + final int waistCircumference; @override @JsonKey(name: 'hip_circumference') - final String hipCircumference; + final int hipCircumference; @override @JsonKey(name: 'blood_pressure_up') - final String bloodPressureUp; + final int bloodPressureUp; @override @JsonKey(name: 'blood_pressure_down') - final String bloodPressureDown; + final int bloodPressureDown; @override @JsonKey(name: 'has_hypo') - final String hasHypo; + final int hasHypo; @override @JsonKey(name: 'has_hyper') - final String hasHyper; + final int hasHyper; @override @JsonKey(name: 'about_alergy') final String aboutAllergy; @@ -579,7 +579,7 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { final String additionalInfo; @override @JsonKey(name: 'activity_coefficient') - final String activityCoefficient; + final double activityCoefficient; @override String toString() { @@ -693,7 +693,7 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { const factory _UserRegistrationSheet( {required final String name, @JsonKey(name: 'first_name') required final String firstName, - @JsonKey(name: 'last') required final String lastName, + @JsonKey(name: 'last_name') required final String lastName, required final String email, required final String password, @JsonKey(name: 'password_confirmation') @@ -704,19 +704,18 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { required final String country, required final String city, required final String lang, - required final String weight, - required final String height, + required final int weight, + required final int height, @JsonKey(name: 'chest_circumference') - required final String chestCircumference, + required final int chestCircumference, @JsonKey(name: 'waist_circumference') - required final String waistCircumference, - @JsonKey(name: 'hip_circumference') - required final String hipCircumference, - @JsonKey(name: 'blood_pressure_up') required final String bloodPressureUp, + required final int waistCircumference, + @JsonKey(name: 'hip_circumference') required final int hipCircumference, + @JsonKey(name: 'blood_pressure_up') required final int bloodPressureUp, @JsonKey(name: 'blood_pressure_down') - required final String bloodPressureDown, - @JsonKey(name: 'has_hypo') required final String hasHypo, - @JsonKey(name: 'has_hyper') required final String hasHyper, + required final int bloodPressureDown, + @JsonKey(name: 'has_hypo') required final int hasHypo, + @JsonKey(name: 'has_hyper') required final int hasHyper, @JsonKey(name: 'about_alergy') required final String aboutAllergy, @JsonKey(name: 'about_taking_pils') required final String aboutTakingPils, @JsonKey(name: 'about_sport_hobbies') @@ -725,7 +724,7 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { @JsonKey(name: 'unfavorite_foods') required final String unfavoriteFoods, @JsonKey(name: 'additional_info') required final String additionalInfo, @JsonKey(name: 'activity_coefficient') - final String activityCoefficient}) = _$UserRegistrationSheetImpl; + final double activityCoefficient}) = _$UserRegistrationSheetImpl; factory _UserRegistrationSheet.fromJson(Map json) = _$UserRegistrationSheetImpl.fromJson; @@ -736,7 +735,7 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { @JsonKey(name: 'first_name') String get firstName; @override - @JsonKey(name: 'last') + @JsonKey(name: 'last_name') String get lastName; @override String get email; @@ -759,30 +758,30 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { @override String get lang; @override - String get weight; + int get weight; @override - String get height; + int get height; @override @JsonKey(name: 'chest_circumference') - String get chestCircumference; + int get chestCircumference; @override @JsonKey(name: 'waist_circumference') - String get waistCircumference; + int get waistCircumference; @override @JsonKey(name: 'hip_circumference') - String get hipCircumference; + int get hipCircumference; @override @JsonKey(name: 'blood_pressure_up') - String get bloodPressureUp; + int get bloodPressureUp; @override @JsonKey(name: 'blood_pressure_down') - String get bloodPressureDown; + int get bloodPressureDown; @override @JsonKey(name: 'has_hypo') - String get hasHypo; + int get hasHypo; @override @JsonKey(name: 'has_hyper') - String get hasHyper; + int get hasHyper; @override @JsonKey(name: 'about_alergy') String get aboutAllergy; @@ -803,7 +802,7 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { String get additionalInfo; @override @JsonKey(name: 'activity_coefficient') - String get activityCoefficient; + double get activityCoefficient; @override @JsonKey(ignore: true) _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> diff --git a/lib/data/models/userRegistrationModel/user_registration_model.g.dart b/lib/data/models/userRegistrationModel/user_registration_model.g.dart index 8eafe710..132240b7 100644 --- a/lib/data/models/userRegistrationModel/user_registration_model.g.dart +++ b/lib/data/models/userRegistrationModel/user_registration_model.g.dart @@ -11,7 +11,7 @@ _$UserRegistrationSheetImpl _$$UserRegistrationSheetImplFromJson( _$UserRegistrationSheetImpl( name: json['name'] as String, firstName: json['first_name'] as String, - lastName: json['last'] as String, + lastName: json['last_name'] as String, email: json['email'] as String, password: json['password'] as String, passwordConfirmation: json['password_confirmation'] as String, @@ -21,22 +21,23 @@ _$UserRegistrationSheetImpl _$$UserRegistrationSheetImplFromJson( country: json['country'] as String, city: json['city'] as String, lang: json['lang'] as String, - weight: json['weight'] as String, - height: json['height'] as String, - chestCircumference: json['chest_circumference'] as String, - waistCircumference: json['waist_circumference'] as String, - hipCircumference: json['hip_circumference'] as String, - bloodPressureUp: json['blood_pressure_up'] as String, - bloodPressureDown: json['blood_pressure_down'] as String, - hasHypo: json['has_hypo'] as String, - hasHyper: json['has_hyper'] as String, + weight: (json['weight'] as num).toInt(), + height: (json['height'] as num).toInt(), + chestCircumference: (json['chest_circumference'] as num).toInt(), + waistCircumference: (json['waist_circumference'] as num).toInt(), + hipCircumference: (json['hip_circumference'] as num).toInt(), + bloodPressureUp: (json['blood_pressure_up'] as num).toInt(), + bloodPressureDown: (json['blood_pressure_down'] as num).toInt(), + hasHypo: (json['has_hypo'] as num).toInt(), + hasHyper: (json['has_hyper'] as num).toInt(), aboutAllergy: json['about_alergy'] as String, aboutTakingPils: json['about_taking_pils'] as String, aboutSportHobbies: json['about_sport_hobbies'] as String, favoriteFoods: json['favorite_foods'] as String, unfavoriteFoods: json['unfavorite_foods'] as String, additionalInfo: json['additional_info'] as String, - activityCoefficient: json['activity_coefficient'] as String? ?? '1.2', + activityCoefficient: + (json['activity_coefficient'] as num?)?.toDouble() ?? 1.2, ); Map _$$UserRegistrationSheetImplToJson( @@ -44,7 +45,7 @@ Map _$$UserRegistrationSheetImplToJson( { 'name': instance.name, 'first_name': instance.firstName, - 'last': instance.lastName, + 'last_name': instance.lastName, 'email': instance.email, 'password': instance.password, 'password_confirmation': instance.passwordConfirmation, diff --git a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart b/lib/features/registration/consts/cities_list.dart similarity index 79% rename from lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart rename to lib/features/registration/consts/cities_list.dart index 1e5f01be..728024d5 100644 --- a/lib/presentation/registration/city_of_living_screen/city_of_living_screen.dart +++ b/lib/features/registration/consts/cities_list.dart @@ -1,159 +1,4 @@ -import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; -import 'package:go_router/go_router.dart'; - -import 'bloc/city_of_living_bloc.dart'; -import 'models/city_of_living_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/custom_drop_down.dart'; -import 'package:eatvio_app/widgets/custom_text_form_field.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:flutter/material.dart'; - -class CityOfLivingScreen extends StatefulWidget { - final UserRegistrationSheet sheet; - - const CityOfLivingScreen({super.key, required this.sheet}); - - @override - State createState() => _CityOfLivingScreenState(); -} - -class _CityOfLivingScreenState extends State { - @override - Widget build(BuildContext context) { - return BlocProvider( - create: (BuildContext context) => - CityOfLivingBloc(CityOfLivingState(cityOfLivingModelObj: CityOfLivingModel(userRegistrationSheet: widget.sheet)))..add(CityOfLivingInitialEvent()), - child: SingleChildScrollView( - padding: EdgeInsets.only(bottom: 80), - child: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column( - children: [ - Text("place_of_living".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 39.v), - Text("country".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.cityOfLivingModelObj, - builder: (context, cityOfLivingModelObj) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), - child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), - ), - hintText: "Не выбрано".tr, - items: cityOfLivingModelObj?.dropdownItemList ?? [], - onChanged: onDropDownChange(context), - ); - }, - ), - SizedBox(height: 22.v), - Text("Населенный пункт", style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocBuilder( - builder: (context, state) { - return RawAutocomplete( - optionsBuilder: (TextEditingValue textEditingValue) => _options.where((String option) { - return option.toLowerCase().startsWith(textEditingValue.text.toLowerCase()); - }), - fieldViewBuilder: ( - BuildContext context, - TextEditingController textEditingController, - FocusNode focusNode, - VoidCallback onFieldSubmitted, - ) { - return CustomTextFormField( - controller: textEditingController, - focusNode: focusNode, - onFieldSubmitted: (String value) => onFieldSubmitted(), - ); - }, - optionsViewBuilder: ( - BuildContext context, - AutocompleteOnSelected onSelected, - Iterable options, - ) { - return Align( - alignment: Alignment.topLeft, - child: Material( - elevation: 4.0, - child: SizedBox( - height: 200.0, - child: ListView.builder( - padding: const EdgeInsets.all(8.0), - itemCount: options.length, - itemBuilder: (BuildContext context, int index) { - final String option = options.elementAt(index); - return GestureDetector( - onTap: () => onSelected(option), - child: ListTile( - title: Text(option), - ), - ); - }, - ), - ), - ), - ); - }, - ); - }, - ), - ], - ), - ), - ), - ); - } - - onTapContinue(CityOfLivingState state, BuildContext context) { - return () { - UserRegistrationSheet sheet = state.cityOfLivingModelObj!.userRegistrationSheet; - GoRouter.of(context).goNamed('bodyCircumferencesScreen', extra: sheet); - }; - } - - onDropDownChange(BuildContext context) { - return (value) { - context.read().add(ChangeDropDownEvent(value: value)); - final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(country: value)); - }; - } - - Function onTapBack(BuildContext context) { - return () { - onTapArrowLeft(context); - }; - } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - GoRouter.of(context).pop(); - } -} - -selectProduct(AutocompleteOnSelected onSelected, String option, CityOfLivingState state, BuildContext context) { - state.cityController?.text = option; - final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(city: option)); - return () { - onSelected(option); - }; -} - -buildOptions(List _options) { - return (TextEditingValue textEditingValue) { - return _options.where((String option) { - return true; - }); - }; -} - -const List _options = const [ +const List citiesList = const [ "Абаза", "Абакан", "Абдулино", @@ -1271,4 +1116,4 @@ const List _options = const [ "Ясногорск", "Ясный", "Яхрома", -]; +]; \ No newline at end of file diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart index e882eadd..c39f8342 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart @@ -2,12 +2,43 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart'; import 'package:eatvio_app/features/registration/repositories/registration_repository.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart'; class RegistrationCubit extends Cubit { final RegistrationRepository registrationRepository; - RegistrationCubit({required this.registrationRepository}) : super(RegistrationState(sheet: LanguageSelectModel().userRegistrationSheet)); + RegistrationCubit({required this.registrationRepository}) + : super( + RegistrationState( + sheet: UserRegistrationSheet( + name: '', + firstName: '', + lastName: '', + email: '', + password: '', + passwordConfirmation: '', + birthdate: DateTime.now().toString(), + gender: '', + country: '', + city: '', + lang: 'Русский', + weight: 0, + height: 0, + chestCircumference: 0, + waistCircumference: 0, + hipCircumference: 0, + bloodPressureUp: 0, + bloodPressureDown: 0, + hasHypo: 0, + hasHyper: 0, + aboutAllergy: '', + aboutTakingPils: '', + aboutSportHobbies: '', + favoriteFoods: '', + unfavoriteFoods: '', + additionalInfo: '', + ), + ), + ); updateSheet(UserRegistrationSheet sheet) => emit(RegistrationState(sheet: sheet)); diff --git a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart b/lib/features/registration/presentation/pages/additional_information_screen.dart similarity index 100% rename from lib/presentation/registration/additional_information_screen/additional_information_screen.dart rename to lib/features/registration/presentation/pages/additional_information_screen.dart diff --git a/lib/presentation/registration/allergies_screen/allergies_screen.dart b/lib/features/registration/presentation/pages/allergies_screen.dart similarity index 100% rename from lib/presentation/registration/allergies_screen/allergies_screen.dart rename to lib/features/registration/presentation/pages/allergies_screen.dart diff --git a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart b/lib/features/registration/presentation/pages/blood_pressure_screen.dart similarity index 89% rename from lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart rename to lib/features/registration/presentation/pages/blood_pressure_screen.dart index 35669330..c4236663 100644 --- a/lib/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/features/registration/presentation/pages/blood_pressure_screen.dart @@ -22,7 +22,7 @@ class _BloodPressureScreenState extends State { title: "Да", ), SelectionPopupModel( - id: 2, + id: 0, title: "Нет", ), ]; @@ -39,14 +39,10 @@ class _BloodPressureScreenState extends State { super.initState(); selectedPopupHypo = selectionPopupList[1]; selectedPopupHyper = selectionPopupList[1]; - upPressureController.text = widget.sheet.bloodPressureUp; - downPressureController.text = widget.sheet.bloodPressureDown; - if (widget.sheet.hasHyper.isNotEmpty) { - widget.sheet.hasHyper == 'Да' ? selectedPopupHyper = selectionPopupList[0] : selectedPopupHyper = selectionPopupList[1]; - } - if (widget.sheet.hasHypo.isNotEmpty) { - widget.sheet.hasHypo == 'Да' ? selectedPopupHypo = selectionPopupList[0] : selectedPopupHypo = selectionPopupList[1]; - } + upPressureController.text = widget.sheet.bloodPressureUp.toString(); + downPressureController.text = widget.sheet.bloodPressureDown.toString(); + widget.sheet.hasHyper == '1' ? selectedPopupHyper = selectionPopupList[0] : selectedPopupHyper = selectionPopupList[1]; + widget.sheet.hasHypo == '1' ? selectedPopupHypo = selectionPopupList[0] : selectedPopupHypo = selectionPopupList[1]; } @override @@ -82,7 +78,7 @@ class _BloodPressureScreenState extends State { hintText: "90".tr, onChanged: (newValue) { final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureUp: newValue)); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureUp: int.parse(newValue))); }, ), ], @@ -102,7 +98,7 @@ class _BloodPressureScreenState extends State { hintText: "90".tr, onChanged: (newValue) { final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureDown: newValue)); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureDown: int.parse(newValue))); }, ), ], @@ -126,7 +122,7 @@ class _BloodPressureScreenState extends State { setState(() { selectedPopupHypo = newPopup; final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hasHypo: selectedPopupHypo.title)); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hasHypo: selectedPopupHypo.id!)); }); }, ), @@ -149,7 +145,7 @@ class _BloodPressureScreenState extends State { setState(() { selectedPopupHyper = newPopup; final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hasHyper: selectedPopupHyper.title)); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hasHyper: selectedPopupHyper.id!)); }); }, ), diff --git a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart b/lib/features/registration/presentation/pages/body_circumferences_screen.dart similarity index 85% rename from lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart rename to lib/features/registration/presentation/pages/body_circumferences_screen.dart index 60576c8e..06417c80 100644 --- a/lib/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/features/registration/presentation/pages/body_circumferences_screen.dart @@ -24,9 +24,9 @@ class _BodyCircumferencesScreenState extends State { @override void initState() { super.initState(); - chestCircumferenceController.text = widget.sheet.chestCircumference; - waistCircumferenceController.text = widget.sheet.waistCircumference; - hipCircumferenceController.text = widget.sheet.hipCircumference; + if (widget.sheet.chestCircumference != 0) chestCircumferenceController.text = widget.sheet.chestCircumference.toString(); + if (widget.sheet.waistCircumference != 0) waistCircumferenceController.text = widget.sheet.waistCircumference.toString(); + if (widget.sheet.hipCircumference != 0) hipCircumferenceController.text = widget.sheet.hipCircumference.toString(); } @override @@ -50,7 +50,7 @@ class _BodyCircumferencesScreenState extends State { hintText: "90".tr, onChanged: (value) { final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(chestCircumference: value)); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(chestCircumference: int.parse(value))); }, ), ], @@ -64,7 +64,7 @@ class _BodyCircumferencesScreenState extends State { hintText: "60".tr, onChanged: (value) { final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(waistCircumference: value)); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(waistCircumference: int.parse(value))); }, ), SizedBox(height: 21.v), @@ -77,7 +77,7 @@ class _BodyCircumferencesScreenState extends State { textInputAction: TextInputAction.done, onChanged: (value) { final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hipCircumference: value)); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hipCircumference: int.parse(value))); }, ), ], diff --git a/lib/features/registration/presentation/pages/city_of_living_screen.dart b/lib/features/registration/presentation/pages/city_of_living_screen.dart new file mode 100644 index 00000000..b183ec98 --- /dev/null +++ b/lib/features/registration/presentation/pages/city_of_living_screen.dart @@ -0,0 +1,88 @@ +import 'package:eatvio_app/features/registration/consts/cities_list.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/widgets/custom_drop_down.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_typeahead/flutter_typeahead.dart'; + +class CityOfLivingScreen extends StatefulWidget { + final UserRegistrationSheet sheet; + + const CityOfLivingScreen({super.key, required this.sheet}); + + @override + State createState() => _CityOfLivingScreenState(); +} + +class _CityOfLivingScreenState extends State { + final dropdownItemList = [ + SelectionPopupModel(id: 1, title: "Россия", isSelected: true), + ]; + + late SelectionPopupModel selectedItem; + final cityController = TextEditingController(); + + @override + void initState() { + super.initState(); + selectedItem = dropdownItemList[0]; + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(country: selectedItem.title)); + } + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + padding: EdgeInsets.only(bottom: 80), + child: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + Text("place_of_living".tr, style: theme.textTheme.headlineSmall), + SizedBox(height: 39.v), + Text("country".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)), + child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize), + ), + hintText: "Не выбрано".tr, + items: dropdownItemList, + value: selectedItem, + onChanged: (newValue) { + setState(() { + selectedItem = newValue; + }); + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(country: newValue.title)); + }, + ), + SizedBox(height: 22.v), + Text("Населенный пункт", style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + TypeAheadField( + controller: cityController, + itemBuilder: (BuildContext context, String item) { + return Text(item); + }, + onSelected: (item) { + setState(() { + cityController.text = item; + }); + final registrationCubit = context.read(); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(city: item)); + }, + suggestionsCallback: (query) { + return citiesList.where((country) => country.toLowerCase().contains(query.toLowerCase())).toList(); + }, + ), + ], + ), + ), + ); + } +} diff --git a/lib/presentation/registration/credentials_screen/credentials_screen.dart b/lib/features/registration/presentation/pages/credentials_screen.dart similarity index 100% rename from lib/presentation/registration/credentials_screen/credentials_screen.dart rename to lib/features/registration/presentation/pages/credentials_screen.dart diff --git a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart b/lib/features/registration/presentation/pages/date_of_birth_screen.dart similarity index 100% rename from lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart rename to lib/features/registration/presentation/pages/date_of_birth_screen.dart diff --git a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart b/lib/features/registration/presentation/pages/favorite_foods_screen.dart similarity index 100% rename from lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart rename to lib/features/registration/presentation/pages/favorite_foods_screen.dart diff --git a/lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart b/lib/features/registration/presentation/pages/favorite_sports_screen.dart similarity index 100% rename from lib/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart rename to lib/features/registration/presentation/pages/favorite_sports_screen.dart diff --git a/lib/presentation/registration/gender_screen/gender_screen.dart b/lib/features/registration/presentation/pages/gender_screen.dart similarity index 100% rename from lib/presentation/registration/gender_screen/gender_screen.dart rename to lib/features/registration/presentation/pages/gender_screen.dart diff --git a/lib/presentation/registration/height_screen/height_screen.dart b/lib/features/registration/presentation/pages/height_screen.dart similarity index 93% rename from lib/presentation/registration/height_screen/height_screen.dart rename to lib/features/registration/presentation/pages/height_screen.dart index 9936418e..a2f47e0e 100644 --- a/lib/presentation/registration/height_screen/height_screen.dart +++ b/lib/features/registration/presentation/pages/height_screen.dart @@ -20,7 +20,7 @@ class _HeightScreenState extends State { @override void initState() { super.initState(); - heightController.text = widget.sheet.height; + if (widget.sheet.height != 0) heightController.text = widget.sheet.height.toString(); } @override @@ -54,7 +54,7 @@ class _HeightScreenState extends State { ], onChanged: (newValue) { final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(height: newValue)); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(height: int.parse(newValue))); }, ), ], diff --git a/lib/presentation/registration/language_select_screen/language_select_screen.dart b/lib/features/registration/presentation/pages/language_select_screen.dart similarity index 100% rename from lib/presentation/registration/language_select_screen/language_select_screen.dart rename to lib/features/registration/presentation/pages/language_select_screen.dart diff --git a/lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart b/lib/features/registration/presentation/pages/medicine_intake_screen.dart similarity index 100% rename from lib/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart rename to lib/features/registration/presentation/pages/medicine_intake_screen.dart diff --git a/lib/presentation/registration/name_screen/name_screen.dart b/lib/features/registration/presentation/pages/name_screen.dart similarity index 100% rename from lib/presentation/registration/name_screen/name_screen.dart rename to lib/features/registration/presentation/pages/name_screen.dart diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index 074d67f8..30eb7591 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -1,22 +1,22 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/allergies_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/city_of_living_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/favorite_foods_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/height_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/name_screen.dart'; import 'package:eatvio_app/locator_service.dart'; -import 'package:eatvio_app/presentation/registration/additional_information_screen/additional_information_screen.dart'; -import 'package:eatvio_app/presentation/registration/allergies_screen/allergies_screen.dart'; -import 'package:eatvio_app/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart'; -import 'package:eatvio_app/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart'; -import 'package:eatvio_app/presentation/registration/city_of_living_screen/city_of_living_screen.dart'; -import 'package:eatvio_app/presentation/registration/credentials_screen/credentials_screen.dart'; -import 'package:eatvio_app/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart'; -import 'package:eatvio_app/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart'; -import 'package:eatvio_app/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart'; -import 'package:eatvio_app/presentation/registration/gender_screen/gender_screen.dart'; -import 'package:eatvio_app/presentation/registration/height_screen/height_screen.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/language_select_screen.dart'; -import 'package:eatvio_app/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart'; -import 'package:eatvio_app/presentation/registration/name_screen/name_screen.dart'; -import 'package:eatvio_app/presentation/registration/weight_screen/weight_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/additional_information_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/blood_pressure_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/body_circumferences_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/credentials_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/date_of_birth_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/favorite_sports_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/gender_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/language_select_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/medicine_intake_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/weight_screen.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -34,6 +34,7 @@ class _RegistrationScreenState extends State { double progressValue = 1 / 15; int step = 1; final pageController = PageController(); + final RegistrationCubit registrationCubit = sl(); _showPopDialog() { showDialog( @@ -63,7 +64,7 @@ class _RegistrationScreenState extends State { @override Widget build(BuildContext context) { return BlocProvider( - create: (BuildContext context) => sl(), + create: (BuildContext context) => registrationCubit, child: BlocBuilder( builder: (BuildContext context, RegistrationState state) { return PopScope( @@ -225,7 +226,10 @@ class _RegistrationScreenState extends State { return false; } case 3: - List errors = validateNameFields(state.sheet.firstName, state.sheet.lastName); + List errors = validateNameFields( + state.sheet.firstName.toString(), + state.sheet.lastName.toString(), + ); if (errors.isEmpty) { return true; } else { @@ -251,7 +255,11 @@ class _RegistrationScreenState extends State { return false; } case 7: - List errors = validateCircumferencesFields(state.sheet.chestCircumference, state.sheet.waistCircumference, state.sheet.hipCircumference); + List errors = validateCircumferencesFields( + state.sheet.chestCircumference.toString(), + state.sheet.waistCircumference.toString(), + state.sheet.hipCircumference.toString(), + ); if (errors.isEmpty) { return true; } else { @@ -277,7 +285,7 @@ class _RegistrationScreenState extends State { return false; } case 15: - context.read().tryRegistration(); + registrationCubit.tryRegistration(); return true; default: return true; diff --git a/lib/presentation/registration/weight_screen/weight_screen.dart b/lib/features/registration/presentation/pages/weight_screen.dart similarity index 93% rename from lib/presentation/registration/weight_screen/weight_screen.dart rename to lib/features/registration/presentation/pages/weight_screen.dart index a8a59ca2..6c64ad1f 100644 --- a/lib/presentation/registration/weight_screen/weight_screen.dart +++ b/lib/features/registration/presentation/pages/weight_screen.dart @@ -20,7 +20,7 @@ class _WeightScreenState extends State { @override void initState() { super.initState(); - weightController.text = widget.sheet.weight; + if (widget.sheet.weight != 0) weightController.text = widget.sheet.weight.toString(); } @override @@ -54,7 +54,7 @@ class _WeightScreenState extends State { ], onChanged: (newValue) { final registrationCubit = context.read(); - registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(weight: newValue)); + registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(weight: int.parse(newValue))); }, ), ], diff --git a/lib/features/registration/repositories/registration_repository.dart b/lib/features/registration/repositories/registration_repository.dart index bbaf43f3..86420946 100644 --- a/lib/features/registration/repositories/registration_repository.dart +++ b/lib/features/registration/repositories/registration_repository.dart @@ -8,9 +8,9 @@ class RegistrationRepository { tryRegister(UserRegistrationSheet sheet) async { try { - return await registrationService.register(sheet: sheet); + return await registrationService.register(sheet: sheet.copyWith(country: 'Россия', city: 'Москва').toJson()); } catch (e) { rethrow; } } -} \ No newline at end of file +} diff --git a/lib/features/registration/services/registration_service.dart b/lib/features/registration/services/registration_service.dart index f7c41ecb..9ff81080 100644 --- a/lib/features/registration/services/registration_service.dart +++ b/lib/features/registration/services/registration_service.dart @@ -1,5 +1,4 @@ import 'package:dio/dio.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:retrofit/retrofit.dart'; part 'registration_service.g.dart'; @@ -10,6 +9,6 @@ abstract class RegistrationService { @POST('/register') Future register({ - @Body() required UserRegistrationSheet sheet, + @Body() required Map sheet, }); } diff --git a/lib/features/registration/services/registration_service.g.dart b/lib/features/registration/services/registration_service.g.dart index 44140792..0a7fc8f5 100644 --- a/lib/features/registration/services/registration_service.g.dart +++ b/lib/features/registration/services/registration_service.g.dart @@ -19,11 +19,12 @@ class _RegistrationService implements RegistrationService { String? baseUrl; @override - Future register({required UserRegistrationSheet sheet}) async { + Future register({required Map sheet}) async { final _extra = {}; final queryParameters = {}; final _headers = {}; - final _data = sheet; + final _data = {}; + _data.addAll(sheet); await _dio.fetch(_setStreamType(Options( method: 'POST', headers: _headers, diff --git a/lib/presentation/auth/auth_screen/auth_screen.dart b/lib/presentation/auth/auth_screen/auth_screen.dart index c2990137..ad32b70f 100644 --- a/lib/presentation/auth/auth_screen/auth_screen.dart +++ b/lib/presentation/auth/auth_screen/auth_screen.dart @@ -1,5 +1,6 @@ import 'package:eatvio_app/core/token_storage.dart'; import 'package:go_router/go_router.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'bloc/auth_bloc.dart'; import 'models/auth_model.dart'; @@ -33,43 +34,46 @@ class AuthScreen extends StatelessWidget { Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); return Scaffold( - resizeToAvoidBottomInset: false, - appBar: _buildAppBar(context), - body: GestureDetector( - onTap: () => FocusScope.of(context).unfocus(), - child: Container( - width: double.maxFinite, - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ - SizedBox(height: 36.v), - Text("user_authorization".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 60.v), - Text("email".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.emailController, - builder: (context, emailController) { - return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done); - },), - SizedBox(height: 22.v), - Text("password".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 5.v), - BlocSelector( - selector: (state) => state.passwordController, - builder: (context, passwordController) { - return CustomTextFormField( - obscureText: true, - controller: passwordController, - ); - },), - SizedBox(height: 50.v), - NextStepButton( - text: "no_account".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapNoAccount(context), - ), - /*NextStepButton( + resizeToAvoidBottomInset: false, + appBar: _buildAppBar(context), + body: GestureDetector( + onTap: () => FocusScope.of(context).unfocus(), + child: Container( + width: double.maxFinite, + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), + child: Column( + children: [ + SizedBox(height: 36.v), + Text("user_authorization".tr, style: theme.textTheme.headlineSmall), + SizedBox(height: 60.v), + Text("email".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + BlocSelector( + selector: (state) => state.emailController, + builder: (context, emailController) { + return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done); + }, + ), + SizedBox(height: 22.v), + Text("password".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 5.v), + BlocSelector( + selector: (state) => state.passwordController, + builder: (context, passwordController) { + return CustomTextFormField( + obscureText: true, + controller: passwordController, + ); + }, + ), + SizedBox(height: 50.v), + NextStepButton( + text: "no_account".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapNoAccount(context), + ), + /*NextStepButton( text: "Тест дневника".toUpperCase(), margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), @@ -81,14 +85,27 @@ class AuthScreen extends StatelessWidget { 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(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: onTapAuth(state, context),); - },), - ],),),),); + BlocBuilder( + builder: (context, state) { + return NextStepButton( + text: "authentificate".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 16.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: onTapAuth(state, context), + ); + }, + ), + TextButton( + onPressed: () async { + await launchUrl(Uri.parse(dotenv.env['OFERTA']!)); + }, + child: Text('Пользовательское соглашение'), + ), + ], + ), + ), + ), + ); } onTapAuth(AuthState state, BuildContext context) { @@ -99,8 +116,12 @@ class AuthScreen extends StatelessWidget { 'email': state.emailController!.text, 'password': state.passwordController!.text, }; - final response = await http.post(Uri.parse(dotenv.env['SERVER_ROOT']! + '/login'), - headers: {'Content-Type': 'application/json'}, body: json.encode(credentials), encoding: utf8,); + final response = await http.post( + Uri.parse(dotenv.env['SERVER_ROOT']! + '/login'), + headers: {'Content-Type': 'application/json'}, + body: json.encode(credentials), + encoding: utf8, + ); print(response.statusCode); if (response.statusCode == 200) { var res = await jsonDecode(response.body); diff --git a/lib/presentation/registration/additional_information_screen/bloc/additional_information_bloc.dart b/lib/presentation/registration/additional_information_screen/bloc/additional_information_bloc.dart deleted file mode 100644 index b2405c57..00000000 --- a/lib/presentation/registration/additional_information_screen/bloc/additional_information_bloc.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/additional_information_screen/models/additional_information_model.dart'; -part 'additional_information_event.dart'; -part 'additional_information_state.dart'; - -/// A bloc that manages the state of a AdditionalInformation according to the event that is dispatched to it. -class AdditionalInformationBloc - extends Bloc { - AdditionalInformationBloc(AdditionalInformationState initialState) - : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - AdditionalInformationInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith(editTextController: TextEditingController())); - } -} diff --git a/lib/presentation/registration/additional_information_screen/bloc/additional_information_event.dart b/lib/presentation/registration/additional_information_screen/bloc/additional_information_event.dart deleted file mode 100644 index 71494f83..00000000 --- a/lib/presentation/registration/additional_information_screen/bloc/additional_information_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'additional_information_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///AdditionalInformation widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class AdditionalInformationEvent extends Equatable {} - -/// Event that is dispatched when the AdditionalInformation widget is first created. -class AdditionalInformationInitialEvent extends AdditionalInformationEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/additional_information_screen/bloc/additional_information_state.dart b/lib/presentation/registration/additional_information_screen/bloc/additional_information_state.dart deleted file mode 100644 index 08dd10c4..00000000 --- a/lib/presentation/registration/additional_information_screen/bloc/additional_information_state.dart +++ /dev/null @@ -1,31 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'additional_information_bloc.dart'; - -/// Represents the state of AdditionalInformation in the application. -class AdditionalInformationState extends Equatable { - AdditionalInformationState({ - this.editTextController, - this.additionalInformationModelObj, - }); - - TextEditingController? editTextController; - - AdditionalInformationModel? additionalInformationModelObj; - - @override - List get props => [ - editTextController, - additionalInformationModelObj, - ]; - AdditionalInformationState copyWith({ - TextEditingController? editTextController, - AdditionalInformationModel? additionalInformationModelObj, - }) { - return AdditionalInformationState( - editTextController: editTextController ?? this.editTextController, - additionalInformationModelObj: - additionalInformationModelObj ?? this.additionalInformationModelObj, - ); - } -} diff --git a/lib/presentation/registration/additional_information_screen/models/additional_information_model.dart b/lib/presentation/registration/additional_information_screen/models/additional_information_model.dart deleted file mode 100644 index ff001d96..00000000 --- a/lib/presentation/registration/additional_information_screen/models/additional_information_model.dart +++ /dev/null @@ -1,20 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [additional_information_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class AdditionalInformationModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - AdditionalInformationModel({required this.userRegistrationSheet}); - - AdditionalInformationModel copyWith() { - return AdditionalInformationModel( - userRegistrationSheet: userRegistrationSheet, - ); - } - - @override - List get props => [userRegistrationSheet]; -} diff --git a/lib/presentation/registration/allergies_screen/bloc/allergies_bloc.dart b/lib/presentation/registration/allergies_screen/bloc/allergies_bloc.dart deleted file mode 100644 index f4cf7a22..00000000 --- a/lib/presentation/registration/allergies_screen/bloc/allergies_bloc.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/allergies_screen/models/allergies_model.dart'; -part 'allergies_event.dart'; -part 'allergies_state.dart'; - -/// A bloc that manages the state of a Allergies according to the event that is dispatched to it. -class AllergiesBloc extends Bloc { - AllergiesBloc(AllergiesState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - AllergiesInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith(enterInformationController: TextEditingController())); - } -} diff --git a/lib/presentation/registration/allergies_screen/bloc/allergies_event.dart b/lib/presentation/registration/allergies_screen/bloc/allergies_event.dart deleted file mode 100644 index 8892cc35..00000000 --- a/lib/presentation/registration/allergies_screen/bloc/allergies_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'allergies_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///Allergies widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class AllergiesEvent extends Equatable {} - -/// Event that is dispatched when the Allergies widget is first created. -class AllergiesInitialEvent extends AllergiesEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/allergies_screen/bloc/allergies_state.dart b/lib/presentation/registration/allergies_screen/bloc/allergies_state.dart deleted file mode 100644 index a63c52d8..00000000 --- a/lib/presentation/registration/allergies_screen/bloc/allergies_state.dart +++ /dev/null @@ -1,31 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'allergies_bloc.dart'; - -/// Represents the state of Allergies in the application. -class AllergiesState extends Equatable { - AllergiesState({ - this.enterInformationController, - this.allergiesModelObj, - }); - - TextEditingController? enterInformationController; - - AllergiesModel? allergiesModelObj; - - @override - List get props => [ - enterInformationController, - allergiesModelObj, - ]; - AllergiesState copyWith({ - TextEditingController? enterInformationController, - AllergiesModel? allergiesModelObj, - }) { - return AllergiesState( - enterInformationController: - enterInformationController ?? this.enterInformationController, - allergiesModelObj: allergiesModelObj ?? this.allergiesModelObj, - ); - } -} diff --git a/lib/presentation/registration/allergies_screen/models/allergies_model.dart b/lib/presentation/registration/allergies_screen/models/allergies_model.dart deleted file mode 100644 index ebd20063..00000000 --- a/lib/presentation/registration/allergies_screen/models/allergies_model.dart +++ /dev/null @@ -1,20 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [allergies_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class AllergiesModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - AllergiesModel({required this.userRegistrationSheet}); - - AllergiesModel copyWith() { - return AllergiesModel( - userRegistrationSheet: userRegistrationSheet, - ); - } - - @override - List get props => [userRegistrationSheet]; -} diff --git a/lib/presentation/registration/app_navigation_screen/app_navigation_screen.dart b/lib/presentation/registration/app_navigation_screen/app_navigation_screen.dart deleted file mode 100644 index cbf92f01..00000000 --- a/lib/presentation/registration/app_navigation_screen/app_navigation_screen.dart +++ /dev/null @@ -1,233 +0,0 @@ -import 'package:go_router/go_router.dart'; - -import 'bloc/app_navigation_bloc.dart'; -import 'models/app_navigation_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; - -class AppNavigationScreen extends StatefulWidget { - const AppNavigationScreen({Key? key}) - : super( - key: key, - ); - - static Widget builder(BuildContext context) { - return BlocProvider( - create: (context) => AppNavigationBloc(AppNavigationState( - appNavigationModelObj: AppNavigationModel(), - ),) - ..add(AppNavigationInitialEvent()), - child: AppNavigationScreen(), - ); - } - - @override - State createState() => _AppNavigationScreenState(); -} - -class _AppNavigationScreenState extends State { - @override - Widget build(BuildContext context) { - mediaQueryData = MediaQuery.of(context); - - return BlocBuilder( - builder: (context, state) { - return SafeArea( - child: Scaffold( - backgroundColor: Color(0XFFFFFFFF), - body: SizedBox( - width: double.maxFinite, - child: Column( - children: [ - _buildAppNavigation(context), - Expanded( - child: SingleChildScrollView( - child: Container( - decoration: BoxDecoration( - color: Color(0XFFFFFFFF), - ), - child: Column( - children: [ - _buildScreenTitle( - context, - screenTitle: "date_of_birth".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('dateOfBirthScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "city_of_living".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('cityOfLivingScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "body_circumferences".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('bodyCircumferencesScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "weight".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('weightScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "allergies".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('allergiesScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "medicine_intake".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('medicineIntakeScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "splash_screen".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('splashScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "gender".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('genderScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "blood_pressure".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('bloodPressureScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "favorite_sports".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('favoriteSportsScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "favorite_foods".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('favoriteFoodsScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "schedule".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('scheduleScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "additional_information".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('additionalInformationScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "language_select".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('languageSelectScreen'), - ), - _buildScreenTitle( - context, - screenTitle: "auth".tr, - onTapScreenTitle: () => GoRouter.of(context).goNamed('authScreen'), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ), - ); - }, - ); - } - - /// Section Widget - _buildAppNavigation(BuildContext context) { - return Container( - decoration: BoxDecoration( - color: Color(0XFFFFFFFF), - ), - child: Column( - children: [ - SizedBox(height: 10.v), - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 20.h), - child: Text( - "App Navigation".tr, - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0XFF000000), - fontSize: 20.fSize, - fontWeight: FontWeight.w400, - ), - ), - ), - ), - SizedBox(height: 10.v), - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: EdgeInsets.only(left: 20.h), - child: Text( - "Check your app's UI from the below demo screens of your app.".tr, - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0XFF888888), - fontSize: 16.fSize, - fontWeight: FontWeight.w400, - ), - ), - ), - ), - SizedBox(height: 5.v), - Divider( - height: 1.v, - thickness: 1.v, - color: Color(0XFF000000), - ), - ], - ), - ); - } - - /// Common widget - _buildScreenTitle( - BuildContext context, { - required String screenTitle, - Function? onTapScreenTitle, - }) { - return GestureDetector( - onTap: onTapScreenTitle!.call(), - child: Container( - decoration: BoxDecoration( - color: Color(0XFFFFFFFF), - ), - child: Column( - children: [ - SizedBox(height: 10.v), - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 20.h), - child: Text( - screenTitle, - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0XFF000000), - fontSize: 20.fSize, - fontWeight: FontWeight.w400, - ), - ), - ), - ), - SizedBox(height: 10.v), - SizedBox(height: 5.v), - Divider( - height: 1.v, - thickness: 1.v, - color: Color(0XFF888888), - ), - ], - ), - ), - ); - } -} diff --git a/lib/presentation/registration/app_navigation_screen/bloc/app_navigation_bloc.dart b/lib/presentation/registration/app_navigation_screen/bloc/app_navigation_bloc.dart deleted file mode 100644 index adb51100..00000000 --- a/lib/presentation/registration/app_navigation_screen/bloc/app_navigation_bloc.dart +++ /dev/null @@ -1,18 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/app_navigation_screen/models/app_navigation_model.dart'; -part 'app_navigation_event.dart'; -part 'app_navigation_state.dart'; - -/// A bloc that manages the state of a AppNavigation according to the event that is dispatched to it. -class AppNavigationBloc extends Bloc { - AppNavigationBloc(AppNavigationState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - AppNavigationInitialEvent event, - Emitter emit, - ) async {} -} diff --git a/lib/presentation/registration/app_navigation_screen/bloc/app_navigation_event.dart b/lib/presentation/registration/app_navigation_screen/bloc/app_navigation_event.dart deleted file mode 100644 index 649738e6..00000000 --- a/lib/presentation/registration/app_navigation_screen/bloc/app_navigation_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'app_navigation_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///AppNavigation widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class AppNavigationEvent extends Equatable {} - -/// Event that is dispatched when the AppNavigation widget is first created. -class AppNavigationInitialEvent extends AppNavigationEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/app_navigation_screen/bloc/app_navigation_state.dart b/lib/presentation/registration/app_navigation_screen/bloc/app_navigation_state.dart deleted file mode 100644 index 2ee33461..00000000 --- a/lib/presentation/registration/app_navigation_screen/bloc/app_navigation_state.dart +++ /dev/null @@ -1,21 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'app_navigation_bloc.dart'; - -/// Represents the state of AppNavigation in the application. -class AppNavigationState extends Equatable { - AppNavigationState({this.appNavigationModelObj}); - - AppNavigationModel? appNavigationModelObj; - - @override - List get props => [ - appNavigationModelObj, - ]; - AppNavigationState copyWith({AppNavigationModel? appNavigationModelObj}) { - return AppNavigationState( - appNavigationModelObj: - appNavigationModelObj ?? this.appNavigationModelObj, - ); - } -} diff --git a/lib/presentation/registration/app_navigation_screen/models/app_navigation_model.dart b/lib/presentation/registration/app_navigation_screen/models/app_navigation_model.dart deleted file mode 100644 index 73fd71d7..00000000 --- a/lib/presentation/registration/app_navigation_screen/models/app_navigation_model.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; - -/// This class defines the variables used in the [app_navigation_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class AppNavigationModel extends Equatable { - AppNavigationModel(); - - AppNavigationModel copyWith() { - return AppNavigationModel(); - } - - @override - List get props => []; -} diff --git a/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart b/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart deleted file mode 100644 index 64e3e019..00000000 --- a/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_bloc.dart +++ /dev/null @@ -1,72 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/blood_pressure_screen/models/blood_pressure_model.dart'; - -part 'blood_pressure_event.dart'; - -part 'blood_pressure_state.dart'; - -/// A bloc that manages the state of a BloodPressure according to the event that is dispatched to it. -class BloodPressureBloc extends Bloc { - BloodPressureBloc(BloodPressureState initialState) : super(initialState) { - on(_onInitialize); - on(_changeHypoDropDown); - on(_changeHyperDropDown); - } - - _changeHyperDropDown( - ChangeHyperDropDownEvent event, - Emitter emit, - ) { - if (event.value.id == 1) { - // state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '1'; - } else { - // state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '0'; - } - emit(state.copyWith(selectedHyperValue: event.value)); - } - - _changeHypoDropDown( - ChangeHypoDownEvent event, - Emitter emit, - ) { - if (event.value.id == 1) { - // state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '1'; - } else { - // state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '0'; - } - emit(state.copyWith(selectedHypoValue: event.value)); - } - - List fillDropdownItemList() { - return [ - SelectionPopupModel( - id: 1, - title: "Да", - ), - SelectionPopupModel( - id: 2, - title: "Нет", - isSelected: true, - ), - ]; - } - - _onInitialize( - BloodPressureInitialEvent event, - Emitter emit, - ) async { - emit( - state.copyWith( - upPressureController: TextEditingController(), - downPressureController: TextEditingController(), - ), - ); - emit( - state.copyWith( - bloodPressureModelObj: state.bloodPressureModelObj?.copyWith(dropdownItemList: fillDropdownItemList()), - ), - ); - } -} diff --git a/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_event.dart b/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_event.dart deleted file mode 100644 index 677d2436..00000000 --- a/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_event.dart +++ /dev/null @@ -1,39 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'blood_pressure_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///BloodPressure widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class BloodPressureEvent extends Equatable {} - -/// Event that is dispatched when the BloodPressure widget is first created. -class BloodPressureInitialEvent extends BloodPressureEvent { - @override - List get props => []; -} - -///event for dropdown selection -class ChangeHyperDropDownEvent extends BloodPressureEvent { - ChangeHyperDropDownEvent({required this.value}); - - SelectionPopupModel value; - - @override - List get props => [ - value, - ]; -} - -class ChangeHypoDownEvent extends BloodPressureEvent { - ChangeHypoDownEvent({required this.value}); - - SelectionPopupModel value; - - @override - List get props => [ - value, - ]; -} diff --git a/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_state.dart b/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_state.dart deleted file mode 100644 index d1db1c49..00000000 --- a/lib/presentation/registration/blood_pressure_screen/bloc/blood_pressure_state.dart +++ /dev/null @@ -1,50 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'blood_pressure_bloc.dart'; - -/// Represents the state of BloodPressure in the application. -class BloodPressureState extends Equatable { - BloodPressureState({ - this.upPressureController, - this.downPressureController, - this.selectedHyperValue, - this.selectedHypoValue, - this.bloodPressureModelObj, - }); - - TextEditingController? upPressureController; - - TextEditingController? downPressureController; - - SelectionPopupModel? selectedHypoValue; - - SelectionPopupModel? selectedHyperValue; - - BloodPressureModel? bloodPressureModelObj; - - @override - List get props => [ - upPressureController, - downPressureController, - selectedHyperValue, - selectedHypoValue, - bloodPressureModelObj, - ]; - BloodPressureState copyWith({ - TextEditingController? upPressureController, - TextEditingController? downPressureController, - SelectionPopupModel? selectedHyperValue, - SelectionPopupModel? selectedHypoValue, - BloodPressureModel? bloodPressureModelObj, - }) { - return BloodPressureState( - upPressureController: upPressureController ?? this.upPressureController, - downPressureController: - downPressureController ?? this.downPressureController, - selectedHyperValue: selectedHyperValue ?? this.selectedHyperValue, - selectedHypoValue: selectedHypoValue ?? this.selectedHypoValue, - bloodPressureModelObj: - bloodPressureModelObj ?? this.bloodPressureModelObj, - ); - } -} diff --git a/lib/presentation/registration/blood_pressure_screen/models/blood_pressure_model.dart b/lib/presentation/registration/blood_pressure_screen/models/blood_pressure_model.dart deleted file mode 100644 index 2d8463ef..00000000 --- a/lib/presentation/registration/blood_pressure_screen/models/blood_pressure_model.dart +++ /dev/null @@ -1,25 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [blood_pressure_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class BloodPressureModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - BloodPressureModel( - {required this.userRegistrationSheet, this.dropdownItemList = const [],}); - - List dropdownItemList; - - BloodPressureModel copyWith({List? dropdownItemList}) { - return BloodPressureModel( - userRegistrationSheet: userRegistrationSheet, - dropdownItemList: dropdownItemList ?? this.dropdownItemList, - ); - } - - @override - List get props => [dropdownItemList, userRegistrationSheet]; -} diff --git a/lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_bloc.dart b/lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_bloc.dart deleted file mode 100644 index 871ff8dc..00000000 --- a/lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_bloc.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/body_circumferences_screen/models/body_circumferences_model.dart'; -part 'body_circumferences_event.dart'; -part 'body_circumferences_state.dart'; - -/// A bloc that manages the state of a BodyCircumferences according to the event that is dispatched to it. -class BodyCircumferencesBloc - extends Bloc { - BodyCircumferencesBloc(BodyCircumferencesState initialState) - : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - BodyCircumferencesInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith( - chestCircumferenceController: TextEditingController(), - waistCircumferenceController: TextEditingController(), - hipCircumferenceController: TextEditingController(),),); - } -} diff --git a/lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_event.dart b/lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_event.dart deleted file mode 100644 index d164270e..00000000 --- a/lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'body_circumferences_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///BodyCircumferences widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class BodyCircumferencesEvent extends Equatable {} - -/// Event that is dispatched when the BodyCircumferences widget is first created. -class BodyCircumferencesInitialEvent extends BodyCircumferencesEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_state.dart b/lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_state.dart deleted file mode 100644 index df28755c..00000000 --- a/lib/presentation/registration/body_circumferences_screen/bloc/body_circumferences_state.dart +++ /dev/null @@ -1,46 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'body_circumferences_bloc.dart'; - -/// Represents the state of BodyCircumferences in the application. -class BodyCircumferencesState extends Equatable { - BodyCircumferencesState({ - this.chestCircumferenceController, - this.waistCircumferenceController, - this.hipCircumferenceController, - this.bodyCircumferencesModelObj, - }); - - TextEditingController? chestCircumferenceController; - - TextEditingController? waistCircumferenceController; - - TextEditingController? hipCircumferenceController; - - BodyCircumferencesModel? bodyCircumferencesModelObj; - - @override - List get props => [ - chestCircumferenceController, - waistCircumferenceController, - hipCircumferenceController, - bodyCircumferencesModelObj, - ]; - BodyCircumferencesState copyWith({ - TextEditingController? chestCircumferenceController, - TextEditingController? waistCircumferenceController, - TextEditingController? hipCircumferenceController, - BodyCircumferencesModel? bodyCircumferencesModelObj, - }) { - return BodyCircumferencesState( - chestCircumferenceController: - chestCircumferenceController ?? this.chestCircumferenceController, - waistCircumferenceController: - waistCircumferenceController ?? this.waistCircumferenceController, - hipCircumferenceController: - hipCircumferenceController ?? this.hipCircumferenceController, - bodyCircumferencesModelObj: - bodyCircumferencesModelObj ?? this.bodyCircumferencesModelObj, - ); - } -} diff --git a/lib/presentation/registration/body_circumferences_screen/models/body_circumferences_model.dart b/lib/presentation/registration/body_circumferences_screen/models/body_circumferences_model.dart deleted file mode 100644 index 2af76f9d..00000000 --- a/lib/presentation/registration/body_circumferences_screen/models/body_circumferences_model.dart +++ /dev/null @@ -1,20 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [body_circumferences_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class BodyCircumferencesModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - BodyCircumferencesModel({required this.userRegistrationSheet}); - - BodyCircumferencesModel copyWith() { - return BodyCircumferencesModel( - userRegistrationSheet: userRegistrationSheet, - ); - } - - @override - List get props => [userRegistrationSheet]; -} diff --git a/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_bloc.dart b/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_bloc.dart deleted file mode 100644 index e642961e..00000000 --- a/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_bloc.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/city_of_living_screen/models/city_of_living_model.dart'; -part 'city_of_living_event.dart'; -part 'city_of_living_state.dart'; - -/// A bloc that manages the state of a CityOfLiving according to the event that is dispatched to it. -class CityOfLivingBloc extends Bloc { - CityOfLivingBloc(CityOfLivingState initialState) : super(initialState) { - on(_onInitialize); - on(_changeDropDown); - } - - _onInitialize( - CityOfLivingInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith( - cityOfLivingModelObj: state.cityOfLivingModelObj?.copyWith( - dropdownItemList: fillDropdownItemList(), - ),),); - } - - _changeDropDown( - ChangeDropDownEvent event, - Emitter emit, - ) { - emit(state.copyWith(selectedDropDownValue: event.value)); - // state.cityOfLivingModelObj?.userRegistrationSheet.country = - event.value.title; - } - - List fillDropdownItemList() { - return [SelectionPopupModel(id: 1, title: "Россия", isSelected: true)]; - } -} diff --git a/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_event.dart b/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_event.dart deleted file mode 100644 index d8418128..00000000 --- a/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_event.dart +++ /dev/null @@ -1,28 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'city_of_living_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///CityOfLiving widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class CityOfLivingEvent extends Equatable {} - -/// Event that is dispatched when the CityOfLiving widget is first created. -class CityOfLivingInitialEvent extends CityOfLivingEvent { - @override - List get props => []; -} - -///event for dropdown selection -class ChangeDropDownEvent extends CityOfLivingEvent { - ChangeDropDownEvent({required this.value}); - - SelectionPopupModel value; - - @override - List get props => [ - value, - ]; -} diff --git a/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_state.dart b/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_state.dart deleted file mode 100644 index 5179b21e..00000000 --- a/lib/presentation/registration/city_of_living_screen/bloc/city_of_living_state.dart +++ /dev/null @@ -1,37 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'city_of_living_bloc.dart'; - -/// Represents the state of CityOfLiving in the application. -class CityOfLivingState extends Equatable { - CityOfLivingState({ - this.selectedDropDownValue, - this.cityController, - this.cityOfLivingModelObj, - }); - - SelectionPopupModel? selectedDropDownValue; - - TextEditingController? cityController; - - CityOfLivingModel? cityOfLivingModelObj; - - @override - List get props => [ - selectedDropDownValue, - cityController, - cityOfLivingModelObj, - ]; - CityOfLivingState copyWith({ - SelectionPopupModel? selectedDropDownValue, - SelectionPopupModel? selectedDropDownValue1, - CityOfLivingModel? cityOfLivingModelObj, - }) { - return CityOfLivingState( - selectedDropDownValue: - selectedDropDownValue ?? this.selectedDropDownValue, - cityController: cityController ?? this.cityController, - cityOfLivingModelObj: cityOfLivingModelObj ?? this.cityOfLivingModelObj, - ); - } -} diff --git a/lib/presentation/registration/city_of_living_screen/models/city_of_living_model.dart b/lib/presentation/registration/city_of_living_screen/models/city_of_living_model.dart deleted file mode 100644 index 24eb6d9c..00000000 --- a/lib/presentation/registration/city_of_living_screen/models/city_of_living_model.dart +++ /dev/null @@ -1,1153 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [city_of_living_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class CityOfLivingModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - CityOfLivingModel({ - required this.userRegistrationSheet, - this.dropdownItemList = const [], - this.cityList = const [ - "Абаза", - "Абакан", - "Абдулино", - "Абинск", - "Агидель", - "Агрыз", - "Адыгейск", - "Азнакаево", - "Азов", - "Ак-Довурак", - "Аксай", - "Алагир", - "Алапаевск", - "Алатырь", - "Алдан", - "Алейск", - "Александров", - "Александровск", - "Александровск-Сахалинский", - "Алексеевка", - "Алексин", - "Алзамай", - "АлупкаОспаривается", - "АлуштаОспаривается", - "Альметьевск", - "Амурск", - "Анадырь", - "Анапа", - "Ангарск", - "Андреаполь", - "Анжеро-Судженск", - "Анива", - "Апатиты", - "Апрелевка", - "Апшеронск", - "Арамиль", - "Аргун", - "Ардатов", - "Ардон", - "Арзамас", - "Аркадак", - "Армавир", - "АрмянскОспаривается", - "Арсеньев", - "Арск", - "Артём", - "Артёмовск", - "Артёмовский", - "Архангельск", - "Асбест", - "Асино", - "Астрахань", - "Аткарск", - "Ахтубинск", - "Ачинск", - "Аша", - "Бабаево", - "Бабушкин", - "Бавлы", - "Багратионовск", - "Байкальск", - "Баймак", - "Бакал", - "Баксан", - "Балабаново", - "Балаково", - "Балахна", - "Балашиха", - "Балашов", - "Балей", - "Балтийск", - "Барабинск", - "Барнаул", - "Барыш", - "Батайск", - "БахчисарайОспаривается", - "Бежецк", - "Белая Калитва", - "Белая Холуница", - "Белгород", - "Белебей", - "Белёв", - "Белинский", - "Белово", - "Белогорск", - "БелогорскОспаривается", - "Белозерск", - "Белокуриха", - "Беломорск", - "Белоозёрский", - "Белорецк", - "Белореченск", - "Белоусово", - "Белоярский", - "Белый", - "Бердск", - "Березники", - "Берёзовский", - "Берёзовский", - "Беслан", - "Бийск", - "Бикин", - "Билибино", - "Биробиджан", - "Бирск", - "Бирюсинск", - "Бирюч", - "Благовещенск", - "Благовещенск", - "Благодарный", - "Бобров", - "Богданович", - "Богородицк", - "Богородск", - "Боготол", - "Богучар", - "Бодайбо", - "Бокситогорск", - "Болгар", - "Бологое", - "Болотное", - "Болохово", - "Болхов", - "Большой Камень", - "Бор", - "Борзя", - "Борисоглебск", - "Боровичи", - "Боровск", - "Бородино", - "Братск", - "Бронницы", - "Брянск", - "Бугульма", - "Бугуруслан", - "Будённовск", - "Бузулук", - "Буинск", - "Буй", - "Буйнакск", - "Бутурлиновка", - "Валдай", - "Валуйки", - "Велиж", - "Великие Луки", - "Великий Новгород", - "Великий Устюг", - "Вельск", - "Венёв", - "Верещагино", - "Верея", - "Верхнеуральск", - "Верхний Тагил", - "Верхний Уфалей", - "Верхняя Пышма", - "Верхняя Салда", - "Верхняя Тура", - "Верхотурье", - "Верхоянск", - "Весьегонск", - "Ветлуга", - "Видное", - "Вилюйск", - "Вилючинск", - "Вихоревка", - "Вичуга", - "Владивосток", - "Владикавказ", - "Владимир", - "Волгоград", - "Волгодонск", - "Волгореченск", - "Волжск", - "Волжский", - "Вологда", - "Володарск", - "Волоколамск", - "Волосово", - "Волхов", - "Волчанск", - "Вольск", - "Воркута", - "Воронеж", - "Ворсма", - "Воскресенск", - "Воткинск", - "Всеволожск", - "Вуктыл", - "Выборг", - "Выкса", - "Высоковск", - "Высоцк", - "Вытегра", - "Вышний Волочёк", - "Вяземский", - "Вязники", - "Вязьма", - "Вятские Поляны", - "Гаврилов Посад", - "Гаврилов-Ям", - "Гагарин", - "Гаджиево", - "Гай", - "Галич", - "Гатчина", - "Гвардейск", - "Гдов", - "Геленджик", - "Георгиевск", - "Глазов", - "Голицыно", - "Горбатов", - "Горно-Алтайск", - "Горнозаводск", - "Горняк", - "Городец", - "Городище", - "Городовиковск", - "Гороховец", - "Горячий Ключ", - "Грайворон", - "Гремячинск", - "Грозный", - "Грязи", - "Грязовец", - "Губаха", - "Губкин", - "Губкинский", - "Гудермес", - "Гуково", - "Гулькевичи", - "Гурьевск", - "Гурьевск", - "Гусев", - "Гусиноозёрск", - "Гусь-Хрустальный", - "Давлеканово", - "Дагестанские Огни", - "Далматово", - "Дальнегорск", - "Дальнереченск", - "Данилов", - "Данков", - "Дегтярск", - "Дедовск", - "Демидов", - "Дербент", - "Десногорск", - "ДжанкойОспаривается", - "Дзержинск", - "Дзержинский", - "Дивногорск", - "Дигора", - "Димитровград", - "Дмитриев", - "Дмитров", - "Дмитровск", - "Дно", - "Добрянка", - "Долгопрудный", - "Долинск", - "Домодедово", - "Донецк", - "Донской", - "Дорогобуж", - "Дрезна", - "Дубна", - "Дубовка", - "Дудинка", - "Духовщина", - "Дюртюли", - "Дятьково", - "ЕвпаторияОспаривается", - "Егорьевск", - "Ейск", - "Екатеринбург", - "Елабуга", - "Елец", - "Елизово", - "Ельня", - "Еманжелинск", - "Емва", - "Енисейск", - "Ермолино", - "Ершов", - "Ессентуки", - "Ефремов", - "Железноводск", - "Железногорск", - "Железногорск", - "Железногорск-Илимский", - "Жердевка", - "Жигулёвск", - "Жиздра", - "Жирновск", - "Жуков", - "Жуковка", - "Жуковский", - "Завитинск", - "Заводоуковск", - "Заволжск", - "Заволжье", - "Задонск", - "Заинск", - "Закаменск", - "Заозёрный", - "Заозёрск", - "Западная Двина", - "Заполярный", - "Зарайск", - "Заречный", - "Заречный", - "Заринск", - "Звенигово", - "Звенигород", - "Зверево", - "Зеленогорск", - "Зеленоградск", - "Зеленодольск", - "Зеленокумск", - "Зерноград", - "Зея", - "Зима", - "Златоуст", - "Злынка", - "Змеиногорск", - "Знаменск", - "Зубцов", - "Зуевка", - "Ивангород", - "Иваново", - "Ивантеевка", - "Ивдель", - "Игарка", - "Ижевск", - "Избербаш", - "Изобильный", - "Иланский", - "Инза", - "Иннополис", - "Инсар", - "Инта", - "Ипатово", - "Ирбит", - "Иркутск", - "Исилькуль", - "Искитим", - "Истра", - "Ишим", - "Ишимбай", - "Йошкар-Ола", - "Кадников", - "Казань", - "Калач", - "Калач-на-Дону", - "Калачинск", - "Калининград", - "Калининск", - "Калтан", - "Калуга", - "Калязин", - "Камбарка", - "Каменка", - "Каменногорск", - "Каменск-Уральский", - "Каменск-Шахтинский", - "Камень-на-Оби", - "Камешково", - "Камызяк", - "Камышин", - "Камышлов", - "Канаш", - "Кандалакша", - "Канск", - "Карабаново", - "Карабаш", - "Карабулак", - "Карасук", - "Карачаевск", - "Карачев", - "Каргат", - "Каргополь", - "Карпинск", - "Карталы", - "Касимов", - "Касли", - "Каспийск", - "Катав-Ивановск", - "Катайск", - "Качканар", - "Кашин", - "Кашира", - "Кедровый", - "Кемерово", - "Кемь", - "КерчьОспаривается", - "Кизел", - "Кизилюрт", - "Кизляр", - "Кимовск", - "Кимры", - "Кингисепп", - "Кинель", - "Кинешма", - "Киреевск", - "Киренск", - "Киржач", - "Кириллов", - "Кириши", - "Киров", - "Киров", - "Кировград", - "Кирово-Чепецк", - "Кировск", - "Кировск", - "Кирс", - "Кирсанов", - "Киселёвск", - "Кисловодск", - "Клин", - "Клинцы", - "Княгинино", - "Ковдор", - "Ковров", - "Ковылкино", - "Когалым", - "Кодинск", - "Козельск", - "Козловка", - "Козьмодемьянск", - "Кола", - "Кологрив", - "Коломна", - "Колпашево", - "Кольчугино", - "Коммунар", - "Комсомольск", - "Комсомольск-на-Амуре", - "Конаково", - "Кондопога", - "Кондрово", - "Константиновск", - "Копейск", - "Кораблино", - "Кореновск", - "Коркино", - "Королёв", - "Короча", - "Корсаков", - "Коряжма", - "Костерёво", - "Костомукша", - "Кострома", - "Котельники", - "Котельниково", - "Котельнич", - "Котлас", - "Котово", - "Котовск", - "Кохма", - "Красавино", - "Красноармейск", - "Красноармейск", - "Красновишерск", - "Красногорск", - "Краснодар", - "Краснозаводск", - "Краснознаменск", - "Краснознаменск", - "Краснокаменск", - "Краснокамск", - "КрасноперекопскОспаривается", - "Краснослободск", - "Краснослободск", - "Краснотурьинск", - "Красноуральск", - "Красноуфимск", - "Красноярск", - "Красный Кут", - "Красный Сулин", - "Красный Холм", - "Кремёнки", - "Кропоткин", - "Крымск", - "Кстово", - "Кубинка", - "Кувандык", - "Кувшиново", - "Кудрово", - "Кудымкар", - "Кузнецк", - "Куйбышев", - "Кукмор", - "Кулебаки", - "Кумертау", - "Кунгур", - "Купино", - "Курган", - "Курганинск", - "Курильск", - "Курлово", - "Куровское", - "Курск", - "Куртамыш", - "Курчалой", - "Курчатов", - "Куса", - "Кушва", - "Кызыл", - "Кыштым", - "Кяхта", - "Лабинск", - "Лабытнанги", - "Лагань", - "Ладушкин", - "Лаишево", - "Лакинск", - "Лангепас", - "Лахденпохья", - "Лебедянь", - "Лениногорск", - "Ленинск", - "Ленинск-Кузнецкий", - "Ленск", - "Лермонтов", - "Лесной", - "Лесозаводск", - "Лесосибирск", - "Ливны", - "Ликино-Дулёво", - "Липецк", - "Липки", - "Лиски", - "Лихославль", - "Лобня", - "Лодейное Поле", - "Лосино-Петровский", - "Луга", - "Луза", - "Лукоянов", - "Луховицы", - "Лысково", - "Лысьва", - "Лыткарино", - "Льгов", - "Любань", - "Люберцы", - "Любим", - "Людиново", - "Лянтор", - "Магадан", - "Магас", - "Магнитогорск", - "Майкоп", - "Майский", - "Макаров", - "Макарьев", - "Макушино", - "Малая Вишера", - "Малгобек", - "Малмыж", - "Малоархангельск", - "Малоярославец", - "Мамадыш", - "Мамоново", - "Мантурово", - "Мариинск", - "Мариинский Посад", - "Маркс", - "Махачкала", - "Мглин", - "Мегион", - "Медвежьегорск", - "Медногорск", - "Медынь", - "Межгорье", - "Междуреченск", - "Мезень", - "Меленки", - "Мелеуз", - "Менделеевск", - "Мензелинск", - "Мещовск", - "Миасс", - "Микунь", - "Миллерово", - "Минеральные Воды", - "Минусинск", - "Миньяр", - "Мирный", - "Мирный", - "Михайлов", - "Михайловка", - "Михайловск", - "Михайловск", - "Мичуринск", - "Могоча", - "Можайск", - "Можга", - "Моздок", - "Мончегорск", - "Морозовск", - "Моршанск", - "Мосальск", - "Москва", - "Муравленко", - "Мураши", - "Мурино", - "Мурманск", - "Муром", - "Мценск", - "Мыски", - "Мытищи", - "Мышкин", - "Набережные Челны", - "Навашино", - "Наволоки", - "Надым", - "Назарово", - "Назрань", - "Называевск", - "Нальчик", - "Нариманов", - "Наро-Фоминск", - "Нарткала", - "Нарьян-Мар", - "Находка", - "Невель", - "Невельск", - "Невинномысск", - "Невьянск", - "Нелидово", - "Неман", - "Нерехта", - "Нерчинск", - "Нерюнгри", - "Нестеров", - "Нефтегорск", - "Нефтекамск", - "Нефтекумск", - "Нефтеюганск", - "Нея", - "Нижневартовск", - "Нижнекамск", - "Нижнеудинск", - "Нижние Серги", - "Нижний Ломов", - "Нижний Новгород", - "Нижний Тагил", - "Нижняя Салда", - "Нижняя Тура", - "Николаевск", - "Николаевск-на-Амуре", - "Никольск", - "Никольск", - "Никольское", - "Новая Ладога", - "Новая Ляля", - "Новоалександровск", - "Новоалтайск", - "Новоаннинский", - "Нововоронеж", - "Новодвинск", - "Новозыбков", - "Новокубанск", - "Новокузнецк", - "Новокуйбышевск", - "Новомичуринск", - "Новомосковск", - "Новопавловск", - "Новоржев", - "Новороссийск", - "Новосибирск", - "Новосиль", - "Новосокольники", - "Новотроицк", - "Новоузенск", - "Новоульяновск", - "Новоуральск", - "Новохопёрск", - "Новочебоксарск", - "Новочеркасск", - "Новошахтинск", - "Новый Оскол", - "Новый Уренгой", - "Ногинск", - "Нолинск", - "Норильск", - "Ноябрьск", - "Нурлат", - "Нытва", - "Нюрба", - "Нягань", - "Нязепетровск", - "Няндома", - "Облучье", - "Обнинск", - "Обоянь", - "Обь", - "Одинцово", - "Озёрск", - "Озёрск", - "Озёры", - "Октябрьск", - "Октябрьский", - "Окуловка", - "Олёкминск", - "Оленегорск", - "Олонец", - "Омск", - "Омутнинск", - "Онега", - "Опочка", - "Орёл", - "Оренбург", - "Орехово-Зуево", - "Орлов", - "Орск", - "Оса", - "Осинники", - "Осташков", - "Остров", - "Островной", - "Острогожск", - "Отрадное", - "Отрадный", - "Оха", - "Оханск", - "Очёр", - "Павлово", - "Павловск", - "Павловский Посад", - "Палласовка", - "Партизанск", - "Певек", - "Пенза", - "Первомайск", - "Первоуральск", - "Перевоз", - "Пересвет", - "Переславль-Залесский", - "Пермь", - "Пестово", - "Петров Вал", - "Петровск", - "Петровск-Забайкальский", - "Петрозаводск", - "Петропавловск-Камчатский", - "Петухово", - "Петушки", - "Печора", - "Печоры", - "Пикалёво", - "Пионерский", - "Питкяранта", - "Плавск", - "Пласт", - "Плёс", - "Поворино", - "Подольск", - "Подпорожье", - "Покачи", - "Покров", - "Покровск", - "Полевской", - "Полесск", - "Полысаево", - "Полярные Зори", - "Полярный", - "Поронайск", - "Порхов", - "Похвистнево", - "Почеп", - "Починок", - "Пошехонье", - "Правдинск", - "Приволжск", - "Приморск", - "Приморск", - "Приморско-Ахтарск", - "Приозерск", - "Прокопьевск", - "Пролетарск", - "Протвино", - "Прохладный", - "Псков", - "Пугачёв", - "Пудож", - "Пустошка", - "Пучеж", - "Пушкино", - "Пущино", - "Пыталово", - "Пыть-Ях", - "Пятигорск", - "Радужный", - "Радужный", - "Райчихинск", - "Раменское", - "Рассказово", - "Ревда", - "Реж", - "Реутов", - "Ржев", - "Родники", - "Рославль", - "Россошь", - "Ростов-на-Дону", - "Ростов", - "Рошаль", - "Ртищево", - "Рубцовск", - "Рудня", - "Руза", - "Рузаевка", - "Рыбинск", - "Рыбное", - "Рыльск", - "Ряжск", - "Рязань", - "СакиОспаривается", - "Салават", - "Салаир", - "Салехард", - "Сальск", - "Самара", - "Санкт-Петербург", - "Саранск", - "Сарапул", - "Саратов", - "Саров", - "Сасово", - "Сатка", - "Сафоново", - "Саяногорск", - "Саянск", - "Светлогорск", - "Светлоград", - "Светлый", - "Светогорск", - "Свирск", - "Свободный", - "Себеж", - "СевастопольОспаривается", - "Северо-Курильск", - "Северобайкальск", - "Северодвинск", - "Североморск", - "Североуральск", - "Северск", - "Севск", - "Сегежа", - "Сельцо", - "Семёнов", - "Семикаракорск", - "Семилуки", - "Сенгилей", - "Серафимович", - "Сергач", - "Сергиев Посад", - "Сердобск", - "Серов", - "Серпухов", - "Сертолово", - "Сибай", - "Сим", - "СимферопольОспаривается", - "Сковородино", - "Скопин", - "Славгород", - "Славск", - "Славянск-на-Кубани", - "Сланцы", - "Слободской", - "Слюдянка", - "Смоленск", - "Снежинск", - "Снежногорск", - "Собинка", - "Советск", - "Советск", - "Советск", - "Советская Гавань", - "Советский", - "Сокол", - "Солигалич", - "Соликамск", - "Солнечногорск", - "Соль-Илецк", - "Сольвычегодск", - "Сольцы", - "Сорочинск", - "Сорск", - "Сортавала", - "Сосенский", - "Сосновка", - "Сосновоборск", - "Сосновый Бор", - "Сосногорск", - "Сочи", - "Спас-Деменск", - "Спас-Клепики", - "Спасск", - "Спасск-Дальний", - "Спасск-Рязанский", - "Среднеколымск", - "Среднеуральск", - "Сретенск", - "Ставрополь", - "Старая Купавна", - "Старая Русса", - "Старица", - "Стародуб", - "Старый КрымОспаривается", - "Старый Оскол", - "Стерлитамак", - "Стрежевой", - "Строитель", - "Струнино", - "Ступино", - "Суворов", - "СудакОспаривается", - "Суджа", - "Судогда", - "Суздаль", - "Сунжа", - "Суоярви", - "Сураж", - "Сургут", - "Суровикино", - "Сурск", - "Сусуман", - "Сухиничи", - "Сухой Лог", - "Сызрань", - "Сыктывкар", - "Сысерть", - "Сычёвка", - "Сясьстрой", - "Тавда", - "Таганрог", - "Тайга", - "Тайшет", - "Талдом", - "Талица", - "Тамбов", - "Тара", - "Тарко-Сале", - "Таруса", - "Татарск", - "Таштагол", - "Тверь", - "Теберда", - "Тейково", - "Темников", - "Темрюк", - "Терек", - "Тетюши", - "Тимашёвск", - "Тихвин", - "Тихорецк", - "Тобольск", - "Тогучин", - "Тольятти", - "Томари", - "Томмот", - "Томск", - "Топки", - "Торжок", - "Торопец", - "Тосно", - "Тотьма", - "Трёхгорный", - "Троицк", - "Трубчевск", - "Туапсе", - "Туймазы", - "Тула", - "Тулун", - "Туран", - "Туринск", - "Тутаев", - "Тында", - "Тырныауз", - "Тюкалинск", - "Тюмень", - "Уварово", - "Углегорск", - "Углич", - "Удачный", - "Удомля", - "Ужур", - "Узловая", - "Улан-Удэ", - "Ульяновск", - "Унеча", - "Урай", - "Урень", - "Уржум", - "Урус-Мартан", - "Урюпинск", - "Усинск", - "Усмань", - "Усолье-Сибирское", - "Усолье", - "Уссурийск", - "Усть-Джегута", - "Усть-Илимск", - "Усть-Катав", - "Усть-Кут", - "Усть-Лабинск", - "Устюжна", - "Уфа", - "Ухта", - "Учалы", - "Уяр", - "Фатеж", - "ФеодосияОспаривается", - "Фокино", - "Фокино", - "Фролово", - "Фрязино", - "Фурманов", - "Хабаровск", - "Хадыженск", - "Ханты-Мансийск", - "Харабали", - "Харовск", - "Хасавюрт", - "Хвалынск", - "Хилок", - "Химки", - "Холм", - "Холмск", - "Хотьково", - "Цивильск", - "Цимлянск", - "Циолковский", - "Чадан", - "Чайковский", - "Чапаевск", - "Чаплыгин", - "Чебаркуль", - "Чебоксары", - "Чегем", - "Чекалин", - "Челябинск", - "Чердынь", - "Черемхово", - "Черепаново", - "Череповец", - "Черкесск", - "Чёрмоз", - "Черноголовка", - "Черногорск", - "Чернушка", - "Черняховск", - "Чехов", - "Чистополь", - "Чита", - "Чкаловск", - "Чудово", - "Чулым", - "Чусовой", - "Чухлома", - "Шагонар", - "Шадринск", - "Шали", - "Шарыпово", - "Шарья", - "Шатура", - "Шахты", - "Шахунья", - "Шацк", - "Шебекино", - "Шелехов", - "Шенкурск", - "Шилка", - "Шимановск", - "Шиханы", - "Шлиссельбург", - "Шумерля", - "Шумиха", - "Шуя", - "Щёкино", - "ЩёлкиноОспаривается", - "Щёлково", - "Щигры", - "Щучье", - "Электрогорск", - "Электросталь", - "Электроугли", - "Элиста", - "Энгельс", - "Эртиль", - "Югорск", - "Южа", - "Южно-Сахалинск", - "Южно-Сухокумск", - "Южноуральск", - "Юрга", - "Юрьев-Польский", - "Юрьевец", - "Юрюзань", - "Юхнов", - "Ядрин", - "Якутск", - "ЯлтаОспаривается", - "Ялуторовск", - "Янаул", - "Яранск", - "Яровое", - "Ярославль", - "Ярцево", - "Ясногорск", - "Ясный", - "Яхрома", - ], - }); - - List dropdownItemList; - - List cityList; - - CityOfLivingModel copyWith({ - List? dropdownItemList, - List? dropdownItemList1, - }) { - return CityOfLivingModel( - userRegistrationSheet: userRegistrationSheet, - dropdownItemList: dropdownItemList ?? this.dropdownItemList, - cityList: cityList, - ); - } - - @override - List get props => - [dropdownItemList, cityList, userRegistrationSheet]; -} diff --git a/lib/presentation/registration/credentials_screen/bloc/credentials_bloc.dart b/lib/presentation/registration/credentials_screen/bloc/credentials_bloc.dart deleted file mode 100644 index f0d45cc0..00000000 --- a/lib/presentation/registration/credentials_screen/bloc/credentials_bloc.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/credentials_screen/models/credentials_model.dart'; -part 'credentials_event.dart'; -part 'credentials_state.dart'; - -/// A bloc that manages the state of a Credentials according to the event that is dispatched to it. -class CredentialsBloc extends Bloc { - CredentialsBloc(CredentialsState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - CredentialsInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith( - emailController: TextEditingController(), - nameController: TextEditingController(), - passwordController: TextEditingController(), - passwordConfirmationController: TextEditingController(),),); - } -} diff --git a/lib/presentation/registration/credentials_screen/bloc/credentials_event.dart b/lib/presentation/registration/credentials_screen/bloc/credentials_event.dart deleted file mode 100644 index 3001076a..00000000 --- a/lib/presentation/registration/credentials_screen/bloc/credentials_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'credentials_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///Credentials widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class CredentialsEvent extends Equatable {} - -/// Event that is dispatched when the Credentials widget is first created. -class CredentialsInitialEvent extends CredentialsEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/credentials_screen/bloc/credentials_state.dart b/lib/presentation/registration/credentials_screen/bloc/credentials_state.dart deleted file mode 100644 index e127da6e..00000000 --- a/lib/presentation/registration/credentials_screen/bloc/credentials_state.dart +++ /dev/null @@ -1,49 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'credentials_bloc.dart'; - -/// Represents the state of Credentials in the application. -class CredentialsState extends Equatable { - CredentialsState({ - this.emailController, - this.nameController, - this.passwordController, - this.passwordConfirmationController, - this.credentialsModelObj, - }); - - TextEditingController? emailController; - - TextEditingController? nameController; - - TextEditingController? passwordController; - - TextEditingController? passwordConfirmationController; - - CredentialsModel? credentialsModelObj; - - @override - List get props => [ - emailController, - nameController, - passwordController, - passwordConfirmationController, - credentialsModelObj, - ]; - CredentialsState copyWith({ - TextEditingController? nameController, - TextEditingController? emailController, - TextEditingController? passwordController, - TextEditingController? passwordConfirmationController, - CredentialsModel? credentialsModelObj, - }) { - return CredentialsState( - emailController: emailController ?? this.emailController, - nameController: nameController ?? this.nameController, - passwordController: passwordController ?? this.passwordController, - passwordConfirmationController: - passwordConfirmationController ?? this.passwordConfirmationController, - credentialsModelObj: credentialsModelObj ?? this.credentialsModelObj, - ); - } -} diff --git a/lib/presentation/registration/credentials_screen/models/credentials_model.dart b/lib/presentation/registration/credentials_screen/models/credentials_model.dart deleted file mode 100644 index ae6c3201..00000000 --- a/lib/presentation/registration/credentials_screen/models/credentials_model.dart +++ /dev/null @@ -1,22 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [credentials_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class CredentialsModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - - CredentialsModel({required this.userRegistrationSheet}); - - CredentialsModel copyWith({UserRegistrationSheet? userRegistrationSheet}) { - return CredentialsModel( - userRegistrationSheet: - userRegistrationSheet ?? this.userRegistrationSheet, - ); - } - - @override - List get props => [userRegistrationSheet]; -} diff --git a/lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_bloc.dart b/lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_bloc.dart deleted file mode 100644 index 78dec540..00000000 --- a/lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_bloc.dart +++ /dev/null @@ -1,18 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/date_of_birth_screen/models/date_of_birth_model.dart'; -part 'date_of_birth_event.dart'; -part 'date_of_birth_state.dart'; - -/// A bloc that manages the state of a DateOfBirth according to the event that is dispatched to it. -class DateOfBirthBloc extends Bloc { - DateOfBirthBloc(DateOfBirthState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - DateOfBirthInitialEvent event, - Emitter emit, - ) async {} -} diff --git a/lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_event.dart b/lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_event.dart deleted file mode 100644 index 0d6938b5..00000000 --- a/lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'date_of_birth_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///DateOfBirth widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class DateOfBirthEvent extends Equatable {} - -/// Event that is dispatched when the DateOfBirth widget is first created. -class DateOfBirthInitialEvent extends DateOfBirthEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_state.dart b/lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_state.dart deleted file mode 100644 index e54b82c6..00000000 --- a/lib/presentation/registration/date_of_birth_screen/bloc/date_of_birth_state.dart +++ /dev/null @@ -1,20 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'date_of_birth_bloc.dart'; - -/// Represents the state of DateOfBirth in the application. -class DateOfBirthState extends Equatable { - DateOfBirthState({this.dateOfBirthModelObj}); - - DateOfBirthModel? dateOfBirthModelObj; - - @override - List get props => [ - dateOfBirthModelObj, - ]; - DateOfBirthState copyWith({DateOfBirthModel? dateOfBirthModelObj}) { - return DateOfBirthState( - dateOfBirthModelObj: dateOfBirthModelObj ?? this.dateOfBirthModelObj, - ); - } -} diff --git a/lib/presentation/registration/date_of_birth_screen/models/date_of_birth_model.dart b/lib/presentation/registration/date_of_birth_screen/models/date_of_birth_model.dart deleted file mode 100644 index 121b10d6..00000000 --- a/lib/presentation/registration/date_of_birth_screen/models/date_of_birth_model.dart +++ /dev/null @@ -1,21 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [date_of_birth_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class DateOfBirthModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - - DateOfBirthModel({required this.userRegistrationSheet}); - - DateOfBirthModel copyWith() { - return DateOfBirthModel( - userRegistrationSheet: userRegistrationSheet, - ); - } - - @override - List get props => [userRegistrationSheet]; -} diff --git a/lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_bloc.dart b/lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_bloc.dart deleted file mode 100644 index b9494911..00000000 --- a/lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_bloc.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/favorite_foods_screen/models/favorite_foods_model.dart'; -part 'favorite_foods_event.dart'; -part 'favorite_foods_state.dart'; - -/// A bloc that manages the state of a FavoriteFoods according to the event that is dispatched to it. -class FavoriteFoodsBloc extends Bloc { - FavoriteFoodsBloc(FavoriteFoodsState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - FavoriteFoodsInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith( - favoriteFoodsController: TextEditingController(), - unfavoriteFoodsController: TextEditingController(),),); - } -} diff --git a/lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_event.dart b/lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_event.dart deleted file mode 100644 index f930b8e0..00000000 --- a/lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'favorite_foods_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///FavoriteFoods widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class FavoriteFoodsEvent extends Equatable {} - -/// Event that is dispatched when the FavoriteFoods widget is first created. -class FavoriteFoodsInitialEvent extends FavoriteFoodsEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_state.dart b/lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_state.dart deleted file mode 100644 index aa4fc3b8..00000000 --- a/lib/presentation/registration/favorite_foods_screen/bloc/favorite_foods_state.dart +++ /dev/null @@ -1,39 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'favorite_foods_bloc.dart'; - -/// Represents the state of FavoriteFoods in the application. -class FavoriteFoodsState extends Equatable { - FavoriteFoodsState({ - this.favoriteFoodsController, - this.unfavoriteFoodsController, - this.favoriteFoodsModelObj, - }); - - TextEditingController? favoriteFoodsController; - - TextEditingController? unfavoriteFoodsController; - - FavoriteFoodsModel? favoriteFoodsModelObj; - - @override - List get props => [ - favoriteFoodsController, - unfavoriteFoodsController, - favoriteFoodsModelObj, - ]; - FavoriteFoodsState copyWith({ - TextEditingController? favoriteFoodsController, - TextEditingController? unfavoriteFoodsController, - FavoriteFoodsModel? favoriteFoodsModelObj, - }) { - return FavoriteFoodsState( - favoriteFoodsController: - favoriteFoodsController ?? this.favoriteFoodsController, - unfavoriteFoodsController: - unfavoriteFoodsController ?? this.unfavoriteFoodsController, - favoriteFoodsModelObj: - favoriteFoodsModelObj ?? this.favoriteFoodsModelObj, - ); - } -} diff --git a/lib/presentation/registration/favorite_foods_screen/models/favorite_foods_model.dart b/lib/presentation/registration/favorite_foods_screen/models/favorite_foods_model.dart deleted file mode 100644 index 3aeeee20..00000000 --- a/lib/presentation/registration/favorite_foods_screen/models/favorite_foods_model.dart +++ /dev/null @@ -1,20 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [favorite_foods_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class FavoriteFoodsModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - FavoriteFoodsModel({required this.userRegistrationSheet}); - - FavoriteFoodsModel copyWith() { - return FavoriteFoodsModel( - userRegistrationSheet: userRegistrationSheet, - ); - } - - @override - List get props => [userRegistrationSheet]; -} diff --git a/lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_bloc.dart b/lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_bloc.dart deleted file mode 100644 index 7857f8b4..00000000 --- a/lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_bloc.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/favorite_sports_screen/models/favorite_sports_model.dart'; -part 'favorite_sports_event.dart'; -part 'favorite_sports_state.dart'; - -/// A bloc that manages the state of a FavoriteSports according to the event that is dispatched to it. -class FavoriteSportsBloc - extends Bloc { - FavoriteSportsBloc(FavoriteSportsState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - FavoriteSportsInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith(enterinformationController: TextEditingController())); - } -} diff --git a/lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_event.dart b/lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_event.dart deleted file mode 100644 index ae9a018f..00000000 --- a/lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'favorite_sports_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///FavoriteSports widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class FavoriteSportsEvent extends Equatable {} - -/// Event that is dispatched when the FavoriteSports widget is first created. -class FavoriteSportsInitialEvent extends FavoriteSportsEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_state.dart b/lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_state.dart deleted file mode 100644 index c44cb2ad..00000000 --- a/lib/presentation/registration/favorite_sports_screen/bloc/favorite_sports_state.dart +++ /dev/null @@ -1,32 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'favorite_sports_bloc.dart'; - -/// Represents the state of FavoriteSports in the application. -class FavoriteSportsState extends Equatable { - FavoriteSportsState({ - this.enterinformationController, - this.favoriteSportsModelObj, - }); - - TextEditingController? enterinformationController; - - FavoriteSportsModel? favoriteSportsModelObj; - - @override - List get props => [ - enterinformationController, - favoriteSportsModelObj, - ]; - FavoriteSportsState copyWith({ - TextEditingController? enterinformationController, - FavoriteSportsModel? favoriteSportsModelObj, - }) { - return FavoriteSportsState( - enterinformationController: - enterinformationController ?? this.enterinformationController, - favoriteSportsModelObj: - favoriteSportsModelObj ?? this.favoriteSportsModelObj, - ); - } -} diff --git a/lib/presentation/registration/favorite_sports_screen/models/favorite_sports_model.dart b/lib/presentation/registration/favorite_sports_screen/models/favorite_sports_model.dart deleted file mode 100644 index 25481701..00000000 --- a/lib/presentation/registration/favorite_sports_screen/models/favorite_sports_model.dart +++ /dev/null @@ -1,20 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [favorite_sports_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class FavoriteSportsModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - FavoriteSportsModel({required this.userRegistrationSheet}); - - FavoriteSportsModel copyWith() { - return FavoriteSportsModel( - userRegistrationSheet: userRegistrationSheet, - ); - } - - @override - List get props => [userRegistrationSheet]; -} diff --git a/lib/presentation/registration/gender_screen/bloc/gender_bloc.dart b/lib/presentation/registration/gender_screen/bloc/gender_bloc.dart deleted file mode 100644 index fe305815..00000000 --- a/lib/presentation/registration/gender_screen/bloc/gender_bloc.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/gender_screen/models/gender_model.dart'; -part 'gender_event.dart'; -part 'gender_state.dart'; - -/// A bloc that manages the state of a Gender according to the event that is dispatched to it. -class GenderBloc extends Bloc { - GenderBloc(GenderState initialState) : super(initialState) { - on(_onInitialize); - on(_genderSelect); - } - - _onInitialize( - GenderInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith(genderModelObj: state.genderModelObj)); - } - - _genderSelect( - GenderSelectEvent event, - Emitter emit, - ) { - emit(state.copyWith(selectedRadioValue: event.value)); - // state.genderModelObj?.userRegistrationSheet.gender = event.value; - } -} diff --git a/lib/presentation/registration/gender_screen/bloc/gender_event.dart b/lib/presentation/registration/gender_screen/bloc/gender_event.dart deleted file mode 100644 index f6b9f69c..00000000 --- a/lib/presentation/registration/gender_screen/bloc/gender_event.dart +++ /dev/null @@ -1,26 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'gender_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///Gender widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class GenderEvent extends Equatable {} - -class GenderInitialEvent extends GenderEvent { - @override - List get props => []; -} - -class GenderSelectEvent extends GenderEvent { - GenderSelectEvent({required this.value}); - - String value; - - @override - List get props => [ - value, - ]; -} diff --git a/lib/presentation/registration/gender_screen/bloc/gender_state.dart b/lib/presentation/registration/gender_screen/bloc/gender_state.dart deleted file mode 100644 index 996082e8..00000000 --- a/lib/presentation/registration/gender_screen/bloc/gender_state.dart +++ /dev/null @@ -1,30 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'gender_bloc.dart'; - -/// Represents the state of Gender in the application. -class GenderState extends Equatable { - GenderState({ - this.selectedRadioValue, - this.genderModelObj, - }); - - String? selectedRadioValue; - - GenderModel? genderModelObj; - - @override - List get props => [ - selectedRadioValue, - genderModelObj, - ]; - GenderState copyWith({ - String? selectedRadioValue, - GenderModel? genderModelObj, - }) { - return GenderState( - selectedRadioValue: selectedRadioValue ?? this.selectedRadioValue, - genderModelObj: genderModelObj ?? this.genderModelObj, - ); - } -} diff --git a/lib/presentation/registration/gender_screen/models/gender_model.dart b/lib/presentation/registration/gender_screen/models/gender_model.dart deleted file mode 100644 index 69779b41..00000000 --- a/lib/presentation/registration/gender_screen/models/gender_model.dart +++ /dev/null @@ -1,20 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [gender_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class GenderModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - GenderModel({required this.userRegistrationSheet}); - - GenderModel copyWith({UserRegistrationSheet? userRegistrationSheet, gender}) { - return GenderModel( - userRegistrationSheet: - userRegistrationSheet ?? this.userRegistrationSheet,); - } - - @override - List get props => [userRegistrationSheet]; -} diff --git a/lib/presentation/registration/height_screen/bloc/height_bloc.dart b/lib/presentation/registration/height_screen/bloc/height_bloc.dart deleted file mode 100644 index 223f7194..00000000 --- a/lib/presentation/registration/height_screen/bloc/height_bloc.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/height_screen/models/height_model.dart'; -part 'height_event.dart'; -part 'height_state.dart'; - -/// A bloc that manages the state of a Height according to the event that is dispatched to it. -class HeightBloc extends Bloc { - HeightBloc(HeightState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - HeightInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith( - heightModelObj: state.heightModelObj?.copyWith(), - heightController: state.heightController,),); - } -} diff --git a/lib/presentation/registration/height_screen/bloc/height_event.dart b/lib/presentation/registration/height_screen/bloc/height_event.dart deleted file mode 100644 index 1d65dd82..00000000 --- a/lib/presentation/registration/height_screen/bloc/height_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'height_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///Height widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class HeightEvent extends Equatable {} - -/// Event that is dispatched when the Height widget is first created. -class HeightInitialEvent extends HeightEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/height_screen/bloc/height_state.dart b/lib/presentation/registration/height_screen/bloc/height_state.dart deleted file mode 100644 index aa10592f..00000000 --- a/lib/presentation/registration/height_screen/bloc/height_state.dart +++ /dev/null @@ -1,30 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'height_bloc.dart'; - -/// Represents the state of Height in the application. -class HeightState extends Equatable { - HeightState({ - this.heightController, - this.heightModelObj, - }); - - TextEditingController? heightController; - - HeightModel? heightModelObj; - - @override - List get props => [ - heightController, - heightModelObj, - ]; - HeightState copyWith({ - TextEditingController? heightController, - HeightModel? heightModelObj, - }) { - return HeightState( - heightController: heightController ?? this.heightController, - heightModelObj: heightModelObj ?? this.heightModelObj, - ); - } -} diff --git a/lib/presentation/registration/height_screen/models/height_model.dart b/lib/presentation/registration/height_screen/models/height_model.dart deleted file mode 100644 index 3a56580a..00000000 --- a/lib/presentation/registration/height_screen/models/height_model.dart +++ /dev/null @@ -1,25 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [height_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class HeightModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - HeightModel( - {this.dropdownItemList = const [], required this.userRegistrationSheet,}); - - List dropdownItemList; - - HeightModel copyWith({List? dropdownItemList}) { - return HeightModel( - userRegistrationSheet: userRegistrationSheet, - dropdownItemList: dropdownItemList ?? this.dropdownItemList, - ); - } - - @override - List get props => [dropdownItemList, userRegistrationSheet]; -} diff --git a/lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart b/lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart deleted file mode 100644 index 76047173..00000000 --- a/lib/presentation/registration/language_select_screen/bloc/language_select_bloc.dart +++ /dev/null @@ -1,35 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart'; - -part 'language_select_event.dart'; - -part 'language_select_state.dart'; - -/// A bloc that manages the state of a LanguageSelect according to the event that is dispatched to it. -class LanguageSelectBloc extends Bloc { - LanguageSelectBloc(LanguageSelectState initialState) : super(initialState) { - on(_onInitialize); - on(_changeDropDown); - } - - _onInitialize(LanguageSelectInitialEvent event, Emitter emit) async { - emit( - state.copyWith( - languageSelectModelObj: state.languageSelectModelObj?.copyWith(dropdownItemList: fillDropdownItemList()), - ), - ); - } - - _changeDropDown(ChangeDropDownEvent event, Emitter emit) { - emit(state.copyWith(selectedDropDownValue: event.value)); - // state.languageSelectModelObj?.userRegistrationSheet.lang = event.value.title; - } - - List fillDropdownItemList() { - return [ - SelectionPopupModel(id: 1, title: "Русский", isSelected: true), - ]; - } -} diff --git a/lib/presentation/registration/language_select_screen/bloc/language_select_event.dart b/lib/presentation/registration/language_select_screen/bloc/language_select_event.dart deleted file mode 100644 index 5c39a950..00000000 --- a/lib/presentation/registration/language_select_screen/bloc/language_select_event.dart +++ /dev/null @@ -1,28 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'language_select_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///LanguageSelect widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class LanguageSelectEvent extends Equatable {} - -/// Event that is dispatched when the LanguageSelect widget is first created. -class LanguageSelectInitialEvent extends LanguageSelectEvent { - @override - List get props => []; -} - -///event for dropdown selection -class ChangeDropDownEvent extends LanguageSelectEvent { - ChangeDropDownEvent({required this.value}); - - SelectionPopupModel value; - - @override - List get props => [ - value, - ]; -} diff --git a/lib/presentation/registration/language_select_screen/bloc/language_select_state.dart b/lib/presentation/registration/language_select_screen/bloc/language_select_state.dart deleted file mode 100644 index 602a4adc..00000000 --- a/lib/presentation/registration/language_select_screen/bloc/language_select_state.dart +++ /dev/null @@ -1,32 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'language_select_bloc.dart'; - -/// Represents the state of LanguageSelect in the application. -class LanguageSelectState extends Equatable { - LanguageSelectState({ - this.selectedDropDownValue, - this.languageSelectModelObj, - }); - - SelectionPopupModel? selectedDropDownValue; - - LanguageSelectModel? languageSelectModelObj; - - @override - List get props => [ - selectedDropDownValue, - languageSelectModelObj, - ]; - LanguageSelectState copyWith({ - SelectionPopupModel? selectedDropDownValue, - LanguageSelectModel? languageSelectModelObj, - }) { - return LanguageSelectState( - selectedDropDownValue: - selectedDropDownValue ?? this.selectedDropDownValue, - languageSelectModelObj: - languageSelectModelObj ?? this.languageSelectModelObj, - ); - } -} diff --git a/lib/presentation/registration/language_select_screen/models/language_select_model.dart b/lib/presentation/registration/language_select_screen/models/language_select_model.dart deleted file mode 100644 index c337c55e..00000000 --- a/lib/presentation/registration/language_select_screen/models/language_select_model.dart +++ /dev/null @@ -1,51 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; - -/// This class defines the variables used in the [language_select_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class LanguageSelectModel extends Equatable { - LanguageSelectModel({this.dropdownItemList = const []}); - - UserRegistrationSheet userRegistrationSheet = UserRegistrationSheet( - name: '', - firstName: '', - lastName: '', - email: '', - password: '', - passwordConfirmation: '', - termsAccepted: 'accepted', - birthdate: DateTime.now().toString(), - gender: '', - country: '', - city: '', - lang: '', - weight: '', - height: '', - chestCircumference: '', - waistCircumference: '', - hipCircumference: '', - bloodPressureUp: '', - bloodPressureDown: '', - hasHypo: '', - hasHyper: '', - aboutAllergy: '', - aboutTakingPils: '', - aboutSportHobbies: '', - favoriteFoods: '', - unfavoriteFoods: '', - additionalInfo: '', - ); - List dropdownItemList; - - LanguageSelectModel copyWith({List? dropdownItemList}) { - return LanguageSelectModel( - dropdownItemList: dropdownItemList ?? this.dropdownItemList, - ); - } - - @override - List get props => [dropdownItemList]; -} diff --git a/lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_bloc.dart b/lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_bloc.dart deleted file mode 100644 index bd878765..00000000 --- a/lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_bloc.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/medicine_intake_screen/models/medicine_intake_model.dart'; -part 'medicine_intake_event.dart'; -part 'medicine_intake_state.dart'; - -/// A bloc that manages the state of a MedicineIntake according to the event that is dispatched to it. -class MedicineIntakeBloc - extends Bloc { - MedicineIntakeBloc(MedicineIntakeState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - MedicineIntakeInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith(enterInformationController: TextEditingController())); - } -} diff --git a/lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_event.dart b/lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_event.dart deleted file mode 100644 index 0300b286..00000000 --- a/lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'medicine_intake_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///MedicineIntake widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class MedicineIntakeEvent extends Equatable {} - -/// Event that is dispatched when the MedicineIntake widget is first created. -class MedicineIntakeInitialEvent extends MedicineIntakeEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_state.dart b/lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_state.dart deleted file mode 100644 index 8d7958f6..00000000 --- a/lib/presentation/registration/medicine_intake_screen/bloc/medicine_intake_state.dart +++ /dev/null @@ -1,32 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'medicine_intake_bloc.dart'; - -/// Represents the state of MedicineIntake in the application. -class MedicineIntakeState extends Equatable { - MedicineIntakeState({ - this.enterInformationController, - this.medicineIntakeModelObj, - }); - - TextEditingController? enterInformationController; - - MedicineIntakeModel? medicineIntakeModelObj; - - @override - List get props => [ - enterInformationController, - medicineIntakeModelObj, - ]; - MedicineIntakeState copyWith({ - TextEditingController? enterInformationController, - MedicineIntakeModel? medicineIntakeModelObj, - }) { - return MedicineIntakeState( - enterInformationController: - enterInformationController ?? this.enterInformationController, - medicineIntakeModelObj: - medicineIntakeModelObj ?? this.medicineIntakeModelObj, - ); - } -} diff --git a/lib/presentation/registration/medicine_intake_screen/models/medicine_intake_model.dart b/lib/presentation/registration/medicine_intake_screen/models/medicine_intake_model.dart deleted file mode 100644 index f6634de4..00000000 --- a/lib/presentation/registration/medicine_intake_screen/models/medicine_intake_model.dart +++ /dev/null @@ -1,20 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [medicine_intake_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class MedicineIntakeModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - MedicineIntakeModel({required this.userRegistrationSheet}); - - MedicineIntakeModel copyWith() { - return MedicineIntakeModel( - userRegistrationSheet: userRegistrationSheet, - ); - } - - @override - List get props => [userRegistrationSheet]; -} diff --git a/lib/presentation/registration/name_screen/bloc/name_bloc.dart b/lib/presentation/registration/name_screen/bloc/name_bloc.dart deleted file mode 100644 index e4a51431..00000000 --- a/lib/presentation/registration/name_screen/bloc/name_bloc.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/name_screen/models/name_model.dart'; -part 'name_event.dart'; -part 'name_state.dart'; - -/// A bloc that manages the state of a Name according to the event that is dispatched to it. -class NameBloc extends Bloc { - NameBloc(NameState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - NameInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith( - firstNameController: TextEditingController(), - lastNameController: TextEditingController(),),); - } -} diff --git a/lib/presentation/registration/name_screen/bloc/name_event.dart b/lib/presentation/registration/name_screen/bloc/name_event.dart deleted file mode 100644 index 7e102994..00000000 --- a/lib/presentation/registration/name_screen/bloc/name_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'name_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///Name widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class NameEvent extends Equatable {} - -/// Event that is dispatched when the Name widget is first created. -class NameInitialEvent extends NameEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/name_screen/bloc/name_state.dart b/lib/presentation/registration/name_screen/bloc/name_state.dart deleted file mode 100644 index b3e0980b..00000000 --- a/lib/presentation/registration/name_screen/bloc/name_state.dart +++ /dev/null @@ -1,36 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'name_bloc.dart'; - -/// Represents the state of Name in the application. -class NameState extends Equatable { - NameState({ - this.firstNameController, - this.lastNameController, - this.nameModelObj, - }); - - TextEditingController? firstNameController; - - TextEditingController? lastNameController; - - NameModel? nameModelObj; - - @override - List get props => [ - firstNameController, - lastNameController, - nameModelObj, - ]; - NameState copyWith({ - TextEditingController? firstNameController, - TextEditingController? lastNameController, - NameModel? nameModelObj, - }) { - return NameState( - firstNameController: firstNameController ?? this.firstNameController, - lastNameController: lastNameController ?? this.lastNameController, - nameModelObj: nameModelObj ?? this.nameModelObj, - ); - } -} diff --git a/lib/presentation/registration/name_screen/models/name_model.dart b/lib/presentation/registration/name_screen/models/name_model.dart deleted file mode 100644 index 6fa44b07..00000000 --- a/lib/presentation/registration/name_screen/models/name_model.dart +++ /dev/null @@ -1,21 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [name_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class NameModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - NameModel({required this.userRegistrationSheet}); - - NameModel copyWith({UserRegistrationSheet? userRegistrationSheet}) { - return NameModel( - userRegistrationSheet: - userRegistrationSheet ?? this.userRegistrationSheet, - ); - } - - @override - List get props => []; -} diff --git a/lib/presentation/registration/splash_screen/bloc/splash_bloc.dart b/lib/presentation/registration/splash_screen/bloc/splash_bloc.dart deleted file mode 100644 index bdd396f0..00000000 --- a/lib/presentation/registration/splash_screen/bloc/splash_bloc.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:eatvio_app/app_router.dart'; -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/splash_screen/models/splash_model.dart'; - -part 'splash_event.dart'; - -part 'splash_state.dart'; - -/// A bloc that manages the state of a Splash according to the event that is dispatched to it. -class SplashBloc extends Bloc { - SplashBloc(SplashState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - SplashInitialEvent event, - Emitter emit, - ) async { - Future.delayed(const Duration(milliseconds: 3000), () { - AppRouter.navigatorKey.currentContext?.goNamed('myProfileScreen'); - }); - } -} diff --git a/lib/presentation/registration/splash_screen/bloc/splash_event.dart b/lib/presentation/registration/splash_screen/bloc/splash_event.dart deleted file mode 100644 index a78a25bb..00000000 --- a/lib/presentation/registration/splash_screen/bloc/splash_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'splash_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///Splash widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class SplashEvent extends Equatable {} - -/// Event that is dispatched when the Splash widget is first created. -class SplashInitialEvent extends SplashEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/splash_screen/bloc/splash_state.dart b/lib/presentation/registration/splash_screen/bloc/splash_state.dart deleted file mode 100644 index e47ce03e..00000000 --- a/lib/presentation/registration/splash_screen/bloc/splash_state.dart +++ /dev/null @@ -1,20 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'splash_bloc.dart'; - -/// Represents the state of Splash in the application. -class SplashState extends Equatable { - SplashState({this.splashModelObj}); - - SplashModel? splashModelObj; - - @override - List get props => [ - splashModelObj, - ]; - SplashState copyWith({SplashModel? splashModelObj}) { - return SplashState( - splashModelObj: splashModelObj ?? this.splashModelObj, - ); - } -} diff --git a/lib/presentation/registration/splash_screen/models/splash_model.dart b/lib/presentation/registration/splash_screen/models/splash_model.dart deleted file mode 100644 index 6ad8f8f1..00000000 --- a/lib/presentation/registration/splash_screen/models/splash_model.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; - -/// This class defines the variables used in the [splash_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class SplashModel extends Equatable { - SplashModel(); - - SplashModel copyWith() { - return SplashModel(); - } - - @override - List get props => []; -} diff --git a/lib/presentation/registration/splash_screen/splash_screen.dart b/lib/presentation/registration/splash_screen/splash_screen.dart deleted file mode 100644 index f8355f03..00000000 --- a/lib/presentation/registration/splash_screen/splash_screen.dart +++ /dev/null @@ -1,36 +0,0 @@ -import 'bloc/splash_bloc.dart'; -import 'models/splash_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; - -class SplashScreen extends StatelessWidget { - const SplashScreen({Key? key}) : super(key: key); - - static Widget builder(BuildContext context) { - return BlocProvider( - create: (context) => - SplashBloc(SplashState(splashModelObj: SplashModel())) - ..add(SplashInitialEvent()), - child: SplashScreen(),); - } - - @override - Widget build(BuildContext context) { - mediaQueryData = MediaQuery.of(context); - return BlocBuilder(builder: (context, state) { - return SafeArea( - child: Scaffold( - body: SizedBox( - width: double.maxFinite, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox(height: 16.v), - CustomImageView( - imagePath: ImageConstant.img2456927096976, - height: 137.adaptSize, - width: 137.adaptSize,), - ],),),),); - },); - } -} diff --git a/lib/presentation/registration/weight_screen/bloc/weight_bloc.dart b/lib/presentation/registration/weight_screen/bloc/weight_bloc.dart deleted file mode 100644 index f03c8c3b..00000000 --- a/lib/presentation/registration/weight_screen/bloc/weight_bloc.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/registration/weight_screen/models/weight_model.dart'; -part 'weight_event.dart'; -part 'weight_state.dart'; - -/// A bloc that manages the state of a Weight according to the event that is dispatched to it. -class WeightBloc extends Bloc { - WeightBloc(WeightState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - WeightInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith( - weightModelObj: state.weightModelObj?.copyWith(), - weightController: state.weightController,),); - } -} diff --git a/lib/presentation/registration/weight_screen/bloc/weight_event.dart b/lib/presentation/registration/weight_screen/bloc/weight_event.dart deleted file mode 100644 index 1b554c5e..00000000 --- a/lib/presentation/registration/weight_screen/bloc/weight_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'weight_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///Weight widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class WeightEvent extends Equatable {} - -/// Event that is dispatched when the Weight widget is first created. -class WeightInitialEvent extends WeightEvent { - @override - List get props => []; -} diff --git a/lib/presentation/registration/weight_screen/bloc/weight_state.dart b/lib/presentation/registration/weight_screen/bloc/weight_state.dart deleted file mode 100644 index 5d782dfd..00000000 --- a/lib/presentation/registration/weight_screen/bloc/weight_state.dart +++ /dev/null @@ -1,30 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'weight_bloc.dart'; - -/// Represents the state of Weight in the application. -class WeightState extends Equatable { - WeightState({ - this.weightController, - this.weightModelObj, - }); - - TextEditingController? weightController; - - WeightModel? weightModelObj; - - @override - List get props => [ - weightController, - weightModelObj, - ]; - WeightState copyWith({ - TextEditingController? weightController, - WeightModel? weightModelObj, - }) { - return WeightState( - weightController: weightController ?? this.weightController, - weightModelObj: weightModelObj ?? this.weightModelObj, - ); - } -} diff --git a/lib/presentation/registration/weight_screen/models/weight_model.dart b/lib/presentation/registration/weight_screen/models/weight_model.dart deleted file mode 100644 index d5edd078..00000000 --- a/lib/presentation/registration/weight_screen/models/weight_model.dart +++ /dev/null @@ -1,25 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - -/// This class defines the variables used in the [weight_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class WeightModel extends Equatable { - UserRegistrationSheet userRegistrationSheet; - WeightModel( - {this.dropdownItemList = const [], required this.userRegistrationSheet,}); - - List dropdownItemList; - - WeightModel copyWith({List? dropdownItemList}) { - return WeightModel( - userRegistrationSheet: userRegistrationSheet, - dropdownItemList: dropdownItemList ?? this.dropdownItemList, - ); - } - - @override - List get props => [dropdownItemList, userRegistrationSheet]; -} From d859a15cfdaf5975f16910cf9c44bfc7bd013e6a Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 15 Jul 2024 17:06:13 +0300 Subject: [PATCH 20/21] feature(registration): remove .env --- .env | 3 - .gitea/workflows/build.yml | 1 - .gitea/workflows/test.yml | 1 - .gitignore | 1 - lib/app_router.dart | 10 +- lib/core/app_export.dart | 5 +- lib/core/constants/constants.dart | 2 +- lib/core/errors/exceptions.dart | 5 +- .../initialization_state.freezed.dart | 90 ++--- lib/core/utils/image_constant.dart | 18 +- lib/core/utils/progress_dialog_utils.dart | 23 +- lib/core/utils/size_utils.dart | 6 +- .../selection_popup_model.dart | 3 +- .../selection_popup_model.freezed.dart | 43 +-- lib/data/models/tokenModel/token_model.dart | 1 + .../user_registration_model.dart | 56 +-- .../user_registration_model.freezed.dart | 120 ++----- .../user_registration_model.g.dart | 11 +- .../blog_post/models/blog_post_model.dart | 3 +- .../models/blog_post_model.freezed.dart | 58 +-- .../blog_post/models/blog_post_model.g.dart | 6 +- .../presentation/bloc/blog_post_cubit.dart | 3 +- .../bloc/blog_post_state.freezed.dart | 82 ++--- .../presentation/pages/blog_post_screen.dart | 18 +- .../blog_post/services/blog_post_service.dart | 2 +- .../services/blog_post_service.g.dart | 29 +- .../blog_post_create_credentials_model.dart | 1 + .../pages/blog_post_create_screen.dart | 38 +- .../repositories/blog_repository.dart | 3 +- .../services/blog_service.dart | 7 +- .../services/blog_service.g.dart | 32 +- .../new_messages_state.freezed.dart | 86 ++--- .../notifications_state.freezed.dart | 89 ++--- .../widgets/bottom_navigation_bar_widget.dart | 4 +- .../chat/models/chat_message_model.dart | 1 - .../models/chat_message_model.freezed.dart | 59 ++-- .../chat/models/chat_message_model.g.dart | 8 +- .../chat/models/chat_messages_model.dart | 1 - .../models/chat_messages_model.freezed.dart | 62 +--- .../chat/models/chat_messages_model.g.dart | 12 +- lib/features/chat/models/chat_meta_model.dart | 1 - .../chat/models/chat_meta_model.freezed.dart | 49 +-- .../chat/models/chat_meta_model.g.dart | 6 +- lib/features/chat/models/chat_room_model.dart | 1 - .../chat/models/chat_room_model.freezed.dart | 68 +--- .../chat/models/chat_room_model.g.dart | 12 +- .../chat/models/chat_room_settings_model.dart | 1 - .../chat_room_settings_model.freezed.dart | 65 ++-- .../models/chat_room_settings_model.g.dart | 8 +- lib/features/chat/models/chat_user_model.dart | 7 +- .../chat/models/chat_user_model.freezed.dart | 67 ++-- .../chat/models/chat_user_model.g.dart | 6 +- .../chat/models/websocket_info_model.dart | 4 +- .../models/websocket_info_model.freezed.dart | 68 ++-- .../chat/models/websocket_info_model.g.dart | 8 +- .../chat_room_state.freezed.dart | 161 +++------ .../chat/presentation/pages/chat_screen.dart | 6 +- .../bloc/chat_select_bloc.dart | 10 +- .../bloc/chat_select_state.dart | 3 +- .../chat_select_screen/chat_search_view.dart | 2 +- .../chat_select_screen.dart | 9 +- .../widgets/chat_entry_widget.dart | 2 +- .../presentation/pages/photo_view_screen.dart | 3 +- .../widgets/chat_bubble_widget.dart | 10 +- lib/features/chat/services/chat_service.dart | 10 +- .../chat/services/chat_service.g.dart | 84 ++--- .../diary/models/diary_model.freezed.dart | 58 +-- lib/features/diary/models/diary_model.g.dart | 10 +- .../diary/presentation/bloc/diary_cubit.dart | 2 +- .../diary/presentation/bloc/diary_state.dart | 2 +- .../presentation/pages/diary_screen.dart | 6 +- .../diary/repositories/diary_repository.dart | 2 +- .../diary/services/diary_service.dart | 4 +- .../models/feed_blog_post_model.freezed.dart | 51 +-- .../feed/models/feed_blog_post_model.g.dart | 8 +- .../models/feed_blog_post_settings_model.dart | 3 +- ...feed_blog_post_settings_model.freezed.dart | 63 +--- .../feed_blog_post_settings_model.g.dart | 12 +- .../bloc/feed_cubit/feed_state.freezed.dart | 95 ++--- .../feed/presentation/pages/feed_screen.dart | 15 +- lib/features/feed/services/feed_service.dart | 2 +- .../feed/services/feed_service.g.dart | 29 +- .../registration/consts/cities_list.dart | 2 +- .../registration_state.freezed.dart | 37 +- .../pages/additional_information_screen.dart | 4 +- .../pages/blood_pressure_screen.dart | 6 +- .../pages/body_circumferences_screen.dart | 5 +- .../pages/city_of_living_screen.dart | 4 +- .../pages/credentials_screen.dart | 2 +- .../pages/date_of_birth_screen.dart | 40 +-- .../pages/favorite_foods_screen.dart | 2 +- .../pages/favorite_sports_screen.dart | 5 +- .../presentation/pages/gender_screen.dart | 4 +- .../presentation/pages/height_screen.dart | 6 +- .../pages/medicine_intake_screen.dart | 4 +- .../presentation/pages/name_screen.dart | 2 +- .../pages/registration_screen.dart | 12 +- .../presentation/pages/weight_screen.dart | 6 +- .../services/registration_service.dart | 2 +- .../services/registration_service.g.dart | 6 +- lib/localization/app_localization.dart | 22 +- .../en_us/en_us_translations.dart | 9 +- lib/localization/ru/ru_translations.dart | 6 +- lib/locator_service.dart | 4 +- lib/main.dart | 9 +- .../auth/auth_screen/auth_screen.dart | 40 +-- .../auth/auth_screen/bloc/auth_bloc.dart | 4 +- .../bloc/diary_edit_bloc.dart | 55 +-- .../bloc/diary_edit_event.dart | 17 +- .../diary_edit_screen/diary_edit_screen.dart | 22 +- .../models/diary_edit_model.dart | 2 +- .../bloc/diet_create_bloc.dart | 37 +- .../bloc/diet_create_state.dart | 3 +- .../diet_create_screen.dart | 95 ++--- .../diet_edit_screen/bloc/diet_edit_bloc.dart | 25 +- .../bloc/diet_edit_state.dart | 12 +- .../diet_edit_screen/diet_edit_screen.dart | 15 +- .../bloc/diet_select_bloc.dart | 34 +- .../bloc/diet_select_state.dart | 6 +- .../diet_select_screen.dart | 98 +++--- .../diet_show_screen/bloc/diet_show_bloc.dart | 13 +- .../bloc/diet_show_state.dart | 6 +- .../diet_show_screen/diet_show_screen.dart | 84 ++--- .../bloc/blog_post_create_bloc.dart | 17 +- .../bloc/blog_post_create_state.dart | 6 +- ...post_create_credentials_model.freezed.dart | 81 ++--- .../blog_post_create_credentials_model.g.dart | 18 +- .../models/blog_post_create_model.dart | 3 +- .../bloc/blog_post_edit_bloc.dart | 25 +- .../bloc/blog_post_edit_state.dart | 6 +- .../blog_post_edit_screen.dart | 20 +- .../models/blog_post_model.dart | 2 +- .../models/comment_model.dart | 13 +- .../widgets/comment_widget.dart | 27 +- .../feed_screen/widgets/feed_scroll_item.dart | 2 +- .../feed_screen/widgets/feed_search_view.dart | 61 ++-- .../bloc/glossary_screen_bloc.dart | 53 ++- .../bloc/glossary_screen_state.dart | 28 +- .../glossary_screen/glossary_screen.dart | 195 +++++----- .../widgets/glossary_scroll_item.dart | 2 +- .../widgets/glossary_search_widget.dart | 61 ++-- .../bloc/plan_create_bloc.dart | 40 ++- .../bloc/plan_create_state.dart | 3 +- .../plan_create_screen.dart | 49 +-- .../plan_edit_screen/bloc/plan_edit_bloc.dart | 27 +- .../bloc/plan_edit_state.dart | 12 +- .../plan_edit_screen/plan_edit_screen.dart | 15 +- .../bloc/plan_select_bloc.dart | 34 +- .../bloc/plan_select_state.dart | 6 +- .../plan_select_screen.dart | 19 +- .../plan_show_screen/bloc/plan_show_bloc.dart | 13 +- .../bloc/plan_show_state.dart | 6 +- .../plan_show_screen/plan_show_screen.dart | 85 ++--- .../bloc/my_profile_bloc.dart | 18 +- .../bloc/my_profile_state.dart | 122 +++---- .../my_profile_screen/my_profile_screen.dart | 32 +- .../my_profile_screen/my_settings_screen.dart | 73 ++-- .../bloc/recipe_create_bloc.dart | 81 +++-- .../bloc/recipe_create_state.dart | 39 +- .../recipe_create_screen.dart | 333 +++++++++--------- .../bloc/recipe_edit_bloc.dart | 15 +- .../bloc/recipe_edit_state.dart | 29 +- .../recipe_edit_screen.dart | 312 ++++++++-------- .../bloc/recipe_select_bloc.dart | 12 +- .../recipe_select_screen.dart | 99 +++--- .../bloc/recipe_show_bloc.dart | 23 +- .../bloc/recipe_show_state.dart | 41 +-- .../recipe_show_screen.dart | 255 +++++++------- .../widgets/comment_widget.dart | 27 +- .../bloc/subscribers_bloc.dart | 14 +- .../bloc/subscribers_state.dart | 6 +- .../subscribers_screen.dart | 35 +- lib/theme/app_decoration.dart | 2 +- lib/theme/bloc/theme_bloc.dart | 2 + lib/theme/custom_text_style.dart | 1 + lib/theme/theme_helper.dart | 1 + lib/widgets/chart_axis.dart | 2 +- lib/widgets/chart_bars.dart | 2 +- lib/widgets/custom_about_list.dart | 12 +- lib/widgets/custom_expandable_list.dart | 299 ++++++++-------- lib/widgets/custom_hyper_switch.dart | 7 +- lib/widgets/custom_hypo_switch.dart | 7 +- lib/widgets/custom_icon_button.dart | 3 +- lib/widgets/custom_navigation_menu.dart | 5 +- lib/widgets/custom_navigation_menu_item.dart | 2 +- lib/widgets/custom_notification_screen.dart | 7 +- lib/widgets/custom_text_form_field.dart | 2 +- pubspec.yaml | 4 +- 188 files changed, 2509 insertions(+), 3147 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index 0f129f5c..00000000 --- a/.env +++ /dev/null @@ -1,3 +0,0 @@ -SERVER_ROOT='https://mobile-stage.eatvio.ru/api' -STORAGE_URL='https://mobile-stage.eatvio.ru/storage/' -OFERTA='https://mobile-stage.eatvio.ru/oferta_bs.pdf' \ No newline at end of file diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 955d74d5..e8e16098 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -78,7 +78,6 @@ jobs: - name: Test run: | - touch .env flutter test - name: Build apk diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index a21834f8..54d180cb 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -89,7 +89,6 @@ jobs: - name: Test run: | - touch .env flutter test - name: Build apk diff --git a/.gitignore b/.gitignore index 9d9b1cef..4a5c4e73 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,4 @@ /.flutter-plugins /.flutter-plugins-dependencies /.packages -/.env /node_modules/ diff --git a/lib/app_router.dart b/lib/app_router.dart index 8f16666c..9c23dd00 100644 --- a/lib/app_router.dart +++ b/lib/app_router.dart @@ -1,23 +1,23 @@ import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart'; import 'package:eatvio_app/core/token_storage.dart'; +import 'package:eatvio_app/features/blog_post/presentation/pages/blog_post_screen.dart'; +import 'package:eatvio_app/features/blog_post_create/presentation/pages/blog_post_create_screen.dart'; +import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chat_screen.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/chat_select_screen.dart'; +import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart'; +import 'package:eatvio_app/features/feed/presentation/pages/feed_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/registration_screen.dart'; import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart'; import 'package:eatvio_app/presentation/diary/diary_edit_screen/diary_edit_screen.dart'; import 'package:eatvio_app/presentation/diets/diet_create_screen/diet_create_screen.dart'; import 'package:eatvio_app/presentation/diets/diet_select_screen/diet_select_screen.dart'; -import 'package:eatvio_app/features/blog_post_create/presentation/pages/blog_post_create_screen.dart'; import 'package:eatvio_app/presentation/feed/blog_post_edit_screen/blog_post_edit_screen.dart'; -import 'package:eatvio_app/features/blog_post/presentation/pages/blog_post_screen.dart'; -import 'package:eatvio_app/features/feed/presentation/pages/feed_screen.dart'; import 'package:eatvio_app/presentation/glossary/glossary_screen/glossary_screen.dart'; import 'package:eatvio_app/presentation/plans/plan_select_screen/plan_select_screen.dart'; import 'package:eatvio_app/presentation/profile/my_profile_screen/my_profile_screen.dart'; import 'package:eatvio_app/presentation/profile/my_profile_screen/my_settings_screen.dart'; import 'package:eatvio_app/presentation/recipe/recipe_select_screen/recipe_select_screen.dart'; -import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart'; -import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; diff --git a/lib/core/app_export.dart b/lib/core/app_export.dart index ae95a220..76a79551 100644 --- a/lib/core/app_export.dart +++ b/lib/core/app_export.dart @@ -1,6 +1,6 @@ -export 'package:flutter_bloc/flutter_bloc.dart'; export 'package:eatvio_app/core/constants/constants.dart'; export 'package:eatvio_app/core/errors/exceptions.dart'; +export 'package:eatvio_app/core/utils/date_time_utils.dart'; export 'package:eatvio_app/core/utils/image_constant.dart'; export 'package:eatvio_app/core/utils/logger.dart'; export 'package:eatvio_app/core/utils/pref_utils.dart'; @@ -11,6 +11,7 @@ export 'package:eatvio_app/theme/app_decoration.dart'; export 'package:eatvio_app/theme/custom_text_style.dart'; export 'package:eatvio_app/theme/theme_helper.dart'; export 'package:eatvio_app/widgets/custom_image_view.dart'; +export 'package:flutter_bloc/flutter_bloc.dart'; + export '../theme/bloc/theme_bloc.dart'; export '../theme/custom_button_style.dart'; -export 'package:eatvio_app/core/utils/date_time_utils.dart'; diff --git a/lib/core/constants/constants.dart b/lib/core/constants/constants.dart index 8b137891..c0353c48 100644 --- a/lib/core/constants/constants.dart +++ b/lib/core/constants/constants.dart @@ -1 +1 @@ - +const String baseUrl = 'https://mobile-stage.eatvio.ru'; diff --git a/lib/core/errors/exceptions.dart b/lib/core/errors/exceptions.dart index d7d4de89..7cbb3f19 100644 --- a/lib/core/errors/exceptions.dart +++ b/lib/core/errors/exceptions.dart @@ -1,5 +1,5 @@ -import 'package:flutter/material.dart'; import 'package:eatvio_app/main.dart'; +import 'package:flutter/material.dart'; class ServerException implements Exception {} @@ -13,8 +13,7 @@ class NoInternetException implements Exception { NoInternetException([String message = 'NoInternetException Occurred']) { if (globalMessengerKey.currentState != null) { - globalMessengerKey.currentState! - .showSnackBar(SnackBar(content: Text(message))); + globalMessengerKey.currentState!.showSnackBar(SnackBar(content: Text(message))); } this._message = message; } diff --git a/lib/core/initialization_cubit/initialization_state.freezed.dart b/lib/core/initialization_cubit/initialization_state.freezed.dart index 3364e440..b5e8e4dd 100644 --- a/lib/core/initialization_cubit/initialization_state.freezed.dart +++ b/lib/core/initialization_cubit/initialization_state.freezed.dart @@ -70,14 +70,12 @@ mixin _$InitializationState { /// @nodoc abstract class $InitializationStateCopyWith<$Res> { - factory $InitializationStateCopyWith( - InitializationState value, $Res Function(InitializationState) then) = + factory $InitializationStateCopyWith(InitializationState value, $Res Function(InitializationState) then) = _$InitializationStateCopyWithImpl<$Res, InitializationState>; } /// @nodoc -class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState> - implements $InitializationStateCopyWith<$Res> { +class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState> implements $InitializationStateCopyWith<$Res> { _$InitializationStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -88,18 +86,14 @@ class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState> /// @nodoc abstract class _$$InitializationStateImplCopyWith<$Res> { - factory _$$InitializationStateImplCopyWith(_$InitializationStateImpl value, - $Res Function(_$InitializationStateImpl) then) = + factory _$$InitializationStateImplCopyWith(_$InitializationStateImpl value, $Res Function(_$InitializationStateImpl) then) = __$$InitializationStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$InitializationStateImplCopyWithImpl<$Res> - extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateImpl> +class __$$InitializationStateImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateImpl> implements _$$InitializationStateImplCopyWith<$Res> { - __$$InitializationStateImplCopyWithImpl(_$InitializationStateImpl _value, - $Res Function(_$InitializationStateImpl) _then) - : super(_value, _then); + __$$InitializationStateImplCopyWithImpl(_$InitializationStateImpl _value, $Res Function(_$InitializationStateImpl) _then) : super(_value, _then); } /// @nodoc @@ -114,9 +108,7 @@ class _$InitializationStateImpl implements _InitializationState { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$InitializationStateImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$InitializationStateImpl); } @override @@ -203,20 +195,14 @@ abstract class _InitializationState implements InitializationState { /// @nodoc abstract class _$$InitializationStateLoadingImplCopyWith<$Res> { - factory _$$InitializationStateLoadingImplCopyWith( - _$InitializationStateLoadingImpl value, - $Res Function(_$InitializationStateLoadingImpl) then) = + factory _$$InitializationStateLoadingImplCopyWith(_$InitializationStateLoadingImpl value, $Res Function(_$InitializationStateLoadingImpl) then) = __$$InitializationStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc -class __$$InitializationStateLoadingImplCopyWithImpl<$Res> - extends _$InitializationStateCopyWithImpl<$Res, - _$InitializationStateLoadingImpl> +class __$$InitializationStateLoadingImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateLoadingImpl> implements _$$InitializationStateLoadingImplCopyWith<$Res> { - __$$InitializationStateLoadingImplCopyWithImpl( - _$InitializationStateLoadingImpl _value, - $Res Function(_$InitializationStateLoadingImpl) _then) + __$$InitializationStateLoadingImplCopyWithImpl(_$InitializationStateLoadingImpl _value, $Res Function(_$InitializationStateLoadingImpl) _then) : super(_value, _then); } @@ -232,9 +218,7 @@ class _$InitializationStateLoadingImpl implements InitializationStateLoading { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$InitializationStateLoadingImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$InitializationStateLoadingImpl); } @override @@ -321,22 +305,16 @@ abstract class InitializationStateLoading implements InitializationState { /// @nodoc abstract class _$$InitializationStateSuccessImplCopyWith<$Res> { - factory _$$InitializationStateSuccessImplCopyWith( - _$InitializationStateSuccessImpl value, - $Res Function(_$InitializationStateSuccessImpl) then) = + factory _$$InitializationStateSuccessImplCopyWith(_$InitializationStateSuccessImpl value, $Res Function(_$InitializationStateSuccessImpl) then) = __$$InitializationStateSuccessImplCopyWithImpl<$Res>; @useResult $Res call({PusherChannelsClient client}); } /// @nodoc -class __$$InitializationStateSuccessImplCopyWithImpl<$Res> - extends _$InitializationStateCopyWithImpl<$Res, - _$InitializationStateSuccessImpl> +class __$$InitializationStateSuccessImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateSuccessImpl> implements _$$InitializationStateSuccessImplCopyWith<$Res> { - __$$InitializationStateSuccessImplCopyWithImpl( - _$InitializationStateSuccessImpl _value, - $Res Function(_$InitializationStateSuccessImpl) _then) + __$$InitializationStateSuccessImplCopyWithImpl(_$InitializationStateSuccessImpl _value, $Res Function(_$InitializationStateSuccessImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -369,9 +347,7 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess { @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$InitializationStateSuccessImpl && - (identical(other.client, client) || other.client == client)); + (other.runtimeType == runtimeType && other is _$InitializationStateSuccessImpl && (identical(other.client, client) || other.client == client)); } @override @@ -380,9 +356,8 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> - get copyWith => __$$InitializationStateSuccessImplCopyWithImpl< - _$InitializationStateSuccessImpl>(this, _$identity); + _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> get copyWith => + __$$InitializationStateSuccessImplCopyWithImpl<_$InitializationStateSuccessImpl>(this, _$identity); @override @optionalTypeArgs @@ -460,34 +435,25 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess { } abstract class InitializationStateSuccess implements InitializationState { - const factory InitializationStateSuccess( - {required final PusherChannelsClient client}) = - _$InitializationStateSuccessImpl; + const factory InitializationStateSuccess({required final PusherChannelsClient client}) = _$InitializationStateSuccessImpl; PusherChannelsClient get client; @JsonKey(ignore: true) - _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> - get copyWith => throw _privateConstructorUsedError; + _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$InitializationStateErrorImplCopyWith<$Res> { - factory _$$InitializationStateErrorImplCopyWith( - _$InitializationStateErrorImpl value, - $Res Function(_$InitializationStateErrorImpl) then) = + factory _$$InitializationStateErrorImplCopyWith(_$InitializationStateErrorImpl value, $Res Function(_$InitializationStateErrorImpl) then) = __$$InitializationStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$InitializationStateErrorImplCopyWithImpl<$Res> - extends _$InitializationStateCopyWithImpl<$Res, - _$InitializationStateErrorImpl> +class __$$InitializationStateErrorImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateErrorImpl> implements _$$InitializationStateErrorImplCopyWith<$Res> { - __$$InitializationStateErrorImplCopyWithImpl( - _$InitializationStateErrorImpl _value, - $Res Function(_$InitializationStateErrorImpl) _then) + __$$InitializationStateErrorImplCopyWithImpl(_$InitializationStateErrorImpl _value, $Res Function(_$InitializationStateErrorImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -522,8 +488,7 @@ class _$InitializationStateErrorImpl implements InitializationStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$InitializationStateErrorImpl && - (identical(other.errorMessage, errorMessage) || - other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override @@ -532,9 +497,8 @@ class _$InitializationStateErrorImpl implements InitializationStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> - get copyWith => __$$InitializationStateErrorImplCopyWithImpl< - _$InitializationStateErrorImpl>(this, _$identity); + _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> get copyWith => + __$$InitializationStateErrorImplCopyWithImpl<_$InitializationStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -612,11 +576,9 @@ class _$InitializationStateErrorImpl implements InitializationStateError { } abstract class InitializationStateError implements InitializationState { - const factory InitializationStateError({required final String errorMessage}) = - _$InitializationStateErrorImpl; + const factory InitializationStateError({required final String errorMessage}) = _$InitializationStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> - get copyWith => throw _privateConstructorUsedError; + _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/core/utils/image_constant.dart b/lib/core/utils/image_constant.dart index 07aa9abb..6a7785af 100644 --- a/lib/core/utils/image_constant.dart +++ b/lib/core/utils/image_constant.dart @@ -24,15 +24,13 @@ class ImageConstant { // Блог images static String imgRectangle14 = '$imagePath/img_rectangle_14.png'; - static String imgRectangle14220x341 = - '$imagePath/img_rectangle_14_220x341.png'; + static String imgRectangle14220x341 = '$imagePath/img_rectangle_14_220x341.png'; // Блог - Tab Container images static String imgCrop = '$imagePath/img_crop.svg'; // Статья images - static String imgRectangle14220x375 = - '$imagePath/img_rectangle_14_220x375.png'; + static String imgRectangle14220x375 = '$imagePath/img_rectangle_14_220x375.png'; static String imgVector = '$imagePath/img_vector.svg'; @@ -116,13 +114,11 @@ class ImageConstant { static String imgNavBlueGray400 = '$imagePath/img_nav_blue_gray_400.svg'; - static String imgNavBlueGray40024x23 = - '$imagePath/img_nav_blue_gray_400_24x23.svg'; + static String imgNavBlueGray40024x23 = '$imagePath/img_nav_blue_gray_400_24x23.svg'; static String imgNavPrimary = '$imagePath/img_nav_primary.svg'; - static String imgNavBlueGray40024x25 = - '$imagePath/img_nav_blue_gray_400_24x25.svg'; + static String imgNavBlueGray40024x25 = '$imagePath/img_nav_blue_gray_400_24x25.svg'; static String imgEye = '$imagePath/img_eye.svg'; @@ -134,11 +130,9 @@ class ImageConstant { static String imgEllipse142x42 = '$imagePath/img_ellipse_1_42x42.png'; - static String imgIconMoreHorizontal = - '$imagePath/img_icon_more_horizontal.svg'; + static String imgIconMoreHorizontal = '$imagePath/img_icon_more_horizontal.svg'; - static String imgRectangle14250x311 = - '$imagePath/img_rectangle_14_250x311.png'; + static String imgRectangle14250x311 = '$imagePath/img_rectangle_14_250x311.png'; static String imgIconMessageSquare = '$imagePath/img_icon_message_square.svg'; diff --git a/lib/core/utils/progress_dialog_utils.dart b/lib/core/utils/progress_dialog_utils.dart index 98cdac07..ced3347c 100644 --- a/lib/core/utils/progress_dialog_utils.dart +++ b/lib/core/utils/progress_dialog_utils.dart @@ -8,18 +8,19 @@ class ProgressDialogUtils { static void showProgressDialog({BuildContext? context, isCancellable = false}) async { if (!isProgressVisible && AppRouter.navigatorKey.currentState?.overlay?.context != null) { showDialog( - barrierDismissible: isCancellable, - context: AppRouter.navigatorKey.currentState!.overlay!.context, - builder: (BuildContext context) { - return Center( - child: CircularProgressIndicator.adaptive( - strokeWidth: 4, - valueColor: AlwaysStoppedAnimation( - Colors.white, - ), + barrierDismissible: isCancellable, + context: AppRouter.navigatorKey.currentState!.overlay!.context, + builder: (BuildContext context) { + return Center( + child: CircularProgressIndicator.adaptive( + strokeWidth: 4, + valueColor: AlwaysStoppedAnimation( + Colors.white, ), - ); - },); + ), + ); + }, + ); isProgressVisible = true; } } diff --git a/lib/core/utils/size_utils.dart b/lib/core/utils/size_utils.dart index 55953775..04f09c8a 100644 --- a/lib/core/utils/size_utils.dart +++ b/lib/core/utils/size_utils.dart @@ -3,7 +3,8 @@ import 'package:flutter/material.dart'; // This functions are responsible to make UI responsive across all the mobile devices. MediaQueryData mediaQueryData = MediaQueryData.fromView( - WidgetsBinding.instance.platformDispatcher.views.single,); + WidgetsBinding.instance.platformDispatcher.views.single, +); // These are the Viewport values of your Figma Design. // These are used in the code as a reference to create your UI Responsively. @@ -30,8 +31,7 @@ extension ResponsiveExtension on num { double get h => ((this * _width) / FIGMA_DESIGN_WIDTH); ///This method is used to set padding/margin (for the top and bottom side) & height of the screen or widget according to the Viewport height. - double get v => - (this * _height) / (FIGMA_DESIGN_HEIGHT - FIGMA_DESIGN_STATUS_BAR); + double get v => (this * _height) / (FIGMA_DESIGN_HEIGHT - FIGMA_DESIGN_STATUS_BAR); ///This method is used to set smallest px in image height and width double get adaptSize { diff --git a/lib/data/models/selectionPopupModel/selection_popup_model.dart b/lib/data/models/selectionPopupModel/selection_popup_model.dart index 82c519c6..f304e8d1 100644 --- a/lib/data/models/selectionPopupModel/selection_popup_model.dart +++ b/lib/data/models/selectionPopupModel/selection_popup_model.dart @@ -8,7 +8,6 @@ class SelectionPopupModel with _$SelectionPopupModel { int? id, required String title, dynamic value, - @Default(false) - bool isSelected, + @Default(false) bool isSelected, }) = _SelectionPopupModel; } diff --git a/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart b/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart index 917785c7..85c5d006 100644 --- a/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart +++ b/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart @@ -22,22 +22,19 @@ mixin _$SelectionPopupModel { bool get isSelected => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $SelectionPopupModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $SelectionPopupModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $SelectionPopupModelCopyWith<$Res> { - factory $SelectionPopupModelCopyWith( - SelectionPopupModel value, $Res Function(SelectionPopupModel) then) = + factory $SelectionPopupModelCopyWith(SelectionPopupModel value, $Res Function(SelectionPopupModel) then) = _$SelectionPopupModelCopyWithImpl<$Res, SelectionPopupModel>; @useResult $Res call({int? id, String title, dynamic value, bool isSelected}); } /// @nodoc -class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> - implements $SelectionPopupModelCopyWith<$Res> { +class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> implements $SelectionPopupModelCopyWith<$Res> { _$SelectionPopupModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -75,10 +72,8 @@ class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> } /// @nodoc -abstract class _$$SelectionPopupModelImplCopyWith<$Res> - implements $SelectionPopupModelCopyWith<$Res> { - factory _$$SelectionPopupModelImplCopyWith(_$SelectionPopupModelImpl value, - $Res Function(_$SelectionPopupModelImpl) then) = +abstract class _$$SelectionPopupModelImplCopyWith<$Res> implements $SelectionPopupModelCopyWith<$Res> { + factory _$$SelectionPopupModelImplCopyWith(_$SelectionPopupModelImpl value, $Res Function(_$SelectionPopupModelImpl) then) = __$$SelectionPopupModelImplCopyWithImpl<$Res>; @override @useResult @@ -86,12 +81,9 @@ abstract class _$$SelectionPopupModelImplCopyWith<$Res> } /// @nodoc -class __$$SelectionPopupModelImplCopyWithImpl<$Res> - extends _$SelectionPopupModelCopyWithImpl<$Res, _$SelectionPopupModelImpl> +class __$$SelectionPopupModelImplCopyWithImpl<$Res> extends _$SelectionPopupModelCopyWithImpl<$Res, _$SelectionPopupModelImpl> implements _$$SelectionPopupModelImplCopyWith<$Res> { - __$$SelectionPopupModelImplCopyWithImpl(_$SelectionPopupModelImpl _value, - $Res Function(_$SelectionPopupModelImpl) _then) - : super(_value, _then); + __$$SelectionPopupModelImplCopyWithImpl(_$SelectionPopupModelImpl _value, $Res Function(_$SelectionPopupModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -125,8 +117,7 @@ class __$$SelectionPopupModelImplCopyWithImpl<$Res> /// @nodoc class _$SelectionPopupModelImpl implements _SelectionPopupModel { - const _$SelectionPopupModelImpl( - {this.id, required this.title, this.value, this.isSelected = false}); + const _$SelectionPopupModelImpl({this.id, required this.title, this.value, this.isSelected = false}); @override final int? id; @@ -151,28 +142,21 @@ class _$SelectionPopupModelImpl implements _SelectionPopupModel { (identical(other.id, id) || other.id == id) && (identical(other.title, title) || other.title == title) && const DeepCollectionEquality().equals(other.value, value) && - (identical(other.isSelected, isSelected) || - other.isSelected == isSelected)); + (identical(other.isSelected, isSelected) || other.isSelected == isSelected)); } @override - int get hashCode => Object.hash(runtimeType, id, title, - const DeepCollectionEquality().hash(value), isSelected); + int get hashCode => Object.hash(runtimeType, id, title, const DeepCollectionEquality().hash(value), isSelected); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => - __$$SelectionPopupModelImplCopyWithImpl<_$SelectionPopupModelImpl>( - this, _$identity); + __$$SelectionPopupModelImplCopyWithImpl<_$SelectionPopupModelImpl>(this, _$identity); } abstract class _SelectionPopupModel implements SelectionPopupModel { - const factory _SelectionPopupModel( - {final int? id, - required final String title, - final dynamic value, - final bool isSelected}) = _$SelectionPopupModelImpl; + const factory _SelectionPopupModel({final int? id, required final String title, final dynamic value, final bool isSelected}) = _$SelectionPopupModelImpl; @override int? get id; @@ -184,6 +168,5 @@ abstract class _SelectionPopupModel implements SelectionPopupModel { bool get isSelected; @override @JsonKey(ignore: true) - _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => - throw _privateConstructorUsedError; + _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/data/models/tokenModel/token_model.dart b/lib/data/models/tokenModel/token_model.dart index 3aa1d3f6..ce310e2e 100644 --- a/lib/data/models/tokenModel/token_model.dart +++ b/lib/data/models/tokenModel/token_model.dart @@ -1,4 +1,5 @@ import 'package:hive/hive.dart'; + /// https://pub.dev/packages/flutter_secure_storage TODO replace hive to secure_storage for token storage @HiveType(typeId: 0) class TokenModel { diff --git a/lib/data/models/userRegistrationModel/user_registration_model.dart b/lib/data/models/userRegistrationModel/user_registration_model.dart index 686d2068..5e308189 100644 --- a/lib/data/models/userRegistrationModel/user_registration_model.dart +++ b/lib/data/models/userRegistrationModel/user_registration_model.dart @@ -7,17 +7,12 @@ part 'user_registration_model.g.dart'; class UserRegistrationSheet with _$UserRegistrationSheet { const factory UserRegistrationSheet({ required String name, - @JsonKey(name: 'first_name') - required String firstName, - @JsonKey(name: 'last_name') - required String lastName, + @JsonKey(name: 'first_name') required String firstName, + @JsonKey(name: 'last_name') required String lastName, required String email, required String password, - @JsonKey(name: 'password_confirmation') - required String passwordConfirmation, - @Default('accepted') - @JsonKey(name: 'terms') - String termsAccepted, + @JsonKey(name: 'password_confirmation') required String passwordConfirmation, + @Default('accepted') @JsonKey(name: 'terms') String termsAccepted, required String birthdate, required String gender, required String country, @@ -25,35 +20,20 @@ class UserRegistrationSheet with _$UserRegistrationSheet { required String lang, required int weight, required int height, - @JsonKey(name: 'chest_circumference') - required int chestCircumference, - @JsonKey(name: 'waist_circumference') - required int waistCircumference, - @JsonKey(name: 'hip_circumference') - required int hipCircumference, - @JsonKey(name: 'blood_pressure_up') - required int bloodPressureUp, - @JsonKey(name: 'blood_pressure_down') - required int bloodPressureDown, - @JsonKey(name: 'has_hypo') - required int hasHypo, - @JsonKey(name: 'has_hyper') - required int hasHyper, - @JsonKey(name: 'about_alergy') - required String aboutAllergy, - @JsonKey(name: 'about_taking_pils') - required String aboutTakingPils, - @JsonKey(name: 'about_sport_hobbies') - required String aboutSportHobbies, - @JsonKey(name: 'favorite_foods') - required String favoriteFoods, - @JsonKey(name: 'unfavorite_foods') - required String unfavoriteFoods, - @JsonKey(name: 'additional_info') - required String additionalInfo, - @Default(1.2) - @JsonKey(name: 'activity_coefficient') - double activityCoefficient, + @JsonKey(name: 'chest_circumference') required int chestCircumference, + @JsonKey(name: 'waist_circumference') required int waistCircumference, + @JsonKey(name: 'hip_circumference') required int hipCircumference, + @JsonKey(name: 'blood_pressure_up') required int bloodPressureUp, + @JsonKey(name: 'blood_pressure_down') required int bloodPressureDown, + @JsonKey(name: 'has_hypo') required int hasHypo, + @JsonKey(name: 'has_hyper') required int hasHyper, + @JsonKey(name: 'about_alergy') required String aboutAllergy, + @JsonKey(name: 'about_taking_pils') required String aboutTakingPils, + @JsonKey(name: 'about_sport_hobbies') required String aboutSportHobbies, + @JsonKey(name: 'favorite_foods') required String favoriteFoods, + @JsonKey(name: 'unfavorite_foods') required String unfavoriteFoods, + @JsonKey(name: 'additional_info') required String additionalInfo, + @Default(1.2) @JsonKey(name: 'activity_coefficient') double activityCoefficient, }) = _UserRegistrationSheet; factory UserRegistrationSheet.fromJson(Map json) => _$UserRegistrationSheetFromJson(json); diff --git a/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart b/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart index 4aa91df8..6c445667 100644 --- a/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart +++ b/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart @@ -14,8 +14,7 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); -UserRegistrationSheet _$UserRegistrationSheetFromJson( - Map json) { +UserRegistrationSheet _$UserRegistrationSheetFromJson(Map json) { return _UserRegistrationSheet.fromJson(json); } @@ -70,14 +69,12 @@ mixin _$UserRegistrationSheet { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $UserRegistrationSheetCopyWith get copyWith => - throw _privateConstructorUsedError; + $UserRegistrationSheetCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $UserRegistrationSheetCopyWith<$Res> { - factory $UserRegistrationSheetCopyWith(UserRegistrationSheet value, - $Res Function(UserRegistrationSheet) then) = + factory $UserRegistrationSheetCopyWith(UserRegistrationSheet value, $Res Function(UserRegistrationSheet) then) = _$UserRegistrationSheetCopyWithImpl<$Res, UserRegistrationSheet>; @useResult $Res call( @@ -112,9 +109,7 @@ abstract class $UserRegistrationSheetCopyWith<$Res> { } /// @nodoc -class _$UserRegistrationSheetCopyWithImpl<$Res, - $Val extends UserRegistrationSheet> - implements $UserRegistrationSheetCopyWith<$Res> { +class _$UserRegistrationSheetCopyWithImpl<$Res, $Val extends UserRegistrationSheet> implements $UserRegistrationSheetCopyWith<$Res> { _$UserRegistrationSheetCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -272,11 +267,8 @@ class _$UserRegistrationSheetCopyWithImpl<$Res, } /// @nodoc -abstract class _$$UserRegistrationSheetImplCopyWith<$Res> - implements $UserRegistrationSheetCopyWith<$Res> { - factory _$$UserRegistrationSheetImplCopyWith( - _$UserRegistrationSheetImpl value, - $Res Function(_$UserRegistrationSheetImpl) then) = +abstract class _$$UserRegistrationSheetImplCopyWith<$Res> implements $UserRegistrationSheetCopyWith<$Res> { + factory _$$UserRegistrationSheetImplCopyWith(_$UserRegistrationSheetImpl value, $Res Function(_$UserRegistrationSheetImpl) then) = __$$UserRegistrationSheetImplCopyWithImpl<$Res>; @override @useResult @@ -312,13 +304,9 @@ abstract class _$$UserRegistrationSheetImplCopyWith<$Res> } /// @nodoc -class __$$UserRegistrationSheetImplCopyWithImpl<$Res> - extends _$UserRegistrationSheetCopyWithImpl<$Res, - _$UserRegistrationSheetImpl> +class __$$UserRegistrationSheetImplCopyWithImpl<$Res> extends _$UserRegistrationSheetCopyWithImpl<$Res, _$UserRegistrationSheetImpl> implements _$$UserRegistrationSheetImplCopyWith<$Res> { - __$$UserRegistrationSheetImplCopyWithImpl(_$UserRegistrationSheetImpl _value, - $Res Function(_$UserRegistrationSheetImpl) _then) - : super(_value, _then); + __$$UserRegistrationSheetImplCopyWithImpl(_$UserRegistrationSheetImpl _value, $Res Function(_$UserRegistrationSheetImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -478,8 +466,7 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { @JsonKey(name: 'last_name') required this.lastName, required this.email, required this.password, - @JsonKey(name: 'password_confirmation') - required this.passwordConfirmation, + @JsonKey(name: 'password_confirmation') required this.passwordConfirmation, @JsonKey(name: 'terms') this.termsAccepted = 'accepted', required this.birthdate, required this.gender, @@ -503,8 +490,7 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { @JsonKey(name: 'additional_info') required this.additionalInfo, @JsonKey(name: 'activity_coefficient') this.activityCoefficient = 1.2}); - factory _$UserRegistrationSheetImpl.fromJson(Map json) => - _$$UserRegistrationSheetImplFromJson(json); + factory _$UserRegistrationSheetImpl.fromJson(Map json) => _$$UserRegistrationSheetImplFromJson(json); @override final String name; @@ -592,52 +578,33 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { (other.runtimeType == runtimeType && other is _$UserRegistrationSheetImpl && (identical(other.name, name) || other.name == name) && - (identical(other.firstName, firstName) || - other.firstName == firstName) && - (identical(other.lastName, lastName) || - other.lastName == lastName) && + (identical(other.firstName, firstName) || other.firstName == firstName) && + (identical(other.lastName, lastName) || other.lastName == lastName) && (identical(other.email, email) || other.email == email) && - (identical(other.password, password) || - other.password == password) && - (identical(other.passwordConfirmation, passwordConfirmation) || - other.passwordConfirmation == passwordConfirmation) && - (identical(other.termsAccepted, termsAccepted) || - other.termsAccepted == termsAccepted) && - (identical(other.birthdate, birthdate) || - other.birthdate == birthdate) && + (identical(other.password, password) || other.password == password) && + (identical(other.passwordConfirmation, passwordConfirmation) || other.passwordConfirmation == passwordConfirmation) && + (identical(other.termsAccepted, termsAccepted) || other.termsAccepted == termsAccepted) && + (identical(other.birthdate, birthdate) || other.birthdate == birthdate) && (identical(other.gender, gender) || other.gender == gender) && (identical(other.country, country) || other.country == country) && (identical(other.city, city) || other.city == city) && (identical(other.lang, lang) || other.lang == lang) && (identical(other.weight, weight) || other.weight == weight) && (identical(other.height, height) || other.height == height) && - (identical(other.chestCircumference, chestCircumference) || - other.chestCircumference == chestCircumference) && - (identical(other.waistCircumference, waistCircumference) || - other.waistCircumference == waistCircumference) && - (identical(other.hipCircumference, hipCircumference) || - other.hipCircumference == hipCircumference) && - (identical(other.bloodPressureUp, bloodPressureUp) || - other.bloodPressureUp == bloodPressureUp) && - (identical(other.bloodPressureDown, bloodPressureDown) || - other.bloodPressureDown == bloodPressureDown) && + (identical(other.chestCircumference, chestCircumference) || other.chestCircumference == chestCircumference) && + (identical(other.waistCircumference, waistCircumference) || other.waistCircumference == waistCircumference) && + (identical(other.hipCircumference, hipCircumference) || other.hipCircumference == hipCircumference) && + (identical(other.bloodPressureUp, bloodPressureUp) || other.bloodPressureUp == bloodPressureUp) && + (identical(other.bloodPressureDown, bloodPressureDown) || other.bloodPressureDown == bloodPressureDown) && (identical(other.hasHypo, hasHypo) || other.hasHypo == hasHypo) && - (identical(other.hasHyper, hasHyper) || - other.hasHyper == hasHyper) && - (identical(other.aboutAllergy, aboutAllergy) || - other.aboutAllergy == aboutAllergy) && - (identical(other.aboutTakingPils, aboutTakingPils) || - other.aboutTakingPils == aboutTakingPils) && - (identical(other.aboutSportHobbies, aboutSportHobbies) || - other.aboutSportHobbies == aboutSportHobbies) && - (identical(other.favoriteFoods, favoriteFoods) || - other.favoriteFoods == favoriteFoods) && - (identical(other.unfavoriteFoods, unfavoriteFoods) || - other.unfavoriteFoods == unfavoriteFoods) && - (identical(other.additionalInfo, additionalInfo) || - other.additionalInfo == additionalInfo) && - (identical(other.activityCoefficient, activityCoefficient) || - other.activityCoefficient == activityCoefficient)); + (identical(other.hasHyper, hasHyper) || other.hasHyper == hasHyper) && + (identical(other.aboutAllergy, aboutAllergy) || other.aboutAllergy == aboutAllergy) && + (identical(other.aboutTakingPils, aboutTakingPils) || other.aboutTakingPils == aboutTakingPils) && + (identical(other.aboutSportHobbies, aboutSportHobbies) || other.aboutSportHobbies == aboutSportHobbies) && + (identical(other.favoriteFoods, favoriteFoods) || other.favoriteFoods == favoriteFoods) && + (identical(other.unfavoriteFoods, unfavoriteFoods) || other.unfavoriteFoods == unfavoriteFoods) && + (identical(other.additionalInfo, additionalInfo) || other.additionalInfo == additionalInfo) && + (identical(other.activityCoefficient, activityCoefficient) || other.activityCoefficient == activityCoefficient)); } @JsonKey(ignore: true) @@ -677,9 +644,8 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> - get copyWith => __$$UserRegistrationSheetImplCopyWithImpl< - _$UserRegistrationSheetImpl>(this, _$identity); + _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> get copyWith => + __$$UserRegistrationSheetImplCopyWithImpl<_$UserRegistrationSheetImpl>(this, _$identity); @override Map toJson() { @@ -696,8 +662,7 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { @JsonKey(name: 'last_name') required final String lastName, required final String email, required final String password, - @JsonKey(name: 'password_confirmation') - required final String passwordConfirmation, + @JsonKey(name: 'password_confirmation') required final String passwordConfirmation, @JsonKey(name: 'terms') final String termsAccepted, required final String birthdate, required final String gender, @@ -706,28 +671,22 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { required final String lang, required final int weight, required final int height, - @JsonKey(name: 'chest_circumference') - required final int chestCircumference, - @JsonKey(name: 'waist_circumference') - required final int waistCircumference, + @JsonKey(name: 'chest_circumference') required final int chestCircumference, + @JsonKey(name: 'waist_circumference') required final int waistCircumference, @JsonKey(name: 'hip_circumference') required final int hipCircumference, @JsonKey(name: 'blood_pressure_up') required final int bloodPressureUp, - @JsonKey(name: 'blood_pressure_down') - required final int bloodPressureDown, + @JsonKey(name: 'blood_pressure_down') required final int bloodPressureDown, @JsonKey(name: 'has_hypo') required final int hasHypo, @JsonKey(name: 'has_hyper') required final int hasHyper, @JsonKey(name: 'about_alergy') required final String aboutAllergy, @JsonKey(name: 'about_taking_pils') required final String aboutTakingPils, - @JsonKey(name: 'about_sport_hobbies') - required final String aboutSportHobbies, + @JsonKey(name: 'about_sport_hobbies') required final String aboutSportHobbies, @JsonKey(name: 'favorite_foods') required final String favoriteFoods, @JsonKey(name: 'unfavorite_foods') required final String unfavoriteFoods, @JsonKey(name: 'additional_info') required final String additionalInfo, - @JsonKey(name: 'activity_coefficient') - final double activityCoefficient}) = _$UserRegistrationSheetImpl; + @JsonKey(name: 'activity_coefficient') final double activityCoefficient}) = _$UserRegistrationSheetImpl; - factory _UserRegistrationSheet.fromJson(Map json) = - _$UserRegistrationSheetImpl.fromJson; + factory _UserRegistrationSheet.fromJson(Map json) = _$UserRegistrationSheetImpl.fromJson; @override String get name; @@ -805,6 +764,5 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { double get activityCoefficient; @override @JsonKey(ignore: true) - _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> - get copyWith => throw _privateConstructorUsedError; + _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/data/models/userRegistrationModel/user_registration_model.g.dart b/lib/data/models/userRegistrationModel/user_registration_model.g.dart index 132240b7..7827901c 100644 --- a/lib/data/models/userRegistrationModel/user_registration_model.g.dart +++ b/lib/data/models/userRegistrationModel/user_registration_model.g.dart @@ -6,9 +6,7 @@ part of 'user_registration_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$UserRegistrationSheetImpl _$$UserRegistrationSheetImplFromJson( - Map json) => - _$UserRegistrationSheetImpl( +_$UserRegistrationSheetImpl _$$UserRegistrationSheetImplFromJson(Map json) => _$UserRegistrationSheetImpl( name: json['name'] as String, firstName: json['first_name'] as String, lastName: json['last_name'] as String, @@ -36,13 +34,10 @@ _$UserRegistrationSheetImpl _$$UserRegistrationSheetImplFromJson( favoriteFoods: json['favorite_foods'] as String, unfavoriteFoods: json['unfavorite_foods'] as String, additionalInfo: json['additional_info'] as String, - activityCoefficient: - (json['activity_coefficient'] as num?)?.toDouble() ?? 1.2, + activityCoefficient: (json['activity_coefficient'] as num?)?.toDouble() ?? 1.2, ); -Map _$$UserRegistrationSheetImplToJson( - _$UserRegistrationSheetImpl instance) => - { +Map _$$UserRegistrationSheetImplToJson(_$UserRegistrationSheetImpl instance) => { 'name': instance.name, 'first_name': instance.firstName, 'last_name': instance.lastName, diff --git a/lib/features/blog_post/models/blog_post_model.dart b/lib/features/blog_post/models/blog_post_model.dart index df39fe1e..1a428e0c 100644 --- a/lib/features/blog_post/models/blog_post_model.dart +++ b/lib/features/blog_post/models/blog_post_model.dart @@ -18,6 +18,5 @@ class BlogPostModel with _$BlogPostModel { required String title, }) = _BlogPostModel; - factory BlogPostModel.fromJson(Map json) => - _$BlogPostModelFromJson(json); + factory BlogPostModel.fromJson(Map json) => _$BlogPostModelFromJson(json); } diff --git a/lib/features/blog_post/models/blog_post_model.freezed.dart b/lib/features/blog_post/models/blog_post_model.freezed.dart index 7c0a750e..06f768a1 100644 --- a/lib/features/blog_post/models/blog_post_model.freezed.dart +++ b/lib/features/blog_post/models/blog_post_model.freezed.dart @@ -36,15 +36,12 @@ mixin _$BlogPostModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $BlogPostModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $BlogPostModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $BlogPostModelCopyWith<$Res> { - factory $BlogPostModelCopyWith( - BlogPostModel value, $Res Function(BlogPostModel) then) = - _$BlogPostModelCopyWithImpl<$Res, BlogPostModel>; + factory $BlogPostModelCopyWith(BlogPostModel value, $Res Function(BlogPostModel) then) = _$BlogPostModelCopyWithImpl<$Res, BlogPostModel>; @useResult $Res call( {int id, @@ -60,8 +57,7 @@ abstract class $BlogPostModelCopyWith<$Res> { } /// @nodoc -class _$BlogPostModelCopyWithImpl<$Res, $Val extends BlogPostModel> - implements $BlogPostModelCopyWith<$Res> { +class _$BlogPostModelCopyWithImpl<$Res, $Val extends BlogPostModel> implements $BlogPostModelCopyWith<$Res> { _$BlogPostModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -129,11 +125,8 @@ class _$BlogPostModelCopyWithImpl<$Res, $Val extends BlogPostModel> } /// @nodoc -abstract class _$$BlogPostModelImplCopyWith<$Res> - implements $BlogPostModelCopyWith<$Res> { - factory _$$BlogPostModelImplCopyWith( - _$BlogPostModelImpl value, $Res Function(_$BlogPostModelImpl) then) = - __$$BlogPostModelImplCopyWithImpl<$Res>; +abstract class _$$BlogPostModelImplCopyWith<$Res> implements $BlogPostModelCopyWith<$Res> { + factory _$$BlogPostModelImplCopyWith(_$BlogPostModelImpl value, $Res Function(_$BlogPostModelImpl) then) = __$$BlogPostModelImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -150,12 +143,8 @@ abstract class _$$BlogPostModelImplCopyWith<$Res> } /// @nodoc -class __$$BlogPostModelImplCopyWithImpl<$Res> - extends _$BlogPostModelCopyWithImpl<$Res, _$BlogPostModelImpl> - implements _$$BlogPostModelImplCopyWith<$Res> { - __$$BlogPostModelImplCopyWithImpl( - _$BlogPostModelImpl _value, $Res Function(_$BlogPostModelImpl) _then) - : super(_value, _then); +class __$$BlogPostModelImplCopyWithImpl<$Res> extends _$BlogPostModelCopyWithImpl<$Res, _$BlogPostModelImpl> implements _$$BlogPostModelImplCopyWith<$Res> { + __$$BlogPostModelImplCopyWithImpl(_$BlogPostModelImpl _value, $Res Function(_$BlogPostModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -231,8 +220,7 @@ class _$BlogPostModelImpl implements _BlogPostModel { @JsonKey(name: "updated_at") required this.updatedAt, required this.title}); - factory _$BlogPostModelImpl.fromJson(Map json) => - _$$BlogPostModelImplFromJson(json); + factory _$BlogPostModelImpl.fromJson(Map json) => _$$BlogPostModelImplFromJson(json); @override final int id; @@ -271,31 +259,23 @@ class _$BlogPostModelImpl implements _BlogPostModel { (identical(other.id, id) || other.id == id) && (identical(other.state, state) || other.state == state) && (identical(other.image, image) || other.image == image) && - (identical(other.description, description) || - other.description == description) && - (identical(other.author_name, author_name) || - other.author_name == author_name) && - (identical(other.author_avatar_path, author_avatar_path) || - other.author_avatar_path == author_avatar_path) && - (identical(other.youtubeUrl, youtubeUrl) || - other.youtubeUrl == youtubeUrl) && - (identical(other.createdAt, createdAt) || - other.createdAt == createdAt) && - (identical(other.updatedAt, updatedAt) || - other.updatedAt == updatedAt) && + (identical(other.description, description) || other.description == description) && + (identical(other.author_name, author_name) || other.author_name == author_name) && + (identical(other.author_avatar_path, author_avatar_path) || other.author_avatar_path == author_avatar_path) && + (identical(other.youtubeUrl, youtubeUrl) || other.youtubeUrl == youtubeUrl) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && (identical(other.title, title) || other.title == title)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, state, image, description, - author_name, author_avatar_path, youtubeUrl, createdAt, updatedAt, title); + int get hashCode => Object.hash(runtimeType, id, state, image, description, author_name, author_avatar_path, youtubeUrl, createdAt, updatedAt, title); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$BlogPostModelImplCopyWith<_$BlogPostModelImpl> get copyWith => - __$$BlogPostModelImplCopyWithImpl<_$BlogPostModelImpl>(this, _$identity); + _$$BlogPostModelImplCopyWith<_$BlogPostModelImpl> get copyWith => __$$BlogPostModelImplCopyWithImpl<_$BlogPostModelImpl>(this, _$identity); @override Map toJson() { @@ -318,8 +298,7 @@ abstract class _BlogPostModel implements BlogPostModel { @JsonKey(name: "updated_at") required final DateTime updatedAt, required final String title}) = _$BlogPostModelImpl; - factory _BlogPostModel.fromJson(Map json) = - _$BlogPostModelImpl.fromJson; + factory _BlogPostModel.fromJson(Map json) = _$BlogPostModelImpl.fromJson; @override int get id; @@ -346,6 +325,5 @@ abstract class _BlogPostModel implements BlogPostModel { String get title; @override @JsonKey(ignore: true) - _$$BlogPostModelImplCopyWith<_$BlogPostModelImpl> get copyWith => - throw _privateConstructorUsedError; + _$$BlogPostModelImplCopyWith<_$BlogPostModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/blog_post/models/blog_post_model.g.dart b/lib/features/blog_post/models/blog_post_model.g.dart index 2e3233c4..137652f2 100644 --- a/lib/features/blog_post/models/blog_post_model.g.dart +++ b/lib/features/blog_post/models/blog_post_model.g.dart @@ -6,8 +6,7 @@ part of 'blog_post_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$BlogPostModelImpl _$$BlogPostModelImplFromJson(Map json) => - _$BlogPostModelImpl( +_$BlogPostModelImpl _$$BlogPostModelImplFromJson(Map json) => _$BlogPostModelImpl( id: (json['id'] as num).toInt(), state: json['state'] as String, image: json['image'] as String?, @@ -20,8 +19,7 @@ _$BlogPostModelImpl _$$BlogPostModelImplFromJson(Map json) => title: json['title'] as String, ); -Map _$$BlogPostModelImplToJson(_$BlogPostModelImpl instance) => - { +Map _$$BlogPostModelImplToJson(_$BlogPostModelImpl instance) => { 'id': instance.id, 'state': instance.state, 'image': instance.image, diff --git a/lib/features/blog_post/presentation/bloc/blog_post_cubit.dart b/lib/features/blog_post/presentation/bloc/blog_post_cubit.dart index 90520c95..301e0efc 100644 --- a/lib/features/blog_post/presentation/bloc/blog_post_cubit.dart +++ b/lib/features/blog_post/presentation/bloc/blog_post_cubit.dart @@ -5,8 +5,7 @@ import 'package:eatvio_app/features/blog_post/repositories/blog_post_repository. class BlogPostCubit extends Cubit { final BlogPostRepository blogPostRepository; - BlogPostCubit({required this.blogPostRepository}) - : super(const BlogPostState.loading()); + BlogPostCubit({required this.blogPostRepository}) : super(const BlogPostState.loading()); loadBlogPost(String blogPostID) async { emit(const BlogPostState.loading()); diff --git a/lib/features/blog_post/presentation/bloc/blog_post_state.freezed.dart b/lib/features/blog_post/presentation/bloc/blog_post_state.freezed.dart index 4f99a3cd..d204df10 100644 --- a/lib/features/blog_post/presentation/bloc/blog_post_state.freezed.dart +++ b/lib/features/blog_post/presentation/bloc/blog_post_state.freezed.dart @@ -70,14 +70,11 @@ mixin _$BlogPostState { /// @nodoc abstract class $BlogPostStateCopyWith<$Res> { - factory $BlogPostStateCopyWith( - BlogPostState value, $Res Function(BlogPostState) then) = - _$BlogPostStateCopyWithImpl<$Res, BlogPostState>; + factory $BlogPostStateCopyWith(BlogPostState value, $Res Function(BlogPostState) then) = _$BlogPostStateCopyWithImpl<$Res, BlogPostState>; } /// @nodoc -class _$BlogPostStateCopyWithImpl<$Res, $Val extends BlogPostState> - implements $BlogPostStateCopyWith<$Res> { +class _$BlogPostStateCopyWithImpl<$Res, $Val extends BlogPostState> implements $BlogPostStateCopyWith<$Res> { _$BlogPostStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -88,18 +85,12 @@ class _$BlogPostStateCopyWithImpl<$Res, $Val extends BlogPostState> /// @nodoc abstract class _$$BlogPostStateImplCopyWith<$Res> { - factory _$$BlogPostStateImplCopyWith( - _$BlogPostStateImpl value, $Res Function(_$BlogPostStateImpl) then) = - __$$BlogPostStateImplCopyWithImpl<$Res>; + factory _$$BlogPostStateImplCopyWith(_$BlogPostStateImpl value, $Res Function(_$BlogPostStateImpl) then) = __$$BlogPostStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$BlogPostStateImplCopyWithImpl<$Res> - extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateImpl> - implements _$$BlogPostStateImplCopyWith<$Res> { - __$$BlogPostStateImplCopyWithImpl( - _$BlogPostStateImpl _value, $Res Function(_$BlogPostStateImpl) _then) - : super(_value, _then); +class __$$BlogPostStateImplCopyWithImpl<$Res> extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateImpl> implements _$$BlogPostStateImplCopyWith<$Res> { + __$$BlogPostStateImplCopyWithImpl(_$BlogPostStateImpl _value, $Res Function(_$BlogPostStateImpl) _then) : super(_value, _then); } /// @nodoc @@ -114,8 +105,7 @@ class _$BlogPostStateImpl implements _BlogPostState { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$BlogPostStateImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$BlogPostStateImpl); } @override @@ -202,18 +192,14 @@ abstract class _BlogPostState implements BlogPostState { /// @nodoc abstract class _$$BlogPostStateLoadingImplCopyWith<$Res> { - factory _$$BlogPostStateLoadingImplCopyWith(_$BlogPostStateLoadingImpl value, - $Res Function(_$BlogPostStateLoadingImpl) then) = + factory _$$BlogPostStateLoadingImplCopyWith(_$BlogPostStateLoadingImpl value, $Res Function(_$BlogPostStateLoadingImpl) then) = __$$BlogPostStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc -class __$$BlogPostStateLoadingImplCopyWithImpl<$Res> - extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateLoadingImpl> +class __$$BlogPostStateLoadingImplCopyWithImpl<$Res> extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateLoadingImpl> implements _$$BlogPostStateLoadingImplCopyWith<$Res> { - __$$BlogPostStateLoadingImplCopyWithImpl(_$BlogPostStateLoadingImpl _value, - $Res Function(_$BlogPostStateLoadingImpl) _then) - : super(_value, _then); + __$$BlogPostStateLoadingImplCopyWithImpl(_$BlogPostStateLoadingImpl _value, $Res Function(_$BlogPostStateLoadingImpl) _then) : super(_value, _then); } /// @nodoc @@ -228,9 +214,7 @@ class _$BlogPostStateLoadingImpl implements BlogPostStateLoading { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$BlogPostStateLoadingImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$BlogPostStateLoadingImpl); } @override @@ -317,8 +301,7 @@ abstract class BlogPostStateLoading implements BlogPostState { /// @nodoc abstract class _$$BlogPostStateLoadedImplCopyWith<$Res> { - factory _$$BlogPostStateLoadedImplCopyWith(_$BlogPostStateLoadedImpl value, - $Res Function(_$BlogPostStateLoadedImpl) then) = + factory _$$BlogPostStateLoadedImplCopyWith(_$BlogPostStateLoadedImpl value, $Res Function(_$BlogPostStateLoadedImpl) then) = __$$BlogPostStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({BlogPostModel blogPost}); @@ -327,12 +310,9 @@ abstract class _$$BlogPostStateLoadedImplCopyWith<$Res> { } /// @nodoc -class __$$BlogPostStateLoadedImplCopyWithImpl<$Res> - extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateLoadedImpl> +class __$$BlogPostStateLoadedImplCopyWithImpl<$Res> extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateLoadedImpl> implements _$$BlogPostStateLoadedImplCopyWith<$Res> { - __$$BlogPostStateLoadedImplCopyWithImpl(_$BlogPostStateLoadedImpl _value, - $Res Function(_$BlogPostStateLoadedImpl) _then) - : super(_value, _then); + __$$BlogPostStateLoadedImplCopyWithImpl(_$BlogPostStateLoadedImpl _value, $Res Function(_$BlogPostStateLoadedImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -372,10 +352,7 @@ class _$BlogPostStateLoadedImpl implements BlogPostStateLoaded { @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$BlogPostStateLoadedImpl && - (identical(other.blogPost, blogPost) || - other.blogPost == blogPost)); + (other.runtimeType == runtimeType && other is _$BlogPostStateLoadedImpl && (identical(other.blogPost, blogPost) || other.blogPost == blogPost)); } @override @@ -385,8 +362,7 @@ class _$BlogPostStateLoadedImpl implements BlogPostStateLoaded { @override @pragma('vm:prefer-inline') _$$BlogPostStateLoadedImplCopyWith<_$BlogPostStateLoadedImpl> get copyWith => - __$$BlogPostStateLoadedImplCopyWithImpl<_$BlogPostStateLoadedImpl>( - this, _$identity); + __$$BlogPostStateLoadedImplCopyWithImpl<_$BlogPostStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -464,31 +440,25 @@ class _$BlogPostStateLoadedImpl implements BlogPostStateLoaded { } abstract class BlogPostStateLoaded implements BlogPostState { - const factory BlogPostStateLoaded({required final BlogPostModel blogPost}) = - _$BlogPostStateLoadedImpl; + const factory BlogPostStateLoaded({required final BlogPostModel blogPost}) = _$BlogPostStateLoadedImpl; BlogPostModel get blogPost; @JsonKey(ignore: true) - _$$BlogPostStateLoadedImplCopyWith<_$BlogPostStateLoadedImpl> get copyWith => - throw _privateConstructorUsedError; + _$$BlogPostStateLoadedImplCopyWith<_$BlogPostStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$BlogPostStateErrorImplCopyWith<$Res> { - factory _$$BlogPostStateErrorImplCopyWith(_$BlogPostStateErrorImpl value, - $Res Function(_$BlogPostStateErrorImpl) then) = + factory _$$BlogPostStateErrorImplCopyWith(_$BlogPostStateErrorImpl value, $Res Function(_$BlogPostStateErrorImpl) then) = __$$BlogPostStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$BlogPostStateErrorImplCopyWithImpl<$Res> - extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateErrorImpl> +class __$$BlogPostStateErrorImplCopyWithImpl<$Res> extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateErrorImpl> implements _$$BlogPostStateErrorImplCopyWith<$Res> { - __$$BlogPostStateErrorImplCopyWithImpl(_$BlogPostStateErrorImpl _value, - $Res Function(_$BlogPostStateErrorImpl) _then) - : super(_value, _then); + __$$BlogPostStateErrorImplCopyWithImpl(_$BlogPostStateErrorImpl _value, $Res Function(_$BlogPostStateErrorImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -522,8 +492,7 @@ class _$BlogPostStateErrorImpl implements BlogPostStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$BlogPostStateErrorImpl && - (identical(other.errorMessage, errorMessage) || - other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override @@ -533,8 +502,7 @@ class _$BlogPostStateErrorImpl implements BlogPostStateError { @override @pragma('vm:prefer-inline') _$$BlogPostStateErrorImplCopyWith<_$BlogPostStateErrorImpl> get copyWith => - __$$BlogPostStateErrorImplCopyWithImpl<_$BlogPostStateErrorImpl>( - this, _$identity); + __$$BlogPostStateErrorImplCopyWithImpl<_$BlogPostStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -612,11 +580,9 @@ class _$BlogPostStateErrorImpl implements BlogPostStateError { } abstract class BlogPostStateError implements BlogPostState { - const factory BlogPostStateError({required final String errorMessage}) = - _$BlogPostStateErrorImpl; + const factory BlogPostStateError({required final String errorMessage}) = _$BlogPostStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$BlogPostStateErrorImplCopyWith<_$BlogPostStateErrorImpl> get copyWith => - throw _privateConstructorUsedError; + _$$BlogPostStateErrorImplCopyWith<_$BlogPostStateErrorImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/blog_post/presentation/pages/blog_post_screen.dart b/lib/features/blog_post/presentation/pages/blog_post_screen.dart index f9fc9696..c46c8b15 100644 --- a/lib/features/blog_post/presentation/pages/blog_post_screen.dart +++ b/lib/features/blog_post/presentation/pages/blog_post_screen.dart @@ -1,15 +1,14 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/blog_post/presentation/bloc/blog_post_cubit.dart'; import 'package:eatvio_app/features/blog_post/presentation/bloc/blog_post_state.dart'; import 'package:eatvio_app/locator_service.dart'; -import 'package:go_router/go_router.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart'; import 'package:eatvio_app/widgets/custom_outlined_button.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:intl/intl.dart'; class BlogPostScreen extends StatelessWidget { final String blogPostID; @@ -97,8 +96,7 @@ class BlogPostScreen extends StatelessWidget { ), ), CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + - (state.blogPost.author_avatar_path ?? ''), + imageUrl: baseUrl + '/storage/' + (state.blogPost.author_avatar_path ?? ''), imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 25, @@ -221,7 +219,7 @@ class BlogPostScreen extends StatelessWidget { _buildImage(BlogPostStateLoaded state) { return CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (state.blogPost.image ?? ""), + imageUrl: baseUrl + '/storage/' + (state.blogPost.image ?? ""), imageBuilder: (context, imageProvider) => Stack( children: [ ClipRRect( diff --git a/lib/features/blog_post/services/blog_post_service.dart b/lib/features/blog_post/services/blog_post_service.dart index a406a7f3..00d8e560 100644 --- a/lib/features/blog_post/services/blog_post_service.dart +++ b/lib/features/blog_post/services/blog_post_service.dart @@ -8,6 +8,6 @@ part 'blog_post_service.g.dart'; abstract class BlogPostService { factory BlogPostService(Dio dio, {String baseUrl}) = _BlogPostService; - @GET('/feed/show/{id}') + @GET('/api/feed/show/{id}') Future getBlogPost(@Path() String id); } diff --git a/lib/features/blog_post/services/blog_post_service.g.dart b/lib/features/blog_post/services/blog_post_service.g.dart index c99e7859..bed41992 100644 --- a/lib/features/blog_post/services/blog_post_service.g.dart +++ b/lib/features/blog_post/services/blog_post_service.g.dart @@ -24,31 +24,28 @@ class _BlogPostService implements BlogPostService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType(Options( + final _result = await _dio.fetch>(_setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/feed/show/${id}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); + .compose( + _dio.options, + '/api/feed/show/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); final _value = BlogPostModel.fromJson(_result.data!); return _value; } RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && - !(requestOptions.responseType == ResponseType.bytes || - requestOptions.responseType == ResponseType.stream)) { + if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) { if (T == String) { requestOptions.responseType = ResponseType.plain; } else { diff --git a/lib/features/blog_post_create/models/blog_post_create_credentials_model.dart b/lib/features/blog_post_create/models/blog_post_create_credentials_model.dart index e961471b..ba68b46b 100644 --- a/lib/features/blog_post_create/models/blog_post_create_credentials_model.dart +++ b/lib/features/blog_post_create/models/blog_post_create_credentials_model.dart @@ -1,4 +1,5 @@ import 'package:freezed_annotation/freezed_annotation.dart'; + part '../../../presentation/feed/blog_post_create_screen/models/blog_post_create_credentials_model.freezed.dart'; part '../../../presentation/feed/blog_post_create_screen/models/blog_post_create_credentials_model.g.dart'; diff --git a/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart b/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart index 4bedcf52..755ce127 100644 --- a/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart +++ b/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart @@ -1,11 +1,13 @@ -import '../../../../presentation/feed/blog_post_create_screen/bloc/blog_post_create_bloc.dart'; -import '../../../../presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart'; +import 'dart:io'; + import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; -import 'package:eatvio_app/widgets/custom_text_form_field.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; -import 'dart:io'; + +import '../../../../presentation/feed/blog_post_create_screen/bloc/blog_post_create_bloc.dart'; +import '../../../../presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart'; class BlogPostCreateScreen extends StatelessWidget { const BlogPostCreateScreen({Key? key}) : super(key: key); @@ -13,9 +15,7 @@ class BlogPostCreateScreen extends StatelessWidget { static Widget builder(BuildContext context) { final blog_postID = ModalRoute.of(context)!.settings.arguments; return BlocProvider( - create: (context) => BlogPostCreateBloc(BlogPostCreateState( - blog_postModelObj: - BlogPostCreateModel(blog_postID: blog_postID.toString()))) + create: (context) => BlogPostCreateBloc(BlogPostCreateState(blog_postModelObj: BlogPostCreateModel(blog_postID: blog_postID.toString()))) ..add(BlogPostCreateInitialEvent()), child: BlogPostCreateScreen(), ); @@ -77,15 +77,13 @@ class BlogPostCreateScreen extends StatelessWidget { children: [ Column( children: [ - Text("Заголовок новости", - style: theme.textTheme.bodyLarge), + Text("Заголовок новости", style: theme.textTheme.bodyLarge), CustomTextFormField( controller: state.title, validator: _validateTitle, ), SizedBox(height: 8.0), - Text("Ссылка на YouTube", - style: theme.textTheme.bodyLarge), + Text("Ссылка на YouTube", style: theme.textTheme.bodyLarge), CustomTextFormField( controller: state.youtubeURL, validator: _validateYouTubeLink, @@ -102,8 +100,7 @@ class BlogPostCreateScreen extends StatelessWidget { SizedBox(height: 16.0), // Add widget for image upload here CustomOutlinedButton( - onPressed: () => _submitForm(context, state.title!.text, - state.description!.text, state.youtubeURL!.text), + onPressed: () => _submitForm(context, state.title!.text, state.description!.text, state.youtubeURL!.text), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, text: 'Создать', ), @@ -119,20 +116,16 @@ class BlogPostCreateScreen extends StatelessWidget { } } -_submitForm( - BuildContext context, String title, String description, String youtubeURL) { +_submitForm(BuildContext context, String title, String description, String youtubeURL) { String? titleError = _validateTitle(title); String? descriptionError = _validateDescription(description); String? youtubeURLError = _validateYouTubeLink(youtubeURL); - if (titleError != null || - descriptionError != null || - youtubeURLError != null) { + if (titleError != null || descriptionError != null || youtubeURLError != null) { // Display error messages or handle invalid input as needed // For example, show a snackbar with the error message ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(titleError ?? descriptionError ?? youtubeURLError!)), + SnackBar(content: Text(titleError ?? descriptionError ?? youtubeURLError!)), ); } else { // Proceed with form submission @@ -233,7 +226,6 @@ String? _validateYouTubeLink(value) { } bool _isValidUrl(String url) { - final RegExp urlRegExp = - new RegExp(r"^(http|https):\/\/([\w-]+\.)+[\w-]+(\/[\w-./?%&=]*)?$"); + final RegExp urlRegExp = new RegExp(r"^(http|https):\/\/([\w-]+\.)+[\w-]+(\/[\w-./?%&=]*)?$"); return urlRegExp.hasMatch(url); } diff --git a/lib/features/blog_post_create/repositories/blog_repository.dart b/lib/features/blog_post_create/repositories/blog_repository.dart index e11bce9e..25b70823 100644 --- a/lib/features/blog_post_create/repositories/blog_repository.dart +++ b/lib/features/blog_post_create/repositories/blog_repository.dart @@ -8,8 +8,7 @@ class BlogRepository { required this.blogService, }); - Future createBlogPost( - BlogPostCreateCredentialsModel model) async { + Future createBlogPost(BlogPostCreateCredentialsModel model) async { try { return (await blogService.createBlogPost(model)); } catch (e) { diff --git a/lib/features/blog_post_create/services/blog_service.dart b/lib/features/blog_post_create/services/blog_service.dart index 1291c9a9..142682f5 100644 --- a/lib/features/blog_post_create/services/blog_service.dart +++ b/lib/features/blog_post_create/services/blog_service.dart @@ -1,5 +1,5 @@ -import 'package:eatvio_app/features/blog_post_create/models/blog_post_create_credentials_model.dart'; import 'package:dio/dio.dart'; +import 'package:eatvio_app/features/blog_post_create/models/blog_post_create_credentials_model.dart'; import 'package:retrofit/retrofit.dart'; part 'blog_service.g.dart'; @@ -8,7 +8,6 @@ part 'blog_service.g.dart'; abstract class BlogService { factory BlogService(Dio dio, {String baseUrl}) = _BlogService; - @POST('/blog_post/create') - Future createBlogPost( - BlogPostCreateCredentialsModel model); + @POST('/api/blog_post/create') + Future createBlogPost(BlogPostCreateCredentialsModel model); } diff --git a/lib/features/blog_post_create/services/blog_service.g.dart b/lib/features/blog_post_create/services/blog_service.g.dart index 71ca2119..d30d7d85 100644 --- a/lib/features/blog_post_create/services/blog_service.g.dart +++ b/lib/features/blog_post_create/services/blog_service.g.dart @@ -19,37 +19,33 @@ class _BlogService implements BlogService { String? baseUrl; @override - Future createBlogPost( - BlogPostCreateCredentialsModel model) async { + Future createBlogPost(BlogPostCreateCredentialsModel model) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType(Options( + final _result = await _dio.fetch>(_setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/blog_post/create', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); + .compose( + _dio.options, + '/api/blog_post/create', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); final _value = BlogPostCreateCredentialsModel.fromJson(_result.data!); return _value; } RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && - !(requestOptions.responseType == ResponseType.bytes || - requestOptions.responseType == ResponseType.stream)) { + if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) { if (T == String) { requestOptions.responseType = ResponseType.plain; } else { diff --git a/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart b/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart index 02a1c4bd..68714d7d 100644 --- a/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart +++ b/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart @@ -70,14 +70,11 @@ mixin _$NewMessagesState { /// @nodoc abstract class $NewMessagesStateCopyWith<$Res> { - factory $NewMessagesStateCopyWith( - NewMessagesState value, $Res Function(NewMessagesState) then) = - _$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>; + factory $NewMessagesStateCopyWith(NewMessagesState value, $Res Function(NewMessagesState) then) = _$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>; } /// @nodoc -class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState> - implements $NewMessagesStateCopyWith<$Res> { +class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState> implements $NewMessagesStateCopyWith<$Res> { _$NewMessagesStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -88,18 +85,14 @@ class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState> /// @nodoc abstract class _$$NewMessagesStateImplCopyWith<$Res> { - factory _$$NewMessagesStateImplCopyWith(_$NewMessagesStateImpl value, - $Res Function(_$NewMessagesStateImpl) then) = + factory _$$NewMessagesStateImplCopyWith(_$NewMessagesStateImpl value, $Res Function(_$NewMessagesStateImpl) then) = __$$NewMessagesStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NewMessagesStateImplCopyWithImpl<$Res> - extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateImpl> +class __$$NewMessagesStateImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateImpl> implements _$$NewMessagesStateImplCopyWith<$Res> { - __$$NewMessagesStateImplCopyWithImpl(_$NewMessagesStateImpl _value, - $Res Function(_$NewMessagesStateImpl) _then) - : super(_value, _then); + __$$NewMessagesStateImplCopyWithImpl(_$NewMessagesStateImpl _value, $Res Function(_$NewMessagesStateImpl) _then) : super(_value, _then); } /// @nodoc @@ -114,8 +107,7 @@ class _$NewMessagesStateImpl implements _NewMessagesState { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$NewMessagesStateImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateImpl); } @override @@ -202,19 +194,14 @@ abstract class _NewMessagesState implements NewMessagesState { /// @nodoc abstract class _$$NewMessagesStateEmptyImplCopyWith<$Res> { - factory _$$NewMessagesStateEmptyImplCopyWith( - _$NewMessagesStateEmptyImpl value, - $Res Function(_$NewMessagesStateEmptyImpl) then) = + factory _$$NewMessagesStateEmptyImplCopyWith(_$NewMessagesStateEmptyImpl value, $Res Function(_$NewMessagesStateEmptyImpl) then) = __$$NewMessagesStateEmptyImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NewMessagesStateEmptyImplCopyWithImpl<$Res> - extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateEmptyImpl> +class __$$NewMessagesStateEmptyImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateEmptyImpl> implements _$$NewMessagesStateEmptyImplCopyWith<$Res> { - __$$NewMessagesStateEmptyImplCopyWithImpl(_$NewMessagesStateEmptyImpl _value, - $Res Function(_$NewMessagesStateEmptyImpl) _then) - : super(_value, _then); + __$$NewMessagesStateEmptyImplCopyWithImpl(_$NewMessagesStateEmptyImpl _value, $Res Function(_$NewMessagesStateEmptyImpl) _then) : super(_value, _then); } /// @nodoc @@ -229,9 +216,7 @@ class _$NewMessagesStateEmptyImpl implements NewMessagesStateEmpty { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$NewMessagesStateEmptyImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateEmptyImpl); } @override @@ -318,22 +303,16 @@ abstract class NewMessagesStateEmpty implements NewMessagesState { /// @nodoc abstract class _$$NewMessagesStateLoadedImplCopyWith<$Res> { - factory _$$NewMessagesStateLoadedImplCopyWith( - _$NewMessagesStateLoadedImpl value, - $Res Function(_$NewMessagesStateLoadedImpl) then) = + factory _$$NewMessagesStateLoadedImplCopyWith(_$NewMessagesStateLoadedImpl value, $Res Function(_$NewMessagesStateLoadedImpl) then) = __$$NewMessagesStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({int messagesCount}); } /// @nodoc -class __$$NewMessagesStateLoadedImplCopyWithImpl<$Res> - extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateLoadedImpl> +class __$$NewMessagesStateLoadedImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateLoadedImpl> implements _$$NewMessagesStateLoadedImplCopyWith<$Res> { - __$$NewMessagesStateLoadedImplCopyWithImpl( - _$NewMessagesStateLoadedImpl _value, - $Res Function(_$NewMessagesStateLoadedImpl) _then) - : super(_value, _then); + __$$NewMessagesStateLoadedImplCopyWithImpl(_$NewMessagesStateLoadedImpl _value, $Res Function(_$NewMessagesStateLoadedImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -367,8 +346,7 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateLoadedImpl && - (identical(other.messagesCount, messagesCount) || - other.messagesCount == messagesCount)); + (identical(other.messagesCount, messagesCount) || other.messagesCount == messagesCount)); } @override @@ -377,9 +355,8 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> - get copyWith => __$$NewMessagesStateLoadedImplCopyWithImpl< - _$NewMessagesStateLoadedImpl>(this, _$identity); + _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> get copyWith => + __$$NewMessagesStateLoadedImplCopyWithImpl<_$NewMessagesStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -457,32 +434,25 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded { } abstract class NewMessagesStateLoaded implements NewMessagesState { - const factory NewMessagesStateLoaded({required final int messagesCount}) = - _$NewMessagesStateLoadedImpl; + const factory NewMessagesStateLoaded({required final int messagesCount}) = _$NewMessagesStateLoadedImpl; int get messagesCount; @JsonKey(ignore: true) - _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> - get copyWith => throw _privateConstructorUsedError; + _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$NewMessagesStateErrorImplCopyWith<$Res> { - factory _$$NewMessagesStateErrorImplCopyWith( - _$NewMessagesStateErrorImpl value, - $Res Function(_$NewMessagesStateErrorImpl) then) = + factory _$$NewMessagesStateErrorImplCopyWith(_$NewMessagesStateErrorImpl value, $Res Function(_$NewMessagesStateErrorImpl) then) = __$$NewMessagesStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$NewMessagesStateErrorImplCopyWithImpl<$Res> - extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateErrorImpl> +class __$$NewMessagesStateErrorImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateErrorImpl> implements _$$NewMessagesStateErrorImplCopyWith<$Res> { - __$$NewMessagesStateErrorImplCopyWithImpl(_$NewMessagesStateErrorImpl _value, - $Res Function(_$NewMessagesStateErrorImpl) _then) - : super(_value, _then); + __$$NewMessagesStateErrorImplCopyWithImpl(_$NewMessagesStateErrorImpl _value, $Res Function(_$NewMessagesStateErrorImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -516,8 +486,7 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateErrorImpl && - (identical(other.errorMessage, errorMessage) || - other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override @@ -526,9 +495,8 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> - get copyWith => __$$NewMessagesStateErrorImplCopyWithImpl< - _$NewMessagesStateErrorImpl>(this, _$identity); + _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> get copyWith => + __$$NewMessagesStateErrorImplCopyWithImpl<_$NewMessagesStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -606,11 +574,9 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError { } abstract class NewMessagesStateError implements NewMessagesState { - const factory NewMessagesStateError({required final String errorMessage}) = - _$NewMessagesStateErrorImpl; + const factory NewMessagesStateError({required final String errorMessage}) = _$NewMessagesStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> - get copyWith => throw _privateConstructorUsedError; + _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart b/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart index 0deeebbd..2f985486 100644 --- a/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart +++ b/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart @@ -70,14 +70,12 @@ mixin _$NotificationsState { /// @nodoc abstract class $NotificationsStateCopyWith<$Res> { - factory $NotificationsStateCopyWith( - NotificationsState value, $Res Function(NotificationsState) then) = + factory $NotificationsStateCopyWith(NotificationsState value, $Res Function(NotificationsState) then) = _$NotificationsStateCopyWithImpl<$Res, NotificationsState>; } /// @nodoc -class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> - implements $NotificationsStateCopyWith<$Res> { +class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> implements $NotificationsStateCopyWith<$Res> { _$NotificationsStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -88,18 +86,14 @@ class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> /// @nodoc abstract class _$$NotificationsStateImplCopyWith<$Res> { - factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value, - $Res Function(_$NotificationsStateImpl) then) = + factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value, $Res Function(_$NotificationsStateImpl) then) = __$$NotificationsStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NotificationsStateImplCopyWithImpl<$Res> - extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateImpl> +class __$$NotificationsStateImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateImpl> implements _$$NotificationsStateImplCopyWith<$Res> { - __$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value, - $Res Function(_$NotificationsStateImpl) _then) - : super(_value, _then); + __$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value, $Res Function(_$NotificationsStateImpl) _then) : super(_value, _then); } /// @nodoc @@ -114,8 +108,7 @@ class _$NotificationsStateImpl implements _NotificationsState { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$NotificationsStateImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateImpl); } @override @@ -202,21 +195,14 @@ abstract class _NotificationsState implements NotificationsState { /// @nodoc abstract class _$$NotificationsStateEmptyImplCopyWith<$Res> { - factory _$$NotificationsStateEmptyImplCopyWith( - _$NotificationsStateEmptyImpl value, - $Res Function(_$NotificationsStateEmptyImpl) then) = + factory _$$NotificationsStateEmptyImplCopyWith(_$NotificationsStateEmptyImpl value, $Res Function(_$NotificationsStateEmptyImpl) then) = __$$NotificationsStateEmptyImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NotificationsStateEmptyImplCopyWithImpl<$Res> - extends _$NotificationsStateCopyWithImpl<$Res, - _$NotificationsStateEmptyImpl> +class __$$NotificationsStateEmptyImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateEmptyImpl> implements _$$NotificationsStateEmptyImplCopyWith<$Res> { - __$$NotificationsStateEmptyImplCopyWithImpl( - _$NotificationsStateEmptyImpl _value, - $Res Function(_$NotificationsStateEmptyImpl) _then) - : super(_value, _then); + __$$NotificationsStateEmptyImplCopyWithImpl(_$NotificationsStateEmptyImpl _value, $Res Function(_$NotificationsStateEmptyImpl) _then) : super(_value, _then); } /// @nodoc @@ -231,9 +217,7 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$NotificationsStateEmptyImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateEmptyImpl); } @override @@ -320,22 +304,16 @@ abstract class NotificationsStateEmpty implements NotificationsState { /// @nodoc abstract class _$$NotificationsStateLoadedImplCopyWith<$Res> { - factory _$$NotificationsStateLoadedImplCopyWith( - _$NotificationsStateLoadedImpl value, - $Res Function(_$NotificationsStateLoadedImpl) then) = + factory _$$NotificationsStateLoadedImplCopyWith(_$NotificationsStateLoadedImpl value, $Res Function(_$NotificationsStateLoadedImpl) then) = __$$NotificationsStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({int notificationsCount}); } /// @nodoc -class __$$NotificationsStateLoadedImplCopyWithImpl<$Res> - extends _$NotificationsStateCopyWithImpl<$Res, - _$NotificationsStateLoadedImpl> +class __$$NotificationsStateLoadedImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateLoadedImpl> implements _$$NotificationsStateLoadedImplCopyWith<$Res> { - __$$NotificationsStateLoadedImplCopyWithImpl( - _$NotificationsStateLoadedImpl _value, - $Res Function(_$NotificationsStateLoadedImpl) _then) + __$$NotificationsStateLoadedImplCopyWithImpl(_$NotificationsStateLoadedImpl _value, $Res Function(_$NotificationsStateLoadedImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -370,8 +348,7 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateLoadedImpl && - (identical(other.notificationsCount, notificationsCount) || - other.notificationsCount == notificationsCount)); + (identical(other.notificationsCount, notificationsCount) || other.notificationsCount == notificationsCount)); } @override @@ -380,9 +357,8 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> - get copyWith => __$$NotificationsStateLoadedImplCopyWithImpl< - _$NotificationsStateLoadedImpl>(this, _$identity); + _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> get copyWith => + __$$NotificationsStateLoadedImplCopyWithImpl<_$NotificationsStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -460,34 +436,25 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { } abstract class NotificationsStateLoaded implements NotificationsState { - const factory NotificationsStateLoaded( - {required final int notificationsCount}) = _$NotificationsStateLoadedImpl; + const factory NotificationsStateLoaded({required final int notificationsCount}) = _$NotificationsStateLoadedImpl; int get notificationsCount; @JsonKey(ignore: true) - _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> - get copyWith => throw _privateConstructorUsedError; + _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$NotificationsStateErrorImplCopyWith<$Res> { - factory _$$NotificationsStateErrorImplCopyWith( - _$NotificationsStateErrorImpl value, - $Res Function(_$NotificationsStateErrorImpl) then) = + factory _$$NotificationsStateErrorImplCopyWith(_$NotificationsStateErrorImpl value, $Res Function(_$NotificationsStateErrorImpl) then) = __$$NotificationsStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$NotificationsStateErrorImplCopyWithImpl<$Res> - extends _$NotificationsStateCopyWithImpl<$Res, - _$NotificationsStateErrorImpl> +class __$$NotificationsStateErrorImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateErrorImpl> implements _$$NotificationsStateErrorImplCopyWith<$Res> { - __$$NotificationsStateErrorImplCopyWithImpl( - _$NotificationsStateErrorImpl _value, - $Res Function(_$NotificationsStateErrorImpl) _then) - : super(_value, _then); + __$$NotificationsStateErrorImplCopyWithImpl(_$NotificationsStateErrorImpl _value, $Res Function(_$NotificationsStateErrorImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -521,8 +488,7 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateErrorImpl && - (identical(other.errorMessage, errorMessage) || - other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override @@ -531,9 +497,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> - get copyWith => __$$NotificationsStateErrorImplCopyWithImpl< - _$NotificationsStateErrorImpl>(this, _$identity); + _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> get copyWith => + __$$NotificationsStateErrorImplCopyWithImpl<_$NotificationsStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -611,11 +576,9 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { } abstract class NotificationsStateError implements NotificationsState { - const factory NotificationsStateError({required final String errorMessage}) = - _$NotificationsStateErrorImpl; + const factory NotificationsStateError({required final String errorMessage}) = _$NotificationsStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> - get copyWith => throw _privateConstructorUsedError; + _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart b/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart index 9865221a..5b890281 100644 --- a/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart +++ b/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart @@ -1,13 +1,13 @@ +import 'package:badges/badges.dart' as badges; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_cubit.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.dart'; -import 'package:flutter/material.dart'; import 'package:eatvio_app/widgets/custom_navigation_menu.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:go_router/go_router.dart'; -import 'package:badges/badges.dart' as badges; int currentBottomNavBarIndex = 0; diff --git a/lib/features/chat/models/chat_message_model.dart b/lib/features/chat/models/chat_message_model.dart index 00e17f59..23f03f9f 100644 --- a/lib/features/chat/models/chat_message_model.dart +++ b/lib/features/chat/models/chat_message_model.dart @@ -1,7 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'chat_message_model.freezed.dart'; - part 'chat_message_model.g.dart'; @freezed diff --git a/lib/features/chat/models/chat_message_model.freezed.dart b/lib/features/chat/models/chat_message_model.freezed.dart index 76a91cbc..90e7e724 100644 --- a/lib/features/chat/models/chat_message_model.freezed.dart +++ b/lib/features/chat/models/chat_message_model.freezed.dart @@ -31,15 +31,12 @@ mixin _$ChatMessageModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatMessageModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $ChatMessageModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatMessageModelCopyWith<$Res> { - factory $ChatMessageModelCopyWith( - ChatMessageModel value, $Res Function(ChatMessageModel) then) = - _$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>; + factory $ChatMessageModelCopyWith(ChatMessageModel value, $Res Function(ChatMessageModel) then) = _$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>; @useResult $Res call( {int id, @@ -50,8 +47,7 @@ abstract class $ChatMessageModelCopyWith<$Res> { } /// @nodoc -class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> - implements $ChatMessageModelCopyWith<$Res> { +class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> implements $ChatMessageModelCopyWith<$Res> { _$ChatMessageModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -94,10 +90,8 @@ class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> } /// @nodoc -abstract class _$$ChatMessageModelImplCopyWith<$Res> - implements $ChatMessageModelCopyWith<$Res> { - factory _$$ChatMessageModelImplCopyWith(_$ChatMessageModelImpl value, - $Res Function(_$ChatMessageModelImpl) then) = +abstract class _$$ChatMessageModelImplCopyWith<$Res> implements $ChatMessageModelCopyWith<$Res> { + factory _$$ChatMessageModelImplCopyWith(_$ChatMessageModelImpl value, $Res Function(_$ChatMessageModelImpl) then) = __$$ChatMessageModelImplCopyWithImpl<$Res>; @override @useResult @@ -110,12 +104,9 @@ abstract class _$$ChatMessageModelImplCopyWith<$Res> } /// @nodoc -class __$$ChatMessageModelImplCopyWithImpl<$Res> - extends _$ChatMessageModelCopyWithImpl<$Res, _$ChatMessageModelImpl> +class __$$ChatMessageModelImplCopyWithImpl<$Res> extends _$ChatMessageModelCopyWithImpl<$Res, _$ChatMessageModelImpl> implements _$$ChatMessageModelImplCopyWith<$Res> { - __$$ChatMessageModelImplCopyWithImpl(_$ChatMessageModelImpl _value, - $Res Function(_$ChatMessageModelImpl) _then) - : super(_value, _then); + __$$ChatMessageModelImplCopyWithImpl(_$ChatMessageModelImpl _value, $Res Function(_$ChatMessageModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -162,8 +153,7 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { @JsonKey(name: 'updated_at') required this.updatedAt}) : _mediaData = mediaData; - factory _$ChatMessageModelImpl.fromJson(Map json) => - _$$ChatMessageModelImplFromJson(json); + factory _$ChatMessageModelImpl.fromJson(Map json) => _$$ChatMessageModelImplFromJson(json); @override final int id; @@ -199,25 +189,19 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { other is _$ChatMessageModelImpl && (identical(other.id, id) || other.id == id) && (identical(other.data, data) || other.data == data) && - const DeepCollectionEquality() - .equals(other._mediaData, _mediaData) && - (identical(other.authorId, authorId) || - other.authorId == authorId) && - (identical(other.updatedAt, updatedAt) || - other.updatedAt == updatedAt)); + const DeepCollectionEquality().equals(other._mediaData, _mediaData) && + (identical(other.authorId, authorId) || other.authorId == authorId) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, data, - const DeepCollectionEquality().hash(_mediaData), authorId, updatedAt); + int get hashCode => Object.hash(runtimeType, id, data, const DeepCollectionEquality().hash(_mediaData), authorId, updatedAt); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => - __$$ChatMessageModelImplCopyWithImpl<_$ChatMessageModelImpl>( - this, _$identity); + _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => __$$ChatMessageModelImplCopyWithImpl<_$ChatMessageModelImpl>(this, _$identity); @override Map toJson() { @@ -229,15 +213,13 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { abstract class _ChatMessageModel implements ChatMessageModel { const factory _ChatMessageModel( - {required final int id, - required final String data, - @JsonKey(name: 'media_data') required final List? mediaData, - @JsonKey(name: 'author_id') required final int authorId, - @JsonKey(name: 'updated_at') required final String updatedAt}) = - _$ChatMessageModelImpl; + {required final int id, + required final String data, + @JsonKey(name: 'media_data') required final List? mediaData, + @JsonKey(name: 'author_id') required final int authorId, + @JsonKey(name: 'updated_at') required final String updatedAt}) = _$ChatMessageModelImpl; - factory _ChatMessageModel.fromJson(Map json) = - _$ChatMessageModelImpl.fromJson; + factory _ChatMessageModel.fromJson(Map json) = _$ChatMessageModelImpl.fromJson; @override int get id; @@ -254,6 +236,5 @@ abstract class _ChatMessageModel implements ChatMessageModel { String get updatedAt; @override @JsonKey(ignore: true) - _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => - throw _privateConstructorUsedError; + _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_message_model.g.dart b/lib/features/chat/models/chat_message_model.g.dart index 3a8d1827..70531099 100644 --- a/lib/features/chat/models/chat_message_model.g.dart +++ b/lib/features/chat/models/chat_message_model.g.dart @@ -6,9 +6,7 @@ part of 'chat_message_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatMessageModelImpl _$$ChatMessageModelImplFromJson( - Map json) => - _$ChatMessageModelImpl( +_$ChatMessageModelImpl _$$ChatMessageModelImplFromJson(Map json) => _$ChatMessageModelImpl( id: (json['id'] as num).toInt(), data: json['data'] as String, mediaData: json['media_data'] as List?, @@ -16,9 +14,7 @@ _$ChatMessageModelImpl _$$ChatMessageModelImplFromJson( updatedAt: json['updated_at'] as String, ); -Map _$$ChatMessageModelImplToJson( - _$ChatMessageModelImpl instance) => - { +Map _$$ChatMessageModelImplToJson(_$ChatMessageModelImpl instance) => { 'id': instance.id, 'data': instance.data, 'media_data': instance.mediaData, diff --git a/lib/features/chat/models/chat_messages_model.dart b/lib/features/chat/models/chat_messages_model.dart index 84a51b48..999f598e 100644 --- a/lib/features/chat/models/chat_messages_model.dart +++ b/lib/features/chat/models/chat_messages_model.dart @@ -3,7 +3,6 @@ import 'package:eatvio_app/features/chat/models/chat_meta_model.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'chat_messages_model.freezed.dart'; - part 'chat_messages_model.g.dart'; @freezed diff --git a/lib/features/chat/models/chat_messages_model.freezed.dart b/lib/features/chat/models/chat_messages_model.freezed.dart index a970241c..e7900ce5 100644 --- a/lib/features/chat/models/chat_messages_model.freezed.dart +++ b/lib/features/chat/models/chat_messages_model.freezed.dart @@ -26,26 +26,20 @@ mixin _$ChatMessagesModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatMessagesModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $ChatMessagesModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatMessagesModelCopyWith<$Res> { - factory $ChatMessagesModelCopyWith( - ChatMessagesModel value, $Res Function(ChatMessagesModel) then) = - _$ChatMessagesModelCopyWithImpl<$Res, ChatMessagesModel>; + factory $ChatMessagesModelCopyWith(ChatMessagesModel value, $Res Function(ChatMessagesModel) then) = _$ChatMessagesModelCopyWithImpl<$Res, ChatMessagesModel>; @useResult - $Res call( - {@JsonKey(name: 'data') List messagesList, - ChatMetaModel meta}); + $Res call({@JsonKey(name: 'data') List messagesList, ChatMetaModel meta}); $ChatMetaModelCopyWith<$Res> get meta; } /// @nodoc -class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel> - implements $ChatMessagesModelCopyWith<$Res> { +class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel> implements $ChatMessagesModelCopyWith<$Res> { _$ChatMessagesModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -81,28 +75,21 @@ class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel> } /// @nodoc -abstract class _$$ChatMessagesModelImplCopyWith<$Res> - implements $ChatMessagesModelCopyWith<$Res> { - factory _$$ChatMessagesModelImplCopyWith(_$ChatMessagesModelImpl value, - $Res Function(_$ChatMessagesModelImpl) then) = +abstract class _$$ChatMessagesModelImplCopyWith<$Res> implements $ChatMessagesModelCopyWith<$Res> { + factory _$$ChatMessagesModelImplCopyWith(_$ChatMessagesModelImpl value, $Res Function(_$ChatMessagesModelImpl) then) = __$$ChatMessagesModelImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {@JsonKey(name: 'data') List messagesList, - ChatMetaModel meta}); + $Res call({@JsonKey(name: 'data') List messagesList, ChatMetaModel meta}); @override $ChatMetaModelCopyWith<$Res> get meta; } /// @nodoc -class __$$ChatMessagesModelImplCopyWithImpl<$Res> - extends _$ChatMessagesModelCopyWithImpl<$Res, _$ChatMessagesModelImpl> +class __$$ChatMessagesModelImplCopyWithImpl<$Res> extends _$ChatMessagesModelCopyWithImpl<$Res, _$ChatMessagesModelImpl> implements _$$ChatMessagesModelImplCopyWith<$Res> { - __$$ChatMessagesModelImplCopyWithImpl(_$ChatMessagesModelImpl _value, - $Res Function(_$ChatMessagesModelImpl) _then) - : super(_value, _then); + __$$ChatMessagesModelImplCopyWithImpl(_$ChatMessagesModelImpl _value, $Res Function(_$ChatMessagesModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -126,14 +113,9 @@ class __$$ChatMessagesModelImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() class _$ChatMessagesModelImpl implements _ChatMessagesModel { - const _$ChatMessagesModelImpl( - {@JsonKey(name: 'data') - required final List messagesList, - required this.meta}) - : _messagesList = messagesList; + const _$ChatMessagesModelImpl({@JsonKey(name: 'data') required final List messagesList, required this.meta}) : _messagesList = messagesList; - factory _$ChatMessagesModelImpl.fromJson(Map json) => - _$$ChatMessagesModelImplFromJson(json); + factory _$ChatMessagesModelImpl.fromJson(Map json) => _$$ChatMessagesModelImplFromJson(json); final List _messagesList; @override @@ -157,22 +139,18 @@ class _$ChatMessagesModelImpl implements _ChatMessagesModel { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatMessagesModelImpl && - const DeepCollectionEquality() - .equals(other._messagesList, _messagesList) && + const DeepCollectionEquality().equals(other._messagesList, _messagesList) && (identical(other.meta, meta) || other.meta == meta)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_messagesList), meta); + int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_messagesList), meta); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith => - __$$ChatMessagesModelImplCopyWithImpl<_$ChatMessagesModelImpl>( - this, _$identity); + _$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith => __$$ChatMessagesModelImplCopyWithImpl<_$ChatMessagesModelImpl>(this, _$identity); @override Map toJson() { @@ -183,13 +161,10 @@ class _$ChatMessagesModelImpl implements _ChatMessagesModel { } abstract class _ChatMessagesModel implements ChatMessagesModel { - const factory _ChatMessagesModel( - {@JsonKey(name: 'data') - required final List messagesList, - required final ChatMetaModel meta}) = _$ChatMessagesModelImpl; + const factory _ChatMessagesModel({@JsonKey(name: 'data') required final List messagesList, required final ChatMetaModel meta}) = + _$ChatMessagesModelImpl; - factory _ChatMessagesModel.fromJson(Map json) = - _$ChatMessagesModelImpl.fromJson; + factory _ChatMessagesModel.fromJson(Map json) = _$ChatMessagesModelImpl.fromJson; @override @JsonKey(name: 'data') @@ -198,6 +173,5 @@ abstract class _ChatMessagesModel implements ChatMessagesModel { ChatMetaModel get meta; @override @JsonKey(ignore: true) - _$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith => - throw _privateConstructorUsedError; + _$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_messages_model.g.dart b/lib/features/chat/models/chat_messages_model.g.dart index 6216cd83..1a7fe48b 100644 --- a/lib/features/chat/models/chat_messages_model.g.dart +++ b/lib/features/chat/models/chat_messages_model.g.dart @@ -6,18 +6,12 @@ part of 'chat_messages_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatMessagesModelImpl _$$ChatMessagesModelImplFromJson( - Map json) => - _$ChatMessagesModelImpl( - messagesList: (json['data'] as List) - .map((e) => ChatMessageModel.fromJson(e as Map)) - .toList(), +_$ChatMessagesModelImpl _$$ChatMessagesModelImplFromJson(Map json) => _$ChatMessagesModelImpl( + messagesList: (json['data'] as List).map((e) => ChatMessageModel.fromJson(e as Map)).toList(), meta: ChatMetaModel.fromJson(json['meta'] as Map), ); -Map _$$ChatMessagesModelImplToJson( - _$ChatMessagesModelImpl instance) => - { +Map _$$ChatMessagesModelImplToJson(_$ChatMessagesModelImpl instance) => { 'data': instance.messagesList, 'meta': instance.meta, }; diff --git a/lib/features/chat/models/chat_meta_model.dart b/lib/features/chat/models/chat_meta_model.dart index 4c4d6cf0..b1e68a41 100644 --- a/lib/features/chat/models/chat_meta_model.dart +++ b/lib/features/chat/models/chat_meta_model.dart @@ -1,7 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'chat_meta_model.freezed.dart'; - part 'chat_meta_model.g.dart'; @freezed diff --git a/lib/features/chat/models/chat_meta_model.freezed.dart b/lib/features/chat/models/chat_meta_model.freezed.dart index 11ecb9e2..91eec021 100644 --- a/lib/features/chat/models/chat_meta_model.freezed.dart +++ b/lib/features/chat/models/chat_meta_model.freezed.dart @@ -25,22 +25,18 @@ mixin _$ChatMetaModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatMetaModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $ChatMetaModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatMetaModelCopyWith<$Res> { - factory $ChatMetaModelCopyWith( - ChatMetaModel value, $Res Function(ChatMetaModel) then) = - _$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>; + factory $ChatMetaModelCopyWith(ChatMetaModel value, $Res Function(ChatMetaModel) then) = _$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>; @useResult $Res call({@JsonKey(name: "last_page") int lastPage}); } /// @nodoc -class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> - implements $ChatMetaModelCopyWith<$Res> { +class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> implements $ChatMetaModelCopyWith<$Res> { _$ChatMetaModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -63,23 +59,16 @@ class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> } /// @nodoc -abstract class _$$ChatMetaModelImplCopyWith<$Res> - implements $ChatMetaModelCopyWith<$Res> { - factory _$$ChatMetaModelImplCopyWith( - _$ChatMetaModelImpl value, $Res Function(_$ChatMetaModelImpl) then) = - __$$ChatMetaModelImplCopyWithImpl<$Res>; +abstract class _$$ChatMetaModelImplCopyWith<$Res> implements $ChatMetaModelCopyWith<$Res> { + factory _$$ChatMetaModelImplCopyWith(_$ChatMetaModelImpl value, $Res Function(_$ChatMetaModelImpl) then) = __$$ChatMetaModelImplCopyWithImpl<$Res>; @override @useResult $Res call({@JsonKey(name: "last_page") int lastPage}); } /// @nodoc -class __$$ChatMetaModelImplCopyWithImpl<$Res> - extends _$ChatMetaModelCopyWithImpl<$Res, _$ChatMetaModelImpl> - implements _$$ChatMetaModelImplCopyWith<$Res> { - __$$ChatMetaModelImplCopyWithImpl( - _$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then) - : super(_value, _then); +class __$$ChatMetaModelImplCopyWithImpl<$Res> extends _$ChatMetaModelCopyWithImpl<$Res, _$ChatMetaModelImpl> implements _$$ChatMetaModelImplCopyWith<$Res> { + __$$ChatMetaModelImplCopyWithImpl(_$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -98,11 +87,9 @@ class __$$ChatMetaModelImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() class _$ChatMetaModelImpl implements _ChatMetaModel { - const _$ChatMetaModelImpl( - {@JsonKey(name: "last_page") required this.lastPage}); + const _$ChatMetaModelImpl({@JsonKey(name: "last_page") required this.lastPage}); - factory _$ChatMetaModelImpl.fromJson(Map json) => - _$$ChatMetaModelImplFromJson(json); + factory _$ChatMetaModelImpl.fromJson(Map json) => _$$ChatMetaModelImplFromJson(json); @override @JsonKey(name: "last_page") @@ -116,10 +103,7 @@ class _$ChatMetaModelImpl implements _ChatMetaModel { @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ChatMetaModelImpl && - (identical(other.lastPage, lastPage) || - other.lastPage == lastPage)); + (other.runtimeType == runtimeType && other is _$ChatMetaModelImpl && (identical(other.lastPage, lastPage) || other.lastPage == lastPage)); } @JsonKey(ignore: true) @@ -129,8 +113,7 @@ class _$ChatMetaModelImpl implements _ChatMetaModel { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => - __$$ChatMetaModelImplCopyWithImpl<_$ChatMetaModelImpl>(this, _$identity); + _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => __$$ChatMetaModelImplCopyWithImpl<_$ChatMetaModelImpl>(this, _$identity); @override Map toJson() { @@ -141,18 +124,14 @@ class _$ChatMetaModelImpl implements _ChatMetaModel { } abstract class _ChatMetaModel implements ChatMetaModel { - const factory _ChatMetaModel( - {@JsonKey(name: "last_page") required final int lastPage}) = - _$ChatMetaModelImpl; + const factory _ChatMetaModel({@JsonKey(name: "last_page") required final int lastPage}) = _$ChatMetaModelImpl; - factory _ChatMetaModel.fromJson(Map json) = - _$ChatMetaModelImpl.fromJson; + factory _ChatMetaModel.fromJson(Map json) = _$ChatMetaModelImpl.fromJson; @override @JsonKey(name: "last_page") int get lastPage; @override @JsonKey(ignore: true) - _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => - throw _privateConstructorUsedError; + _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_meta_model.g.dart b/lib/features/chat/models/chat_meta_model.g.dart index 7126e2dd..bbd16d10 100644 --- a/lib/features/chat/models/chat_meta_model.g.dart +++ b/lib/features/chat/models/chat_meta_model.g.dart @@ -6,12 +6,10 @@ part of 'chat_meta_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatMetaModelImpl _$$ChatMetaModelImplFromJson(Map json) => - _$ChatMetaModelImpl( +_$ChatMetaModelImpl _$$ChatMetaModelImplFromJson(Map json) => _$ChatMetaModelImpl( lastPage: (json['last_page'] as num).toInt(), ); -Map _$$ChatMetaModelImplToJson(_$ChatMetaModelImpl instance) => - { +Map _$$ChatMetaModelImplToJson(_$ChatMetaModelImpl instance) => { 'last_page': instance.lastPage, }; diff --git a/lib/features/chat/models/chat_room_model.dart b/lib/features/chat/models/chat_room_model.dart index 0196b49c..f9e9a416 100644 --- a/lib/features/chat/models/chat_room_model.dart +++ b/lib/features/chat/models/chat_room_model.dart @@ -3,7 +3,6 @@ import 'package:eatvio_app/features/chat/models/chat_user_model.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'chat_room_model.freezed.dart'; - part 'chat_room_model.g.dart'; @freezed diff --git a/lib/features/chat/models/chat_room_model.freezed.dart b/lib/features/chat/models/chat_room_model.freezed.dart index 5a0b6e62..216c1b65 100644 --- a/lib/features/chat/models/chat_room_model.freezed.dart +++ b/lib/features/chat/models/chat_room_model.freezed.dart @@ -22,34 +22,25 @@ ChatRoomModel _$ChatRoomModelFromJson(Map json) { mixin _$ChatRoomModel { String get id => throw _privateConstructorUsedError; @JsonKey(name: 'chat_room_setting') - ChatRoomSettingsModel get chatRoomSettings => - throw _privateConstructorUsedError; + ChatRoomSettingsModel get chatRoomSettings => throw _privateConstructorUsedError; Map get users => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatRoomModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $ChatRoomModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatRoomModelCopyWith<$Res> { - factory $ChatRoomModelCopyWith( - ChatRoomModel value, $Res Function(ChatRoomModel) then) = - _$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>; + factory $ChatRoomModelCopyWith(ChatRoomModel value, $Res Function(ChatRoomModel) then) = _$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>; @useResult - $Res call( - {String id, - @JsonKey(name: 'chat_room_setting') - ChatRoomSettingsModel chatRoomSettings, - Map users}); + $Res call({String id, @JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings, Map users}); $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings; } /// @nodoc -class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> - implements $ChatRoomModelCopyWith<$Res> { +class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> implements $ChatRoomModelCopyWith<$Res> { _$ChatRoomModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -83,38 +74,26 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> @override @pragma('vm:prefer-inline') $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings { - return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings, - (value) { + return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings, (value) { return _then(_value.copyWith(chatRoomSettings: value) as $Val); }); } } /// @nodoc -abstract class _$$ChatRoomModelImplCopyWith<$Res> - implements $ChatRoomModelCopyWith<$Res> { - factory _$$ChatRoomModelImplCopyWith( - _$ChatRoomModelImpl value, $Res Function(_$ChatRoomModelImpl) then) = - __$$ChatRoomModelImplCopyWithImpl<$Res>; +abstract class _$$ChatRoomModelImplCopyWith<$Res> implements $ChatRoomModelCopyWith<$Res> { + factory _$$ChatRoomModelImplCopyWith(_$ChatRoomModelImpl value, $Res Function(_$ChatRoomModelImpl) then) = __$$ChatRoomModelImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {String id, - @JsonKey(name: 'chat_room_setting') - ChatRoomSettingsModel chatRoomSettings, - Map users}); + $Res call({String id, @JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings, Map users}); @override $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings; } /// @nodoc -class __$$ChatRoomModelImplCopyWithImpl<$Res> - extends _$ChatRoomModelCopyWithImpl<$Res, _$ChatRoomModelImpl> - implements _$$ChatRoomModelImplCopyWith<$Res> { - __$$ChatRoomModelImplCopyWithImpl( - _$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then) - : super(_value, _then); +class __$$ChatRoomModelImplCopyWithImpl<$Res> extends _$ChatRoomModelCopyWithImpl<$Res, _$ChatRoomModelImpl> implements _$$ChatRoomModelImplCopyWith<$Res> { + __$$ChatRoomModelImplCopyWithImpl(_$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -144,13 +123,10 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res> @JsonSerializable() class _$ChatRoomModelImpl implements _ChatRoomModel { const _$ChatRoomModelImpl( - {required this.id, - @JsonKey(name: 'chat_room_setting') required this.chatRoomSettings, - required final Map users}) + {required this.id, @JsonKey(name: 'chat_room_setting') required this.chatRoomSettings, required final Map users}) : _users = users; - factory _$ChatRoomModelImpl.fromJson(Map json) => - _$$ChatRoomModelImplFromJson(json); + factory _$ChatRoomModelImpl.fromJson(Map json) => _$$ChatRoomModelImplFromJson(json); @override final String id; @@ -176,21 +152,18 @@ class _$ChatRoomModelImpl implements _ChatRoomModel { (other.runtimeType == runtimeType && other is _$ChatRoomModelImpl && (identical(other.id, id) || other.id == id) && - (identical(other.chatRoomSettings, chatRoomSettings) || - other.chatRoomSettings == chatRoomSettings) && + (identical(other.chatRoomSettings, chatRoomSettings) || other.chatRoomSettings == chatRoomSettings) && const DeepCollectionEquality().equals(other._users, _users)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, chatRoomSettings, - const DeepCollectionEquality().hash(_users)); + int get hashCode => Object.hash(runtimeType, id, chatRoomSettings, const DeepCollectionEquality().hash(_users)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => - __$$ChatRoomModelImplCopyWithImpl<_$ChatRoomModelImpl>(this, _$identity); + _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => __$$ChatRoomModelImplCopyWithImpl<_$ChatRoomModelImpl>(this, _$identity); @override Map toJson() { @@ -203,12 +176,10 @@ class _$ChatRoomModelImpl implements _ChatRoomModel { abstract class _ChatRoomModel implements ChatRoomModel { const factory _ChatRoomModel( {required final String id, - @JsonKey(name: 'chat_room_setting') - required final ChatRoomSettingsModel chatRoomSettings, + @JsonKey(name: 'chat_room_setting') required final ChatRoomSettingsModel chatRoomSettings, required final Map users}) = _$ChatRoomModelImpl; - factory _ChatRoomModel.fromJson(Map json) = - _$ChatRoomModelImpl.fromJson; + factory _ChatRoomModel.fromJson(Map json) = _$ChatRoomModelImpl.fromJson; @override String get id; @@ -219,6 +190,5 @@ abstract class _ChatRoomModel implements ChatRoomModel { Map get users; @override @JsonKey(ignore: true) - _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => - throw _privateConstructorUsedError; + _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_room_model.g.dart b/lib/features/chat/models/chat_room_model.g.dart index 68d3195c..6230d4f4 100644 --- a/lib/features/chat/models/chat_room_model.g.dart +++ b/lib/features/chat/models/chat_room_model.g.dart @@ -6,19 +6,15 @@ part of 'chat_room_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatRoomModelImpl _$$ChatRoomModelImplFromJson(Map json) => - _$ChatRoomModelImpl( +_$ChatRoomModelImpl _$$ChatRoomModelImplFromJson(Map json) => _$ChatRoomModelImpl( id: json['id'] as String, - chatRoomSettings: ChatRoomSettingsModel.fromJson( - json['chat_room_setting'] as Map), + chatRoomSettings: ChatRoomSettingsModel.fromJson(json['chat_room_setting'] as Map), users: (json['users'] as Map).map( - (k, e) => - MapEntry(k, ChatUserModel.fromJson(e as Map)), + (k, e) => MapEntry(k, ChatUserModel.fromJson(e as Map)), ), ); -Map _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) => - { +Map _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) => { 'id': instance.id, 'chat_room_setting': instance.chatRoomSettings, 'users': instance.users, diff --git a/lib/features/chat/models/chat_room_settings_model.dart b/lib/features/chat/models/chat_room_settings_model.dart index 7262c9a2..de41f221 100644 --- a/lib/features/chat/models/chat_room_settings_model.dart +++ b/lib/features/chat/models/chat_room_settings_model.dart @@ -1,7 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'chat_room_settings_model.freezed.dart'; - part 'chat_room_settings_model.g.dart'; @freezed diff --git a/lib/features/chat/models/chat_room_settings_model.freezed.dart b/lib/features/chat/models/chat_room_settings_model.freezed.dart index 4f217556..af237724 100644 --- a/lib/features/chat/models/chat_room_settings_model.freezed.dart +++ b/lib/features/chat/models/chat_room_settings_model.freezed.dart @@ -14,8 +14,7 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); -ChatRoomSettingsModel _$ChatRoomSettingsModelFromJson( - Map json) { +ChatRoomSettingsModel _$ChatRoomSettingsModelFromJson(Map json) { return _ChatRoomSettingsModel.fromJson(json); } @@ -32,14 +31,12 @@ mixin _$ChatRoomSettingsModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatRoomSettingsModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $ChatRoomSettingsModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatRoomSettingsModelCopyWith<$Res> { - factory $ChatRoomSettingsModelCopyWith(ChatRoomSettingsModel value, - $Res Function(ChatRoomSettingsModel) then) = + factory $ChatRoomSettingsModelCopyWith(ChatRoomSettingsModel value, $Res Function(ChatRoomSettingsModel) then) = _$ChatRoomSettingsModelCopyWithImpl<$Res, ChatRoomSettingsModel>; @useResult $Res call( @@ -51,9 +48,7 @@ abstract class $ChatRoomSettingsModelCopyWith<$Res> { } /// @nodoc -class _$ChatRoomSettingsModelCopyWithImpl<$Res, - $Val extends ChatRoomSettingsModel> - implements $ChatRoomSettingsModelCopyWith<$Res> { +class _$ChatRoomSettingsModelCopyWithImpl<$Res, $Val extends ChatRoomSettingsModel> implements $ChatRoomSettingsModelCopyWith<$Res> { _$ChatRoomSettingsModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -96,11 +91,8 @@ class _$ChatRoomSettingsModelCopyWithImpl<$Res, } /// @nodoc -abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> - implements $ChatRoomSettingsModelCopyWith<$Res> { - factory _$$ChatRoomSettingsModelImplCopyWith( - _$ChatRoomSettingsModelImpl value, - $Res Function(_$ChatRoomSettingsModelImpl) then) = +abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> implements $ChatRoomSettingsModelCopyWith<$Res> { + factory _$$ChatRoomSettingsModelImplCopyWith(_$ChatRoomSettingsModelImpl value, $Res Function(_$ChatRoomSettingsModelImpl) then) = __$$ChatRoomSettingsModelImplCopyWithImpl<$Res>; @override @useResult @@ -113,13 +105,9 @@ abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> } /// @nodoc -class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res> - extends _$ChatRoomSettingsModelCopyWithImpl<$Res, - _$ChatRoomSettingsModelImpl> +class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res> extends _$ChatRoomSettingsModelCopyWithImpl<$Res, _$ChatRoomSettingsModelImpl> implements _$$ChatRoomSettingsModelImplCopyWith<$Res> { - __$$ChatRoomSettingsModelImplCopyWithImpl(_$ChatRoomSettingsModelImpl _value, - $Res Function(_$ChatRoomSettingsModelImpl) _then) - : super(_value, _then); + __$$ChatRoomSettingsModelImplCopyWithImpl(_$ChatRoomSettingsModelImpl _value, $Res Function(_$ChatRoomSettingsModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -165,8 +153,7 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel { @JsonKey(name: 'access_level') required this.accessLevel, @JsonKey(name: 'updated_at') required this.updatedAt}); - factory _$ChatRoomSettingsModelImpl.fromJson(Map json) => - _$$ChatRoomSettingsModelImplFromJson(json); + factory _$ChatRoomSettingsModelImpl.fromJson(Map json) => _$$ChatRoomSettingsModelImplFromJson(json); @override final int id; @@ -193,26 +180,21 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel { (other.runtimeType == runtimeType && other is _$ChatRoomSettingsModelImpl && (identical(other.id, id) || other.id == id) && - (identical(other.roomName, roomName) || - other.roomName == roomName) && + (identical(other.roomName, roomName) || other.roomName == roomName) && (identical(other.state, state) || other.state == state) && - (identical(other.accessLevel, accessLevel) || - other.accessLevel == accessLevel) && - (identical(other.updatedAt, updatedAt) || - other.updatedAt == updatedAt)); + (identical(other.accessLevel, accessLevel) || other.accessLevel == accessLevel) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, id, roomName, state, accessLevel, updatedAt); + int get hashCode => Object.hash(runtimeType, id, roomName, state, accessLevel, updatedAt); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> - get copyWith => __$$ChatRoomSettingsModelImplCopyWithImpl< - _$ChatRoomSettingsModelImpl>(this, _$identity); + _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> get copyWith => + __$$ChatRoomSettingsModelImplCopyWithImpl<_$ChatRoomSettingsModelImpl>(this, _$identity); @override Map toJson() { @@ -224,15 +206,13 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel { abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel { const factory _ChatRoomSettingsModel( - {required final int id, - @JsonKey(name: 'room_name') required final String roomName, - required final String state, - @JsonKey(name: 'access_level') required final String accessLevel, - @JsonKey(name: 'updated_at') required final String updatedAt}) = - _$ChatRoomSettingsModelImpl; + {required final int id, + @JsonKey(name: 'room_name') required final String roomName, + required final String state, + @JsonKey(name: 'access_level') required final String accessLevel, + @JsonKey(name: 'updated_at') required final String updatedAt}) = _$ChatRoomSettingsModelImpl; - factory _ChatRoomSettingsModel.fromJson(Map json) = - _$ChatRoomSettingsModelImpl.fromJson; + factory _ChatRoomSettingsModel.fromJson(Map json) = _$ChatRoomSettingsModelImpl.fromJson; @override int get id; @@ -249,6 +229,5 @@ abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel { String get updatedAt; @override @JsonKey(ignore: true) - _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> - get copyWith => throw _privateConstructorUsedError; + _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_room_settings_model.g.dart b/lib/features/chat/models/chat_room_settings_model.g.dart index 7b824334..1a2ef327 100644 --- a/lib/features/chat/models/chat_room_settings_model.g.dart +++ b/lib/features/chat/models/chat_room_settings_model.g.dart @@ -6,9 +6,7 @@ part of 'chat_room_settings_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson( - Map json) => - _$ChatRoomSettingsModelImpl( +_$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson(Map json) => _$ChatRoomSettingsModelImpl( id: (json['id'] as num).toInt(), roomName: json['room_name'] as String, state: json['state'] as String, @@ -16,9 +14,7 @@ _$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson( updatedAt: json['updated_at'] as String, ); -Map _$$ChatRoomSettingsModelImplToJson( - _$ChatRoomSettingsModelImpl instance) => - { +Map _$$ChatRoomSettingsModelImplToJson(_$ChatRoomSettingsModelImpl instance) => { 'id': instance.id, 'room_name': instance.roomName, 'state': instance.state, diff --git a/lib/features/chat/models/chat_user_model.dart b/lib/features/chat/models/chat_user_model.dart index dd8bf02a..4ead086f 100644 --- a/lib/features/chat/models/chat_user_model.dart +++ b/lib/features/chat/models/chat_user_model.dart @@ -1,7 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'chat_user_model.freezed.dart'; - part 'chat_user_model.g.dart'; @freezed @@ -9,10 +8,8 @@ class ChatUserModel with _$ChatUserModel { const factory ChatUserModel({ required int id, required String name, - @JsonKey(name: 'profile_photo_path') - String? profilePhotoPath, - @JsonKey(name: 'profile_photo_url') - String? profilePhotoUrl, + @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, + @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl, }) = _ChatUserModel; factory ChatUserModel.fromJson(Map json) => _$ChatUserModelFromJson(json); diff --git a/lib/features/chat/models/chat_user_model.freezed.dart b/lib/features/chat/models/chat_user_model.freezed.dart index 095c09e2..2827fa17 100644 --- a/lib/features/chat/models/chat_user_model.freezed.dart +++ b/lib/features/chat/models/chat_user_model.freezed.dart @@ -29,26 +29,18 @@ mixin _$ChatUserModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatUserModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $ChatUserModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatUserModelCopyWith<$Res> { - factory $ChatUserModelCopyWith( - ChatUserModel value, $Res Function(ChatUserModel) then) = - _$ChatUserModelCopyWithImpl<$Res, ChatUserModel>; + factory $ChatUserModelCopyWith(ChatUserModel value, $Res Function(ChatUserModel) then) = _$ChatUserModelCopyWithImpl<$Res, ChatUserModel>; @useResult - $Res call( - {int id, - String name, - @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, - @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); + $Res call({int id, String name, @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); } /// @nodoc -class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> - implements $ChatUserModelCopyWith<$Res> { +class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> implements $ChatUserModelCopyWith<$Res> { _$ChatUserModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -86,27 +78,16 @@ class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> } /// @nodoc -abstract class _$$ChatUserModelImplCopyWith<$Res> - implements $ChatUserModelCopyWith<$Res> { - factory _$$ChatUserModelImplCopyWith( - _$ChatUserModelImpl value, $Res Function(_$ChatUserModelImpl) then) = - __$$ChatUserModelImplCopyWithImpl<$Res>; +abstract class _$$ChatUserModelImplCopyWith<$Res> implements $ChatUserModelCopyWith<$Res> { + factory _$$ChatUserModelImplCopyWith(_$ChatUserModelImpl value, $Res Function(_$ChatUserModelImpl) then) = __$$ChatUserModelImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {int id, - String name, - @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, - @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); + $Res call({int id, String name, @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); } /// @nodoc -class __$$ChatUserModelImplCopyWithImpl<$Res> - extends _$ChatUserModelCopyWithImpl<$Res, _$ChatUserModelImpl> - implements _$$ChatUserModelImplCopyWith<$Res> { - __$$ChatUserModelImplCopyWithImpl( - _$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then) - : super(_value, _then); +class __$$ChatUserModelImplCopyWithImpl<$Res> extends _$ChatUserModelCopyWithImpl<$Res, _$ChatUserModelImpl> implements _$$ChatUserModelImplCopyWith<$Res> { + __$$ChatUserModelImplCopyWithImpl(_$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -146,8 +127,7 @@ class _$ChatUserModelImpl implements _ChatUserModel { @JsonKey(name: 'profile_photo_path') this.profilePhotoPath, @JsonKey(name: 'profile_photo_url') this.profilePhotoUrl}); - factory _$ChatUserModelImpl.fromJson(Map json) => - _$$ChatUserModelImplFromJson(json); + factory _$ChatUserModelImpl.fromJson(Map json) => _$$ChatUserModelImplFromJson(json); @override final int id; @@ -172,22 +152,18 @@ class _$ChatUserModelImpl implements _ChatUserModel { other is _$ChatUserModelImpl && (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && - (identical(other.profilePhotoPath, profilePhotoPath) || - other.profilePhotoPath == profilePhotoPath) && - (identical(other.profilePhotoUrl, profilePhotoUrl) || - other.profilePhotoUrl == profilePhotoUrl)); + (identical(other.profilePhotoPath, profilePhotoPath) || other.profilePhotoPath == profilePhotoPath) && + (identical(other.profilePhotoUrl, profilePhotoUrl) || other.profilePhotoUrl == profilePhotoUrl)); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl); + int get hashCode => Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => - __$$ChatUserModelImplCopyWithImpl<_$ChatUserModelImpl>(this, _$identity); + _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => __$$ChatUserModelImplCopyWithImpl<_$ChatUserModelImpl>(this, _$identity); @override Map toJson() { @@ -199,14 +175,12 @@ class _$ChatUserModelImpl implements _ChatUserModel { abstract class _ChatUserModel implements ChatUserModel { const factory _ChatUserModel( - {required final int id, - required final String name, - @JsonKey(name: 'profile_photo_path') final String? profilePhotoPath, - @JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl}) = - _$ChatUserModelImpl; + {required final int id, + required final String name, + @JsonKey(name: 'profile_photo_path') final String? profilePhotoPath, + @JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl}) = _$ChatUserModelImpl; - factory _ChatUserModel.fromJson(Map json) = - _$ChatUserModelImpl.fromJson; + factory _ChatUserModel.fromJson(Map json) = _$ChatUserModelImpl.fromJson; @override int get id; @@ -220,6 +194,5 @@ abstract class _ChatUserModel implements ChatUserModel { String? get profilePhotoUrl; @override @JsonKey(ignore: true) - _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => - throw _privateConstructorUsedError; + _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_user_model.g.dart b/lib/features/chat/models/chat_user_model.g.dart index 78e0f981..06fa92a0 100644 --- a/lib/features/chat/models/chat_user_model.g.dart +++ b/lib/features/chat/models/chat_user_model.g.dart @@ -6,16 +6,14 @@ part of 'chat_user_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatUserModelImpl _$$ChatUserModelImplFromJson(Map json) => - _$ChatUserModelImpl( +_$ChatUserModelImpl _$$ChatUserModelImplFromJson(Map json) => _$ChatUserModelImpl( id: (json['id'] as num).toInt(), name: json['name'] as String, profilePhotoPath: json['profile_photo_path'] as String?, profilePhotoUrl: json['profile_photo_url'] as String?, ); -Map _$$ChatUserModelImplToJson(_$ChatUserModelImpl instance) => - { +Map _$$ChatUserModelImplToJson(_$ChatUserModelImpl instance) => { 'id': instance.id, 'name': instance.name, 'profile_photo_path': instance.profilePhotoPath, diff --git a/lib/features/chat/models/websocket_info_model.dart b/lib/features/chat/models/websocket_info_model.dart index 274b4214..ed6167a0 100644 --- a/lib/features/chat/models/websocket_info_model.dart +++ b/lib/features/chat/models/websocket_info_model.dart @@ -1,7 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'websocket_info_model.freezed.dart'; - part 'websocket_info_model.g.dart'; @freezed @@ -11,8 +10,7 @@ class WebsocketInfoModel with _$WebsocketInfoModel { required String host, required String port, required String cluster, - @JsonKey(name: 'user_id') - required int userId, + @JsonKey(name: 'user_id') required int userId, }) = _WebsocketInfoModel; factory WebsocketInfoModel.fromJson(Map json) => _$WebsocketInfoModelFromJson(json); diff --git a/lib/features/chat/models/websocket_info_model.freezed.dart b/lib/features/chat/models/websocket_info_model.freezed.dart index cd383a2b..2f50540e 100644 --- a/lib/features/chat/models/websocket_info_model.freezed.dart +++ b/lib/features/chat/models/websocket_info_model.freezed.dart @@ -29,27 +29,19 @@ mixin _$WebsocketInfoModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $WebsocketInfoModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $WebsocketInfoModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $WebsocketInfoModelCopyWith<$Res> { - factory $WebsocketInfoModelCopyWith( - WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) = + factory $WebsocketInfoModelCopyWith(WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) = _$WebsocketInfoModelCopyWithImpl<$Res, WebsocketInfoModel>; @useResult - $Res call( - {String key, - String host, - String port, - String cluster, - @JsonKey(name: 'user_id') int userId}); + $Res call({String key, String host, String port, String cluster, @JsonKey(name: 'user_id') int userId}); } /// @nodoc -class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> - implements $WebsocketInfoModelCopyWith<$Res> { +class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> implements $WebsocketInfoModelCopyWith<$Res> { _$WebsocketInfoModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -92,28 +84,18 @@ class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> } /// @nodoc -abstract class _$$WebsocketInfoModelImplCopyWith<$Res> - implements $WebsocketInfoModelCopyWith<$Res> { - factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value, - $Res Function(_$WebsocketInfoModelImpl) then) = +abstract class _$$WebsocketInfoModelImplCopyWith<$Res> implements $WebsocketInfoModelCopyWith<$Res> { + factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value, $Res Function(_$WebsocketInfoModelImpl) then) = __$$WebsocketInfoModelImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {String key, - String host, - String port, - String cluster, - @JsonKey(name: 'user_id') int userId}); + $Res call({String key, String host, String port, String cluster, @JsonKey(name: 'user_id') int userId}); } /// @nodoc -class __$$WebsocketInfoModelImplCopyWithImpl<$Res> - extends _$WebsocketInfoModelCopyWithImpl<$Res, _$WebsocketInfoModelImpl> +class __$$WebsocketInfoModelImplCopyWithImpl<$Res> extends _$WebsocketInfoModelCopyWithImpl<$Res, _$WebsocketInfoModelImpl> implements _$$WebsocketInfoModelImplCopyWith<$Res> { - __$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value, - $Res Function(_$WebsocketInfoModelImpl) _then) - : super(_value, _then); + __$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value, $Res Function(_$WebsocketInfoModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -153,14 +135,9 @@ class __$$WebsocketInfoModelImplCopyWithImpl<$Res> @JsonSerializable() class _$WebsocketInfoModelImpl implements _WebsocketInfoModel { const _$WebsocketInfoModelImpl( - {required this.key, - required this.host, - required this.port, - required this.cluster, - @JsonKey(name: 'user_id') required this.userId}); + {required this.key, required this.host, required this.port, required this.cluster, @JsonKey(name: 'user_id') required this.userId}); - factory _$WebsocketInfoModelImpl.fromJson(Map json) => - _$$WebsocketInfoModelImplFromJson(json); + factory _$WebsocketInfoModelImpl.fromJson(Map json) => _$$WebsocketInfoModelImplFromJson(json); @override final String key; @@ -193,15 +170,13 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel { @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, key, host, port, cluster, userId); + int get hashCode => Object.hash(runtimeType, key, host, port, cluster, userId); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith => - __$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>( - this, _$identity); + __$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>(this, _$identity); @override Map toJson() { @@ -213,15 +188,13 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel { abstract class _WebsocketInfoModel implements WebsocketInfoModel { const factory _WebsocketInfoModel( - {required final String key, - required final String host, - required final String port, - required final String cluster, - @JsonKey(name: 'user_id') required final int userId}) = - _$WebsocketInfoModelImpl; + {required final String key, + required final String host, + required final String port, + required final String cluster, + @JsonKey(name: 'user_id') required final int userId}) = _$WebsocketInfoModelImpl; - factory _WebsocketInfoModel.fromJson(Map json) = - _$WebsocketInfoModelImpl.fromJson; + factory _WebsocketInfoModel.fromJson(Map json) = _$WebsocketInfoModelImpl.fromJson; @override String get key; @@ -236,6 +209,5 @@ abstract class _WebsocketInfoModel implements WebsocketInfoModel { int get userId; @override @JsonKey(ignore: true) - _$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith => - throw _privateConstructorUsedError; + _$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/websocket_info_model.g.dart b/lib/features/chat/models/websocket_info_model.g.dart index b2bb1248..91c386f8 100644 --- a/lib/features/chat/models/websocket_info_model.g.dart +++ b/lib/features/chat/models/websocket_info_model.g.dart @@ -6,9 +6,7 @@ part of 'websocket_info_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson( - Map json) => - _$WebsocketInfoModelImpl( +_$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson(Map json) => _$WebsocketInfoModelImpl( key: json['key'] as String, host: json['host'] as String, port: json['port'] as String, @@ -16,9 +14,7 @@ _$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson( userId: (json['user_id'] as num).toInt(), ); -Map _$$WebsocketInfoModelImplToJson( - _$WebsocketInfoModelImpl instance) => - { +Map _$$WebsocketInfoModelImplToJson(_$WebsocketInfoModelImpl instance) => { 'key': instance.key, 'host': instance.host, 'port': instance.port, diff --git a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart index 43bf9df9..715c1ab4 100644 --- a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart +++ b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart @@ -20,9 +20,7 @@ mixin _$ChatRoomState { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading) - loaded, + required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, required TResult Function(String errorMessage) error, }) => throw _privateConstructorUsedError; @@ -30,9 +28,7 @@ mixin _$ChatRoomState { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading)? - loaded, + TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, TResult? Function(String errorMessage)? error, }) => throw _privateConstructorUsedError; @@ -40,9 +36,7 @@ mixin _$ChatRoomState { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading)? - loaded, + TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) => @@ -76,14 +70,11 @@ mixin _$ChatRoomState { /// @nodoc abstract class $ChatRoomStateCopyWith<$Res> { - factory $ChatRoomStateCopyWith( - ChatRoomState value, $Res Function(ChatRoomState) then) = - _$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>; + factory $ChatRoomStateCopyWith(ChatRoomState value, $Res Function(ChatRoomState) then) = _$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>; } /// @nodoc -class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState> - implements $ChatRoomStateCopyWith<$Res> { +class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState> implements $ChatRoomStateCopyWith<$Res> { _$ChatRoomStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -94,18 +85,12 @@ class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState> /// @nodoc abstract class _$$ChatRoomStateImplCopyWith<$Res> { - factory _$$ChatRoomStateImplCopyWith( - _$ChatRoomStateImpl value, $Res Function(_$ChatRoomStateImpl) then) = - __$$ChatRoomStateImplCopyWithImpl<$Res>; + factory _$$ChatRoomStateImplCopyWith(_$ChatRoomStateImpl value, $Res Function(_$ChatRoomStateImpl) then) = __$$ChatRoomStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$ChatRoomStateImplCopyWithImpl<$Res> - extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateImpl> - implements _$$ChatRoomStateImplCopyWith<$Res> { - __$$ChatRoomStateImplCopyWithImpl( - _$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then) - : super(_value, _then); +class __$$ChatRoomStateImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateImpl> implements _$$ChatRoomStateImplCopyWith<$Res> { + __$$ChatRoomStateImplCopyWithImpl(_$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then) : super(_value, _then); } /// @nodoc @@ -120,8 +105,7 @@ class _$ChatRoomStateImpl implements _ChatRoomState { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$ChatRoomStateImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateImpl); } @override @@ -132,9 +116,7 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading) - loaded, + required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, required TResult Function(String errorMessage) error, }) { return $default(); @@ -145,9 +127,7 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading)? - loaded, + TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, TResult? Function(String errorMessage)? error, }) { return $default?.call(); @@ -158,9 +138,7 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading)? - loaded, + TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -214,18 +192,14 @@ abstract class _ChatRoomState implements ChatRoomState { /// @nodoc abstract class _$$ChatRoomStateLoadingImplCopyWith<$Res> { - factory _$$ChatRoomStateLoadingImplCopyWith(_$ChatRoomStateLoadingImpl value, - $Res Function(_$ChatRoomStateLoadingImpl) then) = + factory _$$ChatRoomStateLoadingImplCopyWith(_$ChatRoomStateLoadingImpl value, $Res Function(_$ChatRoomStateLoadingImpl) then) = __$$ChatRoomStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc -class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res> - extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadingImpl> +class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadingImpl> implements _$$ChatRoomStateLoadingImplCopyWith<$Res> { - __$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value, - $Res Function(_$ChatRoomStateLoadingImpl) _then) - : super(_value, _then); + __$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value, $Res Function(_$ChatRoomStateLoadingImpl) _then) : super(_value, _then); } /// @nodoc @@ -240,9 +214,7 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ChatRoomStateLoadingImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateLoadingImpl); } @override @@ -253,9 +225,7 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading) - loaded, + required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, required TResult Function(String errorMessage) error, }) { return loading(); @@ -266,9 +236,7 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading)? - loaded, + TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, TResult? Function(String errorMessage)? error, }) { return loading?.call(); @@ -279,9 +247,7 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading)? - loaded, + TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -335,26 +301,18 @@ abstract class ChatRoomStateLoading implements ChatRoomState { /// @nodoc abstract class _$$ChatRoomStateLoadedImplCopyWith<$Res> { - factory _$$ChatRoomStateLoadedImplCopyWith(_$ChatRoomStateLoadedImpl value, - $Res Function(_$ChatRoomStateLoadedImpl) then) = + factory _$$ChatRoomStateLoadedImplCopyWith(_$ChatRoomStateLoadedImpl value, $Res Function(_$ChatRoomStateLoadedImpl) then) = __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>; @useResult - $Res call( - {ChatRoomModel chatRoom, - List chatMessages, - bool isTyping, - bool isLoading}); + $Res call({ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading}); $ChatRoomModelCopyWith<$Res> get chatRoom; } /// @nodoc -class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> - extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadedImpl> +class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadedImpl> implements _$$ChatRoomStateLoadedImplCopyWith<$Res> { - __$$ChatRoomStateLoadedImplCopyWithImpl(_$ChatRoomStateLoadedImpl _value, - $Res Function(_$ChatRoomStateLoadedImpl) _then) - : super(_value, _then); + __$$ChatRoomStateLoadedImplCopyWithImpl(_$ChatRoomStateLoadedImpl _value, $Res Function(_$ChatRoomStateLoadedImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -396,11 +354,7 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> /// @nodoc class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { - const _$ChatRoomStateLoadedImpl( - {required this.chatRoom, - required final List chatMessages, - required this.isTyping, - required this.isLoading}) + const _$ChatRoomStateLoadedImpl({required this.chatRoom, required final List chatMessages, required this.isTyping, required this.isLoading}) : _chatMessages = chatMessages; @override @@ -428,35 +382,27 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateLoadedImpl && - (identical(other.chatRoom, chatRoom) || - other.chatRoom == chatRoom) && - const DeepCollectionEquality() - .equals(other._chatMessages, _chatMessages) && - (identical(other.isTyping, isTyping) || - other.isTyping == isTyping) && - (identical(other.isLoading, isLoading) || - other.isLoading == isLoading)); + (identical(other.chatRoom, chatRoom) || other.chatRoom == chatRoom) && + const DeepCollectionEquality().equals(other._chatMessages, _chatMessages) && + (identical(other.isTyping, isTyping) || other.isTyping == isTyping) && + (identical(other.isLoading, isLoading) || other.isLoading == isLoading)); } @override - int get hashCode => Object.hash(runtimeType, chatRoom, - const DeepCollectionEquality().hash(_chatMessages), isTyping, isLoading); + int get hashCode => Object.hash(runtimeType, chatRoom, const DeepCollectionEquality().hash(_chatMessages), isTyping, isLoading); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith => - __$$ChatRoomStateLoadedImplCopyWithImpl<_$ChatRoomStateLoadedImpl>( - this, _$identity); + __$$ChatRoomStateLoadedImplCopyWithImpl<_$ChatRoomStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading) - loaded, + required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, required TResult Function(String errorMessage) error, }) { return loaded(chatRoom, chatMessages, isTyping, isLoading); @@ -467,9 +413,7 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading)? - loaded, + TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, TResult? Function(String errorMessage)? error, }) { return loaded?.call(chatRoom, chatMessages, isTyping, isLoading); @@ -480,9 +424,7 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading)? - loaded, + TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -542,26 +484,21 @@ abstract class ChatRoomStateLoaded implements ChatRoomState { bool get isTyping; bool get isLoading; @JsonKey(ignore: true) - _$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith => - throw _privateConstructorUsedError; + _$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$ChatRoomStateErrorImplCopyWith<$Res> { - factory _$$ChatRoomStateErrorImplCopyWith(_$ChatRoomStateErrorImpl value, - $Res Function(_$ChatRoomStateErrorImpl) then) = + factory _$$ChatRoomStateErrorImplCopyWith(_$ChatRoomStateErrorImpl value, $Res Function(_$ChatRoomStateErrorImpl) then) = __$$ChatRoomStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$ChatRoomStateErrorImplCopyWithImpl<$Res> - extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateErrorImpl> +class __$$ChatRoomStateErrorImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateErrorImpl> implements _$$ChatRoomStateErrorImplCopyWith<$Res> { - __$$ChatRoomStateErrorImplCopyWithImpl(_$ChatRoomStateErrorImpl _value, - $Res Function(_$ChatRoomStateErrorImpl) _then) - : super(_value, _then); + __$$ChatRoomStateErrorImplCopyWithImpl(_$ChatRoomStateErrorImpl _value, $Res Function(_$ChatRoomStateErrorImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -595,8 +532,7 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateErrorImpl && - (identical(other.errorMessage, errorMessage) || - other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override @@ -606,17 +542,14 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { @override @pragma('vm:prefer-inline') _$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith => - __$$ChatRoomStateErrorImplCopyWithImpl<_$ChatRoomStateErrorImpl>( - this, _$identity); + __$$ChatRoomStateErrorImplCopyWithImpl<_$ChatRoomStateErrorImpl>(this, _$identity); @override @optionalTypeArgs TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading) - loaded, + required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, required TResult Function(String errorMessage) error, }) { return error(errorMessage); @@ -627,9 +560,7 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading)? - loaded, + TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, TResult? Function(String errorMessage)? error, }) { return error?.call(errorMessage); @@ -640,9 +571,7 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, - List chatMessages, bool isTyping, bool isLoading)? - loaded, + TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -691,11 +620,9 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { } abstract class ChatRoomStateError implements ChatRoomState { - const factory ChatRoomStateError({required final String errorMessage}) = - _$ChatRoomStateErrorImpl; + const factory ChatRoomStateError({required final String errorMessage}) = _$ChatRoomStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith => - throw _privateConstructorUsedError; + _$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/presentation/pages/chat_screen.dart b/lib/features/chat/presentation/pages/chat_screen.dart index 208ff966..d4747123 100644 --- a/lib/features/chat/presentation/pages/chat_screen.dart +++ b/lib/features/chat/presentation/pages/chat_screen.dart @@ -1,9 +1,9 @@ +import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart'; import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart'; import 'package:eatvio_app/features/chat/presentation/widgets/chat_bubble_widget.dart'; import 'package:eatvio_app/locator_service.dart'; import 'package:flutter/cupertino.dart'; -import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; import 'package:lazy_load_scrollview/lazy_load_scrollview.dart'; @@ -155,9 +155,7 @@ class _ChatScreenState extends State { children: [ SizedBox(width: 8), InkWell( - onTap: () { - - }, + onTap: () {}, borderRadius: BorderRadiusStyle.circleBorder17, child: Ink( height: 32, diff --git a/lib/features/chat/presentation/pages/chat_select_screen/bloc/chat_select_bloc.dart b/lib/features/chat/presentation/pages/chat_select_screen/bloc/chat_select_bloc.dart index a055b5ef..8c60e607 100644 --- a/lib/features/chat/presentation/pages/chat_select_screen/bloc/chat_select_bloc.dart +++ b/lib/features/chat/presentation/pages/chat_select_screen/bloc/chat_select_bloc.dart @@ -1,19 +1,19 @@ +import 'dart:convert'; + import 'package:eatvio_app/app_router.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/models/chat_entry.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/models/chat_select_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; +import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; import 'package:intl/intl.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:go_router/go_router.dart'; part 'chat_select_event.dart'; - part 'chat_select_state.dart'; /// A bloc that manages the state of a ChatSelect according to the event that is dispatched to it. @@ -59,7 +59,7 @@ class ChatSelectBloc extends Bloc { AppRouter.navigatorKey.currentContext?.goNamed('authScreen'); } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/chat/index'), + Uri.parse(baseUrl + '/api/chat/index'), headers: { 'Authorization': 'Bearer $token', }, diff --git a/lib/features/chat/presentation/pages/chat_select_screen/bloc/chat_select_state.dart b/lib/features/chat/presentation/pages/chat_select_screen/bloc/chat_select_state.dart index e5f1262a..2ee186f8 100644 --- a/lib/features/chat/presentation/pages/chat_select_screen/bloc/chat_select_state.dart +++ b/lib/features/chat/presentation/pages/chat_select_screen/bloc/chat_select_state.dart @@ -20,8 +20,7 @@ class ChatSelectState extends Equatable { } class ChatSelectInitialState extends ChatSelectState { - ChatSelectInitialState({required ChatSelectModel chatSelectModelObj}) - : super(chatSelectModelObj: chatSelectModelObj); + ChatSelectInitialState({required ChatSelectModel chatSelectModelObj}) : super(chatSelectModelObj: chatSelectModelObj); } class ChatSelectLoadedState extends ChatSelectState { diff --git a/lib/features/chat/presentation/pages/chat_select_screen/chat_search_view.dart b/lib/features/chat/presentation/pages/chat_select_screen/chat_search_view.dart index 22020a9e..1b8b49e5 100644 --- a/lib/features/chat/presentation/pages/chat_select_screen/chat_search_view.dart +++ b/lib/features/chat/presentation/pages/chat_select_screen/chat_search_view.dart @@ -1,5 +1,5 @@ -import 'package:flutter/material.dart'; import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; class CustomSearchView extends StatelessWidget { CustomSearchView({ diff --git a/lib/features/chat/presentation/pages/chat_select_screen/chat_select_screen.dart b/lib/features/chat/presentation/pages/chat_select_screen/chat_select_screen.dart index dc3f3d29..3df79dfb 100644 --- a/lib/features/chat/presentation/pages/chat_select_screen/chat_select_screen.dart +++ b/lib/features/chat/presentation/pages/chat_select_screen/chat_select_screen.dart @@ -1,12 +1,13 @@ +import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/models/chat_entry.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/widgets/chat_entry_widget.dart'; import 'package:flutter/cupertino.dart'; -import 'bloc/chat_select_bloc.dart'; -import 'models/chat_select_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'chat_search_view.dart'; import 'package:flutter/material.dart'; +import 'bloc/chat_select_bloc.dart'; +import 'chat_search_view.dart'; +import 'models/chat_select_model.dart'; + class ChatSelectScreen extends StatelessWidget { const ChatSelectScreen({Key? key}) : super(key: key); diff --git a/lib/features/chat/presentation/pages/chat_select_screen/widgets/chat_entry_widget.dart b/lib/features/chat/presentation/pages/chat_select_screen/widgets/chat_entry_widget.dart index 4836f94a..0e46e718 100644 --- a/lib/features/chat/presentation/pages/chat_select_screen/widgets/chat_entry_widget.dart +++ b/lib/features/chat/presentation/pages/chat_select_screen/widgets/chat_entry_widget.dart @@ -1,8 +1,8 @@ // ignore_for_file: must_be_immutable +import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/models/chat_entry.dart'; import 'package:flutter/material.dart'; -import 'package:eatvio_app/core/app_export.dart'; import 'package:go_router/go_router.dart'; class ChatEntryWidget extends StatelessWidget { diff --git a/lib/features/chat/presentation/pages/photo_view_screen.dart b/lib/features/chat/presentation/pages/photo_view_screen.dart index f576a586..a070103d 100644 --- a/lib/features/chat/presentation/pages/photo_view_screen.dart +++ b/lib/features/chat/presentation/pages/photo_view_screen.dart @@ -2,7 +2,6 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:dismissible_page/dismissible_page.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:go_router/go_router.dart'; import 'package:photo_view/photo_view.dart'; import 'package:photo_view/photo_view_gallery.dart'; @@ -84,7 +83,7 @@ class _PhotoViewScreenState extends State { color: Colors.white, ), title: Text( - widget.imageUrls[index].replaceAll(dotenv.env['STORAGE_URL']! + 'chat_files/', ''), + widget.imageUrls[index].replaceAll(baseUrl + '/storage/' + 'chat_files/', ''), style: TextStyle( color: Colors.white, fontSize: 12, diff --git a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart index 6f9e9389..5a773cc3 100644 --- a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart @@ -1,9 +1,9 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:dismissible_page/dismissible_page.dart'; +import 'package:eatvio_app/core/constants/constants.dart'; import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart'; import 'package:eatvio_app/theme/app_decoration.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:url_launcher/url_launcher.dart'; class ChatBubbleWidget extends StatelessWidget { @@ -48,7 +48,7 @@ class ChatBubbleWidget extends StatelessWidget { contentPadding: EdgeInsets.zero, horizontalTitleGap: 8, onTap: () async { - if (!await launchUrl(Uri.parse(dotenv.env['STORAGE_URL']! + mediaData[index].toString()))) { + if (!await launchUrl(Uri.parse(baseUrl + '/storage/' + mediaData[index].toString()))) { throw Exception('Could not launch ${mediaData[index].toString()}'); } }, @@ -75,18 +75,18 @@ class ChatBubbleWidget extends StatelessWidget { onTap: () { context.pushTransparentRoute( PhotoViewScreen( - imageUrls: mediaData.map((e) => dotenv.env['STORAGE_URL']! + e.toString()).toList(), + imageUrls: mediaData.map((e) => baseUrl + '/storage/' + e.toString()).toList(), index: index, ), ); }, child: Hero( - tag: dotenv.env['STORAGE_URL']! + '${mediaData[index]}', + tag: baseUrl + '/storage/' + '${mediaData[index]}', transitionOnUserGestures: true, child: ClipRRect( borderRadius: BorderRadiusStyle.roundedBorder8, child: CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + '${mediaData[index]}', + imageUrl: baseUrl + '/storage/' + '${mediaData[index]}', ), ), ), diff --git a/lib/features/chat/services/chat_service.dart b/lib/features/chat/services/chat_service.dart index 675d6806..888aaba0 100644 --- a/lib/features/chat/services/chat_service.dart +++ b/lib/features/chat/services/chat_service.dart @@ -1,8 +1,8 @@ import 'dart:io'; +import 'package:dio/dio.dart'; import 'package:eatvio_app/features/chat/models/chat_messages_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_model.dart'; -import 'package:dio/dio.dart'; import 'package:eatvio_app/features/chat/models/websocket_info_model.dart'; import 'package:retrofit/retrofit.dart'; @@ -12,24 +12,24 @@ part 'chat_service.g.dart'; abstract class ChatService { factory ChatService(Dio dio, {String baseUrl}) = _ChatService; - @GET('/chat/show/{id}') + @GET('/api/chat/show/{id}') Future> getChatRoom({ @Path() required String id, }); - @POST('/chat/{id}/message/send') + @POST('/api/chat/{id}/message/send') Future sendMessage({ @Path() required String id, @Part() String? data, @Part() List? filesList, }); - @GET('/chat/show/{id}/messages?page={page}') + @GET('/api/chat/show/{id}/messages?page={page}') Future getChatMessages({ @Path() required String id, @Path() required int page, }); - @GET('/profile/ws/params') + @GET('/api/profile/ws/params') Future getWebsocket(); } diff --git a/lib/features/chat/services/chat_service.g.dart b/lib/features/chat/services/chat_service.g.dart index 65eb7c5e..8d212c4e 100644 --- a/lib/features/chat/services/chat_service.g.dart +++ b/lib/features/chat/services/chat_service.g.dart @@ -24,25 +24,23 @@ class _ChatService implements ChatService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType>(Options( + final _result = await _dio.fetch>(_setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/chat/show/${id}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - var _value = _result.data!.map((k, dynamic v) => - MapEntry(k, ChatRoomModel.fromJson(v as Map))); + .compose( + _dio.options, + '/api/chat/show/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); + var _value = _result.data!.map((k, dynamic v) => MapEntry(k, ChatRoomModel.fromJson(v as Map))); return _value; } @@ -78,7 +76,7 @@ class _ChatService implements ChatService { ) .compose( _dio.options, - '/chat/${id}/message/send', + '/api/chat/${id}/message/send', queryParameters: queryParameters, data: _data, ) @@ -98,23 +96,22 @@ class _ChatService implements ChatService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType(Options( + final _result = await _dio.fetch>(_setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/chat/show/${id}/messages?page=${page}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); + .compose( + _dio.options, + '/api/chat/show/${id}/messages?page=${page}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); final _value = ChatMessagesModel.fromJson(_result.data!); return _value; } @@ -125,31 +122,28 @@ class _ChatService implements ChatService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio - .fetch>(_setStreamType(Options( + final _result = await _dio.fetch>(_setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/profile/ws/params', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); + .compose( + _dio.options, + '/api/profile/ws/params', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); final _value = WebsocketInfoModel.fromJson(_result.data!); return _value; } RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && - !(requestOptions.responseType == ResponseType.bytes || - requestOptions.responseType == ResponseType.stream)) { + if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) { if (T == String) { requestOptions.responseType = ResponseType.plain; } else { diff --git a/lib/features/diary/models/diary_model.freezed.dart b/lib/features/diary/models/diary_model.freezed.dart index 5ede0101..b593541c 100644 --- a/lib/features/diary/models/diary_model.freezed.dart +++ b/lib/features/diary/models/diary_model.freezed.dart @@ -30,29 +30,18 @@ mixin _$DiaryModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $DiaryModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $DiaryModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $DiaryModelCopyWith<$Res> { - factory $DiaryModelCopyWith( - DiaryModel value, $Res Function(DiaryModel) then) = - _$DiaryModelCopyWithImpl<$Res, DiaryModel>; + factory $DiaryModelCopyWith(DiaryModel value, $Res Function(DiaryModel) then) = _$DiaryModelCopyWithImpl<$Res, DiaryModel>; @useResult - $Res call( - {int id, - DateTime date, - DateTime wakeup, - DateTime retire, - int closed, - String comment, - List meals}); + $Res call({int id, DateTime date, DateTime wakeup, DateTime retire, int closed, String comment, List meals}); } /// @nodoc -class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel> - implements $DiaryModelCopyWith<$Res> { +class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel> implements $DiaryModelCopyWith<$Res> { _$DiaryModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -105,30 +94,16 @@ class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel> } /// @nodoc -abstract class _$$DiaryModelImplCopyWith<$Res> - implements $DiaryModelCopyWith<$Res> { - factory _$$DiaryModelImplCopyWith( - _$DiaryModelImpl value, $Res Function(_$DiaryModelImpl) then) = - __$$DiaryModelImplCopyWithImpl<$Res>; +abstract class _$$DiaryModelImplCopyWith<$Res> implements $DiaryModelCopyWith<$Res> { + factory _$$DiaryModelImplCopyWith(_$DiaryModelImpl value, $Res Function(_$DiaryModelImpl) then) = __$$DiaryModelImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {int id, - DateTime date, - DateTime wakeup, - DateTime retire, - int closed, - String comment, - List meals}); + $Res call({int id, DateTime date, DateTime wakeup, DateTime retire, int closed, String comment, List meals}); } /// @nodoc -class __$$DiaryModelImplCopyWithImpl<$Res> - extends _$DiaryModelCopyWithImpl<$Res, _$DiaryModelImpl> - implements _$$DiaryModelImplCopyWith<$Res> { - __$$DiaryModelImplCopyWithImpl( - _$DiaryModelImpl _value, $Res Function(_$DiaryModelImpl) _then) - : super(_value, _then); +class __$$DiaryModelImplCopyWithImpl<$Res> extends _$DiaryModelCopyWithImpl<$Res, _$DiaryModelImpl> implements _$$DiaryModelImplCopyWith<$Res> { + __$$DiaryModelImplCopyWithImpl(_$DiaryModelImpl _value, $Res Function(_$DiaryModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -187,8 +162,7 @@ class _$DiaryModelImpl implements _DiaryModel { required final List meals}) : _meals = meals; - factory _$DiaryModelImpl.fromJson(Map json) => - _$$DiaryModelImplFromJson(json); + factory _$DiaryModelImpl.fromJson(Map json) => _$$DiaryModelImplFromJson(json); @override final int id; @@ -231,14 +205,12 @@ class _$DiaryModelImpl implements _DiaryModel { @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, date, wakeup, retire, closed, - comment, const DeepCollectionEquality().hash(_meals)); + int get hashCode => Object.hash(runtimeType, id, date, wakeup, retire, closed, comment, const DeepCollectionEquality().hash(_meals)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => - __$$DiaryModelImplCopyWithImpl<_$DiaryModelImpl>(this, _$identity); + _$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => __$$DiaryModelImplCopyWithImpl<_$DiaryModelImpl>(this, _$identity); @override Map toJson() { @@ -258,8 +230,7 @@ abstract class _DiaryModel implements DiaryModel { required final String comment, required final List meals}) = _$DiaryModelImpl; - factory _DiaryModel.fromJson(Map json) = - _$DiaryModelImpl.fromJson; + factory _DiaryModel.fromJson(Map json) = _$DiaryModelImpl.fromJson; @override int get id; @@ -277,6 +248,5 @@ abstract class _DiaryModel implements DiaryModel { List get meals; @override @JsonKey(ignore: true) - _$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => - throw _privateConstructorUsedError; + _$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/diary/models/diary_model.g.dart b/lib/features/diary/models/diary_model.g.dart index cab25b61..79a0e92e 100644 --- a/lib/features/diary/models/diary_model.g.dart +++ b/lib/features/diary/models/diary_model.g.dart @@ -6,21 +6,17 @@ part of 'diary_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$DiaryModelImpl _$$DiaryModelImplFromJson(Map json) => - _$DiaryModelImpl( +_$DiaryModelImpl _$$DiaryModelImplFromJson(Map json) => _$DiaryModelImpl( id: (json['id'] as num).toInt(), date: DateTime.parse(json['date'] as String), wakeup: DateTime.parse(json['wakeup'] as String), retire: DateTime.parse(json['retire'] as String), closed: (json['closed'] as num).toInt(), comment: json['comment'] as String, - meals: (json['meals'] as List) - .map((e) => Meals.fromJson(e as Map)) - .toList(), + meals: (json['meals'] as List).map((e) => Meals.fromJson(e as Map)).toList(), ); -Map _$$DiaryModelImplToJson(_$DiaryModelImpl instance) => - { +Map _$$DiaryModelImplToJson(_$DiaryModelImpl instance) => { 'id': instance.id, 'date': instance.date.toIso8601String(), 'wakeup': instance.wakeup.toIso8601String(), diff --git a/lib/features/diary/presentation/bloc/diary_cubit.dart b/lib/features/diary/presentation/bloc/diary_cubit.dart index 07477bd0..ddc86761 100644 --- a/lib/features/diary/presentation/bloc/diary_cubit.dart +++ b/lib/features/diary/presentation/bloc/diary_cubit.dart @@ -19,4 +19,4 @@ class DiaryCubit extends Cubit { } } } -*/ \ No newline at end of file +*/ diff --git a/lib/features/diary/presentation/bloc/diary_state.dart b/lib/features/diary/presentation/bloc/diary_state.dart index d4305c8d..90e9f4f6 100644 --- a/lib/features/diary/presentation/bloc/diary_state.dart +++ b/lib/features/diary/presentation/bloc/diary_state.dart @@ -17,4 +17,4 @@ abstract class DiaryState with _$DiaryState { required String errorMessage, }) = DiaryStateError; } -*/ \ No newline at end of file +*/ diff --git a/lib/features/diary/presentation/pages/diary_screen.dart b/lib/features/diary/presentation/pages/diary_screen.dart index 9cbf2045..7218cf61 100644 --- a/lib/features/diary/presentation/pages/diary_screen.dart +++ b/lib/features/diary/presentation/pages/diary_screen.dart @@ -7,7 +7,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:image_picker/image_picker.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; + import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart'; import 'package:eatvio_app/widgets/custom_edit_drop_down.dart'; @@ -731,7 +731,7 @@ class DiaryEditScreen extends StatelessWidget { borderRadius: BorderRadiusStyle.roundedBorder5, ), child: Image.network( - dotenv.env['STORAGE_URL']! + photo['path'], + baseUrl + '/storage/' + photo['path'], ), ), Positioned( @@ -1296,4 +1296,4 @@ bool checkConsumedValues( // Если ни одно потребленное значение не превышает рекомендованное с соответствующим индексом return false; // Возвращаем true } -*/ \ No newline at end of file +*/ diff --git a/lib/features/diary/repositories/diary_repository.dart b/lib/features/diary/repositories/diary_repository.dart index 1ae40d88..b5ca0317 100644 --- a/lib/features/diary/repositories/diary_repository.dart +++ b/lib/features/diary/repositories/diary_repository.dart @@ -14,4 +14,4 @@ class DiaryRepository { } } } -*/ \ No newline at end of file +*/ diff --git a/lib/features/diary/services/diary_service.dart b/lib/features/diary/services/diary_service.dart index 6b6cb6bb..07490375 100644 --- a/lib/features/diary/services/diary_service.dart +++ b/lib/features/diary/services/diary_service.dart @@ -8,7 +8,7 @@ part 'diary_service.g.dart'; abstract class DiaryService { factory DiaryService(Dio dio, {String baseUrl}) = _DiaryService; - @GET('/feed/show/{id}') + @GET('/api/feed/show/{id}') Future getDiary(@Path() String id); } -*/ \ No newline at end of file +*/ diff --git a/lib/features/feed/models/feed_blog_post_model.freezed.dart b/lib/features/feed/models/feed_blog_post_model.freezed.dart index 4d753a10..9afd21ed 100644 --- a/lib/features/feed/models/feed_blog_post_model.freezed.dart +++ b/lib/features/feed/models/feed_blog_post_model.freezed.dart @@ -34,15 +34,12 @@ mixin _$FeedBlogPostModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $FeedBlogPostModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $FeedBlogPostModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $FeedBlogPostModelCopyWith<$Res> { - factory $FeedBlogPostModelCopyWith( - FeedBlogPostModel value, $Res Function(FeedBlogPostModel) then) = - _$FeedBlogPostModelCopyWithImpl<$Res, FeedBlogPostModel>; + factory $FeedBlogPostModelCopyWith(FeedBlogPostModel value, $Res Function(FeedBlogPostModel) then) = _$FeedBlogPostModelCopyWithImpl<$Res, FeedBlogPostModel>; @useResult $Res call( {int id, @@ -56,8 +53,7 @@ abstract class $FeedBlogPostModelCopyWith<$Res> { } /// @nodoc -class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel> - implements $FeedBlogPostModelCopyWith<$Res> { +class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel> implements $FeedBlogPostModelCopyWith<$Res> { _$FeedBlogPostModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -115,10 +111,8 @@ class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel> } /// @nodoc -abstract class _$$FeedBlogPostModelImplCopyWith<$Res> - implements $FeedBlogPostModelCopyWith<$Res> { - factory _$$FeedBlogPostModelImplCopyWith(_$FeedBlogPostModelImpl value, - $Res Function(_$FeedBlogPostModelImpl) then) = +abstract class _$$FeedBlogPostModelImplCopyWith<$Res> implements $FeedBlogPostModelCopyWith<$Res> { + factory _$$FeedBlogPostModelImplCopyWith(_$FeedBlogPostModelImpl value, $Res Function(_$FeedBlogPostModelImpl) then) = __$$FeedBlogPostModelImplCopyWithImpl<$Res>; @override @useResult @@ -134,12 +128,9 @@ abstract class _$$FeedBlogPostModelImplCopyWith<$Res> } /// @nodoc -class __$$FeedBlogPostModelImplCopyWithImpl<$Res> - extends _$FeedBlogPostModelCopyWithImpl<$Res, _$FeedBlogPostModelImpl> +class __$$FeedBlogPostModelImplCopyWithImpl<$Res> extends _$FeedBlogPostModelCopyWithImpl<$Res, _$FeedBlogPostModelImpl> implements _$$FeedBlogPostModelImplCopyWith<$Res> { - __$$FeedBlogPostModelImplCopyWithImpl(_$FeedBlogPostModelImpl _value, - $Res Function(_$FeedBlogPostModelImpl) _then) - : super(_value, _then); + __$$FeedBlogPostModelImplCopyWithImpl(_$FeedBlogPostModelImpl _value, $Res Function(_$FeedBlogPostModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -203,8 +194,7 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel { @JsonKey(name: "updated_at") required this.updatedAt, required this.title}); - factory _$FeedBlogPostModelImpl.fromJson(Map json) => - _$$FeedBlogPostModelImplFromJson(json); + factory _$FeedBlogPostModelImpl.fromJson(Map json) => _$$FeedBlogPostModelImplFromJson(json); @override final int id; @@ -239,28 +229,21 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel { (identical(other.id, id) || other.id == id) && (identical(other.state, state) || other.state == state) && (identical(other.image, image) || other.image == image) && - (identical(other.description, description) || - other.description == description) && - (identical(other.youtubeUrl, youtubeUrl) || - other.youtubeUrl == youtubeUrl) && - (identical(other.createdAt, createdAt) || - other.createdAt == createdAt) && - (identical(other.updatedAt, updatedAt) || - other.updatedAt == updatedAt) && + (identical(other.description, description) || other.description == description) && + (identical(other.youtubeUrl, youtubeUrl) || other.youtubeUrl == youtubeUrl) && + (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && (identical(other.title, title) || other.title == title)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, state, image, description, - youtubeUrl, createdAt, updatedAt, title); + int get hashCode => Object.hash(runtimeType, id, state, image, description, youtubeUrl, createdAt, updatedAt, title); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith => - __$$FeedBlogPostModelImplCopyWithImpl<_$FeedBlogPostModelImpl>( - this, _$identity); + _$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith => __$$FeedBlogPostModelImplCopyWithImpl<_$FeedBlogPostModelImpl>(this, _$identity); @override Map toJson() { @@ -281,8 +264,7 @@ abstract class _FeedBlogPostModel implements FeedBlogPostModel { @JsonKey(name: "updated_at") required final DateTime updatedAt, required final String title}) = _$FeedBlogPostModelImpl; - factory _FeedBlogPostModel.fromJson(Map json) = - _$FeedBlogPostModelImpl.fromJson; + factory _FeedBlogPostModel.fromJson(Map json) = _$FeedBlogPostModelImpl.fromJson; @override int get id; @@ -305,6 +287,5 @@ abstract class _FeedBlogPostModel implements FeedBlogPostModel { String get title; @override @JsonKey(ignore: true) - _$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith => - throw _privateConstructorUsedError; + _$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/feed/models/feed_blog_post_model.g.dart b/lib/features/feed/models/feed_blog_post_model.g.dart index 93cc70fc..e6808649 100644 --- a/lib/features/feed/models/feed_blog_post_model.g.dart +++ b/lib/features/feed/models/feed_blog_post_model.g.dart @@ -6,9 +6,7 @@ part of 'feed_blog_post_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$FeedBlogPostModelImpl _$$FeedBlogPostModelImplFromJson( - Map json) => - _$FeedBlogPostModelImpl( +_$FeedBlogPostModelImpl _$$FeedBlogPostModelImplFromJson(Map json) => _$FeedBlogPostModelImpl( id: (json['id'] as num).toInt(), state: json['state'] as String, image: json['image'] as String, @@ -19,9 +17,7 @@ _$FeedBlogPostModelImpl _$$FeedBlogPostModelImplFromJson( title: json['title'] as String, ); -Map _$$FeedBlogPostModelImplToJson( - _$FeedBlogPostModelImpl instance) => - { +Map _$$FeedBlogPostModelImplToJson(_$FeedBlogPostModelImpl instance) => { 'id': instance.id, 'state': instance.state, 'image': instance.image, diff --git a/lib/features/feed/models/feed_blog_post_settings_model.dart b/lib/features/feed/models/feed_blog_post_settings_model.dart index fa72e97e..8296a8be 100644 --- a/lib/features/feed/models/feed_blog_post_settings_model.dart +++ b/lib/features/feed/models/feed_blog_post_settings_model.dart @@ -7,8 +7,7 @@ part 'feed_blog_post_settings_model.g.dart'; @freezed class FeedBlogPostSettingsModel with _$FeedBlogPostSettingsModel { const factory FeedBlogPostSettingsModel({ - @JsonKey(name: 'data') - required List feedBlogPostList, + @JsonKey(name: 'data') required List feedBlogPostList, }) = _FeedBlogPostSettingsModel; factory FeedBlogPostSettingsModel.fromJson(Map json) => _$FeedBlogPostSettingsModelFromJson(json); diff --git a/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart b/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart index 7fd8a12e..cab47d21 100644 --- a/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart +++ b/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart @@ -14,36 +14,30 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); -FeedBlogPostSettingsModel _$FeedBlogPostSettingsModelFromJson( - Map json) { +FeedBlogPostSettingsModel _$FeedBlogPostSettingsModelFromJson(Map json) { return _FeedBlogPostSettingsModel.fromJson(json); } /// @nodoc mixin _$FeedBlogPostSettingsModel { @JsonKey(name: 'data') - List get feedBlogPostList => - throw _privateConstructorUsedError; + List get feedBlogPostList => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $FeedBlogPostSettingsModelCopyWith get copyWith => - throw _privateConstructorUsedError; + $FeedBlogPostSettingsModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $FeedBlogPostSettingsModelCopyWith<$Res> { - factory $FeedBlogPostSettingsModelCopyWith(FeedBlogPostSettingsModel value, - $Res Function(FeedBlogPostSettingsModel) then) = + factory $FeedBlogPostSettingsModelCopyWith(FeedBlogPostSettingsModel value, $Res Function(FeedBlogPostSettingsModel) then) = _$FeedBlogPostSettingsModelCopyWithImpl<$Res, FeedBlogPostSettingsModel>; @useResult $Res call({@JsonKey(name: 'data') List feedBlogPostList}); } /// @nodoc -class _$FeedBlogPostSettingsModelCopyWithImpl<$Res, - $Val extends FeedBlogPostSettingsModel> - implements $FeedBlogPostSettingsModelCopyWith<$Res> { +class _$FeedBlogPostSettingsModelCopyWithImpl<$Res, $Val extends FeedBlogPostSettingsModel> implements $FeedBlogPostSettingsModelCopyWith<$Res> { _$FeedBlogPostSettingsModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -66,11 +60,8 @@ class _$FeedBlogPostSettingsModelCopyWithImpl<$Res, } /// @nodoc -abstract class _$$FeedBlogPostSettingsModelImplCopyWith<$Res> - implements $FeedBlogPostSettingsModelCopyWith<$Res> { - factory _$$FeedBlogPostSettingsModelImplCopyWith( - _$FeedBlogPostSettingsModelImpl value, - $Res Function(_$FeedBlogPostSettingsModelImpl) then) = +abstract class _$$FeedBlogPostSettingsModelImplCopyWith<$Res> implements $FeedBlogPostSettingsModelCopyWith<$Res> { + factory _$$FeedBlogPostSettingsModelImplCopyWith(_$FeedBlogPostSettingsModelImpl value, $Res Function(_$FeedBlogPostSettingsModelImpl) then) = __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res>; @override @useResult @@ -78,13 +69,9 @@ abstract class _$$FeedBlogPostSettingsModelImplCopyWith<$Res> } /// @nodoc -class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res> - extends _$FeedBlogPostSettingsModelCopyWithImpl<$Res, - _$FeedBlogPostSettingsModelImpl> +class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res> extends _$FeedBlogPostSettingsModelCopyWithImpl<$Res, _$FeedBlogPostSettingsModelImpl> implements _$$FeedBlogPostSettingsModelImplCopyWith<$Res> { - __$$FeedBlogPostSettingsModelImplCopyWithImpl( - _$FeedBlogPostSettingsModelImpl _value, - $Res Function(_$FeedBlogPostSettingsModelImpl) _then) + __$$FeedBlogPostSettingsModelImplCopyWithImpl(_$FeedBlogPostSettingsModelImpl _value, $Res Function(_$FeedBlogPostSettingsModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -104,20 +91,16 @@ class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { - const _$FeedBlogPostSettingsModelImpl( - {@JsonKey(name: 'data') - required final List feedBlogPostList}) + const _$FeedBlogPostSettingsModelImpl({@JsonKey(name: 'data') required final List feedBlogPostList}) : _feedBlogPostList = feedBlogPostList; - factory _$FeedBlogPostSettingsModelImpl.fromJson(Map json) => - _$$FeedBlogPostSettingsModelImplFromJson(json); + factory _$FeedBlogPostSettingsModelImpl.fromJson(Map json) => _$$FeedBlogPostSettingsModelImplFromJson(json); final List _feedBlogPostList; @override @JsonKey(name: 'data') List get feedBlogPostList { - if (_feedBlogPostList is EqualUnmodifiableListView) - return _feedBlogPostList; + if (_feedBlogPostList is EqualUnmodifiableListView) return _feedBlogPostList; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(_feedBlogPostList); } @@ -132,21 +115,18 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedBlogPostSettingsModelImpl && - const DeepCollectionEquality() - .equals(other._feedBlogPostList, _feedBlogPostList)); + const DeepCollectionEquality().equals(other._feedBlogPostList, _feedBlogPostList)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList)); + int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> - get copyWith => __$$FeedBlogPostSettingsModelImplCopyWithImpl< - _$FeedBlogPostSettingsModelImpl>(this, _$identity); + _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> get copyWith => + __$$FeedBlogPostSettingsModelImplCopyWithImpl<_$FeedBlogPostSettingsModelImpl>(this, _$identity); @override Map toJson() { @@ -157,19 +137,14 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { } abstract class _FeedBlogPostSettingsModel implements FeedBlogPostSettingsModel { - const factory _FeedBlogPostSettingsModel( - {@JsonKey(name: 'data') - required final List feedBlogPostList}) = - _$FeedBlogPostSettingsModelImpl; + const factory _FeedBlogPostSettingsModel({@JsonKey(name: 'data') required final List feedBlogPostList}) = _$FeedBlogPostSettingsModelImpl; - factory _FeedBlogPostSettingsModel.fromJson(Map json) = - _$FeedBlogPostSettingsModelImpl.fromJson; + factory _FeedBlogPostSettingsModel.fromJson(Map json) = _$FeedBlogPostSettingsModelImpl.fromJson; @override @JsonKey(name: 'data') List get feedBlogPostList; @override @JsonKey(ignore: true) - _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> - get copyWith => throw _privateConstructorUsedError; + _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/feed/models/feed_blog_post_settings_model.g.dart b/lib/features/feed/models/feed_blog_post_settings_model.g.dart index 3f48be1b..c960067d 100644 --- a/lib/features/feed/models/feed_blog_post_settings_model.g.dart +++ b/lib/features/feed/models/feed_blog_post_settings_model.g.dart @@ -6,16 +6,10 @@ part of 'feed_blog_post_settings_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$FeedBlogPostSettingsModelImpl _$$FeedBlogPostSettingsModelImplFromJson( - Map json) => - _$FeedBlogPostSettingsModelImpl( - feedBlogPostList: (json['data'] as List) - .map((e) => FeedBlogPostModel.fromJson(e as Map)) - .toList(), +_$FeedBlogPostSettingsModelImpl _$$FeedBlogPostSettingsModelImplFromJson(Map json) => _$FeedBlogPostSettingsModelImpl( + feedBlogPostList: (json['data'] as List).map((e) => FeedBlogPostModel.fromJson(e as Map)).toList(), ); -Map _$$FeedBlogPostSettingsModelImplToJson( - _$FeedBlogPostSettingsModelImpl instance) => - { +Map _$$FeedBlogPostSettingsModelImplToJson(_$FeedBlogPostSettingsModelImpl instance) => { 'data': instance.feedBlogPostList, }; diff --git a/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart b/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart index ab3385f3..f3b70a9e 100644 --- a/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart +++ b/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart @@ -70,13 +70,11 @@ mixin _$FeedState { /// @nodoc abstract class $FeedStateCopyWith<$Res> { - factory $FeedStateCopyWith(FeedState value, $Res Function(FeedState) then) = - _$FeedStateCopyWithImpl<$Res, FeedState>; + factory $FeedStateCopyWith(FeedState value, $Res Function(FeedState) then) = _$FeedStateCopyWithImpl<$Res, FeedState>; } /// @nodoc -class _$FeedStateCopyWithImpl<$Res, $Val extends FeedState> - implements $FeedStateCopyWith<$Res> { +class _$FeedStateCopyWithImpl<$Res, $Val extends FeedState> implements $FeedStateCopyWith<$Res> { _$FeedStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -87,18 +85,12 @@ class _$FeedStateCopyWithImpl<$Res, $Val extends FeedState> /// @nodoc abstract class _$$FeedStateImplCopyWith<$Res> { - factory _$$FeedStateImplCopyWith( - _$FeedStateImpl value, $Res Function(_$FeedStateImpl) then) = - __$$FeedStateImplCopyWithImpl<$Res>; + factory _$$FeedStateImplCopyWith(_$FeedStateImpl value, $Res Function(_$FeedStateImpl) then) = __$$FeedStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$FeedStateImplCopyWithImpl<$Res> - extends _$FeedStateCopyWithImpl<$Res, _$FeedStateImpl> - implements _$$FeedStateImplCopyWith<$Res> { - __$$FeedStateImplCopyWithImpl( - _$FeedStateImpl _value, $Res Function(_$FeedStateImpl) _then) - : super(_value, _then); +class __$$FeedStateImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateImpl> implements _$$FeedStateImplCopyWith<$Res> { + __$$FeedStateImplCopyWithImpl(_$FeedStateImpl _value, $Res Function(_$FeedStateImpl) _then) : super(_value, _then); } /// @nodoc @@ -113,8 +105,7 @@ class _$FeedStateImpl implements _FeedState { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$FeedStateImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedStateImpl); } @override @@ -201,18 +192,14 @@ abstract class _FeedState implements FeedState { /// @nodoc abstract class _$$FeedStateLoadingImplCopyWith<$Res> { - factory _$$FeedStateLoadingImplCopyWith(_$FeedStateLoadingImpl value, - $Res Function(_$FeedStateLoadingImpl) then) = + factory _$$FeedStateLoadingImplCopyWith(_$FeedStateLoadingImpl value, $Res Function(_$FeedStateLoadingImpl) then) = __$$FeedStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc -class __$$FeedStateLoadingImplCopyWithImpl<$Res> - extends _$FeedStateCopyWithImpl<$Res, _$FeedStateLoadingImpl> +class __$$FeedStateLoadingImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateLoadingImpl> implements _$$FeedStateLoadingImplCopyWith<$Res> { - __$$FeedStateLoadingImplCopyWithImpl(_$FeedStateLoadingImpl _value, - $Res Function(_$FeedStateLoadingImpl) _then) - : super(_value, _then); + __$$FeedStateLoadingImplCopyWithImpl(_$FeedStateLoadingImpl _value, $Res Function(_$FeedStateLoadingImpl) _then) : super(_value, _then); } /// @nodoc @@ -227,8 +214,7 @@ class _$FeedStateLoadingImpl implements FeedStateLoading { @override bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$FeedStateLoadingImpl); + return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedStateLoadingImpl); } @override @@ -315,20 +301,14 @@ abstract class FeedStateLoading implements FeedState { /// @nodoc abstract class _$$FeedStateLoadedImplCopyWith<$Res> { - factory _$$FeedStateLoadedImplCopyWith(_$FeedStateLoadedImpl value, - $Res Function(_$FeedStateLoadedImpl) then) = - __$$FeedStateLoadedImplCopyWithImpl<$Res>; + factory _$$FeedStateLoadedImplCopyWith(_$FeedStateLoadedImpl value, $Res Function(_$FeedStateLoadedImpl) then) = __$$FeedStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({List feedBlogPostList}); } /// @nodoc -class __$$FeedStateLoadedImplCopyWithImpl<$Res> - extends _$FeedStateCopyWithImpl<$Res, _$FeedStateLoadedImpl> - implements _$$FeedStateLoadedImplCopyWith<$Res> { - __$$FeedStateLoadedImplCopyWithImpl( - _$FeedStateLoadedImpl _value, $Res Function(_$FeedStateLoadedImpl) _then) - : super(_value, _then); +class __$$FeedStateLoadedImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateLoadedImpl> implements _$$FeedStateLoadedImplCopyWith<$Res> { + __$$FeedStateLoadedImplCopyWithImpl(_$FeedStateLoadedImpl _value, $Res Function(_$FeedStateLoadedImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -347,15 +327,12 @@ class __$$FeedStateLoadedImplCopyWithImpl<$Res> /// @nodoc class _$FeedStateLoadedImpl implements FeedStateLoaded { - const _$FeedStateLoadedImpl( - {required final List feedBlogPostList}) - : _feedBlogPostList = feedBlogPostList; + const _$FeedStateLoadedImpl({required final List feedBlogPostList}) : _feedBlogPostList = feedBlogPostList; final List _feedBlogPostList; @override List get feedBlogPostList { - if (_feedBlogPostList is EqualUnmodifiableListView) - return _feedBlogPostList; + if (_feedBlogPostList is EqualUnmodifiableListView) return _feedBlogPostList; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(_feedBlogPostList); } @@ -370,20 +347,16 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedStateLoadedImpl && - const DeepCollectionEquality() - .equals(other._feedBlogPostList, _feedBlogPostList)); + const DeepCollectionEquality().equals(other._feedBlogPostList, _feedBlogPostList)); } @override - int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList)); + int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith => - __$$FeedStateLoadedImplCopyWithImpl<_$FeedStateLoadedImpl>( - this, _$identity); + _$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith => __$$FeedStateLoadedImplCopyWithImpl<_$FeedStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -461,32 +434,23 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { } abstract class FeedStateLoaded implements FeedState { - const factory FeedStateLoaded( - {required final List feedBlogPostList}) = - _$FeedStateLoadedImpl; + const factory FeedStateLoaded({required final List feedBlogPostList}) = _$FeedStateLoadedImpl; List get feedBlogPostList; @JsonKey(ignore: true) - _$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith => - throw _privateConstructorUsedError; + _$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$FeedStateErrorImplCopyWith<$Res> { - factory _$$FeedStateErrorImplCopyWith(_$FeedStateErrorImpl value, - $Res Function(_$FeedStateErrorImpl) then) = - __$$FeedStateErrorImplCopyWithImpl<$Res>; + factory _$$FeedStateErrorImplCopyWith(_$FeedStateErrorImpl value, $Res Function(_$FeedStateErrorImpl) then) = __$$FeedStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$FeedStateErrorImplCopyWithImpl<$Res> - extends _$FeedStateCopyWithImpl<$Res, _$FeedStateErrorImpl> - implements _$$FeedStateErrorImplCopyWith<$Res> { - __$$FeedStateErrorImplCopyWithImpl( - _$FeedStateErrorImpl _value, $Res Function(_$FeedStateErrorImpl) _then) - : super(_value, _then); +class __$$FeedStateErrorImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateErrorImpl> implements _$$FeedStateErrorImplCopyWith<$Res> { + __$$FeedStateErrorImplCopyWithImpl(_$FeedStateErrorImpl _value, $Res Function(_$FeedStateErrorImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -520,8 +484,7 @@ class _$FeedStateErrorImpl implements FeedStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedStateErrorImpl && - (identical(other.errorMessage, errorMessage) || - other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override @@ -530,9 +493,7 @@ class _$FeedStateErrorImpl implements FeedStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith => - __$$FeedStateErrorImplCopyWithImpl<_$FeedStateErrorImpl>( - this, _$identity); + _$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith => __$$FeedStateErrorImplCopyWithImpl<_$FeedStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -610,11 +571,9 @@ class _$FeedStateErrorImpl implements FeedStateError { } abstract class FeedStateError implements FeedState { - const factory FeedStateError({required final String errorMessage}) = - _$FeedStateErrorImpl; + const factory FeedStateError({required final String errorMessage}) = _$FeedStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith => - throw _privateConstructorUsedError; + _$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/feed/presentation/pages/feed_screen.dart b/lib/features/feed/presentation/pages/feed_screen.dart index 797bfbba..e97b39e1 100644 --- a/lib/features/feed/presentation/pages/feed_screen.dart +++ b/lib/features/feed/presentation/pages/feed_screen.dart @@ -1,15 +1,14 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart'; import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart'; import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_state.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:go_router/go_router.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:eatvio_app/presentation/feed/feed_screen/widgets/feed_search_view.dart'; import 'package:eatvio_app/presentation/feed/feed_screen/widgets/feed_scroll_item.dart'; +import 'package:eatvio_app/presentation/feed/feed_screen/widgets/feed_search_view.dart'; import 'package:eatvio_app/widgets/custom_outlined_button.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:intl/intl.dart'; class FeedScreen extends StatelessWidget { @@ -153,7 +152,7 @@ class FeedScreen extends StatelessWidget { children: [ ListTile( leading: CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (''), + imageUrl: baseUrl + '/storage/' + (''), /// todo profile photo path imageBuilder: (context, imageProvider) => CircleAvatar( @@ -224,7 +223,7 @@ class FeedScreen extends StatelessWidget { ), SizedBox(height: 16.0), CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (post.image), + imageUrl: baseUrl + '/storage/' + (post.image), imageBuilder: (context, imageProvider) => Stack( children: [ ClipRRect( diff --git a/lib/features/feed/services/feed_service.dart b/lib/features/feed/services/feed_service.dart index a9610378..d96ba1cc 100644 --- a/lib/features/feed/services/feed_service.dart +++ b/lib/features/feed/services/feed_service.dart @@ -8,6 +8,6 @@ part 'feed_service.g.dart'; abstract class FeedService { factory FeedService(Dio dio, {String baseUrl}) = _FeedService; - @GET('/blogPosts/index') + @GET('/api/blogPosts/index') Future getBlocPostList(); } diff --git a/lib/features/feed/services/feed_service.g.dart b/lib/features/feed/services/feed_service.g.dart index 2ef83811..0e66eb4a 100644 --- a/lib/features/feed/services/feed_service.g.dart +++ b/lib/features/feed/services/feed_service.g.dart @@ -24,31 +24,28 @@ class _FeedService implements FeedService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>( - _setStreamType(Options( + final _result = await _dio.fetch>(_setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/blogPosts/index', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); + .compose( + _dio.options, + '/api/blogPosts/index', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); final _value = FeedBlogPostSettingsModel.fromJson(_result.data!); return _value; } RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && - !(requestOptions.responseType == ResponseType.bytes || - requestOptions.responseType == ResponseType.stream)) { + if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) { if (T == String) { requestOptions.responseType = ResponseType.plain; } else { diff --git a/lib/features/registration/consts/cities_list.dart b/lib/features/registration/consts/cities_list.dart index 728024d5..0eea40d6 100644 --- a/lib/features/registration/consts/cities_list.dart +++ b/lib/features/registration/consts/cities_list.dart @@ -1116,4 +1116,4 @@ const List citiesList = const [ "Ясногорск", "Ясный", "Яхрома", -]; \ No newline at end of file +]; diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart index dcb49236..70a7f337 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart @@ -19,15 +19,12 @@ mixin _$RegistrationState { UserRegistrationSheet get sheet => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $RegistrationStateCopyWith get copyWith => - throw _privateConstructorUsedError; + $RegistrationStateCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $RegistrationStateCopyWith<$Res> { - factory $RegistrationStateCopyWith( - RegistrationState value, $Res Function(RegistrationState) then) = - _$RegistrationStateCopyWithImpl<$Res, RegistrationState>; + factory $RegistrationStateCopyWith(RegistrationState value, $Res Function(RegistrationState) then) = _$RegistrationStateCopyWithImpl<$Res, RegistrationState>; @useResult $Res call({UserRegistrationSheet sheet}); @@ -35,8 +32,7 @@ abstract class $RegistrationStateCopyWith<$Res> { } /// @nodoc -class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> - implements $RegistrationStateCopyWith<$Res> { +class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> implements $RegistrationStateCopyWith<$Res> { _$RegistrationStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -67,10 +63,8 @@ class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> } /// @nodoc -abstract class _$$RegistrationStateImplCopyWith<$Res> - implements $RegistrationStateCopyWith<$Res> { - factory _$$RegistrationStateImplCopyWith(_$RegistrationStateImpl value, - $Res Function(_$RegistrationStateImpl) then) = +abstract class _$$RegistrationStateImplCopyWith<$Res> implements $RegistrationStateCopyWith<$Res> { + factory _$$RegistrationStateImplCopyWith(_$RegistrationStateImpl value, $Res Function(_$RegistrationStateImpl) then) = __$$RegistrationStateImplCopyWithImpl<$Res>; @override @useResult @@ -81,12 +75,9 @@ abstract class _$$RegistrationStateImplCopyWith<$Res> } /// @nodoc -class __$$RegistrationStateImplCopyWithImpl<$Res> - extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateImpl> +class __$$RegistrationStateImplCopyWithImpl<$Res> extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateImpl> implements _$$RegistrationStateImplCopyWith<$Res> { - __$$RegistrationStateImplCopyWithImpl(_$RegistrationStateImpl _value, - $Res Function(_$RegistrationStateImpl) _then) - : super(_value, _then); + __$$RegistrationStateImplCopyWithImpl(_$RegistrationStateImpl _value, $Res Function(_$RegistrationStateImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -118,9 +109,7 @@ class _$RegistrationStateImpl implements _RegistrationState { @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$RegistrationStateImpl && - (identical(other.sheet, sheet) || other.sheet == sheet)); + (other.runtimeType == runtimeType && other is _$RegistrationStateImpl && (identical(other.sheet, sheet) || other.sheet == sheet)); } @override @@ -129,19 +118,15 @@ class _$RegistrationStateImpl implements _RegistrationState { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => - __$$RegistrationStateImplCopyWithImpl<_$RegistrationStateImpl>( - this, _$identity); + _$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => __$$RegistrationStateImplCopyWithImpl<_$RegistrationStateImpl>(this, _$identity); } abstract class _RegistrationState implements RegistrationState { - const factory _RegistrationState( - {required final UserRegistrationSheet sheet}) = _$RegistrationStateImpl; + const factory _RegistrationState({required final UserRegistrationSheet sheet}) = _$RegistrationStateImpl; @override UserRegistrationSheet get sheet; @override @JsonKey(ignore: true) - _$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => - throw _privateConstructorUsedError; + _$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/registration/presentation/pages/additional_information_screen.dart b/lib/features/registration/presentation/pages/additional_information_screen.dart index ec4578cc..b1838fdd 100644 --- a/lib/features/registration/presentation/pages/additional_information_screen.dart +++ b/lib/features/registration/presentation/pages/additional_information_screen.dart @@ -1,7 +1,7 @@ -import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; +import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; class AdditionalInformationScreen extends StatefulWidget { diff --git a/lib/features/registration/presentation/pages/blood_pressure_screen.dart b/lib/features/registration/presentation/pages/blood_pressure_screen.dart index c4236663..ef69278b 100644 --- a/lib/features/registration/presentation/pages/blood_pressure_screen.dart +++ b/lib/features/registration/presentation/pages/blood_pressure_screen.dart @@ -1,10 +1,10 @@ -import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; -import 'package:flutter/services.dart'; import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; class BloodPressureScreen extends StatefulWidget { final UserRegistrationSheet sheet; diff --git a/lib/features/registration/presentation/pages/body_circumferences_screen.dart b/lib/features/registration/presentation/pages/body_circumferences_screen.dart index 06417c80..c5370843 100644 --- a/lib/features/registration/presentation/pages/body_circumferences_screen.dart +++ b/lib/features/registration/presentation/pages/body_circumferences_screen.dart @@ -1,10 +1,9 @@ -import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; - -import 'package:flutter/services.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; class BodyCircumferencesScreen extends StatefulWidget { final UserRegistrationSheet sheet; diff --git a/lib/features/registration/presentation/pages/city_of_living_screen.dart b/lib/features/registration/presentation/pages/city_of_living_screen.dart index b183ec98..0372d8b5 100644 --- a/lib/features/registration/presentation/pages/city_of_living_screen.dart +++ b/lib/features/registration/presentation/pages/city_of_living_screen.dart @@ -1,8 +1,8 @@ +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/features/registration/consts/cities_list.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; -import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_typeahead/flutter_typeahead.dart'; diff --git a/lib/features/registration/presentation/pages/credentials_screen.dart b/lib/features/registration/presentation/pages/credentials_screen.dart index ec7809ce..3175b5c4 100644 --- a/lib/features/registration/presentation/pages/credentials_screen.dart +++ b/lib/features/registration/presentation/pages/credentials_screen.dart @@ -1,6 +1,6 @@ +import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; -import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; diff --git a/lib/features/registration/presentation/pages/date_of_birth_screen.dart b/lib/features/registration/presentation/pages/date_of_birth_screen.dart index 49118cac..54e1935d 100644 --- a/lib/features/registration/presentation/pages/date_of_birth_screen.dart +++ b/lib/features/registration/presentation/pages/date_of_birth_screen.dart @@ -1,7 +1,7 @@ -import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; -import 'package:flutter/cupertino.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; +import 'package:flutter/cupertino.dart'; import 'package:intl/intl.dart'; class DateOfBirthScreen extends StatefulWidget { @@ -92,26 +92,22 @@ class _DateOfBirthScreenState extends State { void _showDialog(Widget child) { showCupertinoModalPopup( context: context, - builder: (BuildContext context) => - Container( - height: 216, - padding: const EdgeInsets.only(top: 6.0), - // The Bottom margin is provided to align the popup above the system - // navigation bar. - margin: EdgeInsets.only( - bottom: MediaQuery - .of(context) - .viewInsets - .bottom, - ), - // Provide a background color for the popup. - color: CupertinoColors.systemBackground.resolveFrom(context), - // Use a SafeArea widget to avoid system overlaps. - child: SafeArea( - top: false, - child: child, - ), - ), + builder: (BuildContext context) => Container( + height: 216, + padding: const EdgeInsets.only(top: 6.0), + // The Bottom margin is provided to align the popup above the system + // navigation bar. + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), + // Provide a background color for the popup. + color: CupertinoColors.systemBackground.resolveFrom(context), + // Use a SafeArea widget to avoid system overlaps. + child: SafeArea( + top: false, + child: child, + ), + ), ); } } diff --git a/lib/features/registration/presentation/pages/favorite_foods_screen.dart b/lib/features/registration/presentation/pages/favorite_foods_screen.dart index b26f0c24..d17b5e11 100644 --- a/lib/features/registration/presentation/pages/favorite_foods_screen.dart +++ b/lib/features/registration/presentation/pages/favorite_foods_screen.dart @@ -1,6 +1,6 @@ -import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; diff --git a/lib/features/registration/presentation/pages/favorite_sports_screen.dart b/lib/features/registration/presentation/pages/favorite_sports_screen.dart index 86c7d24e..55273ec7 100644 --- a/lib/features/registration/presentation/pages/favorite_sports_screen.dart +++ b/lib/features/registration/presentation/pages/favorite_sports_screen.dart @@ -1,6 +1,6 @@ -import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -38,7 +38,8 @@ class _FavoriteSportsScreenState extends State { SizedBox(height: 2.v), CustomTextFormField( controller: enterInformationController, - hintText: "Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!", + hintText: + "Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!", textInputAction: TextInputAction.done, maxLines: 8, onChanged: (newValue) { diff --git a/lib/features/registration/presentation/pages/gender_screen.dart b/lib/features/registration/presentation/pages/gender_screen.dart index 803759da..62258260 100644 --- a/lib/features/registration/presentation/pages/gender_screen.dart +++ b/lib/features/registration/presentation/pages/gender_screen.dart @@ -1,6 +1,6 @@ -import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:flutter/material.dart'; class GenderScreen extends StatefulWidget { diff --git a/lib/features/registration/presentation/pages/height_screen.dart b/lib/features/registration/presentation/pages/height_screen.dart index a2f47e0e..98fc71fa 100644 --- a/lib/features/registration/presentation/pages/height_screen.dart +++ b/lib/features/registration/presentation/pages/height_screen.dart @@ -1,9 +1,9 @@ -import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/custom_text_form_field.dart'; -import 'package:flutter/services.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; +import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; class HeightScreen extends StatefulWidget { final UserRegistrationSheet sheet; diff --git a/lib/features/registration/presentation/pages/medicine_intake_screen.dart b/lib/features/registration/presentation/pages/medicine_intake_screen.dart index 1e6f4ff3..d6ea9fbb 100644 --- a/lib/features/registration/presentation/pages/medicine_intake_screen.dart +++ b/lib/features/registration/presentation/pages/medicine_intake_screen.dart @@ -1,7 +1,7 @@ -import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; +import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; class MedicineIntakeScreen extends StatefulWidget { diff --git a/lib/features/registration/presentation/pages/name_screen.dart b/lib/features/registration/presentation/pages/name_screen.dart index dfd9a169..2f1e4c5f 100644 --- a/lib/features/registration/presentation/pages/name_screen.dart +++ b/lib/features/registration/presentation/pages/name_screen.dart @@ -1,6 +1,6 @@ +import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; -import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index 30eb7591..eae9818d 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -1,22 +1,22 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart'; -import 'package:eatvio_app/features/registration/presentation/pages/allergies_screen.dart'; -import 'package:eatvio_app/features/registration/presentation/pages/city_of_living_screen.dart'; -import 'package:eatvio_app/features/registration/presentation/pages/favorite_foods_screen.dart'; -import 'package:eatvio_app/features/registration/presentation/pages/height_screen.dart'; -import 'package:eatvio_app/features/registration/presentation/pages/name_screen.dart'; -import 'package:eatvio_app/locator_service.dart'; import 'package:eatvio_app/features/registration/presentation/pages/additional_information_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/allergies_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/blood_pressure_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/body_circumferences_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/city_of_living_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/credentials_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/date_of_birth_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/favorite_foods_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/favorite_sports_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/gender_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/height_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/language_select_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/medicine_intake_screen.dart'; +import 'package:eatvio_app/features/registration/presentation/pages/name_screen.dart'; import 'package:eatvio_app/features/registration/presentation/pages/weight_screen.dart'; +import 'package:eatvio_app/locator_service.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/lib/features/registration/presentation/pages/weight_screen.dart b/lib/features/registration/presentation/pages/weight_screen.dart index 6c64ad1f..855593e5 100644 --- a/lib/features/registration/presentation/pages/weight_screen.dart +++ b/lib/features/registration/presentation/pages/weight_screen.dart @@ -1,9 +1,9 @@ -import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/custom_text_form_field.dart'; -import 'package:flutter/services.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; +import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; class WeightScreen extends StatefulWidget { final UserRegistrationSheet sheet; diff --git a/lib/features/registration/services/registration_service.dart b/lib/features/registration/services/registration_service.dart index 9ff81080..00ae6739 100644 --- a/lib/features/registration/services/registration_service.dart +++ b/lib/features/registration/services/registration_service.dart @@ -7,7 +7,7 @@ part 'registration_service.g.dart'; abstract class RegistrationService { factory RegistrationService(Dio dio, {String baseUrl}) = _RegistrationService; - @POST('/register') + @POST('/api/register') Future register({ @Body() required Map sheet, }); diff --git a/lib/features/registration/services/registration_service.g.dart b/lib/features/registration/services/registration_service.g.dart index 0a7fc8f5..1268b0bd 100644 --- a/lib/features/registration/services/registration_service.g.dart +++ b/lib/features/registration/services/registration_service.g.dart @@ -32,7 +32,7 @@ class _RegistrationService implements RegistrationService { ) .compose( _dio.options, - '/register', + '/api/register', queryParameters: queryParameters, data: _data, ) @@ -44,9 +44,7 @@ class _RegistrationService implements RegistrationService { } RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && - !(requestOptions.responseType == ResponseType.bytes || - requestOptions.responseType == ResponseType.stream)) { + if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) { if (T == String) { requestOptions.responseType = ResponseType.plain; } else { diff --git a/lib/localization/app_localization.dart b/lib/localization/app_localization.dart index 5d003fca..0c0b2568 100644 --- a/lib/localization/app_localization.dart +++ b/lib/localization/app_localization.dart @@ -1,9 +1,9 @@ import 'package:eatvio_app/app_router.dart'; - -import 'ru/ru_translations.dart'; +import 'package:flutter/cupertino.dart'; //import 'en_us/en_us_translations.dart'; import 'package:flutter/foundation.dart'; -import 'package:flutter/cupertino.dart'; + +import 'ru/ru_translations.dart'; class AppLocalization { AppLocalization(this.locale); @@ -23,24 +23,24 @@ class AppLocalization { return Localizations.of(context, AppLocalization)!; } else { // Обработка ситуации, когда context равен null - return AppLocalization(Locale( - 'ru', - '', - ),); // Возвращаем дефолтное значение или обработку ошибки + return AppLocalization( + Locale( + 'ru', + '', + ), + ); // Возвращаем дефолтное значение или обработку ошибки } } static List languages() => _localizedValues.keys.toList(); - String getString(String text) => - _localizedValues[locale.languageCode]![text] ?? text; + String getString(String text) => _localizedValues[locale.languageCode]![text] ?? text; } class AppLocalizationDelegate extends LocalizationsDelegate { const AppLocalizationDelegate(); @override - bool isSupported(Locale locale) => - AppLocalization.languages().contains(locale.languageCode); + bool isSupported(Locale locale) => AppLocalization.languages().contains(locale.languageCode); //Returning a SynchronousFuture here because an async "load" operation //cause an async "load" operation diff --git a/lib/localization/en_us/en_us_translations.dart b/lib/localization/en_us/en_us_translations.dart index 282c4c70..4c0df242 100644 --- a/lib/localization/en_us/en_us_translations.dart +++ b/lib/localization/en_us/en_us_translations.dart @@ -27,8 +27,7 @@ final Map enUs = { // blood_pressure Screen "no": "No", - "do_you_have_hypertension_tendency": - "Do you have a tendency for hypertension?", + "do_you_have_hypertension_tendency": "Do you have a tendency for hypertension?", "your_blood_pressure": "Your blood pressure?", "average_pressure": "Average pressure:", "do_you_have_hypotension_tendency": "Do you have a tendency for hypotension?", @@ -43,13 +42,11 @@ final Map enUs = { // schedule Screen "your_schedule": "Your Daily Schedule?", - "tell_your_schedule": - "Tell us about your daily routine, when you wake up, eat, and go to sleep:", + "tell_your_schedule": "Tell us about your daily routine, when you wake up, eat, and go to sleep:", // additional_information Screen "additional_information": "Additional Information:", - "enter_additional_information": - "Enter any additional information you would like to share:", + "enter_additional_information": "Enter any additional information you would like to share:", // language_select Screen "lbl_english": "English", diff --git a/lib/localization/ru/ru_translations.dart b/lib/localization/ru/ru_translations.dart index 3d28a232..8d7f708f 100644 --- a/lib/localization/ru/ru_translations.dart +++ b/lib/localization/ru/ru_translations.dart @@ -57,13 +57,11 @@ final Map ru = { // schedule Screen "your_schedule": "Ваш режим дня?", - "tell_your_schedule": - "Расскажите в свободной форме о том как просыпаетесь, когда едите, когда ложитесь спать:", + "tell_your_schedule": "Расскажите в свободной форме о том как просыпаетесь, когда едите, когда ложитесь спать:", // additional_information Screen "additional_information": "Дополнительная информация", - "enter_additional_information": - "Введите любую дополнительную информацию на своё усмотрение:", + "enter_additional_information": "Введите любую дополнительную информацию на своё усмотрение:", // language_select Screen "lbl_english": "English", diff --git a/lib/locator_service.dart b/lib/locator_service.dart index dc09164c..1d95a0b5 100644 --- a/lib/locator_service.dart +++ b/lib/locator_service.dart @@ -1,4 +1,5 @@ import 'package:dio/dio.dart'; +import 'package:eatvio_app/core/constants/constants.dart'; import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart'; import 'package:eatvio_app/features/blog_post/presentation/bloc/blog_post_cubit.dart'; import 'package:eatvio_app/features/blog_post/repositories/blog_post_repository.dart'; @@ -14,7 +15,6 @@ import 'package:eatvio_app/features/feed/services/feed_service.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/features/registration/repositories/registration_repository.dart'; import 'package:eatvio_app/features/registration/services/registration_service.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:get_it/get_it.dart'; final sl = GetIt.instance; @@ -46,7 +46,7 @@ Future init() async { sl.registerLazySingleton( () => Dio( BaseOptions( - baseUrl: dotenv.env['SERVER_ROOT']!, + baseUrl: baseUrl, ), ), ); diff --git a/lib/main.dart b/lib/main.dart index 7faced2a..ab53ccad 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,6 +6,7 @@ import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/noti import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/bloc/chat_select_bloc.dart'; import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/models/chat_select_model.dart'; import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart'; +import 'package:eatvio_app/locator_service.dart' as di; import 'package:eatvio_app/locator_service.dart'; import 'package:eatvio_app/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart'; import 'package:eatvio_app/presentation/diary/diary_edit_screen/models/diary_edit_model.dart'; @@ -14,12 +15,11 @@ import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_prof import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; -import 'core/app_export.dart'; import 'package:hive_flutter/hive_flutter.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:keyboard_dismisser/keyboard_dismisser.dart'; -import 'package:eatvio_app/locator_service.dart' as di; +import 'package:path_provider/path_provider.dart'; + +import 'core/app_export.dart'; var globalMessengerKey = GlobalKey(); @@ -28,7 +28,6 @@ void main() async { await di.init(); final appDocumentDir = await getApplicationDocumentsDirectory(); final path = appDocumentDir.path; - await dotenv.load(fileName: ".env"); await Hive.initFlutter(path); SystemChrome.setPreferredOrientations([ DeviceOrientation.landscapeLeft, diff --git a/lib/presentation/auth/auth_screen/auth_screen.dart b/lib/presentation/auth/auth_screen/auth_screen.dart index ad32b70f..ec01a983 100644 --- a/lib/presentation/auth/auth_screen/auth_screen.dart +++ b/lib/presentation/auth/auth_screen/auth_screen.dart @@ -1,22 +1,21 @@ +import 'dart:convert'; + +import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/core/token_storage.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; +import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; +import 'package:eatvio_app/widgets/custom_text_form_field.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:hive/hive.dart'; +import 'package:http/http.dart' as http; +import 'package:validators/validators.dart'; import 'bloc/auth_bloc.dart'; import 'models/auth_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:validators/validators.dart'; -import 'package:eatvio_app/widgets/next_step_button.dart'; -import 'package:eatvio_app/widgets/custom_text_form_field.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'dart:convert'; -import 'package:hive/hive.dart'; -import 'package:http/http.dart' as http; -class AuthScreen extends StatelessWidget { +class AuthScreen extends StatefulWidget { static Widget builder(BuildContext context) { return BlocProvider( create: (context) => AuthBloc( @@ -30,6 +29,13 @@ class AuthScreen extends StatelessWidget { ); } + @override + State createState() => _AuthScreenState(); +} + +class _AuthScreenState extends State { + bool checkboxState = false; + @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); @@ -95,12 +101,6 @@ class AuthScreen extends StatelessWidget { ); }, ), - TextButton( - onPressed: () async { - await launchUrl(Uri.parse(dotenv.env['OFERTA']!)); - }, - child: Text('Пользовательское соглашение'), - ), ], ), ), @@ -117,7 +117,7 @@ class AuthScreen extends StatelessWidget { 'password': state.passwordController!.text, }; final response = await http.post( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/login'), + Uri.parse(baseUrl + '/api/login'), headers: {'Content-Type': 'application/json'}, body: json.encode(credentials), encoding: utf8, diff --git a/lib/presentation/auth/auth_screen/bloc/auth_bloc.dart b/lib/presentation/auth/auth_screen/bloc/auth_bloc.dart index 6622981a..0d8f67ad 100644 --- a/lib/presentation/auth/auth_screen/bloc/auth_bloc.dart +++ b/lib/presentation/auth/auth_screen/bloc/auth_bloc.dart @@ -1,10 +1,10 @@ +import 'package:eatvio_app/presentation/auth/auth_screen/models/auth_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/auth/auth_screen/models/auth_model.dart'; part 'auth_event.dart'; - part 'auth_state.dart'; /// A bloc that manages the state of a Auth according to the event that is dispatched to it. 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 e93f2957..1792f4d0 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 @@ -1,14 +1,15 @@ import 'dart:async'; -import 'package:intl/intl.dart'; +import 'dart:convert'; + +import 'package:eatvio_app/presentation/diary/diary_edit_screen/models/diary_edit_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:eatvio_app/presentation/diary/diary_edit_screen/models/diary_edit_model.dart'; -import 'package:http/http.dart' as http; -import 'dart:convert'; import 'package:hive/hive.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:http/http.dart' as http; +import 'package:image_picker/image_picker.dart'; +import 'package:intl/intl.dart'; + +import '/core/app_export.dart'; part 'diary_edit_event.dart'; part 'diary_edit_state.dart'; @@ -148,7 +149,7 @@ class DiaryEditBloc extends Bloc { fetchDiaryId(String token, Emitter emit) async { final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/diary/index'), + Uri.parse(baseUrl + '/api/diary/index'), headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer $token', @@ -173,7 +174,7 @@ class DiaryEditBloc extends Bloc { fetchDiaryData(String token, int diaryId) async { final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/diary/$diaryId/show/'), + Uri.parse(baseUrl + '/api/diary/$diaryId/show/'), headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer $token', @@ -191,7 +192,7 @@ class DiaryEditBloc extends Bloc { ) async { final responseChart = await http.get( Uri.parse( - dotenv.env['SERVER_ROOT']! + '/diary/$diaryID/dailyNutritionData/', + baseUrl + '/api/diary/$diaryID/dailyNutritionData/', ), headers: { 'Content-Type': 'application/json', @@ -234,7 +235,7 @@ class DiaryEditBloc extends Bloc { final box = await Hive.openBox('token'); final token = box.get('token'); final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/diary/index'), + Uri.parse(baseUrl + '/api/diary/index'), headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer $token', @@ -247,7 +248,7 @@ class DiaryEditBloc extends Bloc { final int diaryId = data['id']; final diaryResponse = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/diary/$diaryId/show/'), + Uri.parse(baseUrl + '/api/diary/$diaryId/show/'), headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer $token', @@ -260,7 +261,7 @@ class DiaryEditBloc extends Bloc { final String diaryDate = diary['date'] ?? DateTime.now().toString(); final responseChart = await http.get( Uri.parse( - dotenv.env['SERVER_ROOT']! + '/diary/$diaryId/dailyNutritionData/', + baseUrl + '/api/diary/$diaryId/dailyNutritionData/', ), headers: { 'Content-Type': 'application/json', @@ -371,7 +372,7 @@ class DiaryEditBloc extends Bloc { int? mealID, int diaryID, ) async { - String url = dotenv.env['SERVER_ROOT']! + '/diary/$diaryID/meal/$mealID/satiety/fill'; + String url = baseUrl + '/api/diary/$diaryID/meal/$mealID/satiety/fill'; final Map credentials = { 'satiety': selectedSatiety, }; @@ -419,7 +420,7 @@ class DiaryEditBloc extends Bloc { int? mealID, int diaryID, ) async { - String url = dotenv.env['SERVER_ROOT']! + '/diary/$diaryID/meal/$mealID/mood/fill'; + String url = baseUrl + '/api/diary/$diaryID/meal/$mealID/mood/fill'; final Map credentials = { 'mood': selectedMood, }; @@ -484,7 +485,7 @@ class DiaryEditBloc extends Bloc { TimeOfDay wakeup, int diaryID, ) async { - String url = dotenv.env['SERVER_ROOT']! + '/diary/$diaryID/wakeUp/fill'; + String url = baseUrl + '/api/diary/$diaryID/wakeUp/fill'; final formatter = DateFormat('HH:mm'); final wakeupString = formatter.format(DateTime(2022, 1, 1, wakeup.hour, wakeup.minute)); final Map credentials = { @@ -509,7 +510,7 @@ class DiaryEditBloc extends Bloc { TimeOfDay retire, int diaryID, ) async { - String url = dotenv.env['SERVER_ROOT']! + '/diary/$diaryID/retire/fill'; + String url = baseUrl + '/api/diary/$diaryID/retire/fill'; final formatter = DateFormat('HH:mm'); final retireString = formatter.format(DateTime(2022, 1, 1, retire.hour, retire.minute)); final Map credentials = { @@ -547,7 +548,7 @@ class DiaryEditBloc extends Bloc { int? mealID, int diaryID, ) async { - String url = dotenv.env['SERVER_ROOT']! + '/diary/???'; + String url = baseUrl + '/api/diary/???'; final Map credentials = { 'time': mealTime, 'meal_id': mealID, @@ -674,7 +675,7 @@ class DiaryEditBloc extends Bloc { int? mealID, int diaryID, ) async { - String url = '${dotenv.env['SERVER_ROOT']!}/diary/$diaryID/meal/$mealID/portions/create'; + String url = '${baseUrl}/api/diary/$diaryID/meal/$mealID/portions/create'; final Map credentials = { 'product_name': name, @@ -705,7 +706,7 @@ class DiaryEditBloc extends Bloc { final Map credentials = {'name': event.input}; final uri = Uri.parse( - '${dotenv.env['SERVER_ROOT']!}/diary/product_nutritional_values/filter?${Uri(queryParameters: credentials).query}', + '${baseUrl}/api/diary/product_nutritional_values/filter?${Uri(queryParameters: credentials).query}', ); final response = await http.get( @@ -767,7 +768,7 @@ class DiaryEditBloc extends Bloc { int? mealID, int diaryID, ) async { - String url = '${dotenv.env['SERVER_ROOT']!}/diary/$diaryID/meal/$mealID/portions/$portionID/delete'; + String url = '${baseUrl}/api/diary/$diaryID/meal/$mealID/portions/$portionID/delete'; var response = await http.delete( Uri.parse(url), @@ -813,7 +814,7 @@ class DiaryEditBloc extends Bloc { int? mealID, int diaryID, ) async { - String url = '${dotenv.env['SERVER_ROOT']!}/diary/$diaryID/meal/$mealID/photo/delete'; + String url = '${baseUrl}/api/diary/$diaryID/meal/$mealID/photo/delete'; final Map credentials = { 'id': photoID, 'path': path, @@ -866,7 +867,7 @@ class DiaryEditBloc extends Bloc { 'comment': comment ?? " ", }; - String url = '${dotenv.env['SERVER_ROOT']!}/diary/$diaryID/finishDay'; + String url = '${baseUrl}/api/diary/$diaryID/finishDay'; var response = await http.post( Uri.parse(url), @@ -905,7 +906,7 @@ class DiaryEditBloc extends Bloc { int mealId, String? token, ) async { - String url = '${dotenv.env['SERVER_ROOT']!}/diary/$diaryID/meal/$mealId/photo/upload'; + String url = '${baseUrl}/api/diary/$diaryID/meal/$mealId/photo/upload'; var request = http.MultipartRequest('POST', Uri.parse(url)); request.headers['Authorization'] = 'Bearer $token'; @@ -958,9 +959,9 @@ class DiaryEditBloc extends Bloc { String? token, ) async { final Uri url = Uri.parse( - '${dotenv.env['SERVER_ROOT']!}/diary/product_nutritional_values/sendToModeration', + '${baseUrl}/api/diary/product_nutritional_values/sendToModeration', ); - final Uri serverURL = Uri.parse('${dotenv.env['SERVER_ROOT']!}'); + final Uri serverURL = Uri.parse('${baseUrl}'); String host = serverURL.host; final Map credentials = { 'name': name, @@ -1020,7 +1021,7 @@ class DiaryEditBloc extends Bloc { String comment, int diaryID, ) async { - String url = dotenv.env['SERVER_ROOT']! + '/diary/$diaryID/retire/fill'; + String url = baseUrl + '/api/diary/$diaryID/retire/fill'; final Map credentials = { 'comment': comment, }; diff --git a/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_event.dart b/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_event.dart index c2c5dad3..318a7688 100644 --- a/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_event.dart +++ b/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_event.dart @@ -122,7 +122,6 @@ class ChangeMeal extends DiaryEditEvent { List get props => [value, meals]; } - class ClearInput extends DiaryEditEvent { ClearInput({required this.value}); @@ -154,18 +153,18 @@ class RefreshEvent extends DiaryEditEvent { } class SendModeration extends DiaryEditEvent { - SendModeration( - {required this.name, - required this.energyOn100gr, - required this.proteinsOn100gr, - required this.fatsOn100gr, - required this.carbohydratesOn100gr,}); + SendModeration({ + required this.name, + required this.energyOn100gr, + required this.proteinsOn100gr, + required this.fatsOn100gr, + required this.carbohydratesOn100gr, + }); String name; String energyOn100gr; String proteinsOn100gr; String fatsOn100gr; String carbohydratesOn100gr; @override - List get props => - [name, energyOn100gr, proteinsOn100gr, fatsOn100gr, carbohydratesOn100gr]; + List get props => [name, energyOn100gr, proteinsOn100gr, fatsOn100gr, carbohydratesOn100gr]; } diff --git a/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart b/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart index dfea7c25..e5f942fe 100644 --- a/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart +++ b/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart @@ -1,19 +1,19 @@ // ignore_for_file: unused_local_variable -import 'bloc/diary_edit_bloc.dart'; -import 'models/diary_edit_model.dart'; +import 'package:carousel_slider/carousel_slider.dart'; +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/widgets/custom_edit_drop_down.dart'; +import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart'; +import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/custom_scale_element.dart'; +import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; -import 'package:fl_chart/fl_chart.dart'; import 'package:image_picker/image_picker.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart'; -import 'package:eatvio_app/widgets/custom_edit_drop_down.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; -import 'package:eatvio_app/widgets/custom_scale_element.dart'; -import 'package:carousel_slider/carousel_slider.dart'; + +import 'bloc/diary_edit_bloc.dart'; +import 'models/diary_edit_model.dart'; // ignore: must_be_immutable class DiaryEditScreen extends StatelessWidget { @@ -711,7 +711,7 @@ class DiaryEditScreen extends StatelessWidget { borderRadius: BorderRadiusStyle.roundedBorder5, ), child: Image.network( - dotenv.env['STORAGE_URL']! + photo['path'], + baseUrl + '/storage/' + photo['path'], ), ), Positioned( diff --git a/lib/presentation/diary/diary_edit_screen/models/diary_edit_model.dart b/lib/presentation/diary/diary_edit_screen/models/diary_edit_model.dart index 6f68bc2d..d37abbf4 100644 --- a/lib/presentation/diary/diary_edit_screen/models/diary_edit_model.dart +++ b/lib/presentation/diary/diary_edit_screen/models/diary_edit_model.dart @@ -1,7 +1,7 @@ // ignore_for_file: must_be_immutable -import 'package:equatable/equatable.dart'; import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; +import 'package:equatable/equatable.dart'; /// This class defines the variables used in the [k0_page], /// and is typically used to hold data that is passed between different parts of the application. diff --git a/lib/presentation/diets/diet_create_screen/bloc/diet_create_bloc.dart b/lib/presentation/diets/diet_create_screen/bloc/diet_create_bloc.dart index a28b79de..65ea65b9 100644 --- a/lib/presentation/diets/diet_create_screen/bloc/diet_create_bloc.dart +++ b/lib/presentation/diets/diet_create_screen/bloc/diet_create_bloc.dart @@ -1,15 +1,15 @@ import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/diets/diet_create_screen/models/diet_create_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/diets/diet_create_screen/models/diet_create_model.dart'; part 'diet_create_event.dart'; part 'diet_create_state.dart'; @@ -32,21 +32,27 @@ class DietCreateBloc extends Bloc { } if (state is DietCreateLoadedState) { var currentState = state as DietCreateLoadedState; - emit(currentState.copyWith( - dietModelObj: currentState.dietModelObj, - name: currentState.name, - details: currentState.details, - ),); + emit( + currentState.copyWith( + dietModelObj: currentState.dietModelObj, + name: currentState.name, + details: currentState.details, + ), + ); } else { - emit(DietCreateLoadedState( - name: TextEditingController(), - details: TextEditingController(), - ),); + emit( + DietCreateLoadedState( + name: TextEditingController(), + details: TextEditingController(), + ), + ); } } FutureOr _createDiet( - CreateDiet event, Emitter emit,) async { + CreateDiet event, + Emitter emit, + ) async { if (state is DietCreateLoadedState) { var currentState = state as DietCreateLoadedState; @@ -59,7 +65,8 @@ class DietCreateBloc extends Bloc { AppRouter.navigatorKey.currentContext?.goNamed('dietSelectScreen'); } else { print( - 'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}',); + 'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}', + ); } } } @@ -68,7 +75,7 @@ class DietCreateBloc extends Bloc { String? name, String? details, ) async { - String url = '${dotenv.env['SERVER_ROOT']!}/diets/create'; + String url = '${baseUrl}/api/diets/create'; final Map credentials = { 'name': name, diff --git a/lib/presentation/diets/diet_create_screen/bloc/diet_create_state.dart b/lib/presentation/diets/diet_create_screen/bloc/diet_create_state.dart index be825abe..6b42e385 100644 --- a/lib/presentation/diets/diet_create_screen/bloc/diet_create_state.dart +++ b/lib/presentation/diets/diet_create_screen/bloc/diet_create_state.dart @@ -60,6 +60,5 @@ class DietCreateErrorState extends DietCreateState { } class DietCreateInitialState extends DietCreateState { - DietCreateInitialState({required DietCreateModel dietModelObj}) - : super(dietModelObj: dietModelObj); + DietCreateInitialState({required DietCreateModel dietModelObj}) : super(dietModelObj: dietModelObj); } diff --git a/lib/presentation/diets/diet_create_screen/diet_create_screen.dart b/lib/presentation/diets/diet_create_screen/diet_create_screen.dart index 619e8f71..2ade3f80 100644 --- a/lib/presentation/diets/diet_create_screen/diet_create_screen.dart +++ b/lib/presentation/diets/diet_create_screen/diet_create_screen.dart @@ -1,16 +1,18 @@ -import 'bloc/diet_create_bloc.dart'; -import 'models/diet_create_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; +import 'bloc/diet_create_bloc.dart'; +import 'models/diet_create_model.dart'; + class DietCreateScreen extends StatelessWidget { const DietCreateScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { final dietID = ModalRoute.of(context)!.settings.arguments; return BlocProvider( - create: (context) => DietCreateBloc(DietCreateState(dietModelObj: DietCreateModel(dietID: dietID.toString())))..add(DietCreateInitialEvent()), - child: DietCreateScreen(),); + create: (context) => DietCreateBloc(DietCreateState(dietModelObj: DietCreateModel(dietID: dietID.toString())))..add(DietCreateInitialEvent()), + child: DietCreateScreen(), + ); } Widget build(BuildContext context) { @@ -43,47 +45,52 @@ class DietCreateScreen extends StatelessWidget { body: Container( width: double.maxFinite, decoration: AppDecoration.fillGray, - child: ListView(children: [ - SizedBox(height: 30.v), - Container( - margin: EdgeInsets.only( - left: 16.h, - right: 20.h, - bottom: 10.h, + child: ListView( + children: [ + SizedBox(height: 30.v), + Container( + margin: EdgeInsets.only( + left: 16.h, + right: 20.h, + bottom: 10.h, + ), + padding: EdgeInsets.all(12.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.all(Radius.circular(12)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 2, + blurRadius: 5, + offset: Offset(0, 3), + ), + ], + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 16.0), + TextFormField( + controller: state.name, + decoration: InputDecoration(labelText: 'Заголовок'), + ), + SizedBox(height: 16.0), + TextFormField( + controller: state.details, + decoration: InputDecoration(labelText: 'Описание'), + ), + SizedBox(height: 16.0), + // Здесь нужно добавить виджет для загрузки картинки + ElevatedButton( + onPressed: () => context.read().add(CreateDiet()), + child: Text('Создать'), + ), + ], + ), ), - padding: EdgeInsets.all(12.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], - ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 16.0), - TextFormField( - controller: state.name, - decoration: InputDecoration(labelText: 'Заголовок'), - ), - SizedBox(height: 16.0), - TextFormField( - controller: state.details, - decoration: InputDecoration(labelText: 'Описание'), - ), - SizedBox(height: 16.0), - // Здесь нужно добавить виджет для загрузки картинки - ElevatedButton( - onPressed: () => context.read().add(CreateDiet()), - child: Text('Создать'), - ), - ],), - ), - ],), + ], + ), ), ), ); diff --git a/lib/presentation/diets/diet_edit_screen/bloc/diet_edit_bloc.dart b/lib/presentation/diets/diet_edit_screen/bloc/diet_edit_bloc.dart index 22cc1aa2..81e034a1 100644 --- a/lib/presentation/diets/diet_edit_screen/bloc/diet_edit_bloc.dart +++ b/lib/presentation/diets/diet_edit_screen/bloc/diet_edit_bloc.dart @@ -1,18 +1,17 @@ import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/diets/diet_edit_screen/models/diet_edit_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/diets/diet_edit_screen/models/diet_edit_model.dart'; part 'diet_edit_event.dart'; - part 'diet_edit_state.dart'; /// A bloc that manages the state of a DietEdit according to the event that is dispatched to it. @@ -34,7 +33,7 @@ class DietEditBloc extends Bloc { } final String? dietID = state.dietModelObj?.dietID; final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/diets/show/$dietID'), + Uri.parse(baseUrl + '/api/diets/show/$dietID'), headers: { 'Authorization': 'Bearer $token', }, @@ -44,18 +43,24 @@ class DietEditBloc extends Bloc { if (data is Map) { if (state is DietEditLoadedState) { var currentState = state as DietEditLoadedState; - emit(currentState.copyWith( + emit( + currentState.copyWith( dietModelObj: currentState.dietModelObj, diet: currentState.diet, name: currentState.name, duration: currentState.duration, - details: currentState.details,),); + details: currentState.details, + ), + ); } else { - emit(DietEditLoadedState( + emit( + DietEditLoadedState( diet: data, name: TextEditingController(text: data['name']), details: TextEditingController(text: data['details']), - duration: TextEditingController(text: data['duration']),),); + duration: TextEditingController(text: data['duration']), + ), + ); } } else { // Один или несколько ключевых полей отсутствуют, обрабатываем ошибку @@ -96,7 +101,7 @@ class DietEditBloc extends Bloc { String? duration, ) async { int id = diet?['id']; - String url = '${dotenv.env['SERVER_ROOT']!}/diets/update/$id'; + String url = '${baseUrl}/api/diets/update/$id'; final Map credentials = { 'id': id, diff --git a/lib/presentation/diets/diet_edit_screen/bloc/diet_edit_state.dart b/lib/presentation/diets/diet_edit_screen/bloc/diet_edit_state.dart index bfc5e245..ab0d2ee3 100644 --- a/lib/presentation/diets/diet_edit_screen/bloc/diet_edit_state.dart +++ b/lib/presentation/diets/diet_edit_screen/bloc/diet_edit_state.dart @@ -22,8 +22,13 @@ class DietEditState extends Equatable { } class DietEditLoadedState extends DietEditState { - DietEditLoadedState( - {this.dietModelObj, this.diet, this.name, this.details, this.duration,}); + DietEditLoadedState({ + this.dietModelObj, + this.diet, + this.name, + this.details, + this.duration, + }); DietEditModel? dietModelObj; Map? diet; @@ -59,6 +64,5 @@ class DietEditErrorState extends DietEditState { } class DietEditInitialState extends DietEditState { - DietEditInitialState({required DietEditModel dietModelObj}) - : super(dietModelObj: dietModelObj); + DietEditInitialState({required DietEditModel dietModelObj}) : super(dietModelObj: dietModelObj); } diff --git a/lib/presentation/diets/diet_edit_screen/diet_edit_screen.dart b/lib/presentation/diets/diet_edit_screen/diet_edit_screen.dart index aa7cf200..d76d79d7 100644 --- a/lib/presentation/diets/diet_edit_screen/diet_edit_screen.dart +++ b/lib/presentation/diets/diet_edit_screen/diet_edit_screen.dart @@ -1,9 +1,9 @@ -import 'bloc/diet_edit_bloc.dart'; -import 'models/diet_edit_model.dart'; +import 'package:cached_network_image/cached_network_image.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; + +import 'bloc/diet_edit_bloc.dart'; +import 'models/diet_edit_model.dart'; class DietEditScreen extends StatelessWidget { const DietEditScreen({Key? key}) : super(key: key); @@ -11,8 +11,9 @@ class DietEditScreen extends StatelessWidget { static Widget builder(BuildContext context) { final dietID = ModalRoute.of(context)!.settings.arguments; return BlocProvider( - create: (context) => DietEditBloc(DietEditState(dietModelObj: DietEditModel(dietID: dietID.toString())))..add(DietEditInitialEvent()), - child: DietEditScreen(),); + create: (context) => DietEditBloc(DietEditState(dietModelObj: DietEditModel(dietID: dietID.toString())))..add(DietEditInitialEvent()), + child: DietEditScreen(), + ); } Widget build(BuildContext context) { @@ -71,7 +72,7 @@ class DietEditScreen extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (state.diet?['image'] ?? ''), + imageUrl: baseUrl + '/storage/' + (state.diet?['image'] ?? ''), imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 25, diff --git a/lib/presentation/diets/diet_select_screen/bloc/diet_select_bloc.dart b/lib/presentation/diets/diet_select_screen/bloc/diet_select_bloc.dart index e12eab5e..56dabcf2 100644 --- a/lib/presentation/diets/diet_select_screen/bloc/diet_select_bloc.dart +++ b/lib/presentation/diets/diet_select_screen/bloc/diet_select_bloc.dart @@ -1,17 +1,17 @@ //import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart'; import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/diets/diet_select_screen/models/diet_select_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/diets/diet_select_screen/models/diet_select_model.dart'; -import 'package:http/http.dart' as http; -import 'dart:convert'; -import 'package:hive/hive.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:image_picker/image_picker.dart'; import 'package:go_router/go_router.dart'; +import 'package:hive/hive.dart'; +import 'package:http/http.dart' as http; +import 'package:image_picker/image_picker.dart'; + +import '/core/app_export.dart'; part 'diet_select_event.dart'; part 'diet_select_state.dart'; @@ -33,7 +33,7 @@ class DietSelectBloc extends Bloc { AppRouter.navigatorKey.currentContext?.goNamed('authScreen'); } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/diets/index'), + Uri.parse(baseUrl + '/api/diets/index'), headers: { 'Authorization': 'Bearer $token', }, @@ -47,15 +47,19 @@ class DietSelectBloc extends Bloc { if (state is DietSelectLoadedState) { print('Got loaded'); var currentState = state as DietSelectLoadedState; - emit((currentState).copyWith( - posts: data, - myProfileModelObj: currentState.myProfileModelObj, - ),); + emit( + (currentState).copyWith( + posts: data, + myProfileModelObj: currentState.myProfileModelObj, + ), + ); } else { print('Got unloaded'); - emit(DietSelectLoadedState( - posts: data, - ),); + emit( + DietSelectLoadedState( + posts: data, + ), + ); } } else { // Один или несколько ключевых полей отсутствуют, обрабатываем ошибку diff --git a/lib/presentation/diets/diet_select_screen/bloc/diet_select_state.dart b/lib/presentation/diets/diet_select_screen/bloc/diet_select_state.dart index e7b709db..85b7d5ab 100644 --- a/lib/presentation/diets/diet_select_screen/bloc/diet_select_state.dart +++ b/lib/presentation/diets/diet_select_screen/bloc/diet_select_state.dart @@ -12,14 +12,12 @@ class DietSelectState extends Equatable { } class DietSelectInitialState extends DietSelectState { - DietSelectInitialState({required DietSelectModel myProfileModelObj}) - : super(myProfileModelObj: myProfileModelObj); + DietSelectInitialState({required DietSelectModel myProfileModelObj}) : super(myProfileModelObj: myProfileModelObj); } /// Represents the state of DietSelect in the application. class DietSelectLoadedState extends DietSelectState { - DietSelectLoadedState({this.myProfileModelObj, this.posts}) - : super(myProfileModelObj: null); + DietSelectLoadedState({this.myProfileModelObj, this.posts}) : super(myProfileModelObj: null); DietSelectModel? myProfileModelObj; List? posts; diff --git a/lib/presentation/diets/diet_select_screen/diet_select_screen.dart b/lib/presentation/diets/diet_select_screen/diet_select_screen.dart index 4b026cb2..3f4a8ce8 100644 --- a/lib/presentation/diets/diet_select_screen/diet_select_screen.dart +++ b/lib/presentation/diets/diet_select_screen/diet_select_screen.dart @@ -1,19 +1,20 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; +import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'bloc/diet_select_bloc.dart'; import 'models/diet_select_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:flutter/material.dart'; class DietSelectScreen extends StatelessWidget { static Widget builder(BuildContext context) { return BlocProvider( - create: (context) => DietSelectBloc(DietSelectState(myProfileModelObj: DietSelectModel()))..add(DietSelectInitialEvent()), child: DietSelectScreen(),); + create: (context) => DietSelectBloc(DietSelectState(myProfileModelObj: DietSelectModel()))..add(DietSelectInitialEvent()), + child: DietSelectScreen(), + ); } Widget build(BuildContext context) { @@ -118,50 +119,51 @@ class DietSelectScreen extends StatelessWidget { itemBuilder: (context, index) { final post = state.posts?[index]; return Container( - margin: EdgeInsets.only(bottom: 10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], + margin: EdgeInsets.only(bottom: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.all(Radius.circular(12)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 2, + blurRadius: 5, + offset: Offset(0, 3), + ), + ], + ), + child: ListTile( + leading: CachedNetworkImage( + imageUrl: baseUrl + '/storage/' + post['image'], + imageBuilder: (context, imageProvider) => CircleAvatar( + backgroundImage: imageProvider, + radius: 25, + ), + placeholder: (context, url) => CircularProgressIndicator(), + errorWidget: (context, url, error) => CircleAvatar( + child: Icon(Icons.person), + backgroundColor: Colors.white, + radius: 25, + ), ), - child: ListTile( - leading: CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + post['image'], - imageBuilder: (context, imageProvider) => CircleAvatar( - backgroundImage: imageProvider, - radius: 25, - ), - placeholder: (context, url) => CircularProgressIndicator(), - errorWidget: (context, url, error) => CircleAvatar( - child: Icon(Icons.person), - backgroundColor: Colors.white, - radius: 25, - ), - ), - title: Text( - post?['name'] ?? '', - style: CustomTextStyles.titleMediumSemiBold, - ), - subtitle: Text(post?['details'] ?? ''), + title: Text( + post?['name'] ?? '', + style: CustomTextStyles.titleMediumSemiBold, + ), + subtitle: Text(post?['details'] ?? ''), + onTap: () => GoRouter.of(context).goNamed( + 'dietScreen', + extra: post?['id'].toString(), + ), + trailing: GestureDetector( onTap: () => GoRouter.of(context).goNamed( - 'dietScreen', + 'dietEditScreen', extra: post?['id'].toString(), ), - trailing: GestureDetector( - onTap: () => GoRouter.of(context).goNamed( - 'dietEditScreen', - extra: post?['id'].toString(), - ), - child: Icon(Icons.edit), - ), - ),); + child: Icon(Icons.edit), + ), + ), + ); }, ); } diff --git a/lib/presentation/diets/diet_show_screen/bloc/diet_show_bloc.dart b/lib/presentation/diets/diet_show_screen/bloc/diet_show_bloc.dart index 5fcd3a1d..3d0551a2 100644 --- a/lib/presentation/diets/diet_show_screen/bloc/diet_show_bloc.dart +++ b/lib/presentation/diets/diet_show_screen/bloc/diet_show_bloc.dart @@ -1,18 +1,17 @@ import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/diets/diet_show_screen/models/diet_show_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/diets/diet_show_screen/models/diet_show_model.dart'; -import 'package:go_router/go_router.dart'; part 'diet_show_event.dart'; - part 'diet_show_state.dart'; /// A bloc that manages the state of a Diet according to the event that is dispatched to it. @@ -34,7 +33,7 @@ class DietBloc extends Bloc { } final String? dietID = state.dietModelObj?.dietID; final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/diets/show/$dietID'), + Uri.parse(baseUrl + '/api/diets/show/$dietID'), headers: { 'Authorization': 'Bearer $token', }, @@ -70,7 +69,7 @@ class DietBloc extends Bloc { } final int id = event.id; final response = await http.post( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/diets/delete/$id'), + Uri.parse(baseUrl + '/api/diets/delete/$id'), headers: { 'Authorization': 'Bearer $token', }, diff --git a/lib/presentation/diets/diet_show_screen/bloc/diet_show_state.dart b/lib/presentation/diets/diet_show_screen/bloc/diet_show_state.dart index 49913f7f..d587263f 100644 --- a/lib/presentation/diets/diet_show_screen/bloc/diet_show_state.dart +++ b/lib/presentation/diets/diet_show_screen/bloc/diet_show_state.dart @@ -28,8 +28,7 @@ class DietLoadedState extends DietState { Map? diet; @override List get props => [dietModelObj, diet]; - DietLoadedState copyWith( - {DietModel? dietModelObj, Map? diet}) { + DietLoadedState copyWith({DietModel? dietModelObj, Map? diet}) { return DietLoadedState( dietModelObj: dietModelObj ?? this.dietModelObj, diet: diet ?? this.diet, @@ -47,6 +46,5 @@ class DietErrorState extends DietState { } class DietInitialState extends DietState { - DietInitialState({required DietModel dietModelObj}) - : super(dietModelObj: dietModelObj); + DietInitialState({required DietModel dietModelObj}) : super(dietModelObj: dietModelObj); } diff --git a/lib/presentation/diets/diet_show_screen/diet_show_screen.dart b/lib/presentation/diets/diet_show_screen/diet_show_screen.dart index 950e47a6..9fae1efd 100644 --- a/lib/presentation/diets/diet_show_screen/diet_show_screen.dart +++ b/lib/presentation/diets/diet_show_screen/diet_show_screen.dart @@ -1,11 +1,10 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'bloc/diet_show_bloc.dart'; import 'models/diet_show_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; class DietScreen extends StatelessWidget { const DietScreen({Key? key}) : super(key: key); @@ -13,7 +12,9 @@ class DietScreen extends StatelessWidget { static Widget builder(BuildContext context) { final dietID = ModalRoute.of(context)!.settings.arguments; return BlocProvider( - create: (context) => DietBloc(DietState(dietModelObj: DietModel(dietID: dietID.toString())))..add(DietInitialEvent()), child: DietScreen(),); + create: (context) => DietBloc(DietState(dietModelObj: DietModel(dietID: dietID.toString())))..add(DietInitialEvent()), + child: DietScreen(), + ); } Widget build(BuildContext context) { @@ -68,44 +69,47 @@ class DietScreen extends StatelessWidget { ), ], ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (state.diet?['image'] ?? ''), - imageBuilder: (context, imageProvider) => CircleAvatar( - backgroundImage: imageProvider, - radius: 25, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + CachedNetworkImage( + imageUrl: baseUrl + '/storage/' + (state.diet?['image'] ?? ''), + imageBuilder: (context, imageProvider) => CircleAvatar( + backgroundImage: imageProvider, + radius: 25, + ), + placeholder: (context, url) => CircularProgressIndicator(), + errorWidget: (context, url, error) => CircleAvatar( + child: Icon(Icons.person), + backgroundColor: Colors.white, + radius: 25, + ), ), - placeholder: (context, url) => CircularProgressIndicator(), - errorWidget: (context, url, error) => CircleAvatar( - child: Icon(Icons.person), - backgroundColor: Colors.white, - radius: 25, + SizedBox(height: 16.0), + Text(state.diet?['name'], style: CustomTextStyles.titleMediumBlack), + SizedBox(height: 8.0), + Text( + state.diet?['details'], ), - ), - SizedBox(height: 16.0), - Text(state.diet?['name'], style: CustomTextStyles.titleMediumBlack), - SizedBox(height: 8.0), - Text( - state.diet?['details'], - ), - SizedBox(height: 16.0), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - ElevatedButton( - onPressed: () => GoRouter.of(context).goNamed( - 'dietEditScreen', - extra: state.diet?['id'].toString(), + SizedBox(height: 16.0), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + ElevatedButton( + onPressed: () => GoRouter.of(context).goNamed( + 'dietEditScreen', + extra: state.diet?['id'].toString(), + ), + child: Text('Редактировать'), ), - child: Text('Редактировать'), - ), - ElevatedButton( - onPressed: () => context.read().add(DeleteEntry(state.diet?['id'])), - child: Text('Удалить'), - ), - ], - ), - ],), + ElevatedButton( + onPressed: () => context.read().add(DeleteEntry(state.diet?['id'])), + child: Text('Удалить'), + ), + ], + ), + ], + ), ), ], ), diff --git a/lib/presentation/feed/blog_post_create_screen/bloc/blog_post_create_bloc.dart b/lib/presentation/feed/blog_post_create_screen/bloc/blog_post_create_bloc.dart index 7ddbaca0..624a1ef4 100644 --- a/lib/presentation/feed/blog_post_create_screen/bloc/blog_post_create_bloc.dart +++ b/lib/presentation/feed/blog_post_create_screen/bloc/blog_post_create_bloc.dart @@ -1,22 +1,23 @@ import 'dart:async'; +import 'dart:convert'; import 'package:dio/dio.dart'; import 'package:eatvio_app/app_router.dart'; import 'package:eatvio_app/locator_service.dart'; +import 'package:eatvio_app/presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:image_picker/image_picker.dart'; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart'; -import 'package:go_router/go_router.dart'; + part 'blog_post_create_event.dart'; part 'blog_post_create_state.dart'; /// A bloc that manages the state of a BlogPostCreate according to the event that is dispatched to it. -class BlogPostCreateBloc - extends Bloc { +class BlogPostCreateBloc extends Bloc { BlogPostCreateBloc(BlogPostCreateState initialState) : super(initialState) { on(_onInitialize); on(_createBlogPost); @@ -79,8 +80,7 @@ class BlogPostCreateBloc } } - sendBlogPost(String? title, String? youtubeURL, String? description, - XFile? image) async { + sendBlogPost(String? title, String? youtubeURL, String? description, XFile? image) async { String url = '/blog_post/create'; final Map credentials = { @@ -99,8 +99,7 @@ class BlogPostCreateBloc return response; } - FutureOr _uploadImages( - UploadImages event, Emitter emit) { + FutureOr _uploadImages(UploadImages event, Emitter emit) { if (state is BlogPostCreateLoadedState) { var currentState = state as BlogPostCreateLoadedState; emit( diff --git a/lib/presentation/feed/blog_post_create_screen/bloc/blog_post_create_state.dart b/lib/presentation/feed/blog_post_create_screen/bloc/blog_post_create_state.dart index 4da3f5a6..33dc59b5 100644 --- a/lib/presentation/feed/blog_post_create_screen/bloc/blog_post_create_state.dart +++ b/lib/presentation/feed/blog_post_create_screen/bloc/blog_post_create_state.dart @@ -40,8 +40,7 @@ class BlogPostCreateLoadedState extends BlogPostCreateState { bool isLoading; XFile? image; @override - List get props => - [blog_postModelObj, title, description, youtubeURL]; + List get props => [blog_postModelObj, title, description, youtubeURL]; BlogPostCreateLoadedState copyWith({ BlogPostCreateModel? blog_postModelObj, TextEditingController? title, @@ -73,6 +72,5 @@ class BlogPostCreateErrorState extends BlogPostCreateState { } class BlogPostCreateInitialState extends BlogPostCreateState { - BlogPostCreateInitialState({required BlogPostCreateModel blog_postModelObj}) - : super(blog_postModelObj: blog_postModelObj); + BlogPostCreateInitialState({required BlogPostCreateModel blog_postModelObj}) : super(blog_postModelObj: blog_postModelObj); } diff --git a/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_credentials_model.freezed.dart b/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_credentials_model.freezed.dart index d403e452..13d4b864 100644 --- a/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_credentials_model.freezed.dart +++ b/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_credentials_model.freezed.dart @@ -14,8 +14,7 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); -BlogPostCreateCredentialsModel _$BlogPostCreateCredentialsModelFromJson( - Map json) { +BlogPostCreateCredentialsModel _$BlogPostCreateCredentialsModelFromJson(Map json) { return _BlogPostCreateCredentialsModel.fromJson(json); } @@ -29,29 +28,19 @@ mixin _$BlogPostCreateCredentialsModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $BlogPostCreateCredentialsModelCopyWith - get copyWith => throw _privateConstructorUsedError; + $BlogPostCreateCredentialsModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class $BlogPostCreateCredentialsModelCopyWith<$Res> { - factory $BlogPostCreateCredentialsModelCopyWith( - BlogPostCreateCredentialsModel value, - $Res Function(BlogPostCreateCredentialsModel) then) = - _$BlogPostCreateCredentialsModelCopyWithImpl<$Res, - BlogPostCreateCredentialsModel>; + factory $BlogPostCreateCredentialsModelCopyWith(BlogPostCreateCredentialsModel value, $Res Function(BlogPostCreateCredentialsModel) then) = + _$BlogPostCreateCredentialsModelCopyWithImpl<$Res, BlogPostCreateCredentialsModel>; @useResult - $Res call( - {String title, - String description, - @JsonKey(name: 'youtube_url') String youtubeUrl, - String status}); + $Res call({String title, String description, @JsonKey(name: 'youtube_url') String youtubeUrl, String status}); } /// @nodoc -class _$BlogPostCreateCredentialsModelCopyWithImpl<$Res, - $Val extends BlogPostCreateCredentialsModel> - implements $BlogPostCreateCredentialsModelCopyWith<$Res> { +class _$BlogPostCreateCredentialsModelCopyWithImpl<$Res, $Val extends BlogPostCreateCredentialsModel> implements $BlogPostCreateCredentialsModelCopyWith<$Res> { _$BlogPostCreateCredentialsModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -89,29 +78,18 @@ class _$BlogPostCreateCredentialsModelCopyWithImpl<$Res, } /// @nodoc -abstract class _$$BlogPostCreateCredentialsModelImplCopyWith<$Res> - implements $BlogPostCreateCredentialsModelCopyWith<$Res> { - factory _$$BlogPostCreateCredentialsModelImplCopyWith( - _$BlogPostCreateCredentialsModelImpl value, - $Res Function(_$BlogPostCreateCredentialsModelImpl) then) = +abstract class _$$BlogPostCreateCredentialsModelImplCopyWith<$Res> implements $BlogPostCreateCredentialsModelCopyWith<$Res> { + factory _$$BlogPostCreateCredentialsModelImplCopyWith(_$BlogPostCreateCredentialsModelImpl value, $Res Function(_$BlogPostCreateCredentialsModelImpl) then) = __$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {String title, - String description, - @JsonKey(name: 'youtube_url') String youtubeUrl, - String status}); + $Res call({String title, String description, @JsonKey(name: 'youtube_url') String youtubeUrl, String status}); } /// @nodoc -class __$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res> - extends _$BlogPostCreateCredentialsModelCopyWithImpl<$Res, - _$BlogPostCreateCredentialsModelImpl> +class __$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res> extends _$BlogPostCreateCredentialsModelCopyWithImpl<$Res, _$BlogPostCreateCredentialsModelImpl> implements _$$BlogPostCreateCredentialsModelImplCopyWith<$Res> { - __$$BlogPostCreateCredentialsModelImplCopyWithImpl( - _$BlogPostCreateCredentialsModelImpl _value, - $Res Function(_$BlogPostCreateCredentialsModelImpl) _then) + __$$BlogPostCreateCredentialsModelImplCopyWithImpl(_$BlogPostCreateCredentialsModelImpl _value, $Res Function(_$BlogPostCreateCredentialsModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -145,17 +123,11 @@ class __$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$BlogPostCreateCredentialsModelImpl - implements _BlogPostCreateCredentialsModel { +class _$BlogPostCreateCredentialsModelImpl implements _BlogPostCreateCredentialsModel { const _$BlogPostCreateCredentialsModelImpl( - {required this.title, - required this.description, - @JsonKey(name: 'youtube_url') required this.youtubeUrl, - this.status = 'active'}); + {required this.title, required this.description, @JsonKey(name: 'youtube_url') required this.youtubeUrl, this.status = 'active'}); - factory _$BlogPostCreateCredentialsModelImpl.fromJson( - Map json) => - _$$BlogPostCreateCredentialsModelImplFromJson(json); + factory _$BlogPostCreateCredentialsModelImpl.fromJson(Map json) => _$$BlogPostCreateCredentialsModelImplFromJson(json); @override final String title; @@ -179,25 +151,20 @@ class _$BlogPostCreateCredentialsModelImpl (other.runtimeType == runtimeType && other is _$BlogPostCreateCredentialsModelImpl && (identical(other.title, title) || other.title == title) && - (identical(other.description, description) || - other.description == description) && - (identical(other.youtubeUrl, youtubeUrl) || - other.youtubeUrl == youtubeUrl) && + (identical(other.description, description) || other.description == description) && + (identical(other.youtubeUrl, youtubeUrl) || other.youtubeUrl == youtubeUrl) && (identical(other.status, status) || other.status == status)); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, title, description, youtubeUrl, status); + int get hashCode => Object.hash(runtimeType, title, description, youtubeUrl, status); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$BlogPostCreateCredentialsModelImplCopyWith< - _$BlogPostCreateCredentialsModelImpl> - get copyWith => __$$BlogPostCreateCredentialsModelImplCopyWithImpl< - _$BlogPostCreateCredentialsModelImpl>(this, _$identity); + _$$BlogPostCreateCredentialsModelImplCopyWith<_$BlogPostCreateCredentialsModelImpl> get copyWith => + __$$BlogPostCreateCredentialsModelImplCopyWithImpl<_$BlogPostCreateCredentialsModelImpl>(this, _$identity); @override Map toJson() { @@ -207,16 +174,14 @@ class _$BlogPostCreateCredentialsModelImpl } } -abstract class _BlogPostCreateCredentialsModel - implements BlogPostCreateCredentialsModel { +abstract class _BlogPostCreateCredentialsModel implements BlogPostCreateCredentialsModel { const factory _BlogPostCreateCredentialsModel( {required final String title, required final String description, @JsonKey(name: 'youtube_url') required final String youtubeUrl, final String status}) = _$BlogPostCreateCredentialsModelImpl; - factory _BlogPostCreateCredentialsModel.fromJson(Map json) = - _$BlogPostCreateCredentialsModelImpl.fromJson; + factory _BlogPostCreateCredentialsModel.fromJson(Map json) = _$BlogPostCreateCredentialsModelImpl.fromJson; @override String get title; @@ -229,7 +194,5 @@ abstract class _BlogPostCreateCredentialsModel String get status; @override @JsonKey(ignore: true) - _$$BlogPostCreateCredentialsModelImplCopyWith< - _$BlogPostCreateCredentialsModelImpl> - get copyWith => throw _privateConstructorUsedError; + _$$BlogPostCreateCredentialsModelImplCopyWith<_$BlogPostCreateCredentialsModelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_credentials_model.g.dart b/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_credentials_model.g.dart index 5dec0301..f4bfea00 100644 --- a/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_credentials_model.g.dart +++ b/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_credentials_model.g.dart @@ -6,18 +6,14 @@ part of '../../../../features/blog_post_create/models/blog_post_create_credentia // JsonSerializableGenerator // ************************************************************************** -_$BlogPostCreateCredentialsModelImpl - _$$BlogPostCreateCredentialsModelImplFromJson(Map json) => - _$BlogPostCreateCredentialsModelImpl( - title: json['title'] as String, - description: json['description'] as String, - youtubeUrl: json['youtube_url'] as String, - status: json['status'] as String? ?? 'active', - ); +_$BlogPostCreateCredentialsModelImpl _$$BlogPostCreateCredentialsModelImplFromJson(Map json) => _$BlogPostCreateCredentialsModelImpl( + title: json['title'] as String, + description: json['description'] as String, + youtubeUrl: json['youtube_url'] as String, + status: json['status'] as String? ?? 'active', + ); -Map _$$BlogPostCreateCredentialsModelImplToJson( - _$BlogPostCreateCredentialsModelImpl instance) => - { +Map _$$BlogPostCreateCredentialsModelImplToJson(_$BlogPostCreateCredentialsModelImpl instance) => { 'title': instance.title, 'description': instance.description, 'youtube_url': instance.youtubeUrl, diff --git a/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart b/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart index 46b21c4e..b571cef7 100644 --- a/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart +++ b/lib/presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart @@ -8,8 +8,7 @@ import 'package:equatable/equatable.dart'; class BlogPostCreateModel extends Equatable { final String blog_postID; - BlogPostCreateModel({required String blog_postID}) - : blog_postID = blog_postID; + BlogPostCreateModel({required String blog_postID}) : blog_postID = blog_postID; BlogPostCreateModel copyWith(String blog_postID) { return BlogPostCreateModel(blog_postID: blog_postID); diff --git a/lib/presentation/feed/blog_post_edit_screen/bloc/blog_post_edit_bloc.dart b/lib/presentation/feed/blog_post_edit_screen/bloc/blog_post_edit_bloc.dart index 07dc31ca..02e496fa 100644 --- a/lib/presentation/feed/blog_post_edit_screen/bloc/blog_post_edit_bloc.dart +++ b/lib/presentation/feed/blog_post_edit_screen/bloc/blog_post_edit_bloc.dart @@ -1,18 +1,17 @@ import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/feed/blog_post_edit_screen/models/blog_post_edit_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/feed/blog_post_edit_screen/models/blog_post_edit_model.dart'; -import 'package:go_router/go_router.dart'; part 'blog_post_edit_event.dart'; - part 'blog_post_edit_state.dart'; /// A bloc that manages the state of a BlogPostEdit according to the event that is dispatched to it. @@ -34,7 +33,7 @@ class BlogPostEditBloc extends Bloc { } final String? blog_postID = state.blog_postModelObj?.blog_postID; final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/feed/show/$blog_postID'), + Uri.parse(baseUrl + '/api/feed/show/$blog_postID'), headers: { 'Authorization': 'Bearer $token', }, @@ -65,8 +64,7 @@ class BlogPostEditBloc extends Bloc { } } else { // Один или несколько ключевых полей отсутствуют, обрабатываем ошибку - emit(BlogPostEditErrorState( - 'Некоторые необходимые данные отсутствуют.')); + emit(BlogPostEditErrorState('Некоторые необходимые данные отсутствуют.')); } } else { // Статус ответа не равен 200, обрабатываем ошибку @@ -78,8 +76,7 @@ class BlogPostEditBloc extends Bloc { } } - FutureOr _editBlogPost( - EditBlogPost event, Emitter emit) async { + FutureOr _editBlogPost(EditBlogPost event, Emitter emit) async { if (state is BlogPostEditLoadedState) { var currentState = state as BlogPostEditLoadedState; @@ -91,11 +88,9 @@ class BlogPostEditBloc extends Bloc { ); if (response.statusCode == 200) { - AppRouter.navigatorKey.currentContext?.goNamed('blogPostScreen', - extra: currentState.blog_post?['id'].toString()); + AppRouter.navigatorKey.currentContext?.goNamed('blogPostScreen', extra: currentState.blog_post?['id'].toString()); } else { - print( - 'Failed to edit blog post. Status Code: ${response.statusCode} ${response.body}'); + print('Failed to edit blog post. Status Code: ${response.statusCode} ${response.body}'); } } } @@ -107,7 +102,7 @@ class BlogPostEditBloc extends Bloc { String? description, ) async { int id = blog_post?['id']; - String url = '${dotenv.env['SERVER_ROOT']!}/feed/update/$id'; + String url = '${baseUrl}/api/feed/update/$id'; final Map credentials = { 'id': id, diff --git a/lib/presentation/feed/blog_post_edit_screen/bloc/blog_post_edit_state.dart b/lib/presentation/feed/blog_post_edit_screen/bloc/blog_post_edit_state.dart index cc2d5f36..d78db89d 100644 --- a/lib/presentation/feed/blog_post_edit_screen/bloc/blog_post_edit_state.dart +++ b/lib/presentation/feed/blog_post_edit_screen/bloc/blog_post_edit_state.dart @@ -36,8 +36,7 @@ class BlogPostEditLoadedState extends BlogPostEditState { TextEditingController? description; TextEditingController? youtubeURL; @override - List get props => - [blog_postModelObj, blog_post, title, description, youtubeURL]; + List get props => [blog_postModelObj, blog_post, title, description, youtubeURL]; BlogPostEditLoadedState copyWith({ BlogPostEditModel? blog_postModelObj, Map? blog_post, @@ -65,6 +64,5 @@ class BlogPostEditErrorState extends BlogPostEditState { } class BlogPostEditInitialState extends BlogPostEditState { - BlogPostEditInitialState({required BlogPostEditModel blog_postModelObj}) - : super(blog_postModelObj: blog_postModelObj); + BlogPostEditInitialState({required BlogPostEditModel blog_postModelObj}) : super(blog_postModelObj: blog_postModelObj); } diff --git a/lib/presentation/feed/blog_post_edit_screen/blog_post_edit_screen.dart b/lib/presentation/feed/blog_post_edit_screen/blog_post_edit_screen.dart index 7012a55f..ba691376 100644 --- a/lib/presentation/feed/blog_post_edit_screen/blog_post_edit_screen.dart +++ b/lib/presentation/feed/blog_post_edit_screen/blog_post_edit_screen.dart @@ -1,19 +1,17 @@ -import 'bloc/blog_post_edit_bloc.dart'; -import 'models/blog_post_edit_model.dart'; +import 'package:cached_network_image/cached_network_image.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; + +import 'bloc/blog_post_edit_bloc.dart'; +import 'models/blog_post_edit_model.dart'; class BlogPostEditScreen extends StatelessWidget { const BlogPostEditScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context, blog_postID) { return BlocProvider( - create: (context) => BlogPostEditBloc(BlogPostEditState( - blog_postModelObj: - BlogPostEditModel(blog_postID: blog_postID.toString()))) - ..add(BlogPostEditInitialEvent()), + create: (context) => + BlogPostEditBloc(BlogPostEditState(blog_postModelObj: BlogPostEditModel(blog_postID: blog_postID.toString())))..add(BlogPostEditInitialEvent()), child: BlogPostEditScreen(), ); } @@ -77,8 +75,7 @@ class BlogPostEditScreen extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + - (state.blog_post?['image'] ?? ''), + imageUrl: baseUrl + '/storage/' + (state.blog_post?['image'] ?? ''), imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 25, @@ -108,8 +105,7 @@ class BlogPostEditScreen extends StatelessWidget { SizedBox(height: 16.0), // Здесь нужно добавить виджет для загрузки картинки ElevatedButton( - onPressed: () => - context.read().add(EditBlogPost()), + onPressed: () => context.read().add(EditBlogPost()), child: Text('Сохранить'), ), ], diff --git a/lib/presentation/feed/blog_post_screen/models/blog_post_model.dart b/lib/presentation/feed/blog_post_screen/models/blog_post_model.dart index 67cbe661..73e9c6ab 100644 --- a/lib/presentation/feed/blog_post_screen/models/blog_post_model.dart +++ b/lib/presentation/feed/blog_post_screen/models/blog_post_model.dart @@ -1,7 +1,7 @@ // ignore_for_file: must_be_immutable -import 'package:equatable/equatable.dart'; import 'package:eatvio_app/presentation/feed/blog_post_screen/models/comment_model.dart'; +import 'package:equatable/equatable.dart'; class BlogPostModel extends Equatable { final String blog_postID; diff --git a/lib/presentation/feed/blog_post_screen/models/comment_model.dart b/lib/presentation/feed/blog_post_screen/models/comment_model.dart index feecc7c9..2b9c7133 100644 --- a/lib/presentation/feed/blog_post_screen/models/comment_model.dart +++ b/lib/presentation/feed/blog_post_screen/models/comment_model.dart @@ -4,12 +4,13 @@ import 'package:eatvio_app/core/app_export.dart'; // ignore_for_file: must_be_immutable class CommentModel { - CommentModel( - {this.userImage, - this.username, - this.dateText, - this.greetingText, - required this.id,}) { + CommentModel({ + this.userImage, + this.username, + this.dateText, + this.greetingText, + required this.id, + }) { userImage = userImage ?? ImageConstant.imageNotFound; username = username; dateText = dateText; diff --git a/lib/presentation/feed/blog_post_screen/widgets/comment_widget.dart b/lib/presentation/feed/blog_post_screen/widgets/comment_widget.dart index ab177fa1..ed2e075c 100644 --- a/lib/presentation/feed/blog_post_screen/widgets/comment_widget.dart +++ b/lib/presentation/feed/blog_post_screen/widgets/comment_widget.dart @@ -1,10 +1,9 @@ // ignore_for_file: must_be_immutable -import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:cached_network_image/cached_network_image.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/presentation/feed/blog_post_screen/models/comment_model.dart'; -import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; class CommentWidget extends StatelessWidget { CommentWidget(this.commentModelObj, {Key? key}) @@ -36,13 +35,11 @@ class CommentWidget extends StatelessWidget { ], ), child: Row( - mainAxisAlignment: MainAxisAlignment - .spaceBetween, // Move the main axis alignment to space between - crossAxisAlignment: - CrossAxisAlignment.center, // Center the items vertically + mainAxisAlignment: MainAxisAlignment.spaceBetween, // Move the main axis alignment to space between + crossAxisAlignment: CrossAxisAlignment.center, // Center the items vertically children: [ CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + commentModelObj.userImage!, + imageUrl: baseUrl + '/storage/' + commentModelObj.userImage!, imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 25, @@ -69,10 +66,7 @@ class CommentWidget extends StatelessWidget { child: Row( children: [ Text( - commentModelObj.username!.length <= 15 - ? commentModelObj.username! - : commentModelObj.username!.substring(0, 15) + - '...', + commentModelObj.username!.length <= 15 ? commentModelObj.username! : commentModelObj.username!.substring(0, 15) + '...', style: theme.textTheme.titleMedium, ), Spacer(), @@ -96,10 +90,11 @@ class CommentWidget extends StatelessWidget { ), ), CustomImageView( - imagePath: ImageConstant.imgSend, - height: 30.v, - width: 30.h, - margin: EdgeInsets.only(left: 5),), + imagePath: ImageConstant.imgSend, + height: 30.v, + width: 30.h, + margin: EdgeInsets.only(left: 5), + ), ], ), ); diff --git a/lib/presentation/feed/feed_screen/widgets/feed_scroll_item.dart b/lib/presentation/feed/feed_screen/widgets/feed_scroll_item.dart index 2c407394..bc3b1613 100644 --- a/lib/presentation/feed/feed_screen/widgets/feed_scroll_item.dart +++ b/lib/presentation/feed/feed_screen/widgets/feed_scroll_item.dart @@ -1,5 +1,5 @@ -import 'package:flutter/material.dart'; import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; class ScrollItem extends StatelessWidget { final String title; diff --git a/lib/presentation/feed/feed_screen/widgets/feed_search_view.dart b/lib/presentation/feed/feed_screen/widgets/feed_search_view.dart index cef2304e..bbfff40f 100644 --- a/lib/presentation/feed/feed_screen/widgets/feed_search_view.dart +++ b/lib/presentation/feed/feed_screen/widgets/feed_search_view.dart @@ -1,31 +1,31 @@ -import 'package:flutter/material.dart'; import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; class CustomSearchView extends StatelessWidget { - CustomSearchView( - {Key? key, - this.alignment, - this.width, - this.scrollPadding, - this.controller, - this.focusNode, - this.autofocus = false, - this.textStyle, - this.textInputType = TextInputType.text, - this.maxLines, - this.hintText, - this.hintStyle, - this.prefix, - this.prefixConstraints, - this.suffix, - this.suffixConstraints, - this.contentPadding, - this.borderDecoration, - this.fillColor, - this.filled = true, - this.validator, - this.onChanged,}) - : super( + CustomSearchView({ + Key? key, + this.alignment, + this.width, + this.scrollPadding, + this.controller, + this.focusNode, + this.autofocus = false, + this.textStyle, + this.textInputType = TextInputType.text, + this.maxLines, + this.hintText, + this.hintStyle, + this.prefix, + this.prefixConstraints, + this.suffix, + this.suffixConstraints, + this.contentPadding, + this.borderDecoration, + this.fillColor, + this.filled = true, + this.validator, + this.onChanged, + }) : super( key: key, ); @@ -76,15 +76,15 @@ class CustomSearchView extends StatelessWidget { return alignment != null ? Align( alignment: alignment ?? Alignment.center, - child: searchViewWidget(context),) + child: searchViewWidget(context), + ) : searchViewWidget(context); } searchViewWidget(BuildContext context) => SizedBox( width: width ?? double.maxFinite, child: TextFormField( - scrollPadding: - EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + scrollPadding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), controller: controller, focusNode: focusNode, onTapOutside: (event) => onTapOutside(), @@ -112,8 +112,9 @@ class CustomSearchView extends StatelessWidget { prefixIcon: prefix ?? SizedBox( child: Padding( - padding: EdgeInsets.only(left: 10), - child: Icon(Icons.search),), + padding: EdgeInsets.only(left: 10), + child: Icon(Icons.search), + ), ), prefixIconConstraints: prefixConstraints ?? BoxConstraints( diff --git a/lib/presentation/glossary/glossary_screen/bloc/glossary_screen_bloc.dart b/lib/presentation/glossary/glossary_screen/bloc/glossary_screen_bloc.dart index f78c3ffb..45b6bcd6 100644 --- a/lib/presentation/glossary/glossary_screen/bloc/glossary_screen_bloc.dart +++ b/lib/presentation/glossary/glossary_screen/bloc/glossary_screen_bloc.dart @@ -1,15 +1,16 @@ import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/glossary/glossary_screen/models/glossary_screen_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/glossary/glossary_screen/models/glossary_screen_model.dart'; -import 'package:go_router/go_router.dart'; + part 'glossary_screen_event.dart'; part 'glossary_screen_state.dart'; @@ -31,7 +32,7 @@ class GlossaryBloc extends Bloc { AppRouter.navigatorKey.currentContext?.goNamed('authScreen'); } final responseProductGroups = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/glossary/getProductGroups'), + Uri.parse(baseUrl + '/api/glossary/getProductGroups'), headers: { 'Authorization': 'Bearer $token', }, @@ -41,18 +42,23 @@ class GlossaryBloc extends Bloc { if (dataProductGroups is List) { if (state is GlossaryLoadedState) { var currentState = state as GlossaryLoadedState; - emit(currentState.copyWith( + emit( + currentState.copyWith( glossaryModelObj: currentState.glossaryModelObj, token: currentState.token, productGroups: currentState.productGroups, - productList: currentState.productList,),); + productList: currentState.productList, + ), + ); } else { - List productGroupsModel = - _fillProductGroups(dataProductGroups); - emit(GlossaryLoadedState( + List productGroupsModel = _fillProductGroups(dataProductGroups); + emit( + GlossaryLoadedState( token: token, productGroups: productGroupsModel, - productList: [],),); + productList: [], + ), + ); await _getProductListById(token, emit, productGroupsModel[0].id); } } else { @@ -61,8 +67,11 @@ class GlossaryBloc extends Bloc { } } else { // Статус ответа не равен 200, обрабатываем ошибку - emit(GlossaryErrorState( - 'Ошибка сервера: ${responseProductGroups.statusCode}',),); + emit( + GlossaryErrorState( + 'Ошибка сервера: ${responseProductGroups.statusCode}', + ), + ); } } catch (e) { // Ошибка при декодировании JSON или другая ошибка выполнения @@ -71,7 +80,9 @@ class GlossaryBloc extends Bloc { } void _changeProductGroup( - ChangeProductGroup event, Emitter emit,) async { + ChangeProductGroup event, + Emitter emit, + ) async { if (state is GlossaryLoadedState) { var currentState = state as GlossaryLoadedState; await _getProductListById(currentState.token, emit, event.id); @@ -79,9 +90,12 @@ class GlossaryBloc extends Bloc { } Future _getProductListById( - token, Emitter emit, int? productGroupID,) async { + token, + Emitter emit, + int? productGroupID, + ) async { final responseProductList = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/glossary/index/$productGroupID'), + Uri.parse(baseUrl + '/api/glossary/index/$productGroupID'), headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer $token', @@ -90,10 +104,13 @@ class GlossaryBloc extends Bloc { final dataProductList = jsonDecode(responseProductList.body); if (dataProductList is List) { var currentState = state as GlossaryLoadedState; - emit(currentState.copyWith( + emit( + currentState.copyWith( glossaryModelObj: currentState.glossaryModelObj, productGroups: currentState.productGroups, - productList: dataProductList,),); + productList: dataProductList, + ), + ); } else { emit(GlossaryErrorState('Список продуктов некорректного формата')); } diff --git a/lib/presentation/glossary/glossary_screen/bloc/glossary_screen_state.dart b/lib/presentation/glossary/glossary_screen/bloc/glossary_screen_state.dart index a6f8cf52..42119a8c 100644 --- a/lib/presentation/glossary/glossary_screen/bloc/glossary_screen_state.dart +++ b/lib/presentation/glossary/glossary_screen/bloc/glossary_screen_state.dart @@ -22,24 +22,25 @@ class GlossaryState extends Equatable { } class GlossaryLoadedState extends GlossaryState { - GlossaryLoadedState( - {this.glossaryModelObj, - this.productGroups, - this.productList, - this.token,}); + GlossaryLoadedState({ + this.glossaryModelObj, + this.productGroups, + this.productList, + this.token, + }); GlossaryModel? glossaryModelObj; String? token; List? productGroups; List? productList; @override - List get props => - [glossaryModelObj, productGroups, productList, token]; - GlossaryLoadedState copyWith( - {GlossaryModel? glossaryModelObj, - String? token, - List? productGroups, - List? productList,}) { + List get props => [glossaryModelObj, productGroups, productList, token]; + GlossaryLoadedState copyWith({ + GlossaryModel? glossaryModelObj, + String? token, + List? productGroups, + List? productList, + }) { return GlossaryLoadedState( glossaryModelObj: glossaryModelObj ?? this.glossaryModelObj, productGroups: productGroups ?? this.productGroups, @@ -59,6 +60,5 @@ class GlossaryErrorState extends GlossaryState { } class GlossaryInitialState extends GlossaryState { - GlossaryInitialState({required GlossaryModel glossaryModelObj}) - : super(glossaryModelObj: glossaryModelObj); + GlossaryInitialState({required GlossaryModel glossaryModelObj}) : super(glossaryModelObj: glossaryModelObj); } diff --git a/lib/presentation/glossary/glossary_screen/glossary_screen.dart b/lib/presentation/glossary/glossary_screen/glossary_screen.dart index 35caec2d..e8453187 100644 --- a/lib/presentation/glossary/glossary_screen/glossary_screen.dart +++ b/lib/presentation/glossary/glossary_screen/glossary_screen.dart @@ -1,20 +1,22 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/presentation/glossary/glossary_screen/widgets/glossary_scroll_item.dart'; +import 'package:eatvio_app/presentation/glossary/glossary_screen/widgets/glossary_search_widget.dart'; +import 'package:eatvio_app/widgets/custom_drop_down.dart'; +import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:flutter/material.dart'; + import 'bloc/glossary_screen_bloc.dart'; import 'models/glossary_screen_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; -import 'package:eatvio_app/widgets/custom_drop_down.dart'; -import 'package:eatvio_app/presentation/glossary/glossary_screen/widgets/glossary_search_widget.dart'; -import 'package:eatvio_app/presentation/glossary/glossary_screen/widgets/glossary_scroll_item.dart'; class GlossaryScreen extends StatelessWidget { const GlossaryScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { return BlocProvider( - create: (context) => GlossaryBloc(GlossaryState(glossaryModelObj: GlossaryModel()))..add(GlossaryInitialEvent()), child: GlossaryScreen(),); + create: (context) => GlossaryBloc(GlossaryState(glossaryModelObj: GlossaryModel()))..add(GlossaryInitialEvent()), + child: GlossaryScreen(), + ); } Widget build(BuildContext context) { @@ -125,24 +127,26 @@ class GlossaryScreen extends StatelessWidget { ), ], ), - child: Column(children: [ - Align( - alignment: Alignment.centerLeft, - child: Text( - "Поиск по алфавиту", - style: CustomTextStyles.titleMediumSemiBold, + child: Column( + children: [ + Align( + alignment: Alignment.centerLeft, + child: Text( + "Поиск по алфавиту", + style: CustomTextStyles.titleMediumSemiBold, + ), ), - ), - SizedBox( - height: 8, - ), - SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: List.generate(33, _fillAlphabet), + SizedBox( + height: 8, ), - ), - ],), + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: List.generate(33, _fillAlphabet), + ), + ), + ], + ), ); } @@ -162,42 +166,44 @@ class GlossaryScreen extends StatelessWidget { ), ], ), - child: Column(children: [ - Align( - alignment: Alignment.centerLeft, - child: Text( - "Группа продуктов", - style: CustomTextStyles.titleMediumSemiBold, + child: Column( + children: [ + Align( + alignment: Alignment.centerLeft, + child: Text( + "Группа продуктов", + style: CustomTextStyles.titleMediumSemiBold, + ), ), - ), - SizedBox( - height: 8, - ), - CustomDropDown( - items: state.productGroups, - value: state.productGroups?[0], - fillColor: Colors.grey[200]!, - hintText: 'Выберите категорию', - borderDecoration: OutlineInputBorder( - borderRadius: const BorderRadius.all(Radius.circular(8)), - borderSide: BorderSide(color: Colors.grey[200]!, width: 1), + SizedBox( + height: 8, ), - contentPadding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 9, + CustomDropDown( + items: state.productGroups, + value: state.productGroups?[0], + fillColor: Colors.grey[200]!, + hintText: 'Выберите категорию', + borderDecoration: OutlineInputBorder( + borderRadius: const BorderRadius.all(Radius.circular(8)), + borderSide: BorderSide(color: Colors.grey[200]!, width: 1), + ), + contentPadding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 9, + ), + onChanged: _changeProductGroup(context, state), + width: MediaQuery.of(context).size.width, // Set a percentage value as per your layout ), - onChanged: _changeProductGroup(context, state), - width: MediaQuery.of(context).size.width, // Set a percentage value as per your layout - ), - SizedBox( - height: 8, - ), - Align(alignment: Alignment.centerLeft, child: Text("*КБЖУ указано за 100гр")), - SizedBox( - height: 8, - ), - _buildProductList(context, state), - ],), + SizedBox( + height: 8, + ), + Align(alignment: Alignment.centerLeft, child: Text("*КБЖУ указано за 100гр")), + SizedBox( + height: 8, + ), + _buildProductList(context, state), + ], + ), ); } @@ -218,23 +224,24 @@ class GlossaryScreen extends StatelessWidget { _buildProductEntry(product, BuildContext context) { return Container( - margin: EdgeInsets.only(bottom: 10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 1, - blurRadius: 3, - offset: Offset(0, 3), - ), - ], - ), - child: Column(children: [ + margin: EdgeInsets.only(bottom: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.all(Radius.circular(12)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 1, + blurRadius: 3, + offset: Offset(0, 3), + ), + ], + ), + child: Column( + children: [ ListTile( trailing: CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (product['image'] ?? ''), + imageUrl: baseUrl + '/storage/' + (product['image'] ?? ''), imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 25, @@ -255,26 +262,34 @@ class GlossaryScreen extends StatelessWidget { padding: const EdgeInsets.all(16.0), child: Column( children: [ - Row(children: [ - Column(children: [ - Text("Ккал - ${product['energy_on_100gr'].toString()}"), - SizedBox(height: 8), - Text("Белки - ${product['proteins_on_100gr'].toString()}"), - ],), - Spacer(), - Padding( - padding: const EdgeInsets.only(right: 24.0), - child: Column(children: [ - Text("Жиры - ${product['fats_on_100gr'].toString()}"), - SizedBox(height: 8), - Text("Углеводы - ${product['carbohydrates_on_100gr'].toString()}"), - ],), - ), - ],), + Row( + children: [ + Column( + children: [ + Text("Ккал - ${product['energy_on_100gr'].toString()}"), + SizedBox(height: 8), + Text("Белки - ${product['proteins_on_100gr'].toString()}"), + ], + ), + Spacer(), + Padding( + padding: const EdgeInsets.only(right: 24.0), + child: Column( + children: [ + Text("Жиры - ${product['fats_on_100gr'].toString()}"), + SizedBox(height: 8), + Text("Углеводы - ${product['carbohydrates_on_100gr'].toString()}"), + ], + ), + ), + ], + ), ], ), ), - ],),); + ], + ), + ); } Widget _fillAlphabet(int index) { diff --git a/lib/presentation/glossary/glossary_screen/widgets/glossary_scroll_item.dart b/lib/presentation/glossary/glossary_screen/widgets/glossary_scroll_item.dart index 2c407394..bc3b1613 100644 --- a/lib/presentation/glossary/glossary_screen/widgets/glossary_scroll_item.dart +++ b/lib/presentation/glossary/glossary_screen/widgets/glossary_scroll_item.dart @@ -1,5 +1,5 @@ -import 'package:flutter/material.dart'; import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; class ScrollItem extends StatelessWidget { final String title; diff --git a/lib/presentation/glossary/glossary_screen/widgets/glossary_search_widget.dart b/lib/presentation/glossary/glossary_screen/widgets/glossary_search_widget.dart index cef2304e..bbfff40f 100644 --- a/lib/presentation/glossary/glossary_screen/widgets/glossary_search_widget.dart +++ b/lib/presentation/glossary/glossary_screen/widgets/glossary_search_widget.dart @@ -1,31 +1,31 @@ -import 'package:flutter/material.dart'; import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; class CustomSearchView extends StatelessWidget { - CustomSearchView( - {Key? key, - this.alignment, - this.width, - this.scrollPadding, - this.controller, - this.focusNode, - this.autofocus = false, - this.textStyle, - this.textInputType = TextInputType.text, - this.maxLines, - this.hintText, - this.hintStyle, - this.prefix, - this.prefixConstraints, - this.suffix, - this.suffixConstraints, - this.contentPadding, - this.borderDecoration, - this.fillColor, - this.filled = true, - this.validator, - this.onChanged,}) - : super( + CustomSearchView({ + Key? key, + this.alignment, + this.width, + this.scrollPadding, + this.controller, + this.focusNode, + this.autofocus = false, + this.textStyle, + this.textInputType = TextInputType.text, + this.maxLines, + this.hintText, + this.hintStyle, + this.prefix, + this.prefixConstraints, + this.suffix, + this.suffixConstraints, + this.contentPadding, + this.borderDecoration, + this.fillColor, + this.filled = true, + this.validator, + this.onChanged, + }) : super( key: key, ); @@ -76,15 +76,15 @@ class CustomSearchView extends StatelessWidget { return alignment != null ? Align( alignment: alignment ?? Alignment.center, - child: searchViewWidget(context),) + child: searchViewWidget(context), + ) : searchViewWidget(context); } searchViewWidget(BuildContext context) => SizedBox( width: width ?? double.maxFinite, child: TextFormField( - scrollPadding: - EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + scrollPadding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), controller: controller, focusNode: focusNode, onTapOutside: (event) => onTapOutside(), @@ -112,8 +112,9 @@ class CustomSearchView extends StatelessWidget { prefixIcon: prefix ?? SizedBox( child: Padding( - padding: EdgeInsets.only(left: 10), - child: Icon(Icons.search),), + padding: EdgeInsets.only(left: 10), + child: Icon(Icons.search), + ), ), prefixIconConstraints: prefixConstraints ?? BoxConstraints( diff --git a/lib/presentation/plans/plan_create_screen/bloc/plan_create_bloc.dart b/lib/presentation/plans/plan_create_screen/bloc/plan_create_bloc.dart index fd30edd0..3cab0f65 100644 --- a/lib/presentation/plans/plan_create_screen/bloc/plan_create_bloc.dart +++ b/lib/presentation/plans/plan_create_screen/bloc/plan_create_bloc.dart @@ -1,15 +1,16 @@ import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/plans/plan_create_screen/models/plan_create_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/plans/plan_create_screen/models/plan_create_model.dart'; -import 'package:go_router/go_router.dart'; + part 'plan_create_event.dart'; part 'plan_create_state.dart'; @@ -31,21 +32,27 @@ class PlanCreateBloc extends Bloc { } if (state is PlanCreateLoadedState) { var currentState = state as PlanCreateLoadedState; - emit(currentState.copyWith( - planModelObj: currentState.planModelObj, - name: currentState.name, - details: currentState.details, - ),); + emit( + currentState.copyWith( + planModelObj: currentState.planModelObj, + name: currentState.name, + details: currentState.details, + ), + ); } else { - emit(PlanCreateLoadedState( - name: TextEditingController(), - details: TextEditingController(), - ),); + emit( + PlanCreateLoadedState( + name: TextEditingController(), + details: TextEditingController(), + ), + ); } } FutureOr _createPlan( - CreatePlan event, Emitter emit,) async { + CreatePlan event, + Emitter emit, + ) async { if (state is PlanCreateLoadedState) { var currentState = state as PlanCreateLoadedState; @@ -58,7 +65,8 @@ class PlanCreateBloc extends Bloc { AppRouter.navigatorKey.currentContext?.goNamed('planSelectScreen'); } else { print( - 'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}',); + 'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}', + ); } } } @@ -67,7 +75,7 @@ class PlanCreateBloc extends Bloc { String? name, String? details, ) async { - String url = '${dotenv.env['SERVER_ROOT']!}/plans/create'; + String url = '${baseUrl}/api/plans/create'; final Map credentials = { 'name': name, diff --git a/lib/presentation/plans/plan_create_screen/bloc/plan_create_state.dart b/lib/presentation/plans/plan_create_screen/bloc/plan_create_state.dart index 93e4aaf2..4e98812c 100644 --- a/lib/presentation/plans/plan_create_screen/bloc/plan_create_state.dart +++ b/lib/presentation/plans/plan_create_screen/bloc/plan_create_state.dart @@ -60,6 +60,5 @@ class PlanCreateErrorState extends PlanCreateState { } class PlanCreateInitialState extends PlanCreateState { - PlanCreateInitialState({required PlanCreateModel planModelObj}) - : super(planModelObj: planModelObj); + PlanCreateInitialState({required PlanCreateModel planModelObj}) : super(planModelObj: planModelObj); } diff --git a/lib/presentation/plans/plan_create_screen/plan_create_screen.dart b/lib/presentation/plans/plan_create_screen/plan_create_screen.dart index 81262591..165be86b 100644 --- a/lib/presentation/plans/plan_create_screen/plan_create_screen.dart +++ b/lib/presentation/plans/plan_create_screen/plan_create_screen.dart @@ -1,16 +1,18 @@ -import 'bloc/plan_create_bloc.dart'; -import 'models/plan_create_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; +import 'bloc/plan_create_bloc.dart'; +import 'models/plan_create_model.dart'; + class PlanCreateScreen extends StatelessWidget { const PlanCreateScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { final planID = ModalRoute.of(context)!.settings.arguments; return BlocProvider( - create: (context) => PlanCreateBloc(PlanCreateState(planModelObj: PlanCreateModel(planID: planID.toString())))..add(PlanCreateInitialEvent()), - child: PlanCreateScreen(),); + create: (context) => PlanCreateBloc(PlanCreateState(planModelObj: PlanCreateModel(planID: planID.toString())))..add(PlanCreateInitialEvent()), + child: PlanCreateScreen(), + ); } Widget build(BuildContext context) { @@ -65,24 +67,27 @@ class PlanCreateScreen extends StatelessWidget { ), ], ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 16.0), - TextFormField( - controller: state.name, - decoration: InputDecoration(labelText: 'Заголовок'), - ), - SizedBox(height: 16.0), - TextFormField( - controller: state.details, - decoration: InputDecoration(labelText: 'Описание'), - ), - SizedBox(height: 16.0), - // Здесь нужно добавить виджет для загрузки картинки - ElevatedButton( - onPressed: () => context.read().add(CreatePlan()), - child: Text('Создать'), - ), - ],), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 16.0), + TextFormField( + controller: state.name, + decoration: InputDecoration(labelText: 'Заголовок'), + ), + SizedBox(height: 16.0), + TextFormField( + controller: state.details, + decoration: InputDecoration(labelText: 'Описание'), + ), + SizedBox(height: 16.0), + // Здесь нужно добавить виджет для загрузки картинки + ElevatedButton( + onPressed: () => context.read().add(CreatePlan()), + child: Text('Создать'), + ), + ], + ), ), ], ), diff --git a/lib/presentation/plans/plan_edit_screen/bloc/plan_edit_bloc.dart b/lib/presentation/plans/plan_edit_screen/bloc/plan_edit_bloc.dart index e150c8bc..5987b6bd 100644 --- a/lib/presentation/plans/plan_edit_screen/bloc/plan_edit_bloc.dart +++ b/lib/presentation/plans/plan_edit_screen/bloc/plan_edit_bloc.dart @@ -1,18 +1,17 @@ import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/plans/plan_edit_screen/models/plan_edit_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/plans/plan_edit_screen/models/plan_edit_model.dart'; -import 'package:go_router/go_router.dart'; part 'plan_edit_event.dart'; - part 'plan_edit_state.dart'; /// A bloc that manages the state of a PlanEdit according to the event that is dispatched to it. @@ -34,7 +33,7 @@ class PlanEditBloc extends Bloc { } final String? planID = state.planModelObj?.planID; final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/plans/show/$planID'), + Uri.parse(baseUrl + '/api/plans/show/$planID'), headers: { 'Authorization': 'Bearer $token', }, @@ -44,18 +43,24 @@ class PlanEditBloc extends Bloc { if (data is Map) { if (state is PlanEditLoadedState) { var currentState = state as PlanEditLoadedState; - emit(currentState.copyWith( + emit( + currentState.copyWith( planModelObj: currentState.planModelObj, plan: currentState.plan, name: currentState.name, duration: currentState.duration, - details: currentState.details,),); + details: currentState.details, + ), + ); } else { - emit(PlanEditLoadedState( + emit( + PlanEditLoadedState( plan: data, name: TextEditingController(text: data['name']), details: TextEditingController(text: data['details']), - duration: TextEditingController(text: data['duration'].toString()),),); + duration: TextEditingController(text: data['duration'].toString()), + ), + ); } } else { // Один или несколько ключевых полей отсутствуют, обрабатываем ошибку @@ -96,7 +101,7 @@ class PlanEditBloc extends Bloc { String? duration, ) async { int id = plan?['id']; - String url = '${dotenv.env['SERVER_ROOT']!}/plans/update/$id'; + String url = '${baseUrl}/api/plans/update/$id'; final Map credentials = { 'id': id, diff --git a/lib/presentation/plans/plan_edit_screen/bloc/plan_edit_state.dart b/lib/presentation/plans/plan_edit_screen/bloc/plan_edit_state.dart index 66769622..e3cf6b85 100644 --- a/lib/presentation/plans/plan_edit_screen/bloc/plan_edit_state.dart +++ b/lib/presentation/plans/plan_edit_screen/bloc/plan_edit_state.dart @@ -22,8 +22,13 @@ class PlanEditState extends Equatable { } class PlanEditLoadedState extends PlanEditState { - PlanEditLoadedState( - {this.planModelObj, this.plan, this.name, this.details, this.duration,}); + PlanEditLoadedState({ + this.planModelObj, + this.plan, + this.name, + this.details, + this.duration, + }); PlanEditModel? planModelObj; Map? plan; @@ -59,6 +64,5 @@ class PlanEditErrorState extends PlanEditState { } class PlanEditInitialState extends PlanEditState { - PlanEditInitialState({required PlanEditModel planModelObj}) - : super(planModelObj: planModelObj); + PlanEditInitialState({required PlanEditModel planModelObj}) : super(planModelObj: planModelObj); } diff --git a/lib/presentation/plans/plan_edit_screen/plan_edit_screen.dart b/lib/presentation/plans/plan_edit_screen/plan_edit_screen.dart index abea8b9a..c7005746 100644 --- a/lib/presentation/plans/plan_edit_screen/plan_edit_screen.dart +++ b/lib/presentation/plans/plan_edit_screen/plan_edit_screen.dart @@ -1,9 +1,9 @@ -import 'bloc/plan_edit_bloc.dart'; -import 'models/plan_edit_model.dart'; +import 'package:cached_network_image/cached_network_image.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; + +import 'bloc/plan_edit_bloc.dart'; +import 'models/plan_edit_model.dart'; class PlanEditScreen extends StatelessWidget { const PlanEditScreen({Key? key}) : super(key: key); @@ -11,8 +11,9 @@ class PlanEditScreen extends StatelessWidget { static Widget builder(BuildContext context) { final planID = ModalRoute.of(context)!.settings.arguments; return BlocProvider( - create: (context) => PlanEditBloc(PlanEditState(planModelObj: PlanEditModel(planID: planID.toString())))..add(PlanEditInitialEvent()), - child: PlanEditScreen(),); + create: (context) => PlanEditBloc(PlanEditState(planModelObj: PlanEditModel(planID: planID.toString())))..add(PlanEditInitialEvent()), + child: PlanEditScreen(), + ); } Widget build(BuildContext context) { @@ -71,7 +72,7 @@ class PlanEditScreen extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (state.plan?['image'] ?? ''), + imageUrl: baseUrl + '/storage/' + (state.plan?['image'] ?? ''), imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 25, diff --git a/lib/presentation/plans/plan_select_screen/bloc/plan_select_bloc.dart b/lib/presentation/plans/plan_select_screen/bloc/plan_select_bloc.dart index e65409f1..dcf60700 100644 --- a/lib/presentation/plans/plan_select_screen/bloc/plan_select_bloc.dart +++ b/lib/presentation/plans/plan_select_screen/bloc/plan_select_bloc.dart @@ -1,17 +1,17 @@ //import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart'; import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/plans/plan_select_screen/models/plan_select_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/plans/plan_select_screen/models/plan_select_model.dart'; -import 'package:http/http.dart' as http; -import 'dart:convert'; -import 'package:hive/hive.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:image_picker/image_picker.dart'; import 'package:go_router/go_router.dart'; +import 'package:hive/hive.dart'; +import 'package:http/http.dart' as http; +import 'package:image_picker/image_picker.dart'; + +import '/core/app_export.dart'; part 'plan_select_event.dart'; part 'plan_select_state.dart'; @@ -33,7 +33,7 @@ class PlanSelectBloc extends Bloc { AppRouter.navigatorKey.currentContext?.goNamed('authScreen'); } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/plans/index'), + Uri.parse(baseUrl + '/api/plans/index'), ); print('Got response'); if (response.statusCode == 200) { @@ -44,15 +44,19 @@ class PlanSelectBloc extends Bloc { if (state is PlanSelectLoadedState) { print('Got loaded'); var currentState = state as PlanSelectLoadedState; - emit((currentState).copyWith( - posts: data, - myProfileModelObj: currentState.myProfileModelObj, - ),); + emit( + (currentState).copyWith( + posts: data, + myProfileModelObj: currentState.myProfileModelObj, + ), + ); } else { print('Got unloaded'); - emit(PlanSelectLoadedState( - posts: data, - ),); + emit( + PlanSelectLoadedState( + posts: data, + ), + ); } } else { // Один или несколько ключевых полей отсутствуют, обрабатываем ошибку diff --git a/lib/presentation/plans/plan_select_screen/bloc/plan_select_state.dart b/lib/presentation/plans/plan_select_screen/bloc/plan_select_state.dart index 5ab68c28..2c8561b0 100644 --- a/lib/presentation/plans/plan_select_screen/bloc/plan_select_state.dart +++ b/lib/presentation/plans/plan_select_screen/bloc/plan_select_state.dart @@ -12,14 +12,12 @@ class PlanSelectState extends Equatable { } class PlanSelectInitialState extends PlanSelectState { - PlanSelectInitialState({required PlanSelectModel myProfileModelObj}) - : super(myProfileModelObj: myProfileModelObj); + PlanSelectInitialState({required PlanSelectModel myProfileModelObj}) : super(myProfileModelObj: myProfileModelObj); } /// Represents the state of PlanSelect in the application. class PlanSelectLoadedState extends PlanSelectState { - PlanSelectLoadedState({this.myProfileModelObj, this.posts}) - : super(myProfileModelObj: null); + PlanSelectLoadedState({this.myProfileModelObj, this.posts}) : super(myProfileModelObj: null); PlanSelectModel? myProfileModelObj; List? posts; diff --git a/lib/presentation/plans/plan_select_screen/plan_select_screen.dart b/lib/presentation/plans/plan_select_screen/plan_select_screen.dart index 022e4e2e..1508c75e 100644 --- a/lib/presentation/plans/plan_select_screen/plan_select_screen.dart +++ b/lib/presentation/plans/plan_select_screen/plan_select_screen.dart @@ -1,19 +1,20 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; +import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'bloc/plan_select_bloc.dart'; import 'models/plan_select_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:flutter/material.dart'; class PlanSelectScreen extends StatelessWidget { static Widget builder(BuildContext context) { return BlocProvider( - create: (context) => PlanSelectBloc(PlanSelectState(myProfileModelObj: PlanSelectModel()))..add(PlanSelectInitialEvent()), child: PlanSelectScreen(),); + create: (context) => PlanSelectBloc(PlanSelectState(myProfileModelObj: PlanSelectModel()))..add(PlanSelectInitialEvent()), + child: PlanSelectScreen(), + ); } Widget build(BuildContext context) { @@ -133,7 +134,7 @@ class PlanSelectScreen extends StatelessWidget { ), child: ListTile( leading: CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + post['image'], + imageUrl: baseUrl + '/storage/' + post['image'], imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 25, diff --git a/lib/presentation/plans/plan_show_screen/bloc/plan_show_bloc.dart b/lib/presentation/plans/plan_show_screen/bloc/plan_show_bloc.dart index e920db89..ad9a7a43 100644 --- a/lib/presentation/plans/plan_show_screen/bloc/plan_show_bloc.dart +++ b/lib/presentation/plans/plan_show_screen/bloc/plan_show_bloc.dart @@ -1,18 +1,17 @@ import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/plans/plan_show_screen/models/plan_show_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/plans/plan_show_screen/models/plan_show_model.dart'; -import 'package:go_router/go_router.dart'; part 'plan_show_event.dart'; - part 'plan_show_state.dart'; /// A bloc that manages the state of a Plan according to the event that is dispatched to it. @@ -34,7 +33,7 @@ class PlanBloc extends Bloc { } final String? planID = state.planModelObj?.planID; final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/plans/show/$planID'), + Uri.parse(baseUrl + '/api/plans/show/$planID'), headers: { 'Authorization': 'Bearer $token', }, @@ -70,7 +69,7 @@ class PlanBloc extends Bloc { } final int id = event.id; final response = await http.post( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/plans/delete/$id'), + Uri.parse(baseUrl + '/api/plans/delete/$id'), headers: { 'Authorization': 'Bearer $token', }, diff --git a/lib/presentation/plans/plan_show_screen/bloc/plan_show_state.dart b/lib/presentation/plans/plan_show_screen/bloc/plan_show_state.dart index cefb6cf6..50527102 100644 --- a/lib/presentation/plans/plan_show_screen/bloc/plan_show_state.dart +++ b/lib/presentation/plans/plan_show_screen/bloc/plan_show_state.dart @@ -28,8 +28,7 @@ class PlanLoadedState extends PlanState { Map? plan; @override List get props => [planModelObj, plan]; - PlanLoadedState copyWith( - {PlanModel? planModelObj, Map? plan}) { + PlanLoadedState copyWith({PlanModel? planModelObj, Map? plan}) { return PlanLoadedState( planModelObj: planModelObj ?? this.planModelObj, plan: plan ?? this.plan, @@ -47,6 +46,5 @@ class PlanErrorState extends PlanState { } class PlanInitialState extends PlanState { - PlanInitialState({required PlanModel planModelObj}) - : super(planModelObj: planModelObj); + PlanInitialState({required PlanModel planModelObj}) : super(planModelObj: planModelObj); } diff --git a/lib/presentation/plans/plan_show_screen/plan_show_screen.dart b/lib/presentation/plans/plan_show_screen/plan_show_screen.dart index 98cefd46..bf618680 100644 --- a/lib/presentation/plans/plan_show_screen/plan_show_screen.dart +++ b/lib/presentation/plans/plan_show_screen/plan_show_screen.dart @@ -1,12 +1,10 @@ - +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'bloc/plan_show_bloc.dart'; import 'models/plan_show_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; class PlanScreen extends StatelessWidget { const PlanScreen({Key? key}) : super(key: key); @@ -14,7 +12,9 @@ class PlanScreen extends StatelessWidget { static Widget builder(BuildContext context) { final planID = ModalRoute.of(context)!.settings.arguments; return BlocProvider( - create: (context) => PlanBloc(PlanState(planModelObj: PlanModel(planID: planID.toString())))..add(PlanInitialEvent()), child: PlanScreen(),); + create: (context) => PlanBloc(PlanState(planModelObj: PlanModel(planID: planID.toString())))..add(PlanInitialEvent()), + child: PlanScreen(), + ); } Widget build(BuildContext context) { @@ -69,43 +69,46 @@ class PlanScreen extends StatelessWidget { ), ], ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (state.plan?['image'] ?? ''), - imageBuilder: (context, imageProvider) => CircleAvatar( - backgroundImage: imageProvider, - radius: 25, - ), - placeholder: (context, url) => CircularProgressIndicator(), - errorWidget: (context, url, error) => CircleAvatar( - child: Icon(Icons.person), - backgroundColor: Colors.white, - radius: 25, - ), - ), - SizedBox(height: 16.0), - Text(state.plan?['name'], style: CustomTextStyles.titleMediumBlack), - SizedBox(height: 8.0), - Text( - state.plan?['details'], - ), - SizedBox(height: 16.0), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - ElevatedButton( - onPressed: () { - // Действие для редактирования - }, - child: Text('Редактировать'), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + CachedNetworkImage( + imageUrl: baseUrl + '/storage/' + (state.plan?['image'] ?? ''), + imageBuilder: (context, imageProvider) => CircleAvatar( + backgroundImage: imageProvider, + radius: 25, ), - ElevatedButton( - onPressed: () => context.read().add(DeleteEntry(state.plan?['id'])), - child: Text('Удалить'), + placeholder: (context, url) => CircularProgressIndicator(), + errorWidget: (context, url, error) => CircleAvatar( + child: Icon(Icons.person), + backgroundColor: Colors.white, + radius: 25, ), - ], - ), - ],), + ), + SizedBox(height: 16.0), + Text(state.plan?['name'], style: CustomTextStyles.titleMediumBlack), + SizedBox(height: 8.0), + Text( + state.plan?['details'], + ), + SizedBox(height: 16.0), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + ElevatedButton( + onPressed: () { + // Действие для редактирования + }, + child: Text('Редактировать'), + ), + ElevatedButton( + onPressed: () => context.read().add(DeleteEntry(state.plan?['id'])), + child: Text('Удалить'), + ), + ], + ), + ], + ), ), ], ), 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 af1c5581..8b01f618 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 @@ -1,17 +1,17 @@ //import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart'; import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart'; -import 'package:http/http.dart' as http; -import 'dart:convert'; -import 'package:hive/hive.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:image_picker/image_picker.dart'; import 'package:go_router/go_router.dart'; +import 'package:hive/hive.dart'; +import 'package:http/http.dart' as http; +import 'package:image_picker/image_picker.dart'; + +import '/core/app_export.dart'; part 'my_profile_event.dart'; part 'my_profile_state.dart'; @@ -36,7 +36,7 @@ class MyProfileBloc extends Bloc { //final token = // "9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1ne AggmpR2TidVGDPN34fa201a"; final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/index'), + Uri.parse(baseUrl + '/api/profile/index'), headers: { 'Authorization': 'Bearer $token', }, @@ -278,7 +278,7 @@ class MyProfileBloc extends Bloc { } Future uploadImageToServer(String imagePath, String? token) async { - String url = '${dotenv.env['SERVER_ROOT']!}/profile/photo/upload'; + String url = '${baseUrl}/api/profile/photo/upload'; print(url); var request = http.MultipartRequest('POST', Uri.parse(url)); request.headers['Authorization'] = 'Bearer $token'; 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 7c66b4c3..85c254d1 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 @@ -12,49 +12,48 @@ class MyProfileState extends Equatable { } class MyProfileInitialState extends MyProfileState { - MyProfileInitialState({required MyProfileModel myProfileModelObj}) - : super(myProfileModelObj: myProfileModelObj); + MyProfileInitialState({required MyProfileModel myProfileModelObj}) : super(myProfileModelObj: myProfileModelObj); } /// Represents the state of MyProfile in the application. class MyProfileLoadedState extends MyProfileState { - MyProfileLoadedState( - {this.chestCircumferenceController, - this.waistCircumferenceController, - this.hipCircumferenceController, - this.myProfileModelObj, - this.weightController, - this.user, - this.userDetails, - this.chartPoints, - this.chartDates, - this.plans, - this.token, - this.selectedCountry, - this.selectedCity, - this.selectedActivity, - this.chestCircumferenceFormController, - this.waistCircumferenceFormController, - this.hipCircumferenceFormController, - this.firstNameFormController, - this.lastNameFormController, - this.countryFormController, - this.dateFormController, - this.cityFormController, - this.heightFormController, - this.weightFormController, - this.upPressureFormController, - this.downPressureFormController, - this.allergiesFormController, - this.pillsFormController, - this.sportsFormController, - this.favoriteFormController, - this.unfavoriteFormController, - this.additionalFormController, - this.hypoFormController, - this.hyperFormController, - this.circumferences,}) - : super(myProfileModelObj: null); + MyProfileLoadedState({ + this.chestCircumferenceController, + this.waistCircumferenceController, + this.hipCircumferenceController, + this.myProfileModelObj, + this.weightController, + this.user, + this.userDetails, + this.chartPoints, + this.chartDates, + this.plans, + this.token, + this.selectedCountry, + this.selectedCity, + this.selectedActivity, + this.chestCircumferenceFormController, + this.waistCircumferenceFormController, + this.hipCircumferenceFormController, + this.firstNameFormController, + this.lastNameFormController, + this.countryFormController, + this.dateFormController, + this.cityFormController, + this.heightFormController, + this.weightFormController, + this.upPressureFormController, + this.downPressureFormController, + this.allergiesFormController, + this.pillsFormController, + this.sportsFormController, + this.favoriteFormController, + this.unfavoriteFormController, + this.additionalFormController, + this.hypoFormController, + this.hyperFormController, + this.circumferences, + }) : super(myProfileModelObj: null); MyProfileModel? myProfileModelObj; Map? user; @@ -174,42 +173,27 @@ class MyProfileLoadedState extends MyProfileState { chartPoints: chartPoints ?? this.chartPoints, chartDates: chartDates ?? this.chartDates, weightController: weightController ?? this.weightController, - chestCircumferenceController: - chestCircumferenceController ?? this.chestCircumferenceController, - waistCircumferenceController: - waistCircumferenceController ?? this.waistCircumferenceController, - hipCircumferenceController: - hipCircumferenceController ?? this.hipCircumferenceController, - chestCircumferenceFormController: chestCircumferenceFormController ?? - this.chestCircumferenceFormController, - waistCircumferenceFormController: waistCircumferenceFormController ?? - this.waistCircumferenceFormController, - hipCircumferenceFormController: - hipCircumferenceFormController ?? this.hipCircumferenceFormController, - firstNameFormController: - firstNameFormController ?? this.firstNameFormController, - lastNameFormController: - lastNameFormController ?? this.lastNameFormController, - countryFormController: - countryFormController ?? this.countryFormController, + chestCircumferenceController: chestCircumferenceController ?? this.chestCircumferenceController, + waistCircumferenceController: waistCircumferenceController ?? this.waistCircumferenceController, + hipCircumferenceController: hipCircumferenceController ?? this.hipCircumferenceController, + chestCircumferenceFormController: chestCircumferenceFormController ?? this.chestCircumferenceFormController, + waistCircumferenceFormController: waistCircumferenceFormController ?? this.waistCircumferenceFormController, + hipCircumferenceFormController: hipCircumferenceFormController ?? this.hipCircumferenceFormController, + firstNameFormController: firstNameFormController ?? this.firstNameFormController, + lastNameFormController: lastNameFormController ?? this.lastNameFormController, + countryFormController: countryFormController ?? this.countryFormController, dateFormController: dateFormController ?? this.dateFormController, cityFormController: cityFormController ?? this.cityFormController, heightFormController: heightFormController ?? this.heightFormController, weightFormController: weightFormController ?? this.weightFormController, - upPressureFormController: - upPressureFormController ?? this.upPressureFormController, - downPressureFormController: - downPressureFormController ?? this.downPressureFormController, - allergiesFormController: - allergiesFormController ?? this.allergiesFormController, + upPressureFormController: upPressureFormController ?? this.upPressureFormController, + downPressureFormController: downPressureFormController ?? this.downPressureFormController, + allergiesFormController: allergiesFormController ?? this.allergiesFormController, pillsFormController: pillsFormController ?? this.pillsFormController, sportsFormController: sportsFormController ?? this.sportsFormController, - favoriteFormController: - favoriteFormController ?? this.favoriteFormController, - unfavoriteFormController: - unfavoriteFormController ?? this.unfavoriteFormController, - additionalFormController: - additionalFormController ?? this.additionalFormController, + favoriteFormController: favoriteFormController ?? this.favoriteFormController, + unfavoriteFormController: unfavoriteFormController ?? this.unfavoriteFormController, + additionalFormController: additionalFormController ?? this.additionalFormController, token: token ?? this.token, selectedCountry: selectedCountry ?? this.selectedCountry, selectedCity: selectedCity ?? this.selectedCity, diff --git a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart index 9aeb496e..3aa1f640 100644 --- a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart +++ b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart @@ -1,21 +1,21 @@ -import 'package:go_router/go_router.dart'; +import 'dart:convert'; +import 'dart:math'; -import 'bloc/my_profile_bloc.dart'; -import 'models/my_profile_model.dart'; +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:carousel_slider/carousel_slider.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; -import 'package:carousel_slider/carousel_slider.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:flutter/services.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:http/http.dart' as http; import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:go_router/go_router.dart'; +import 'package:http/http.dart' as http; +import 'package:image_picker/image_picker.dart'; import 'package:intl/intl.dart'; -import 'dart:math'; -import 'dart:convert'; + +import 'bloc/my_profile_bloc.dart'; +import 'models/my_profile_model.dart'; class MyProfileScreen extends StatelessWidget { static Widget builder(BuildContext context) { @@ -156,7 +156,7 @@ class MyProfileScreen extends StatelessWidget { GestureDetector( onTap: () => addImage(context), child: CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (state.user?['profile_photo_path'] ?? ''), + imageUrl: baseUrl + '/storage/' + (state.user?['profile_photo_path'] ?? ''), imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 60, @@ -720,7 +720,7 @@ class MyProfileScreen extends StatelessWidget { child: Container( margin: EdgeInsets.only(bottom: 12.h), child: Image.network( - dotenv.env['STORAGE_URL']! + imagePaths?[i], + baseUrl + '/storage/' + imagePaths?[i], height: 25.adaptSize, width: 25.adaptSize, ), @@ -849,7 +849,7 @@ class MyProfileScreen extends StatelessWidget { try { final token = state.token; final response = await http.post( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/addCircumference'), + Uri.parse(baseUrl + '/api/profile/addCircumference'), headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer $token', @@ -941,7 +941,7 @@ class MyProfileScreen extends StatelessWidget { try { final token = state.token; final response = await http.post( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/addWeight'), + Uri.parse(baseUrl + '/api/profile/addWeight'), headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer $token', 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 cb3aeb60..4cd47b18 100644 --- a/lib/presentation/profile/my_profile_screen/my_settings_screen.dart +++ b/lib/presentation/profile/my_profile_screen/my_settings_screen.dart @@ -1,22 +1,24 @@ +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; +import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; +import 'package:eatvio_app/widgets/custom_about_list.dart'; +import 'package:eatvio_app/widgets/custom_expandable_list.dart'; +import 'package:eatvio_app/widgets/custom_language_drop_down.dart'; +import 'package:eatvio_app/widgets/custom_notification_screen.dart'; +import 'package:eatvio_app/widgets/custom_section_title.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'bloc/my_profile_bloc.dart'; import 'models/my_profile_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; -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_about_list.dart'; -import 'package:eatvio_app/widgets/custom_expandable_list.dart'; -import 'package:eatvio_app/widgets/custom_notification_screen.dart'; -import 'package:eatvio_app/widgets/custom_section_title.dart'; -import 'package:eatvio_app/widgets/custom_language_drop_down.dart'; -import 'package:flutter/material.dart'; class MySettingsScreen extends StatelessWidget { static Widget builder(BuildContext context) { return BlocProvider( - create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent()), child: MySettingsScreen(),); + create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent()), + child: MySettingsScreen(), + ); } Widget build(BuildContext context) { @@ -45,7 +47,6 @@ class MySettingsScreen extends StatelessWidget { } _buildSetingsScreen(BuildContext context, MyProfileLoadedState state) { - return Scaffold( appBar: AppBar( toolbarHeight: 0, @@ -64,30 +65,32 @@ class MySettingsScreen extends StatelessWidget { children: [ SizedBox(height: 30), Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], - ), - child: CustomAppBar( - height: 54.v, - leadingWidth: 28.h, - leading: AppbarLeadingImage( - imagePath: ImageConstant.imgArrowLeft, - margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), - onTap: () => GoRouter.of(context).pop(), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.all(Radius.circular(12)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 2, + blurRadius: 5, + offset: Offset(0, 3), ), - title: Padding( - padding: EdgeInsets.only(left: 20.h), - child: Row(children: [AppbarSubtitle(text: state.user?['name'], margin: EdgeInsets.only(left: 80.h, top: 12.v, bottom: 9.v))]),), - ),), + ], + ), + child: CustomAppBar( + height: 54.v, + leadingWidth: 28.h, + leading: AppbarLeadingImage( + imagePath: ImageConstant.imgArrowLeft, + margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), + onTap: () => GoRouter.of(context).pop(), + ), + title: Padding( + padding: EdgeInsets.only(left: 20.h), + child: Row(children: [AppbarSubtitle(text: state.user?['name'], margin: EdgeInsets.only(left: 80.h, top: 12.v, bottom: 9.v))]), + ), + ), + ), SizedBox(height: 20), Container( padding: EdgeInsets.symmetric( diff --git a/lib/presentation/recipe/recipe_create_screen/bloc/recipe_create_bloc.dart b/lib/presentation/recipe/recipe_create_screen/bloc/recipe_create_bloc.dart index ebb0ec06..c0b0e2ee 100644 --- a/lib/presentation/recipe/recipe_create_screen/bloc/recipe_create_bloc.dart +++ b/lib/presentation/recipe/recipe_create_screen/bloc/recipe_create_bloc.dart @@ -1,15 +1,16 @@ import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/recipe/recipe_create_screen/models/recipe_create_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/recipe/recipe_create_screen/models/recipe_create_model.dart'; -import 'package:go_router/go_router.dart'; + part 'recipe_create_event.dart'; part 'recipe_create_state.dart'; @@ -34,7 +35,8 @@ class RecipeCreateBloc extends Bloc { } if (state is RecipeCreateLoadedState) { var currentState = state as RecipeCreateLoadedState; - emit(currentState.copyWith( + emit( + currentState.copyWith( recipeModelObj: currentState.recipeModelObj, title: currentState.title, token: currentState.token, @@ -42,62 +44,79 @@ class RecipeCreateBloc extends Bloc { video_url: currentState.video_url, steps: currentState.steps, stepDescriptions: currentState.stepDescriptions, - tags: currentState.tags,),); + tags: currentState.tags, + ), + ); } else { final Map step = { 'description': '', 'image': '', }; - emit(RecipeCreateLoadedState( + emit( + RecipeCreateLoadedState( token: token, title: TextEditingController(), description: TextEditingController(), video_url: TextEditingController(), tags: TextEditingController(), stepDescriptions: [TextEditingController()], - steps: [step],),); + steps: [step], + ), + ); } } FutureOr _addStep( - AddStep event, Emitter emit,) async { + AddStep event, + Emitter emit, + ) async { if (state is RecipeCreateLoadedState) { var currentState = state as RecipeCreateLoadedState; List? updatedSteps = currentState.steps; - List? updatedStepDescriptions = - currentState.stepDescriptions; + List? updatedStepDescriptions = currentState.stepDescriptions; updatedSteps!.add({ 'description': '', 'image': '', }); updatedStepDescriptions!.add(TextEditingController()); - emit(currentState.copyWith( - steps: updatedSteps, stepDescriptions: updatedStepDescriptions,),); + emit( + currentState.copyWith( + steps: updatedSteps, + stepDescriptions: updatedStepDescriptions, + ), + ); await _reloadScreen(event, emit); } } FutureOr _removeStep( - RemoveStep event, Emitter emit,) async { + RemoveStep event, + Emitter emit, + ) async { if (state is RecipeCreateLoadedState) { var currentState = state as RecipeCreateLoadedState; List? updatedSteps = currentState.steps; - List? updatedStepDescriptions = - currentState.stepDescriptions; + List? updatedStepDescriptions = currentState.stepDescriptions; updatedSteps!.removeAt(event.id); updatedStepDescriptions!.removeAt(event.id); - emit(currentState.copyWith( - steps: updatedSteps, stepDescriptions: updatedStepDescriptions,),); + emit( + currentState.copyWith( + steps: updatedSteps, + stepDescriptions: updatedStepDescriptions, + ), + ); await _reloadScreen(event, emit); } } FutureOr _createRecipe( - CreateRecipe event, Emitter emit,) async { + CreateRecipe event, + Emitter emit, + ) async { if (state is RecipeCreateLoadedState) { var currentState = state as RecipeCreateLoadedState; @@ -112,14 +131,19 @@ class RecipeCreateBloc extends Bloc { AppRouter.navigatorKey.currentContext?.goNamed('recipeSelectScreen'); } else { print( - 'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}',); + 'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}', + ); } } } - FutureOr sendRecipe(String? title, String? video_url, - String? description, List? steps,) async { - String url = '${dotenv.env['SERVER_ROOT']!}/recipe/create'; + FutureOr sendRecipe( + String? title, + String? video_url, + String? description, + List? steps, + ) async { + String url = '${baseUrl}/api/recipe/create'; final Map credentials = { 'title': title, 'description': description, @@ -141,7 +165,9 @@ class RecipeCreateBloc extends Bloc { } FutureOr _reloadScreen( - RecipeCreateEvent? event, Emitter emit,) async { + RecipeCreateEvent? event, + Emitter emit, + ) async { print('Reloading..'); final box = await Hive.openBox('token'); final token = box.get('token'); @@ -150,7 +176,8 @@ class RecipeCreateBloc extends Bloc { } if (state is RecipeCreateLoadedState) { var currentState = state as RecipeCreateLoadedState; - emit(currentState.copyWith( + emit( + currentState.copyWith( recipeModelObj: currentState.recipeModelObj, title: currentState.title, token: currentState.token, @@ -158,7 +185,9 @@ class RecipeCreateBloc extends Bloc { video_url: currentState.video_url, steps: currentState.steps, stepDescriptions: currentState.stepDescriptions, - tags: currentState.tags,),); + tags: currentState.tags, + ), + ); } } } diff --git a/lib/presentation/recipe/recipe_create_screen/bloc/recipe_create_state.dart b/lib/presentation/recipe/recipe_create_screen/bloc/recipe_create_state.dart index 4865bf38..d58773af 100644 --- a/lib/presentation/recipe/recipe_create_screen/bloc/recipe_create_state.dart +++ b/lib/presentation/recipe/recipe_create_screen/bloc/recipe_create_state.dart @@ -22,15 +22,16 @@ class RecipeCreateState extends Equatable { } class RecipeCreateLoadedState extends RecipeCreateState { - RecipeCreateLoadedState( - {this.recipeModelObj, - this.token, - this.title, - this.description, - this.video_url, - this.tags, - this.stepDescriptions, - this.steps,}); + RecipeCreateLoadedState({ + this.recipeModelObj, + this.token, + this.title, + this.description, + this.video_url, + this.tags, + this.stepDescriptions, + this.steps, + }); RecipeCreateModel? recipeModelObj; String? token; @@ -62,14 +63,15 @@ class RecipeCreateLoadedState extends RecipeCreateState { List? stepDescriptions, }) { return RecipeCreateLoadedState( - recipeModelObj: recipeModelObj ?? this.recipeModelObj, - title: title ?? this.title, - description: description ?? this.description, - video_url: video_url ?? this.video_url, - token: token ?? this.token, - steps: steps ?? this.steps, - tags: tags ?? this.tags, - stepDescriptions: stepDescriptions ?? this.stepDescriptions,); + recipeModelObj: recipeModelObj ?? this.recipeModelObj, + title: title ?? this.title, + description: description ?? this.description, + video_url: video_url ?? this.video_url, + token: token ?? this.token, + steps: steps ?? this.steps, + tags: tags ?? this.tags, + stepDescriptions: stepDescriptions ?? this.stepDescriptions, + ); } } @@ -83,6 +85,5 @@ class RecipeCreateErrorState extends RecipeCreateState { } class RecipeCreateInitialState extends RecipeCreateState { - RecipeCreateInitialState({required RecipeCreateModel recipeModelObj}) - : super(recipeModelObj: recipeModelObj); + RecipeCreateInitialState({required RecipeCreateModel recipeModelObj}) : super(recipeModelObj: recipeModelObj); } diff --git a/lib/presentation/recipe/recipe_create_screen/recipe_create_screen.dart b/lib/presentation/recipe/recipe_create_screen/recipe_create_screen.dart index 5afb1645..0f8f3f53 100644 --- a/lib/presentation/recipe/recipe_create_screen/recipe_create_screen.dart +++ b/lib/presentation/recipe/recipe_create_screen/recipe_create_screen.dart @@ -1,14 +1,14 @@ +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; +import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; +import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/custom_text_form_field.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'bloc/recipe_create_bloc.dart'; import 'models/recipe_create_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; -import 'package:eatvio_app/widgets/custom_text_form_field.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; class RecipeCreateScreen extends StatelessWidget { const RecipeCreateScreen({Key? key}) : super(key: key); @@ -16,9 +16,10 @@ class RecipeCreateScreen extends StatelessWidget { static Widget builder(BuildContext context) { final recipeID = ModalRoute.of(context)!.settings.arguments; return BlocProvider( - create: (context) => - RecipeCreateBloc(RecipeCreateState(recipeModelObj: RecipeCreateModel(recipeID: recipeID.toString())))..add(RecipeCreateInitialEvent()), - child: RecipeCreateScreen(),); + create: (context) => + RecipeCreateBloc(RecipeCreateState(recipeModelObj: RecipeCreateModel(recipeID: recipeID.toString())))..add(RecipeCreateInitialEvent()), + child: RecipeCreateScreen(), + ); } Widget build(BuildContext context) { @@ -53,29 +54,33 @@ class RecipeCreateScreen extends StatelessWidget { } return RefreshIndicator( - onRefresh: refreshPage(context), - child: Scaffold( - appBar: AppBar( - toolbarHeight: 0, - automaticallyImplyLeading: false, - ), - resizeToAvoidBottomInset: false, - body: Container( - width: double.maxFinite, - decoration: BoxDecoration(color: Colors.grey[200]), - child: ListView(children: [ - _buldAppBar(context), - SizedBox(height: 20.v), - _buildRecipeInfo(state, context), - SizedBox(height: 20.v), - Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: steps, - ), - SizedBox(height: 20.v), - _buildAdditional(context, state), - ],), - ),),); + onRefresh: refreshPage(context), + child: Scaffold( + appBar: AppBar( + toolbarHeight: 0, + automaticallyImplyLeading: false, + ), + resizeToAvoidBottomInset: false, + body: Container( + width: double.maxFinite, + decoration: BoxDecoration(color: Colors.grey[200]), + child: ListView( + children: [ + _buldAppBar(context), + SizedBox(height: 20.v), + _buildRecipeInfo(state, context), + SizedBox(height: 20.v), + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: steps, + ), + SizedBox(height: 20.v), + _buildAdditional(context, state), + ], + ), + ), + ), + ); } _buldAppBar(BuildContext context) { @@ -102,10 +107,11 @@ class RecipeCreateScreen extends StatelessWidget { onTap: onTapBack(context), ), title: Align( - alignment: Alignment.center, - child: AppbarSubtitle( - text: "Добавление рецепта", - ),), + alignment: Alignment.center, + child: AppbarSubtitle( + text: "Добавление рецепта", + ), + ), ), ); } @@ -130,41 +136,44 @@ class RecipeCreateScreen extends StatelessWidget { ), ], ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 16.0), - Align(alignment: Alignment.centerLeft, child: Text("Изображение")), - _buildAddPhoto(context, state), - SizedBox(height: 16.0), - Align(alignment: Alignment.centerLeft, child: Text("Название рецепта")), - CustomTextFormField( - controller: state.title, - hintText: "Введите название рецепта", - fillColor: appTheme.gray50, - borderDecoration: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.h), - borderSide: BorderSide( - color: appTheme.gray50, - width: 1, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 16.0), + Align(alignment: Alignment.centerLeft, child: Text("Изображение")), + _buildAddPhoto(context, state), + SizedBox(height: 16.0), + Align(alignment: Alignment.centerLeft, child: Text("Название рецепта")), + CustomTextFormField( + controller: state.title, + hintText: "Введите название рецепта", + fillColor: appTheme.gray50, + borderDecoration: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.h), + borderSide: BorderSide( + color: appTheme.gray50, + width: 1, + ), ), ), - ), - SizedBox(height: 16.0), - Align(alignment: Alignment.centerLeft, child: Text("Описание")), - CustomTextFormField( - controller: state.description, - hintText: "Введите описание рецепта", - maxLines: 4, - fillColor: appTheme.gray50, - borderDecoration: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.h), - borderSide: BorderSide( - color: appTheme.gray50, - width: 1, + SizedBox(height: 16.0), + Align(alignment: Alignment.centerLeft, child: Text("Описание")), + CustomTextFormField( + controller: state.description, + hintText: "Введите описание рецепта", + maxLines: 4, + fillColor: appTheme.gray50, + borderDecoration: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.h), + borderSide: BorderSide( + color: appTheme.gray50, + width: 1, + ), ), ), - ), - SizedBox(height: 16.0), - ],), + SizedBox(height: 16.0), + ], + ), ); } @@ -254,71 +263,74 @@ class RecipeCreateScreen extends StatelessWidget { ), ], ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - Align( - alignment: Alignment.centerLeft, - child: Text( - "Шаг ${i + 1}", - style: CustomTextStyles.titleMediumSemiBold, - ), - ), - SizedBox(height: 8.0), - CustomTextFormField( - controller: state.stepDescriptions?[i], - hintText: "Введите описание шага", - maxLines: 4, - fillColor: appTheme.gray50, - borderDecoration: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.h), - borderSide: BorderSide( - color: appTheme.gray50, - width: 1, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Align( + alignment: Alignment.centerLeft, + child: Text( + "Шаг ${i + 1}", + style: CustomTextStyles.titleMediumSemiBold, ), ), - ), - SizedBox(height: 16.0), - _buildAddPhoto(context, state), - SizedBox(height: 16.0), - if (isFirstStep && isLastStep) - CustomOutlinedButton( - onPressed: () => context.read().add(AddStep()), - text: "Добавить шаг", - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - ), - if (isLastStep && !isFirstStep) // Добавляем кнопку "Добавить шаг" только для последнего шага - Column( - children: [ - SizedBox(height: 16.0), - Row( - children: [ - Flexible( - flex: 5, - child: CustomOutlinedButton( - onPressed: () => context.read().add(AddStep()), - text: "Добавить шаг", - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - ), - ), - SizedBox(width: 8), // Add some spacing between the buttons - Flexible( - flex: 1, - child: CustomOutlinedButton( - text: "х", - onPressed: () => context.read().add(RemoveStep(i)), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - ), - ), - ], + SizedBox(height: 8.0), + CustomTextFormField( + controller: state.stepDescriptions?[i], + hintText: "Введите описание шага", + maxLines: 4, + fillColor: appTheme.gray50, + borderDecoration: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.h), + borderSide: BorderSide( + color: appTheme.gray50, + width: 1, ), - ], + ), ), - if (!isLastStep && !isFirstStep) - CustomOutlinedButton( - onPressed: () => context.read().add(RemoveStep(i)), - text: "x", - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - ), - ],), + SizedBox(height: 16.0), + _buildAddPhoto(context, state), + SizedBox(height: 16.0), + if (isFirstStep && isLastStep) + CustomOutlinedButton( + onPressed: () => context.read().add(AddStep()), + text: "Добавить шаг", + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + ), + if (isLastStep && !isFirstStep) // Добавляем кнопку "Добавить шаг" только для последнего шага + Column( + children: [ + SizedBox(height: 16.0), + Row( + children: [ + Flexible( + flex: 5, + child: CustomOutlinedButton( + onPressed: () => context.read().add(AddStep()), + text: "Добавить шаг", + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + ), + ), + SizedBox(width: 8), // Add some spacing between the buttons + Flexible( + flex: 1, + child: CustomOutlinedButton( + text: "х", + onPressed: () => context.read().add(RemoveStep(i)), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + ), + ), + ], + ), + ], + ), + if (!isLastStep && !isFirstStep) + CustomOutlinedButton( + onPressed: () => context.read().add(RemoveStep(i)), + text: "x", + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + ), + ], + ), ); } @@ -342,40 +354,43 @@ class RecipeCreateScreen extends StatelessWidget { ), ], ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - Align(alignment: Alignment.centerLeft, child: Text("Теги")), - CustomTextFormField( - controller: state.tags, - hintText: "Введите теги, через запятую", - fillColor: appTheme.gray50, - borderDecoration: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.h), - borderSide: BorderSide( - color: appTheme.gray50, - width: 1, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Align(alignment: Alignment.centerLeft, child: Text("Теги")), + CustomTextFormField( + controller: state.tags, + hintText: "Введите теги, через запятую", + fillColor: appTheme.gray50, + borderDecoration: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.h), + borderSide: BorderSide( + color: appTheme.gray50, + width: 1, + ), ), ), - ), - SizedBox(height: 8.0), - Align(alignment: Alignment.centerLeft, child: Text("Ссылка на видео (необязательно)")), - CustomTextFormField( - controller: state.video_url, - hintText: "YouTube", - fillColor: appTheme.gray50, - borderDecoration: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.h), - borderSide: BorderSide( - color: appTheme.gray50, - width: 1, + SizedBox(height: 8.0), + Align(alignment: Alignment.centerLeft, child: Text("Ссылка на видео (необязательно)")), + CustomTextFormField( + controller: state.video_url, + hintText: "YouTube", + fillColor: appTheme.gray50, + borderDecoration: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.h), + borderSide: BorderSide( + color: appTheme.gray50, + width: 1, + ), ), ), - ), - SizedBox(height: 16.0), - CustomOutlinedButton( - text: "Добавить рецепт", - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - ), - ],), + SizedBox(height: 16.0), + CustomOutlinedButton( + text: "Добавить рецепт", + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + ), + ], + ), ); } diff --git a/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_bloc.dart b/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_bloc.dart index 0fbc0481..560c75ee 100644 --- a/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_bloc.dart +++ b/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_bloc.dart @@ -1,18 +1,17 @@ import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/recipe/recipe_edit_screen/models/recipe_edit_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/recipe/recipe_edit_screen/models/recipe_edit_model.dart'; -import 'package:go_router/go_router.dart'; part 'recipe_edit_event.dart'; - part 'recipe_edit_state.dart'; /// A bloc that manages the state of a RecipeEdit according to the event that is dispatched to it. @@ -37,7 +36,7 @@ class RecipeEditBloc extends Bloc { } final String? recipeID = state.recipeModelObj?.recipeID; final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/show/$recipeID'), + Uri.parse(baseUrl + '/api/recipes/show/$recipeID'), headers: { 'Authorization': 'Bearer $token', }, @@ -166,7 +165,7 @@ class RecipeEditBloc extends Bloc { String? description, ) async { int id = recipe?['id']; - String url = '${dotenv.env['SERVER_ROOT']!}/recipe/update/$id'; + String url = '${baseUrl}/api/recipe/update/$id'; final Map credentials = { 'id': id, @@ -200,7 +199,7 @@ class RecipeEditBloc extends Bloc { } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/getTags/$id'), + Uri.parse(baseUrl + '/api/recipes/getTags/$id'), headers: { 'Authorization': 'Bearer $token', }, diff --git a/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_state.dart b/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_state.dart index e9086e60..57df9f28 100644 --- a/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_state.dart +++ b/lib/presentation/recipe/recipe_edit_screen/bloc/recipe_edit_state.dart @@ -22,17 +22,18 @@ class RecipeEditState extends Equatable { } class RecipeEditLoadedState extends RecipeEditState { - RecipeEditLoadedState( - {this.recipeModelObj, - this.token, - this.recipe, - this.title, - this.description, - this.video_url, - this.tagsController, - this.stepDescriptions, - this.tags, - this.steps,}); + RecipeEditLoadedState({ + this.recipeModelObj, + this.token, + this.recipe, + this.title, + this.description, + this.video_url, + this.tagsController, + this.stepDescriptions, + this.tags, + this.steps, + }); RecipeEditModel? recipeModelObj; Map? recipe; @@ -45,8 +46,7 @@ class RecipeEditLoadedState extends RecipeEditState { List? tags; List? stepDescriptions; @override - List get props => - [recipeModelObj, recipe, title, description, video_url]; + List get props => [recipeModelObj, recipe, title, description, video_url]; RecipeEditLoadedState copyWith({ RecipeEditModel? recipeModelObj, Map? recipe, @@ -84,6 +84,5 @@ class RecipeEditErrorState extends RecipeEditState { } class RecipeEditInitialState extends RecipeEditState { - RecipeEditInitialState({required RecipeEditModel recipeModelObj}) - : super(recipeModelObj: recipeModelObj); + RecipeEditInitialState({required RecipeEditModel recipeModelObj}) : super(recipeModelObj: recipeModelObj); } diff --git a/lib/presentation/recipe/recipe_edit_screen/recipe_edit_screen.dart b/lib/presentation/recipe/recipe_edit_screen/recipe_edit_screen.dart index 6621fc8d..e3dbcbe6 100644 --- a/lib/presentation/recipe/recipe_edit_screen/recipe_edit_screen.dart +++ b/lib/presentation/recipe/recipe_edit_screen/recipe_edit_screen.dart @@ -1,16 +1,15 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; +import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; +import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/custom_text_form_field.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'bloc/recipe_edit_bloc.dart'; import 'models/recipe_edit_model.dart'; -import 'package:flutter/material.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; -import 'package:eatvio_app/widgets/custom_text_form_field.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; class RecipeEditScreen extends StatelessWidget { const RecipeEditScreen({Key? key}) : super(key: key); @@ -18,8 +17,9 @@ class RecipeEditScreen extends StatelessWidget { static Widget builder(BuildContext context) { final recipeID = ModalRoute.of(context)!.settings.arguments; return BlocProvider( - create: (context) => RecipeEditBloc(RecipeEditState(recipeModelObj: RecipeEditModel(recipeID: recipeID.toString())))..add(RecipeEditInitialEvent()), - child: RecipeEditScreen(),); + create: (context) => RecipeEditBloc(RecipeEditState(recipeModelObj: RecipeEditModel(recipeID: recipeID.toString())))..add(RecipeEditInitialEvent()), + child: RecipeEditScreen(), + ); } Widget build(BuildContext context) { @@ -109,10 +109,11 @@ class RecipeEditScreen extends StatelessWidget { onTap: onTapBack(context), ), title: Align( - alignment: Alignment.center, - child: AppbarSubtitle( - text: "Редактирование рецепта", - ),), + alignment: Alignment.center, + child: AppbarSubtitle( + text: "Редактирование рецепта", + ), + ), ), ); } @@ -137,52 +138,55 @@ class RecipeEditScreen extends StatelessWidget { ), ], ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 16.0), - Align(alignment: Alignment.centerLeft, child: Text("Изображение")), - if (state.recipe?['image'] != null) - CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (state.recipe?['image']), - width: double.infinity, - // Установите ширину равной ширине родительского элемента - height: 200.0, - fit: BoxFit.cover, - placeholder: (context, url) => CircularProgressIndicator(), - errorWidget: (context, url, error) => Icon(Icons.error), - ) - else - _buildAddPhoto(context, state), - SizedBox(height: 16.0), - Align(alignment: Alignment.centerLeft, child: Text("Название рецепта")), - CustomTextFormField( - controller: state.title, - hintText: "Введите название рецепта", - fillColor: appTheme.gray50, - borderDecoration: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.h), - borderSide: BorderSide( - color: appTheme.gray50, - width: 1, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 16.0), + Align(alignment: Alignment.centerLeft, child: Text("Изображение")), + if (state.recipe?['image'] != null) + CachedNetworkImage( + imageUrl: baseUrl + '/storage/' + (state.recipe?['image']), + width: double.infinity, + // Установите ширину равной ширине родительского элемента + height: 200.0, + fit: BoxFit.cover, + placeholder: (context, url) => CircularProgressIndicator(), + errorWidget: (context, url, error) => Icon(Icons.error), + ) + else + _buildAddPhoto(context, state), + SizedBox(height: 16.0), + Align(alignment: Alignment.centerLeft, child: Text("Название рецепта")), + CustomTextFormField( + controller: state.title, + hintText: "Введите название рецепта", + fillColor: appTheme.gray50, + borderDecoration: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.h), + borderSide: BorderSide( + color: appTheme.gray50, + width: 1, + ), ), ), - ), - SizedBox(height: 16.0), - Align(alignment: Alignment.centerLeft, child: Text("Описание")), - CustomTextFormField( - controller: state.description, - hintText: "Введите описание рецепта", - maxLines: 4, - fillColor: appTheme.gray50, - borderDecoration: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.h), - borderSide: BorderSide( - color: appTheme.gray50, - width: 1, + SizedBox(height: 16.0), + Align(alignment: Alignment.centerLeft, child: Text("Описание")), + CustomTextFormField( + controller: state.description, + hintText: "Введите описание рецепта", + maxLines: 4, + fillColor: appTheme.gray50, + borderDecoration: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.h), + borderSide: BorderSide( + color: appTheme.gray50, + width: 1, + ), ), ), - ), - SizedBox(height: 16.0), - ],), + SizedBox(height: 16.0), + ], + ), ); } @@ -272,83 +276,86 @@ class RecipeEditScreen extends StatelessWidget { ), ], ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - Align( - alignment: Alignment.centerLeft, - child: Text( - "Шаг ${i + 1}", - style: CustomTextStyles.titleMediumSemiBold, - ), - ), - SizedBox(height: 8.0), - CustomTextFormField( - controller: state.stepDescriptions?[i], - hintText: "Введите описание шага", - maxLines: 4, - fillColor: appTheme.gray50, - borderDecoration: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.h), - borderSide: BorderSide( - color: appTheme.gray50, - width: 1, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Align( + alignment: Alignment.centerLeft, + child: Text( + "Шаг ${i + 1}", + style: CustomTextStyles.titleMediumSemiBold, ), ), - ), - SizedBox(height: 16.0), - if (state.steps?[i]['image'] != null) - CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (state.steps?[i]['image']), - width: double.infinity, - // Установите ширину равной ширине родительского элемента - height: 200.0, - // Задайте постоянную высоту элемента - fit: BoxFit.cover, - placeholder: (context, url) => CircularProgressIndicator(), - errorWidget: (context, url, error) => Icon(Icons.error), - ) - else - _buildAddPhoto(context, state), - SizedBox(height: 16.0), - if (isFirstStep && isLastStep) - CustomOutlinedButton( - onPressed: () => context.read().add(AddStep()), - text: "Добавить шаг", - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - ), - if (isLastStep && !isFirstStep) // Добавляем кнопку "Добавить шаг" только для последнего шага - Column( - children: [ - SizedBox(height: 16.0), - Row( - children: [ - Flexible( - flex: 5, - child: CustomOutlinedButton( - onPressed: () => context.read().add(AddStep()), - text: "Добавить шаг", - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - ), - ), - SizedBox(width: 8), // Add some spacing between the buttons - Flexible( - flex: 1, - child: CustomOutlinedButton( - text: "х", - onPressed: () => context.read().add(RemoveStep(i)), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - ), - ), - ], + SizedBox(height: 8.0), + CustomTextFormField( + controller: state.stepDescriptions?[i], + hintText: "Введите описание шага", + maxLines: 4, + fillColor: appTheme.gray50, + borderDecoration: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.h), + borderSide: BorderSide( + color: appTheme.gray50, + width: 1, ), - ], + ), ), - if (!isLastStep && !isFirstStep) - CustomOutlinedButton( - onPressed: () => context.read().add(RemoveStep(i)), - text: "x", - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - ), - ],), + SizedBox(height: 16.0), + if (state.steps?[i]['image'] != null) + CachedNetworkImage( + imageUrl: baseUrl + '/storage/' + (state.steps?[i]['image']), + width: double.infinity, + // Установите ширину равной ширине родительского элемента + height: 200.0, + // Задайте постоянную высоту элемента + fit: BoxFit.cover, + placeholder: (context, url) => CircularProgressIndicator(), + errorWidget: (context, url, error) => Icon(Icons.error), + ) + else + _buildAddPhoto(context, state), + SizedBox(height: 16.0), + if (isFirstStep && isLastStep) + CustomOutlinedButton( + onPressed: () => context.read().add(AddStep()), + text: "Добавить шаг", + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + ), + if (isLastStep && !isFirstStep) // Добавляем кнопку "Добавить шаг" только для последнего шага + Column( + children: [ + SizedBox(height: 16.0), + Row( + children: [ + Flexible( + flex: 5, + child: CustomOutlinedButton( + onPressed: () => context.read().add(AddStep()), + text: "Добавить шаг", + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + ), + ), + SizedBox(width: 8), // Add some spacing between the buttons + Flexible( + flex: 1, + child: CustomOutlinedButton( + text: "х", + onPressed: () => context.read().add(RemoveStep(i)), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + ), + ), + ], + ), + ], + ), + if (!isLastStep && !isFirstStep) + CustomOutlinedButton( + onPressed: () => context.read().add(RemoveStep(i)), + text: "x", + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + ), + ], + ), ); } @@ -372,29 +379,32 @@ class RecipeEditScreen extends StatelessWidget { ), ], ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - Align(alignment: Alignment.centerLeft, child: Text("Теги")), - _buildEditableTags(state.tags), - SizedBox(height: 8.0), - Align(alignment: Alignment.centerLeft, child: Text("Ссылка на видео (необязательно)")), - CustomTextFormField( - controller: state.video_url, - hintText: "YouTube", - fillColor: appTheme.gray50, - borderDecoration: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.h), - borderSide: BorderSide( - color: appTheme.gray50, - width: 1, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Align(alignment: Alignment.centerLeft, child: Text("Теги")), + _buildEditableTags(state.tags), + SizedBox(height: 8.0), + Align(alignment: Alignment.centerLeft, child: Text("Ссылка на видео (необязательно)")), + CustomTextFormField( + controller: state.video_url, + hintText: "YouTube", + fillColor: appTheme.gray50, + borderDecoration: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.h), + borderSide: BorderSide( + color: appTheme.gray50, + width: 1, + ), ), ), - ), - SizedBox(height: 16.0), - CustomOutlinedButton( - text: "Добавить рецепт", - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - ), - ],), + SizedBox(height: 16.0), + CustomOutlinedButton( + text: "Добавить рецепт", + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + ), + ], + ), ); } diff --git a/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart b/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart index 08f57b47..399e20f8 100644 --- a/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart +++ b/lib/presentation/recipe/recipe_select_screen/bloc/recipe_select_bloc.dart @@ -3,14 +3,14 @@ import 'dart:async'; import 'package:dio/dio.dart'; import 'package:eatvio_app/app_router.dart'; import 'package:eatvio_app/locator_service.dart'; +import 'package:eatvio_app/presentation/recipe/recipe_select_screen/models/recipe_select_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/recipe/recipe_select_screen/models/recipe_select_model.dart'; -import 'package:hive/hive.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:image_picker/image_picker.dart'; import 'package:go_router/go_router.dart'; +import 'package:hive/hive.dart'; +import 'package:image_picker/image_picker.dart'; + +import '/core/app_export.dart'; part 'recipe_select_event.dart'; part 'recipe_select_state.dart'; @@ -31,7 +31,7 @@ class RecipeSelectBloc extends Bloc { if (token == null) { AppRouter.navigatorKey.currentContext?.goNamed('authScreen'); } - final response = await sl().get(dotenv.env['SERVER_ROOT']! + '/recipes/index'); + final response = await sl().get(baseUrl + '/api/recipes/index'); print('Got response'); if (response.statusCode == 200) { print('Got 200'); diff --git a/lib/presentation/recipe/recipe_select_screen/recipe_select_screen.dart b/lib/presentation/recipe/recipe_select_screen/recipe_select_screen.dart index 33b59af3..29e47b36 100644 --- a/lib/presentation/recipe/recipe_select_screen/recipe_select_screen.dart +++ b/lib/presentation/recipe/recipe_select_screen/recipe_select_screen.dart @@ -1,20 +1,20 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; +import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'bloc/recipe_select_bloc.dart'; import 'models/recipe_select_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; -import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:flutter/material.dart'; class RecipeSelectScreen extends StatelessWidget { static Widget builder(BuildContext context) { return BlocProvider( - create: (context) => RecipeSelectBloc(RecipeSelectState(myProfileModelObj: RecipeSelectModel()))..add(RecipeSelectInitialEvent()), - child: RecipeSelectScreen(),); + create: (context) => RecipeSelectBloc(RecipeSelectState(myProfileModelObj: RecipeSelectModel()))..add(RecipeSelectInitialEvent()), + child: RecipeSelectScreen(), + ); } Widget build(BuildContext context) { @@ -118,50 +118,51 @@ class RecipeSelectScreen extends StatelessWidget { itemBuilder: (context, index) { final post = state.posts?[index]; return Container( - margin: EdgeInsets.only(bottom: 10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], + margin: EdgeInsets.only(bottom: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.all(Radius.circular(12)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 2, + blurRadius: 5, + offset: Offset(0, 3), + ), + ], + ), + child: ListTile( + leading: CachedNetworkImage( + imageUrl: baseUrl + '/storage/' + post['image'], + imageBuilder: (context, imageProvider) => CircleAvatar( + backgroundImage: imageProvider, + radius: 25, + ), + placeholder: (context, url) => CircularProgressIndicator(), + errorWidget: (context, url, error) => CircleAvatar( + child: Icon(Icons.person), + backgroundColor: Colors.white, + radius: 25, + ), ), - child: ListTile( - leading: CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + post['image'], - imageBuilder: (context, imageProvider) => CircleAvatar( - backgroundImage: imageProvider, - radius: 25, - ), - placeholder: (context, url) => CircularProgressIndicator(), - errorWidget: (context, url, error) => CircleAvatar( - child: Icon(Icons.person), - backgroundColor: Colors.white, - radius: 25, - ), - ), - title: Text( - post?['title'] ?? '', - style: CustomTextStyles.titleMediumSemiBold, - ), - subtitle: Text(post?['description'] ?? ''), + title: Text( + post?['title'] ?? '', + style: CustomTextStyles.titleMediumSemiBold, + ), + subtitle: Text(post?['description'] ?? ''), + onTap: () => GoRouter.of(context).goNamed( + 'recipeScreen', + extra: post?['id'].toString(), + ), + trailing: GestureDetector( onTap: () => GoRouter.of(context).goNamed( - 'recipeScreen', + 'recipeEditScreen', extra: post?['id'].toString(), ), - trailing: GestureDetector( - onTap: () => GoRouter.of(context).goNamed( - 'recipeEditScreen', - extra: post?['id'].toString(), - ), - child: Icon(Icons.edit), - ), - ),); + child: Icon(Icons.edit), + ), + ), + ); }, ); } diff --git a/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_bloc.dart b/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_bloc.dart index e8ef6e3a..ac2d9a9a 100644 --- a/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_bloc.dart +++ b/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_bloc.dart @@ -1,20 +1,19 @@ import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/feed/blog_post_screen/models/comment_model.dart'; +import 'package:eatvio_app/presentation/recipe/recipe_show_screen/models/recipe_show_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; import 'package:intl/intl.dart'; -import 'dart:convert'; + import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/recipe/recipe_show_screen/models/recipe_show_model.dart'; -import 'package:eatvio_app/presentation/feed/blog_post_screen/models/comment_model.dart'; -import 'package:go_router/go_router.dart'; part 'recipe_show_event.dart'; - part 'recipe_show_state.dart'; /// A bloc that manages the state of a Recipe according to the event that is dispatched to it. @@ -37,7 +36,7 @@ class RecipeBloc extends Bloc { } final String? recipeID = state.recipeModelObj?.recipeID; final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/show/$recipeID'), + Uri.parse(baseUrl + '/api/recipes/show/$recipeID'), headers: { 'Authorization': 'Bearer $token', }, @@ -93,7 +92,7 @@ class RecipeBloc extends Bloc { } final int id = event.id; final response = await http.post( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/delete/$id'), + Uri.parse(baseUrl + '/api/recipes/delete/$id'), headers: { 'Authorization': 'Bearer $token', }, @@ -131,7 +130,7 @@ class RecipeBloc extends Bloc { } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/getAuthor/$id'), + Uri.parse(baseUrl + '/api/recipes/getAuthor/$id'), headers: { 'Authorization': 'Bearer $token', }, @@ -147,7 +146,7 @@ class RecipeBloc extends Bloc { AppRouter.navigatorKey.currentContext?.goNamed('authScreen'); } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/getComments/$id'), + Uri.parse(baseUrl + '/api/recipes/getComments/$id'), headers: { 'Authorization': 'Bearer $token', }, @@ -165,7 +164,7 @@ class RecipeBloc extends Bloc { } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/recipes/getTags/$id'), + Uri.parse(baseUrl + '/api/recipes/getTags/$id'), headers: { 'Authorization': 'Bearer $token', }, @@ -191,7 +190,7 @@ class RecipeBloc extends Bloc { } Future _sendCommentData(String? token, String body, int id) async { - String url = dotenv.env['SERVER_ROOT']! + '/recipes/createComment/$id'; + String url = baseUrl + '/api/recipes/createComment/$id'; final Map credentials = { 'id': id, 'body': body, diff --git a/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_state.dart b/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_state.dart index efc80d69..335ac202 100644 --- a/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_state.dart +++ b/lib/presentation/recipe/recipe_show_screen/bloc/recipe_show_state.dart @@ -22,15 +22,16 @@ class RecipeState extends Equatable { } class RecipeLoadedState extends RecipeState { - RecipeLoadedState( - {this.recipeModelObj, - this.recipe, - this.author, - this.comments, - this.token, - this.commentController, - this.tags, - this.steps,}); + RecipeLoadedState({ + this.recipeModelObj, + this.recipe, + this.author, + this.comments, + this.token, + this.commentController, + this.tags, + this.steps, + }); RecipeModel? recipeModelObj; Map? recipe; @@ -50,15 +51,16 @@ class RecipeLoadedState extends RecipeState { commentController, steps, ]; - RecipeLoadedState copyWith( - {RecipeModel? recipeModelObj, - Map? recipe, - Map? author, - TextEditingController? commentController, - String? token, - List? tags, - List? steps, - List? comments,}) { + RecipeLoadedState copyWith({ + RecipeModel? recipeModelObj, + Map? recipe, + Map? author, + TextEditingController? commentController, + String? token, + List? tags, + List? steps, + List? comments, + }) { return RecipeLoadedState( recipeModelObj: recipeModelObj ?? this.recipeModelObj, recipe: recipe ?? this.recipe, @@ -82,6 +84,5 @@ class RecipeErrorState extends RecipeState { } class RecipeInitialState extends RecipeState { - RecipeInitialState({required RecipeModel recipeModelObj}) - : super(recipeModelObj: recipeModelObj); + RecipeInitialState({required RecipeModel recipeModelObj}) : super(recipeModelObj: recipeModelObj); } diff --git a/lib/presentation/recipe/recipe_show_screen/recipe_show_screen.dart b/lib/presentation/recipe/recipe_show_screen/recipe_show_screen.dart index 30fd4e9d..c42813d4 100644 --- a/lib/presentation/recipe/recipe_show_screen/recipe_show_screen.dart +++ b/lib/presentation/recipe/recipe_show_screen/recipe_show_screen.dart @@ -1,15 +1,14 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/presentation/feed/blog_post_screen/widgets/comment_widget.dart'; +import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart'; +import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; +import 'package:intl/intl.dart'; import 'bloc/recipe_show_bloc.dart'; import 'models/recipe_show_model.dart'; -import 'package:eatvio_app/presentation/feed/blog_post_screen/widgets/comment_widget.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; -import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; class RecipeScreen extends StatelessWidget { const RecipeScreen({Key? key}) : super(key: key); @@ -17,8 +16,9 @@ class RecipeScreen extends StatelessWidget { static Widget builder(BuildContext context) { final recipeID = ModalRoute.of(context)!.settings.arguments; return BlocProvider( - create: (context) => RecipeBloc(RecipeState(recipeModelObj: RecipeModel(recipeID: recipeID.toString())))..add(RecipeInitialEvent()), - child: RecipeScreen(),); + create: (context) => RecipeBloc(RecipeState(recipeModelObj: RecipeModel(recipeID: recipeID.toString())))..add(RecipeInitialEvent()), + child: RecipeScreen(), + ); } Widget build(BuildContext context) { @@ -52,32 +52,33 @@ class RecipeScreen extends StatelessWidget { } } return Scaffold( - appBar: AppBar( - toolbarHeight: 0, - automaticallyImplyLeading: false, + appBar: AppBar( + toolbarHeight: 0, + automaticallyImplyLeading: false, + ), + resizeToAvoidBottomInset: false, + body: Container( + width: double.maxFinite, + decoration: AppDecoration.fillGray, + child: ListView( + children: [ + SizedBox(height: 15.v), + _buildHeaderRow(context, state), + SizedBox(height: 15.v), + _buildRecipeData(context, state), + SizedBox(height: 15.v), + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: steps, + ), + SizedBox(height: 15.v), + _buildTextField(context, state), + SizedBox(height: 15.v), + _buildCommentSection(context, state), + ], ), - resizeToAvoidBottomInset: false, - body: Container( - width: double.maxFinite, - decoration: AppDecoration.fillGray, - child: ListView( - children: [ - SizedBox(height: 15.v), - _buildHeaderRow(context, state), - SizedBox(height: 15.v), - _buildRecipeData(context, state), - SizedBox(height: 15.v), - Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: steps, - ), - SizedBox(height: 15.v), - _buildTextField(context, state), - SizedBox(height: 15.v), - _buildCommentSection(context, state), - ], - ), - ),); + ), + ); } _buildHeaderRow(BuildContext context, RecipeLoadedState state) { @@ -119,7 +120,7 @@ class RecipeScreen extends StatelessWidget { ), ), CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (state.author?['profile_photo_path'] ?? ''), + imageUrl: baseUrl + '/storage/' + (state.author?['profile_photo_path'] ?? ''), imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 25, @@ -159,75 +160,86 @@ class RecipeScreen extends StatelessWidget { ), ], ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - Row( - children: [ - Text( - state.recipe?['title'], - style: CustomTextStyles.titleMediumBlack, - ), - Spacer(), - PopupMenuButton( - onSelected: (value) => tapMenu(value, context, state), - itemBuilder: (BuildContext context) => >[ - PopupMenuItem( - value: 'edit', - child: Text('Редактировать'), - ), - PopupMenuItem( - value: 'delete', - child: Text('Удалить'), - ), - ], - ), - ], - ), - SizedBox(height: 8.0), - _buildImage(state), - SizedBox(height: 16.0), - Text( - state.recipe?['description'], - style: CustomTextStyles.bodyMediumBluegray800, - ), - SizedBox(height: 16.0), - Align( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + Text( + state.recipe?['title'], + style: CustomTextStyles.titleMediumBlack, + ), + Spacer(), + PopupMenuButton( + onSelected: (value) => tapMenu(value, context, state), + itemBuilder: (BuildContext context) => >[ + PopupMenuItem( + value: 'edit', + child: Text('Редактировать'), + ), + PopupMenuItem( + value: 'delete', + child: Text('Удалить'), + ), + ], + ), + ], + ), + SizedBox(height: 8.0), + _buildImage(state), + SizedBox(height: 16.0), + Text( + state.recipe?['description'], + style: CustomTextStyles.bodyMediumBluegray800, + ), + SizedBox(height: 16.0), + Align( alignment: Alignment.topLeft, child: Text( DateFormat('dd.MM.yyyy').format(DateTime.parse(state.recipe?['updated_at'])), style: theme.textTheme.bodyMedium, - ),), - SizedBox(height: 16.0), - _buildTags(state.tags), - SizedBox(height: 16.0), - Row(children: [ - Padding( - padding: EdgeInsets.only(left: 24), - child: Row(children: [ - Padding( - padding: EdgeInsets.only(right: 8), - child: Icon(Icons.favorite_outline), - ), - Text( - "Нравится", - style: CustomTextStyles.titleMediumSemiBold, - ), - ],), + ), ), - Spacer(), - Padding( - padding: EdgeInsets.only(right: 24), - child: Row(children: [ - Padding( - padding: const EdgeInsets.only(right: 8), - child: Icon(Icons.share_outlined), + SizedBox(height: 16.0), + _buildTags(state.tags), + SizedBox(height: 16.0), + Row( + children: [ + Padding( + padding: EdgeInsets.only(left: 24), + child: Row( + children: [ + Padding( + padding: EdgeInsets.only(right: 8), + child: Icon(Icons.favorite_outline), + ), + Text( + "Нравится", + style: CustomTextStyles.titleMediumSemiBold, + ), + ], ), - Text( - "Поделиться", - style: CustomTextStyles.titleMediumSemiBold, + ), + Spacer(), + Padding( + padding: EdgeInsets.only(right: 24), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 8), + child: Icon(Icons.share_outlined), + ), + Text( + "Поделиться", + style: CustomTextStyles.titleMediumSemiBold, + ), + ], ), - ],),), - ],), - ],), + ), + ], + ), + ], + ), ); } @@ -245,7 +257,7 @@ class RecipeScreen extends StatelessWidget { _buildImage(RecipeLoadedState state) { return CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (state.recipe?['image'] ?? ''), + imageUrl: baseUrl + '/storage/' + (state.recipe?['image'] ?? ''), imageBuilder: (context, imageProvider) => Stack( children: [ ClipRRect( @@ -431,28 +443,31 @@ class RecipeScreen extends StatelessWidget { ), ], ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - Align( - alignment: Alignment.centerLeft, - child: Text( - "Шаг ${i + 1}", - style: CustomTextStyles.titleMediumSemiBold, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Align( + alignment: Alignment.centerLeft, + child: Text( + "Шаг ${i + 1}", + style: CustomTextStyles.titleMediumSemiBold, + ), ), - ), - SizedBox(height: 16.0), - CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + (state.steps?[i]['image']), - width: double.infinity, - // Установите ширину равной ширине родительского элемента - height: 200.0, - // Задайте постоянную высоту элемента - fit: BoxFit.cover, - placeholder: (context, url) => CircularProgressIndicator(), - errorWidget: (context, url, error) => Icon(Icons.error), - ), - SizedBox(height: 16.0), - Text(state.steps?[i]['description']), - ],), + SizedBox(height: 16.0), + CachedNetworkImage( + imageUrl: baseUrl + '/storage/' + (state.steps?[i]['image']), + width: double.infinity, + // Установите ширину равной ширине родительского элемента + height: 200.0, + // Задайте постоянную высоту элемента + fit: BoxFit.cover, + placeholder: (context, url) => CircularProgressIndicator(), + errorWidget: (context, url, error) => Icon(Icons.error), + ), + SizedBox(height: 16.0), + Text(state.steps?[i]['description']), + ], + ), ); } } diff --git a/lib/presentation/recipe/recipe_show_screen/widgets/comment_widget.dart b/lib/presentation/recipe/recipe_show_screen/widgets/comment_widget.dart index ab177fa1..ed2e075c 100644 --- a/lib/presentation/recipe/recipe_show_screen/widgets/comment_widget.dart +++ b/lib/presentation/recipe/recipe_show_screen/widgets/comment_widget.dart @@ -1,10 +1,9 @@ // ignore_for_file: must_be_immutable -import 'package:flutter/material.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:cached_network_image/cached_network_image.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/presentation/feed/blog_post_screen/models/comment_model.dart'; -import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; class CommentWidget extends StatelessWidget { CommentWidget(this.commentModelObj, {Key? key}) @@ -36,13 +35,11 @@ class CommentWidget extends StatelessWidget { ], ), child: Row( - mainAxisAlignment: MainAxisAlignment - .spaceBetween, // Move the main axis alignment to space between - crossAxisAlignment: - CrossAxisAlignment.center, // Center the items vertically + mainAxisAlignment: MainAxisAlignment.spaceBetween, // Move the main axis alignment to space between + crossAxisAlignment: CrossAxisAlignment.center, // Center the items vertically children: [ CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + commentModelObj.userImage!, + imageUrl: baseUrl + '/storage/' + commentModelObj.userImage!, imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 25, @@ -69,10 +66,7 @@ class CommentWidget extends StatelessWidget { child: Row( children: [ Text( - commentModelObj.username!.length <= 15 - ? commentModelObj.username! - : commentModelObj.username!.substring(0, 15) + - '...', + commentModelObj.username!.length <= 15 ? commentModelObj.username! : commentModelObj.username!.substring(0, 15) + '...', style: theme.textTheme.titleMedium, ), Spacer(), @@ -96,10 +90,11 @@ class CommentWidget extends StatelessWidget { ), ), CustomImageView( - imagePath: ImageConstant.imgSend, - height: 30.v, - width: 30.h, - margin: EdgeInsets.only(left: 5),), + imagePath: ImageConstant.imgSend, + height: 30.v, + width: 30.h, + margin: EdgeInsets.only(left: 5), + ), ], ), ); diff --git a/lib/presentation/users/subscribers_screen/bloc/subscribers_bloc.dart b/lib/presentation/users/subscribers_screen/bloc/subscribers_bloc.dart index 1bb1bcf6..a48d6198 100644 --- a/lib/presentation/users/subscribers_screen/bloc/subscribers_bloc.dart +++ b/lib/presentation/users/subscribers_screen/bloc/subscribers_bloc.dart @@ -1,16 +1,16 @@ //import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart'; import 'dart:async'; +import 'dart:convert'; import 'package:eatvio_app/app_router.dart'; +import 'package:eatvio_app/presentation/users/subscribers_screen/models/subscribers_model.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/users/subscribers_screen/models/subscribers_model.dart'; -import 'package:http/http.dart' as http; -import 'dart:convert'; -import 'package:hive/hive.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:go_router/go_router.dart'; +import 'package:hive/hive.dart'; +import 'package:http/http.dart' as http; + +import '/core/app_export.dart'; part 'subscribers_event.dart'; part 'subscribers_state.dart'; @@ -32,7 +32,7 @@ class SubscribersBloc extends Bloc { AppRouter.navigatorKey.currentContext?.goNamed('authScreen'); } final response = await http.get( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/subscribers'), + Uri.parse(baseUrl + '/api/profile/subscribers'), headers: { 'Authorization': 'Bearer $token', }, diff --git a/lib/presentation/users/subscribers_screen/bloc/subscribers_state.dart b/lib/presentation/users/subscribers_screen/bloc/subscribers_state.dart index 151e0625..f934270d 100644 --- a/lib/presentation/users/subscribers_screen/bloc/subscribers_state.dart +++ b/lib/presentation/users/subscribers_screen/bloc/subscribers_state.dart @@ -12,14 +12,12 @@ class SubscribersState extends Equatable { } class SubscribersInitialState extends SubscribersState { - SubscribersInitialState({required SubscribersModel myProfileModelObj}) - : super(myProfileModelObj: myProfileModelObj); + SubscribersInitialState({required SubscribersModel myProfileModelObj}) : super(myProfileModelObj: myProfileModelObj); } /// Represents the state of Subscribers in the application. class SubscribersLoadedState extends SubscribersState { - SubscribersLoadedState({this.myProfileModelObj, this.subscribers}) - : super(myProfileModelObj: null); + SubscribersLoadedState({this.myProfileModelObj, this.subscribers}) : super(myProfileModelObj: null); SubscribersModel? myProfileModelObj; dynamic subscribers; diff --git a/lib/presentation/users/subscribers_screen/subscribers_screen.dart b/lib/presentation/users/subscribers_screen/subscribers_screen.dart index f2ac7e15..01fb9a7f 100644 --- a/lib/presentation/users/subscribers_screen/subscribers_screen.dart +++ b/lib/presentation/users/subscribers_screen/subscribers_screen.dart @@ -1,23 +1,20 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/presentation/feed/feed_screen/widgets/feed_search_view.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; +import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; +import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; +import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'bloc/subscribers_bloc.dart'; import 'models/subscribers_model.dart'; -import 'package:eatvio_app/core/app_export.dart'; -import 'package:eatvio_app/presentation/feed/feed_screen/widgets/feed_search_view.dart'; -import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; -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_outlined_button.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:flutter/material.dart'; class SubscribersScreen extends StatelessWidget { static Widget builder(BuildContext context) { return BlocProvider( - create: (context) => SubscribersBloc( - SubscribersState(myProfileModelObj: SubscribersModel())) - ..add(SubscribersInitialEvent()), + create: (context) => SubscribersBloc(SubscribersState(myProfileModelObj: SubscribersModel()))..add(SubscribersInitialEvent()), child: SubscribersScreen()); } @@ -73,8 +70,7 @@ class SubscribersScreen extends StatelessWidget { leadingWidth: 28.h, leading: AppbarLeadingImage( imagePath: ImageConstant.imgArrowLeft, - margin: - EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), + margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: () => GoRouter.of(context).pop(), ), title: Padding( @@ -83,14 +79,12 @@ class SubscribersScreen extends StatelessWidget { children: [ AppbarSubtitle( text: "Мои подписчики", - margin: EdgeInsets.only( - left: 80.h, top: 12.v, bottom: 9.v), + margin: EdgeInsets.only(left: 80.h, top: 12.v, bottom: 9.v), ), Spacer(), Padding( padding: const EdgeInsets.only(right: 20.0), - child: GestureDetector( - child: Icon(Icons.create_outlined)), + child: GestureDetector(child: Icon(Icons.create_outlined)), ) ], ), @@ -145,8 +139,7 @@ class SubscribersScreen extends StatelessWidget { flex: 1, child: CustomOutlinedButton( text: "+", - onPressed: () => - GoRouter.of(context).goNamed('blogPostCreateScreen'), + onPressed: () => GoRouter.of(context).goNamed('blogPostCreateScreen'), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, ), ), @@ -190,7 +183,7 @@ class SubscribersScreen extends StatelessWidget { ), child: ListTile( leading: CachedNetworkImage( - imageUrl: dotenv.env['STORAGE_URL']! + subscriber['image'], + imageUrl: baseUrl + '/storage/' + subscriber['image'], imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 25, diff --git a/lib/theme/app_decoration.dart b/lib/theme/app_decoration.dart index f304e54d..9ba1b22f 100644 --- a/lib/theme/app_decoration.dart +++ b/lib/theme/app_decoration.dart @@ -1,5 +1,5 @@ -import 'package:flutter/material.dart'; import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; class AppDecoration { // Fill decorations diff --git a/lib/theme/bloc/theme_bloc.dart b/lib/theme/bloc/theme_bloc.dart index 60f947d2..ae2863bd 100644 --- a/lib/theme/bloc/theme_bloc.dart +++ b/lib/theme/bloc/theme_bloc.dart @@ -1,6 +1,8 @@ import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; + import '../../core/app_export.dart'; + part 'theme_event.dart'; part 'theme_state.dart'; diff --git a/lib/theme/custom_text_style.dart b/lib/theme/custom_text_style.dart index de3bee78..1ed606cd 100644 --- a/lib/theme/custom_text_style.dart +++ b/lib/theme/custom_text_style.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; + import '../core/app_export.dart'; /// A collection of pre-defined text styles for customizing text appearance, diff --git a/lib/theme/theme_helper.dart b/lib/theme/theme_helper.dart index f9f64aa5..e202a868 100644 --- a/lib/theme/theme_helper.dart +++ b/lib/theme/theme_helper.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; + import '../../core/app_export.dart'; /// Helper class for managing themes and colors. diff --git a/lib/widgets/chart_axis.dart b/lib/widgets/chart_axis.dart index 5cc64480..f137c6d3 100644 --- a/lib/widgets/chart_axis.dart +++ b/lib/widgets/chart_axis.dart @@ -142,4 +142,4 @@ buildChart( ), ); } -*/ \ No newline at end of file +*/ diff --git a/lib/widgets/chart_bars.dart b/lib/widgets/chart_bars.dart index 7f4fc342..eac9e99c 100644 --- a/lib/widgets/chart_bars.dart +++ b/lib/widgets/chart_bars.dart @@ -76,4 +76,4 @@ class MyApp extends StatelessWidget { ); } } -*/ \ No newline at end of file +*/ diff --git a/lib/widgets/custom_about_list.dart b/lib/widgets/custom_about_list.dart index 4b4e709f..90b1d3d0 100644 --- a/lib/widgets/custom_about_list.dart +++ b/lib/widgets/custom_about_list.dart @@ -26,9 +26,10 @@ class _AboutListState extends State { Text( widget.title, style: TextStyle( - color: Colors.black, - fontSize: 14, - fontWeight: FontWeight.bold,), + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), Icon(isExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down), ], @@ -38,8 +39,9 @@ class _AboutListState extends State { Padding( padding: const EdgeInsets.only(left: 16.0), child: Column( - //children: widget.items.map((item) => Text(item)).toList(), - children: [Text(widget.items.join('\n'))],), + //children: widget.items.map((item) => Text(item)).toList(), + children: [Text(widget.items.join('\n'))], + ), ), Divider(), ], diff --git a/lib/widgets/custom_expandable_list.dart b/lib/widgets/custom_expandable_list.dart index 79d62d1b..a98dd33d 100644 --- a/lib/widgets/custom_expandable_list.dart +++ b/lib/widgets/custom_expandable_list.dart @@ -1,16 +1,16 @@ -import 'package:flutter/material.dart'; +import 'dart:convert'; + import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart'; import 'package:eatvio_app/widgets/custom_hyper_switch.dart'; import 'package:eatvio_app/widgets/custom_hypo_switch.dart'; -import 'package:go_router/go_router.dart'; -import 'package:intl/intl.dart'; import 'package:eatvio_app/widgets/next_step_button.dart'; -import 'dart:convert'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; -import 'package:hive/hive.dart'; +import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:go_router/go_router.dart'; +import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; +import 'package:intl/intl.dart'; class ExpandableList extends StatefulWidget { final String title; @@ -37,9 +37,10 @@ class _ExpandableListState extends State { Text( widget.title, style: TextStyle( - color: Colors.black, - fontSize: 14, - fontWeight: FontWeight.bold,), + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), Icon(isExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down), ], @@ -49,24 +50,25 @@ class _ExpandableListState extends State { Padding( padding: const EdgeInsets.only(left: 16.0), child: BlocBuilder( - builder: (context, state) { - if (state is MyProfileInitialState) { - // Это начальное состояние, данные ещё не загружены. - return CircularProgressIndicator( - color: Colors.white, - backgroundColor: Colors.white, - ); - } else if (state is MyProfileLoadedState) { - // Данные загружены, можно строить форму. - return _buildForm(context, state); - } else if (state is MyProfileErrorState) { - // Произошла ошибка при загрузке данных. - return Center(child: Text(state.errorMessage)); - } else { - // Другие состояния, если они есть. - return Container(); // Пустой контейнер для необработанных состояний. - } - },), + builder: (context, state) { + if (state is MyProfileInitialState) { + // Это начальное состояние, данные ещё не загружены. + return CircularProgressIndicator( + color: Colors.white, + backgroundColor: Colors.white, + ); + } else if (state is MyProfileLoadedState) { + // Данные загружены, можно строить форму. + return _buildForm(context, state); + } else if (state is MyProfileErrorState) { + // Произошла ошибка при загрузке данных. + return Center(child: Text(state.errorMessage)); + } else { + // Другие состояния, если они есть. + return Container(); // Пустой контейнер для необработанных состояний. + } + }, + ), ), Divider(), ], @@ -125,142 +127,152 @@ class _ExpandableListState extends State { 'экстремальный (несколько интенсивных тренировок в день)', ]; final digitsOnly = FilteringTextInputFormatter.digitsOnly; - return Column(children: [ - TextField( - controller: state.firstNameFormController, - decoration: InputDecoration(labelText: 'first_name'.tr), - ), - TextField( - controller: state.lastNameFormController, - decoration: InputDecoration(labelText: 'last_name'.tr), - ), - TextField( + return Column( + children: [ + TextField( + controller: state.firstNameFormController, + decoration: InputDecoration(labelText: 'first_name'.tr), + ), + TextField( + controller: state.lastNameFormController, + decoration: InputDecoration(labelText: 'last_name'.tr), + ), + TextField( decoration: InputDecoration(labelText: 'date_of_birth'.tr), controller: state.dateFormController, - onTap: inputTime(context, state),), - DropdownButtonFormField( - value: state.selectedCountry, - hint: Text(state.selectedCountry ?? "Не выбрано"), - onChanged: setCountry(state), - items: countries.map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - decoration: InputDecoration(labelText: 'country'.tr), - ), - DropdownButtonFormField( - hint: Text(state.selectedCity ?? "Не выбрано"), - value: state.selectedCity, - onChanged: setCity(state), - items: cities.map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - decoration: InputDecoration(labelText: 'city_of_living'.tr), - ), - TextField( + onTap: inputTime(context, state), + ), + DropdownButtonFormField( + value: state.selectedCountry, + hint: Text(state.selectedCountry ?? "Не выбрано"), + onChanged: setCountry(state), + items: countries.map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + decoration: InputDecoration(labelText: 'country'.tr), + ), + DropdownButtonFormField( + hint: Text(state.selectedCity ?? "Не выбрано"), + value: state.selectedCity, + onChanged: setCity(state), + items: cities.map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + decoration: InputDecoration(labelText: 'city_of_living'.tr), + ), + TextField( controller: state.weightFormController, decoration: InputDecoration(labelText: 'weight_measurements'.tr), keyboardType: TextInputType.number, - inputFormatters: [digitsOnly],), - TextField( + inputFormatters: [digitsOnly], + ), + TextField( controller: state.heightFormController, decoration: InputDecoration(labelText: 'height_measurements'.tr), keyboardType: TextInputType.number, - inputFormatters: [digitsOnly],), - TextField( + inputFormatters: [digitsOnly], + ), + TextField( controller: state.chestCircumferenceFormController, decoration: InputDecoration(labelText: 'chest_circumference'.tr), keyboardType: TextInputType.number, - inputFormatters: [digitsOnly],), - TextField( + inputFormatters: [digitsOnly], + ), + TextField( controller: state.waistCircumferenceFormController, decoration: InputDecoration(labelText: 'waist_circumference'.tr), keyboardType: TextInputType.number, - inputFormatters: [digitsOnly],), - TextField( + inputFormatters: [digitsOnly], + ), + TextField( controller: state.hipCircumferenceFormController, decoration: InputDecoration(labelText: 'hip_circumference'.tr), keyboardType: TextInputType.number, - inputFormatters: [digitsOnly],), - TextField( + inputFormatters: [digitsOnly], + ), + TextField( controller: state.upPressureFormController, decoration: InputDecoration(labelText: 'up_pressure'.tr), keyboardType: TextInputType.number, - inputFormatters: [digitsOnly],), - TextField( + inputFormatters: [digitsOnly], + ), + TextField( controller: state.downPressureFormController, decoration: InputDecoration(labelText: 'down_pressure'.tr), keyboardType: TextInputType.number, - inputFormatters: [digitsOnly],), - TextField( - controller: state.allergiesFormController, - decoration: InputDecoration(labelText: 'allergies_presence'.tr), - maxLines: null, - ), - TextField( - controller: state.pillsFormController, - decoration: InputDecoration(labelText: 'do_you_take_pills'.tr), - maxLines: null, - ), - TextField( - controller: state.sportsFormController, - decoration: InputDecoration(labelText: 'your_favorite_sports'.tr), - maxLines: null, - ), - TextField( - controller: state.favoriteFormController, - decoration: InputDecoration(labelText: 'favorite_foods'.tr), - maxLines: null, - ), - TextField( - controller: state.unfavoriteFormController, - decoration: InputDecoration(labelText: 'unfavorite_foods'.tr), - maxLines: null, - ), - TextField( - controller: state.additionalFormController, - decoration: InputDecoration(labelText: 'additional_information'.tr), - maxLines: null, - ), - DropdownButtonFormField( - hint: Text(state.selectedActivity ?? "Не выбрано"), - value: state.selectedActivity, - onChanged: setActivity(state), - items: activities.map>((String value) { - return DropdownMenuItem( - value: value, - child: SizedBox( - // Используем SizedBox для ограничения ширины элемента списка - width: MediaQuery.of(context).size.width * - 0.8, // Устанавливаем желаемую ширину элемента списка - child: Text(value), - ), - ); - }).toList(), - isExpanded: true, // Расширяем список на всю доступную ширину - decoration: InputDecoration(labelText: 'Активность'), - ), - Row( - children: [ - HypoSwitch('do_you_have_hypotension_tendency'.tr, state), - ], - ), - Row( - children: [ - HyperSwitch('do_you_have_hypertension_tendency'.tr, state), - ], - ), - NextStepButton( + inputFormatters: [digitsOnly], + ), + TextField( + controller: state.allergiesFormController, + decoration: InputDecoration(labelText: 'allergies_presence'.tr), + maxLines: null, + ), + TextField( + controller: state.pillsFormController, + decoration: InputDecoration(labelText: 'do_you_take_pills'.tr), + maxLines: null, + ), + TextField( + controller: state.sportsFormController, + decoration: InputDecoration(labelText: 'your_favorite_sports'.tr), + maxLines: null, + ), + TextField( + controller: state.favoriteFormController, + decoration: InputDecoration(labelText: 'favorite_foods'.tr), + maxLines: null, + ), + TextField( + controller: state.unfavoriteFormController, + decoration: InputDecoration(labelText: 'unfavorite_foods'.tr), + maxLines: null, + ), + TextField( + controller: state.additionalFormController, + decoration: InputDecoration(labelText: 'additional_information'.tr), + maxLines: null, + ), + DropdownButtonFormField( + hint: Text(state.selectedActivity ?? "Не выбрано"), + value: state.selectedActivity, + onChanged: setActivity(state), + items: activities.map>((String value) { + return DropdownMenuItem( + value: value, + child: SizedBox( + // Используем SizedBox для ограничения ширины элемента списка + width: MediaQuery.of(context).size.width * 0.8, // Устанавливаем желаемую ширину элемента списка + child: Text(value), + ), + ); + }).toList(), + isExpanded: true, // Расширяем список на всю доступную ширину + decoration: InputDecoration(labelText: 'Активность'), + ), + Row( + children: [ + HypoSwitch('do_you_have_hypotension_tendency'.tr, state), + ], + ), + Row( + children: [ + HyperSwitch('do_you_have_hypertension_tendency'.tr, state), + ], + ), + NextStepButton( onPressed: () => sendProfileData(state), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, text: "save".tr.toUpperCase(), - margin: EdgeInsets.only(top: 20.h, bottom: 20.h),), - ],); + margin: EdgeInsets.only(top: 20.h, bottom: 20.h), + ), + ], + ); } sendData(MyProfileLoadedState state) { @@ -300,8 +312,7 @@ class _ExpandableListState extends State { ).then((selectedDate) { if (selectedDate != null) { setState(() { - state.dateFormController!.text = - DateFormat('dd-MM-yyyy').format(selectedDate); + state.dateFormController!.text = DateFormat('dd-MM-yyyy').format(selectedDate); }); } }); @@ -367,8 +378,7 @@ class _ExpandableListState extends State { 'city': state?.selectedCity ?? 'Москва', 'has_hypo': state?.hypoFormController, 'has_hyper': state?.hyperFormController, - 'activity_coefficient': - determineActivityFactor(state?.selectedActivity ?? 'сидячий'), + 'activity_coefficient': determineActivityFactor(state?.selectedActivity ?? 'сидячий'), }; } @@ -378,11 +388,14 @@ class _ExpandableListState extends State { } String _buildApiUrl() { - return dotenv.env['SERVER_ROOT']! + '/profile/update'; + return baseUrl + '/api/profile/update'; } Future _sendHttpRequest( - Map profileData, String apiUrl, String? token,) { + Map profileData, + String apiUrl, + String? token, + ) { return http.post( Uri.parse(apiUrl), body: json.encode(profileData), diff --git a/lib/widgets/custom_hyper_switch.dart b/lib/widgets/custom_hyper_switch.dart index e25c462b..edad8ec6 100644 --- a/lib/widgets/custom_hyper_switch.dart +++ b/lib/widgets/custom_hyper_switch.dart @@ -1,6 +1,6 @@ -import 'package:flutter/material.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart'; +import 'package:flutter/material.dart'; class HyperSwitch extends StatefulWidget { final String title; @@ -30,7 +30,10 @@ class _HyperState extends State { Text( widget.title, style: TextStyle( - color: Colors.black, fontSize: 14, fontWeight: FontWeight.bold,), + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), Switch( value: switchValue, diff --git a/lib/widgets/custom_hypo_switch.dart b/lib/widgets/custom_hypo_switch.dart index 173de64a..2e0c511b 100644 --- a/lib/widgets/custom_hypo_switch.dart +++ b/lib/widgets/custom_hypo_switch.dart @@ -1,6 +1,6 @@ -import 'package:flutter/material.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart'; +import 'package:flutter/material.dart'; class HypoSwitch extends StatefulWidget { final String title; @@ -30,7 +30,10 @@ class _HypoState extends State { Text( widget.title, style: TextStyle( - color: Colors.black, fontSize: 14, fontWeight: FontWeight.bold,), + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), Switch( value: switchValue, diff --git a/lib/widgets/custom_icon_button.dart b/lib/widgets/custom_icon_button.dart index 2937b5a1..d029004a 100644 --- a/lib/widgets/custom_icon_button.dart +++ b/lib/widgets/custom_icon_button.dart @@ -45,7 +45,8 @@ class CustomIconButton extends StatelessWidget { color: Colors.black, borderRadius: const BorderRadius.all(Radius.circular(9)), border: const Border.fromBorderSide( - BorderSide(color: Colors.blueGrey, width: 1),), + BorderSide(color: Colors.blueGrey, width: 1), + ), ), child: child, ), diff --git a/lib/widgets/custom_navigation_menu.dart b/lib/widgets/custom_navigation_menu.dart index 03d11a98..5868bf01 100644 --- a/lib/widgets/custom_navigation_menu.dart +++ b/lib/widgets/custom_navigation_menu.dart @@ -1,9 +1,8 @@ import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; import 'package:eatvio_app/widgets/custom_navigation_menu_item.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:hive/hive.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:http/http.dart' as http; class CustomNavigationMenu extends StatelessWidget { @@ -66,7 +65,7 @@ _onTapLogout(BuildContext context) { final box = await Hive.openBox('token'); final token = box.get('token'); final response = await http.post( - Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/logout'), + Uri.parse(baseUrl + '/api/profile/logout'), headers: { 'Authorization': 'Bearer $token', }, diff --git a/lib/widgets/custom_navigation_menu_item.dart b/lib/widgets/custom_navigation_menu_item.dart index 9d7d1618..44850fa3 100644 --- a/lib/widgets/custom_navigation_menu_item.dart +++ b/lib/widgets/custom_navigation_menu_item.dart @@ -1,6 +1,6 @@ import 'package:eatvio_app/core/app_export.dart'; -import 'package:flutter/material.dart'; import 'package:eatvio_app/widgets/custom_image_view.dart'; +import 'package:flutter/material.dart'; class MenuItem extends StatelessWidget { final String icon; diff --git a/lib/widgets/custom_notification_screen.dart b/lib/widgets/custom_notification_screen.dart index 960293c3..72fd860b 100644 --- a/lib/widgets/custom_notification_screen.dart +++ b/lib/widgets/custom_notification_screen.dart @@ -1,5 +1,5 @@ -import 'package:flutter/material.dart'; import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; class NotificationSwitch extends StatefulWidget { final String title; @@ -21,7 +21,10 @@ class _NotificationSwitchState extends State { Text( widget.title, style: TextStyle( - color: Colors.black, fontSize: 14, fontWeight: FontWeight.bold,), + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), Switch( value: switchValue, diff --git a/lib/widgets/custom_text_form_field.dart b/lib/widgets/custom_text_form_field.dart index 3d061e91..862cc104 100644 --- a/lib/widgets/custom_text_form_field.dart +++ b/lib/widgets/custom_text_form_field.dart @@ -181,7 +181,7 @@ class CustomTextFormField extends StatelessWidget { ); } } - /* InputDecoration _buildInputDecoration() { +/* InputDecoration _buildInputDecoration() { return InputDecoration( hintText: hintText ?? "", hintStyle: hintStyle ?? theme.textTheme.bodyLarge, diff --git a/pubspec.yaml b/pubspec.yaml index 36031fcd..2cdbe598 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -27,7 +27,6 @@ dependencies: path_provider: ^2.1.3 fl_chart: ^0.68.0 flutter_spinkit: ^5.2.1 - flutter_dotenv: ^5.1.0 carousel_slider: ^4.2.1 flutter_form_builder: ^9.3.0 image_picker: ^1.1.2 @@ -59,5 +58,4 @@ flutter: uses-material-design: true assets: - assets/ - - assets/images/ - - .env \ No newline at end of file + - assets/images/ \ No newline at end of file From fc58ec60421a49e154d5a84467cf9824cc48ef9d Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 15 Jul 2024 17:34:04 +0300 Subject: [PATCH 21/21] feature(registration): iter 7 --- .../initialization_state.freezed.dart | 90 +++++++--- .../selection_popup_model.freezed.dart | 43 +++-- .../user_registration_model.freezed.dart | 120 ++++++++----- .../user_registration_model.g.dart | 11 +- .../models/blog_post_model.freezed.dart | 58 +++++-- .../blog_post/models/blog_post_model.g.dart | 6 +- .../bloc/blog_post_state.freezed.dart | 82 ++++++--- .../services/blog_post_service.g.dart | 29 ++-- .../services/blog_service.g.dart | 32 ++-- .../new_messages_state.freezed.dart | 86 +++++++--- .../notifications_state.freezed.dart | 89 +++++++--- .../models/chat_message_model.freezed.dart | 59 ++++--- .../chat/models/chat_message_model.g.dart | 8 +- .../models/chat_messages_model.freezed.dart | 62 +++++-- .../chat/models/chat_messages_model.g.dart | 12 +- .../chat/models/chat_meta_model.freezed.dart | 49 ++++-- .../chat/models/chat_meta_model.g.dart | 6 +- .../chat/models/chat_room_model.freezed.dart | 68 +++++--- .../chat/models/chat_room_model.g.dart | 12 +- .../chat_room_settings_model.freezed.dart | 65 ++++--- .../models/chat_room_settings_model.g.dart | 8 +- .../chat/models/chat_user_model.freezed.dart | 67 +++++--- .../chat/models/chat_user_model.g.dart | 6 +- .../models/websocket_info_model.freezed.dart | 68 +++++--- .../chat/models/websocket_info_model.g.dart | 8 +- .../chat_room_state.freezed.dart | 161 +++++++++++++----- .../chat/services/chat_service.g.dart | 82 ++++----- .../diary/models/diary_model.freezed.dart | 58 +++++-- lib/features/diary/models/diary_model.g.dart | 10 +- .../models/feed_blog_post_model.freezed.dart | 51 ++++-- .../feed/models/feed_blog_post_model.g.dart | 8 +- ...feed_blog_post_settings_model.freezed.dart | 63 ++++--- .../feed_blog_post_settings_model.g.dart | 12 +- .../bloc/feed_cubit/feed_state.freezed.dart | 95 ++++++++--- .../feed/services/feed_service.g.dart | 29 ++-- .../registration_cubit.dart | 12 +- .../registration_state.freezed.dart | 37 ++-- .../pages/registration_screen.dart | 32 +++- .../repositories/registration_repository.dart | 4 +- .../services/registration_service.dart | 2 +- .../services/registration_service.g.dart | 34 ++-- 41 files changed, 1264 insertions(+), 570 deletions(-) diff --git a/lib/core/initialization_cubit/initialization_state.freezed.dart b/lib/core/initialization_cubit/initialization_state.freezed.dart index b5e8e4dd..3364e440 100644 --- a/lib/core/initialization_cubit/initialization_state.freezed.dart +++ b/lib/core/initialization_cubit/initialization_state.freezed.dart @@ -70,12 +70,14 @@ mixin _$InitializationState { /// @nodoc abstract class $InitializationStateCopyWith<$Res> { - factory $InitializationStateCopyWith(InitializationState value, $Res Function(InitializationState) then) = + factory $InitializationStateCopyWith( + InitializationState value, $Res Function(InitializationState) then) = _$InitializationStateCopyWithImpl<$Res, InitializationState>; } /// @nodoc -class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState> implements $InitializationStateCopyWith<$Res> { +class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState> + implements $InitializationStateCopyWith<$Res> { _$InitializationStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -86,14 +88,18 @@ class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState> /// @nodoc abstract class _$$InitializationStateImplCopyWith<$Res> { - factory _$$InitializationStateImplCopyWith(_$InitializationStateImpl value, $Res Function(_$InitializationStateImpl) then) = + factory _$$InitializationStateImplCopyWith(_$InitializationStateImpl value, + $Res Function(_$InitializationStateImpl) then) = __$$InitializationStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$InitializationStateImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateImpl> +class __$$InitializationStateImplCopyWithImpl<$Res> + extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateImpl> implements _$$InitializationStateImplCopyWith<$Res> { - __$$InitializationStateImplCopyWithImpl(_$InitializationStateImpl _value, $Res Function(_$InitializationStateImpl) _then) : super(_value, _then); + __$$InitializationStateImplCopyWithImpl(_$InitializationStateImpl _value, + $Res Function(_$InitializationStateImpl) _then) + : super(_value, _then); } /// @nodoc @@ -108,7 +114,9 @@ class _$InitializationStateImpl implements _InitializationState { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$InitializationStateImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InitializationStateImpl); } @override @@ -195,14 +203,20 @@ abstract class _InitializationState implements InitializationState { /// @nodoc abstract class _$$InitializationStateLoadingImplCopyWith<$Res> { - factory _$$InitializationStateLoadingImplCopyWith(_$InitializationStateLoadingImpl value, $Res Function(_$InitializationStateLoadingImpl) then) = + factory _$$InitializationStateLoadingImplCopyWith( + _$InitializationStateLoadingImpl value, + $Res Function(_$InitializationStateLoadingImpl) then) = __$$InitializationStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc -class __$$InitializationStateLoadingImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateLoadingImpl> +class __$$InitializationStateLoadingImplCopyWithImpl<$Res> + extends _$InitializationStateCopyWithImpl<$Res, + _$InitializationStateLoadingImpl> implements _$$InitializationStateLoadingImplCopyWith<$Res> { - __$$InitializationStateLoadingImplCopyWithImpl(_$InitializationStateLoadingImpl _value, $Res Function(_$InitializationStateLoadingImpl) _then) + __$$InitializationStateLoadingImplCopyWithImpl( + _$InitializationStateLoadingImpl _value, + $Res Function(_$InitializationStateLoadingImpl) _then) : super(_value, _then); } @@ -218,7 +232,9 @@ class _$InitializationStateLoadingImpl implements InitializationStateLoading { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$InitializationStateLoadingImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InitializationStateLoadingImpl); } @override @@ -305,16 +321,22 @@ abstract class InitializationStateLoading implements InitializationState { /// @nodoc abstract class _$$InitializationStateSuccessImplCopyWith<$Res> { - factory _$$InitializationStateSuccessImplCopyWith(_$InitializationStateSuccessImpl value, $Res Function(_$InitializationStateSuccessImpl) then) = + factory _$$InitializationStateSuccessImplCopyWith( + _$InitializationStateSuccessImpl value, + $Res Function(_$InitializationStateSuccessImpl) then) = __$$InitializationStateSuccessImplCopyWithImpl<$Res>; @useResult $Res call({PusherChannelsClient client}); } /// @nodoc -class __$$InitializationStateSuccessImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateSuccessImpl> +class __$$InitializationStateSuccessImplCopyWithImpl<$Res> + extends _$InitializationStateCopyWithImpl<$Res, + _$InitializationStateSuccessImpl> implements _$$InitializationStateSuccessImplCopyWith<$Res> { - __$$InitializationStateSuccessImplCopyWithImpl(_$InitializationStateSuccessImpl _value, $Res Function(_$InitializationStateSuccessImpl) _then) + __$$InitializationStateSuccessImplCopyWithImpl( + _$InitializationStateSuccessImpl _value, + $Res Function(_$InitializationStateSuccessImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -347,7 +369,9 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess { @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$InitializationStateSuccessImpl && (identical(other.client, client) || other.client == client)); + (other.runtimeType == runtimeType && + other is _$InitializationStateSuccessImpl && + (identical(other.client, client) || other.client == client)); } @override @@ -356,8 +380,9 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> get copyWith => - __$$InitializationStateSuccessImplCopyWithImpl<_$InitializationStateSuccessImpl>(this, _$identity); + _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> + get copyWith => __$$InitializationStateSuccessImplCopyWithImpl< + _$InitializationStateSuccessImpl>(this, _$identity); @override @optionalTypeArgs @@ -435,25 +460,34 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess { } abstract class InitializationStateSuccess implements InitializationState { - const factory InitializationStateSuccess({required final PusherChannelsClient client}) = _$InitializationStateSuccessImpl; + const factory InitializationStateSuccess( + {required final PusherChannelsClient client}) = + _$InitializationStateSuccessImpl; PusherChannelsClient get client; @JsonKey(ignore: true) - _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> get copyWith => throw _privateConstructorUsedError; + _$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$InitializationStateErrorImplCopyWith<$Res> { - factory _$$InitializationStateErrorImplCopyWith(_$InitializationStateErrorImpl value, $Res Function(_$InitializationStateErrorImpl) then) = + factory _$$InitializationStateErrorImplCopyWith( + _$InitializationStateErrorImpl value, + $Res Function(_$InitializationStateErrorImpl) then) = __$$InitializationStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$InitializationStateErrorImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateErrorImpl> +class __$$InitializationStateErrorImplCopyWithImpl<$Res> + extends _$InitializationStateCopyWithImpl<$Res, + _$InitializationStateErrorImpl> implements _$$InitializationStateErrorImplCopyWith<$Res> { - __$$InitializationStateErrorImplCopyWithImpl(_$InitializationStateErrorImpl _value, $Res Function(_$InitializationStateErrorImpl) _then) + __$$InitializationStateErrorImplCopyWithImpl( + _$InitializationStateErrorImpl _value, + $Res Function(_$InitializationStateErrorImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -488,7 +522,8 @@ class _$InitializationStateErrorImpl implements InitializationStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$InitializationStateErrorImpl && - (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); } @override @@ -497,8 +532,9 @@ class _$InitializationStateErrorImpl implements InitializationStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> get copyWith => - __$$InitializationStateErrorImplCopyWithImpl<_$InitializationStateErrorImpl>(this, _$identity); + _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> + get copyWith => __$$InitializationStateErrorImplCopyWithImpl< + _$InitializationStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -576,9 +612,11 @@ class _$InitializationStateErrorImpl implements InitializationStateError { } abstract class InitializationStateError implements InitializationState { - const factory InitializationStateError({required final String errorMessage}) = _$InitializationStateErrorImpl; + const factory InitializationStateError({required final String errorMessage}) = + _$InitializationStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> get copyWith => throw _privateConstructorUsedError; + _$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart b/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart index 85c5d006..917785c7 100644 --- a/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart +++ b/lib/data/models/selectionPopupModel/selection_popup_model.freezed.dart @@ -22,19 +22,22 @@ mixin _$SelectionPopupModel { bool get isSelected => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $SelectionPopupModelCopyWith get copyWith => throw _privateConstructorUsedError; + $SelectionPopupModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $SelectionPopupModelCopyWith<$Res> { - factory $SelectionPopupModelCopyWith(SelectionPopupModel value, $Res Function(SelectionPopupModel) then) = + factory $SelectionPopupModelCopyWith( + SelectionPopupModel value, $Res Function(SelectionPopupModel) then) = _$SelectionPopupModelCopyWithImpl<$Res, SelectionPopupModel>; @useResult $Res call({int? id, String title, dynamic value, bool isSelected}); } /// @nodoc -class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> implements $SelectionPopupModelCopyWith<$Res> { +class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> + implements $SelectionPopupModelCopyWith<$Res> { _$SelectionPopupModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -72,8 +75,10 @@ class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> } /// @nodoc -abstract class _$$SelectionPopupModelImplCopyWith<$Res> implements $SelectionPopupModelCopyWith<$Res> { - factory _$$SelectionPopupModelImplCopyWith(_$SelectionPopupModelImpl value, $Res Function(_$SelectionPopupModelImpl) then) = +abstract class _$$SelectionPopupModelImplCopyWith<$Res> + implements $SelectionPopupModelCopyWith<$Res> { + factory _$$SelectionPopupModelImplCopyWith(_$SelectionPopupModelImpl value, + $Res Function(_$SelectionPopupModelImpl) then) = __$$SelectionPopupModelImplCopyWithImpl<$Res>; @override @useResult @@ -81,9 +86,12 @@ abstract class _$$SelectionPopupModelImplCopyWith<$Res> implements $SelectionPop } /// @nodoc -class __$$SelectionPopupModelImplCopyWithImpl<$Res> extends _$SelectionPopupModelCopyWithImpl<$Res, _$SelectionPopupModelImpl> +class __$$SelectionPopupModelImplCopyWithImpl<$Res> + extends _$SelectionPopupModelCopyWithImpl<$Res, _$SelectionPopupModelImpl> implements _$$SelectionPopupModelImplCopyWith<$Res> { - __$$SelectionPopupModelImplCopyWithImpl(_$SelectionPopupModelImpl _value, $Res Function(_$SelectionPopupModelImpl) _then) : super(_value, _then); + __$$SelectionPopupModelImplCopyWithImpl(_$SelectionPopupModelImpl _value, + $Res Function(_$SelectionPopupModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -117,7 +125,8 @@ class __$$SelectionPopupModelImplCopyWithImpl<$Res> extends _$SelectionPopupMode /// @nodoc class _$SelectionPopupModelImpl implements _SelectionPopupModel { - const _$SelectionPopupModelImpl({this.id, required this.title, this.value, this.isSelected = false}); + const _$SelectionPopupModelImpl( + {this.id, required this.title, this.value, this.isSelected = false}); @override final int? id; @@ -142,21 +151,28 @@ class _$SelectionPopupModelImpl implements _SelectionPopupModel { (identical(other.id, id) || other.id == id) && (identical(other.title, title) || other.title == title) && const DeepCollectionEquality().equals(other.value, value) && - (identical(other.isSelected, isSelected) || other.isSelected == isSelected)); + (identical(other.isSelected, isSelected) || + other.isSelected == isSelected)); } @override - int get hashCode => Object.hash(runtimeType, id, title, const DeepCollectionEquality().hash(value), isSelected); + int get hashCode => Object.hash(runtimeType, id, title, + const DeepCollectionEquality().hash(value), isSelected); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => - __$$SelectionPopupModelImplCopyWithImpl<_$SelectionPopupModelImpl>(this, _$identity); + __$$SelectionPopupModelImplCopyWithImpl<_$SelectionPopupModelImpl>( + this, _$identity); } abstract class _SelectionPopupModel implements SelectionPopupModel { - const factory _SelectionPopupModel({final int? id, required final String title, final dynamic value, final bool isSelected}) = _$SelectionPopupModelImpl; + const factory _SelectionPopupModel( + {final int? id, + required final String title, + final dynamic value, + final bool isSelected}) = _$SelectionPopupModelImpl; @override int? get id; @@ -168,5 +184,6 @@ abstract class _SelectionPopupModel implements SelectionPopupModel { bool get isSelected; @override @JsonKey(ignore: true) - _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart b/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart index 6c445667..4aa91df8 100644 --- a/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart +++ b/lib/data/models/userRegistrationModel/user_registration_model.freezed.dart @@ -14,7 +14,8 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); -UserRegistrationSheet _$UserRegistrationSheetFromJson(Map json) { +UserRegistrationSheet _$UserRegistrationSheetFromJson( + Map json) { return _UserRegistrationSheet.fromJson(json); } @@ -69,12 +70,14 @@ mixin _$UserRegistrationSheet { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $UserRegistrationSheetCopyWith get copyWith => throw _privateConstructorUsedError; + $UserRegistrationSheetCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $UserRegistrationSheetCopyWith<$Res> { - factory $UserRegistrationSheetCopyWith(UserRegistrationSheet value, $Res Function(UserRegistrationSheet) then) = + factory $UserRegistrationSheetCopyWith(UserRegistrationSheet value, + $Res Function(UserRegistrationSheet) then) = _$UserRegistrationSheetCopyWithImpl<$Res, UserRegistrationSheet>; @useResult $Res call( @@ -109,7 +112,9 @@ abstract class $UserRegistrationSheetCopyWith<$Res> { } /// @nodoc -class _$UserRegistrationSheetCopyWithImpl<$Res, $Val extends UserRegistrationSheet> implements $UserRegistrationSheetCopyWith<$Res> { +class _$UserRegistrationSheetCopyWithImpl<$Res, + $Val extends UserRegistrationSheet> + implements $UserRegistrationSheetCopyWith<$Res> { _$UserRegistrationSheetCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -267,8 +272,11 @@ class _$UserRegistrationSheetCopyWithImpl<$Res, $Val extends UserRegistrationShe } /// @nodoc -abstract class _$$UserRegistrationSheetImplCopyWith<$Res> implements $UserRegistrationSheetCopyWith<$Res> { - factory _$$UserRegistrationSheetImplCopyWith(_$UserRegistrationSheetImpl value, $Res Function(_$UserRegistrationSheetImpl) then) = +abstract class _$$UserRegistrationSheetImplCopyWith<$Res> + implements $UserRegistrationSheetCopyWith<$Res> { + factory _$$UserRegistrationSheetImplCopyWith( + _$UserRegistrationSheetImpl value, + $Res Function(_$UserRegistrationSheetImpl) then) = __$$UserRegistrationSheetImplCopyWithImpl<$Res>; @override @useResult @@ -304,9 +312,13 @@ abstract class _$$UserRegistrationSheetImplCopyWith<$Res> implements $UserRegist } /// @nodoc -class __$$UserRegistrationSheetImplCopyWithImpl<$Res> extends _$UserRegistrationSheetCopyWithImpl<$Res, _$UserRegistrationSheetImpl> +class __$$UserRegistrationSheetImplCopyWithImpl<$Res> + extends _$UserRegistrationSheetCopyWithImpl<$Res, + _$UserRegistrationSheetImpl> implements _$$UserRegistrationSheetImplCopyWith<$Res> { - __$$UserRegistrationSheetImplCopyWithImpl(_$UserRegistrationSheetImpl _value, $Res Function(_$UserRegistrationSheetImpl) _then) : super(_value, _then); + __$$UserRegistrationSheetImplCopyWithImpl(_$UserRegistrationSheetImpl _value, + $Res Function(_$UserRegistrationSheetImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -466,7 +478,8 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { @JsonKey(name: 'last_name') required this.lastName, required this.email, required this.password, - @JsonKey(name: 'password_confirmation') required this.passwordConfirmation, + @JsonKey(name: 'password_confirmation') + required this.passwordConfirmation, @JsonKey(name: 'terms') this.termsAccepted = 'accepted', required this.birthdate, required this.gender, @@ -490,7 +503,8 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { @JsonKey(name: 'additional_info') required this.additionalInfo, @JsonKey(name: 'activity_coefficient') this.activityCoefficient = 1.2}); - factory _$UserRegistrationSheetImpl.fromJson(Map json) => _$$UserRegistrationSheetImplFromJson(json); + factory _$UserRegistrationSheetImpl.fromJson(Map json) => + _$$UserRegistrationSheetImplFromJson(json); @override final String name; @@ -578,33 +592,52 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { (other.runtimeType == runtimeType && other is _$UserRegistrationSheetImpl && (identical(other.name, name) || other.name == name) && - (identical(other.firstName, firstName) || other.firstName == firstName) && - (identical(other.lastName, lastName) || other.lastName == lastName) && + (identical(other.firstName, firstName) || + other.firstName == firstName) && + (identical(other.lastName, lastName) || + other.lastName == lastName) && (identical(other.email, email) || other.email == email) && - (identical(other.password, password) || other.password == password) && - (identical(other.passwordConfirmation, passwordConfirmation) || other.passwordConfirmation == passwordConfirmation) && - (identical(other.termsAccepted, termsAccepted) || other.termsAccepted == termsAccepted) && - (identical(other.birthdate, birthdate) || other.birthdate == birthdate) && + (identical(other.password, password) || + other.password == password) && + (identical(other.passwordConfirmation, passwordConfirmation) || + other.passwordConfirmation == passwordConfirmation) && + (identical(other.termsAccepted, termsAccepted) || + other.termsAccepted == termsAccepted) && + (identical(other.birthdate, birthdate) || + other.birthdate == birthdate) && (identical(other.gender, gender) || other.gender == gender) && (identical(other.country, country) || other.country == country) && (identical(other.city, city) || other.city == city) && (identical(other.lang, lang) || other.lang == lang) && (identical(other.weight, weight) || other.weight == weight) && (identical(other.height, height) || other.height == height) && - (identical(other.chestCircumference, chestCircumference) || other.chestCircumference == chestCircumference) && - (identical(other.waistCircumference, waistCircumference) || other.waistCircumference == waistCircumference) && - (identical(other.hipCircumference, hipCircumference) || other.hipCircumference == hipCircumference) && - (identical(other.bloodPressureUp, bloodPressureUp) || other.bloodPressureUp == bloodPressureUp) && - (identical(other.bloodPressureDown, bloodPressureDown) || other.bloodPressureDown == bloodPressureDown) && + (identical(other.chestCircumference, chestCircumference) || + other.chestCircumference == chestCircumference) && + (identical(other.waistCircumference, waistCircumference) || + other.waistCircumference == waistCircumference) && + (identical(other.hipCircumference, hipCircumference) || + other.hipCircumference == hipCircumference) && + (identical(other.bloodPressureUp, bloodPressureUp) || + other.bloodPressureUp == bloodPressureUp) && + (identical(other.bloodPressureDown, bloodPressureDown) || + other.bloodPressureDown == bloodPressureDown) && (identical(other.hasHypo, hasHypo) || other.hasHypo == hasHypo) && - (identical(other.hasHyper, hasHyper) || other.hasHyper == hasHyper) && - (identical(other.aboutAllergy, aboutAllergy) || other.aboutAllergy == aboutAllergy) && - (identical(other.aboutTakingPils, aboutTakingPils) || other.aboutTakingPils == aboutTakingPils) && - (identical(other.aboutSportHobbies, aboutSportHobbies) || other.aboutSportHobbies == aboutSportHobbies) && - (identical(other.favoriteFoods, favoriteFoods) || other.favoriteFoods == favoriteFoods) && - (identical(other.unfavoriteFoods, unfavoriteFoods) || other.unfavoriteFoods == unfavoriteFoods) && - (identical(other.additionalInfo, additionalInfo) || other.additionalInfo == additionalInfo) && - (identical(other.activityCoefficient, activityCoefficient) || other.activityCoefficient == activityCoefficient)); + (identical(other.hasHyper, hasHyper) || + other.hasHyper == hasHyper) && + (identical(other.aboutAllergy, aboutAllergy) || + other.aboutAllergy == aboutAllergy) && + (identical(other.aboutTakingPils, aboutTakingPils) || + other.aboutTakingPils == aboutTakingPils) && + (identical(other.aboutSportHobbies, aboutSportHobbies) || + other.aboutSportHobbies == aboutSportHobbies) && + (identical(other.favoriteFoods, favoriteFoods) || + other.favoriteFoods == favoriteFoods) && + (identical(other.unfavoriteFoods, unfavoriteFoods) || + other.unfavoriteFoods == unfavoriteFoods) && + (identical(other.additionalInfo, additionalInfo) || + other.additionalInfo == additionalInfo) && + (identical(other.activityCoefficient, activityCoefficient) || + other.activityCoefficient == activityCoefficient)); } @JsonKey(ignore: true) @@ -644,8 +677,9 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> get copyWith => - __$$UserRegistrationSheetImplCopyWithImpl<_$UserRegistrationSheetImpl>(this, _$identity); + _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> + get copyWith => __$$UserRegistrationSheetImplCopyWithImpl< + _$UserRegistrationSheetImpl>(this, _$identity); @override Map toJson() { @@ -662,7 +696,8 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { @JsonKey(name: 'last_name') required final String lastName, required final String email, required final String password, - @JsonKey(name: 'password_confirmation') required final String passwordConfirmation, + @JsonKey(name: 'password_confirmation') + required final String passwordConfirmation, @JsonKey(name: 'terms') final String termsAccepted, required final String birthdate, required final String gender, @@ -671,22 +706,28 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { required final String lang, required final int weight, required final int height, - @JsonKey(name: 'chest_circumference') required final int chestCircumference, - @JsonKey(name: 'waist_circumference') required final int waistCircumference, + @JsonKey(name: 'chest_circumference') + required final int chestCircumference, + @JsonKey(name: 'waist_circumference') + required final int waistCircumference, @JsonKey(name: 'hip_circumference') required final int hipCircumference, @JsonKey(name: 'blood_pressure_up') required final int bloodPressureUp, - @JsonKey(name: 'blood_pressure_down') required final int bloodPressureDown, + @JsonKey(name: 'blood_pressure_down') + required final int bloodPressureDown, @JsonKey(name: 'has_hypo') required final int hasHypo, @JsonKey(name: 'has_hyper') required final int hasHyper, @JsonKey(name: 'about_alergy') required final String aboutAllergy, @JsonKey(name: 'about_taking_pils') required final String aboutTakingPils, - @JsonKey(name: 'about_sport_hobbies') required final String aboutSportHobbies, + @JsonKey(name: 'about_sport_hobbies') + required final String aboutSportHobbies, @JsonKey(name: 'favorite_foods') required final String favoriteFoods, @JsonKey(name: 'unfavorite_foods') required final String unfavoriteFoods, @JsonKey(name: 'additional_info') required final String additionalInfo, - @JsonKey(name: 'activity_coefficient') final double activityCoefficient}) = _$UserRegistrationSheetImpl; + @JsonKey(name: 'activity_coefficient') + final double activityCoefficient}) = _$UserRegistrationSheetImpl; - factory _UserRegistrationSheet.fromJson(Map json) = _$UserRegistrationSheetImpl.fromJson; + factory _UserRegistrationSheet.fromJson(Map json) = + _$UserRegistrationSheetImpl.fromJson; @override String get name; @@ -764,5 +805,6 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet { double get activityCoefficient; @override @JsonKey(ignore: true) - _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> get copyWith => throw _privateConstructorUsedError; + _$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/data/models/userRegistrationModel/user_registration_model.g.dart b/lib/data/models/userRegistrationModel/user_registration_model.g.dart index 7827901c..132240b7 100644 --- a/lib/data/models/userRegistrationModel/user_registration_model.g.dart +++ b/lib/data/models/userRegistrationModel/user_registration_model.g.dart @@ -6,7 +6,9 @@ part of 'user_registration_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$UserRegistrationSheetImpl _$$UserRegistrationSheetImplFromJson(Map json) => _$UserRegistrationSheetImpl( +_$UserRegistrationSheetImpl _$$UserRegistrationSheetImplFromJson( + Map json) => + _$UserRegistrationSheetImpl( name: json['name'] as String, firstName: json['first_name'] as String, lastName: json['last_name'] as String, @@ -34,10 +36,13 @@ _$UserRegistrationSheetImpl _$$UserRegistrationSheetImplFromJson(Map _$$UserRegistrationSheetImplToJson(_$UserRegistrationSheetImpl instance) => { +Map _$$UserRegistrationSheetImplToJson( + _$UserRegistrationSheetImpl instance) => + { 'name': instance.name, 'first_name': instance.firstName, 'last_name': instance.lastName, diff --git a/lib/features/blog_post/models/blog_post_model.freezed.dart b/lib/features/blog_post/models/blog_post_model.freezed.dart index 06f768a1..7c0a750e 100644 --- a/lib/features/blog_post/models/blog_post_model.freezed.dart +++ b/lib/features/blog_post/models/blog_post_model.freezed.dart @@ -36,12 +36,15 @@ mixin _$BlogPostModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $BlogPostModelCopyWith get copyWith => throw _privateConstructorUsedError; + $BlogPostModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $BlogPostModelCopyWith<$Res> { - factory $BlogPostModelCopyWith(BlogPostModel value, $Res Function(BlogPostModel) then) = _$BlogPostModelCopyWithImpl<$Res, BlogPostModel>; + factory $BlogPostModelCopyWith( + BlogPostModel value, $Res Function(BlogPostModel) then) = + _$BlogPostModelCopyWithImpl<$Res, BlogPostModel>; @useResult $Res call( {int id, @@ -57,7 +60,8 @@ abstract class $BlogPostModelCopyWith<$Res> { } /// @nodoc -class _$BlogPostModelCopyWithImpl<$Res, $Val extends BlogPostModel> implements $BlogPostModelCopyWith<$Res> { +class _$BlogPostModelCopyWithImpl<$Res, $Val extends BlogPostModel> + implements $BlogPostModelCopyWith<$Res> { _$BlogPostModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -125,8 +129,11 @@ class _$BlogPostModelCopyWithImpl<$Res, $Val extends BlogPostModel> implements $ } /// @nodoc -abstract class _$$BlogPostModelImplCopyWith<$Res> implements $BlogPostModelCopyWith<$Res> { - factory _$$BlogPostModelImplCopyWith(_$BlogPostModelImpl value, $Res Function(_$BlogPostModelImpl) then) = __$$BlogPostModelImplCopyWithImpl<$Res>; +abstract class _$$BlogPostModelImplCopyWith<$Res> + implements $BlogPostModelCopyWith<$Res> { + factory _$$BlogPostModelImplCopyWith( + _$BlogPostModelImpl value, $Res Function(_$BlogPostModelImpl) then) = + __$$BlogPostModelImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -143,8 +150,12 @@ abstract class _$$BlogPostModelImplCopyWith<$Res> implements $BlogPostModelCopyW } /// @nodoc -class __$$BlogPostModelImplCopyWithImpl<$Res> extends _$BlogPostModelCopyWithImpl<$Res, _$BlogPostModelImpl> implements _$$BlogPostModelImplCopyWith<$Res> { - __$$BlogPostModelImplCopyWithImpl(_$BlogPostModelImpl _value, $Res Function(_$BlogPostModelImpl) _then) : super(_value, _then); +class __$$BlogPostModelImplCopyWithImpl<$Res> + extends _$BlogPostModelCopyWithImpl<$Res, _$BlogPostModelImpl> + implements _$$BlogPostModelImplCopyWith<$Res> { + __$$BlogPostModelImplCopyWithImpl( + _$BlogPostModelImpl _value, $Res Function(_$BlogPostModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -220,7 +231,8 @@ class _$BlogPostModelImpl implements _BlogPostModel { @JsonKey(name: "updated_at") required this.updatedAt, required this.title}); - factory _$BlogPostModelImpl.fromJson(Map json) => _$$BlogPostModelImplFromJson(json); + factory _$BlogPostModelImpl.fromJson(Map json) => + _$$BlogPostModelImplFromJson(json); @override final int id; @@ -259,23 +271,31 @@ class _$BlogPostModelImpl implements _BlogPostModel { (identical(other.id, id) || other.id == id) && (identical(other.state, state) || other.state == state) && (identical(other.image, image) || other.image == image) && - (identical(other.description, description) || other.description == description) && - (identical(other.author_name, author_name) || other.author_name == author_name) && - (identical(other.author_avatar_path, author_avatar_path) || other.author_avatar_path == author_avatar_path) && - (identical(other.youtubeUrl, youtubeUrl) || other.youtubeUrl == youtubeUrl) && - (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && - (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.description, description) || + other.description == description) && + (identical(other.author_name, author_name) || + other.author_name == author_name) && + (identical(other.author_avatar_path, author_avatar_path) || + other.author_avatar_path == author_avatar_path) && + (identical(other.youtubeUrl, youtubeUrl) || + other.youtubeUrl == youtubeUrl) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt) && (identical(other.title, title) || other.title == title)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, state, image, description, author_name, author_avatar_path, youtubeUrl, createdAt, updatedAt, title); + int get hashCode => Object.hash(runtimeType, id, state, image, description, + author_name, author_avatar_path, youtubeUrl, createdAt, updatedAt, title); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$BlogPostModelImplCopyWith<_$BlogPostModelImpl> get copyWith => __$$BlogPostModelImplCopyWithImpl<_$BlogPostModelImpl>(this, _$identity); + _$$BlogPostModelImplCopyWith<_$BlogPostModelImpl> get copyWith => + __$$BlogPostModelImplCopyWithImpl<_$BlogPostModelImpl>(this, _$identity); @override Map toJson() { @@ -298,7 +318,8 @@ abstract class _BlogPostModel implements BlogPostModel { @JsonKey(name: "updated_at") required final DateTime updatedAt, required final String title}) = _$BlogPostModelImpl; - factory _BlogPostModel.fromJson(Map json) = _$BlogPostModelImpl.fromJson; + factory _BlogPostModel.fromJson(Map json) = + _$BlogPostModelImpl.fromJson; @override int get id; @@ -325,5 +346,6 @@ abstract class _BlogPostModel implements BlogPostModel { String get title; @override @JsonKey(ignore: true) - _$$BlogPostModelImplCopyWith<_$BlogPostModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$BlogPostModelImplCopyWith<_$BlogPostModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/blog_post/models/blog_post_model.g.dart b/lib/features/blog_post/models/blog_post_model.g.dart index 137652f2..2e3233c4 100644 --- a/lib/features/blog_post/models/blog_post_model.g.dart +++ b/lib/features/blog_post/models/blog_post_model.g.dart @@ -6,7 +6,8 @@ part of 'blog_post_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$BlogPostModelImpl _$$BlogPostModelImplFromJson(Map json) => _$BlogPostModelImpl( +_$BlogPostModelImpl _$$BlogPostModelImplFromJson(Map json) => + _$BlogPostModelImpl( id: (json['id'] as num).toInt(), state: json['state'] as String, image: json['image'] as String?, @@ -19,7 +20,8 @@ _$BlogPostModelImpl _$$BlogPostModelImplFromJson(Map json) => _ title: json['title'] as String, ); -Map _$$BlogPostModelImplToJson(_$BlogPostModelImpl instance) => { +Map _$$BlogPostModelImplToJson(_$BlogPostModelImpl instance) => + { 'id': instance.id, 'state': instance.state, 'image': instance.image, diff --git a/lib/features/blog_post/presentation/bloc/blog_post_state.freezed.dart b/lib/features/blog_post/presentation/bloc/blog_post_state.freezed.dart index d204df10..4f99a3cd 100644 --- a/lib/features/blog_post/presentation/bloc/blog_post_state.freezed.dart +++ b/lib/features/blog_post/presentation/bloc/blog_post_state.freezed.dart @@ -70,11 +70,14 @@ mixin _$BlogPostState { /// @nodoc abstract class $BlogPostStateCopyWith<$Res> { - factory $BlogPostStateCopyWith(BlogPostState value, $Res Function(BlogPostState) then) = _$BlogPostStateCopyWithImpl<$Res, BlogPostState>; + factory $BlogPostStateCopyWith( + BlogPostState value, $Res Function(BlogPostState) then) = + _$BlogPostStateCopyWithImpl<$Res, BlogPostState>; } /// @nodoc -class _$BlogPostStateCopyWithImpl<$Res, $Val extends BlogPostState> implements $BlogPostStateCopyWith<$Res> { +class _$BlogPostStateCopyWithImpl<$Res, $Val extends BlogPostState> + implements $BlogPostStateCopyWith<$Res> { _$BlogPostStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -85,12 +88,18 @@ class _$BlogPostStateCopyWithImpl<$Res, $Val extends BlogPostState> implements $ /// @nodoc abstract class _$$BlogPostStateImplCopyWith<$Res> { - factory _$$BlogPostStateImplCopyWith(_$BlogPostStateImpl value, $Res Function(_$BlogPostStateImpl) then) = __$$BlogPostStateImplCopyWithImpl<$Res>; + factory _$$BlogPostStateImplCopyWith( + _$BlogPostStateImpl value, $Res Function(_$BlogPostStateImpl) then) = + __$$BlogPostStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$BlogPostStateImplCopyWithImpl<$Res> extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateImpl> implements _$$BlogPostStateImplCopyWith<$Res> { - __$$BlogPostStateImplCopyWithImpl(_$BlogPostStateImpl _value, $Res Function(_$BlogPostStateImpl) _then) : super(_value, _then); +class __$$BlogPostStateImplCopyWithImpl<$Res> + extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateImpl> + implements _$$BlogPostStateImplCopyWith<$Res> { + __$$BlogPostStateImplCopyWithImpl( + _$BlogPostStateImpl _value, $Res Function(_$BlogPostStateImpl) _then) + : super(_value, _then); } /// @nodoc @@ -105,7 +114,8 @@ class _$BlogPostStateImpl implements _BlogPostState { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$BlogPostStateImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$BlogPostStateImpl); } @override @@ -192,14 +202,18 @@ abstract class _BlogPostState implements BlogPostState { /// @nodoc abstract class _$$BlogPostStateLoadingImplCopyWith<$Res> { - factory _$$BlogPostStateLoadingImplCopyWith(_$BlogPostStateLoadingImpl value, $Res Function(_$BlogPostStateLoadingImpl) then) = + factory _$$BlogPostStateLoadingImplCopyWith(_$BlogPostStateLoadingImpl value, + $Res Function(_$BlogPostStateLoadingImpl) then) = __$$BlogPostStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc -class __$$BlogPostStateLoadingImplCopyWithImpl<$Res> extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateLoadingImpl> +class __$$BlogPostStateLoadingImplCopyWithImpl<$Res> + extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateLoadingImpl> implements _$$BlogPostStateLoadingImplCopyWith<$Res> { - __$$BlogPostStateLoadingImplCopyWithImpl(_$BlogPostStateLoadingImpl _value, $Res Function(_$BlogPostStateLoadingImpl) _then) : super(_value, _then); + __$$BlogPostStateLoadingImplCopyWithImpl(_$BlogPostStateLoadingImpl _value, + $Res Function(_$BlogPostStateLoadingImpl) _then) + : super(_value, _then); } /// @nodoc @@ -214,7 +228,9 @@ class _$BlogPostStateLoadingImpl implements BlogPostStateLoading { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$BlogPostStateLoadingImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BlogPostStateLoadingImpl); } @override @@ -301,7 +317,8 @@ abstract class BlogPostStateLoading implements BlogPostState { /// @nodoc abstract class _$$BlogPostStateLoadedImplCopyWith<$Res> { - factory _$$BlogPostStateLoadedImplCopyWith(_$BlogPostStateLoadedImpl value, $Res Function(_$BlogPostStateLoadedImpl) then) = + factory _$$BlogPostStateLoadedImplCopyWith(_$BlogPostStateLoadedImpl value, + $Res Function(_$BlogPostStateLoadedImpl) then) = __$$BlogPostStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({BlogPostModel blogPost}); @@ -310,9 +327,12 @@ abstract class _$$BlogPostStateLoadedImplCopyWith<$Res> { } /// @nodoc -class __$$BlogPostStateLoadedImplCopyWithImpl<$Res> extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateLoadedImpl> +class __$$BlogPostStateLoadedImplCopyWithImpl<$Res> + extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateLoadedImpl> implements _$$BlogPostStateLoadedImplCopyWith<$Res> { - __$$BlogPostStateLoadedImplCopyWithImpl(_$BlogPostStateLoadedImpl _value, $Res Function(_$BlogPostStateLoadedImpl) _then) : super(_value, _then); + __$$BlogPostStateLoadedImplCopyWithImpl(_$BlogPostStateLoadedImpl _value, + $Res Function(_$BlogPostStateLoadedImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -352,7 +372,10 @@ class _$BlogPostStateLoadedImpl implements BlogPostStateLoaded { @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$BlogPostStateLoadedImpl && (identical(other.blogPost, blogPost) || other.blogPost == blogPost)); + (other.runtimeType == runtimeType && + other is _$BlogPostStateLoadedImpl && + (identical(other.blogPost, blogPost) || + other.blogPost == blogPost)); } @override @@ -362,7 +385,8 @@ class _$BlogPostStateLoadedImpl implements BlogPostStateLoaded { @override @pragma('vm:prefer-inline') _$$BlogPostStateLoadedImplCopyWith<_$BlogPostStateLoadedImpl> get copyWith => - __$$BlogPostStateLoadedImplCopyWithImpl<_$BlogPostStateLoadedImpl>(this, _$identity); + __$$BlogPostStateLoadedImplCopyWithImpl<_$BlogPostStateLoadedImpl>( + this, _$identity); @override @optionalTypeArgs @@ -440,25 +464,31 @@ class _$BlogPostStateLoadedImpl implements BlogPostStateLoaded { } abstract class BlogPostStateLoaded implements BlogPostState { - const factory BlogPostStateLoaded({required final BlogPostModel blogPost}) = _$BlogPostStateLoadedImpl; + const factory BlogPostStateLoaded({required final BlogPostModel blogPost}) = + _$BlogPostStateLoadedImpl; BlogPostModel get blogPost; @JsonKey(ignore: true) - _$$BlogPostStateLoadedImplCopyWith<_$BlogPostStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; + _$$BlogPostStateLoadedImplCopyWith<_$BlogPostStateLoadedImpl> get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class _$$BlogPostStateErrorImplCopyWith<$Res> { - factory _$$BlogPostStateErrorImplCopyWith(_$BlogPostStateErrorImpl value, $Res Function(_$BlogPostStateErrorImpl) then) = + factory _$$BlogPostStateErrorImplCopyWith(_$BlogPostStateErrorImpl value, + $Res Function(_$BlogPostStateErrorImpl) then) = __$$BlogPostStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$BlogPostStateErrorImplCopyWithImpl<$Res> extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateErrorImpl> +class __$$BlogPostStateErrorImplCopyWithImpl<$Res> + extends _$BlogPostStateCopyWithImpl<$Res, _$BlogPostStateErrorImpl> implements _$$BlogPostStateErrorImplCopyWith<$Res> { - __$$BlogPostStateErrorImplCopyWithImpl(_$BlogPostStateErrorImpl _value, $Res Function(_$BlogPostStateErrorImpl) _then) : super(_value, _then); + __$$BlogPostStateErrorImplCopyWithImpl(_$BlogPostStateErrorImpl _value, + $Res Function(_$BlogPostStateErrorImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -492,7 +522,8 @@ class _$BlogPostStateErrorImpl implements BlogPostStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$BlogPostStateErrorImpl && - (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); } @override @@ -502,7 +533,8 @@ class _$BlogPostStateErrorImpl implements BlogPostStateError { @override @pragma('vm:prefer-inline') _$$BlogPostStateErrorImplCopyWith<_$BlogPostStateErrorImpl> get copyWith => - __$$BlogPostStateErrorImplCopyWithImpl<_$BlogPostStateErrorImpl>(this, _$identity); + __$$BlogPostStateErrorImplCopyWithImpl<_$BlogPostStateErrorImpl>( + this, _$identity); @override @optionalTypeArgs @@ -580,9 +612,11 @@ class _$BlogPostStateErrorImpl implements BlogPostStateError { } abstract class BlogPostStateError implements BlogPostState { - const factory BlogPostStateError({required final String errorMessage}) = _$BlogPostStateErrorImpl; + const factory BlogPostStateError({required final String errorMessage}) = + _$BlogPostStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$BlogPostStateErrorImplCopyWith<_$BlogPostStateErrorImpl> get copyWith => throw _privateConstructorUsedError; + _$$BlogPostStateErrorImplCopyWith<_$BlogPostStateErrorImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/blog_post/services/blog_post_service.g.dart b/lib/features/blog_post/services/blog_post_service.g.dart index bed41992..40905775 100644 --- a/lib/features/blog_post/services/blog_post_service.g.dart +++ b/lib/features/blog_post/services/blog_post_service.g.dart @@ -24,28 +24,31 @@ class _BlogPostService implements BlogPostService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>(_setStreamType(Options( + final _result = await _dio + .fetch>(_setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/feed/show/${id}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); + .compose( + _dio.options, + '/api/feed/show/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); final _value = BlogPostModel.fromJson(_result.data!); return _value; } RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { if (T == String) { requestOptions.responseType = ResponseType.plain; } else { diff --git a/lib/features/blog_post_create/services/blog_service.g.dart b/lib/features/blog_post_create/services/blog_service.g.dart index d30d7d85..a6ff68e4 100644 --- a/lib/features/blog_post_create/services/blog_service.g.dart +++ b/lib/features/blog_post_create/services/blog_service.g.dart @@ -19,33 +19,37 @@ class _BlogService implements BlogService { String? baseUrl; @override - Future createBlogPost(BlogPostCreateCredentialsModel model) async { + Future createBlogPost( + BlogPostCreateCredentialsModel model) async { final _extra = {}; final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>(_setStreamType(Options( + final _result = await _dio.fetch>( + _setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/blog_post/create', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); + .compose( + _dio.options, + '/api/blog_post/create', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); final _value = BlogPostCreateCredentialsModel.fromJson(_result.data!); return _value; } RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { if (T == String) { requestOptions.responseType = ResponseType.plain; } else { diff --git a/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart b/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart index 68714d7d..02a1c4bd 100644 --- a/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart +++ b/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.freezed.dart @@ -70,11 +70,14 @@ mixin _$NewMessagesState { /// @nodoc abstract class $NewMessagesStateCopyWith<$Res> { - factory $NewMessagesStateCopyWith(NewMessagesState value, $Res Function(NewMessagesState) then) = _$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>; + factory $NewMessagesStateCopyWith( + NewMessagesState value, $Res Function(NewMessagesState) then) = + _$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>; } /// @nodoc -class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState> implements $NewMessagesStateCopyWith<$Res> { +class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState> + implements $NewMessagesStateCopyWith<$Res> { _$NewMessagesStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -85,14 +88,18 @@ class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState> implem /// @nodoc abstract class _$$NewMessagesStateImplCopyWith<$Res> { - factory _$$NewMessagesStateImplCopyWith(_$NewMessagesStateImpl value, $Res Function(_$NewMessagesStateImpl) then) = + factory _$$NewMessagesStateImplCopyWith(_$NewMessagesStateImpl value, + $Res Function(_$NewMessagesStateImpl) then) = __$$NewMessagesStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NewMessagesStateImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateImpl> +class __$$NewMessagesStateImplCopyWithImpl<$Res> + extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateImpl> implements _$$NewMessagesStateImplCopyWith<$Res> { - __$$NewMessagesStateImplCopyWithImpl(_$NewMessagesStateImpl _value, $Res Function(_$NewMessagesStateImpl) _then) : super(_value, _then); + __$$NewMessagesStateImplCopyWithImpl(_$NewMessagesStateImpl _value, + $Res Function(_$NewMessagesStateImpl) _then) + : super(_value, _then); } /// @nodoc @@ -107,7 +114,8 @@ class _$NewMessagesStateImpl implements _NewMessagesState { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$NewMessagesStateImpl); } @override @@ -194,14 +202,19 @@ abstract class _NewMessagesState implements NewMessagesState { /// @nodoc abstract class _$$NewMessagesStateEmptyImplCopyWith<$Res> { - factory _$$NewMessagesStateEmptyImplCopyWith(_$NewMessagesStateEmptyImpl value, $Res Function(_$NewMessagesStateEmptyImpl) then) = + factory _$$NewMessagesStateEmptyImplCopyWith( + _$NewMessagesStateEmptyImpl value, + $Res Function(_$NewMessagesStateEmptyImpl) then) = __$$NewMessagesStateEmptyImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NewMessagesStateEmptyImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateEmptyImpl> +class __$$NewMessagesStateEmptyImplCopyWithImpl<$Res> + extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateEmptyImpl> implements _$$NewMessagesStateEmptyImplCopyWith<$Res> { - __$$NewMessagesStateEmptyImplCopyWithImpl(_$NewMessagesStateEmptyImpl _value, $Res Function(_$NewMessagesStateEmptyImpl) _then) : super(_value, _then); + __$$NewMessagesStateEmptyImplCopyWithImpl(_$NewMessagesStateEmptyImpl _value, + $Res Function(_$NewMessagesStateEmptyImpl) _then) + : super(_value, _then); } /// @nodoc @@ -216,7 +229,9 @@ class _$NewMessagesStateEmptyImpl implements NewMessagesStateEmpty { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateEmptyImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$NewMessagesStateEmptyImpl); } @override @@ -303,16 +318,22 @@ abstract class NewMessagesStateEmpty implements NewMessagesState { /// @nodoc abstract class _$$NewMessagesStateLoadedImplCopyWith<$Res> { - factory _$$NewMessagesStateLoadedImplCopyWith(_$NewMessagesStateLoadedImpl value, $Res Function(_$NewMessagesStateLoadedImpl) then) = + factory _$$NewMessagesStateLoadedImplCopyWith( + _$NewMessagesStateLoadedImpl value, + $Res Function(_$NewMessagesStateLoadedImpl) then) = __$$NewMessagesStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({int messagesCount}); } /// @nodoc -class __$$NewMessagesStateLoadedImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateLoadedImpl> +class __$$NewMessagesStateLoadedImplCopyWithImpl<$Res> + extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateLoadedImpl> implements _$$NewMessagesStateLoadedImplCopyWith<$Res> { - __$$NewMessagesStateLoadedImplCopyWithImpl(_$NewMessagesStateLoadedImpl _value, $Res Function(_$NewMessagesStateLoadedImpl) _then) : super(_value, _then); + __$$NewMessagesStateLoadedImplCopyWithImpl( + _$NewMessagesStateLoadedImpl _value, + $Res Function(_$NewMessagesStateLoadedImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -346,7 +367,8 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateLoadedImpl && - (identical(other.messagesCount, messagesCount) || other.messagesCount == messagesCount)); + (identical(other.messagesCount, messagesCount) || + other.messagesCount == messagesCount)); } @override @@ -355,8 +377,9 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> get copyWith => - __$$NewMessagesStateLoadedImplCopyWithImpl<_$NewMessagesStateLoadedImpl>(this, _$identity); + _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> + get copyWith => __$$NewMessagesStateLoadedImplCopyWithImpl< + _$NewMessagesStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -434,25 +457,32 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded { } abstract class NewMessagesStateLoaded implements NewMessagesState { - const factory NewMessagesStateLoaded({required final int messagesCount}) = _$NewMessagesStateLoadedImpl; + const factory NewMessagesStateLoaded({required final int messagesCount}) = + _$NewMessagesStateLoadedImpl; int get messagesCount; @JsonKey(ignore: true) - _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; + _$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$NewMessagesStateErrorImplCopyWith<$Res> { - factory _$$NewMessagesStateErrorImplCopyWith(_$NewMessagesStateErrorImpl value, $Res Function(_$NewMessagesStateErrorImpl) then) = + factory _$$NewMessagesStateErrorImplCopyWith( + _$NewMessagesStateErrorImpl value, + $Res Function(_$NewMessagesStateErrorImpl) then) = __$$NewMessagesStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$NewMessagesStateErrorImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateErrorImpl> +class __$$NewMessagesStateErrorImplCopyWithImpl<$Res> + extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateErrorImpl> implements _$$NewMessagesStateErrorImplCopyWith<$Res> { - __$$NewMessagesStateErrorImplCopyWithImpl(_$NewMessagesStateErrorImpl _value, $Res Function(_$NewMessagesStateErrorImpl) _then) : super(_value, _then); + __$$NewMessagesStateErrorImplCopyWithImpl(_$NewMessagesStateErrorImpl _value, + $Res Function(_$NewMessagesStateErrorImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -486,7 +516,8 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateErrorImpl && - (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); } @override @@ -495,8 +526,9 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> get copyWith => - __$$NewMessagesStateErrorImplCopyWithImpl<_$NewMessagesStateErrorImpl>(this, _$identity); + _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> + get copyWith => __$$NewMessagesStateErrorImplCopyWithImpl< + _$NewMessagesStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -574,9 +606,11 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError { } abstract class NewMessagesStateError implements NewMessagesState { - const factory NewMessagesStateError({required final String errorMessage}) = _$NewMessagesStateErrorImpl; + const factory NewMessagesStateError({required final String errorMessage}) = + _$NewMessagesStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> get copyWith => throw _privateConstructorUsedError; + _$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart b/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart index 2f985486..0deeebbd 100644 --- a/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart +++ b/lib/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.freezed.dart @@ -70,12 +70,14 @@ mixin _$NotificationsState { /// @nodoc abstract class $NotificationsStateCopyWith<$Res> { - factory $NotificationsStateCopyWith(NotificationsState value, $Res Function(NotificationsState) then) = + factory $NotificationsStateCopyWith( + NotificationsState value, $Res Function(NotificationsState) then) = _$NotificationsStateCopyWithImpl<$Res, NotificationsState>; } /// @nodoc -class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> implements $NotificationsStateCopyWith<$Res> { +class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> + implements $NotificationsStateCopyWith<$Res> { _$NotificationsStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -86,14 +88,18 @@ class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> im /// @nodoc abstract class _$$NotificationsStateImplCopyWith<$Res> { - factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value, $Res Function(_$NotificationsStateImpl) then) = + factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value, + $Res Function(_$NotificationsStateImpl) then) = __$$NotificationsStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NotificationsStateImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateImpl> +class __$$NotificationsStateImplCopyWithImpl<$Res> + extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateImpl> implements _$$NotificationsStateImplCopyWith<$Res> { - __$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value, $Res Function(_$NotificationsStateImpl) _then) : super(_value, _then); + __$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value, + $Res Function(_$NotificationsStateImpl) _then) + : super(_value, _then); } /// @nodoc @@ -108,7 +114,8 @@ class _$NotificationsStateImpl implements _NotificationsState { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$NotificationsStateImpl); } @override @@ -195,14 +202,21 @@ abstract class _NotificationsState implements NotificationsState { /// @nodoc abstract class _$$NotificationsStateEmptyImplCopyWith<$Res> { - factory _$$NotificationsStateEmptyImplCopyWith(_$NotificationsStateEmptyImpl value, $Res Function(_$NotificationsStateEmptyImpl) then) = + factory _$$NotificationsStateEmptyImplCopyWith( + _$NotificationsStateEmptyImpl value, + $Res Function(_$NotificationsStateEmptyImpl) then) = __$$NotificationsStateEmptyImplCopyWithImpl<$Res>; } /// @nodoc -class __$$NotificationsStateEmptyImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateEmptyImpl> +class __$$NotificationsStateEmptyImplCopyWithImpl<$Res> + extends _$NotificationsStateCopyWithImpl<$Res, + _$NotificationsStateEmptyImpl> implements _$$NotificationsStateEmptyImplCopyWith<$Res> { - __$$NotificationsStateEmptyImplCopyWithImpl(_$NotificationsStateEmptyImpl _value, $Res Function(_$NotificationsStateEmptyImpl) _then) : super(_value, _then); + __$$NotificationsStateEmptyImplCopyWithImpl( + _$NotificationsStateEmptyImpl _value, + $Res Function(_$NotificationsStateEmptyImpl) _then) + : super(_value, _then); } /// @nodoc @@ -217,7 +231,9 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateEmptyImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$NotificationsStateEmptyImpl); } @override @@ -304,16 +320,22 @@ abstract class NotificationsStateEmpty implements NotificationsState { /// @nodoc abstract class _$$NotificationsStateLoadedImplCopyWith<$Res> { - factory _$$NotificationsStateLoadedImplCopyWith(_$NotificationsStateLoadedImpl value, $Res Function(_$NotificationsStateLoadedImpl) then) = + factory _$$NotificationsStateLoadedImplCopyWith( + _$NotificationsStateLoadedImpl value, + $Res Function(_$NotificationsStateLoadedImpl) then) = __$$NotificationsStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({int notificationsCount}); } /// @nodoc -class __$$NotificationsStateLoadedImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateLoadedImpl> +class __$$NotificationsStateLoadedImplCopyWithImpl<$Res> + extends _$NotificationsStateCopyWithImpl<$Res, + _$NotificationsStateLoadedImpl> implements _$$NotificationsStateLoadedImplCopyWith<$Res> { - __$$NotificationsStateLoadedImplCopyWithImpl(_$NotificationsStateLoadedImpl _value, $Res Function(_$NotificationsStateLoadedImpl) _then) + __$$NotificationsStateLoadedImplCopyWithImpl( + _$NotificationsStateLoadedImpl _value, + $Res Function(_$NotificationsStateLoadedImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -348,7 +370,8 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateLoadedImpl && - (identical(other.notificationsCount, notificationsCount) || other.notificationsCount == notificationsCount)); + (identical(other.notificationsCount, notificationsCount) || + other.notificationsCount == notificationsCount)); } @override @@ -357,8 +380,9 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> get copyWith => - __$$NotificationsStateLoadedImplCopyWithImpl<_$NotificationsStateLoadedImpl>(this, _$identity); + _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> + get copyWith => __$$NotificationsStateLoadedImplCopyWithImpl< + _$NotificationsStateLoadedImpl>(this, _$identity); @override @optionalTypeArgs @@ -436,25 +460,34 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded { } abstract class NotificationsStateLoaded implements NotificationsState { - const factory NotificationsStateLoaded({required final int notificationsCount}) = _$NotificationsStateLoadedImpl; + const factory NotificationsStateLoaded( + {required final int notificationsCount}) = _$NotificationsStateLoadedImpl; int get notificationsCount; @JsonKey(ignore: true) - _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; + _$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> + get copyWith => throw _privateConstructorUsedError; } /// @nodoc abstract class _$$NotificationsStateErrorImplCopyWith<$Res> { - factory _$$NotificationsStateErrorImplCopyWith(_$NotificationsStateErrorImpl value, $Res Function(_$NotificationsStateErrorImpl) then) = + factory _$$NotificationsStateErrorImplCopyWith( + _$NotificationsStateErrorImpl value, + $Res Function(_$NotificationsStateErrorImpl) then) = __$$NotificationsStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$NotificationsStateErrorImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateErrorImpl> +class __$$NotificationsStateErrorImplCopyWithImpl<$Res> + extends _$NotificationsStateCopyWithImpl<$Res, + _$NotificationsStateErrorImpl> implements _$$NotificationsStateErrorImplCopyWith<$Res> { - __$$NotificationsStateErrorImplCopyWithImpl(_$NotificationsStateErrorImpl _value, $Res Function(_$NotificationsStateErrorImpl) _then) : super(_value, _then); + __$$NotificationsStateErrorImplCopyWithImpl( + _$NotificationsStateErrorImpl _value, + $Res Function(_$NotificationsStateErrorImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -488,7 +521,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateErrorImpl && - (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); } @override @@ -497,8 +531,9 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> get copyWith => - __$$NotificationsStateErrorImplCopyWithImpl<_$NotificationsStateErrorImpl>(this, _$identity); + _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> + get copyWith => __$$NotificationsStateErrorImplCopyWithImpl< + _$NotificationsStateErrorImpl>(this, _$identity); @override @optionalTypeArgs @@ -576,9 +611,11 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError { } abstract class NotificationsStateError implements NotificationsState { - const factory NotificationsStateError({required final String errorMessage}) = _$NotificationsStateErrorImpl; + const factory NotificationsStateError({required final String errorMessage}) = + _$NotificationsStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> get copyWith => throw _privateConstructorUsedError; + _$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_message_model.freezed.dart b/lib/features/chat/models/chat_message_model.freezed.dart index 90e7e724..76a91cbc 100644 --- a/lib/features/chat/models/chat_message_model.freezed.dart +++ b/lib/features/chat/models/chat_message_model.freezed.dart @@ -31,12 +31,15 @@ mixin _$ChatMessageModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatMessageModelCopyWith get copyWith => throw _privateConstructorUsedError; + $ChatMessageModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatMessageModelCopyWith<$Res> { - factory $ChatMessageModelCopyWith(ChatMessageModel value, $Res Function(ChatMessageModel) then) = _$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>; + factory $ChatMessageModelCopyWith( + ChatMessageModel value, $Res Function(ChatMessageModel) then) = + _$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>; @useResult $Res call( {int id, @@ -47,7 +50,8 @@ abstract class $ChatMessageModelCopyWith<$Res> { } /// @nodoc -class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> implements $ChatMessageModelCopyWith<$Res> { +class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> + implements $ChatMessageModelCopyWith<$Res> { _$ChatMessageModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -90,8 +94,10 @@ class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> implem } /// @nodoc -abstract class _$$ChatMessageModelImplCopyWith<$Res> implements $ChatMessageModelCopyWith<$Res> { - factory _$$ChatMessageModelImplCopyWith(_$ChatMessageModelImpl value, $Res Function(_$ChatMessageModelImpl) then) = +abstract class _$$ChatMessageModelImplCopyWith<$Res> + implements $ChatMessageModelCopyWith<$Res> { + factory _$$ChatMessageModelImplCopyWith(_$ChatMessageModelImpl value, + $Res Function(_$ChatMessageModelImpl) then) = __$$ChatMessageModelImplCopyWithImpl<$Res>; @override @useResult @@ -104,9 +110,12 @@ abstract class _$$ChatMessageModelImplCopyWith<$Res> implements $ChatMessageMode } /// @nodoc -class __$$ChatMessageModelImplCopyWithImpl<$Res> extends _$ChatMessageModelCopyWithImpl<$Res, _$ChatMessageModelImpl> +class __$$ChatMessageModelImplCopyWithImpl<$Res> + extends _$ChatMessageModelCopyWithImpl<$Res, _$ChatMessageModelImpl> implements _$$ChatMessageModelImplCopyWith<$Res> { - __$$ChatMessageModelImplCopyWithImpl(_$ChatMessageModelImpl _value, $Res Function(_$ChatMessageModelImpl) _then) : super(_value, _then); + __$$ChatMessageModelImplCopyWithImpl(_$ChatMessageModelImpl _value, + $Res Function(_$ChatMessageModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -153,7 +162,8 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { @JsonKey(name: 'updated_at') required this.updatedAt}) : _mediaData = mediaData; - factory _$ChatMessageModelImpl.fromJson(Map json) => _$$ChatMessageModelImplFromJson(json); + factory _$ChatMessageModelImpl.fromJson(Map json) => + _$$ChatMessageModelImplFromJson(json); @override final int id; @@ -189,19 +199,25 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { other is _$ChatMessageModelImpl && (identical(other.id, id) || other.id == id) && (identical(other.data, data) || other.data == data) && - const DeepCollectionEquality().equals(other._mediaData, _mediaData) && - (identical(other.authorId, authorId) || other.authorId == authorId) && - (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + const DeepCollectionEquality() + .equals(other._mediaData, _mediaData) && + (identical(other.authorId, authorId) || + other.authorId == authorId) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, data, const DeepCollectionEquality().hash(_mediaData), authorId, updatedAt); + int get hashCode => Object.hash(runtimeType, id, data, + const DeepCollectionEquality().hash(_mediaData), authorId, updatedAt); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => __$$ChatMessageModelImplCopyWithImpl<_$ChatMessageModelImpl>(this, _$identity); + _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => + __$$ChatMessageModelImplCopyWithImpl<_$ChatMessageModelImpl>( + this, _$identity); @override Map toJson() { @@ -213,13 +229,15 @@ class _$ChatMessageModelImpl implements _ChatMessageModel { abstract class _ChatMessageModel implements ChatMessageModel { const factory _ChatMessageModel( - {required final int id, - required final String data, - @JsonKey(name: 'media_data') required final List? mediaData, - @JsonKey(name: 'author_id') required final int authorId, - @JsonKey(name: 'updated_at') required final String updatedAt}) = _$ChatMessageModelImpl; + {required final int id, + required final String data, + @JsonKey(name: 'media_data') required final List? mediaData, + @JsonKey(name: 'author_id') required final int authorId, + @JsonKey(name: 'updated_at') required final String updatedAt}) = + _$ChatMessageModelImpl; - factory _ChatMessageModel.fromJson(Map json) = _$ChatMessageModelImpl.fromJson; + factory _ChatMessageModel.fromJson(Map json) = + _$ChatMessageModelImpl.fromJson; @override int get id; @@ -236,5 +254,6 @@ abstract class _ChatMessageModel implements ChatMessageModel { String get updatedAt; @override @JsonKey(ignore: true) - _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_message_model.g.dart b/lib/features/chat/models/chat_message_model.g.dart index 70531099..3a8d1827 100644 --- a/lib/features/chat/models/chat_message_model.g.dart +++ b/lib/features/chat/models/chat_message_model.g.dart @@ -6,7 +6,9 @@ part of 'chat_message_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatMessageModelImpl _$$ChatMessageModelImplFromJson(Map json) => _$ChatMessageModelImpl( +_$ChatMessageModelImpl _$$ChatMessageModelImplFromJson( + Map json) => + _$ChatMessageModelImpl( id: (json['id'] as num).toInt(), data: json['data'] as String, mediaData: json['media_data'] as List?, @@ -14,7 +16,9 @@ _$ChatMessageModelImpl _$$ChatMessageModelImplFromJson(Map json updatedAt: json['updated_at'] as String, ); -Map _$$ChatMessageModelImplToJson(_$ChatMessageModelImpl instance) => { +Map _$$ChatMessageModelImplToJson( + _$ChatMessageModelImpl instance) => + { 'id': instance.id, 'data': instance.data, 'media_data': instance.mediaData, diff --git a/lib/features/chat/models/chat_messages_model.freezed.dart b/lib/features/chat/models/chat_messages_model.freezed.dart index e7900ce5..a970241c 100644 --- a/lib/features/chat/models/chat_messages_model.freezed.dart +++ b/lib/features/chat/models/chat_messages_model.freezed.dart @@ -26,20 +26,26 @@ mixin _$ChatMessagesModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatMessagesModelCopyWith get copyWith => throw _privateConstructorUsedError; + $ChatMessagesModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatMessagesModelCopyWith<$Res> { - factory $ChatMessagesModelCopyWith(ChatMessagesModel value, $Res Function(ChatMessagesModel) then) = _$ChatMessagesModelCopyWithImpl<$Res, ChatMessagesModel>; + factory $ChatMessagesModelCopyWith( + ChatMessagesModel value, $Res Function(ChatMessagesModel) then) = + _$ChatMessagesModelCopyWithImpl<$Res, ChatMessagesModel>; @useResult - $Res call({@JsonKey(name: 'data') List messagesList, ChatMetaModel meta}); + $Res call( + {@JsonKey(name: 'data') List messagesList, + ChatMetaModel meta}); $ChatMetaModelCopyWith<$Res> get meta; } /// @nodoc -class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel> implements $ChatMessagesModelCopyWith<$Res> { +class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel> + implements $ChatMessagesModelCopyWith<$Res> { _$ChatMessagesModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -75,21 +81,28 @@ class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel> impl } /// @nodoc -abstract class _$$ChatMessagesModelImplCopyWith<$Res> implements $ChatMessagesModelCopyWith<$Res> { - factory _$$ChatMessagesModelImplCopyWith(_$ChatMessagesModelImpl value, $Res Function(_$ChatMessagesModelImpl) then) = +abstract class _$$ChatMessagesModelImplCopyWith<$Res> + implements $ChatMessagesModelCopyWith<$Res> { + factory _$$ChatMessagesModelImplCopyWith(_$ChatMessagesModelImpl value, + $Res Function(_$ChatMessagesModelImpl) then) = __$$ChatMessagesModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({@JsonKey(name: 'data') List messagesList, ChatMetaModel meta}); + $Res call( + {@JsonKey(name: 'data') List messagesList, + ChatMetaModel meta}); @override $ChatMetaModelCopyWith<$Res> get meta; } /// @nodoc -class __$$ChatMessagesModelImplCopyWithImpl<$Res> extends _$ChatMessagesModelCopyWithImpl<$Res, _$ChatMessagesModelImpl> +class __$$ChatMessagesModelImplCopyWithImpl<$Res> + extends _$ChatMessagesModelCopyWithImpl<$Res, _$ChatMessagesModelImpl> implements _$$ChatMessagesModelImplCopyWith<$Res> { - __$$ChatMessagesModelImplCopyWithImpl(_$ChatMessagesModelImpl _value, $Res Function(_$ChatMessagesModelImpl) _then) : super(_value, _then); + __$$ChatMessagesModelImplCopyWithImpl(_$ChatMessagesModelImpl _value, + $Res Function(_$ChatMessagesModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -113,9 +126,14 @@ class __$$ChatMessagesModelImplCopyWithImpl<$Res> extends _$ChatMessagesModelCop /// @nodoc @JsonSerializable() class _$ChatMessagesModelImpl implements _ChatMessagesModel { - const _$ChatMessagesModelImpl({@JsonKey(name: 'data') required final List messagesList, required this.meta}) : _messagesList = messagesList; + const _$ChatMessagesModelImpl( + {@JsonKey(name: 'data') + required final List messagesList, + required this.meta}) + : _messagesList = messagesList; - factory _$ChatMessagesModelImpl.fromJson(Map json) => _$$ChatMessagesModelImplFromJson(json); + factory _$ChatMessagesModelImpl.fromJson(Map json) => + _$$ChatMessagesModelImplFromJson(json); final List _messagesList; @override @@ -139,18 +157,22 @@ class _$ChatMessagesModelImpl implements _ChatMessagesModel { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatMessagesModelImpl && - const DeepCollectionEquality().equals(other._messagesList, _messagesList) && + const DeepCollectionEquality() + .equals(other._messagesList, _messagesList) && (identical(other.meta, meta) || other.meta == meta)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_messagesList), meta); + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_messagesList), meta); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith => __$$ChatMessagesModelImplCopyWithImpl<_$ChatMessagesModelImpl>(this, _$identity); + _$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith => + __$$ChatMessagesModelImplCopyWithImpl<_$ChatMessagesModelImpl>( + this, _$identity); @override Map toJson() { @@ -161,10 +183,13 @@ class _$ChatMessagesModelImpl implements _ChatMessagesModel { } abstract class _ChatMessagesModel implements ChatMessagesModel { - const factory _ChatMessagesModel({@JsonKey(name: 'data') required final List messagesList, required final ChatMetaModel meta}) = - _$ChatMessagesModelImpl; + const factory _ChatMessagesModel( + {@JsonKey(name: 'data') + required final List messagesList, + required final ChatMetaModel meta}) = _$ChatMessagesModelImpl; - factory _ChatMessagesModel.fromJson(Map json) = _$ChatMessagesModelImpl.fromJson; + factory _ChatMessagesModel.fromJson(Map json) = + _$ChatMessagesModelImpl.fromJson; @override @JsonKey(name: 'data') @@ -173,5 +198,6 @@ abstract class _ChatMessagesModel implements ChatMessagesModel { ChatMetaModel get meta; @override @JsonKey(ignore: true) - _$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_messages_model.g.dart b/lib/features/chat/models/chat_messages_model.g.dart index 1a7fe48b..6216cd83 100644 --- a/lib/features/chat/models/chat_messages_model.g.dart +++ b/lib/features/chat/models/chat_messages_model.g.dart @@ -6,12 +6,18 @@ part of 'chat_messages_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatMessagesModelImpl _$$ChatMessagesModelImplFromJson(Map json) => _$ChatMessagesModelImpl( - messagesList: (json['data'] as List).map((e) => ChatMessageModel.fromJson(e as Map)).toList(), +_$ChatMessagesModelImpl _$$ChatMessagesModelImplFromJson( + Map json) => + _$ChatMessagesModelImpl( + messagesList: (json['data'] as List) + .map((e) => ChatMessageModel.fromJson(e as Map)) + .toList(), meta: ChatMetaModel.fromJson(json['meta'] as Map), ); -Map _$$ChatMessagesModelImplToJson(_$ChatMessagesModelImpl instance) => { +Map _$$ChatMessagesModelImplToJson( + _$ChatMessagesModelImpl instance) => + { 'data': instance.messagesList, 'meta': instance.meta, }; diff --git a/lib/features/chat/models/chat_meta_model.freezed.dart b/lib/features/chat/models/chat_meta_model.freezed.dart index 91eec021..11ecb9e2 100644 --- a/lib/features/chat/models/chat_meta_model.freezed.dart +++ b/lib/features/chat/models/chat_meta_model.freezed.dart @@ -25,18 +25,22 @@ mixin _$ChatMetaModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatMetaModelCopyWith get copyWith => throw _privateConstructorUsedError; + $ChatMetaModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatMetaModelCopyWith<$Res> { - factory $ChatMetaModelCopyWith(ChatMetaModel value, $Res Function(ChatMetaModel) then) = _$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>; + factory $ChatMetaModelCopyWith( + ChatMetaModel value, $Res Function(ChatMetaModel) then) = + _$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>; @useResult $Res call({@JsonKey(name: "last_page") int lastPage}); } /// @nodoc -class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> implements $ChatMetaModelCopyWith<$Res> { +class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> + implements $ChatMetaModelCopyWith<$Res> { _$ChatMetaModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -59,16 +63,23 @@ class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> implements $ } /// @nodoc -abstract class _$$ChatMetaModelImplCopyWith<$Res> implements $ChatMetaModelCopyWith<$Res> { - factory _$$ChatMetaModelImplCopyWith(_$ChatMetaModelImpl value, $Res Function(_$ChatMetaModelImpl) then) = __$$ChatMetaModelImplCopyWithImpl<$Res>; +abstract class _$$ChatMetaModelImplCopyWith<$Res> + implements $ChatMetaModelCopyWith<$Res> { + factory _$$ChatMetaModelImplCopyWith( + _$ChatMetaModelImpl value, $Res Function(_$ChatMetaModelImpl) then) = + __$$ChatMetaModelImplCopyWithImpl<$Res>; @override @useResult $Res call({@JsonKey(name: "last_page") int lastPage}); } /// @nodoc -class __$$ChatMetaModelImplCopyWithImpl<$Res> extends _$ChatMetaModelCopyWithImpl<$Res, _$ChatMetaModelImpl> implements _$$ChatMetaModelImplCopyWith<$Res> { - __$$ChatMetaModelImplCopyWithImpl(_$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then) : super(_value, _then); +class __$$ChatMetaModelImplCopyWithImpl<$Res> + extends _$ChatMetaModelCopyWithImpl<$Res, _$ChatMetaModelImpl> + implements _$$ChatMetaModelImplCopyWith<$Res> { + __$$ChatMetaModelImplCopyWithImpl( + _$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -87,9 +98,11 @@ class __$$ChatMetaModelImplCopyWithImpl<$Res> extends _$ChatMetaModelCopyWithImp /// @nodoc @JsonSerializable() class _$ChatMetaModelImpl implements _ChatMetaModel { - const _$ChatMetaModelImpl({@JsonKey(name: "last_page") required this.lastPage}); + const _$ChatMetaModelImpl( + {@JsonKey(name: "last_page") required this.lastPage}); - factory _$ChatMetaModelImpl.fromJson(Map json) => _$$ChatMetaModelImplFromJson(json); + factory _$ChatMetaModelImpl.fromJson(Map json) => + _$$ChatMetaModelImplFromJson(json); @override @JsonKey(name: "last_page") @@ -103,7 +116,10 @@ class _$ChatMetaModelImpl implements _ChatMetaModel { @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$ChatMetaModelImpl && (identical(other.lastPage, lastPage) || other.lastPage == lastPage)); + (other.runtimeType == runtimeType && + other is _$ChatMetaModelImpl && + (identical(other.lastPage, lastPage) || + other.lastPage == lastPage)); } @JsonKey(ignore: true) @@ -113,7 +129,8 @@ class _$ChatMetaModelImpl implements _ChatMetaModel { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => __$$ChatMetaModelImplCopyWithImpl<_$ChatMetaModelImpl>(this, _$identity); + _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => + __$$ChatMetaModelImplCopyWithImpl<_$ChatMetaModelImpl>(this, _$identity); @override Map toJson() { @@ -124,14 +141,18 @@ class _$ChatMetaModelImpl implements _ChatMetaModel { } abstract class _ChatMetaModel implements ChatMetaModel { - const factory _ChatMetaModel({@JsonKey(name: "last_page") required final int lastPage}) = _$ChatMetaModelImpl; + const factory _ChatMetaModel( + {@JsonKey(name: "last_page") required final int lastPage}) = + _$ChatMetaModelImpl; - factory _ChatMetaModel.fromJson(Map json) = _$ChatMetaModelImpl.fromJson; + factory _ChatMetaModel.fromJson(Map json) = + _$ChatMetaModelImpl.fromJson; @override @JsonKey(name: "last_page") int get lastPage; @override @JsonKey(ignore: true) - _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_meta_model.g.dart b/lib/features/chat/models/chat_meta_model.g.dart index bbd16d10..7126e2dd 100644 --- a/lib/features/chat/models/chat_meta_model.g.dart +++ b/lib/features/chat/models/chat_meta_model.g.dart @@ -6,10 +6,12 @@ part of 'chat_meta_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatMetaModelImpl _$$ChatMetaModelImplFromJson(Map json) => _$ChatMetaModelImpl( +_$ChatMetaModelImpl _$$ChatMetaModelImplFromJson(Map json) => + _$ChatMetaModelImpl( lastPage: (json['last_page'] as num).toInt(), ); -Map _$$ChatMetaModelImplToJson(_$ChatMetaModelImpl instance) => { +Map _$$ChatMetaModelImplToJson(_$ChatMetaModelImpl instance) => + { 'last_page': instance.lastPage, }; diff --git a/lib/features/chat/models/chat_room_model.freezed.dart b/lib/features/chat/models/chat_room_model.freezed.dart index 216c1b65..5a0b6e62 100644 --- a/lib/features/chat/models/chat_room_model.freezed.dart +++ b/lib/features/chat/models/chat_room_model.freezed.dart @@ -22,25 +22,34 @@ ChatRoomModel _$ChatRoomModelFromJson(Map json) { mixin _$ChatRoomModel { String get id => throw _privateConstructorUsedError; @JsonKey(name: 'chat_room_setting') - ChatRoomSettingsModel get chatRoomSettings => throw _privateConstructorUsedError; + ChatRoomSettingsModel get chatRoomSettings => + throw _privateConstructorUsedError; Map get users => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatRoomModelCopyWith get copyWith => throw _privateConstructorUsedError; + $ChatRoomModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatRoomModelCopyWith<$Res> { - factory $ChatRoomModelCopyWith(ChatRoomModel value, $Res Function(ChatRoomModel) then) = _$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>; + factory $ChatRoomModelCopyWith( + ChatRoomModel value, $Res Function(ChatRoomModel) then) = + _$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>; @useResult - $Res call({String id, @JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings, Map users}); + $Res call( + {String id, + @JsonKey(name: 'chat_room_setting') + ChatRoomSettingsModel chatRoomSettings, + Map users}); $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings; } /// @nodoc -class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> implements $ChatRoomModelCopyWith<$Res> { +class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> + implements $ChatRoomModelCopyWith<$Res> { _$ChatRoomModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -74,26 +83,38 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> implements $ @override @pragma('vm:prefer-inline') $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings { - return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings, (value) { + return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings, + (value) { return _then(_value.copyWith(chatRoomSettings: value) as $Val); }); } } /// @nodoc -abstract class _$$ChatRoomModelImplCopyWith<$Res> implements $ChatRoomModelCopyWith<$Res> { - factory _$$ChatRoomModelImplCopyWith(_$ChatRoomModelImpl value, $Res Function(_$ChatRoomModelImpl) then) = __$$ChatRoomModelImplCopyWithImpl<$Res>; +abstract class _$$ChatRoomModelImplCopyWith<$Res> + implements $ChatRoomModelCopyWith<$Res> { + factory _$$ChatRoomModelImplCopyWith( + _$ChatRoomModelImpl value, $Res Function(_$ChatRoomModelImpl) then) = + __$$ChatRoomModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({String id, @JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings, Map users}); + $Res call( + {String id, + @JsonKey(name: 'chat_room_setting') + ChatRoomSettingsModel chatRoomSettings, + Map users}); @override $ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings; } /// @nodoc -class __$$ChatRoomModelImplCopyWithImpl<$Res> extends _$ChatRoomModelCopyWithImpl<$Res, _$ChatRoomModelImpl> implements _$$ChatRoomModelImplCopyWith<$Res> { - __$$ChatRoomModelImplCopyWithImpl(_$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then) : super(_value, _then); +class __$$ChatRoomModelImplCopyWithImpl<$Res> + extends _$ChatRoomModelCopyWithImpl<$Res, _$ChatRoomModelImpl> + implements _$$ChatRoomModelImplCopyWith<$Res> { + __$$ChatRoomModelImplCopyWithImpl( + _$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -123,10 +144,13 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res> extends _$ChatRoomModelCopyWithImp @JsonSerializable() class _$ChatRoomModelImpl implements _ChatRoomModel { const _$ChatRoomModelImpl( - {required this.id, @JsonKey(name: 'chat_room_setting') required this.chatRoomSettings, required final Map users}) + {required this.id, + @JsonKey(name: 'chat_room_setting') required this.chatRoomSettings, + required final Map users}) : _users = users; - factory _$ChatRoomModelImpl.fromJson(Map json) => _$$ChatRoomModelImplFromJson(json); + factory _$ChatRoomModelImpl.fromJson(Map json) => + _$$ChatRoomModelImplFromJson(json); @override final String id; @@ -152,18 +176,21 @@ class _$ChatRoomModelImpl implements _ChatRoomModel { (other.runtimeType == runtimeType && other is _$ChatRoomModelImpl && (identical(other.id, id) || other.id == id) && - (identical(other.chatRoomSettings, chatRoomSettings) || other.chatRoomSettings == chatRoomSettings) && + (identical(other.chatRoomSettings, chatRoomSettings) || + other.chatRoomSettings == chatRoomSettings) && const DeepCollectionEquality().equals(other._users, _users)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, chatRoomSettings, const DeepCollectionEquality().hash(_users)); + int get hashCode => Object.hash(runtimeType, id, chatRoomSettings, + const DeepCollectionEquality().hash(_users)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => __$$ChatRoomModelImplCopyWithImpl<_$ChatRoomModelImpl>(this, _$identity); + _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => + __$$ChatRoomModelImplCopyWithImpl<_$ChatRoomModelImpl>(this, _$identity); @override Map toJson() { @@ -176,10 +203,12 @@ class _$ChatRoomModelImpl implements _ChatRoomModel { abstract class _ChatRoomModel implements ChatRoomModel { const factory _ChatRoomModel( {required final String id, - @JsonKey(name: 'chat_room_setting') required final ChatRoomSettingsModel chatRoomSettings, + @JsonKey(name: 'chat_room_setting') + required final ChatRoomSettingsModel chatRoomSettings, required final Map users}) = _$ChatRoomModelImpl; - factory _ChatRoomModel.fromJson(Map json) = _$ChatRoomModelImpl.fromJson; + factory _ChatRoomModel.fromJson(Map json) = + _$ChatRoomModelImpl.fromJson; @override String get id; @@ -190,5 +219,6 @@ abstract class _ChatRoomModel implements ChatRoomModel { Map get users; @override @JsonKey(ignore: true) - _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_room_model.g.dart b/lib/features/chat/models/chat_room_model.g.dart index 6230d4f4..68d3195c 100644 --- a/lib/features/chat/models/chat_room_model.g.dart +++ b/lib/features/chat/models/chat_room_model.g.dart @@ -6,15 +6,19 @@ part of 'chat_room_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatRoomModelImpl _$$ChatRoomModelImplFromJson(Map json) => _$ChatRoomModelImpl( +_$ChatRoomModelImpl _$$ChatRoomModelImplFromJson(Map json) => + _$ChatRoomModelImpl( id: json['id'] as String, - chatRoomSettings: ChatRoomSettingsModel.fromJson(json['chat_room_setting'] as Map), + chatRoomSettings: ChatRoomSettingsModel.fromJson( + json['chat_room_setting'] as Map), users: (json['users'] as Map).map( - (k, e) => MapEntry(k, ChatUserModel.fromJson(e as Map)), + (k, e) => + MapEntry(k, ChatUserModel.fromJson(e as Map)), ), ); -Map _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) => { +Map _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) => + { 'id': instance.id, 'chat_room_setting': instance.chatRoomSettings, 'users': instance.users, diff --git a/lib/features/chat/models/chat_room_settings_model.freezed.dart b/lib/features/chat/models/chat_room_settings_model.freezed.dart index af237724..4f217556 100644 --- a/lib/features/chat/models/chat_room_settings_model.freezed.dart +++ b/lib/features/chat/models/chat_room_settings_model.freezed.dart @@ -14,7 +14,8 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); -ChatRoomSettingsModel _$ChatRoomSettingsModelFromJson(Map json) { +ChatRoomSettingsModel _$ChatRoomSettingsModelFromJson( + Map json) { return _ChatRoomSettingsModel.fromJson(json); } @@ -31,12 +32,14 @@ mixin _$ChatRoomSettingsModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatRoomSettingsModelCopyWith get copyWith => throw _privateConstructorUsedError; + $ChatRoomSettingsModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatRoomSettingsModelCopyWith<$Res> { - factory $ChatRoomSettingsModelCopyWith(ChatRoomSettingsModel value, $Res Function(ChatRoomSettingsModel) then) = + factory $ChatRoomSettingsModelCopyWith(ChatRoomSettingsModel value, + $Res Function(ChatRoomSettingsModel) then) = _$ChatRoomSettingsModelCopyWithImpl<$Res, ChatRoomSettingsModel>; @useResult $Res call( @@ -48,7 +51,9 @@ abstract class $ChatRoomSettingsModelCopyWith<$Res> { } /// @nodoc -class _$ChatRoomSettingsModelCopyWithImpl<$Res, $Val extends ChatRoomSettingsModel> implements $ChatRoomSettingsModelCopyWith<$Res> { +class _$ChatRoomSettingsModelCopyWithImpl<$Res, + $Val extends ChatRoomSettingsModel> + implements $ChatRoomSettingsModelCopyWith<$Res> { _$ChatRoomSettingsModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -91,8 +96,11 @@ class _$ChatRoomSettingsModelCopyWithImpl<$Res, $Val extends ChatRoomSettingsMod } /// @nodoc -abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> implements $ChatRoomSettingsModelCopyWith<$Res> { - factory _$$ChatRoomSettingsModelImplCopyWith(_$ChatRoomSettingsModelImpl value, $Res Function(_$ChatRoomSettingsModelImpl) then) = +abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> + implements $ChatRoomSettingsModelCopyWith<$Res> { + factory _$$ChatRoomSettingsModelImplCopyWith( + _$ChatRoomSettingsModelImpl value, + $Res Function(_$ChatRoomSettingsModelImpl) then) = __$$ChatRoomSettingsModelImplCopyWithImpl<$Res>; @override @useResult @@ -105,9 +113,13 @@ abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> implements $ChatRoomSe } /// @nodoc -class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res> extends _$ChatRoomSettingsModelCopyWithImpl<$Res, _$ChatRoomSettingsModelImpl> +class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res> + extends _$ChatRoomSettingsModelCopyWithImpl<$Res, + _$ChatRoomSettingsModelImpl> implements _$$ChatRoomSettingsModelImplCopyWith<$Res> { - __$$ChatRoomSettingsModelImplCopyWithImpl(_$ChatRoomSettingsModelImpl _value, $Res Function(_$ChatRoomSettingsModelImpl) _then) : super(_value, _then); + __$$ChatRoomSettingsModelImplCopyWithImpl(_$ChatRoomSettingsModelImpl _value, + $Res Function(_$ChatRoomSettingsModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -153,7 +165,8 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel { @JsonKey(name: 'access_level') required this.accessLevel, @JsonKey(name: 'updated_at') required this.updatedAt}); - factory _$ChatRoomSettingsModelImpl.fromJson(Map json) => _$$ChatRoomSettingsModelImplFromJson(json); + factory _$ChatRoomSettingsModelImpl.fromJson(Map json) => + _$$ChatRoomSettingsModelImplFromJson(json); @override final int id; @@ -180,21 +193,26 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel { (other.runtimeType == runtimeType && other is _$ChatRoomSettingsModelImpl && (identical(other.id, id) || other.id == id) && - (identical(other.roomName, roomName) || other.roomName == roomName) && + (identical(other.roomName, roomName) || + other.roomName == roomName) && (identical(other.state, state) || other.state == state) && - (identical(other.accessLevel, accessLevel) || other.accessLevel == accessLevel) && - (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + (identical(other.accessLevel, accessLevel) || + other.accessLevel == accessLevel) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, roomName, state, accessLevel, updatedAt); + int get hashCode => + Object.hash(runtimeType, id, roomName, state, accessLevel, updatedAt); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> get copyWith => - __$$ChatRoomSettingsModelImplCopyWithImpl<_$ChatRoomSettingsModelImpl>(this, _$identity); + _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> + get copyWith => __$$ChatRoomSettingsModelImplCopyWithImpl< + _$ChatRoomSettingsModelImpl>(this, _$identity); @override Map toJson() { @@ -206,13 +224,15 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel { abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel { const factory _ChatRoomSettingsModel( - {required final int id, - @JsonKey(name: 'room_name') required final String roomName, - required final String state, - @JsonKey(name: 'access_level') required final String accessLevel, - @JsonKey(name: 'updated_at') required final String updatedAt}) = _$ChatRoomSettingsModelImpl; + {required final int id, + @JsonKey(name: 'room_name') required final String roomName, + required final String state, + @JsonKey(name: 'access_level') required final String accessLevel, + @JsonKey(name: 'updated_at') required final String updatedAt}) = + _$ChatRoomSettingsModelImpl; - factory _ChatRoomSettingsModel.fromJson(Map json) = _$ChatRoomSettingsModelImpl.fromJson; + factory _ChatRoomSettingsModel.fromJson(Map json) = + _$ChatRoomSettingsModelImpl.fromJson; @override int get id; @@ -229,5 +249,6 @@ abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel { String get updatedAt; @override @JsonKey(ignore: true) - _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_room_settings_model.g.dart b/lib/features/chat/models/chat_room_settings_model.g.dart index 1a2ef327..7b824334 100644 --- a/lib/features/chat/models/chat_room_settings_model.g.dart +++ b/lib/features/chat/models/chat_room_settings_model.g.dart @@ -6,7 +6,9 @@ part of 'chat_room_settings_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson(Map json) => _$ChatRoomSettingsModelImpl( +_$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson( + Map json) => + _$ChatRoomSettingsModelImpl( id: (json['id'] as num).toInt(), roomName: json['room_name'] as String, state: json['state'] as String, @@ -14,7 +16,9 @@ _$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson(Map _$$ChatRoomSettingsModelImplToJson(_$ChatRoomSettingsModelImpl instance) => { +Map _$$ChatRoomSettingsModelImplToJson( + _$ChatRoomSettingsModelImpl instance) => + { 'id': instance.id, 'room_name': instance.roomName, 'state': instance.state, diff --git a/lib/features/chat/models/chat_user_model.freezed.dart b/lib/features/chat/models/chat_user_model.freezed.dart index 2827fa17..095c09e2 100644 --- a/lib/features/chat/models/chat_user_model.freezed.dart +++ b/lib/features/chat/models/chat_user_model.freezed.dart @@ -29,18 +29,26 @@ mixin _$ChatUserModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ChatUserModelCopyWith get copyWith => throw _privateConstructorUsedError; + $ChatUserModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $ChatUserModelCopyWith<$Res> { - factory $ChatUserModelCopyWith(ChatUserModel value, $Res Function(ChatUserModel) then) = _$ChatUserModelCopyWithImpl<$Res, ChatUserModel>; + factory $ChatUserModelCopyWith( + ChatUserModel value, $Res Function(ChatUserModel) then) = + _$ChatUserModelCopyWithImpl<$Res, ChatUserModel>; @useResult - $Res call({int id, String name, @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); + $Res call( + {int id, + String name, + @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, + @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); } /// @nodoc -class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> implements $ChatUserModelCopyWith<$Res> { +class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> + implements $ChatUserModelCopyWith<$Res> { _$ChatUserModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -78,16 +86,27 @@ class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> implements $ } /// @nodoc -abstract class _$$ChatUserModelImplCopyWith<$Res> implements $ChatUserModelCopyWith<$Res> { - factory _$$ChatUserModelImplCopyWith(_$ChatUserModelImpl value, $Res Function(_$ChatUserModelImpl) then) = __$$ChatUserModelImplCopyWithImpl<$Res>; +abstract class _$$ChatUserModelImplCopyWith<$Res> + implements $ChatUserModelCopyWith<$Res> { + factory _$$ChatUserModelImplCopyWith( + _$ChatUserModelImpl value, $Res Function(_$ChatUserModelImpl) then) = + __$$ChatUserModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({int id, String name, @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); + $Res call( + {int id, + String name, + @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, + @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl}); } /// @nodoc -class __$$ChatUserModelImplCopyWithImpl<$Res> extends _$ChatUserModelCopyWithImpl<$Res, _$ChatUserModelImpl> implements _$$ChatUserModelImplCopyWith<$Res> { - __$$ChatUserModelImplCopyWithImpl(_$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then) : super(_value, _then); +class __$$ChatUserModelImplCopyWithImpl<$Res> + extends _$ChatUserModelCopyWithImpl<$Res, _$ChatUserModelImpl> + implements _$$ChatUserModelImplCopyWith<$Res> { + __$$ChatUserModelImplCopyWithImpl( + _$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -127,7 +146,8 @@ class _$ChatUserModelImpl implements _ChatUserModel { @JsonKey(name: 'profile_photo_path') this.profilePhotoPath, @JsonKey(name: 'profile_photo_url') this.profilePhotoUrl}); - factory _$ChatUserModelImpl.fromJson(Map json) => _$$ChatUserModelImplFromJson(json); + factory _$ChatUserModelImpl.fromJson(Map json) => + _$$ChatUserModelImplFromJson(json); @override final int id; @@ -152,18 +172,22 @@ class _$ChatUserModelImpl implements _ChatUserModel { other is _$ChatUserModelImpl && (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && - (identical(other.profilePhotoPath, profilePhotoPath) || other.profilePhotoPath == profilePhotoPath) && - (identical(other.profilePhotoUrl, profilePhotoUrl) || other.profilePhotoUrl == profilePhotoUrl)); + (identical(other.profilePhotoPath, profilePhotoPath) || + other.profilePhotoPath == profilePhotoPath) && + (identical(other.profilePhotoUrl, profilePhotoUrl) || + other.profilePhotoUrl == profilePhotoUrl)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl); + int get hashCode => + Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => __$$ChatUserModelImplCopyWithImpl<_$ChatUserModelImpl>(this, _$identity); + _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => + __$$ChatUserModelImplCopyWithImpl<_$ChatUserModelImpl>(this, _$identity); @override Map toJson() { @@ -175,12 +199,14 @@ class _$ChatUserModelImpl implements _ChatUserModel { abstract class _ChatUserModel implements ChatUserModel { const factory _ChatUserModel( - {required final int id, - required final String name, - @JsonKey(name: 'profile_photo_path') final String? profilePhotoPath, - @JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl}) = _$ChatUserModelImpl; + {required final int id, + required final String name, + @JsonKey(name: 'profile_photo_path') final String? profilePhotoPath, + @JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl}) = + _$ChatUserModelImpl; - factory _ChatUserModel.fromJson(Map json) = _$ChatUserModelImpl.fromJson; + factory _ChatUserModel.fromJson(Map json) = + _$ChatUserModelImpl.fromJson; @override int get id; @@ -194,5 +220,6 @@ abstract class _ChatUserModel implements ChatUserModel { String? get profilePhotoUrl; @override @JsonKey(ignore: true) - _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/chat_user_model.g.dart b/lib/features/chat/models/chat_user_model.g.dart index 06fa92a0..78e0f981 100644 --- a/lib/features/chat/models/chat_user_model.g.dart +++ b/lib/features/chat/models/chat_user_model.g.dart @@ -6,14 +6,16 @@ part of 'chat_user_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$ChatUserModelImpl _$$ChatUserModelImplFromJson(Map json) => _$ChatUserModelImpl( +_$ChatUserModelImpl _$$ChatUserModelImplFromJson(Map json) => + _$ChatUserModelImpl( id: (json['id'] as num).toInt(), name: json['name'] as String, profilePhotoPath: json['profile_photo_path'] as String?, profilePhotoUrl: json['profile_photo_url'] as String?, ); -Map _$$ChatUserModelImplToJson(_$ChatUserModelImpl instance) => { +Map _$$ChatUserModelImplToJson(_$ChatUserModelImpl instance) => + { 'id': instance.id, 'name': instance.name, 'profile_photo_path': instance.profilePhotoPath, diff --git a/lib/features/chat/models/websocket_info_model.freezed.dart b/lib/features/chat/models/websocket_info_model.freezed.dart index 2f50540e..cd383a2b 100644 --- a/lib/features/chat/models/websocket_info_model.freezed.dart +++ b/lib/features/chat/models/websocket_info_model.freezed.dart @@ -29,19 +29,27 @@ mixin _$WebsocketInfoModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $WebsocketInfoModelCopyWith get copyWith => throw _privateConstructorUsedError; + $WebsocketInfoModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $WebsocketInfoModelCopyWith<$Res> { - factory $WebsocketInfoModelCopyWith(WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) = + factory $WebsocketInfoModelCopyWith( + WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) = _$WebsocketInfoModelCopyWithImpl<$Res, WebsocketInfoModel>; @useResult - $Res call({String key, String host, String port, String cluster, @JsonKey(name: 'user_id') int userId}); + $Res call( + {String key, + String host, + String port, + String cluster, + @JsonKey(name: 'user_id') int userId}); } /// @nodoc -class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> implements $WebsocketInfoModelCopyWith<$Res> { +class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> + implements $WebsocketInfoModelCopyWith<$Res> { _$WebsocketInfoModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -84,18 +92,28 @@ class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> im } /// @nodoc -abstract class _$$WebsocketInfoModelImplCopyWith<$Res> implements $WebsocketInfoModelCopyWith<$Res> { - factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value, $Res Function(_$WebsocketInfoModelImpl) then) = +abstract class _$$WebsocketInfoModelImplCopyWith<$Res> + implements $WebsocketInfoModelCopyWith<$Res> { + factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value, + $Res Function(_$WebsocketInfoModelImpl) then) = __$$WebsocketInfoModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({String key, String host, String port, String cluster, @JsonKey(name: 'user_id') int userId}); + $Res call( + {String key, + String host, + String port, + String cluster, + @JsonKey(name: 'user_id') int userId}); } /// @nodoc -class __$$WebsocketInfoModelImplCopyWithImpl<$Res> extends _$WebsocketInfoModelCopyWithImpl<$Res, _$WebsocketInfoModelImpl> +class __$$WebsocketInfoModelImplCopyWithImpl<$Res> + extends _$WebsocketInfoModelCopyWithImpl<$Res, _$WebsocketInfoModelImpl> implements _$$WebsocketInfoModelImplCopyWith<$Res> { - __$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value, $Res Function(_$WebsocketInfoModelImpl) _then) : super(_value, _then); + __$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value, + $Res Function(_$WebsocketInfoModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -135,9 +153,14 @@ class __$$WebsocketInfoModelImplCopyWithImpl<$Res> extends _$WebsocketInfoModelC @JsonSerializable() class _$WebsocketInfoModelImpl implements _WebsocketInfoModel { const _$WebsocketInfoModelImpl( - {required this.key, required this.host, required this.port, required this.cluster, @JsonKey(name: 'user_id') required this.userId}); + {required this.key, + required this.host, + required this.port, + required this.cluster, + @JsonKey(name: 'user_id') required this.userId}); - factory _$WebsocketInfoModelImpl.fromJson(Map json) => _$$WebsocketInfoModelImplFromJson(json); + factory _$WebsocketInfoModelImpl.fromJson(Map json) => + _$$WebsocketInfoModelImplFromJson(json); @override final String key; @@ -170,13 +193,15 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel { @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, key, host, port, cluster, userId); + int get hashCode => + Object.hash(runtimeType, key, host, port, cluster, userId); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith => - __$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>(this, _$identity); + __$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>( + this, _$identity); @override Map toJson() { @@ -188,13 +213,15 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel { abstract class _WebsocketInfoModel implements WebsocketInfoModel { const factory _WebsocketInfoModel( - {required final String key, - required final String host, - required final String port, - required final String cluster, - @JsonKey(name: 'user_id') required final int userId}) = _$WebsocketInfoModelImpl; + {required final String key, + required final String host, + required final String port, + required final String cluster, + @JsonKey(name: 'user_id') required final int userId}) = + _$WebsocketInfoModelImpl; - factory _WebsocketInfoModel.fromJson(Map json) = _$WebsocketInfoModelImpl.fromJson; + factory _WebsocketInfoModel.fromJson(Map json) = + _$WebsocketInfoModelImpl.fromJson; @override String get key; @@ -209,5 +236,6 @@ abstract class _WebsocketInfoModel implements WebsocketInfoModel { int get userId; @override @JsonKey(ignore: true) - _$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/models/websocket_info_model.g.dart b/lib/features/chat/models/websocket_info_model.g.dart index 91c386f8..b2bb1248 100644 --- a/lib/features/chat/models/websocket_info_model.g.dart +++ b/lib/features/chat/models/websocket_info_model.g.dart @@ -6,7 +6,9 @@ part of 'websocket_info_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson(Map json) => _$WebsocketInfoModelImpl( +_$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson( + Map json) => + _$WebsocketInfoModelImpl( key: json['key'] as String, host: json['host'] as String, port: json['port'] as String, @@ -14,7 +16,9 @@ _$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson(Map userId: (json['user_id'] as num).toInt(), ); -Map _$$WebsocketInfoModelImplToJson(_$WebsocketInfoModelImpl instance) => { +Map _$$WebsocketInfoModelImplToJson( + _$WebsocketInfoModelImpl instance) => + { 'key': instance.key, 'host': instance.host, 'port': instance.port, diff --git a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart index 715c1ab4..43bf9df9 100644 --- a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart +++ b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.freezed.dart @@ -20,7 +20,9 @@ mixin _$ChatRoomState { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, + required TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) => throw _privateConstructorUsedError; @@ -28,7 +30,9 @@ mixin _$ChatRoomState { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult? Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) => throw _privateConstructorUsedError; @@ -36,7 +40,9 @@ mixin _$ChatRoomState { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) => @@ -70,11 +76,14 @@ mixin _$ChatRoomState { /// @nodoc abstract class $ChatRoomStateCopyWith<$Res> { - factory $ChatRoomStateCopyWith(ChatRoomState value, $Res Function(ChatRoomState) then) = _$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>; + factory $ChatRoomStateCopyWith( + ChatRoomState value, $Res Function(ChatRoomState) then) = + _$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>; } /// @nodoc -class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState> implements $ChatRoomStateCopyWith<$Res> { +class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState> + implements $ChatRoomStateCopyWith<$Res> { _$ChatRoomStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -85,12 +94,18 @@ class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState> implements $ /// @nodoc abstract class _$$ChatRoomStateImplCopyWith<$Res> { - factory _$$ChatRoomStateImplCopyWith(_$ChatRoomStateImpl value, $Res Function(_$ChatRoomStateImpl) then) = __$$ChatRoomStateImplCopyWithImpl<$Res>; + factory _$$ChatRoomStateImplCopyWith( + _$ChatRoomStateImpl value, $Res Function(_$ChatRoomStateImpl) then) = + __$$ChatRoomStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$ChatRoomStateImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateImpl> implements _$$ChatRoomStateImplCopyWith<$Res> { - __$$ChatRoomStateImplCopyWithImpl(_$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then) : super(_value, _then); +class __$$ChatRoomStateImplCopyWithImpl<$Res> + extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateImpl> + implements _$$ChatRoomStateImplCopyWith<$Res> { + __$$ChatRoomStateImplCopyWithImpl( + _$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then) + : super(_value, _then); } /// @nodoc @@ -105,7 +120,8 @@ class _$ChatRoomStateImpl implements _ChatRoomState { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$ChatRoomStateImpl); } @override @@ -116,7 +132,9 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, + required TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return $default(); @@ -127,7 +145,9 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult? Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return $default?.call(); @@ -138,7 +158,9 @@ class _$ChatRoomStateImpl implements _ChatRoomState { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -192,14 +214,18 @@ abstract class _ChatRoomState implements ChatRoomState { /// @nodoc abstract class _$$ChatRoomStateLoadingImplCopyWith<$Res> { - factory _$$ChatRoomStateLoadingImplCopyWith(_$ChatRoomStateLoadingImpl value, $Res Function(_$ChatRoomStateLoadingImpl) then) = + factory _$$ChatRoomStateLoadingImplCopyWith(_$ChatRoomStateLoadingImpl value, + $Res Function(_$ChatRoomStateLoadingImpl) then) = __$$ChatRoomStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc -class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadingImpl> +class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res> + extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadingImpl> implements _$$ChatRoomStateLoadingImplCopyWith<$Res> { - __$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value, $Res Function(_$ChatRoomStateLoadingImpl) _then) : super(_value, _then); + __$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value, + $Res Function(_$ChatRoomStateLoadingImpl) _then) + : super(_value, _then); } /// @nodoc @@ -214,7 +240,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateLoadingImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ChatRoomStateLoadingImpl); } @override @@ -225,7 +253,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, + required TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return loading(); @@ -236,7 +266,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult? Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return loading?.call(); @@ -247,7 +279,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -301,18 +335,26 @@ abstract class ChatRoomStateLoading implements ChatRoomState { /// @nodoc abstract class _$$ChatRoomStateLoadedImplCopyWith<$Res> { - factory _$$ChatRoomStateLoadedImplCopyWith(_$ChatRoomStateLoadedImpl value, $Res Function(_$ChatRoomStateLoadedImpl) then) = + factory _$$ChatRoomStateLoadedImplCopyWith(_$ChatRoomStateLoadedImpl value, + $Res Function(_$ChatRoomStateLoadedImpl) then) = __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>; @useResult - $Res call({ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading}); + $Res call( + {ChatRoomModel chatRoom, + List chatMessages, + bool isTyping, + bool isLoading}); $ChatRoomModelCopyWith<$Res> get chatRoom; } /// @nodoc -class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadedImpl> +class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> + extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadedImpl> implements _$$ChatRoomStateLoadedImplCopyWith<$Res> { - __$$ChatRoomStateLoadedImplCopyWithImpl(_$ChatRoomStateLoadedImpl _value, $Res Function(_$ChatRoomStateLoadedImpl) _then) : super(_value, _then); + __$$ChatRoomStateLoadedImplCopyWithImpl(_$ChatRoomStateLoadedImpl _value, + $Res Function(_$ChatRoomStateLoadedImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -354,7 +396,11 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyW /// @nodoc class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { - const _$ChatRoomStateLoadedImpl({required this.chatRoom, required final List chatMessages, required this.isTyping, required this.isLoading}) + const _$ChatRoomStateLoadedImpl( + {required this.chatRoom, + required final List chatMessages, + required this.isTyping, + required this.isLoading}) : _chatMessages = chatMessages; @override @@ -382,27 +428,35 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateLoadedImpl && - (identical(other.chatRoom, chatRoom) || other.chatRoom == chatRoom) && - const DeepCollectionEquality().equals(other._chatMessages, _chatMessages) && - (identical(other.isTyping, isTyping) || other.isTyping == isTyping) && - (identical(other.isLoading, isLoading) || other.isLoading == isLoading)); + (identical(other.chatRoom, chatRoom) || + other.chatRoom == chatRoom) && + const DeepCollectionEquality() + .equals(other._chatMessages, _chatMessages) && + (identical(other.isTyping, isTyping) || + other.isTyping == isTyping) && + (identical(other.isLoading, isLoading) || + other.isLoading == isLoading)); } @override - int get hashCode => Object.hash(runtimeType, chatRoom, const DeepCollectionEquality().hash(_chatMessages), isTyping, isLoading); + int get hashCode => Object.hash(runtimeType, chatRoom, + const DeepCollectionEquality().hash(_chatMessages), isTyping, isLoading); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith => - __$$ChatRoomStateLoadedImplCopyWithImpl<_$ChatRoomStateLoadedImpl>(this, _$identity); + __$$ChatRoomStateLoadedImplCopyWithImpl<_$ChatRoomStateLoadedImpl>( + this, _$identity); @override @optionalTypeArgs TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, + required TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return loaded(chatRoom, chatMessages, isTyping, isLoading); @@ -413,7 +467,9 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult? Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return loaded?.call(chatRoom, chatMessages, isTyping, isLoading); @@ -424,7 +480,9 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -484,21 +542,26 @@ abstract class ChatRoomStateLoaded implements ChatRoomState { bool get isTyping; bool get isLoading; @JsonKey(ignore: true) - _$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class _$$ChatRoomStateErrorImplCopyWith<$Res> { - factory _$$ChatRoomStateErrorImplCopyWith(_$ChatRoomStateErrorImpl value, $Res Function(_$ChatRoomStateErrorImpl) then) = + factory _$$ChatRoomStateErrorImplCopyWith(_$ChatRoomStateErrorImpl value, + $Res Function(_$ChatRoomStateErrorImpl) then) = __$$ChatRoomStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$ChatRoomStateErrorImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateErrorImpl> +class __$$ChatRoomStateErrorImplCopyWithImpl<$Res> + extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateErrorImpl> implements _$$ChatRoomStateErrorImplCopyWith<$Res> { - __$$ChatRoomStateErrorImplCopyWithImpl(_$ChatRoomStateErrorImpl _value, $Res Function(_$ChatRoomStateErrorImpl) _then) : super(_value, _then); + __$$ChatRoomStateErrorImplCopyWithImpl(_$ChatRoomStateErrorImpl _value, + $Res Function(_$ChatRoomStateErrorImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -532,7 +595,8 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateErrorImpl && - (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); } @override @@ -542,14 +606,17 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { @override @pragma('vm:prefer-inline') _$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith => - __$$ChatRoomStateErrorImplCopyWithImpl<_$ChatRoomStateErrorImpl>(this, _$identity); + __$$ChatRoomStateErrorImplCopyWithImpl<_$ChatRoomStateErrorImpl>( + this, _$identity); @override @optionalTypeArgs TResult when( TResult Function() $default, { required TResult Function() loading, - required TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading) loaded, + required TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading) + loaded, required TResult Function(String errorMessage) error, }) { return error(errorMessage); @@ -560,7 +627,9 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { TResult? whenOrNull( TResult? Function()? $default, { TResult? Function()? loading, - TResult? Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult? Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult? Function(String errorMessage)? error, }) { return error?.call(errorMessage); @@ -571,7 +640,9 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { TResult maybeWhen( TResult Function()? $default, { TResult Function()? loading, - TResult Function(ChatRoomModel chatRoom, List chatMessages, bool isTyping, bool isLoading)? loaded, + TResult Function(ChatRoomModel chatRoom, + List chatMessages, bool isTyping, bool isLoading)? + loaded, TResult Function(String errorMessage)? error, required TResult orElse(), }) { @@ -620,9 +691,11 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError { } abstract class ChatRoomStateError implements ChatRoomState { - const factory ChatRoomStateError({required final String errorMessage}) = _$ChatRoomStateErrorImpl; + const factory ChatRoomStateError({required final String errorMessage}) = + _$ChatRoomStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith => throw _privateConstructorUsedError; + _$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/chat/services/chat_service.g.dart b/lib/features/chat/services/chat_service.g.dart index 8d212c4e..2f0674be 100644 --- a/lib/features/chat/services/chat_service.g.dart +++ b/lib/features/chat/services/chat_service.g.dart @@ -24,23 +24,25 @@ class _ChatService implements ChatService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>(_setStreamType>(Options( + final _result = await _dio.fetch>( + _setStreamType>(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/chat/show/${id}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); - var _value = _result.data!.map((k, dynamic v) => MapEntry(k, ChatRoomModel.fromJson(v as Map))); + .compose( + _dio.options, + '/api/chat/show/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); + var _value = _result.data!.map((k, dynamic v) => + MapEntry(k, ChatRoomModel.fromJson(v as Map))); return _value; } @@ -96,22 +98,23 @@ class _ChatService implements ChatService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>(_setStreamType(Options( + final _result = await _dio + .fetch>(_setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/chat/show/${id}/messages?page=${page}', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); + .compose( + _dio.options, + '/api/chat/show/${id}/messages?page=${page}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); final _value = ChatMessagesModel.fromJson(_result.data!); return _value; } @@ -122,28 +125,31 @@ class _ChatService implements ChatService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>(_setStreamType(Options( + final _result = await _dio + .fetch>(_setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/profile/ws/params', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); + .compose( + _dio.options, + '/api/profile/ws/params', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); final _value = WebsocketInfoModel.fromJson(_result.data!); return _value; } RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { if (T == String) { requestOptions.responseType = ResponseType.plain; } else { diff --git a/lib/features/diary/models/diary_model.freezed.dart b/lib/features/diary/models/diary_model.freezed.dart index b593541c..5ede0101 100644 --- a/lib/features/diary/models/diary_model.freezed.dart +++ b/lib/features/diary/models/diary_model.freezed.dart @@ -30,18 +30,29 @@ mixin _$DiaryModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $DiaryModelCopyWith get copyWith => throw _privateConstructorUsedError; + $DiaryModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $DiaryModelCopyWith<$Res> { - factory $DiaryModelCopyWith(DiaryModel value, $Res Function(DiaryModel) then) = _$DiaryModelCopyWithImpl<$Res, DiaryModel>; + factory $DiaryModelCopyWith( + DiaryModel value, $Res Function(DiaryModel) then) = + _$DiaryModelCopyWithImpl<$Res, DiaryModel>; @useResult - $Res call({int id, DateTime date, DateTime wakeup, DateTime retire, int closed, String comment, List meals}); + $Res call( + {int id, + DateTime date, + DateTime wakeup, + DateTime retire, + int closed, + String comment, + List meals}); } /// @nodoc -class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel> implements $DiaryModelCopyWith<$Res> { +class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel> + implements $DiaryModelCopyWith<$Res> { _$DiaryModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -94,16 +105,30 @@ class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel> implements $DiaryM } /// @nodoc -abstract class _$$DiaryModelImplCopyWith<$Res> implements $DiaryModelCopyWith<$Res> { - factory _$$DiaryModelImplCopyWith(_$DiaryModelImpl value, $Res Function(_$DiaryModelImpl) then) = __$$DiaryModelImplCopyWithImpl<$Res>; +abstract class _$$DiaryModelImplCopyWith<$Res> + implements $DiaryModelCopyWith<$Res> { + factory _$$DiaryModelImplCopyWith( + _$DiaryModelImpl value, $Res Function(_$DiaryModelImpl) then) = + __$$DiaryModelImplCopyWithImpl<$Res>; @override @useResult - $Res call({int id, DateTime date, DateTime wakeup, DateTime retire, int closed, String comment, List meals}); + $Res call( + {int id, + DateTime date, + DateTime wakeup, + DateTime retire, + int closed, + String comment, + List meals}); } /// @nodoc -class __$$DiaryModelImplCopyWithImpl<$Res> extends _$DiaryModelCopyWithImpl<$Res, _$DiaryModelImpl> implements _$$DiaryModelImplCopyWith<$Res> { - __$$DiaryModelImplCopyWithImpl(_$DiaryModelImpl _value, $Res Function(_$DiaryModelImpl) _then) : super(_value, _then); +class __$$DiaryModelImplCopyWithImpl<$Res> + extends _$DiaryModelCopyWithImpl<$Res, _$DiaryModelImpl> + implements _$$DiaryModelImplCopyWith<$Res> { + __$$DiaryModelImplCopyWithImpl( + _$DiaryModelImpl _value, $Res Function(_$DiaryModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -162,7 +187,8 @@ class _$DiaryModelImpl implements _DiaryModel { required final List meals}) : _meals = meals; - factory _$DiaryModelImpl.fromJson(Map json) => _$$DiaryModelImplFromJson(json); + factory _$DiaryModelImpl.fromJson(Map json) => + _$$DiaryModelImplFromJson(json); @override final int id; @@ -205,12 +231,14 @@ class _$DiaryModelImpl implements _DiaryModel { @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, date, wakeup, retire, closed, comment, const DeepCollectionEquality().hash(_meals)); + int get hashCode => Object.hash(runtimeType, id, date, wakeup, retire, closed, + comment, const DeepCollectionEquality().hash(_meals)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => __$$DiaryModelImplCopyWithImpl<_$DiaryModelImpl>(this, _$identity); + _$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => + __$$DiaryModelImplCopyWithImpl<_$DiaryModelImpl>(this, _$identity); @override Map toJson() { @@ -230,7 +258,8 @@ abstract class _DiaryModel implements DiaryModel { required final String comment, required final List meals}) = _$DiaryModelImpl; - factory _DiaryModel.fromJson(Map json) = _$DiaryModelImpl.fromJson; + factory _DiaryModel.fromJson(Map json) = + _$DiaryModelImpl.fromJson; @override int get id; @@ -248,5 +277,6 @@ abstract class _DiaryModel implements DiaryModel { List get meals; @override @JsonKey(ignore: true) - _$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/diary/models/diary_model.g.dart b/lib/features/diary/models/diary_model.g.dart index 79a0e92e..cab25b61 100644 --- a/lib/features/diary/models/diary_model.g.dart +++ b/lib/features/diary/models/diary_model.g.dart @@ -6,17 +6,21 @@ part of 'diary_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$DiaryModelImpl _$$DiaryModelImplFromJson(Map json) => _$DiaryModelImpl( +_$DiaryModelImpl _$$DiaryModelImplFromJson(Map json) => + _$DiaryModelImpl( id: (json['id'] as num).toInt(), date: DateTime.parse(json['date'] as String), wakeup: DateTime.parse(json['wakeup'] as String), retire: DateTime.parse(json['retire'] as String), closed: (json['closed'] as num).toInt(), comment: json['comment'] as String, - meals: (json['meals'] as List).map((e) => Meals.fromJson(e as Map)).toList(), + meals: (json['meals'] as List) + .map((e) => Meals.fromJson(e as Map)) + .toList(), ); -Map _$$DiaryModelImplToJson(_$DiaryModelImpl instance) => { +Map _$$DiaryModelImplToJson(_$DiaryModelImpl instance) => + { 'id': instance.id, 'date': instance.date.toIso8601String(), 'wakeup': instance.wakeup.toIso8601String(), diff --git a/lib/features/feed/models/feed_blog_post_model.freezed.dart b/lib/features/feed/models/feed_blog_post_model.freezed.dart index 9afd21ed..4d753a10 100644 --- a/lib/features/feed/models/feed_blog_post_model.freezed.dart +++ b/lib/features/feed/models/feed_blog_post_model.freezed.dart @@ -34,12 +34,15 @@ mixin _$FeedBlogPostModel { Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $FeedBlogPostModelCopyWith get copyWith => throw _privateConstructorUsedError; + $FeedBlogPostModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $FeedBlogPostModelCopyWith<$Res> { - factory $FeedBlogPostModelCopyWith(FeedBlogPostModel value, $Res Function(FeedBlogPostModel) then) = _$FeedBlogPostModelCopyWithImpl<$Res, FeedBlogPostModel>; + factory $FeedBlogPostModelCopyWith( + FeedBlogPostModel value, $Res Function(FeedBlogPostModel) then) = + _$FeedBlogPostModelCopyWithImpl<$Res, FeedBlogPostModel>; @useResult $Res call( {int id, @@ -53,7 +56,8 @@ abstract class $FeedBlogPostModelCopyWith<$Res> { } /// @nodoc -class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel> implements $FeedBlogPostModelCopyWith<$Res> { +class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel> + implements $FeedBlogPostModelCopyWith<$Res> { _$FeedBlogPostModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -111,8 +115,10 @@ class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel> impl } /// @nodoc -abstract class _$$FeedBlogPostModelImplCopyWith<$Res> implements $FeedBlogPostModelCopyWith<$Res> { - factory _$$FeedBlogPostModelImplCopyWith(_$FeedBlogPostModelImpl value, $Res Function(_$FeedBlogPostModelImpl) then) = +abstract class _$$FeedBlogPostModelImplCopyWith<$Res> + implements $FeedBlogPostModelCopyWith<$Res> { + factory _$$FeedBlogPostModelImplCopyWith(_$FeedBlogPostModelImpl value, + $Res Function(_$FeedBlogPostModelImpl) then) = __$$FeedBlogPostModelImplCopyWithImpl<$Res>; @override @useResult @@ -128,9 +134,12 @@ abstract class _$$FeedBlogPostModelImplCopyWith<$Res> implements $FeedBlogPostMo } /// @nodoc -class __$$FeedBlogPostModelImplCopyWithImpl<$Res> extends _$FeedBlogPostModelCopyWithImpl<$Res, _$FeedBlogPostModelImpl> +class __$$FeedBlogPostModelImplCopyWithImpl<$Res> + extends _$FeedBlogPostModelCopyWithImpl<$Res, _$FeedBlogPostModelImpl> implements _$$FeedBlogPostModelImplCopyWith<$Res> { - __$$FeedBlogPostModelImplCopyWithImpl(_$FeedBlogPostModelImpl _value, $Res Function(_$FeedBlogPostModelImpl) _then) : super(_value, _then); + __$$FeedBlogPostModelImplCopyWithImpl(_$FeedBlogPostModelImpl _value, + $Res Function(_$FeedBlogPostModelImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -194,7 +203,8 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel { @JsonKey(name: "updated_at") required this.updatedAt, required this.title}); - factory _$FeedBlogPostModelImpl.fromJson(Map json) => _$$FeedBlogPostModelImplFromJson(json); + factory _$FeedBlogPostModelImpl.fromJson(Map json) => + _$$FeedBlogPostModelImplFromJson(json); @override final int id; @@ -229,21 +239,28 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel { (identical(other.id, id) || other.id == id) && (identical(other.state, state) || other.state == state) && (identical(other.image, image) || other.image == image) && - (identical(other.description, description) || other.description == description) && - (identical(other.youtubeUrl, youtubeUrl) || other.youtubeUrl == youtubeUrl) && - (identical(other.createdAt, createdAt) || other.createdAt == createdAt) && - (identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) && + (identical(other.description, description) || + other.description == description) && + (identical(other.youtubeUrl, youtubeUrl) || + other.youtubeUrl == youtubeUrl) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt) && (identical(other.title, title) || other.title == title)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, id, state, image, description, youtubeUrl, createdAt, updatedAt, title); + int get hashCode => Object.hash(runtimeType, id, state, image, description, + youtubeUrl, createdAt, updatedAt, title); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith => __$$FeedBlogPostModelImplCopyWithImpl<_$FeedBlogPostModelImpl>(this, _$identity); + _$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith => + __$$FeedBlogPostModelImplCopyWithImpl<_$FeedBlogPostModelImpl>( + this, _$identity); @override Map toJson() { @@ -264,7 +281,8 @@ abstract class _FeedBlogPostModel implements FeedBlogPostModel { @JsonKey(name: "updated_at") required final DateTime updatedAt, required final String title}) = _$FeedBlogPostModelImpl; - factory _FeedBlogPostModel.fromJson(Map json) = _$FeedBlogPostModelImpl.fromJson; + factory _FeedBlogPostModel.fromJson(Map json) = + _$FeedBlogPostModelImpl.fromJson; @override int get id; @@ -287,5 +305,6 @@ abstract class _FeedBlogPostModel implements FeedBlogPostModel { String get title; @override @JsonKey(ignore: true) - _$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/feed/models/feed_blog_post_model.g.dart b/lib/features/feed/models/feed_blog_post_model.g.dart index e6808649..93cc70fc 100644 --- a/lib/features/feed/models/feed_blog_post_model.g.dart +++ b/lib/features/feed/models/feed_blog_post_model.g.dart @@ -6,7 +6,9 @@ part of 'feed_blog_post_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$FeedBlogPostModelImpl _$$FeedBlogPostModelImplFromJson(Map json) => _$FeedBlogPostModelImpl( +_$FeedBlogPostModelImpl _$$FeedBlogPostModelImplFromJson( + Map json) => + _$FeedBlogPostModelImpl( id: (json['id'] as num).toInt(), state: json['state'] as String, image: json['image'] as String, @@ -17,7 +19,9 @@ _$FeedBlogPostModelImpl _$$FeedBlogPostModelImplFromJson(Map js title: json['title'] as String, ); -Map _$$FeedBlogPostModelImplToJson(_$FeedBlogPostModelImpl instance) => { +Map _$$FeedBlogPostModelImplToJson( + _$FeedBlogPostModelImpl instance) => + { 'id': instance.id, 'state': instance.state, 'image': instance.image, diff --git a/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart b/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart index cab47d21..7fd8a12e 100644 --- a/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart +++ b/lib/features/feed/models/feed_blog_post_settings_model.freezed.dart @@ -14,30 +14,36 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); -FeedBlogPostSettingsModel _$FeedBlogPostSettingsModelFromJson(Map json) { +FeedBlogPostSettingsModel _$FeedBlogPostSettingsModelFromJson( + Map json) { return _FeedBlogPostSettingsModel.fromJson(json); } /// @nodoc mixin _$FeedBlogPostSettingsModel { @JsonKey(name: 'data') - List get feedBlogPostList => throw _privateConstructorUsedError; + List get feedBlogPostList => + throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $FeedBlogPostSettingsModelCopyWith get copyWith => throw _privateConstructorUsedError; + $FeedBlogPostSettingsModelCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $FeedBlogPostSettingsModelCopyWith<$Res> { - factory $FeedBlogPostSettingsModelCopyWith(FeedBlogPostSettingsModel value, $Res Function(FeedBlogPostSettingsModel) then) = + factory $FeedBlogPostSettingsModelCopyWith(FeedBlogPostSettingsModel value, + $Res Function(FeedBlogPostSettingsModel) then) = _$FeedBlogPostSettingsModelCopyWithImpl<$Res, FeedBlogPostSettingsModel>; @useResult $Res call({@JsonKey(name: 'data') List feedBlogPostList}); } /// @nodoc -class _$FeedBlogPostSettingsModelCopyWithImpl<$Res, $Val extends FeedBlogPostSettingsModel> implements $FeedBlogPostSettingsModelCopyWith<$Res> { +class _$FeedBlogPostSettingsModelCopyWithImpl<$Res, + $Val extends FeedBlogPostSettingsModel> + implements $FeedBlogPostSettingsModelCopyWith<$Res> { _$FeedBlogPostSettingsModelCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -60,8 +66,11 @@ class _$FeedBlogPostSettingsModelCopyWithImpl<$Res, $Val extends FeedBlogPostSet } /// @nodoc -abstract class _$$FeedBlogPostSettingsModelImplCopyWith<$Res> implements $FeedBlogPostSettingsModelCopyWith<$Res> { - factory _$$FeedBlogPostSettingsModelImplCopyWith(_$FeedBlogPostSettingsModelImpl value, $Res Function(_$FeedBlogPostSettingsModelImpl) then) = +abstract class _$$FeedBlogPostSettingsModelImplCopyWith<$Res> + implements $FeedBlogPostSettingsModelCopyWith<$Res> { + factory _$$FeedBlogPostSettingsModelImplCopyWith( + _$FeedBlogPostSettingsModelImpl value, + $Res Function(_$FeedBlogPostSettingsModelImpl) then) = __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res>; @override @useResult @@ -69,9 +78,13 @@ abstract class _$$FeedBlogPostSettingsModelImplCopyWith<$Res> implements $FeedBl } /// @nodoc -class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res> extends _$FeedBlogPostSettingsModelCopyWithImpl<$Res, _$FeedBlogPostSettingsModelImpl> +class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res> + extends _$FeedBlogPostSettingsModelCopyWithImpl<$Res, + _$FeedBlogPostSettingsModelImpl> implements _$$FeedBlogPostSettingsModelImplCopyWith<$Res> { - __$$FeedBlogPostSettingsModelImplCopyWithImpl(_$FeedBlogPostSettingsModelImpl _value, $Res Function(_$FeedBlogPostSettingsModelImpl) _then) + __$$FeedBlogPostSettingsModelImplCopyWithImpl( + _$FeedBlogPostSettingsModelImpl _value, + $Res Function(_$FeedBlogPostSettingsModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -91,16 +104,20 @@ class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res> extends _$FeedBlogPost /// @nodoc @JsonSerializable() class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { - const _$FeedBlogPostSettingsModelImpl({@JsonKey(name: 'data') required final List feedBlogPostList}) + const _$FeedBlogPostSettingsModelImpl( + {@JsonKey(name: 'data') + required final List feedBlogPostList}) : _feedBlogPostList = feedBlogPostList; - factory _$FeedBlogPostSettingsModelImpl.fromJson(Map json) => _$$FeedBlogPostSettingsModelImplFromJson(json); + factory _$FeedBlogPostSettingsModelImpl.fromJson(Map json) => + _$$FeedBlogPostSettingsModelImplFromJson(json); final List _feedBlogPostList; @override @JsonKey(name: 'data') List get feedBlogPostList { - if (_feedBlogPostList is EqualUnmodifiableListView) return _feedBlogPostList; + if (_feedBlogPostList is EqualUnmodifiableListView) + return _feedBlogPostList; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(_feedBlogPostList); } @@ -115,18 +132,21 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedBlogPostSettingsModelImpl && - const DeepCollectionEquality().equals(other._feedBlogPostList, _feedBlogPostList)); + const DeepCollectionEquality() + .equals(other._feedBlogPostList, _feedBlogPostList)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList)); + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> get copyWith => - __$$FeedBlogPostSettingsModelImplCopyWithImpl<_$FeedBlogPostSettingsModelImpl>(this, _$identity); + _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> + get copyWith => __$$FeedBlogPostSettingsModelImplCopyWithImpl< + _$FeedBlogPostSettingsModelImpl>(this, _$identity); @override Map toJson() { @@ -137,14 +157,19 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel { } abstract class _FeedBlogPostSettingsModel implements FeedBlogPostSettingsModel { - const factory _FeedBlogPostSettingsModel({@JsonKey(name: 'data') required final List feedBlogPostList}) = _$FeedBlogPostSettingsModelImpl; + const factory _FeedBlogPostSettingsModel( + {@JsonKey(name: 'data') + required final List feedBlogPostList}) = + _$FeedBlogPostSettingsModelImpl; - factory _FeedBlogPostSettingsModel.fromJson(Map json) = _$FeedBlogPostSettingsModelImpl.fromJson; + factory _FeedBlogPostSettingsModel.fromJson(Map json) = + _$FeedBlogPostSettingsModelImpl.fromJson; @override @JsonKey(name: 'data') List get feedBlogPostList; @override @JsonKey(ignore: true) - _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> get copyWith => throw _privateConstructorUsedError; + _$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/features/feed/models/feed_blog_post_settings_model.g.dart b/lib/features/feed/models/feed_blog_post_settings_model.g.dart index c960067d..3f48be1b 100644 --- a/lib/features/feed/models/feed_blog_post_settings_model.g.dart +++ b/lib/features/feed/models/feed_blog_post_settings_model.g.dart @@ -6,10 +6,16 @@ part of 'feed_blog_post_settings_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$FeedBlogPostSettingsModelImpl _$$FeedBlogPostSettingsModelImplFromJson(Map json) => _$FeedBlogPostSettingsModelImpl( - feedBlogPostList: (json['data'] as List).map((e) => FeedBlogPostModel.fromJson(e as Map)).toList(), +_$FeedBlogPostSettingsModelImpl _$$FeedBlogPostSettingsModelImplFromJson( + Map json) => + _$FeedBlogPostSettingsModelImpl( + feedBlogPostList: (json['data'] as List) + .map((e) => FeedBlogPostModel.fromJson(e as Map)) + .toList(), ); -Map _$$FeedBlogPostSettingsModelImplToJson(_$FeedBlogPostSettingsModelImpl instance) => { +Map _$$FeedBlogPostSettingsModelImplToJson( + _$FeedBlogPostSettingsModelImpl instance) => + { 'data': instance.feedBlogPostList, }; diff --git a/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart b/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart index f3b70a9e..ab3385f3 100644 --- a/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart +++ b/lib/features/feed/presentation/bloc/feed_cubit/feed_state.freezed.dart @@ -70,11 +70,13 @@ mixin _$FeedState { /// @nodoc abstract class $FeedStateCopyWith<$Res> { - factory $FeedStateCopyWith(FeedState value, $Res Function(FeedState) then) = _$FeedStateCopyWithImpl<$Res, FeedState>; + factory $FeedStateCopyWith(FeedState value, $Res Function(FeedState) then) = + _$FeedStateCopyWithImpl<$Res, FeedState>; } /// @nodoc -class _$FeedStateCopyWithImpl<$Res, $Val extends FeedState> implements $FeedStateCopyWith<$Res> { +class _$FeedStateCopyWithImpl<$Res, $Val extends FeedState> + implements $FeedStateCopyWith<$Res> { _$FeedStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -85,12 +87,18 @@ class _$FeedStateCopyWithImpl<$Res, $Val extends FeedState> implements $FeedStat /// @nodoc abstract class _$$FeedStateImplCopyWith<$Res> { - factory _$$FeedStateImplCopyWith(_$FeedStateImpl value, $Res Function(_$FeedStateImpl) then) = __$$FeedStateImplCopyWithImpl<$Res>; + factory _$$FeedStateImplCopyWith( + _$FeedStateImpl value, $Res Function(_$FeedStateImpl) then) = + __$$FeedStateImplCopyWithImpl<$Res>; } /// @nodoc -class __$$FeedStateImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateImpl> implements _$$FeedStateImplCopyWith<$Res> { - __$$FeedStateImplCopyWithImpl(_$FeedStateImpl _value, $Res Function(_$FeedStateImpl) _then) : super(_value, _then); +class __$$FeedStateImplCopyWithImpl<$Res> + extends _$FeedStateCopyWithImpl<$Res, _$FeedStateImpl> + implements _$$FeedStateImplCopyWith<$Res> { + __$$FeedStateImplCopyWithImpl( + _$FeedStateImpl _value, $Res Function(_$FeedStateImpl) _then) + : super(_value, _then); } /// @nodoc @@ -105,7 +113,8 @@ class _$FeedStateImpl implements _FeedState { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedStateImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$FeedStateImpl); } @override @@ -192,14 +201,18 @@ abstract class _FeedState implements FeedState { /// @nodoc abstract class _$$FeedStateLoadingImplCopyWith<$Res> { - factory _$$FeedStateLoadingImplCopyWith(_$FeedStateLoadingImpl value, $Res Function(_$FeedStateLoadingImpl) then) = + factory _$$FeedStateLoadingImplCopyWith(_$FeedStateLoadingImpl value, + $Res Function(_$FeedStateLoadingImpl) then) = __$$FeedStateLoadingImplCopyWithImpl<$Res>; } /// @nodoc -class __$$FeedStateLoadingImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateLoadingImpl> +class __$$FeedStateLoadingImplCopyWithImpl<$Res> + extends _$FeedStateCopyWithImpl<$Res, _$FeedStateLoadingImpl> implements _$$FeedStateLoadingImplCopyWith<$Res> { - __$$FeedStateLoadingImplCopyWithImpl(_$FeedStateLoadingImpl _value, $Res Function(_$FeedStateLoadingImpl) _then) : super(_value, _then); + __$$FeedStateLoadingImplCopyWithImpl(_$FeedStateLoadingImpl _value, + $Res Function(_$FeedStateLoadingImpl) _then) + : super(_value, _then); } /// @nodoc @@ -214,7 +227,8 @@ class _$FeedStateLoadingImpl implements FeedStateLoading { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedStateLoadingImpl); + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$FeedStateLoadingImpl); } @override @@ -301,14 +315,20 @@ abstract class FeedStateLoading implements FeedState { /// @nodoc abstract class _$$FeedStateLoadedImplCopyWith<$Res> { - factory _$$FeedStateLoadedImplCopyWith(_$FeedStateLoadedImpl value, $Res Function(_$FeedStateLoadedImpl) then) = __$$FeedStateLoadedImplCopyWithImpl<$Res>; + factory _$$FeedStateLoadedImplCopyWith(_$FeedStateLoadedImpl value, + $Res Function(_$FeedStateLoadedImpl) then) = + __$$FeedStateLoadedImplCopyWithImpl<$Res>; @useResult $Res call({List feedBlogPostList}); } /// @nodoc -class __$$FeedStateLoadedImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateLoadedImpl> implements _$$FeedStateLoadedImplCopyWith<$Res> { - __$$FeedStateLoadedImplCopyWithImpl(_$FeedStateLoadedImpl _value, $Res Function(_$FeedStateLoadedImpl) _then) : super(_value, _then); +class __$$FeedStateLoadedImplCopyWithImpl<$Res> + extends _$FeedStateCopyWithImpl<$Res, _$FeedStateLoadedImpl> + implements _$$FeedStateLoadedImplCopyWith<$Res> { + __$$FeedStateLoadedImplCopyWithImpl( + _$FeedStateLoadedImpl _value, $Res Function(_$FeedStateLoadedImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -327,12 +347,15 @@ class __$$FeedStateLoadedImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl< /// @nodoc class _$FeedStateLoadedImpl implements FeedStateLoaded { - const _$FeedStateLoadedImpl({required final List feedBlogPostList}) : _feedBlogPostList = feedBlogPostList; + const _$FeedStateLoadedImpl( + {required final List feedBlogPostList}) + : _feedBlogPostList = feedBlogPostList; final List _feedBlogPostList; @override List get feedBlogPostList { - if (_feedBlogPostList is EqualUnmodifiableListView) return _feedBlogPostList; + if (_feedBlogPostList is EqualUnmodifiableListView) + return _feedBlogPostList; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(_feedBlogPostList); } @@ -347,16 +370,20 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedStateLoadedImpl && - const DeepCollectionEquality().equals(other._feedBlogPostList, _feedBlogPostList)); + const DeepCollectionEquality() + .equals(other._feedBlogPostList, _feedBlogPostList)); } @override - int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList)); + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith => __$$FeedStateLoadedImplCopyWithImpl<_$FeedStateLoadedImpl>(this, _$identity); + _$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith => + __$$FeedStateLoadedImplCopyWithImpl<_$FeedStateLoadedImpl>( + this, _$identity); @override @optionalTypeArgs @@ -434,23 +461,32 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded { } abstract class FeedStateLoaded implements FeedState { - const factory FeedStateLoaded({required final List feedBlogPostList}) = _$FeedStateLoadedImpl; + const factory FeedStateLoaded( + {required final List feedBlogPostList}) = + _$FeedStateLoadedImpl; List get feedBlogPostList; @JsonKey(ignore: true) - _$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith => throw _privateConstructorUsedError; + _$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class _$$FeedStateErrorImplCopyWith<$Res> { - factory _$$FeedStateErrorImplCopyWith(_$FeedStateErrorImpl value, $Res Function(_$FeedStateErrorImpl) then) = __$$FeedStateErrorImplCopyWithImpl<$Res>; + factory _$$FeedStateErrorImplCopyWith(_$FeedStateErrorImpl value, + $Res Function(_$FeedStateErrorImpl) then) = + __$$FeedStateErrorImplCopyWithImpl<$Res>; @useResult $Res call({String errorMessage}); } /// @nodoc -class __$$FeedStateErrorImplCopyWithImpl<$Res> extends _$FeedStateCopyWithImpl<$Res, _$FeedStateErrorImpl> implements _$$FeedStateErrorImplCopyWith<$Res> { - __$$FeedStateErrorImplCopyWithImpl(_$FeedStateErrorImpl _value, $Res Function(_$FeedStateErrorImpl) _then) : super(_value, _then); +class __$$FeedStateErrorImplCopyWithImpl<$Res> + extends _$FeedStateCopyWithImpl<$Res, _$FeedStateErrorImpl> + implements _$$FeedStateErrorImplCopyWith<$Res> { + __$$FeedStateErrorImplCopyWithImpl( + _$FeedStateErrorImpl _value, $Res Function(_$FeedStateErrorImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -484,7 +520,8 @@ class _$FeedStateErrorImpl implements FeedStateError { return identical(this, other) || (other.runtimeType == runtimeType && other is _$FeedStateErrorImpl && - (identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); } @override @@ -493,7 +530,9 @@ class _$FeedStateErrorImpl implements FeedStateError { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith => __$$FeedStateErrorImplCopyWithImpl<_$FeedStateErrorImpl>(this, _$identity); + _$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith => + __$$FeedStateErrorImplCopyWithImpl<_$FeedStateErrorImpl>( + this, _$identity); @override @optionalTypeArgs @@ -571,9 +610,11 @@ class _$FeedStateErrorImpl implements FeedStateError { } abstract class FeedStateError implements FeedState { - const factory FeedStateError({required final String errorMessage}) = _$FeedStateErrorImpl; + const factory FeedStateError({required final String errorMessage}) = + _$FeedStateErrorImpl; String get errorMessage; @JsonKey(ignore: true) - _$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith => throw _privateConstructorUsedError; + _$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/feed/services/feed_service.g.dart b/lib/features/feed/services/feed_service.g.dart index 0e66eb4a..89003f6e 100644 --- a/lib/features/feed/services/feed_service.g.dart +++ b/lib/features/feed/services/feed_service.g.dart @@ -24,28 +24,31 @@ class _FeedService implements FeedService { final queryParameters = {}; final _headers = {}; const Map? _data = null; - final _result = await _dio.fetch>(_setStreamType(Options( + final _result = await _dio.fetch>( + _setStreamType(Options( method: 'GET', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/blogPosts/index', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); + .compose( + _dio.options, + '/api/blogPosts/index', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); final _value = FeedBlogPostSettingsModel.fromJson(_result.data!); return _value; } RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { if (T == String) { requestOptions.responseType = ResponseType.plain; } else { diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart index c39f8342..4d06c950 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart @@ -1,7 +1,10 @@ +import 'package:eatvio_app/app_router.dart'; import 'package:eatvio_app/core/app_export.dart'; +import 'package:eatvio_app/core/token_storage.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart'; import 'package:eatvio_app/features/registration/repositories/registration_repository.dart'; +import 'package:go_router/go_router.dart'; class RegistrationCubit extends Cubit { final RegistrationRepository registrationRepository; @@ -42,12 +45,13 @@ class RegistrationCubit extends Cubit { updateSheet(UserRegistrationSheet sheet) => emit(RegistrationState(sheet: sheet)); - tryRegistration() async { + Future tryRegistration() async { try { - final response = await registrationRepository.tryRegister(state.sheet); - print(response); + final token = await registrationRepository.tryRegister(state.sheet); + await TokenStorage.saveTokenInStorage(token); + AppRouter.navigatorKey.currentContext?.go('/my-profile-screen'); } catch (e) { - print(e); + rethrow; } } } diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart index 70a7f337..dcb49236 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_state.freezed.dart @@ -19,12 +19,15 @@ mixin _$RegistrationState { UserRegistrationSheet get sheet => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $RegistrationStateCopyWith get copyWith => throw _privateConstructorUsedError; + $RegistrationStateCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc abstract class $RegistrationStateCopyWith<$Res> { - factory $RegistrationStateCopyWith(RegistrationState value, $Res Function(RegistrationState) then) = _$RegistrationStateCopyWithImpl<$Res, RegistrationState>; + factory $RegistrationStateCopyWith( + RegistrationState value, $Res Function(RegistrationState) then) = + _$RegistrationStateCopyWithImpl<$Res, RegistrationState>; @useResult $Res call({UserRegistrationSheet sheet}); @@ -32,7 +35,8 @@ abstract class $RegistrationStateCopyWith<$Res> { } /// @nodoc -class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> implements $RegistrationStateCopyWith<$Res> { +class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> + implements $RegistrationStateCopyWith<$Res> { _$RegistrationStateCopyWithImpl(this._value, this._then); // ignore: unused_field @@ -63,8 +67,10 @@ class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> impl } /// @nodoc -abstract class _$$RegistrationStateImplCopyWith<$Res> implements $RegistrationStateCopyWith<$Res> { - factory _$$RegistrationStateImplCopyWith(_$RegistrationStateImpl value, $Res Function(_$RegistrationStateImpl) then) = +abstract class _$$RegistrationStateImplCopyWith<$Res> + implements $RegistrationStateCopyWith<$Res> { + factory _$$RegistrationStateImplCopyWith(_$RegistrationStateImpl value, + $Res Function(_$RegistrationStateImpl) then) = __$$RegistrationStateImplCopyWithImpl<$Res>; @override @useResult @@ -75,9 +81,12 @@ abstract class _$$RegistrationStateImplCopyWith<$Res> implements $RegistrationSt } /// @nodoc -class __$$RegistrationStateImplCopyWithImpl<$Res> extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateImpl> +class __$$RegistrationStateImplCopyWithImpl<$Res> + extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateImpl> implements _$$RegistrationStateImplCopyWith<$Res> { - __$$RegistrationStateImplCopyWithImpl(_$RegistrationStateImpl _value, $Res Function(_$RegistrationStateImpl) _then) : super(_value, _then); + __$$RegistrationStateImplCopyWithImpl(_$RegistrationStateImpl _value, + $Res Function(_$RegistrationStateImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -109,7 +118,9 @@ class _$RegistrationStateImpl implements _RegistrationState { @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$RegistrationStateImpl && (identical(other.sheet, sheet) || other.sheet == sheet)); + (other.runtimeType == runtimeType && + other is _$RegistrationStateImpl && + (identical(other.sheet, sheet) || other.sheet == sheet)); } @override @@ -118,15 +129,19 @@ class _$RegistrationStateImpl implements _RegistrationState { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => __$$RegistrationStateImplCopyWithImpl<_$RegistrationStateImpl>(this, _$identity); + _$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => + __$$RegistrationStateImplCopyWithImpl<_$RegistrationStateImpl>( + this, _$identity); } abstract class _RegistrationState implements RegistrationState { - const factory _RegistrationState({required final UserRegistrationSheet sheet}) = _$RegistrationStateImpl; + const factory _RegistrationState( + {required final UserRegistrationSheet sheet}) = _$RegistrationStateImpl; @override UserRegistrationSheet get sheet; @override @JsonKey(ignore: true) - _$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => throw _privateConstructorUsedError; + _$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index eae9818d..93a5eae0 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -113,8 +113,8 @@ class _RegistrationScreenState extends State { borderRadius: BorderRadius.circular(16), ), backgroundColor: appTheme.blueA400, - onPressed: () { - if (canGoNext(state)) { + onPressed: () async { + if (await canGoNext(state)) { setState(() { pageController.nextPage( duration: const Duration(milliseconds: 350), @@ -197,7 +197,7 @@ class _RegistrationScreenState extends State { ); } - bool canGoNext(state) { + Future canGoNext(state) async { switch (step) { case 2: List errors = validateCredentialsFields(state.sheet.email, state.sheet.name, state.sheet.password, state.sheet.passwordConfirmation); @@ -285,8 +285,30 @@ class _RegistrationScreenState extends State { return false; } case 15: - registrationCubit.tryRegistration(); - return true; + try { + showDialog( + barrierDismissible: false, + useSafeArea: false, + context: context, + builder: (context) => PopScope( + canPop: false, + child: Center( + child: CircularProgressIndicator(), + ), + ), + ); + await registrationCubit.tryRegistration(); + Navigator.pop(context); + } catch (e) { + Navigator.pop(context); + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text('Ошибка при попытке регистрации'), + ), + ); + } + return false; default: return true; } diff --git a/lib/features/registration/repositories/registration_repository.dart b/lib/features/registration/repositories/registration_repository.dart index 86420946..aa388801 100644 --- a/lib/features/registration/repositories/registration_repository.dart +++ b/lib/features/registration/repositories/registration_repository.dart @@ -6,9 +6,9 @@ class RegistrationRepository { RegistrationRepository({required this.registrationService}); - tryRegister(UserRegistrationSheet sheet) async { + Future tryRegister(UserRegistrationSheet sheet) async { try { - return await registrationService.register(sheet: sheet.copyWith(country: 'Россия', city: 'Москва').toJson()); + return (await registrationService.register(sheet: sheet.toJson()))['token']!; } catch (e) { rethrow; } diff --git a/lib/features/registration/services/registration_service.dart b/lib/features/registration/services/registration_service.dart index 00ae6739..fefca6ad 100644 --- a/lib/features/registration/services/registration_service.dart +++ b/lib/features/registration/services/registration_service.dart @@ -8,7 +8,7 @@ abstract class RegistrationService { factory RegistrationService(Dio dio, {String baseUrl}) = _RegistrationService; @POST('/api/register') - Future register({ + Future> register({ @Body() required Map sheet, }); } diff --git a/lib/features/registration/services/registration_service.g.dart b/lib/features/registration/services/registration_service.g.dart index 1268b0bd..269d16cc 100644 --- a/lib/features/registration/services/registration_service.g.dart +++ b/lib/features/registration/services/registration_service.g.dart @@ -19,32 +19,38 @@ class _RegistrationService implements RegistrationService { String? baseUrl; @override - Future register({required Map sheet}) async { + Future> register( + {required Map sheet}) async { final _extra = {}; final queryParameters = {}; final _headers = {}; final _data = {}; _data.addAll(sheet); - await _dio.fetch(_setStreamType(Options( + final _result = await _dio.fetch>( + _setStreamType>(Options( method: 'POST', headers: _headers, extra: _extra, ) - .compose( - _dio.options, - '/api/register', - queryParameters: queryParameters, - data: _data, - ) - .copyWith( - baseUrl: _combineBaseUrls( - _dio.options.baseUrl, - baseUrl, - )))); + .compose( + _dio.options, + '/api/register', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls( + _dio.options.baseUrl, + baseUrl, + )))); + final _value = _result.data!.cast(); + return _value; } RequestOptions _setStreamType(RequestOptions requestOptions) { - if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) { + if (T != dynamic && + !(requestOptions.responseType == ResponseType.bytes || + requestOptions.responseType == ResponseType.stream)) { if (T == String) { requestOptions.responseType = ResponseType.plain; } else {