Compare commits
No commits in common. "dc1ce941450b863c0ddd49bfcb0f6f7b8badd3a4" and "23301764eea1f6eb271b56d3e1796888729344f3" have entirely different histories.
dc1ce94145
...
23301764ee
@ -211,9 +211,6 @@
|
||||
"other": "{} results"
|
||||
},
|
||||
"postSearchTook": "Took {}",
|
||||
"postDelete": "Delete post {}",
|
||||
"postDeleteDescription": "Are you sure you want to delete this post? This operation is irreversible.",
|
||||
"postDeleted": "Post {} has been deleted.",
|
||||
"call" : "Call",
|
||||
"callOngoingNotice": "A call is ongoing",
|
||||
"callJoin": "Join",
|
||||
@ -247,8 +244,6 @@
|
||||
"dailyCheckAction": "Check in right now!",
|
||||
"dailyCheckDetail": "Can't understand the symbol? Master, help me understand it!",
|
||||
"dailyCheckDetailTitle": "{}'s fortune details",
|
||||
"dailyCheckPositiveHint": "Good for {}",
|
||||
"dailyCheckNegativeHint": "Bad for {}",
|
||||
"dailyCheckPositiveHint1": "Making friends",
|
||||
"dailyCheckPositiveHint1Description": "Friendship lasts forever",
|
||||
"dailyCheckPositiveHint2": "Drinking",
|
||||
|
@ -168,7 +168,7 @@
|
||||
"fieldChatBelongToRealm": "所属领域",
|
||||
"fieldChatBelongToRealmUnset": "未设置频道所属领域",
|
||||
"channelEditingNotice": "您正在编辑频道 {}",
|
||||
"channelDeleted": "聊天频道 {} 已被删除",
|
||||
"channelDeleted": "聊天频道 {} 已被删除" ,
|
||||
"channelDelete": "删除聊天频道 {}",
|
||||
"channelDeleteDescription": "你确定要删除这个聊天频道吗?该操作不可撤销,其频道内的所有消息将被永久删除。",
|
||||
"fieldRealmAlias": "领域别名",
|
||||
@ -176,7 +176,7 @@
|
||||
"fieldRealmName": "名称",
|
||||
"fieldRealmDescription": "描述",
|
||||
"realmEditingNotice": "您正在编辑领域 {}",
|
||||
"realmDeleted": "领域 {} 已被删除",
|
||||
"realmDeleted": "领域 {} 已被删除" ,
|
||||
"realmDelete": "删除领域 {}",
|
||||
"realmDeleteDescription": "你确定要删除这个领域吗?该操作不可撤销,其隶属于该领域的所有资源(帖子、聊天频道、发布者、制品等)都将被永久删除。三思而后行!",
|
||||
"fieldChatMessage": "在 {} 中发消息",
|
||||
@ -194,7 +194,7 @@
|
||||
},
|
||||
"addAttachmentFromAlbum": "从相册中添加附件",
|
||||
"addAttachmentFromClipboard": "粘贴附件",
|
||||
"attachmentPastedImage": "粘贴的图片",
|
||||
"attachmentPastedImage" : "粘贴的图片",
|
||||
"notificationUnread": "未读",
|
||||
"notificationRead": "已读",
|
||||
"notificationMarkAllRead": "已读所有通知",
|
||||
@ -211,9 +211,6 @@
|
||||
"other": "搜索到 {} 个结果"
|
||||
},
|
||||
"postSearchTook": "耗时 {}",
|
||||
"postDelete": "删除帖子 {}",
|
||||
"postDeleteDescription": "你确定要删除这个帖子吗?该操作不可撤销。",
|
||||
"postDeleted": "帖子 {} 已被删除。",
|
||||
"call": "通话",
|
||||
"callOngoingNotice": "一则通话进行中",
|
||||
"callJoin": "加入",
|
||||
@ -247,8 +244,8 @@
|
||||
"dailyCheckAction": "现在签到",
|
||||
"dailyCheckDetail": "看不懂符?大师帮我解惑!",
|
||||
"dailyCheckDetailTitle": "{} 的运势详情",
|
||||
"dailyCheckPositiveHint": "宜 {}",
|
||||
"dailyCheckNegativeHint": "忌 {}",
|
||||
"dailyCheckPositiveHint": "宜 {}",
|
||||
"dailyCheckNegativeHint": "忌 {}",
|
||||
"dailyCheckPositiveHint1": "交友",
|
||||
"dailyCheckPositiveHint1Description": "友谊地久天长",
|
||||
"dailyCheckPositiveHint2": "饮酒",
|
||||
|
@ -164,10 +164,6 @@ class _ExploreScreenState extends State<ExploreScreen> {
|
||||
onChanged: (data) {
|
||||
setState(() => _posts[idx] = data);
|
||||
},
|
||||
onDeleted: () {
|
||||
_posts.clear();
|
||||
_fetchPosts();
|
||||
},
|
||||
),
|
||||
onTap: () {
|
||||
GoRouter.of(context).pushNamed(
|
||||
|
@ -1,5 +1,3 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
@ -142,6 +140,9 @@ class _HomeDashCheckInWidgetState extends State<_HomeDashCheckInWidget> {
|
||||
final sn = context.read<SnNetworkProvider>();
|
||||
final resp = await sn.client.get('/cgi/id/check-in/today');
|
||||
_todayRecord = SnCheckInRecord.fromJson(resp.data);
|
||||
} catch (err) {
|
||||
if (!mounted) return;
|
||||
context.showErrorDialog(err);
|
||||
} finally {
|
||||
setState(() => _isBusy = false);
|
||||
}
|
||||
@ -166,19 +167,20 @@ class _HomeDashCheckInWidgetState extends State<_HomeDashCheckInWidget> {
|
||||
positive ? 'dailyCheckPositiveHint' : 'dailyCheckNegativeHint';
|
||||
final mod =
|
||||
positive ? kSuggestionPositiveHintCount : kSuggestionNegativeHintCount;
|
||||
final pos = math.max(1, _todayRecord!.resultModifiers[index] % mod);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
prefix.tr(args: ['$prefix$pos'.tr()]),
|
||||
prefix.tr(args: [
|
||||
'$prefix${_todayRecord!.resultModifiers[index] % mod}'.tr()
|
||||
]),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(fontWeight: FontWeight.bold),
|
||||
).tr(),
|
||||
Text(
|
||||
'$prefix${pos}Description',
|
||||
'$prefix${_todayRecord!.resultModifiers[index] % kSuggestionPositiveHintCount}Description',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
).tr(),
|
||||
],
|
||||
|
@ -113,9 +113,6 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
|
||||
onChanged: (data) {
|
||||
setState(() => _data = data);
|
||||
},
|
||||
onDeleted: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SliverToBoxAdapter(child: Divider(height: 1)),
|
||||
|
@ -101,10 +101,6 @@ class _PostSearchScreenState extends State<PostSearchScreen> {
|
||||
onChanged: (data) {
|
||||
setState(() => _posts[idx] = data);
|
||||
},
|
||||
onDeleted: () {
|
||||
_posts.clear();
|
||||
_fetchPosts();
|
||||
},
|
||||
),
|
||||
onTap: () {
|
||||
GoRouter.of(context).pushNamed(
|
||||
|
@ -74,10 +74,6 @@ class PostCommentSliverListState extends State<PostCommentSliverList> {
|
||||
onChanged: (data) {
|
||||
setState(() => _posts[idx] = data);
|
||||
},
|
||||
onDeleted: () {
|
||||
_posts.clear();
|
||||
_fetchPosts();
|
||||
},
|
||||
),
|
||||
onTap: () {
|
||||
GoRouter.of(context).pushNamed(
|
||||
|
@ -5,12 +5,10 @@ import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:relative_time/relative_time.dart';
|
||||
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/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';
|
||||
@ -23,7 +21,6 @@ class PostItem extends StatelessWidget {
|
||||
final bool showMenu;
|
||||
final double? maxWidth;
|
||||
final Function(SnPost data)? onChanged;
|
||||
final Function()? onDeleted;
|
||||
const PostItem({
|
||||
super.key,
|
||||
required this.data,
|
||||
@ -32,7 +29,6 @@ class PostItem extends StatelessWidget {
|
||||
this.showMenu = true,
|
||||
this.maxWidth,
|
||||
this.onChanged,
|
||||
this.onDeleted,
|
||||
});
|
||||
|
||||
void _onChanged(SnPost data) {
|
||||
@ -49,13 +45,8 @@ class PostItem extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_PostContentHeader(
|
||||
data: data,
|
||||
showMenu: showMenu,
|
||||
onDeleted: () {
|
||||
if (onDeleted != null) onDeleted!();
|
||||
},
|
||||
).padding(horizontal: 12, vertical: 8),
|
||||
_PostContentHeader(data: data, showMenu: showMenu)
|
||||
.padding(horizontal: 12, vertical: 8),
|
||||
if (data.body['title'] != null ||
|
||||
data.body['description'] != null)
|
||||
_PostHeadline(data: data).padding(horizontal: 16, bottom: 8),
|
||||
@ -226,37 +217,12 @@ class _PostContentHeader extends StatelessWidget {
|
||||
final SnPost data;
|
||||
final bool isCompact;
|
||||
final bool showMenu;
|
||||
final Function onDeleted;
|
||||
const _PostContentHeader({
|
||||
required this.data,
|
||||
this.isCompact = false,
|
||||
this.showMenu = true,
|
||||
required this.onDeleted,
|
||||
});
|
||||
|
||||
Future<void> _deletePost(BuildContext context) async {
|
||||
final confirm = await context.showConfirmDialog(
|
||||
'postDelete'.tr(args: ['#${data.id}']),
|
||||
'postDeleteDescription'.tr(),
|
||||
);
|
||||
|
||||
if (!confirm) return;
|
||||
if (!context.mounted) return;
|
||||
|
||||
try {
|
||||
final sn = context.read<SnNetworkProvider>();
|
||||
await sn.client.delete('/cgi/co/posts/${data.id}', queryParameters: {
|
||||
'publisherId': data.publisherId,
|
||||
});
|
||||
|
||||
if (!context.mounted) return;
|
||||
context.showSnackbar('postDeleted'.tr(args: ['#${data.id}']));
|
||||
} catch (err) {
|
||||
if (!context.mounted) return;
|
||||
context.showErrorDialog(err);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ua = context.read<UserProvider>();
|
||||
@ -336,7 +302,6 @@ class _PostContentHeader extends StatelessWidget {
|
||||
Text('delete').tr(),
|
||||
],
|
||||
),
|
||||
onTap: () => _deletePost(context),
|
||||
),
|
||||
if (isAuthor) const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
@ -416,12 +381,8 @@ class _PostQuoteContent extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Column(
|
||||
children: [
|
||||
_PostContentHeader(
|
||||
data: child,
|
||||
isCompact: true,
|
||||
showMenu: false,
|
||||
onDeleted: () {},
|
||||
).padding(bottom: 4),
|
||||
_PostContentHeader(data: child, isCompact: true, showMenu: false)
|
||||
.padding(bottom: 4),
|
||||
_PostContentBody(data: child.body),
|
||||
],
|
||||
),
|
||||
|
Loading…
x
Reference in New Issue
Block a user