Compare commits
No commits in common. "599dd4827bdbad1b79e5f553835f39d367fcd023" and "f16053c475c4ef7d710c8b85ee3cd7a483eac8f6" have entirely different histories.
599dd4827b
...
f16053c475
@ -62,8 +62,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
||||
'audio' => 16 / 9,
|
||||
'video' => 16 / 9,
|
||||
_ => 1,
|
||||
}
|
||||
.toDouble();
|
||||
};
|
||||
|
||||
return Container(
|
||||
constraints: ResponsiveBreakpoints.of(context).largerThan(MOBILE)
|
||||
|
@ -11,14 +11,12 @@ import 'package:styled_widget/styled_widget.dart';
|
||||
import 'package:surface/providers/sn_network.dart';
|
||||
import 'package:surface/providers/userinfo.dart';
|
||||
import 'package:surface/types/post.dart';
|
||||
import 'package:surface/types/reaction.dart';
|
||||
import 'package:surface/widgets/account/account_image.dart';
|
||||
import 'package:surface/widgets/attachment/attachment_list.dart';
|
||||
import 'package:surface/widgets/dialog.dart';
|
||||
import 'package:surface/widgets/markdown_content.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:surface/widgets/post/post_comment_list.dart';
|
||||
import 'package:surface/widgets/post/post_meta_editor.dart';
|
||||
import 'package:surface/widgets/post/post_reaction.dart';
|
||||
import 'package:surface/widgets/post/publisher_popover.dart';
|
||||
|
||||
@ -71,11 +69,6 @@ class PostItem extends StatelessWidget {
|
||||
_PostQuoteContent(child: data.repostTo!).padding(
|
||||
horizontal: 12,
|
||||
),
|
||||
if (data.visibility > 0)
|
||||
_PostVisibilityHint(data: data).padding(
|
||||
horizontal: 16,
|
||||
vertical: 4,
|
||||
),
|
||||
if (data.body['content_truncated'] == true)
|
||||
_PostTruncatedHint(data: data).padding(
|
||||
horizontal: 16,
|
||||
@ -128,13 +121,6 @@ class _PostBottomAction extends StatelessWidget {
|
||||
final iconColor = Theme.of(context).colorScheme.onSurface.withAlpha(
|
||||
(255 * 0.8).round(),
|
||||
);
|
||||
|
||||
final String? mostTypicalReaction = data.metric.reactionList.isNotEmpty
|
||||
? data.metric.reactionList.entries
|
||||
.reduce((a, b) => a.value > b.value ? a : b)
|
||||
.key
|
||||
: null;
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -145,18 +131,7 @@ class _PostBottomAction extends StatelessWidget {
|
||||
InkWell(
|
||||
child: Row(
|
||||
children: [
|
||||
if (mostTypicalReaction == null ||
|
||||
kTemplateReactions[mostTypicalReaction] == null)
|
||||
Icon(Symbols.add_reaction, size: 20, color: iconColor)
|
||||
else
|
||||
Text(
|
||||
kTemplateReactions[mostTypicalReaction]!.icon,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
height: 1.2,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
Icon(Symbols.add_reaction, size: 20, color: iconColor),
|
||||
const Gap(8),
|
||||
if (data.totalUpvote > 0 &&
|
||||
data.totalUpvote >= data.totalDownvote)
|
||||
@ -503,30 +478,6 @@ class _PostTagsList extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _PostVisibilityHint extends StatelessWidget {
|
||||
final SnPost data;
|
||||
const _PostVisibilityHint({super.key, required this.data});
|
||||
|
||||
static const List<IconData> kVisibilityIcons = [
|
||||
Symbols.public,
|
||||
Symbols.group,
|
||||
Symbols.person_check,
|
||||
Symbols.person_remove,
|
||||
Symbols.lock,
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(kVisibilityIcons[data.visibility], size: 20),
|
||||
const Gap(4),
|
||||
Text(kPostVisibilityLevel[data.visibility] ?? 'postVisibilityAll').tr(),
|
||||
],
|
||||
).opacity(0.75);
|
||||
}
|
||||
}
|
||||
|
||||
class _PostTruncatedHint extends StatelessWidget {
|
||||
final SnPost data;
|
||||
const _PostTruncatedHint({super.key, required this.data});
|
||||
@ -544,9 +495,9 @@ class _PostTruncatedHint extends StatelessWidget {
|
||||
const Gap(4),
|
||||
Text('postReadEstimate').tr(args: [
|
||||
'${Duration(
|
||||
seconds: (data.body['content_length'] as num).toDouble() *
|
||||
60 ~/
|
||||
kHumanReadSpeed,
|
||||
seconds: ((data.body['content_length'] as num).toDouble() /
|
||||
kHumanReadSpeed)
|
||||
.round(),
|
||||
).inSeconds}s',
|
||||
]),
|
||||
],
|
||||
|
@ -9,17 +9,17 @@ import 'package:surface/controllers/post_write_controller.dart';
|
||||
import 'package:surface/widgets/account/account_select.dart';
|
||||
import 'package:surface/widgets/post/post_tags_field.dart';
|
||||
|
||||
const Map<int, String> kPostVisibilityLevel = {
|
||||
class PostMetaEditor extends StatelessWidget {
|
||||
final PostWriteController controller;
|
||||
const PostMetaEditor({super.key, required this.controller});
|
||||
|
||||
static Map<int, String> kPostVisibilityLevel = {
|
||||
0: 'postVisibilityAll',
|
||||
1: 'postVisibilityFriends',
|
||||
2: 'postVisibilitySelected',
|
||||
3: 'postVisibilityFiltered',
|
||||
4: 'postVisibilityNone',
|
||||
};
|
||||
|
||||
class PostMetaEditor extends StatelessWidget {
|
||||
final PostWriteController controller;
|
||||
const PostMetaEditor({super.key, required this.controller});
|
||||
};
|
||||
|
||||
Future<DateTime?> _selectDate(
|
||||
BuildContext context, {
|
||||
|
Loading…
x
Reference in New Issue
Block a user