🐛 Bug fixes and translation

This commit is contained in:
LittleSheep 2024-04-15 23:40:36 +08:00
parent 7e42d95904
commit d2ae4f3292
6 changed files with 37 additions and 30 deletions

View File

@ -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."
}

View File

@ -13,6 +13,8 @@
"delete": "删除",
"action": "操作",
"report": "举报",
"reaction": "反应",
"reactVerb": "作出反应",
"post": "帖子",
"postVerb": "发表",
"comment": "评论",
@ -23,5 +25,7 @@
"newComment": "留下评论",
"postIdentityNotify": "你将会以该身份发表本帖子",
"postContentPlaceholder": "发生什么事了?!",
"postDeleteConfirm": "你确定要删除这篇帖子吗?这意味着这个帖子将永远被我们丢弃在硬盘海中!该操作不可被反转!"
"postDeleteConfirm": "你确定要删除这篇帖子吗?这意味着这个帖子将永远被我们丢弃在硬盘海中!该操作不可被反转!",
"reactionAdded": "你的反应已被添加。",
"reactionRemoved": "你的反应已被移除。"
}

View File

@ -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),
};

View File

@ -62,7 +62,6 @@ 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),
@ -79,9 +78,6 @@ class _PostItemState extends State<PostItem> {
},
),
);
} else {
return Container();
}
}
String getAuthorDescribe() => widget.item.author.description.isNotEmpty

View File

@ -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,
),
),

View File

@ -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),
),