Compare commits
2 Commits
5d6a52494e
...
0ed8c2373d
Author | SHA1 | Date | |
---|---|---|---|
0ed8c2373d | |||
b8a1e5b5c0 |
@ -104,10 +104,20 @@
|
|||||||
"postRepostingNotice": "You're about to repost a post that posted {}.",
|
"postRepostingNotice": "You're about to repost a post that posted {}.",
|
||||||
"postReact": "React",
|
"postReact": "React",
|
||||||
"postReactions": "Reactions of Post",
|
"postReactions": "Reactions of Post",
|
||||||
"postReactionPoints": {
|
"postReactionUpvote": {
|
||||||
"zero": "{} pt",
|
"zero": "0 upvote",
|
||||||
"one": "{} pt",
|
"one": "{} upvote",
|
||||||
"other": "{} pts"
|
"other": "{} upvotes"
|
||||||
|
},
|
||||||
|
"postReactionDownvote": {
|
||||||
|
"zero": "0 downvote",
|
||||||
|
"one": "{} downvote",
|
||||||
|
"other": "{} downvotes"
|
||||||
|
},
|
||||||
|
"postReactionSocialPoint": {
|
||||||
|
"zero": "0 point",
|
||||||
|
"one": "{} point",
|
||||||
|
"other": "{} points"
|
||||||
},
|
},
|
||||||
"postReactCompleted": "Reaction has been added.",
|
"postReactCompleted": "Reaction has been added.",
|
||||||
"postReactUncompleted": "Reaction has been removed.",
|
"postReactUncompleted": "Reaction has been removed.",
|
||||||
|
@ -104,10 +104,20 @@
|
|||||||
"postReact": "反应",
|
"postReact": "反应",
|
||||||
"postPosted": "帖子已经发表。",
|
"postPosted": "帖子已经发表。",
|
||||||
"postReactions": "帖子的反应",
|
"postReactions": "帖子的反应",
|
||||||
"postReactionPoints": {
|
"postReactionUpvote": {
|
||||||
"zero": "{} 点",
|
"zero": "0 个顶",
|
||||||
"one": "{} 点",
|
"one": "{} 个顶",
|
||||||
"other": "{} 点"
|
"other": "{} 个顶"
|
||||||
|
},
|
||||||
|
"postReactionDownvote": {
|
||||||
|
"zero": "0 个踩",
|
||||||
|
"one": "{} 个踩",
|
||||||
|
"other": "{} 个踩"
|
||||||
|
},
|
||||||
|
"postReactionSocialPoint": {
|
||||||
|
"zero": "无社会信用点变更",
|
||||||
|
"one": "{} 点社会信用点变更",
|
||||||
|
"other": "{} 点社会信用点变更"
|
||||||
},
|
},
|
||||||
"postReactCompleted": "反应已被添加。",
|
"postReactCompleted": "反应已被添加。",
|
||||||
"postReactUncompleted": "反应已被移除。",
|
"postReactUncompleted": "反应已被移除。",
|
||||||
|
@ -48,7 +48,8 @@ final _appRoutes = [
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/post/write/:mode',
|
path: '/post/write/:mode',
|
||||||
name: 'postEditor',
|
name: 'postEditor',
|
||||||
pageBuilder: (context, state) => CustomTransitionPage(
|
builder: (context, state) => AppBackground(
|
||||||
|
isLessOptimization: true,
|
||||||
child: PostEditorScreen(
|
child: PostEditorScreen(
|
||||||
mode: state.pathParameters['mode']!,
|
mode: state.pathParameters['mode']!,
|
||||||
postEditId: int.tryParse(
|
postEditId: int.tryParse(
|
||||||
@ -61,34 +62,17 @@ final _appRoutes = [
|
|||||||
state.uri.queryParameters['reposting'] ?? '',
|
state.uri.queryParameters['reposting'] ?? '',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
transitionsBuilder:
|
|
||||||
(context, animation, secondaryAnimation, child) {
|
|
||||||
return FadeThroughTransition(
|
|
||||||
animation: animation,
|
|
||||||
secondaryAnimation: secondaryAnimation,
|
|
||||||
fillColor: Colors.transparent,
|
|
||||||
child: AppBackground(isLessOptimization: true, child: child),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/post/:slug',
|
path: '/post/:slug',
|
||||||
name: 'postDetail',
|
name: 'postDetail',
|
||||||
pageBuilder: (context, state) => CustomTransitionPage(
|
builder: (context, state) => AppBackground(
|
||||||
|
isLessOptimization: true,
|
||||||
child: PostDetailScreen(
|
child: PostDetailScreen(
|
||||||
slug: state.pathParameters['slug']!,
|
slug: state.pathParameters['slug']!,
|
||||||
preload: state.extra as SnPost?,
|
preload: state.extra as SnPost?,
|
||||||
),
|
),
|
||||||
transitionsBuilder:
|
|
||||||
(context, animation, secondaryAnimation, child) {
|
|
||||||
return FadeThroughTransition(
|
|
||||||
animation: animation,
|
|
||||||
secondaryAnimation: secondaryAnimation,
|
|
||||||
fillColor: Colors.transparent,
|
|
||||||
child: AppBackground(isLessOptimization: true, child: child),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -130,7 +130,7 @@ class _ChatManageScreenState extends State<ChatManageScreen> {
|
|||||||
LoadingIndicator(isActive: _isBusy),
|
LoadingIndicator(isActive: _isBusy),
|
||||||
if (_editingChannel != null)
|
if (_editingChannel != null)
|
||||||
MaterialBanner(
|
MaterialBanner(
|
||||||
leading: const Icon(Icons.edit),
|
leading: const Icon(Symbols.edit),
|
||||||
leadingPadding: const EdgeInsets.only(left: 10, right: 20),
|
leadingPadding: const EdgeInsets.only(left: 10, right: 20),
|
||||||
dividerColor: Colors.transparent,
|
dividerColor: Colors.transparent,
|
||||||
content: Text(
|
content: Text(
|
||||||
|
@ -173,7 +173,13 @@ class _ExploreScreenState extends State<ExploreScreen> {
|
|||||||
onFetchData: _fetchPosts,
|
onFetchData: _fetchPosts,
|
||||||
itemBuilder: (context, idx) {
|
itemBuilder: (context, idx) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
child: PostItem(data: _posts[idx], maxWidth: 640),
|
child: PostItem(
|
||||||
|
data: _posts[idx],
|
||||||
|
maxWidth: 640,
|
||||||
|
onChanged: (data) {
|
||||||
|
setState(() => _posts[idx] = data);
|
||||||
|
},
|
||||||
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
GoRouter.of(context).pushNamed(
|
GoRouter.of(context).pushNamed(
|
||||||
'postDetail',
|
'postDetail',
|
||||||
|
@ -135,7 +135,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
|||||||
title: Text('screenNotification').tr(),
|
title: Text('screenNotification').tr(),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.checklist),
|
icon: const Icon(Symbols.checklist),
|
||||||
onPressed: _isSubmitting ? null : _markAllAsRead,
|
onPressed: _isSubmitting ? null : _markAllAsRead,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -113,6 +113,9 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
|
|||||||
data: _data!,
|
data: _data!,
|
||||||
maxWidth: 640,
|
maxWidth: 640,
|
||||||
showComments: false,
|
showComments: false,
|
||||||
|
onChanged: (data) {
|
||||||
|
setState(() => _data = data);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SliverToBoxAdapter(child: Divider(height: 1)),
|
const SliverToBoxAdapter(child: Divider(height: 1)),
|
||||||
@ -144,7 +147,6 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
|
|||||||
child: PostMiniEditor(
|
child: PostMiniEditor(
|
||||||
postReplyId: _data!.id,
|
postReplyId: _data!.id,
|
||||||
onPost: () {
|
onPost: () {
|
||||||
_childListKey.currentState!.refresh();
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_data = _data!.copyWith(
|
_data = _data!.copyWith(
|
||||||
metric: _data!.metric.copyWith(
|
metric: _data!.metric.copyWith(
|
||||||
@ -152,6 +154,7 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
_childListKey.currentState!.refresh();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -292,7 +292,8 @@ class _PostEditorScreenState extends State<PostEditorScreen> {
|
|||||||
]),
|
]),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
PostItem(
|
PostItem(
|
||||||
data: _writeController.repostingPost!)
|
data: _writeController.repostingPost!,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -354,7 +355,25 @@ class _PostEditorScreenState extends State<PostEditorScreen> {
|
|||||||
),
|
),
|
||||||
if (_writeController.attachments.isNotEmpty)
|
if (_writeController.attachments.isNotEmpty)
|
||||||
PostMediaPendingList(
|
PostMediaPendingList(
|
||||||
controller: _writeController,
|
attachments: _writeController.attachments,
|
||||||
|
isBusy: _writeController.isBusy,
|
||||||
|
onUpdate: (int idx, PostWriteMedia updatedMedia) async {
|
||||||
|
_writeController.setIsBusy(true);
|
||||||
|
try {
|
||||||
|
_writeController.setAttachmentAt(idx, updatedMedia);
|
||||||
|
} finally {
|
||||||
|
_writeController.setIsBusy(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onRemove: (int idx) async {
|
||||||
|
_writeController.setIsBusy(true);
|
||||||
|
try {
|
||||||
|
_writeController.removeAttachmentAt(idx);
|
||||||
|
} finally {
|
||||||
|
_writeController.setIsBusy(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onUpdateBusy: (state) => _writeController.setIsBusy(state),
|
||||||
).padding(bottom: 8),
|
).padding(bottom: 8),
|
||||||
Material(
|
Material(
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
|
@ -81,8 +81,8 @@ class _RealmScreenState extends State<RealmScreen> {
|
|||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: !_isCompactView
|
icon: !_isCompactView
|
||||||
? const Icon(Icons.view_list)
|
? const Icon(Symbols.view_list)
|
||||||
: const Icon(Icons.view_module),
|
: const Icon(Symbols.view_module),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() => _isCompactView = !_isCompactView);
|
setState(() => _isCompactView = !_isCompactView);
|
||||||
},
|
},
|
||||||
|
@ -191,7 +191,7 @@ class _RealmManageScreenState extends State<RealmManageScreen> {
|
|||||||
LoadingIndicator(isActive: _isBusy),
|
LoadingIndicator(isActive: _isBusy),
|
||||||
if (_editingRealm != null)
|
if (_editingRealm != null)
|
||||||
MaterialBanner(
|
MaterialBanner(
|
||||||
leading: const Icon(Icons.edit),
|
leading: const Icon(Symbols.edit),
|
||||||
leadingPadding: const EdgeInsets.only(left: 10, right: 20),
|
leadingPadding: const EdgeInsets.only(left: 10, right: 20),
|
||||||
dividerColor: Colors.transparent,
|
dividerColor: Colors.transparent,
|
||||||
content: Text(
|
content: Text(
|
||||||
|
@ -232,7 +232,7 @@ class _AttachmentItemContentVideoState
|
|||||||
)
|
)
|
||||||
else
|
else
|
||||||
const Center(
|
const Center(
|
||||||
child: Icon(Icons.movie, size: 64),
|
child: Icon(Symbols.movie, size: 64),
|
||||||
),
|
),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
@ -397,7 +397,7 @@ class _AttachmentItemContentAudioState
|
|||||||
)
|
)
|
||||||
else
|
else
|
||||||
const Center(
|
const Center(
|
||||||
child: Icon(Icons.radio, size: 64),
|
child: Icon(Symbols.radio, size: 64),
|
||||||
),
|
),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
@ -485,7 +485,7 @@ class _AttachmentItemContentAudioState
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.audio_file, size: 32),
|
const Icon(Symbols.audio_file, size: 32),
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
Text(
|
Text(
|
||||||
widget.data.alt,
|
widget.data.alt,
|
||||||
@ -554,8 +554,8 @@ class _AttachmentItemContentAudioState
|
|||||||
const Gap(16),
|
const Gap(16),
|
||||||
IconButton.filled(
|
IconButton.filled(
|
||||||
icon: _isPlaying
|
icon: _isPlaying
|
||||||
? const Icon(Icons.pause)
|
? const Icon(Symbols.pause)
|
||||||
: const Icon(Icons.play_arrow),
|
: const Icon(Symbols.play_arrow),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_audioPlayer!.playOrPause();
|
_audioPlayer!.playOrPause();
|
||||||
},
|
},
|
||||||
|
@ -175,7 +175,7 @@ class ChatMessageInputState extends State<ChatMessageInput> {
|
|||||||
padding: _attachments.isNotEmpty
|
padding: _attachments.isNotEmpty
|
||||||
? const EdgeInsets.only(top: 8)
|
? const EdgeInsets.only(top: 8)
|
||||||
: EdgeInsets.zero,
|
: EdgeInsets.zero,
|
||||||
child: PostMediaPendingListRaw(
|
child: PostMediaPendingList(
|
||||||
attachments: _attachments,
|
attachments: _attachments,
|
||||||
isBusy: _isBusy,
|
isBusy: _isBusy,
|
||||||
onUpdate: (idx, updatedMedia) async {
|
onUpdate: (idx, updatedMedia) async {
|
||||||
|
@ -98,6 +98,9 @@ class PostCommentSliverListState extends State<PostCommentSliverList> {
|
|||||||
child: PostItem(
|
child: PostItem(
|
||||||
data: _posts[idx],
|
data: _posts[idx],
|
||||||
maxWidth: widget.maxWidth,
|
maxWidth: widget.maxWidth,
|
||||||
|
onChanged: (data) {
|
||||||
|
setState(() => _posts[idx] = data);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
GoRouter.of(context).pushNamed(
|
GoRouter.of(context).pushNamed(
|
||||||
|
@ -106,9 +106,14 @@ class _PostBottomAction extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Icon(Symbols.add_reaction, size: 20, color: iconColor),
|
Icon(Symbols.add_reaction, size: 20, color: iconColor),
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
if (data.totalDownvote > 0 || data.totalUpvote > 0)
|
if (data.totalUpvote > 0 &&
|
||||||
Text('postReactionPoints').plural(
|
data.totalUpvote >= data.totalDownvote)
|
||||||
data.totalUpvote - data.totalDownvote,
|
Text('postReactionUpvote').plural(
|
||||||
|
data.totalUpvote,
|
||||||
|
)
|
||||||
|
else if (data.totalDownvote > 0)
|
||||||
|
Text('postReactionDownvote').plural(
|
||||||
|
data.totalDownvote,
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Text('postReact').tr(),
|
Text('postReact').tr(),
|
||||||
@ -119,12 +124,12 @@ class _PostBottomAction extends StatelessWidget {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (context) => PostReactionPopup(
|
builder: (context) => PostReactionPopup(
|
||||||
data: data,
|
data: data,
|
||||||
onChanged: (value, isPositive, delta) {
|
onChanged: (value, attr, delta) {
|
||||||
onChanged(data.copyWith(
|
onChanged(data.copyWith(
|
||||||
totalUpvote: isPositive
|
totalUpvote: attr == 1
|
||||||
? data.totalUpvote + delta
|
? data.totalUpvote + delta
|
||||||
: data.totalUpvote,
|
: data.totalUpvote,
|
||||||
totalDownvote: !isPositive
|
totalDownvote: attr == 2
|
||||||
? data.totalDownvote + delta
|
? data.totalDownvote + delta
|
||||||
: data.totalDownvote,
|
: data.totalDownvote,
|
||||||
metric: data.metric.copyWith(reactionList: value),
|
metric: data.metric.copyWith(reactionList: value),
|
||||||
|
@ -17,53 +17,13 @@ import 'package:surface/widgets/attachment/attachment_detail.dart';
|
|||||||
import 'package:surface/widgets/dialog.dart';
|
import 'package:surface/widgets/dialog.dart';
|
||||||
|
|
||||||
class PostMediaPendingList extends StatelessWidget {
|
class PostMediaPendingList extends StatelessWidget {
|
||||||
final PostWriteController controller;
|
|
||||||
|
|
||||||
const PostMediaPendingList({super.key, required this.controller});
|
|
||||||
|
|
||||||
Future<void> _handleUpdate(int idx, PostWriteMedia updatedMedia) async {
|
|
||||||
controller.setIsBusy(true);
|
|
||||||
try {
|
|
||||||
controller.setAttachmentAt(idx, updatedMedia);
|
|
||||||
} finally {
|
|
||||||
controller.setIsBusy(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _handleRemove(int idx) async {
|
|
||||||
controller.setIsBusy(true);
|
|
||||||
try {
|
|
||||||
controller.removeAttachmentAt(idx);
|
|
||||||
} finally {
|
|
||||||
controller.setIsBusy(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ListenableBuilder(
|
|
||||||
listenable: controller,
|
|
||||||
builder: (context, _) {
|
|
||||||
return PostMediaPendingListRaw(
|
|
||||||
attachments: controller.attachments,
|
|
||||||
isBusy: controller.isBusy,
|
|
||||||
onUpdate: (idx, updatedMedia) => _handleUpdate(idx, updatedMedia),
|
|
||||||
onRemove: (idx) => _handleRemove(idx),
|
|
||||||
onUpdateBusy: (state) => controller.setIsBusy(state),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class PostMediaPendingListRaw extends StatelessWidget {
|
|
||||||
final List<PostWriteMedia> attachments;
|
final List<PostWriteMedia> attachments;
|
||||||
final bool isBusy;
|
final bool isBusy;
|
||||||
final Future<void> Function(int idx, PostWriteMedia updatedMedia)? onUpdate;
|
final Future<void> Function(int idx, PostWriteMedia updatedMedia)? onUpdate;
|
||||||
final Future<void> Function(int idx)? onRemove;
|
final Future<void> Function(int idx)? onRemove;
|
||||||
final void Function(bool state)? onUpdateBusy;
|
final void Function(bool state)? onUpdateBusy;
|
||||||
|
|
||||||
const PostMediaPendingListRaw({
|
const PostMediaPendingList({
|
||||||
super.key,
|
super.key,
|
||||||
required this.attachments,
|
required this.attachments,
|
||||||
required this.isBusy,
|
required this.isBusy,
|
||||||
@ -122,24 +82,11 @@ class PostMediaPendingListRaw extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
ContextMenu _buildContextMenu(
|
||||||
Widget build(BuildContext context) {
|
BuildContext context, int idx, PostWriteMedia media) {
|
||||||
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
|
return ContextMenu(
|
||||||
|
|
||||||
return Container(
|
|
||||||
constraints: const BoxConstraints(maxHeight: 120),
|
|
||||||
child: ListView.separated(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
separatorBuilder: (context, index) => const Gap(8),
|
|
||||||
itemCount: attachments.length,
|
|
||||||
itemBuilder: (context, idx) {
|
|
||||||
final media = attachments[idx];
|
|
||||||
return ContextMenuRegion(
|
|
||||||
contextMenu: ContextMenu(
|
|
||||||
entries: [
|
entries: [
|
||||||
if (media.type == PostWriteMediaType.image &&
|
if (media.type == PostWriteMediaType.image && media.attachment != null)
|
||||||
media.attachment != null)
|
|
||||||
MenuItem(
|
MenuItem(
|
||||||
label: 'preview'.tr(),
|
label: 'preview'.tr(),
|
||||||
icon: Symbols.preview,
|
icon: Symbols.preview,
|
||||||
@ -150,8 +97,7 @@ class PostMediaPendingListRaw extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (media.type == PostWriteMediaType.image &&
|
if (media.type == PostWriteMediaType.image && media.attachment == null)
|
||||||
media.attachment == null)
|
|
||||||
MenuItem(
|
MenuItem(
|
||||||
label: 'crop'.tr(),
|
label: 'crop'.tr(),
|
||||||
icon: Symbols.crop,
|
icon: Symbols.crop,
|
||||||
@ -161,8 +107,7 @@ class PostMediaPendingListRaw extends StatelessWidget {
|
|||||||
MenuItem(
|
MenuItem(
|
||||||
label: 'delete'.tr(),
|
label: 'delete'.tr(),
|
||||||
icon: Symbols.delete,
|
icon: Symbols.delete,
|
||||||
onSelected:
|
onSelected: isBusy ? null : () => _deleteAttachment(context, idx),
|
||||||
isBusy ? null : () => _deleteAttachment(context, idx),
|
|
||||||
),
|
),
|
||||||
if (media.attachment == null && onRemove != null)
|
if (media.attachment == null && onRemove != null)
|
||||||
MenuItem(
|
MenuItem(
|
||||||
@ -181,7 +126,24 @@ class PostMediaPendingListRaw extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
constraints: const BoxConstraints(maxHeight: 120),
|
||||||
|
child: ListView.separated(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
separatorBuilder: (context, index) => const Gap(8),
|
||||||
|
itemCount: attachments.length,
|
||||||
|
itemBuilder: (context, idx) {
|
||||||
|
final media = attachments[idx];
|
||||||
|
return ContextMenuRegion(
|
||||||
|
contextMenu: _buildContextMenu(context, idx, media),
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
|
@ -11,7 +11,7 @@ import 'package:surface/widgets/dialog.dart';
|
|||||||
|
|
||||||
class PostReactionPopup extends StatefulWidget {
|
class PostReactionPopup extends StatefulWidget {
|
||||||
final SnPost data;
|
final SnPost data;
|
||||||
final Function(Map<String, int> value, bool isPositive, int delta)? onChanged;
|
final Function(Map<String, int> value, int attr, int delta)? onChanged;
|
||||||
const PostReactionPopup({super.key, required this.data, this.onChanged});
|
const PostReactionPopup({super.key, required this.data, this.onChanged});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -43,7 +43,7 @@ class _PostReactionPopupState extends State<PostReactionPopup> {
|
|||||||
if (widget.onChanged != null) {
|
if (widget.onChanged != null) {
|
||||||
widget.onChanged!(
|
widget.onChanged!(
|
||||||
_reactions,
|
_reactions,
|
||||||
kTemplateReactions[symbol]!.attitude == 1,
|
kTemplateReactions[symbol]!.attitude,
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ class _PostReactionPopupState extends State<PostReactionPopup> {
|
|||||||
if (widget.onChanged != null) {
|
if (widget.onChanged != null) {
|
||||||
widget.onChanged!(
|
widget.onChanged!(
|
||||||
_reactions,
|
_reactions,
|
||||||
kTemplateReactions[symbol]!.attitude == 1,
|
kTemplateReactions[symbol]!.attitude,
|
||||||
-1,
|
-1,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -89,11 +89,36 @@ class _PostReactionPopupState extends State<PostReactionPopup> {
|
|||||||
.textStyle(Theme.of(context).textTheme.titleLarge!),
|
.textStyle(Theme.of(context).textTheme.titleLarge!),
|
||||||
],
|
],
|
||||||
).padding(horizontal: 20, top: 16, bottom: 12),
|
).padding(horizontal: 20, top: 16, bottom: 12),
|
||||||
|
Container(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Symbols.thumb_up, size: 16),
|
||||||
|
const Gap(8),
|
||||||
|
Text('postReactionUpvote').plural(widget.data.totalUpvote),
|
||||||
|
const Gap(24),
|
||||||
|
const Icon(Symbols.thumb_down, size: 16),
|
||||||
|
const Gap(8),
|
||||||
|
Text('postReactionDownvote').plural(widget.data.totalDownvote),
|
||||||
|
const Gap(24),
|
||||||
|
Icon(
|
||||||
|
widget.data.totalUpvote >= widget.data.totalDownvote
|
||||||
|
? Symbols.trending_up
|
||||||
|
: Symbols.trending_down,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
const Gap(8),
|
||||||
|
Text('postReactionSocialPoint').plural(
|
||||||
|
widget.data.totalUpvote - widget.data.totalDownvote,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).padding(vertical: 8, horizontal: 24),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GridView.count(
|
child: GridView.extent(
|
||||||
crossAxisSpacing: 4,
|
crossAxisSpacing: 4,
|
||||||
mainAxisSpacing: 4,
|
mainAxisSpacing: 4,
|
||||||
crossAxisCount: 4,
|
maxCrossAxisExtent: 120,
|
||||||
children: kTemplateReactions.entries.map((e) {
|
children: kTemplateReactions.entries.map((e) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user