diff --git a/lib/core/comments/presentation/comments_actions_bottom_sheet.dart b/lib/core/comments/presentation/comments_actions_bottom_sheet.dart index 3c1c3859..c4f3e540 100644 --- a/lib/core/comments/presentation/comments_actions_bottom_sheet.dart +++ b/lib/core/comments/presentation/comments_actions_bottom_sheet.dart @@ -18,25 +18,23 @@ void showCommentsActionsBottomSheet( required bool isMyComment, }) { showModalBottomSheet( - context: context, - isScrollControlled: true, - backgroundColor: Colors.transparent, - builder: (context) => Container( - margin: EdgeInsets.only(left: 8, right: 8, bottom: MediaQuery.of(context).padding.bottom + 20), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: appTheme.whiteA700, - ), - child: CommentsActionsBottomSheet( - isMyComment: isMyComment, - reply: reply, - copy: copy, - edit: edit, - delete: delete, - complain: complain, - commentText: commentText, - ), - )); + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (context) => Container( + margin: EdgeInsets.only(left: 8, right: 8, bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom + 20), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: appTheme.whiteA700), + child: CommentsActionsBottomSheet( + isMyComment: isMyComment, + reply: reply, + copy: copy, + edit: edit, + delete: delete, + complain: complain, + commentText: commentText, + ), + ), + ); } class CommentsActionsBottomSheet extends StatefulWidget { @@ -82,44 +80,33 @@ class _CommentsActionsBottomSheetState extends State child: Column( mainAxisSize: MainAxisSize.min, children: [ - Row(children: [ - Expanded( - child: CustomTextFormField( - autofocus: true, - controller: controller, - onChanged: (value) => setState(() {}), + Row( + children: [ + Expanded( + child: CustomTextFormField(autofocus: true, controller: controller, onChanged: (value) => setState(() {})), ), - ), - const SizedBox(width: 8), - GestureDetector( - onTap: () { - widget.edit(controller.text); - GoRouter.of(context).pop(); - }, - child: Container( - decoration: BoxDecoration( - color: controller.text.length > 2 ? appTheme.blueA400 : appTheme.gray50, - shape: BoxShape.circle, - ), - height: 32, - width: 32, - child: Icon( - Icons.send_rounded, - size: 18, - color: controller.text.length > 2 ? appTheme.whiteA700 : appTheme.black, + const SizedBox(width: 8), + GestureDetector( + onTap: () { + widget.edit(controller.text); + GoRouter.of(context).pop(); + }, + child: Container( + decoration: BoxDecoration(color: controller.text.length > 2 ? appTheme.blueA400 : appTheme.gray50, shape: BoxShape.circle), + height: 32, + width: 32, + child: Icon(Icons.send_rounded, size: 18, color: controller.text.length > 2 ? appTheme.whiteA700 : appTheme.black), ), ), - ) - ]) + ], + ), ], ), ) : Column( mainAxisSize: MainAxisSize.min, children: [ - const SizedBox( - height: 7, - ), + const SizedBox(height: 7), const BottomSheetHandlerBar(), if (widget.isMyComment) BottomSheetActionWidget( @@ -131,43 +118,22 @@ class _CommentsActionsBottomSheetState extends State }), ) else if (widget.reply != null) - BottomSheetActionWidget( - text: s.reply, - iconPath: 'assets/icons/reply.svg', - onTap: widget.reply!, - ), + BottomSheetActionWidget(text: s.reply, iconPath: 'assets/icons/reply.svg', onTap: widget.reply!), if (widget.reply != null) const CustomDivider(), - BottomSheetActionWidget( - text: s.copy, - iconPath: 'assets/icons/copy2.svg', - onTap: widget.copy, - ), + BottomSheetActionWidget(text: s.copy, iconPath: 'assets/icons/copy2.svg', onTap: widget.copy), if (widget.isMyComment) ...[ if (widget.reply != null) ...[ const CustomDivider(), - BottomSheetActionWidget( - text: s.reply, - iconPath: 'assets/icons/reply.svg', - onTap: widget.reply!, - ), + BottomSheetActionWidget(text: s.reply, iconPath: 'assets/icons/reply.svg', onTap: widget.reply!), ], const CustomDivider(), - BottomSheetActionWidget( - text: s.deleteComment, - iconPath: 'assets/icons/red_trash.svg', - onTap: widget.delete, - ), + BottomSheetActionWidget(text: s.deleteComment, iconPath: 'assets/icons/red_trash.svg', onTap: widget.delete), ] else ...[ const CustomDivider(), - BottomSheetActionWidget( - text: s.complain, - iconPath: 'assets/icons/complain.svg', - onTap: widget.complain, - ), - ] + BottomSheetActionWidget(text: s.complain, iconPath: 'assets/icons/complain.svg', onTap: widget.complain), + ], ], ), ); } } - diff --git a/lib/features/feed/presentation/widgets/comments_widget.dart b/lib/features/feed/presentation/widgets/comments_widget.dart index e36bdf52..3617fe33 100644 --- a/lib/features/feed/presentation/widgets/comments_widget.dart +++ b/lib/features/feed/presentation/widgets/comments_widget.dart @@ -25,13 +25,7 @@ class CommentsWidget extends StatefulWidget { final CommentModel comment; final int? replyId; - const CommentsWidget({ - super.key, - required this.id, - required this.commentSourceType, - required this.comment, - this.replyId, - }); + const CommentsWidget({super.key, required this.id, required this.commentSourceType, required this.comment, this.replyId}); @override State createState() => _CommentsWidgetState(); @@ -47,10 +41,7 @@ class _CommentsWidgetState extends State { _comment(s, widget.comment.data[i]), if (widget.comment.data[i].childrenComments.isNotEmpty) const SizedBox(height: 8), for (int j = 0; j < widget.comment.data[i].childrenComments.length; j++) - Padding( - padding: const EdgeInsets.only(left: 40), - child: _comment(s, widget.comment.data[i].childrenComments[j], 16, true), - ), + Padding(padding: const EdgeInsets.only(left: 40), child: _comment(s, widget.comment.data[i].childrenComments[j], 16, true)), const SizedBox(height: 8), ], const SizedBox(height: 48), @@ -72,7 +63,7 @@ class _CommentsWidgetState extends State { : null, copy: () { Clipboard.setData(ClipboardData(text: comment.body)); - showInfoToast(s.link_was_copied); + showInfoToast(s.text_was_copied); }, edit: (String text) { context.read().updateComment(id: comment.id, body: text); @@ -84,10 +75,7 @@ class _CommentsWidgetState extends State { showModalBottomSheet( context: context, isScrollControlled: true, - builder: (context) => ComplainingBottomSheet( - complainedContentType: ComplainedContent.comment, - id: comment.id, - ), + builder: (context) => ComplainingBottomSheet(complainedContentType: ComplainedContent.comment, id: comment.id), ); }, isMyComment: isMe, @@ -117,9 +105,7 @@ class _CommentsWidgetState extends State { ); }, child: CircleAvatar( - foregroundImage: NetworkImage( - comment.authorProfileIcon.contains('https') ? comment.authorProfileIcon : baseUrl + comment.authorProfileIcon, - ), + foregroundImage: NetworkImage(comment.authorProfileIcon.contains('https') ? comment.authorProfileIcon : baseUrl + comment.authorProfileIcon), backgroundImage: const AssetImage('assets/images/no_avatar.png'), radius: radius, ), @@ -131,24 +117,14 @@ class _CommentsWidgetState extends State { children: [ Text( comment.authorName, - style: TextStyle( - height: 1, - color: appTheme.gray, - fontSize: 14, - fontWeight: FontWeight.w500, - ), + style: TextStyle(height: 1, color: appTheme.gray, fontSize: 14, fontWeight: FontWeight.w500), ), const SizedBox(height: 4), SizedBox( width: isChild ? MediaQuery.of(context).size.width * 0.72 : MediaQuery.of(context).size.width * 0.8, child: Text( comment.body, - style: TextStyle( - height: 1, - color: appTheme.black, - fontSize: 16, - fontWeight: FontWeight.w500, - ), + style: TextStyle(height: 1, color: appTheme.black, fontSize: 16, fontWeight: FontWeight.w500), ), ), const SizedBox(height: 4), @@ -156,12 +132,7 @@ class _CommentsWidgetState extends State { children: [ Text( comment.createdAt.format('dd MMMM', 'ru'), - style: TextStyle( - height: 1, - color: appTheme.gray, - fontSize: 14, - fontWeight: FontWeight.w500, - ), + style: TextStyle(height: 1, color: appTheme.gray, fontSize: 14, fontWeight: FontWeight.w500), ), const SizedBox(width: 16), if (!isChild) @@ -171,12 +142,7 @@ class _CommentsWidgetState extends State { }, child: Text( s.answer, - style: TextStyle( - height: 1, - color: appTheme.gray, - fontSize: 14, - fontWeight: FontWeight.w600, - ), + style: TextStyle(height: 1, color: appTheme.gray, fontSize: 14, fontWeight: FontWeight.w600), ), ), ], diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 6403bc49..c054a4b5 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -694,6 +694,9 @@ class MessageLookup extends MessageLookupByLibrary { "tell_your_schedule": MessageLookupByLibrary.simpleMessage( "Расскажите в свободной форме о том как просыпаетесь, когда едите, когда ложитесь спать:", ), + "text_was_copied": MessageLookupByLibrary.simpleMessage( + "Text copied successfully", + ), "there_is_a_video": MessageLookupByLibrary.simpleMessage("Есть видео"), "three_options": MessageLookupByLibrary.simpleMessage("3 опции"), "time": MessageLookupByLibrary.simpleMessage("Время прохождения"), diff --git a/lib/generated/intl/messages_ru.dart b/lib/generated/intl/messages_ru.dart index b7db0a45..097e1180 100644 --- a/lib/generated/intl/messages_ru.dart +++ b/lib/generated/intl/messages_ru.dart @@ -326,6 +326,9 @@ class MessageLookup extends MessageLookupByLibrary { "tell_your_schedule": MessageLookupByLibrary.simpleMessage( "Расскажите в свободной форме о том как просыпаетесь, когда едите, когда ложитесь спать:", ), + "text_was_copied": MessageLookupByLibrary.simpleMessage( + "Текст успешно скопирован", + ), "three_options": MessageLookupByLibrary.simpleMessage("3 опции"), "toOffer": MessageLookupByLibrary.simpleMessage("Предложить"), "to_draft": MessageLookupByLibrary.simpleMessage("В черновик"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 105b40c7..85f74918 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -1054,6 +1054,16 @@ class S { ); } + /// `Text copied successfully` + String get text_was_copied { + return Intl.message( + 'Text copied successfully', + name: 'text_was_copied', + desc: '', + args: [], + ); + } + /// `Почта успешно скопирована` String get mail_was_copied { return Intl.message( diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index c6898871..57145fb9 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -129,6 +129,7 @@ "carbohydrates": "Углеводы", "answer": "Ответить", "link_was_copied": "Ссылка успешно скопирована", + "text_was_copied": "Text copied successfully", "mail_was_copied": "Почта успешно скопирована", "choose_start_diet_date": "Выберите дату старты диеты. Она отобразиться у Вас в дневнике", "continue_": "Продолжить", diff --git a/lib/l10n/intl_ru.arb b/lib/l10n/intl_ru.arb index b52f418f..e5d6f7c9 100644 --- a/lib/l10n/intl_ru.arb +++ b/lib/l10n/intl_ru.arb @@ -129,6 +129,7 @@ "carbohydrates": "Углеводы", "answer": "Ответить", "link_was_copied": "Ссылка успешно скопирована", + "text_was_copied": "Текст успешно скопирован", "mail_was_copied": "Почта успешно скопирована", "choose_start_diet_date": "Выберите дату старты диеты. Она отобразиться у Вас в дневнике", "continue_": "Продолжить",