forked from eatvio/eatvio_app
fix: youtube_url => video_url
This commit is contained in:
@@ -12,14 +12,14 @@ class BlogPostCreateCubit extends Cubit<BlogPostCreateState> {
|
||||
|
||||
createBlogPost({
|
||||
String? title,
|
||||
String? youtubeURL,
|
||||
String? videoUrl,
|
||||
String? description,
|
||||
XFile? image,
|
||||
}) async {
|
||||
emit(BlogPostCreateState.loading());
|
||||
await blogPostRepository.createBlogPost(
|
||||
title,
|
||||
youtubeURL,
|
||||
videoUrl,
|
||||
description,
|
||||
image,
|
||||
);
|
||||
|
||||
@@ -9,7 +9,7 @@ class BlogPostCreateCredentialsModel with _$BlogPostCreateCredentialsModel {
|
||||
const factory BlogPostCreateCredentialsModel({
|
||||
required String title,
|
||||
required String description,
|
||||
@JsonKey(name: 'youtube_url') required String youtubeUrl,
|
||||
@JsonKey(name: 'video_url') required String videoUrl,
|
||||
@Default('active') String status,
|
||||
}) = _BlogPostCreateCredentialsModel;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
|
||||
XFile? image;
|
||||
final titleController = TextEditingController();
|
||||
final descriptionController = TextEditingController();
|
||||
final youtubeUrlController = TextEditingController();
|
||||
final videoUrlController = TextEditingController();
|
||||
bool isLoading = false;
|
||||
|
||||
@override
|
||||
@@ -141,7 +141,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
|
||||
blogPostCubit.createBlogPost(
|
||||
title: titleController.text,
|
||||
description: descriptionController.text,
|
||||
youtubeURL: youtubeUrlController.text,
|
||||
videoUrl: videoUrlController.text,
|
||||
image: image,
|
||||
);
|
||||
},
|
||||
@@ -167,15 +167,15 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
|
||||
minLines: 4,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
if (youtubeUrlController.text.isEmpty) Text('Изображение поста'),
|
||||
if (youtubeUrlController.text.isEmpty) SizedBox(height: 8),
|
||||
if (youtubeUrlController.text.isEmpty) _buildAddPhoto(),
|
||||
if (videoUrlController.text.isEmpty) Text('Изображение поста'),
|
||||
if (videoUrlController.text.isEmpty) SizedBox(height: 8),
|
||||
if (videoUrlController.text.isEmpty) _buildAddPhoto(),
|
||||
SizedBox(height: 16),
|
||||
if (image == null) Text('Ссылка на видео'),
|
||||
if (image == null) SizedBox(height: 8),
|
||||
if (image == null)
|
||||
CustomTextFormField(
|
||||
controller: youtubeUrlController,
|
||||
controller: videoUrlController,
|
||||
),
|
||||
SizedBox(height: 80),
|
||||
],
|
||||
|
||||
@@ -13,7 +13,7 @@ class BlogPostRepository {
|
||||
|
||||
Future<void> createBlogPost(
|
||||
String? title,
|
||||
String? youtubeURL,
|
||||
String? videoUrl,
|
||||
String? description,
|
||||
XFile? image,
|
||||
) async {
|
||||
@@ -21,7 +21,7 @@ class BlogPostRepository {
|
||||
'title': title,
|
||||
'description': description,
|
||||
'state': 'active',
|
||||
'youtube_url': youtubeURL,
|
||||
'video_url': videoUrl,
|
||||
'image': image != null ? await MultipartFile.fromFile((await ImageCompressUtility.compressFile(File(image.path))).path, filename: image.name) : null,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user