diff --git a/firebase.json b/firebase.json index f87cfe20..9ebb3fe8 100644 --- a/firebase.json +++ b/firebase.json @@ -1 +1,30 @@ -{"flutter":{"platforms":{"android":{"default":{"projectId":"eatvio-3467b","appId":"1:613980912922:android:4de95e5f2d50ba69ecc0a3","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"eatvio-3467b","appId":"1:613980912922:ios:c557d140a1212e63ecc0a3","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options.dart":{"projectId":"eatvio-3467b","configurations":{"android":"1:613980912922:android:4de95e5f2d50ba69ecc0a3","ios":"1:613980912922:ios:c557d140a1212e63ecc0a3"}}}}}} \ No newline at end of file +{ + "flutter": { + "platforms": { + "android": { + "default": { + "projectId": "eatvio-3467b", + "appId": "1:613980912922:android:4de95e5f2d50ba69ecc0a3", + "fileOutput": "android/app/google-services.json" + } + }, + "ios": { + "default": { + "projectId": "eatvio-3467b", + "appId": "1:613980912922:ios:c557d140a1212e63ecc0a3", + "uploadDebugSymbols": false, + "fileOutput": "ios/Runner/GoogleService-Info.plist" + } + }, + "dart": { + "lib/firebase_options.dart": { + "projectId": "eatvio-3467b", + "configurations": { + "android": "1:613980912922:android:4de95e5f2d50ba69ecc0a3", + "ios": "1:613980912922:ios:c557d140a1212e63ecc0a3" + } + } + } + } + } +} \ No newline at end of file diff --git a/lib/core/const.dart b/lib/core/const.dart index 4f38a54e..31c47e9c 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,5 +1,5 @@ -// String baseUrl = 'https://eatvio.ru'; -String baseUrl = 'https://dev2.eatvio.com'; +String baseUrl = 'https://eatvio.ru'; +// String baseUrl = 'https://dev2.eatvio.com'; const List durationValues = [7, 14, 21]; diff --git a/lib/features/blog_post_create/repositories/blog_post_repository.dart b/lib/features/blog_post_create/repositories/blog_post_repository.dart index 7ec77089..0b9b0ecd 100644 --- a/lib/features/blog_post_create/repositories/blog_post_repository.dart +++ b/lib/features/blog_post_create/repositories/blog_post_repository.dart @@ -68,8 +68,7 @@ class BlogPostRepository { ) async { FormData formData = FormData.fromMap({ 'title': title, - 'description': description, - 'state': 'active', + 'description_md': description, 'video_url': videoUrl, 'image': image != null ? await MultipartFile.fromFile((await ImageCompressUtility.compressFile(File(image.path))).path, filename: image.name) diff --git a/lib/features/blog_post_create/services/blog_post_service.dart b/lib/features/blog_post_create/services/blog_post_service.dart index 645b621d..56fc5461 100644 --- a/lib/features/blog_post_create/services/blog_post_service.dart +++ b/lib/features/blog_post_create/services/blog_post_service.dart @@ -13,7 +13,7 @@ abstract class BlogPostService { @Body() required FormData formData, }); - @POST('/api/blogPosts/update/{id}') + @POST('/api/blogPosts/update/published/{id}') @MultiPart() Future updateBlogPost({ @Path('id') required int id, diff --git a/lib/features/blog_post_create/services/blog_post_service.g.dart b/lib/features/blog_post_create/services/blog_post_service.g.dart index aa430049..ba5e1482 100644 --- a/lib/features/blog_post_create/services/blog_post_service.g.dart +++ b/lib/features/blog_post_create/services/blog_post_service.g.dart @@ -59,7 +59,7 @@ class _BlogPostService implements BlogPostService { ) .compose( _dio.options, - '/api/blogPosts/update/${id}', + '/api/blogPosts/update/published/${id}', queryParameters: queryParameters, data: _data, ) diff --git a/lib/features/blog_post_create/services/blog_service.dart b/lib/features/blog_post_create/services/blog_service.dart deleted file mode 100644 index 4b110622..00000000 --- a/lib/features/blog_post_create/services/blog_service.dart +++ /dev/null @@ -1,16 +0,0 @@ -/* -import 'package:eatvio_app/features/blog_post_create/models/blog_post_create_credentials_model.dart'; -import 'package:dio/dio.dart'; -import 'package:retrofit/retrofit.dart'; - -part 'blog_service.g.dart'; - -@RestApi() -abstract class BlogService { - factory BlogService(Dio dio, {String baseUrl}) = _BlogService; - - @POST('/blog_post/create') - Future createBlogPost( - BlogPostCreateCredentialsModel model); -} -*/ diff --git a/lib/features/create_diet/repositories/create_diet_repository.dart b/lib/features/create_diet/repositories/create_diet_repository.dart index 3661dfd9..e72f159b 100644 --- a/lib/features/create_diet/repositories/create_diet_repository.dart +++ b/lib/features/create_diet/repositories/create_diet_repository.dart @@ -36,7 +36,7 @@ class CreateDietRepository { dietMap.addAll({ 'name': name, - 'details': details, + 'description_md': details, 'duration': duration, 'type[meat]': meatType, 'type[carb]': carbType, @@ -115,7 +115,7 @@ class CreateDietRepository { dietMap.addAll({'name': name}); } if (details != null) { - dietMap.addAll({'details': details}); + dietMap.addAll({'description_md': details}); } if (duration != null) { dietMap.addAll({'duration': duration}); diff --git a/lib/features/create_plan/models/create_plan_model.dart b/lib/features/create_plan/models/create_plan_model.dart index 37e4b883..75187284 100644 --- a/lib/features/create_plan/models/create_plan_model.dart +++ b/lib/features/create_plan/models/create_plan_model.dart @@ -27,7 +27,7 @@ class CreatePlanModel with _$CreatePlanModel { 'duration': duration, 'state': state, 'type': type, - 'details': details, + 'description_md': details, 'image': image != null ? await MultipartFile.fromFile((await ImageCompressUtility.compressFile(File(image!.path))).path, filename: image!.name) : null, }; diff --git a/lib/features/create_recipe/models/recipe_create_model.dart b/lib/features/create_recipe/models/recipe_create_model.dart index 747e165f..a38398d9 100644 --- a/lib/features/create_recipe/models/recipe_create_model.dart +++ b/lib/features/create_recipe/models/recipe_create_model.dart @@ -21,7 +21,7 @@ class RecipeCreateModel with _$RecipeCreateModel { const factory RecipeCreateModel({ required String title, required String state, - required String description, + @JsonKey(name: 'description_md') required String description, required RecipeType type, @JsonKey(name: 'video_url') String? videoUrl, @JsonKey(name: 'cooking_time') String? cookingTime, diff --git a/lib/features/create_recipe/models/recipe_create_model.freezed.dart b/lib/features/create_recipe/models/recipe_create_model.freezed.dart index b64ed74e..5e4efb8d 100644 --- a/lib/features/create_recipe/models/recipe_create_model.freezed.dart +++ b/lib/features/create_recipe/models/recipe_create_model.freezed.dart @@ -23,6 +23,7 @@ RecipeCreateModel _$RecipeCreateModelFromJson(Map json) { mixin _$RecipeCreateModel { String get title => throw _privateConstructorUsedError; String get state => throw _privateConstructorUsedError; + @JsonKey(name: 'description_md') String get description => throw _privateConstructorUsedError; RecipeType get type => throw _privateConstructorUsedError; @JsonKey(name: 'video_url') @@ -58,7 +59,7 @@ abstract class $RecipeCreateModelCopyWith<$Res> { $Res call({ String title, String state, - String description, + @JsonKey(name: 'description_md') String description, RecipeType type, @JsonKey(name: 'video_url') String? videoUrl, @JsonKey(name: 'cooking_time') String? cookingTime, @@ -179,7 +180,7 @@ abstract class _$$RecipeCreateModelImplCopyWith<$Res> $Res call({ String title, String state, - String description, + @JsonKey(name: 'description_md') String description, RecipeType type, @JsonKey(name: 'video_url') String? videoUrl, @JsonKey(name: 'cooking_time') String? cookingTime, @@ -292,7 +293,7 @@ class _$RecipeCreateModelImpl implements _RecipeCreateModel { const _$RecipeCreateModelImpl({ required this.title, required this.state, - required this.description, + @JsonKey(name: 'description_md') required this.description, required this.type, @JsonKey(name: 'video_url') this.videoUrl, @JsonKey(name: 'cooking_time') this.cookingTime, @@ -314,6 +315,7 @@ class _$RecipeCreateModelImpl implements _RecipeCreateModel { @override final String state; @override + @JsonKey(name: 'description_md') final String description; @override final RecipeType type; @@ -427,7 +429,7 @@ abstract class _RecipeCreateModel implements RecipeCreateModel { const factory _RecipeCreateModel({ required final String title, required final String state, - required final String description, + @JsonKey(name: 'description_md') required final String description, required final RecipeType type, @JsonKey(name: 'video_url') final String? videoUrl, @JsonKey(name: 'cooking_time') final String? cookingTime, @@ -447,6 +449,7 @@ abstract class _RecipeCreateModel implements RecipeCreateModel { @override String get state; @override + @JsonKey(name: 'description_md') String get description; @override RecipeType get type; diff --git a/lib/features/create_recipe/models/recipe_create_model.g.dart b/lib/features/create_recipe/models/recipe_create_model.g.dart index 4926d92f..6f3efc13 100644 --- a/lib/features/create_recipe/models/recipe_create_model.g.dart +++ b/lib/features/create_recipe/models/recipe_create_model.g.dart @@ -11,7 +11,7 @@ _$RecipeCreateModelImpl _$$RecipeCreateModelImplFromJson( ) => _$RecipeCreateModelImpl( title: json['title'] as String, state: json['state'] as String, - description: json['description'] as String, + description: json['description_md'] as String, type: $enumDecode(_$RecipeTypeEnumMap, json['type']), videoUrl: json['video_url'] as String?, cookingTime: json['cooking_time'] as String?, @@ -34,7 +34,7 @@ Map _$$RecipeCreateModelImplToJson( ) => { 'title': instance.title, 'state': instance.state, - 'description': instance.description, + 'description_md': instance.description, 'type': _$RecipeTypeEnumMap[instance.type]!, 'video_url': instance.videoUrl, 'cooking_time': instance.cookingTime, diff --git a/lib/features/create_recipe/reporitories/recipe_repository.dart b/lib/features/create_recipe/reporitories/recipe_repository.dart index f1284fd6..233c2c88 100644 --- a/lib/features/create_recipe/reporitories/recipe_repository.dart +++ b/lib/features/create_recipe/reporitories/recipe_repository.dart @@ -43,13 +43,13 @@ class RecipeRepository { if (step != null) { if ((step.image == null || (step.image?.isEmpty ?? true)) && step.description != null) { stepsMap.add({ - 'description': step.description ?? "", + 'description_md': step.description ?? "", }); } else if (step.image != null && (step.image?.isNotEmpty ?? false)) { final image = await ImageCompressUtility.compressFile(File(step.image ?? '')); final multipartFile = await MultipartFile.fromFile(image.path); stepsMap.add({ - 'description': step.description ?? "", + 'description_md': step.description ?? "", 'image': multipartFile, }); } @@ -60,7 +60,7 @@ class RecipeRepository { 'state': 'active', 'title': recipe.title, 'tags': recipe.tags, - 'description': recipe.description, + 'description_md': recipe.description, 'video_url': recipe.video_url, 'ingredients': ingredientsMap, 'steps': stepsMap, diff --git a/lib/features/diets/presentation/widgets/expandable_text.dart b/lib/features/diets/presentation/widgets/expandable_text.dart index 37285909..666605b8 100644 --- a/lib/features/diets/presentation/widgets/expandable_text.dart +++ b/lib/features/diets/presentation/widgets/expandable_text.dart @@ -36,16 +36,17 @@ class _ExpandableTextState extends State { padding: const EdgeInsets.symmetric(horizontal: 16), child: Stack( children: [ - Html( - data: widget.text, - style: { - "*": Style( - margin: Margins.all(0), - color: Colors.black87, - maxLines: isExpanded ? null : widget.maxLines, - textOverflow: TextOverflow.clip, - ), - }, + Text( + widget.text, + style: TextStyles.textMMediumAuto.copyWith(color: appTheme.black), + // style: { + // "*": Style( + // margin: Margins.all(0), + // color: Colors.black87, + // maxLines: isExpanded ? null : widget.maxLines, + // textOverflow: TextOverflow.clip, + // ), + // }, ), if (!isExpanded) Positioned.fill( @@ -57,11 +58,7 @@ class _ExpandableTextState extends State { gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, - colors: [ - Colors.white.withValues(alpha: 0.0), - Colors.white.withValues(alpha: 0.6), - Colors.white, - ], + colors: [Colors.white.withValues(alpha: 0.0), Colors.white.withValues(alpha: 0.6), Colors.white], ), ), ), @@ -77,10 +74,7 @@ class _ExpandableTextState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - isExpanded ? s.hide : s.expand, - style: TextStyles.textMMedium.copyWith(color: appTheme.blueA400), - ), + Text(isExpanded ? s.hide : s.expand, style: TextStyles.textMMedium.copyWith(color: appTheme.blueA400)), Transform.rotate(angle: isExpanded ? math.pi : 0, child: SvgPicture.asset('assets/icons/arrow_down.svg', width: 12, height: 12)), ], ), diff --git a/lib/features/feed/models/diets_pagination_model.dart b/lib/features/feed/models/diets_pagination_model.dart index 3907fe8a..00f8e520 100644 --- a/lib/features/feed/models/diets_pagination_model.dart +++ b/lib/features/feed/models/diets_pagination_model.dart @@ -25,7 +25,7 @@ class Diet with _$Diet { @JsonKey(name: "duration") required int duration, @JsonKey(name: "state") required DietState state, @JsonKey(name: "type") required DietType type, - @JsonKey(name: "details") required String details, + @JsonKey(name: "description_md") required String details, @JsonKey(name: "daily_schedule") required Map>> dailySchedule, @JsonKey(name: "author") required Author author, @JsonKey(name: "total_likes") required int totalLikes, diff --git a/lib/features/feed/models/diets_pagination_model.freezed.dart b/lib/features/feed/models/diets_pagination_model.freezed.dart index 398cb653..ad7a4b07 100644 --- a/lib/features/feed/models/diets_pagination_model.freezed.dart +++ b/lib/features/feed/models/diets_pagination_model.freezed.dart @@ -285,7 +285,7 @@ mixin _$Diet { DietState get state => throw _privateConstructorUsedError; @JsonKey(name: "type") DietType get type => throw _privateConstructorUsedError; - @JsonKey(name: "details") + @JsonKey(name: "description_md") String get details => throw _privateConstructorUsedError; @JsonKey(name: "daily_schedule") Map>> get dailySchedule => @@ -326,7 +326,7 @@ abstract class $DietCopyWith<$Res> { @JsonKey(name: "duration") int duration, @JsonKey(name: "state") DietState state, @JsonKey(name: "type") DietType type, - @JsonKey(name: "details") String details, + @JsonKey(name: "description_md") String details, @JsonKey(name: "daily_schedule") Map>> dailySchedule, @JsonKey(name: "author") Author author, @@ -491,7 +491,7 @@ abstract class _$$DietImplCopyWith<$Res> implements $DietCopyWith<$Res> { @JsonKey(name: "duration") int duration, @JsonKey(name: "state") DietState state, @JsonKey(name: "type") DietType type, - @JsonKey(name: "details") String details, + @JsonKey(name: "description_md") String details, @JsonKey(name: "daily_schedule") Map>> dailySchedule, @JsonKey(name: "author") Author author, @@ -629,7 +629,7 @@ class _$DietImpl implements _Diet { @JsonKey(name: "duration") required this.duration, @JsonKey(name: "state") required this.state, @JsonKey(name: "type") required this.type, - @JsonKey(name: "details") required this.details, + @JsonKey(name: "description_md") required this.details, @JsonKey(name: "daily_schedule") required final Map>> dailySchedule, @JsonKey(name: "author") required this.author, @@ -665,7 +665,7 @@ class _$DietImpl implements _Diet { @JsonKey(name: "type") final DietType type; @override - @JsonKey(name: "details") + @JsonKey(name: "description_md") final String details; final Map>> _dailySchedule; @override @@ -785,7 +785,7 @@ abstract class _Diet implements Diet { @JsonKey(name: "duration") required final int duration, @JsonKey(name: "state") required final DietState state, @JsonKey(name: "type") required final DietType type, - @JsonKey(name: "details") required final String details, + @JsonKey(name: "description_md") required final String details, @JsonKey(name: "daily_schedule") required final Map>> dailySchedule, @JsonKey(name: "author") required final Author author, @@ -819,7 +819,7 @@ abstract class _Diet implements Diet { @JsonKey(name: "type") DietType get type; @override - @JsonKey(name: "details") + @JsonKey(name: "description_md") String get details; @override @JsonKey(name: "daily_schedule") diff --git a/lib/features/feed/models/diets_pagination_model.g.dart b/lib/features/feed/models/diets_pagination_model.g.dart index f8e66d9f..93258944 100644 --- a/lib/features/feed/models/diets_pagination_model.g.dart +++ b/lib/features/feed/models/diets_pagination_model.g.dart @@ -32,7 +32,7 @@ _$DietImpl _$$DietImplFromJson(Map json) => _$DietImpl( duration: (json['duration'] as num).toInt(), state: $enumDecode(_$DietStateEnumMap, json['state']), type: DietType.fromJson(json['type'] as Map), - details: json['details'] as String, + details: json['description_md'] as String, dailySchedule: (json['daily_schedule'] as Map).map( (k, e) => MapEntry( int.parse(k), @@ -70,7 +70,7 @@ Map _$$DietImplToJson( 'duration': instance.duration, 'state': _$DietStateEnumMap[instance.state]!, 'type': instance.type, - 'details': instance.details, + 'description_md': instance.details, 'daily_schedule': instance.dailySchedule.map( (k, e) => MapEntry( k.toString(), diff --git a/lib/features/feed/models/plan_pagination_model.dart b/lib/features/feed/models/plan_pagination_model.dart index 5af99db7..c4eeb71b 100644 --- a/lib/features/feed/models/plan_pagination_model.dart +++ b/lib/features/feed/models/plan_pagination_model.dart @@ -58,7 +58,7 @@ class PacketOptions with _$PacketOptions { @JsonKey(name: "items") required List items, @JsonKey(name: "price") required dynamic price, @JsonKey(name: "short") required String short, - @JsonKey(name: "description") required String description, + @JsonKey(name: "description_md") required String description, }) = _PacketOptions; factory PacketOptions.fromJson(Map json) => _$PacketOptionsFromJson(json); diff --git a/lib/features/feed/models/plan_pagination_model.freezed.dart b/lib/features/feed/models/plan_pagination_model.freezed.dart index bcf2a193..0ed900bb 100644 --- a/lib/features/feed/models/plan_pagination_model.freezed.dart +++ b/lib/features/feed/models/plan_pagination_model.freezed.dart @@ -1036,7 +1036,7 @@ mixin _$PacketOptions { dynamic get price => throw _privateConstructorUsedError; @JsonKey(name: "short") String get short => throw _privateConstructorUsedError; - @JsonKey(name: "description") + @JsonKey(name: "description_md") String get description => throw _privateConstructorUsedError; /// Serializes this PacketOptions to a JSON map. @@ -1060,7 +1060,7 @@ abstract class $PacketOptionsCopyWith<$Res> { @JsonKey(name: "items") List items, @JsonKey(name: "price") dynamic price, @JsonKey(name: "short") String short, - @JsonKey(name: "description") String description, + @JsonKey(name: "description_md") String description, }); } @@ -1125,7 +1125,7 @@ abstract class _$$PacketOptionsImplCopyWith<$Res> @JsonKey(name: "items") List items, @JsonKey(name: "price") dynamic price, @JsonKey(name: "short") String short, - @JsonKey(name: "description") String description, + @JsonKey(name: "description_md") String description, }); } @@ -1182,7 +1182,7 @@ class _$PacketOptionsImpl implements _PacketOptions { @JsonKey(name: "items") required final List items, @JsonKey(name: "price") required this.price, @JsonKey(name: "short") required this.short, - @JsonKey(name: "description") required this.description, + @JsonKey(name: "description_md") required this.description, }) : _items = items; factory _$PacketOptionsImpl.fromJson(Map json) => @@ -1204,7 +1204,7 @@ class _$PacketOptionsImpl implements _PacketOptions { @JsonKey(name: "short") final String short; @override - @JsonKey(name: "description") + @JsonKey(name: "description_md") final String description; @override @@ -1253,7 +1253,7 @@ abstract class _PacketOptions implements PacketOptions { @JsonKey(name: "items") required final List items, @JsonKey(name: "price") required final dynamic price, @JsonKey(name: "short") required final String short, - @JsonKey(name: "description") required final String description, + @JsonKey(name: "description_md") required final String description, }) = _$PacketOptionsImpl; factory _PacketOptions.fromJson(Map json) = @@ -1269,7 +1269,7 @@ abstract class _PacketOptions implements PacketOptions { @JsonKey(name: "short") String get short; @override - @JsonKey(name: "description") + @JsonKey(name: "description_md") String get description; /// Create a copy of PacketOptions diff --git a/lib/features/feed/models/plan_pagination_model.g.dart b/lib/features/feed/models/plan_pagination_model.g.dart index f9a2ccee..08771efc 100644 --- a/lib/features/feed/models/plan_pagination_model.g.dart +++ b/lib/features/feed/models/plan_pagination_model.g.dart @@ -93,7 +93,7 @@ _$PacketOptionsImpl _$$PacketOptionsImplFromJson(Map json) => items: (json['items'] as List).map((e) => e as String).toList(), price: json['price'], short: json['short'] as String, - description: json['description'] as String, + description: json['description_md'] as String, ); Map _$$PacketOptionsImplToJson(_$PacketOptionsImpl instance) => @@ -101,7 +101,7 @@ Map _$$PacketOptionsImplToJson(_$PacketOptionsImpl instance) => 'items': instance.items, 'price': instance.price, 'short': instance.short, - 'description': instance.description, + 'description_md': instance.description, }; _$PlanTypeImpl _$$PlanTypeImplFromJson(Map json) => diff --git a/lib/features/feed/models/recipes_model.dart b/lib/features/feed/models/recipes_model.dart index 3a5b56ff..6a5668bd 100644 --- a/lib/features/feed/models/recipes_model.dart +++ b/lib/features/feed/models/recipes_model.dart @@ -35,21 +35,14 @@ class Recipe with _$Recipe { @freezed class Ingredient with _$Ingredient { - const factory Ingredient({ - required String name, - String? unit, - required String portion, - }) = _Ingredient; + const factory Ingredient({required String name, String? unit, required String portion}) = _Ingredient; factory Ingredient.fromJson(Map json) => _$IngredientFromJson(json); } @freezed class Step with _$Step { - const factory Step({ - required String image, - required String description, - }) = _Step; + const factory Step({required String image, @JsonKey(name: 'description_md') required String description}) = _Step; factory Step.fromJson(Map json) => _$StepFromJson(json); } diff --git a/lib/features/feed/models/recipes_model.freezed.dart b/lib/features/feed/models/recipes_model.freezed.dart index 3e062bab..ed3d6d3e 100644 --- a/lib/features/feed/models/recipes_model.freezed.dart +++ b/lib/features/feed/models/recipes_model.freezed.dart @@ -929,6 +929,7 @@ Step _$StepFromJson(Map json) { /// @nodoc mixin _$Step { String get image => throw _privateConstructorUsedError; + @JsonKey(name: 'description_md') String get description => throw _privateConstructorUsedError; /// Serializes this Step to a JSON map. @@ -945,7 +946,10 @@ abstract class $StepCopyWith<$Res> { factory $StepCopyWith(Step value, $Res Function(Step) then) = _$StepCopyWithImpl<$Res, Step>; @useResult - $Res call({String image, String description}); + $Res call({ + String image, + @JsonKey(name: 'description_md') String description, + }); } /// @nodoc @@ -989,7 +993,10 @@ abstract class _$$StepImplCopyWith<$Res> implements $StepCopyWith<$Res> { ) = __$$StepImplCopyWithImpl<$Res>; @override @useResult - $Res call({String image, String description}); + $Res call({ + String image, + @JsonKey(name: 'description_md') String description, + }); } /// @nodoc @@ -1024,7 +1031,10 @@ class __$$StepImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() class _$StepImpl implements _Step { - const _$StepImpl({required this.image, required this.description}); + const _$StepImpl({ + required this.image, + @JsonKey(name: 'description_md') required this.description, + }); factory _$StepImpl.fromJson(Map json) => _$$StepImplFromJson(json); @@ -1032,6 +1042,7 @@ class _$StepImpl implements _Step { @override final String image; @override + @JsonKey(name: 'description_md') final String description; @override @@ -1070,7 +1081,7 @@ class _$StepImpl implements _Step { abstract class _Step implements Step { const factory _Step({ required final String image, - required final String description, + @JsonKey(name: 'description_md') required final String description, }) = _$StepImpl; factory _Step.fromJson(Map json) = _$StepImpl.fromJson; @@ -1078,6 +1089,7 @@ abstract class _Step implements Step { @override String get image; @override + @JsonKey(name: 'description_md') String get description; /// Create a copy of Step diff --git a/lib/features/feed/models/recipes_model.g.dart b/lib/features/feed/models/recipes_model.g.dart index 43a99cb9..ff44c0e2 100644 --- a/lib/features/feed/models/recipes_model.g.dart +++ b/lib/features/feed/models/recipes_model.g.dart @@ -78,11 +78,11 @@ Map _$$IngredientImplToJson(_$IngredientImpl instance) => _$StepImpl _$$StepImplFromJson(Map json) => _$StepImpl( image: json['image'] as String, - description: json['description'] as String, + description: json['description_md'] as String, ); Map _$$StepImplToJson(_$StepImpl instance) => { 'image': instance.image, - 'description': instance.description, + 'description_md': instance.description, }; diff --git a/lib/features/recipe/presentation/about_recipe_screen.dart b/lib/features/recipe/presentation/about_recipe_screen.dart index f2a15edd..5f1f6d7f 100644 --- a/lib/features/recipe/presentation/about_recipe_screen.dart +++ b/lib/features/recipe/presentation/about_recipe_screen.dart @@ -67,9 +67,7 @@ class _AboutRecipeScreenState extends State { void _scrollToBottom() { _jumped = true; - scrollController.jumpTo( - scrollController.position.maxScrollExtent, - ); + scrollController.jumpTo(scrollController.position.maxScrollExtent); } @override @@ -78,12 +76,7 @@ class _AboutRecipeScreenState extends State { return BlocProvider( create: (context) => recipeCubit..getRecipe(widget.recipe.slug), child: BlocProvider( - create: (BuildContext context) => commentsCubit - ..getComments( - widget.recipe.slug.toString(), - CommentSourceType.recipe, - true, - ), + create: (BuildContext context) => commentsCubit..getComments(widget.recipe.slug.toString(), CommentSourceType.recipe, true), child: BlocConsumer( listener: (BuildContext context, CommentsState commentsState) { if (commentsState is CommentsStateLoaded) { @@ -106,14 +99,7 @@ class _AboutRecipeScreenState extends State { resizeToAvoidBottomInset: true, bottomSheet: Container( padding: EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero), - decoration: BoxDecoration( - color: Colors.white, - border: Border( - top: BorderSide( - color: Colors.black.withValues(alpha: 0.1), - ), - ), - ), + decoration: BoxDecoration(color: Colors.white, border: Border(top: BorderSide(color: Colors.black.withValues(alpha: 0.1)))), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Column( @@ -133,17 +119,10 @@ class _AboutRecipeScreenState extends State { FocusManager.instance.primaryFocus?.unfocus(); }, child: Container( - decoration: BoxDecoration( - color: appTheme.blueA400, - shape: BoxShape.circle, - ), + decoration: BoxDecoration(color: appTheme.blueA400, shape: BoxShape.circle), height: 32, width: 32, - child: Icon( - Icons.close_rounded, - size: 18, - color: Colors.white, - ), + child: Icon(Icons.close_rounded, size: 18, color: Colors.white), ), ), if (replyId != null) SizedBox(width: 8), @@ -159,22 +138,12 @@ class _AboutRecipeScreenState extends State { maxLines: 5, minLines: 1, keyboardType: TextInputType.multiline, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w400, - color: Colors.black, - height: 1.2, - ), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1.2), decoration: InputDecoration( isDense: false, // убираем true, чтобы padding учитывался корректно contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен hintText: 'Комментарий', - hintStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w400, - height: 1.2, - color: Color(0xFFAEAEB2), - ), + hintStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, height: 1.2, color: Color(0xFFAEAEB2)), filled: true, border: OutlineInputBorder( borderRadius: BorderRadius.circular(16), @@ -214,7 +183,10 @@ class _AboutRecipeScreenState extends State { } }, child: Container( - decoration: BoxDecoration(color: textEditingController.text.length > 2 ? appTheme.blueA400 : Colors.grey, shape: BoxShape.circle), + decoration: BoxDecoration( + color: textEditingController.text.length > 2 ? appTheme.blueA400 : Colors.grey, + shape: BoxShape.circle, + ), height: 32, width: 32, child: Icon(Icons.send_rounded, size: 18, color: Colors.white), @@ -244,22 +216,14 @@ class _AboutRecipeScreenState extends State { path: 'recipe/${widget.recipe.slug}', slug: widget.recipe.slug, ), - anchor: Aligned( - shiftToWithinBound: AxisFlag(x: true, y: true), - follower: Alignment.topRight, - target: Alignment.bottomRight, - ), + anchor: Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight), child: IconButton( onPressed: () { setState(() { isMoreOptionsVisible = !isMoreOptionsVisible; }); }, - icon: SvgPicture.asset( - 'assets/icons/more_button.svg', - width: 20, - height: 20, - ), + icon: SvgPicture.asset('assets/icons/more_button.svg', width: 20, height: 20), ), ), ], @@ -294,10 +258,7 @@ class _AboutRecipeScreenState extends State { children: [ SvgPicture.asset('assets/icons/eye.svg', width: 18, height: 12), SizedBox(width: 8), - Text( - widget.recipe.viewsCount.toString(), - style: TextStyles.textXSSemibold.copyWith(color: appTheme.black), - ), + Text(widget.recipe.viewsCount.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)), ], backgroundColor: appTheme.whiteA700, ), @@ -361,17 +322,11 @@ class _AboutRecipeScreenState extends State { SizedBox(height: 16), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), - child: Text( - s.about_recipe, - style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), - ), + child: Text(s.about_recipe, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black)), ), SizedBox(height: 12), - InfoRow( - recipe: widget.recipe, - type: ProductType.recipe, - ), - if (widget.recipe.videoUrl != null) + InfoRow(recipe: widget.recipe, type: ProductType.recipe), + if (widget.recipe.videoUrl != null && widget.recipe.videoUrl!.isNotEmpty) Padding( padding: const EdgeInsets.only(left: 16, bottom: 12, top: 12), child: GestureDetector( @@ -389,44 +344,26 @@ class _AboutRecipeScreenState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text( - s.check_out_video_recipe, - style: TextStyles.textMSemibold.copyWith( - color: appTheme.black, - ), - ), + Text(s.check_out_video_recipe, style: TextStyles.textMSemibold.copyWith(color: appTheme.black)), SizedBox(width: 12), SvgPicture.asset('assets/icons/play_icon.svg', width: 16, height: 16), ], ), ), ), - ExpandableText( - text: widget.recipe.description, - ), + ExpandableText(text: widget.recipe.description), SizedBox(height: 20), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), - child: AuthorCard( - author: widget.recipe.author, - title: s.recipe_author, - ), + child: AuthorCard(author: widget.recipe.author, title: s.recipe_author), ), SizedBox(height: 16), ], ), ), SizedBox(height: 12), - if (widget.recipe.ingredients?.isNotEmpty == true) - IngredientsWidget( - recipe: widget.recipe, - ), - if (widget.recipe.steps?.isNotEmpty == true) ...[ - SizedBox(height: 12), - StepsWidget( - recipe: widget.recipe, - ), - ], + if (widget.recipe.ingredients?.isNotEmpty == true) IngredientsWidget(recipe: widget.recipe), + if (widget.recipe.steps?.isNotEmpty == true) ...[SizedBox(height: 12), StepsWidget(recipe: widget.recipe)], SizedBox(height: 8), MainBackgroundBouble( padding: EdgeInsets.symmetric(vertical: 16), @@ -437,20 +374,13 @@ class _AboutRecipeScreenState extends State { alignment: Alignment.centerLeft, child: Text( recipeState.recipe.commentsCount.toString() + ' ' + getCommentForm(widget.recipe.commentsCount, s), - style: TextStyles.textMMedium.copyWith( - color: appTheme.gray500, - ), + style: TextStyles.textMMedium.copyWith(color: appTheme.gray500), ), ), SizedBox(height: 16), if (state is CommentsStateLoading) const Loader(), if (state is CommentsStateLoaded) - CommentsWidget( - id: widget.recipe.slug, - commentSourceType: CommentSourceType.recipe, - comment: state.comment, - replyId: replyId, - ), + CommentsWidget(id: widget.recipe.slug, commentSourceType: CommentSourceType.recipe, comment: state.comment, replyId: replyId), ], ), ), @@ -479,29 +409,19 @@ class _AboutRecipeScreenState extends State { path: 'recipe/${widget.recipe.slug}', slug: widget.recipe.slug, ), - anchor: Aligned( - shiftToWithinBound: AxisFlag(x: true, y: true), - follower: Alignment.topRight, - target: Alignment.bottomRight, - ), + anchor: Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight), child: IconButton( onPressed: () { setState(() { isMoreOptionsVisible = !isMoreOptionsVisible; }); }, - icon: SvgPicture.asset( - 'assets/icons/more_button.svg', - width: 20, - height: 20, - ), + icon: SvgPicture.asset('assets/icons/more_button.svg', width: 20, height: 20), ), ), ], ), - body: DataErrorWidget( - onReload: () => context.read().getRecipe(widget.recipe.slug, index: widget.index), - ), + body: DataErrorWidget(onReload: () => context.read().getRecipe(widget.recipe.slug, index: widget.index)), ); } return Scaffold( @@ -523,22 +443,14 @@ class _AboutRecipeScreenState extends State { path: 'recipe/${widget.recipe.slug}', slug: widget.recipe.slug, ), - anchor: Aligned( - shiftToWithinBound: AxisFlag(x: true, y: true), - follower: Alignment.topRight, - target: Alignment.bottomRight, - ), + anchor: Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight), child: IconButton( onPressed: () { setState(() { isMoreOptionsVisible = !isMoreOptionsVisible; }); }, - icon: SvgPicture.asset( - 'assets/icons/more_button.svg', - width: 20, - height: 20, - ), + icon: SvgPicture.asset('assets/icons/more_button.svg', width: 20, height: 20), ), ), ], diff --git a/pubspec.yaml b/pubspec.yaml index faef1c98..59a1033d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: eatvio_app description: A new Flutter project. -version: 1.0.50+2 +version: 1.0.50+3 publish_to: 'none' environment: