🐛 Dozens of bug fixes

This commit is contained in:
2025-07-20 02:31:50 +08:00
parent 903008d397
commit 18db50d80c
33 changed files with 359 additions and 318 deletions

View File

@@ -72,7 +72,10 @@ class PostItem extends HookConsumerWidget {
children: [
GestureDetector(
onTap: () {
context.pushNamed('publisherProfile', pathParameters: {'name': item.publisher.name});
context.pushNamed(
'publisherProfile',
pathParameters: {'name': item.publisher.name},
);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
@@ -254,7 +257,10 @@ class PostItem extends HookConsumerWidget {
GestureDetector(
child: ProfilePictureWidget(file: item.publisher.picture),
onTap: () {
context.pushNamed('publisherProfile', pathParameters: {'name': item.publisher.name});
context.pushNamed(
'publisherProfile',
pathParameters: {'name': item.publisher.name},
);
},
),
Expanded(
@@ -427,7 +433,10 @@ class PostItem extends HookConsumerWidget {
),
onTap: () {
if (isOpenable) {
context.pushNamed('postDetail', pathParameters: {'id': item.id});
context.pushNamed(
'postDetail',
pathParameters: {'id': item.id},
);
}
},
),
@@ -496,11 +505,13 @@ class PostItem extends HookConsumerWidget {
title: 'edit'.tr(),
image: MenuImage.icon(Symbols.edit),
callback: () {
context.pushNamed('postEdit', pathParameters: {'id': item.id}).then((value) {
if (value != null) {
onRefresh?.call();
}
});
context
.pushNamed('postEdit', pathParameters: {'id': item.id})
.then((value) {
if (value != null) {
onRefresh?.call();
}
});
},
),
if (isAuthor)
@@ -732,7 +743,13 @@ Widget _buildReferencePost(BuildContext context, SnPost item) {
),
],
),
).gestures(onTap: () => context.pushNamed('postDetail', pathParameters: {'id': referencePost.id}));
).gestures(
onTap:
() => context.pushNamed(
'postDetail',
pathParameters: {'id': referencePost.id},
),
);
}
class PostReactionList extends HookConsumerWidget {
@@ -757,7 +774,7 @@ class PostReactionList extends HookConsumerWidget {
submitting.value = true;
await client
.post(
'/posts/$parentId/reactions',
'/sphere/posts/$parentId/reactions',
data: {'symbol': symbol, 'attitude': attitude},
)
.catchError((err) {

View File

@@ -43,7 +43,7 @@ class PostQuickReply extends HookConsumerWidget {
try {
final client = ref.watch(apiClientProvider);
await client.post(
'/posts',
'/sphere/posts',
data: {
'content': contentController.text,
'replied_post_id': parent.id,

View File

@@ -35,7 +35,7 @@ class PostRepliesNotifier extends _$PostRepliesNotifier
final offset = cursor == null ? 0 : int.parse(cursor);
final response = await client.get(
'/posts/$_postId/replies',
'/sphere/posts/$_postId/replies',
queryParameters: {'offset': offset, 'take': _pageSize},
);
@@ -57,7 +57,11 @@ class PostRepliesNotifier extends _$PostRepliesNotifier
class PostRepliesList extends HookConsumerWidget {
final String postId;
final Color? backgroundColor;
const PostRepliesList({super.key, required this.postId, this.backgroundColor});
const PostRepliesList({
super.key,
required this.postId,
this.backgroundColor,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -93,7 +97,8 @@ class PostRepliesList extends HookConsumerWidget {
children: [
PostItem(
item: data.items[index],
backgroundColor: backgroundColor ?? (isWide ? Colors.transparent : null),
backgroundColor:
backgroundColor ?? (isWide ? Colors.transparent : null),
showReferencePost: false,
),
const Divider(height: 1),

View File

@@ -7,7 +7,7 @@ part of 'post_replies.dart';
// **************************************************************************
String _$postRepliesNotifierHash() =>
r'49c178102ec0a4136974a0e9a8f090f511abd542';
r'1cdda919249e3bf34459369e033ad5de8dbcf3f8';
/// Copied from Dart SDK
class _SystemHash {