lemmur-app-android/lib/widgets/post/post_actions.dart

50 lines
1.4 KiB
Dart
Raw Normal View History

2021-09-11 01:04:15 +02:00
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import '../../l10n/l10n.dart';
import '../../util/icons.dart';
import '../../util/observer_consumers.dart';
import '../../util/share.dart';
import 'post_status.dart';
import 'post_store.dart';
import 'post_voting.dart';
import 'save_post_button.dart';
class PostActions extends HookWidget {
const PostActions();
@override
Widget build(BuildContext context) {
final fullPost = context.read<IsFullPost>();
// assemble actions section
2021-09-11 01:04:15 +02:00
return ObserverBuilder<PostStore>(builder: (context, store) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
2021-09-11 01:04:15 +02:00
child: Row(
children: [
const Icon(Icons.comment),
const SizedBox(width: 6),
Expanded(
child: Text(
L10n.of(context)
2021-09-11 01:04:15 +02:00
.number_of_comments(store.postView.counts.comments),
overflow: TextOverflow.fade,
softWrap: false,
),
),
if (!fullPost)
IconButton(
icon: Icon(shareIcon),
onPressed: () =>
share(store.postView.post.apId, context: context),
),
if (!fullPost) const SavePostButton(),
const PostVoting(),
],
),
);
});
}
}