forked from eatvio/eatvio_app
feat(chat): add trailing comma rules
This commit is contained in:
@@ -37,18 +37,18 @@ class BlogPostCreateBloc
|
||||
title: currentState.title,
|
||||
description: currentState.description,
|
||||
youtube_url: currentState.youtube_url,
|
||||
token: currentState.token));
|
||||
token: currentState.token,),);
|
||||
} else {
|
||||
emit(BlogPostCreateLoadedState(
|
||||
token: token,
|
||||
title: TextEditingController(),
|
||||
description: TextEditingController(),
|
||||
youtube_url: TextEditingController()));
|
||||
youtube_url: TextEditingController(),),);
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _createBlogPost(
|
||||
CreateBlogPost event, Emitter<BlogPostCreateState> emit) async {
|
||||
CreateBlogPost event, Emitter<BlogPostCreateState> emit,) async {
|
||||
if (state is BlogPostCreateLoadedState) {
|
||||
var currentState = state as BlogPostCreateLoadedState;
|
||||
|
||||
@@ -62,7 +62,7 @@ class BlogPostCreateBloc
|
||||
AppRouter.navigatorKey.currentContext?.goNamed('feedScreen');
|
||||
} else {
|
||||
print(
|
||||
'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}');
|
||||
'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}',);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class BlogPostCreateLoadedState extends BlogPostCreateState {
|
||||
this.blog_postModelObj,
|
||||
this.title,
|
||||
this.description,
|
||||
this.youtube_url});
|
||||
this.youtube_url,});
|
||||
|
||||
BlogPostCreateModel? blog_postModelObj;
|
||||
TextEditingController? title;
|
||||
@@ -42,7 +42,7 @@ class BlogPostCreateLoadedState extends BlogPostCreateState {
|
||||
TextEditingController? title,
|
||||
TextEditingController? description,
|
||||
TextEditingController? youtube_url,
|
||||
String? token}) {
|
||||
String? token,}) {
|
||||
return BlogPostCreateLoadedState(
|
||||
blog_postModelObj: blog_postModelObj ?? this.blog_postModelObj,
|
||||
title: title ?? this.title,
|
||||
|
||||
@@ -13,7 +13,7 @@ class BlogPostCreateScreen extends StatelessWidget {
|
||||
return BlocProvider<BlogPostCreateBloc>(
|
||||
create: (context) => BlogPostCreateBloc(BlogPostCreateState(blog_postModelObj: BlogPostCreateModel(blog_postID: blog_postID.toString())))
|
||||
..add(BlogPostCreateInitialEvent()),
|
||||
child: BlogPostCreateScreen());
|
||||
child: BlogPostCreateScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -100,7 +100,7 @@ class BlogPostCreateScreen extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -49,13 +49,13 @@ class BlogPostEditBloc extends Bloc<BlogPostEditEvent, BlogPostEditState> {
|
||||
blog_post: currentState.blog_post,
|
||||
title: currentState.title,
|
||||
description: currentState.description,
|
||||
youtube_url: currentState.youtube_url));
|
||||
youtube_url: currentState.youtube_url,),);
|
||||
} else {
|
||||
emit(BlogPostEditLoadedState(
|
||||
blog_post: data,
|
||||
title: TextEditingController(text: data['title']),
|
||||
description: TextEditingController(text: data['description']),
|
||||
youtube_url: TextEditingController(text: data['youtube_url'])));
|
||||
youtube_url: TextEditingController(text: data['youtube_url']),),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
|
||||
@@ -27,7 +27,7 @@ class BlogPostEditLoadedState extends BlogPostEditState {
|
||||
this.blog_post,
|
||||
this.title,
|
||||
this.description,
|
||||
this.youtube_url});
|
||||
this.youtube_url,});
|
||||
|
||||
BlogPostEditModel? blog_postModelObj;
|
||||
Map<String, dynamic>? blog_post;
|
||||
|
||||
@@ -12,7 +12,7 @@ class BlogPostEditScreen extends StatelessWidget {
|
||||
return BlocProvider<BlogPostEditBloc>(
|
||||
create: (context) =>
|
||||
BlogPostEditBloc(BlogPostEditState(blog_postModelObj: BlogPostEditModel(blog_postID: blog_postID.toString())))..add(BlogPostEditInitialEvent()),
|
||||
child: BlogPostEditScreen());
|
||||
child: BlogPostEditScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -106,10 +106,10 @@ class BlogPostEditScreen extends StatelessWidget {
|
||||
ElevatedButton(
|
||||
onPressed: () => context.read<BlogPostEditBloc>().add(EditBlogPost()),
|
||||
child: Text('Сохранить'),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -50,14 +50,14 @@ class BlogPostBloc extends Bloc<BlogPostEvent, BlogPostState> {
|
||||
blog_post: currentState.blog_post,
|
||||
author: currentState.author,
|
||||
comments: currentState.comments,
|
||||
token: currentState.token));
|
||||
token: currentState.token,),);
|
||||
} else {
|
||||
emit(BlogPostLoadedState(
|
||||
blog_post: data,
|
||||
token: token,
|
||||
commentController: TextEditingController(),
|
||||
author: await _fetchAuthor(data['id']),
|
||||
comments: fillCommentList(await _fetchComments(data['id']))));
|
||||
comments: fillCommentList(await _fetchComments(data['id'])),),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
@@ -74,15 +74,15 @@ class BlogPostBloc extends Bloc<BlogPostEvent, BlogPostState> {
|
||||
}
|
||||
|
||||
FutureOr<void> _createComment(
|
||||
CreateComment event, Emitter<BlogPostState> emit) async {
|
||||
CreateComment event, Emitter<BlogPostState> emit,) async {
|
||||
if (state is BlogPostLoadedState) {
|
||||
var currentState = state as BlogPostLoadedState;
|
||||
// Отправляем данные по HTTP маршруту и ждем ответ
|
||||
var response = await _sendCommentData(
|
||||
currentState.token, event.body, currentState.blog_post?['id']);
|
||||
currentState.token, event.body, currentState.blog_post?['id'],);
|
||||
if (response.statusCode == 200) {
|
||||
var updatedComments = fillCommentList(
|
||||
await _fetchComments(currentState.blog_post?['id']));
|
||||
await _fetchComments(currentState.blog_post?['id']),);
|
||||
var updatedState = currentState.copyWith(
|
||||
comments: updatedComments,
|
||||
commentController:
|
||||
@@ -94,7 +94,7 @@ class BlogPostBloc extends Bloc<BlogPostEvent, BlogPostState> {
|
||||
}
|
||||
|
||||
FutureOr<void> _deleteEntry(
|
||||
DeleteEntry event, Emitter<BlogPostState> emit) async {
|
||||
DeleteEntry event, Emitter<BlogPostState> emit,) async {
|
||||
final box = await Hive.openBox('token');
|
||||
final token = box.get('token');
|
||||
if (token == null) {
|
||||
@@ -158,13 +158,13 @@ class BlogPostBloc extends Bloc<BlogPostEvent, BlogPostState> {
|
||||
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<http.Response> _sendCommentData(
|
||||
String? token, String body, int id) async {
|
||||
String? token, String body, int id,) async {
|
||||
String url = dotenv.env['SERVER_ROOT']! + '/feed/createComment/$id';
|
||||
final Map<String, dynamic> credentials = {
|
||||
'id': id,
|
||||
@@ -177,7 +177,7 @@ class BlogPostBloc extends Bloc<BlogPostEvent, BlogPostState> {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
body: json.encode(credentials),
|
||||
encoding: utf8);
|
||||
encoding: utf8,);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class BlogPostLoadedState extends BlogPostState {
|
||||
this.author,
|
||||
this.comments,
|
||||
this.token,
|
||||
this.commentController});
|
||||
this.commentController,});
|
||||
|
||||
BlogPostModel? blog_postModelObj;
|
||||
Map<String, dynamic>? blog_post;
|
||||
@@ -44,14 +44,14 @@ class BlogPostLoadedState extends BlogPostState {
|
||||
Map<String, dynamic>? author,
|
||||
TextEditingController? commentController,
|
||||
String? token,
|
||||
List<dynamic>? comments}) {
|
||||
List<dynamic>? comments,}) {
|
||||
return BlogPostLoadedState(
|
||||
blog_postModelObj: blog_postModelObj ?? this.blog_postModelObj,
|
||||
blog_post: blog_post ?? this.blog_post,
|
||||
author: author ?? this.author,
|
||||
comments: comments ?? this.comments,
|
||||
token: token ?? this.token,
|
||||
commentController: commentController ?? this.commentController);
|
||||
commentController: commentController ?? this.commentController,);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ class BlogPostScreen extends StatelessWidget {
|
||||
child: Text(
|
||||
DateFormat('dd.MM.yyyy').format(DateTime.parse(state.blog_post?['updated_at'])),
|
||||
style: theme.textTheme.bodyMedium,
|
||||
)),
|
||||
),),
|
||||
SizedBox(height: 16.0),
|
||||
Row(children: [
|
||||
Padding(
|
||||
@@ -210,8 +210,8 @@ class BlogPostScreen extends StatelessWidget {
|
||||
Text(
|
||||
"Нравится",
|
||||
style: CustomTextStyles.titleMediumSemiBold,
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
),
|
||||
Spacer(),
|
||||
Padding(
|
||||
@@ -224,10 +224,10 @@ class BlogPostScreen extends StatelessWidget {
|
||||
Text(
|
||||
"Поделиться",
|
||||
style: CustomTextStyles.titleMediumSemiBold,
|
||||
)
|
||||
]))
|
||||
]),
|
||||
]),
|
||||
),
|
||||
],),),
|
||||
],),
|
||||
],),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ class BlogPostScreen extends StatelessWidget {
|
||||
),
|
||||
onPressed: () => context.read<BlogPostBloc>().add(CreateComment(state.commentController!.text)),
|
||||
// Установите прозрачный фон
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -9,7 +9,7 @@ class CommentModel {
|
||||
this.username,
|
||||
this.dateText,
|
||||
this.greetingText,
|
||||
required this.id}) {
|
||||
required this.id,}) {
|
||||
userImage = userImage ?? ImageConstant.imageNotFound;
|
||||
username = username;
|
||||
dateText = dateText;
|
||||
|
||||
@@ -82,7 +82,7 @@ class CommentWidget extends StatelessWidget {
|
||||
commentModelObj.dateText!,
|
||||
style: theme.textTheme.bodyMedium,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -99,7 +99,7 @@ class CommentWidget extends StatelessWidget {
|
||||
imagePath: ImageConstant.imgSend,
|
||||
height: 30.v,
|
||||
width: 30.h,
|
||||
margin: EdgeInsets.only(left: 5)),
|
||||
margin: EdgeInsets.only(left: 5),),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -50,12 +50,12 @@ class FeedBloc extends Bloc<FeedEvent, FeedState> {
|
||||
emit((currentState).copyWith(
|
||||
posts: data,
|
||||
myProfileModelObj: currentState.myProfileModelObj,
|
||||
));
|
||||
),);
|
||||
} else {
|
||||
print('Got unloaded');
|
||||
emit(FeedLoadedState(
|
||||
posts: data,
|
||||
));
|
||||
),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
|
||||
@@ -56,7 +56,7 @@ class FeedScreen extends StatelessWidget {
|
||||
SizedBox(height: 20),
|
||||
_buildMenu(context, state),
|
||||
SizedBox(height: 20),
|
||||
_buildBlogPostList(context, state)
|
||||
_buildBlogPostList(context, state),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -108,7 +108,7 @@ class FeedScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -235,8 +235,8 @@ class FeedScreen extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
"Комментировать",
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
),
|
||||
Spacer(),
|
||||
Row(children: [
|
||||
@@ -246,18 +246,18 @@ class FeedScreen extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
"Нравится",
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
Spacer(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 4),
|
||||
child: Icon(Icons.share_outlined),
|
||||
),
|
||||
]),
|
||||
],),
|
||||
],
|
||||
),
|
||||
),
|
||||
]));
|
||||
],),);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
|
||||
@@ -24,7 +24,7 @@ class CustomSearchView extends StatelessWidget {
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.onChanged})
|
||||
this.onChanged,})
|
||||
: super(
|
||||
key: key,
|
||||
);
|
||||
@@ -76,7 +76,7 @@ class CustomSearchView extends StatelessWidget {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: searchViewWidget(context))
|
||||
child: searchViewWidget(context),)
|
||||
: searchViewWidget(context);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ class CustomSearchView extends StatelessWidget {
|
||||
SizedBox(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Icon(Icons.search)),
|
||||
child: Icon(Icons.search),),
|
||||
),
|
||||
prefixIconConstraints: prefixConstraints ??
|
||||
BoxConstraints(
|
||||
|
||||
Reference in New Issue
Block a user