🐛 Bug fixes and translation
This commit is contained in:
@ -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