🐛 Bug fixes and translation
This commit is contained in:
		| @@ -13,6 +13,8 @@ | ||||
|   "delete": "Delete", | ||||
|   "action": "Action", | ||||
|   "report": "Report", | ||||
|   "reaction": "Reaction", | ||||
|   "reactVerb": "React", | ||||
|   "post": "Post", | ||||
|   "postVerb": "Post", | ||||
|   "comment": "Comment", | ||||
| @@ -23,5 +25,7 @@ | ||||
|   "newComment": "Leave a comment", | ||||
|   "postIdentityNotify": "You will create this post as", | ||||
|   "postContentPlaceholder": "What's happened?!", | ||||
|   "postDeleteConfirm": "Are you sure you want to delete this post? This operation cannot be revert!" | ||||
|   "postDeleteConfirm": "Are you sure you want to delete this post? This operation cannot be revert!", | ||||
|   "reactionAdded": "Your reaction has been added.", | ||||
|   "reactionRemoved": "Your reaction has been removed." | ||||
| } | ||||
|   | ||||
| @@ -13,6 +13,8 @@ | ||||
|   "delete": "删除", | ||||
|   "action": "操作", | ||||
|   "report": "举报", | ||||
|   "reaction": "反应", | ||||
|   "reactVerb": "作出反应", | ||||
|   "post": "帖子", | ||||
|   "postVerb": "发表", | ||||
|   "comment": "评论", | ||||
| @@ -23,5 +25,7 @@ | ||||
|   "newComment": "留下评论", | ||||
|   "postIdentityNotify": "你将会以该身份发表本帖子", | ||||
|   "postContentPlaceholder": "发生什么事了?!", | ||||
|   "postDeleteConfirm": "你确定要删除这篇帖子吗?这意味着这个帖子将永远被我们丢弃在硬盘海中!该操作不可被反转!" | ||||
|   "postDeleteConfirm": "你确定要删除这篇帖子吗?这意味着这个帖子将永远被我们丢弃在硬盘海中!该操作不可被反转!", | ||||
|   "reactionAdded": "你的反应已被添加。", | ||||
|   "reactionRemoved": "你的反应已被移除。" | ||||
| } | ||||
| @@ -7,6 +7,7 @@ class ReactInfo { | ||||
|  | ||||
| final Map<String, ReactInfo> reactions = { | ||||
|   'thumb_up': ReactInfo(icon: '👍', attitude: 1), | ||||
|   'thumb_down': ReactInfo(icon: '👎', attitude: -1), | ||||
|   'thumb_down': ReactInfo(icon: '👎', attitude: 2), | ||||
|   'just_okay': ReactInfo(icon: '😅', attitude: 0), | ||||
|   'clap': ReactInfo(icon: '👏', attitude: 1), | ||||
| }; | ||||
|   | ||||
| @@ -62,26 +62,22 @@ class _PostItemState extends State<PostItem> { | ||||
|   } | ||||
|  | ||||
|   Widget renderReactions() { | ||||
|     if (reactionList != null && reactionList!.isNotEmpty) { | ||||
|       return Container( | ||||
|         height: 48, | ||||
|         padding: const EdgeInsets.only(top: 8, left: 4, right: 4), | ||||
|         child: ReactionList( | ||||
|           item: widget.item, | ||||
|           reactionList: reactionList, | ||||
|           onReact: (symbol, changes) { | ||||
|             setState(() { | ||||
|               if (!reactionList!.containsKey(symbol)) { | ||||
|                 reactionList![symbol] = 0; | ||||
|               } | ||||
|               reactionList![symbol] += changes; | ||||
|             }); | ||||
|           }, | ||||
|         ), | ||||
|       ); | ||||
|     } else { | ||||
|       return Container(); | ||||
|     } | ||||
|     return Container( | ||||
|       height: 48, | ||||
|       padding: const EdgeInsets.only(top: 8, left: 4, right: 4), | ||||
|       child: ReactionList( | ||||
|         item: widget.item, | ||||
|         reactionList: reactionList, | ||||
|         onReact: (symbol, changes) { | ||||
|           setState(() { | ||||
|             if (!reactionList!.containsKey(symbol)) { | ||||
|               reactionList![symbol] = 0; | ||||
|             } | ||||
|             reactionList![symbol] += changes; | ||||
|           }); | ||||
|         }, | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   String getAuthorDescribe() => widget.item.author.description.isNotEmpty | ||||
|   | ||||
| @@ -5,6 +5,7 @@ import 'package:provider/provider.dart'; | ||||
| import 'package:solian/models/reaction.dart'; | ||||
| import 'package:solian/providers/auth.dart'; | ||||
| import 'package:solian/utils/service_url.dart'; | ||||
| import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||||
|  | ||||
| Future<void> doReact( | ||||
|   String dataset, | ||||
| @@ -36,19 +37,19 @@ Future<void> doReact( | ||||
|   if (res.statusCode == 201) { | ||||
|     onReact(symbol, 1); | ||||
|     ScaffoldMessenger.of(context).showSnackBar( | ||||
|       const SnackBar( | ||||
|         content: Text("Your reaction has been added onto this post."), | ||||
|       SnackBar( | ||||
|         content: Text(AppLocalizations.of(context)!.reactionAdded), | ||||
|       ), | ||||
|     ); | ||||
|   } else if (res.statusCode == 204) { | ||||
|     onReact(symbol, -1); | ||||
|     ScaffoldMessenger.of(context).showSnackBar( | ||||
|       const SnackBar( | ||||
|         content: Text("Your reaction has been removed from this post."), | ||||
|       SnackBar( | ||||
|         content: Text(AppLocalizations.of(context)!.reactionRemoved), | ||||
|       ), | ||||
|     ); | ||||
|   } else { | ||||
|     var message = utf8.decode(res.bodyBytes); | ||||
|     final message = utf8.decode(res.bodyBytes); | ||||
|     ScaffoldMessenger.of(context).showSnackBar( | ||||
|       SnackBar(content: Text("Something went wrong... $message")), | ||||
|     ); | ||||
| @@ -112,7 +113,7 @@ class _ReactionActionPopupState extends State<ReactionActionPopup> { | ||||
|               vertical: 12, | ||||
|             ), | ||||
|             child: Text( | ||||
|               'Add a reaction', | ||||
|               AppLocalizations.of(context)!.reaction, | ||||
|               style: Theme.of(context).textTheme.headlineSmall, | ||||
|             ), | ||||
|           ), | ||||
|   | ||||
| @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; | ||||
| import 'package:solian/models/post.dart'; | ||||
| import 'package:solian/models/reaction.dart'; | ||||
| import 'package:solian/widgets/posts/reaction_action.dart'; | ||||
| import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||||
|  | ||||
| class ReactionList extends StatefulWidget { | ||||
|   final Post item; | ||||
| @@ -79,7 +80,7 @@ class _ReactionListState extends State<ReactionList> { | ||||
|         }), | ||||
|         ActionChip( | ||||
|           avatar: const Icon(Icons.add_reaction, color: Colors.teal), | ||||
|           label: const Text("React"), | ||||
|           label: Text(AppLocalizations.of(context)!.reactVerb), | ||||
|           visualDensity: density, | ||||
|           onPressed: () => viewReactMenu(context), | ||||
|         ), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user