💄 Redesigned post item
This commit is contained in:
parent
ac2aec48aa
commit
9ec0f1ff19
@ -837,5 +837,6 @@
|
|||||||
"fieldContactContent": "Contact method",
|
"fieldContactContent": "Contact method",
|
||||||
"accountContactMethodsPublicHint": "This contact method will be displayed publicly on your profile.",
|
"accountContactMethodsPublicHint": "This contact method will be displayed publicly on your profile.",
|
||||||
"accountContactMethodsDelete": "Delete Contact Method",
|
"accountContactMethodsDelete": "Delete Contact Method",
|
||||||
"accountContactMethodsDeleteDescription": "Are you sure you want to delete contact method {}? This operation is irreversible."
|
"accountContactMethodsDeleteDescription": "Are you sure you want to delete contact method {}? This operation is irreversible.",
|
||||||
|
"postCommentAdd": "Write a comment"
|
||||||
}
|
}
|
||||||
|
@ -837,5 +837,6 @@
|
|||||||
"fieldContactContent": "联系方式",
|
"fieldContactContent": "联系方式",
|
||||||
"accountContactMethodsPublicHint": "这个联系方式公开地显示在个人资料中。",
|
"accountContactMethodsPublicHint": "这个联系方式公开地显示在个人资料中。",
|
||||||
"accountContactMethodsDelete": "删除联系方式",
|
"accountContactMethodsDelete": "删除联系方式",
|
||||||
"accountContactMethodsDeleteDescription": "你确定要删除联系方式 {} 吗?这个操作不可撤销。"
|
"accountContactMethodsDeleteDescription": "你确定要删除联系方式 {} 吗?这个操作不可撤销。",
|
||||||
|
"postCommentAdd": "撰写一条评论"
|
||||||
}
|
}
|
||||||
|
@ -837,5 +837,6 @@
|
|||||||
"fieldContactContent": "聯繫方式",
|
"fieldContactContent": "聯繫方式",
|
||||||
"accountContactMethodsPublicHint": "這個聯繫方式公開地顯示在個人資料中。",
|
"accountContactMethodsPublicHint": "這個聯繫方式公開地顯示在個人資料中。",
|
||||||
"accountContactMethodsDelete": "刪除聯繫方式",
|
"accountContactMethodsDelete": "刪除聯繫方式",
|
||||||
"accountContactMethodsDeleteDescription": "你確定要刪除聯繫方式 {} 嗎?這個操作不可撤銷。"
|
"accountContactMethodsDeleteDescription": "你確定要刪除聯繫方式 {} 嗎?這個操作不可撤銷。",
|
||||||
|
"postCommentAdd": "撰寫一條評論"
|
||||||
}
|
}
|
||||||
|
@ -837,5 +837,6 @@
|
|||||||
"fieldContactContent": "聯繫方式",
|
"fieldContactContent": "聯繫方式",
|
||||||
"accountContactMethodsPublicHint": "這個聯繫方式公開地顯示在個人資料中。",
|
"accountContactMethodsPublicHint": "這個聯繫方式公開地顯示在個人資料中。",
|
||||||
"accountContactMethodsDelete": "刪除聯繫方式",
|
"accountContactMethodsDelete": "刪除聯繫方式",
|
||||||
"accountContactMethodsDeleteDescription": "你確定要刪除聯繫方式 {} 嗎?這個操作不可撤銷。"
|
"accountContactMethodsDeleteDescription": "你確定要刪除聯繫方式 {} 嗎?這個操作不可撤銷。",
|
||||||
|
"postCommentAdd": "撰寫一條評論"
|
||||||
}
|
}
|
||||||
|
@ -551,12 +551,18 @@ class _PostListWidgetState extends State<_PostListWidget> {
|
|||||||
maxWidth: 640,
|
maxWidth: 640,
|
||||||
);
|
);
|
||||||
case 'reader.news':
|
case 'reader.news':
|
||||||
return NewsFeedEntry(data: ele);
|
return Container(
|
||||||
|
constraints: BoxConstraints(maxWidth: 640),
|
||||||
|
child: NewsFeedEntry(data: ele),
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return FeedUnknownEntry(data: ele);
|
return Container(
|
||||||
|
constraints: BoxConstraints(maxWidth: 640),
|
||||||
|
child: FeedUnknownEntry(data: ele),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
separatorBuilder: (_, __) => const Gap(8),
|
separatorBuilder: (_, __) => const Divider().padding(vertical: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -7,6 +7,7 @@ import 'package:provider/provider.dart';
|
|||||||
import 'package:responsive_framework/responsive_framework.dart';
|
import 'package:responsive_framework/responsive_framework.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:surface/providers/post.dart';
|
import 'package:surface/providers/post.dart';
|
||||||
|
import 'package:surface/providers/sn_network.dart';
|
||||||
import 'package:surface/providers/userinfo.dart';
|
import 'package:surface/providers/userinfo.dart';
|
||||||
import 'package:surface/types/post.dart';
|
import 'package:surface/types/post.dart';
|
||||||
import 'package:surface/widgets/dialog.dart';
|
import 'package:surface/widgets/dialog.dart';
|
||||||
@ -14,14 +15,13 @@ import 'package:surface/widgets/post/post_item.dart';
|
|||||||
import 'package:surface/widgets/post/post_mini_editor.dart';
|
import 'package:surface/widgets/post/post_mini_editor.dart';
|
||||||
import 'package:very_good_infinite_list/very_good_infinite_list.dart';
|
import 'package:very_good_infinite_list/very_good_infinite_list.dart';
|
||||||
|
|
||||||
import '../../providers/sn_network.dart';
|
|
||||||
|
|
||||||
class PostCommentQuickAction extends StatelessWidget {
|
class PostCommentQuickAction extends StatelessWidget {
|
||||||
final double? maxWidth;
|
final double? maxWidth;
|
||||||
final SnPost parentPost;
|
final SnPost parentPost;
|
||||||
final Function? onPosted;
|
final Function? onPosted;
|
||||||
|
|
||||||
const PostCommentQuickAction({super.key, this.maxWidth, required this.parentPost, this.onPosted});
|
const PostCommentQuickAction(
|
||||||
|
{super.key, this.maxWidth, required this.parentPost, this.onPosted});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -30,7 +30,9 @@ class PostCommentQuickAction extends StatelessWidget {
|
|||||||
return Container(
|
return Container(
|
||||||
height: 240,
|
height: 240,
|
||||||
constraints: BoxConstraints(maxWidth: maxWidth ?? double.infinity),
|
constraints: BoxConstraints(maxWidth: maxWidth ?? double.infinity),
|
||||||
margin: ResponsiveBreakpoints.of(context).largerThan(MOBILE) ? const EdgeInsets.symmetric(vertical: 8) : EdgeInsets.zero,
|
margin: ResponsiveBreakpoints.of(context).largerThan(MOBILE)
|
||||||
|
? const EdgeInsets.symmetric(vertical: 8)
|
||||||
|
: EdgeInsets.zero,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: ResponsiveBreakpoints.of(context).largerThan(MOBILE)
|
borderRadius: ResponsiveBreakpoints.of(context).largerThan(MOBILE)
|
||||||
? const BorderRadius.all(Radius.circular(8))
|
? const BorderRadius.all(Radius.circular(8))
|
||||||
@ -99,7 +101,8 @@ class PostCommentSliverListState extends State<PostCommentSliverList> {
|
|||||||
Future<void> _selectAnswer(SnPost answer) async {
|
Future<void> _selectAnswer(SnPost answer) async {
|
||||||
try {
|
try {
|
||||||
final sn = context.read<SnNetworkProvider>();
|
final sn = context.read<SnNetworkProvider>();
|
||||||
await sn.client.put('/cgi/co/questions/${widget.parentPost.id}/answer', data: {
|
await sn.client
|
||||||
|
.put('/cgi/co/questions/${widget.parentPost.id}/answer', data: {
|
||||||
'publisher': answer.publisherId,
|
'publisher': answer.publisherId,
|
||||||
'answer_id': answer.id,
|
'answer_id': answer.id,
|
||||||
});
|
});
|
||||||
@ -135,7 +138,9 @@ class PostCommentSliverListState extends State<PostCommentSliverList> {
|
|||||||
child: PostItem(
|
child: PostItem(
|
||||||
data: _posts[idx],
|
data: _posts[idx],
|
||||||
maxWidth: widget.maxWidth,
|
maxWidth: widget.maxWidth,
|
||||||
onSelectAnswer: widget.parentPost.type == 'question' ? () => _selectAnswer(_posts[idx]) : null,
|
onSelectAnswer: widget.parentPost.type == 'question'
|
||||||
|
? () => _selectAnswer(_posts[idx])
|
||||||
|
: null,
|
||||||
onChanged: (data) {
|
onChanged: (data) {
|
||||||
setState(() => _posts[idx] = data);
|
setState(() => _posts[idx] = data);
|
||||||
},
|
},
|
||||||
@ -153,7 +158,8 @@ class PostCommentSliverListState extends State<PostCommentSliverList> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
separatorBuilder: (context, index) => const Divider(height: 1),
|
separatorBuilder: (context, index) =>
|
||||||
|
const Divider().padding(vertical: 2),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,7 +194,9 @@ class _PostCommentListPopupState extends State<PostCommentListPopup> {
|
|||||||
children: [
|
children: [
|
||||||
const Icon(Symbols.comment, size: 24),
|
const Icon(Symbols.comment, size: 24),
|
||||||
const Gap(16),
|
const Gap(16),
|
||||||
Text('postCommentsDetailed').plural(widget.commentCount).textStyle(Theme.of(context).textTheme.titleLarge!),
|
Text('postCommentsDetailed')
|
||||||
|
.plural(widget.commentCount)
|
||||||
|
.textStyle(Theme.of(context).textTheme.titleLarge!),
|
||||||
],
|
],
|
||||||
).padding(horizontal: 20, top: 16, bottom: 12),
|
).padding(horizontal: 20, top: 16, bottom: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user